|
|
|
@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
|
|
|
@ -18,7 +19,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
|
|
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
|
|
|
|
|
|
|
|
|
class ToDo extends StatefulWidget {
|
|
|
|
|
PatientShareResponse patientShareResponse;
|
|
|
|
@ -106,7 +106,12 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.liveCareAppo,
|
|
|
|
|
style: TextStyle(fontSize: 12.0))
|
|
|
|
|
: Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-",
|
|
|
|
|
: Text(
|
|
|
|
|
widget.appoList[index].projectName !=
|
|
|
|
|
null
|
|
|
|
|
? widget
|
|
|
|
|
.appoList[index].projectName
|
|
|
|
|
: "-",
|
|
|
|
|
style: TextStyle(fontSize: 11.0)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -464,8 +469,10 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPatientAppointmentHistory() {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.getPatientAppointmentHistory(true, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (res['AppoimentAllHistoryResultList'].length != 0) {
|
|
|
|
@ -485,26 +492,29 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPatientShare(context, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.getPatientShare(appo.appointmentNo.toString(), appo.clinicID,
|
|
|
|
|
appo.projectID, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
|
|
|
|
|
openPaymentDialog(appo, widget.patientShareResponse);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAppoQR(context, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
PatientShareResponse patientShareResponse = new PatientShareResponse();
|
|
|
|
|
|
|
|
|
|
patientShareResponse.doctorNameObj = appo.doctorNameObj;
|
|
|
|
@ -518,12 +528,13 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.generateAppointmentQR(patientShareResponse, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(res);
|
|
|
|
|
navigateToQR(context, res['AppointmentQR'], patientShareResponse);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToQR(
|
|
|
|
@ -620,6 +631,7 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.checkPaymentStatus(
|
|
|
|
@ -627,8 +639,7 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
appo.projectID, appo.clinicID, appo.appointmentNo),
|
|
|
|
|
context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
print("Printing Payment Status Reponse!!!!");
|
|
|
|
|
print(res);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
String paymentInfo = res['Response_Message'];
|
|
|
|
|
if (paymentInfo == 'Success') {
|
|
|
|
|
createAdvancePayment(res, appo);
|
|
|
|
@ -636,18 +647,20 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
AppToast.showErrorToast(message: res['Response_Message']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
String paymentReference = res['Fort_id'].toString();
|
|
|
|
|
service
|
|
|
|
|
.createAdvancePayment(
|
|
|
|
|
appo, res['Amount'], res['Fort_id'], res['PaymentMethod'], context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']);
|
|
|
|
|
addAdvancedNumberRequest(
|
|
|
|
|
res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
@ -656,23 +669,25 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
appo);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
print(res);
|
|
|
|
|
getAppoQR(context, appo);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToPaymentMethod(
|
|
|
|
@ -705,51 +720,46 @@ class _ToDoState extends State<ToDo> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confirmAppointment(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID,
|
|
|
|
|
appo.isLiveCareAppointment, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
getPatientAppointmentHistory();
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
})
|
|
|
|
|
.showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6))
|
|
|
|
|
.then((value) {
|
|
|
|
|
if (appo.isLiveCareAppointment) {
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
} else {
|
|
|
|
|
getPatientAppointmentHistory();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
if (appo.isLiveCareAppointment) {
|
|
|
|
|
insertLiveCareVIDARequest(appo);
|
|
|
|
|
} else {
|
|
|
|
|
getPatientAppointmentHistory();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID,
|
|
|
|
|
appo.serviceID, appo.doctorID, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
})
|
|
|
|
|
.showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6))
|
|
|
|
|
.then((value) {
|
|
|
|
|
getPatientAppointmentHistory();
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
getPatientAppointmentHistory();
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|