From f7d415b7eb52daaeea8958e7daac0ddae981aed5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 10 May 2026 16:56:24 +0300 Subject: [PATCH] LocationID updates --- .../models/get_pharmacy_invoices_response_model.dart | 7 +++++-- lib/features/my_invoices/my_invoices_repo.dart | 5 +++-- lib/features/my_invoices/my_invoices_view_model.dart | 4 ++-- lib/features/todo_section/todo_section_view_model.dart | 8 ++++++-- lib/presentation/my_invoices/my_invoices_list.dart | 1 + 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/features/my_invoices/models/get_pharmacy_invoices_response_model.dart b/lib/features/my_invoices/models/get_pharmacy_invoices_response_model.dart index 2128e4e1..458d512a 100644 --- a/lib/features/my_invoices/models/get_pharmacy_invoices_response_model.dart +++ b/lib/features/my_invoices/models/get_pharmacy_invoices_response_model.dart @@ -14,11 +14,12 @@ class GetPharmacyInvoicesResponseModel { String? doctorNameN; String? displayInvoiceNo; String? clinicName; - double? decimalDoctorRate; + num? decimalDoctorRate; String? doctorImageURL; num? doctorRate; num? patientNumber; String? projectName; + dynamic locationID; GetPharmacyInvoicesResponseModel( {this.setupId, @@ -40,7 +41,7 @@ class GetPharmacyInvoicesResponseModel { this.doctorImageURL, this.doctorRate, this.patientNumber, - this.projectName}); + this.projectName, this.locationID}); GetPharmacyInvoicesResponseModel.fromJson(Map json) { setupId = json['SetupId']; @@ -63,6 +64,7 @@ class GetPharmacyInvoicesResponseModel { doctorRate = json['DoctorRate']; patientNumber = json['PatientNumber']; projectName = json['ProjectName']; + locationID = json['LocationId']; } Map toJson() { @@ -87,6 +89,7 @@ class GetPharmacyInvoicesResponseModel { data['DoctorRate'] = this.doctorRate; data['PatientNumber'] = this.patientNumber; data['ProjectName'] = this.projectName; + data['LocationId'] = this.locationID; return data; } } diff --git a/lib/features/my_invoices/my_invoices_repo.dart b/lib/features/my_invoices/my_invoices_repo.dart index cee29489..23f5d06a 100644 --- a/lib/features/my_invoices/my_invoices_repo.dart +++ b/lib/features/my_invoices/my_invoices_repo.dart @@ -19,7 +19,7 @@ abstract class MyInvoicesRepo { Future>> downloadInvoice({required String setupId, required int invoiceNo, required int projectID}); - Future>> downloadPharmacyInvoice({required String setupId, required int invoiceNo, required int projectID}); + Future>> downloadPharmacyInvoice({required String setupId, required int invoiceNo, required int projectID, required dynamic locationID}); } class MyInvoicesRepoImp implements MyInvoicesRepo { @@ -226,11 +226,12 @@ class MyInvoicesRepoImp implements MyInvoicesRepo { } @override - Future> downloadPharmacyInvoice({required String setupId, required int invoiceNo, required int projectID}) async { + Future> downloadPharmacyInvoice({required String setupId, required int invoiceNo, required int projectID, required dynamic locationID}) async { Map mapDevice = { "SetupID": setupId, "ProjectID": projectID, "InvoiceNo": invoiceNo, + "LocationID": locationID, }; try { diff --git a/lib/features/my_invoices/my_invoices_view_model.dart b/lib/features/my_invoices/my_invoices_view_model.dart index f39ba65b..49d37927 100644 --- a/lib/features/my_invoices/my_invoices_view_model.dart +++ b/lib/features/my_invoices/my_invoices_view_model.dart @@ -193,8 +193,8 @@ class MyInvoicesViewModel extends ChangeNotifier { ); } - Future downloadPharmacyInvoicePDF({required String setupId, required int invoiceNo, required int projectID, Function(dynamic)? onSuccess, Function(String)? onError}) async { - final result = await myInvoicesRepo.downloadPharmacyInvoice(setupId: setupId, invoiceNo: invoiceNo, projectID: projectID); + Future downloadPharmacyInvoicePDF({required String setupId, required int invoiceNo, required int projectID, required dynamic locationID, Function(dynamic)? onSuccess, Function(String)? onError}) async { + final result = await myInvoicesRepo.downloadPharmacyInvoice(setupId: setupId, invoiceNo: invoiceNo, projectID: projectID, locationID: locationID); result.fold( (failure) async { diff --git a/lib/features/todo_section/todo_section_view_model.dart b/lib/features/todo_section/todo_section_view_model.dart index b14e4ead..131774d6 100644 --- a/lib/features/todo_section/todo_section_view_model.dart +++ b/lib/features/todo_section/todo_section_view_model.dart @@ -51,8 +51,12 @@ class TodoSectionViewModel extends ChangeNotifier { // if (apiResponse.messageStatus == 2) { // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); // } else if (apiResponse.messageStatus == 1) { - notificationsCount = - apiResponse['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : apiResponse['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + if (apiResponse['List_PatientDashboard'] != null && apiResponse['List_PatientDashboard'] is List && (apiResponse['List_PatientDashboard'] as List).isNotEmpty) { + notificationsCount = + apiResponse['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : apiResponse['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + } else { + notificationsCount = "0"; + } notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); diff --git a/lib/presentation/my_invoices/my_invoices_list.dart b/lib/presentation/my_invoices/my_invoices_list.dart index d23639b9..2dbbaf12 100644 --- a/lib/presentation/my_invoices/my_invoices_list.dart +++ b/lib/presentation/my_invoices/my_invoices_list.dart @@ -377,6 +377,7 @@ class _MyInvoicesListState extends State { setupId: myInvoicesVM.allPharmacyInvoicesList[index].setupId ?? "", invoiceNo: myInvoicesVM.allPharmacyInvoicesList[index].invoiceNo ?? 0, projectID: myInvoicesVM.allPharmacyInvoicesList[index].projectID ?? 0, + locationID: myInvoicesVM.allPharmacyInvoicesList[index].locationID ?? 0, onError: (err) { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight(