This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
960bcff
commit a7676c9
Showing
8 changed files
with
286 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
frontend/mgramseva/lib/model/reports/vendor_report_data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class VendorReportData { | ||
String? tenantId; | ||
String? vendorName; | ||
String? mobileNo; | ||
String? typeOfExpense; | ||
String? billId; | ||
String? ownerUuid; | ||
|
||
VendorReportData( | ||
{this.tenantId, | ||
this.vendorName, | ||
this.mobileNo, | ||
this.typeOfExpense, | ||
this.billId, | ||
this.ownerUuid}); | ||
|
||
VendorReportData.fromJson(Map<String, dynamic> json) { | ||
tenantId = json['tenantId']; | ||
vendorName = json['vendor_name']; | ||
mobileNo = json['mobile_no']; | ||
typeOfExpense = json['type_of_expense']; | ||
billId = json['bill_id']; | ||
ownerUuid = json['owner_uuid']; | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['tenantId'] = this.tenantId; | ||
data['vendor_name'] = this.vendorName; | ||
data['mobile_no'] = this.mobileNo; | ||
data['type_of_expense'] = this.typeOfExpense; | ||
data['bill_id'] = this.billId; | ||
data['owner_uuid'] = this.ownerUuid; | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
frontend/mgramseva/lib/screeens/reports/vendor_report.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
import '../../providers/reports_provider.dart'; | ||
import '../../utils/localization/application_localizations.dart'; | ||
import 'package:mgramseva/utils/constants/i18_key_constants.dart'; | ||
import '../../utils/notifiers.dart'; | ||
import '../../utils/testing_keys/testing_keys.dart'; | ||
import '../../widgets/button.dart'; | ||
|
||
class VendorReport extends StatefulWidget { | ||
final Function onViewClick; | ||
|
||
VendorReport({Key? key, required this.onViewClick}) : super(key: key); | ||
|
||
@override | ||
State<StatefulWidget> createState() => _VendorReportState(); | ||
} | ||
|
||
class _VendorReportState extends State<VendorReport> | ||
with SingleTickerProviderStateMixin { | ||
@override | ||
Widget build(BuildContext context) { | ||
return LayoutBuilder(builder: (context, constraints) | ||
{ | ||
final isWideScreen = constraints.maxWidth > 700; | ||
final containerMargin = isWideScreen | ||
? const EdgeInsets.only(top: 5.0, bottom: 5, right: 20, left: 10) | ||
: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 8); | ||
return Consumer<ReportsProvider>(builder: (_, reportProvider, child) { | ||
return Container( | ||
margin: containerMargin, | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: [ | ||
SizedBox( | ||
height: 30, | ||
), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Container( | ||
width: constraints.maxWidth > 344 ? constraints.maxWidth / | ||
2.5 : constraints.maxWidth / 3, | ||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
"5. ", | ||
style: TextStyle( | ||
fontSize: 14, fontWeight: FontWeight.w700), | ||
), | ||
Expanded( | ||
child: Text( | ||
ApplicationLocalizations.of(context) | ||
.translate(i18.dashboard.VENDOR_REPORT), | ||
maxLines: 3, | ||
style: TextStyle( | ||
fontSize: 14, fontWeight: FontWeight.w700), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
Row( | ||
children: [ | ||
Container( | ||
width: 50, | ||
child: Button( | ||
ApplicationLocalizations.of(context) | ||
.translate(i18.common.VIEW), | ||
() { | ||
if (reportProvider.selectedBillPeriod == null) { | ||
Notifiers.getToastMessage( | ||
context, 'Select Billing Cycle', 'ERROR'); | ||
} else { | ||
reportProvider.clearTableData(); | ||
reportProvider.getVendorReport(); | ||
widget.onViewClick( | ||
true, i18.dashboard.VENDOR_REPORT); | ||
} | ||
}, | ||
key: Keys.billReport.VENDOR_REPORT_VIEW_BUTTON, | ||
), | ||
), | ||
SizedBox( | ||
width: 10, | ||
), | ||
TextButton.icon( | ||
onPressed: () { | ||
if (reportProvider.selectedBillPeriod == null) { | ||
Notifiers.getToastMessage( | ||
context, 'Select Billing Cycle', 'ERROR'); | ||
} else { | ||
reportProvider.getVendorReport( | ||
download: true); | ||
} | ||
}, | ||
icon: Icon(Icons.download_sharp), | ||
label: Text(ApplicationLocalizations.of(context) | ||
.translate(i18.common.CORE_DOWNLOAD))), | ||
], | ||
), | ||
], | ||
), | ||
], | ||
), | ||
); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters