Derma package appointment booking fixes

merge-update-with-lab-changes
haroon amjad 2 years ago
parent 554548bc9a
commit 66ec7b5ca4

@ -1976,8 +1976,9 @@ const Map localizedValues = {
"selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"}, "selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"},
"wecare": {"en": "We Care", "ar": "نحن نهتم"}, "wecare": {"en": "We Care", "ar": "نحن نهتم"},
"myinstructions": {"en": "My Instructions", "ar": "تعليماتي"}, "myinstructions": {"en": "My Instructions", "ar": "تعليماتي"},
"existingPackage":{"en":"There is an existing package","ar":"هناك حزمة موجودة"}, "existingPackage":{"en":"This patient has a package under this clinic,","ar":"هذا المريض لديه حزمة تحت هذه العيادة،"},
"continueOrbookNew":{"en":"do you want to continue with that package? or book new appointment","ar":"هل تريد الاستمرار في هذه الباقة؟ أو حجز موعد جديد"}, "continueOrbookNew":{"en":"do you want to continue with that package? or book new appointment?","ar":"هل تريد الاستمرار في هذه الباقة؟ أو حجز موعد جديد؟"},
"newAppointment":{"en":"New Appointment","ar":"موعد جديد"}, "newAppointment":{"en":"New Appointment","ar":"موعد جديد"},
"proceedPackage":{"en":"Proceed with package","ar":"المضي قدما في الحزمة"},
}; };

