|
|
|
@ -31,13 +31,13 @@ class BookSuccess extends StatefulWidget {
|
|
|
|
|
PatientShareResponse patientShareResponse;
|
|
|
|
|
DoctorList docObject;
|
|
|
|
|
|
|
|
|
|
MyInAppBrowser browser;
|
|
|
|
|
late MyInAppBrowser browser;
|
|
|
|
|
final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser());
|
|
|
|
|
|
|
|
|
|
String appoDateFormatted;
|
|
|
|
|
String appoTimeFormatted;
|
|
|
|
|
|
|
|
|
|
BookSuccess({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted});
|
|
|
|
|
BookSuccess({required this.patientShareResponse, required this.docObject, required this.appoDateFormatted, required this.appoTimeFormatted});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_BookSuccessState createState() => _BookSuccessState();
|
|
|
|
@ -48,16 +48,16 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
|
|
|
|
|
// AuthenticatedUser authUser;
|
|
|
|
|
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
late ProjectViewModel projectViewModel;
|
|
|
|
|
String selectedPaymentMethod = "";
|
|
|
|
|
String selectedInstallments = "";
|
|
|
|
|
String tamaraPaymentStatus;
|
|
|
|
|
String tamaraOrderID;
|
|
|
|
|
String? tamaraPaymentStatus;
|
|
|
|
|
String? tamaraOrderID;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
initState() {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
if (widget.patientShareResponse.isLiveCareAppointment &&
|
|
|
|
|
if (widget.patientShareResponse.isLiveCareAppointment! &&
|
|
|
|
|
(widget.patientShareResponse.patientShareWithTax.toString() == "0" || widget.patientShareResponse.patientShareWithTax.toString() == "0.0")) {
|
|
|
|
|
setOnlineCheckInForAppointment();
|
|
|
|
|
}
|
|
|
|
@ -69,7 +69,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of<ProjectViewModel>(context);
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: widget.docObject.doctorTitle + " " + widget.docObject.name,
|
|
|
|
|
appBarTitle: widget.docObject.doctorTitle! + " " + widget.docObject.name!,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
@ -82,15 +82,15 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
DoctorHeader(
|
|
|
|
|
headerModel: HeaderModel(
|
|
|
|
|
widget.docObject.name,
|
|
|
|
|
widget.docObject.doctorID,
|
|
|
|
|
widget.docObject.doctorImageURL,
|
|
|
|
|
widget.docObject.speciality,
|
|
|
|
|
widget.docObject.name!,
|
|
|
|
|
widget.docObject.doctorID!,
|
|
|
|
|
widget.docObject.doctorImageURL!,
|
|
|
|
|
widget.docObject.speciality!,
|
|
|
|
|
"",
|
|
|
|
|
widget.docObject.projectName,
|
|
|
|
|
widget.docObject.projectName!,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
widget.docObject.nationalityFlagURL,
|
|
|
|
|
widget.docObject.nationalityFlagURL!,
|
|
|
|
|
widget.docObject.doctorRate,
|
|
|
|
|
null,
|
|
|
|
|
widget.docObject.noOfPatientsRate,
|
|
|
|
@ -119,7 +119,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
getNextActionWidget(),
|
|
|
|
|
getNextActionWidget()!,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -127,7 +127,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getBottomContainer() {
|
|
|
|
|
Widget? getBottomContainer() {
|
|
|
|
|
switch (widget.patientShareResponse.nextAction) {
|
|
|
|
|
case 0:
|
|
|
|
|
return Container();
|
|
|
|
@ -266,7 +266,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.doctorID = widget.patientShareResponse.doctorID;
|
|
|
|
|
appo.appointmentDate = widget.patientShareResponse.appointmentDate;
|
|
|
|
|
if (appo.isLiveCareAppointment)
|
|
|
|
|
if (appo.isLiveCareAppointment!)
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
else
|
|
|
|
|
navigateToHome(context);
|
|
|
|
@ -294,13 +294,13 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
appo.serviceID = widget.patientShareResponse.serviceID;
|
|
|
|
|
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
|
|
|
|
|
appo.doctorID = widget.patientShareResponse.doctorID;
|
|
|
|
|
if (appo.isLiveCareAppointment) {
|
|
|
|
|
if (appo.isLiveCareAppointment!) {
|
|
|
|
|
navigateToHome(context);
|
|
|
|
|
} else {
|
|
|
|
|
confirmAppointment(appo);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Text(widget.patientShareResponse.isLiveCareAppointment ? TranslationBase.of(context).confirmLiveCare : TranslationBase.of(context).confirm,
|
|
|
|
|
child: Text(widget.patientShareResponse.isLiveCareAppointment! ? TranslationBase.of(context).confirmLiveCare : TranslationBase.of(context).confirm,
|
|
|
|
|
style: TextStyle(fontSize: 16.0, color: Colors.white)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -311,7 +311,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getNextActionWidget() {
|
|
|
|
|
Widget? getNextActionWidget() {
|
|
|
|
|
switch (widget.patientShareResponse.nextAction) {
|
|
|
|
|
case 0:
|
|
|
|
|
return Container();
|
|
|
|
@ -336,7 +336,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getNextAction() {
|
|
|
|
|
String? getNextAction() {
|
|
|
|
|
switch (widget.patientShareResponse.nextAction) {
|
|
|
|
|
case 0:
|
|
|
|
|
return 'No Action';
|
|
|
|
@ -426,7 +426,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
setOnlineCheckInForAppointment() {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID, context).then((res) {
|
|
|
|
|
service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID!, context).then((res) {
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.clinicID = widget.docObject.clinicID;
|
|
|
|
|
appo.projectID = widget.docObject.projectID;
|
|
|
|
@ -447,11 +447,11 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
confirmAppointment(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) {
|
|
|
|
|
service.confirmAppointment(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.isLiveCareAppointment!, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
if (appo.isLiveCareAppointment) {
|
|
|
|
|
if (appo.isLiveCareAppointment!) {
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
} else {
|
|
|
|
|
navigateToHome(context);
|
|
|
|
@ -470,8 +470,8 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service
|
|
|
|
|
.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate,
|
|
|
|
|
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context)
|
|
|
|
|
.insertVIDARequest(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.serviceID!, appo.doctorID!, appo.appointmentDate!,
|
|
|
|
|
Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
@ -550,13 +550,13 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: PaymentMethod(
|
|
|
|
|
onSelectedMethod: (String metohd, [String selectedInstallmentPlan]) {
|
|
|
|
|
onSelectedMethod: (String metohd, [String? selectedInstallmentPlan]) {
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
patientShare: widget.patientShareResponse.patientShareWithTax)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo);
|
|
|
|
|
openPayment(value, projectViewModel.user!, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo);
|
|
|
|
|
projectViewModel.analytics.appointment.payment_method(appointment_type: 'regular', clinic: widget.docObject.clinicName, payment_method: value[0], payment_type: 'appointment');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -569,18 +569,18 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
widget.browser.openPaymentBrowser(
|
|
|
|
|
amount,
|
|
|
|
|
"Appointment check in",
|
|
|
|
|
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo),
|
|
|
|
|
Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!),
|
|
|
|
|
appo.projectID.toString(),
|
|
|
|
|
authenticatedUser.emailAddress,
|
|
|
|
|
authenticatedUser.emailAddress!,
|
|
|
|
|
paymentMethod[0],
|
|
|
|
|
authenticatedUser.patientType,
|
|
|
|
|
authenticatedUser.firstName,
|
|
|
|
|
authenticatedUser.firstName!,
|
|
|
|
|
authenticatedUser.patientID,
|
|
|
|
|
authenticatedUser,
|
|
|
|
|
widget.browser,
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment,
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment!,
|
|
|
|
|
"2",
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment ? widget.patientShareResponse.clinicID.toString() : "",
|
|
|
|
|
widget.patientShareResponse.isLiveCareAppointment! ? widget.patientShareResponse.clinicID.toString() : "",
|
|
|
|
|
context,
|
|
|
|
|
widget.patientShareResponse.appointmentDate,
|
|
|
|
|
widget.patientShareResponse.appointmentNo,
|
|
|
|
@ -623,7 +623,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
|
|
|
|
try {
|
|
|
|
|
if (selectedPaymentMethod == "TAMARA") {
|
|
|
|
|
checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo);
|
|
|
|
|
checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), appo);
|
|
|
|
|
// if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") {
|
|
|
|
|
// updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo);
|
|
|
|
|
// } else {
|
|
|
|
@ -644,10 +644,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
service.getTamaraPaymentStatus(orderID).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res["status"].toString().toLowerCase() == "success") {
|
|
|
|
|
updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, num.parse(selectedInstallments), appo);
|
|
|
|
|
updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID!, int.parse(selectedInstallments), appo);
|
|
|
|
|
} else {
|
|
|
|
|
updateTamaraRequestStatus(
|
|
|
|
|
"Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo);
|
|
|
|
|
"Failed", "00", Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), tamaraOrderID != null ? tamaraOrderID! : "", int.parse(selectedInstallments), appo);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
@ -671,7 +671,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (tamaraPaymentStatus.toLowerCase() == "approved") {
|
|
|
|
|
if (tamaraPaymentStatus!.toLowerCase() == "approved") {
|
|
|
|
|
markAppointmentForTamara(appo);
|
|
|
|
|
addAdvancedNumberRequestTamara("Tamara-Advance-0000", tamaraOrderID, appo.appointmentNo.toString(), appo);
|
|
|
|
|
}
|
|
|
|
@ -688,9 +688,9 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
markAppointmentForTamara(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.markAppointmentForTamara(appo.projectID, appo.appointmentNo.toString()).then((res) {
|
|
|
|
|
service.markAppointmentForTamara(appo.projectID!, appo.appointmentNo.toString()).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (appo.isLiveCareAppointment)
|
|
|
|
|
if (appo.isLiveCareAppointment!)
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
else
|
|
|
|
|
getAppoQR(context);
|
|
|
|
@ -704,9 +704,9 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
autoGenerateInvoiceTamara(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.autoGenerateInvoiceTamara(appo.projectID, appo.appointmentNo.toString(), projectViewModel.user.mobileNumber).then((res) {
|
|
|
|
|
service.autoGenerateInvoiceTamara(appo.projectID!, appo.appointmentNo.toString(), projectViewModel.user!.mobileNumber!).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (appo.isLiveCareAppointment)
|
|
|
|
|
if (appo.isLiveCareAppointment!)
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
else
|
|
|
|
|
getAppoQR(context);
|
|
|
|
@ -721,10 +721,10 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
String txn_ref;
|
|
|
|
|
num amount;
|
|
|
|
|
String payment_method;
|
|
|
|
|
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
|
|
|
|
|
final currency = projectViewModel.user!.outSA == 0 ? "sar" : 'aed';
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) {
|
|
|
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), false, context).then((res) {
|
|
|
|
|
String paymentInfo = res['Response_Message'];
|
|
|
|
|
if (paymentInfo == 'Success') {
|
|
|
|
|
txn_ref = res['Merchant_Reference'];
|
|
|
|
@ -755,7 +755,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
getApplePayAPQ(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) {
|
|
|
|
|
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), false, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
String paymentInfo = res['Response_Message'];
|
|
|
|
@ -776,7 +776,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
String paymentReference = res['Fort_id'].toString();
|
|
|
|
|
service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) {
|
|
|
|
|
addAdvancedNumberRequest(
|
|
|
|
|
Utils.isVidaPlusProject(projectViewModel, appo.projectID)
|
|
|
|
|
Utils.isVidaPlusProject(projectViewModel, appo.projectID!)
|
|
|
|
|
? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
|
|
|
|
|
: res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
|
paymentReference,
|
|
|
|
@ -792,7 +792,7 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {
|
|
|
|
|
if (appo.isLiveCareAppointment) {
|
|
|
|
|
if (appo.isLiveCareAppointment!) {
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
} else {
|
|
|
|
|
getAppoQR(context);
|
|
|
|
@ -960,7 +960,8 @@ class _BookSuccessState extends State<BookSuccess> {
|
|
|
|
|
appointment.doctorTitle = "Dr. ";
|
|
|
|
|
appointment.doctorNameObj = widget.patientShareResponse.doctorNameObj;
|
|
|
|
|
appointment.doctorImageURL = widget.patientShareResponse.doctorImageURL;
|
|
|
|
|
appointment.doctorSpeciality = widget.patientShareResponse.doctorSpeciality;
|
|
|
|
|
appointment.doctorSpeciality = widget.patientShareResponse.doctorSpeciality as List<String>?;
|
|
|
|
|
// changed by Aamir List dynamic into list of Strings
|
|
|
|
|
appointment.projectName = widget.patientShareResponse.projectName;
|
|
|
|
|
appointment.projectID = widget.patientShareResponse.projectID;
|
|
|
|
|
appointment.appointmentDate = widget.patientShareResponse.appointmentDate;
|
|
|
|
|