diff --git a/lib/config/config.dart b/lib/config/config.dart index 4386f96f..1a3ef187 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; @@ -625,6 +625,7 @@ var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity'; var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany'; +var PHC_REFERRAL_APPOINTMENT_STATUS = 'Services/OUTPs.svc/REST/getPHCReferralAppointmentStatuse'; //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 9f6c5df5..f7ee126d 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -212,12 +212,13 @@ class _BookConfirmState extends State { disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), elevation: 0, onPressed: () async { - bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); - if (isLiveCareSchedule != null && isLiveCareSchedule) { - insertLiveCareScheduledAppointment(context, widget.doctor); - } else { - insertAppointment(context, widget.doctor, widget.initialSlotDuration); - } + checkPHCReferralAppointmentStatus(widget.doctor); + // bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); + // if (isLiveCareSchedule != null && isLiveCareSchedule) { + // insertLiveCareScheduledAppointment(context, widget.doctor); + // } else { + // insertAppointment(context, widget.doctor, widget.initialSlotDuration); + // } }, child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white)), ), @@ -227,6 +228,45 @@ class _BookConfirmState extends State { ); } + checkPHCReferralAppointmentStatus(DoctorList docObject) { + int languageID = projectViewModel.isArabic ? 1 : 2; + GifLoaderDialogUtils.showMyDialog(context); + widget.service.checkPHCReferralAppointmentStatus(docObject.projectID, docObject.clinicID, languageID).then((res) async { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + if (res["PHCReferralAppointment"]["statusCode"] == 1) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: res['SuccessMsg'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); + if (isLiveCareSchedule != null && isLiveCareSchedule) { + insertLiveCareScheduledAppointment(context, widget.doctor); + } else { + insertAppointment(context, widget.doctor, widget.initialSlotDuration); + } + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } else { + bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); + if (isLiveCareSchedule != null && isLiveCareSchedule) { + insertLiveCareScheduledAppointment(context, widget.doctor); + } else { + insertAppointment(context, widget.doctor, widget.initialSlotDuration); + } + } + } else { + AppToast.showErrorToast(message: res["ErrorEndUserMessage"]); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + Widget showInfo(String title, String des) { return Container( child: Row( @@ -329,7 +369,8 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; widget.service - .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, null, null, null, projectViewModel) + .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, null, + null, null, projectViewModel) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); @@ -385,7 +426,10 @@ class _BookConfirmState extends State { widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; - widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, projectViewModel.isArabic ? 1 : 2, context).then((res) { + widget.service + .insertLiveCareScheduleAppointment( + docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, projectViewModel.isArabic ? 1 : 2, context) + .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); @@ -448,7 +492,7 @@ class _BookConfirmState extends State { widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) { projectViewModel.selectedBodyPartList.clear(); projectViewModel.laserSelectionDuration = 0; - if(res['OnlineCheckInAppointments'].length != 0) { + if (res['OnlineCheckInAppointments'].length != 0) { widget.patientShareResponse = new PatientShareResponse.fromJson(res['OnlineCheckInAppointments'][0]); } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index b85ec599..e9c102dd 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1790,6 +1790,19 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future checkPHCReferralAppointmentStatus(int projectID, int clinicID, int languageID) async { + Map request; + request = {"ProjectID": projectID, "ClinicID": clinicID, "LanguageID": languageID}; + dynamic localRes; + await baseAppClient.post(PHC_REFERRAL_APPOINTMENT_STATUS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + Future getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async { Map request; request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue};