|
|
|
|
@ -382,7 +382,7 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!,
|
|
|
|
|
// customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
|
|
|
|
|
customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com",
|
|
|
|
|
orderDescription: "Appointment Payment",
|
|
|
|
|
orderDescription: "Walk-In appointment payment",
|
|
|
|
|
orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()),
|
|
|
|
|
merchantReference: transID,
|
|
|
|
|
payfortProjectDetailsRespModel: payfortProjectDetailsRespModel,
|
|
|
|
|
@ -473,12 +473,12 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
try {
|
|
|
|
|
if (selectedPaymentMethod == "TAMARA") {
|
|
|
|
|
checkTamaraPaymentStatus(transID!, appo);
|
|
|
|
|
if (tamaraPaymentStatus != null && tamaraPaymentStatus!.toLowerCase() == "approved") {
|
|
|
|
|
updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID!, num.parse(selectedInstallments!), appo);
|
|
|
|
|
} else {
|
|
|
|
|
updateTamaraRequestStatus(
|
|
|
|
|
"Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID! != null ? tamaraOrderID! : "", num.parse(selectedInstallments!), appo);
|
|
|
|
|
}
|
|
|
|
|
// if (tamaraPaymentStatus != null && tamaraPaymentStatus!.toLowerCase() == "approved") {
|
|
|
|
|
// updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID!, num.parse(selectedInstallments!), appo);
|
|
|
|
|
// } else {
|
|
|
|
|
// updateTamaraRequestStatus(
|
|
|
|
|
// "Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID! != null ? tamaraOrderID! : "", num.parse(selectedInstallments!), appo);
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
checkPaymentStatus(appo);
|
|
|
|
|
}
|
|
|
|
|
@ -512,8 +512,7 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (tamaraPaymentStatus!.toLowerCase() == "approved") {
|
|
|
|
|
// markAppointmentForTamara(appo);
|
|
|
|
|
// addAdvancedNumberRequestTamara("Tamara-Advance-0000", tamaraOrderID, appo.appointmentNo.toString(), appo);
|
|
|
|
|
insertWalkInAppointment(context, widget.doctor, widget.initialSlotDuration, tamaraOrderID);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
@ -525,6 +524,28 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addAdvancedNumberRequestTamara(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
markAppointmentForTamara(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.markAppointmentForTamara(appo.projectID!, appo.appointmentNo.toString()).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
sendNfcCheckInRequest(projectViewModel.waitingAppointmentNFCCode, 2, int.parse(appo.appointmentNo), projectViewModel.waitingAppointmentProjectID);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
String txn_ref;
|
|
|
|
|
num amount;
|
|
|
|
|
@ -539,7 +560,7 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
amount = res['Amount'];
|
|
|
|
|
payment_method = res['PaymentMethod'];
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// createAdvancePayment(res, appo);
|
|
|
|
|
insertWalkInAppointment(context, widget.doctor, widget.initialSlotDuration, res);
|
|
|
|
|
projectViewModel.analytics.appointment.payment_success(
|
|
|
|
|
appointment_type: 'Walk-In', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref);
|
|
|
|
|
} else {
|
|
|
|
|
@ -588,6 +609,23 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// canPayForWalkInAppointment() {
|
|
|
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
// widget.service
|
|
|
|
|
// .canPayForWalkInAppointment(
|
|
|
|
|
// widget.doctor.projectID!,
|
|
|
|
|
// widget.doctor.clinicID!,
|
|
|
|
|
// )
|
|
|
|
|
// .then((res) {
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// getWalkinAppointmentPatientShare();
|
|
|
|
|
// }).catchError((err) {
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// AppToast.showErrorToast(message: err);
|
|
|
|
|
// print(err);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
getWalkinAppointmentPatientShare() {
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
@ -598,13 +636,18 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
|
|
|
|
|
widget.service
|
|
|
|
|
.getPatientShareForWalkInAppointment(
|
|
|
|
|
widget.doctor.projectID!,
|
|
|
|
|
widget.doctor.clinicID!,
|
|
|
|
|
widget.doctor.projectID!,
|
|
|
|
|
widget.doctor.doctorID!,
|
|
|
|
|
)
|
|
|
|
|
.then((res) {
|
|
|
|
|
widget.patientShareResponse = new PatientShareResponse.fromJson(res["OnlineCheckInAppointmentsWalkInModel"]);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
openPaymentDialog(appo, widget.patientShareResponse!);
|
|
|
|
|
if (widget.patientShareResponse.patientShareWithTax != 0 || widget.patientShareResponse.patientShareWithTax != 0.0) {
|
|
|
|
|
openPaymentDialog(appo, widget.patientShareResponse!);
|
|
|
|
|
} else {
|
|
|
|
|
insertWalkInAppointment(context, widget.doctor, widget.initialSlotDuration, null);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
@ -679,11 +722,102 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertWalkInAppointment(context, DoctorList docObject, int initialSlotDuration, paymentRes) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.doctorID = docObject.doctorID;
|
|
|
|
|
appo.clinicID = docObject.clinicID;
|
|
|
|
|
appo.projectID = docObject.projectID;
|
|
|
|
|
|
|
|
|
|
widget.service
|
|
|
|
|
.insertWalkInAppointment(
|
|
|
|
|
docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
|
|
|
|
|
appo.appointmentNo = res["AppointmentNo"]; // Add appointment No to the appointment project
|
|
|
|
|
Future.delayed(Duration(milliseconds: 500), () {
|
|
|
|
|
if (selectedPaymentMethod == "TAMARA") {
|
|
|
|
|
markAppointmentForTamara(appo);
|
|
|
|
|
addAdvancedNumberRequestTamara("Tamara-Advance-0000", paymentRes, res["AppointmentNo"].toString(), appo);
|
|
|
|
|
} else {
|
|
|
|
|
if (widget.patientShareResponse.patientShareWithTax != 0 || widget.patientShareResponse.patientShareWithTax != 0.0) {
|
|
|
|
|
createAdvancePayment(paymentRes, appo);
|
|
|
|
|
} else {
|
|
|
|
|
sendNfcCheckInRequest(projectViewModel.waitingAppointmentNFCCode, 2, int.parse(res["AppointmentNo"]), projectViewModel.waitingAppointmentProjectID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
String paymentReference = res['Fort_id'].toString();
|
|
|
|
|
service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
addAdvancedNumberRequest(
|
|
|
|
|
Utils.isVidaPlusProject(projectViewModel, appo.projectID!)
|
|
|
|
|
? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
|
|
|
|
: res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
|
paymentReference,
|
|
|
|
|
appo.appointmentNo.toString(),
|
|
|
|
|
appo);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
sendNfcCheckInRequest(projectViewModel.waitingAppointmentNFCCode, 2, int.parse(appointmentID), projectViewModel.waitingAppointmentProjectID);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendNfcCheckInRequest(String nfcId, int checkInBy, int appoNo, int projectID) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.sendCheckinNfcRequest(appoNo, nfcId, projectID, checkInBy, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
_showMyDialog(res["SuccessMsg"], this.context);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
_showMyDialog(err, this.context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertAppointment(context, DoctorList docObject, int initialSlotDuration) async {
|
|
|
|
|
final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
|
|
|
|
|
String logs = await sharedPref.getString('selectedLogSlots');
|
|
|
|
|
List<dynamic> decodedLogs = json.decode(logs);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
AppoitmentAllHistoryResultList appo;
|
|
|
|
|
widget.service
|
|
|
|
|
// .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, 'null', null, null, projectViewModel)
|
|
|
|
|
@ -741,7 +875,9 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
|
|
|
|
|
widget.selectedDate = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[0];
|
|
|
|
|
widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
AppoitmentAllHistoryResultList appo;
|
|
|
|
|
widget.service
|
|
|
|
|
.insertLiveCareScheduleAppointment(
|
|
|
|
|
@ -805,7 +941,9 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) {
|
|
|
|
|
int languageID = projectViewModel.isArabic ? 1 : 2;
|
|
|
|
|
String errorMsg = "";
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) {
|
|
|
|
|
projectViewModel.selectedBodyPartList.clear();
|
|
|
|
|
projectViewModel.laserSelectionDuration = 0;
|
|
|
|
|
@ -934,4 +1072,32 @@ class _BookConfirmState extends State<BookConfirm> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _showMyDialog(String message, BuildContext context) async {
|
|
|
|
|
return showDialog<void>(
|
|
|
|
|
context: context,
|
|
|
|
|
barrierDismissible: true, // user must tap button!
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
title: const Text('Alert'),
|
|
|
|
|
content: SingleChildScrollView(
|
|
|
|
|
child: ListBody(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(message),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
TextButton(
|
|
|
|
|
child: const Text('OK'),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|