diff --git a/lib/config/config.dart b/lib/config/config.dart index a9091a47..d876cf8a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -22,8 +22,8 @@ var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; // 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://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -313,6 +313,8 @@ var GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_Get var GET_ER_APPOINTMENT_FEES = 'Services/DoctorApplication.svc/REST/GetERAppointmentFees'; var GET_ER_APPOINTMENT_TIME = 'Services/ER_VirtualCall.svc/REST/GetRestTime'; +var CHECK_PATIENT_DERMA_PACKAGE = 'Services/OUTPs.svc/REST/getPatientPackageComponentsForOnlineCheckIn'; + var ADD_NEW_CALL_FOR_PATIENT_ER = 'Services/DoctorApplication.svc/REST/NewCallForPatientER'; var GET_LIVECARE_HISTORY = 'Services/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5a775c5b..4c2acf61 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1976,4 +1976,8 @@ const Map localizedValues = { "selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"}, "wecare": {"en": "We Care", "ar": "نحن نهتم"}, "myinstructions": {"en": "My Instructions", "ar": "تعليماتي"}, + "existingPackage":{"en":"There is an existing package","ar":"هناك حزمة موجودة"}, + "continueOrbookNew":{"en":"do you want to continue with that package? or book new appointment","ar":"هل تريد الاستمرار في هذه الباقة؟ أو حجز موعد جديد"}, + "newAppointment":{"en":"New Appointment","ar":"موعد جديد"}, + }; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 398b3afe..7216da7b 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -30,7 +30,7 @@ class ProjectViewModel extends BaseViewModel { AppSharedPreferences sharedPref = AppSharedPreferences(); Locale _appLocale = Locale('ar'); String currentLanguage = 'ar'; - bool _isArabic = false; + bool _isArabic = true; bool isInternetConnection = true; bool isLoading = false; bool isError = false; diff --git a/lib/models/Appointments/PatientPackageComponent b/lib/models/Appointments/PatientPackageComponent new file mode 100644 index 00000000..e69de29b diff --git a/lib/models/Appointments/PatientPackageComponent.dart b/lib/models/Appointments/PatientPackageComponent.dart new file mode 100644 index 00000000..31163cc7 --- /dev/null +++ b/lib/models/Appointments/PatientPackageComponent.dart @@ -0,0 +1,64 @@ +class PatientPackageComponent { + List? patientPackageComponents; + + PatientPackageComponent({this.patientPackageComponents}); + + PatientPackageComponent.fromJson(Map json) { + if (json['PatientPackageComponents'] != null) { + patientPackageComponents = []; + json['PatientPackageComponents'].forEach((v) { + patientPackageComponents!.add(new PatientPackageComponents.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.patientPackageComponents != null) { + data['PatientPackageComponents'] = + this.patientPackageComponents!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PatientPackageComponents { + int? invoiceNo; + int? lineItemNo; + String? procedureID; + String? procedureName; + int? projectID; + int? sequence; + String? setupID; + + PatientPackageComponents( + {this.invoiceNo, + this.lineItemNo, + this.procedureID, + this.procedureName, + this.projectID, + this.sequence, + this.setupID}); + + PatientPackageComponents.fromJson(Map json) { + invoiceNo = json['InvoiceNo']; + lineItemNo = json['LineItemNo']; + procedureID = json['ProcedureID']; + procedureName = json['ProcedureName']; + projectID = json['ProjectID']; + sequence = json['Sequence']; + setupID = json['SetupID']; + } + + Map toJson() { + final Map data = new Map(); + data['InvoiceNo'] = this.invoiceNo; + data['LineItemNo'] = this.lineItemNo; + data['ProcedureID'] = this.procedureID; + data['ProcedureName'] = this.procedureName; + data['ProjectID'] = this.projectID; + data['Sequence'] = this.sequence; + data['SetupID'] = this.setupID; + return data; + } +} diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index b2ccf085..e53ef60c 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -28,6 +28,7 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import '../../models/Appointments/PatientPackageComponent.dart'; import 'book_reminder_page.dart'; import 'components/DocAvailableAppointments.dart'; @@ -211,11 +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) ?? false; + bool isLiveCareSchedule = await this.sharedPref.getBool( + IS_LIVECARE_APPOINTMENT) ?? false; if (isLiveCareSchedule) { insertLiveCareScheduledAppointment(context, widget.doctor); } else { - insertAppointment(context, widget.doctor, widget.initialSlotDuration); + checkPatientHasDermaPackage( + widget.doctor, projectViewModel.user.patientID!); } }, child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white)), @@ -319,8 +322,46 @@ class _BookConfirmState extends State { print(err); }); } + checkPatientHasDermaPackage(DoctorList doctor, int patientID){ + GifLoaderDialogUtils.showMyDialog(context); + widget.service + // .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, 'null', null, null, projectViewModel) + .checkPatientHasDermaPackage(patientID!, doctor.clinicID!, doctor.projectID!, doctor.doctorID!, projectViewModel.isArabic ? 1 : 2, context, + ) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1 && res['PatientPackageComponent']['Message'] =='Success') { + + PatientPackageComponent package = PatientPackageComponent.fromJson(res['PatientPackageComponent']); + + ConfirmDialog dialog = ConfirmDialog( + context: context, + confirmMessage: "${TranslationBase.of(context).existingPackage} , ${package.patientPackageComponents![0].procedureName} , ${ TranslationBase.of(context).continueOrbookNew}", + okText: TranslationBase.of(context).continues, + cancelText:TranslationBase.of(context).newAppointment, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context), + insertAppointment( + context, widget.doctor, widget.initialSlotDuration, invoiceNumber: package.patientPackageComponents![0].invoiceNo) }, + cancelFunction: () => { + ConfirmDialog.closeAlertDialog(context), + insertAppointment( + context, widget.doctor, widget.initialSlotDuration) + }, + ); + dialog.showAlertDialog(context); + } else{ + insertAppointment( + context, widget.doctor, widget.initialSlotDuration); + } + + }).onError((error, stackTrace) { + insertAppointment( + context, widget.doctor, widget.initialSlotDuration); + }); + } - insertAppointment(context, DoctorList docObject, int initialSlotDuration) async { + insertAppointment(context, DoctorList docObject, int initialSlotDuration, {int? invoiceNumber} ) async { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; String logs = await sharedPref.getString('selectedLogSlots'); List decodedLogs = json.decode(logs); @@ -329,7 +370,7 @@ class _BookConfirmState extends State { widget.service // .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, 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) + null, null, null, projectViewModel, invoiceNumber ) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index aaf30b97..aa94e425 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -335,7 +335,7 @@ class DoctorsListService extends BaseService { } Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, int languageID, BuildContext context, - [String? procedureID, num? testTypeEnum, num? testProcedureEnum, ProjectViewModel? projectViewModel]) async { + [String? procedureID, num? testTypeEnum, num? testProcedureEnum, ProjectViewModel? projectViewModel, int? invoiceNumber]) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -374,7 +374,8 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, - "PatientType": authUser.patientType + "PatientType": authUser.patientType, + "InvoiceNumber":invoiceNumber }; if (clinicID == 253) { @@ -509,6 +510,28 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + + + Future checkPatientHasDermaPackage(int patientID, int clinicID, int projectID, int doctorID, int languageID, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + request = { "PatientID":patientID, "ClinicID":clinicID, "ProjectID": projectID, "LanguageID": languageID}; + // request = { "PatientID":4768732, "ClinicID":1, "ProjectID": 15, "LanguageID": languageID, "TokenID":"@dm!n" }; + + dynamic localRes; + + await baseAppClient.post(CHECK_PATIENT_DERMA_PACKAGE, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, int languageID, BuildContext context) async { Map request; diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 82e52ae7..dc494a61 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -52,7 +52,7 @@ class ClinicListService extends BaseService { Future getProjectsList(int languageID, context) async { Map request = {}; - request = {"LanguageID": languageID}; + // request = {"LanguageID": languageID}; dynamic localRes; diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 2d5fa774..cff0acba 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -76,7 +76,7 @@ class AppSharedPreferences { final SharedPreferences prefs = await _prefs; await prefs.reload(); String value = prefs.getString(key).toString(); - return value == null ? defaultVal : value; + return (value == null ) || (value =="null") ? defaultVal : value; } /// Get List of String [key] the key was saved diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 46f4807c..83d41027 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2964,7 +2964,9 @@ class TranslationBase { String get wecare => localizedValues["wecare"][locale.languageCode]; String get myinstructions => localizedValues["myinstructions"][locale.languageCode]; - + String get existingPackage => localizedValues["existingPackage"][locale.languageCode]; + String get continueOrbookNew => localizedValues["continueOrbookNew"][locale.languageCode]; + String get newAppointment => localizedValues["newAppointment"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart index a493f14e..1da92ac5 100644 --- a/lib/widgets/dialogs/confirm_dialog.dart +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -73,7 +73,9 @@ class Mdialog extends StatelessWidget { Text( // title != null ? title : TranslationBase.of(context).confirm, title!, + style: TextStyle( + fontSize: 24, letterSpacing: -0.94, fontWeight: FontWeight.w600, @@ -82,6 +84,7 @@ class Mdialog extends StatelessWidget { Text( // this.confirmMessage, description!, + style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -101,7 +104,7 @@ class Mdialog extends StatelessWidget { child: Container( decoration: containerRadius(CustomColors.accentColor, 12), padding: EdgeInsets.only(top: 8,bottom: 8), - child: Center(child: Texts(cancelText, variant: "caption3", color: CustomColors.white,)), + child: Center(child: Texts(cancelText, textAlign: TextAlign.center, variant: "caption3", color: CustomColors.white,)), ), ), ), @@ -115,6 +118,7 @@ class Mdialog extends StatelessWidget { child: Center( child: Texts( okText, + textAlign: TextAlign.center, color: Colors.white, variant: "caption3", ),