@ -212,13 +212,11 @@ class _BookConfirmState extends State<BookConfirm> {
disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12),
elevation: 0, elevation: 0,
onPressed: () async { onPressed: () async {
bool isLiveCareSchedule = await this.sharedPref.getBool( bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false;
IS_LIVECARE_APPOINTMENT) ?? false;
if (isLiveCareSchedule) { if (isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor); insertLiveCareScheduledAppointment(context, widget.doctor);
} else { } else {
checkPatientHasDermaPackage( checkPatientHasDermaPackage(widget.doctor, projectViewModel.user.patientID!);
widget.doctor, projectViewModel.user.patientID!);
} }
}, },
child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white)), child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white)),
@ -268,7 +266,7 @@ class _BookConfirmState extends State<BookConfirm> {
if (isLiveCareSchedule != null && isLiveCareSchedule) { if (isLiveCareSchedule != null && isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor); insertLiveCareScheduledAppointment(context, widget.doctor);
} else { } else {
insertAppointment(context, widget.doctor, widget.initialSlotDuration, invoiceNumber: invoiceNumber, lineItemNo: lineItemNo); insertAppointment(widget.doctor, widget.initialSlotDuration, invoiceNumber: invoiceNumber, lineItemNo: lineItemNo);
} }
}); });
} else { } else {
@ -322,55 +320,53 @@ class _BookConfirmState extends State<BookConfirm> {
print(err); print(err);
}); });
} }
checkPatientHasDermaPackage(DoctorList doctor, int patientID) { checkPatientHasDermaPackage(DoctorList doctor, int patientID) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
widget.service widget.service
// .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, 'null', null, null, projectViewModel) .checkPatientHasDermaPackage(
.checkPatientHasDermaPackage(patientID!, doctor.clinicID!, doctor.projectID!, doctor.doctorID!, projectViewModel.isArabic ? 1 : 2, context, patientID!,
doctor.clinicID!,
doctor.projectID!,
doctor.doctorID!,
projectViewModel.isArabic ? 1 : 2,
context,
) )
.then((res) { .then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1 && res['PatientPackageComponent']['Message'] == 'Success') { if (res['MessageStatus'] == 1 && res['PatientPackageComponent']['Message'] == 'Success') {
PatientPackageComponent package = PatientPackageComponent.fromJson(res['PatientPackageComponent']); PatientPackageComponent package = PatientPackageComponent.fromJson(res['PatientPackageComponent']);
ConfirmDialog dialog = ConfirmDialog( ConfirmDialog dialog = ConfirmDialog(
context: context, context: context,
confirmMessage: "${TranslationBase.of(context).existingPackage} , ${package.patientPackageComponents![0].procedureName} , ${ TranslationBase.of(context).continueOrbookNew}", confirmMessage: "${TranslationBase.of(context).existingPackage} ${package.patientPackageComponents![0].procedureName}, ${TranslationBase.of(context).continueOrbookNew}",
okText: TranslationBase.of(context).continues, okText: TranslationBase.of(context).proceedPackage,
cancelText: TranslationBase.of(context).newAppointment, cancelText: TranslationBase.of(context).newAppointment,
okFunction: () => { okFunction: () => {
ConfirmDialog.closeAlertDialog(context), ConfirmDialog.closeAlertDialog(context),
insertAppointment( insertAppointment(widget.doctor, widget.initialSlotDuration, invoiceNumber: package.patientPackageComponents![0].invoiceNo, lineItemNo: package.patientPackageComponents![0].lineItemNo)
context, widget.doctor, widget.initialSlotDuration, invoiceNumber: package.patientPackageComponents![0].invoiceNo, lineItemNo:package.patientPackageComponents![0].lineItemNo ) },
cancelFunction: () => {
ConfirmDialog.closeAlertDialog(context),
insertAppointment(
context, widget.doctor, widget.initialSlotDuration)
}, },
cancelFunction: () => {insertAppointment(widget.doctor, widget.initialSlotDuration)},
); );
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
} else { } else {
insertAppointment( insertAppointment(widget.doctor, widget.initialSlotDuration);
context, widget.doctor, widget.initialSlotDuration);
} }
}).onError((error, stackTrace) { }).onError((error, stackTrace) {
insertAppointment( insertAppointment(widget.doctor, widget.initialSlotDuration);
context, widget.doctor, widget.initialSlotDuration);
}); });
} }
insertAppointment(context, DoctorList docObject, int initialSlotDuration, {int? invoiceNumber, int? lineItemNo} ) async { insertAppointment(DoctorList docObject, int initialSlotDuration, {int? invoiceNumber, int? lineItemNo}) async {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
String logs = await sharedPref.getString('selectedLogSlots'); String logs = await sharedPref.getString('selectedLogSlots');
List<dynamic> decodedLogs = json.decode(logs); List<dynamic> decodedLogs = json.decode(logs);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: true);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service 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, context, 'null', null, null, projectViewModel)
.insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context,
null, null, null, projectViewModel, invoiceNumber, lineItemNo!) null, null, null, projectViewModel, invoiceNumber, lineItemNo)
.then((res) { .then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
@ -407,14 +403,14 @@ class _BookConfirmState extends State<BookConfirm> {
confirmMessage: res['ErrorEndUserMessage'], confirmMessage: res['ErrorEndUserMessage'],
okText: TranslationBase.of(context).confirm, okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps, cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {cancelAppointment(docObject, appo, context, invoiceNumber: invoiceNumber, lineItemNo: lineItemNo!)}, okFunction: () => {cancelAppointment(docObject, appo, context, invoiceNumber: invoiceNumber, lineItemNo: lineItemNo)},
cancelFunction: () => {}, cancelFunction: () => {},
); );
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
} }
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err, localContext: context);
}); });
projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot!, doctor: widget.doctor); projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot!, doctor: widget.doctor);
} }

@ -512,8 +512,6 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> checkPatientHasDermaPackage(int patientID, int clinicID, int projectID, int doctorID, int languageID, BuildContext context) async { Future<Map> checkPatientHasDermaPackage(int patientID, int clinicID, int projectID, int doctorID, int languageID, BuildContext context) async {
Map<String, dynamic> request; Map<String, dynamic> request;

@ -2967,6 +2967,7 @@ class TranslationBase {
String get existingPackage => localizedValues["existingPackage"][locale.languageCode]; String get existingPackage => localizedValues["existingPackage"][locale.languageCode];
String get continueOrbookNew => localizedValues["continueOrbookNew"][locale.languageCode]; String get continueOrbookNew => localizedValues["continueOrbookNew"][locale.languageCode];
String get newAppointment => localizedValues["newAppointment"][locale.languageCode]; String get newAppointment => localizedValues["newAppointment"][locale.languageCode];
String get proceedPackage => localizedValues["proceedPackage"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save