Skip to content

Commit

Permalink
Merge pull request #912 from egovernments/ISTE-12_2
Browse files Browse the repository at this point in the history
Iste 12 2
  • Loading branch information
pradeepkumarcm-egov authored Aug 16, 2024
2 parents c585125 + 9e1df77 commit f3ac954
Show file tree
Hide file tree
Showing 24 changed files with 1,203 additions and 114 deletions.
50 changes: 26 additions & 24 deletions frontend/mgramseva/lib/components/dashboard/bills_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ class _BillsTable extends State<BillsTable> {
}

String getCurrentRoutePath(BuildContext context) {
final currentRoute = ModalRoute.of(context)!;
return currentRoute.settings.name ?? '';
}
final currentRoute = ModalRoute.of(context)!;
return currentRoute.settings.name ?? '';
}

Widget _generateFirstColumnRow(BuildContext context, int index) {

return LayoutBuilder(builder: (context, constraints) {
bool showLeadger = getCurrentRoutePath(context) == "/home/householdRegister";
bool showLeadger =
getCurrentRoutePath(context) == "/home/householdRegister";
var data = widget.tableData[index].tableRow.first;

return ScrollParent(
widget.scrollController,
Row(
Expand All @@ -184,7 +184,9 @@ class _BillsTable extends State<BillsTable> {
style: widget.tableData[index].tableRow.first.style ??
TextStyle(color: Theme.of(context).primaryColor),
),
width: showLeadger ? widget.leftColumnWidth * 0.55 : widget.leftColumnWidth,
width: showLeadger
? widget.leftColumnWidth * 0.55
: widget.leftColumnWidth,
height:
widget.tableData[index].tableRow.first.label.length > 28
? columnRowIncreasedHeight(index)
Expand All @@ -194,16 +196,18 @@ class _BillsTable extends State<BillsTable> {
alignment: Alignment.centerLeft,
),
),
if(showLeadger)
Tooltip(
message: '${i18.dashboard.LEDGER_REPORTS}',

child: IconButton(onPressed: () {
if (data.iconButtonCallBack != null) {
data.iconButtonCallBack!(data);
}
}, icon: Icon(Icons.insert_chart_outlined)),
)
if (showLeadger)
Tooltip(
message:
'${ApplicationLocalizations.of(context).translate(i18.dashboard.LEDGER_REPORTS)}',
child: IconButton(
onPressed: () {
if (data.iconButtonCallBack != null) {
data.iconButtonCallBack!(data);
}
},
icon: Icon(Icons.insert_chart_outlined)),
)
],
));
});
Expand Down Expand Up @@ -269,13 +273,11 @@ class _BillsTable extends State<BillsTable> {
return LayoutBuilder(builder: (context, constraints) {
var list = <Widget>[];
for (int i = 1; i < data.tableRow.length; i++) {

list.add(
_generateColumnRow(
context, index, data.tableRow[i].label, constraints,
style: data.tableRow[i].style),
);

list.add(
_generateColumnRow(
context, index, data.tableRow[i].label, constraints,
style: data.tableRow[i].style),
);
}
return Container(
color: index % 2 == 0 ? const Color(0xffEEEEEE) : Colors.white,
Expand Down
111 changes: 111 additions & 0 deletions frontend/mgramseva/lib/model/reports/monthly_ledger_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
class MonthReport {
final List<MonthReportData>? monthReport;
final String? tenantName;
final String? monthPeriod;
final ResponseInfo? responseInfo;

MonthReport({
this.monthReport,
this.tenantName,
this.monthPeriod,
this.responseInfo,
});

factory MonthReport.fromJson(Map<String, dynamic> json) {
return MonthReport(
monthReport: (json['monthReport'] as List<dynamic>?)
?.map((e) => MonthReportData.fromJson(e))
.toList(),
tenantName: json['tenantName'] as String?,
monthPeriod: json['monthPeriod'] as String?,
responseInfo: json['responseInfo'] != null
? ResponseInfo.fromJson(json['responseInfo'])
: null,
);
}
}

class MonthReportData {
final String? tenantName;
final String? connectionNo;
final String? oldConnectionNo;
final int? consumerCreatedOnDate;
final String? consumerName;
final String? userId;
final int? demandGenerationDate;
final double? penalty;
final double? demandAmount;
final double? advance;
final double? arrears;
final double? totalAmount;
final double? amountPaid;
final int? paidDate;
final double? remainingAmount;

MonthReportData({
this.tenantName,
this.connectionNo,
this.oldConnectionNo,
this.consumerCreatedOnDate,
this.consumerName,
this.userId,
this.demandGenerationDate,
this.penalty,
this.demandAmount,
this.advance,
this.arrears,
this.totalAmount,
this.amountPaid,
this.paidDate,
this.remainingAmount,
});

factory MonthReportData.fromJson(Map<String, dynamic> json) {
return MonthReportData(
tenantName: json['tenantName'] as String?,
connectionNo: json['connectionNo'] as String?,
oldConnectionNo: json['oldConnectionNo'] as String?,
consumerCreatedOnDate: json['consumerCreatedOnDate'] as int?,
consumerName: json['consumerName'] as String?,
userId: json['userId'] as String?,
demandGenerationDate: json['demandGenerationDate'] as int?,
penalty: (json['penalty'] as num?)?.toDouble(),
demandAmount: (json['demandAmount'] as num?)?.toDouble(),
advance: (json['advance'] as num?)?.toDouble(),
arrears: (json['arrears'] as num?)?.toDouble(),
totalAmount: (json['totalAmount'] as num?)?.toDouble(),
amountPaid: (json['amountPaid'] as num?)?.toDouble(),
paidDate: json['paidDate'] as int?,
remainingAmount: (json['remainingAmount'] as num?)?.toDouble(),
);
}
}

class ResponseInfo {
final String apiId;
final String ver;
final dynamic ts;
final String resMsgId;
final String msgId;
final String status;

ResponseInfo({
required this.apiId,
required this.ver,
required this.ts,
required this.resMsgId,
required this.msgId,
required this.status,
});

factory ResponseInfo.fromJson(Map<String, dynamic> json) {
return ResponseInfo(
apiId: json['apiId'],
ver: json['ver'],
ts: json['ts'],
resMsgId: json['resMsgId'],
msgId: json['msgId'],
status: json['status'],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class HouseholdRegisterProvider with ChangeNotifier {
callBack: onSort),
TableHeader(i18.householdRegister.ACTIVE_INACTIVE,
isSortingRequired: false, apiKey: 'leadgerReport'),
// TableHeader("Ledger", apiKey: '/viewLeadger')
// TableHeader("Ledger", apiKey: '/viewLeadger')
];
List<TableHeader> get collectionHeaderListOLd => [
TableHeader(i18.common.CONNECTION_ID,
Expand Down Expand Up @@ -297,7 +297,6 @@ class HouseholdRegisterProvider with ChangeNotifier {
? sortBy!.isAscending
: null,
callBack: onSort),

];

List<TableDataRow> getCollectionsData(List<WaterConnection> list) {
Expand Down Expand Up @@ -338,7 +337,6 @@ class HouseholdRegisterProvider with ChangeNotifier {
callBack: onClickOfCollectionNo,
iconButtonCallBack: viewLeadger,
apiKey: connection.connectionNo),

TableData(
'${name ?? 'NA'}',
),
Expand Down Expand Up @@ -423,12 +421,12 @@ class HouseholdRegisterProvider with ChangeNotifier {
'status': waterConnection?.status
});
}

viewLeadger(TableData tableData) {
log("Call Ledger View Here");
var waterConnection = waterConnectionsDetails?.waterConnection
var waterConnection = waterConnectionsDetails?.waterConnection
?.firstWhere((element) => element.connectionNo == tableData.apiKey);
Navigator.pushNamed(navigatorKey.currentContext!, Routes.LEDGER_REPORTS,
arguments: {
arguments: {
'waterconnections': waterConnection,
});
}
Expand Down
Loading

0 comments on commit f3ac954

Please sign in to comment.