From fb13096f945645e97db63c8367e497529c067808 Mon Sep 17 00:00:00 2001 From: Haroon Amjad <> Date: Wed, 16 Oct 2024 19:44:21 +0300 Subject: [PATCH] NPHIES Eligibility check implemented in LiveCare Schedule Appointment booking in ToDo list --- lib/pages/ToDoList/ToDo.dart | 39 +++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 5b8c6801..9a15a3ba 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1014,13 +1014,17 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Navigator.push(context, FadePage(page: InsuranceUpdate())); } - void continueAsCash(AppoitmentAllHistoryResultList appo) { + void continueAsCash(AppoitmentAllHistoryResultList appo, bool isLiveCareAppointment) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); service.convertPatientToCash(appo.projectID!).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res["MessageStatus"] == 1) { - getPatientShare(context, appo); + if (isLiveCareAppointment) { + getLiveCareAppointmentPatientShare(context, service, appo); + } else { + getPatientShare(context, appo); + } // getToDoCount(); } else { AppToast.showErrorToast(message: res["ErrorEndUserMessage"]); @@ -1080,11 +1084,40 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } getLiveCareAppointmentPatientShare(context, DoctorsListService service, AppoitmentAllHistoryResultList appo) { + String errorMsg = ""; GifLoaderDialogUtils.showMyDialog(context); service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); - openPaymentDialog(appo, widget.patientShareResponse!); + + isInsured = res["IsInsured"]; + isEligible = res["IsEligible"]; + isCash = res["IsCash"]; + + if (isCash) { + openPaymentDialog(appo, widget.patientShareResponse!); + } else { + if (isInsured && isEligible) { + openPaymentDialog(appo, widget.patientShareResponse!); + } else { + if (isInsured && !isEligible) { + errorMsg = TranslationBase.of(context).invalidEligibility; + } else { + errorMsg = TranslationBase.of(context).invalidInsurance; + } + ConfirmDialog dialog = new ConfirmDialog( + isDissmissable: false, + context: context, + confirmMessage: errorMsg, + okText: TranslationBase.of(context).updateInsuranceText, + cancelText: TranslationBase.of(context).continueCash, + okFunction: () => {openUpdateInsurance()}, + cancelFunction: () => {continueAsCash(appo)}); + dialog.showAlertDialog(context); + } + } + + // openPaymentDialog(appo, widget.patientShareResponse!); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err);