From 6075da95ea1ee9885c72102ce997276a626d7be4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 23 Jul 2026 15:33:36 +0300 Subject: [PATCH] Updates & fixes --- lib/core/api_consts.dart | 2 +- lib/features/insurance/insurance_view_model.dart | 10 ---------- lib/features/my_appointments/my_appointments_repo.dart | 6 +++--- .../my_appointments/my_appointments_view_model.dart | 5 ----- .../insurance/insurance_approval_details_page.dart | 2 +- 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 8f2deaa3..8f1455ad 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -5,7 +5,7 @@ import 'package:hmg_patient_app_new/core/enums.dart'; class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/features/insurance/insurance_view_model.dart b/lib/features/insurance/insurance_view_model.dart index 621ebe4c..2422920a 100644 --- a/lib/features/insurance/insurance_view_model.dart +++ b/lib/features/insurance/insurance_view_model.dart @@ -33,14 +33,10 @@ class InsuranceViewModel extends ChangeNotifier { InsuranceViewModel({required this.insuranceRepo, required this.errorHandlerService}); initInsuranceProvider() { - debugPrint("InsuranceViewModel: initInsuranceProvider called, isInsuranceDataToBeLoaded=$isInsuranceDataToBeLoaded"); if (isInsuranceDataToBeLoaded) { patientInsuranceList.clear(); isInsuranceLoading = true; - debugPrint("InsuranceViewModel: Calling getPatientInsuranceDetails API"); getPatientInsuranceDetails(); - } else { - debugPrint("InsuranceViewModel: Skipping API call, isInsuranceDataToBeLoaded is false"); } patientInsuranceCardHistoryList.clear(); isInsuranceHistoryLoading = true; @@ -82,17 +78,14 @@ class InsuranceViewModel extends ChangeNotifier { Future getPatientInsuranceDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async { if (!isInsuranceDataToBeLoaded) { - debugPrint("InsuranceViewModel: getPatientInsuranceDetails - skipping, flag is false"); return; } - debugPrint("InsuranceViewModel: getPatientInsuranceDetails - making API call"); final result = await insuranceRepo.getPatientInsuranceDetails(); result.fold( // (failure) async => await errorHandlerService.handleError(failure: failure), (failure) async { - debugPrint("InsuranceViewModel: API call failed - ${failure.toString()}"); isInsuranceLoading = false; isInsuranceDataToBeLoaded = true; isInsuranceExpired = false; @@ -102,11 +95,9 @@ class InsuranceViewModel extends ChangeNotifier { }, (apiResponse) { if (apiResponse.messageStatus == 2) { - debugPrint("InsuranceViewModel: API returned error status"); isInsuranceDataToBeLoaded = false; // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); } else if (apiResponse.messageStatus == 1) { - debugPrint("InsuranceViewModel: API success - received ${apiResponse.data?.length ?? 0} insurance records"); patientInsuranceList = apiResponse.data!; isInsuranceLoading = false; isInsuranceDataToBeLoaded = false; @@ -115,7 +106,6 @@ class InsuranceViewModel extends ChangeNotifier { isInsuranceExpired = DateTime.now().isAfter( DateUtil.convertStringToDate(patientInsuranceList.first.cardValidTo), ); - debugPrint("InsuranceViewModel: Insurance card expired: $isInsuranceExpired"); } isInsuranceExpiryBannerShown = isInsuranceExpired; diff --git a/lib/features/my_appointments/my_appointments_repo.dart b/lib/features/my_appointments/my_appointments_repo.dart index 87484e06..d7a926d3 100644 --- a/lib/features/my_appointments/my_appointments_repo.dart +++ b/lib/features/my_appointments/my_appointments_repo.dart @@ -172,9 +172,9 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { try { final list = response['OnlineCheckInAppointments']; patientShareObj = (list == null || list.isEmpty) ? PatientAppointmentShareResponseModel() : PatientAppointmentShareResponseModel.fromJson(list[0]); - patientShareObj.isCash = response["IsCash"]; - patientShareObj.isEligible = response["IsEligible"]; - patientShareObj.isInsured = response["IsInsured"]; + patientShareObj.isCash = isLiveCareAppointment ? list[0]["IsCash"] : response["IsCash"]; + patientShareObj.isEligible = isLiveCareAppointment ? list[0]["IsEligible"] : response["IsEligible"]; + patientShareObj.isInsured = isLiveCareAppointment ? list[0]["IsInsured"] : response["IsInsured"]; // if (list == null || list.isEmpty) { // throw Exception("patient share list is empty"); diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart index b480a354..52d8b240 100644 --- a/lib/features/my_appointments/my_appointments_view_model.dart +++ b/lib/features/my_appointments/my_appointments_view_model.dart @@ -277,7 +277,6 @@ class MyAppointmentsViewModel extends ChangeNotifier { } if (!isAppointmentDataToBeLoaded) return; - debugPrint('getPatientAppointments CALLED!!!'); patientAppointmentsByClinic.clear(); patientAppointmentsByHospital.clear(); @@ -347,9 +346,6 @@ class MyAppointmentsViewModel extends ChangeNotifier { } // } - debugPrint('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}'); - debugPrint('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}'); - debugPrint('All Appointments: ${patientAppointmentsHistoryList.length}'); getFiltersForSelectedAppointmentList(filteredAppointmentList); notifyListeners(); } @@ -1299,7 +1295,6 @@ class MyAppointmentsViewModel extends ChangeNotifier { ); } catch (e) { // Ignore errors if reminder doesn't exist - debugPrint("No existing ${type.displayName} to remove"); } } } diff --git a/lib/presentation/insurance/insurance_approval_details_page.dart b/lib/presentation/insurance/insurance_approval_details_page.dart index b1fce84a..d0d7f681 100644 --- a/lib/presentation/insurance/insurance_approval_details_page.dart +++ b/lib/presentation/insurance/insurance_approval_details_page.dart @@ -102,7 +102,7 @@ class InsuranceApprovalDetailsPage extends StatelessWidget { spacing: 3.h, runSpacing: 4.h, children: [ - AppCustomChipWidget(labelText: insuranceApprovalResponseModel.clinicName!), + AppCustomChipWidget(labelText: insuranceApprovalResponseModel.clinicName ?? ""), AppCustomChipWidget(labelText: "${LocaleKeys.approvalNo.tr(context: context)} ${insuranceApprovalResponseModel.approvalNo}", isEnglishOnly: true), AppCustomChipWidget(labelText: "${LocaleKeys.unusedCount.tr(context: context)} ${insuranceApprovalResponseModel.unUsedCount}", isEnglishOnly: true), AppCustomChipWidget(labelText: "${LocaleKeys.companyName.tr(context: context)} ${insuranceApprovalResponseModel.companyName}"),