You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
601 lines
24 KiB
Dart
601 lines
24 KiB
Dart
import 'package:diplomaticquarterapp/analytics/google-analytics.dart';
|
|
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
|
|
import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart';
|
|
import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
import 'package:diplomaticquarterapp/locator.dart';
|
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
|
import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart';
|
|
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart';
|
|
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
|
|
import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart';
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart';
|
|
import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart';
|
|
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart';
|
|
import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_page.dart';
|
|
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart';
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/widgets/data_display/medical/medical_profile_item.dart';
|
|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:map_launcher/map_launcher.dart';
|
|
import 'package:maps_launcher/maps_launcher.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class AppointmentActions extends StatefulWidget {
|
|
AppoitmentAllHistoryResultList appo;
|
|
TabController tabController;
|
|
final Function enableFooterButton;
|
|
MyInAppBrowser browser;
|
|
final ProjectViewModel projectViewModel;
|
|
|
|
AppointmentActions({@required this.appo, @required this.tabController, @required this.enableFooterButton, this.projectViewModel});
|
|
|
|
@override
|
|
_AppointmentActionsState createState() => _AppointmentActionsState();
|
|
}
|
|
|
|
class _AppointmentActionsState extends State<AppointmentActions> {
|
|
List<AppoDetailsButton> appoButtonsList = [];
|
|
|
|
@override
|
|
void initState() {
|
|
_getAppointmentActionButtons();
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
ToDoCountProviderModel model = Provider.of<ToDoCountProviderModel>(context);
|
|
|
|
return GridView.builder(
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, crossAxisSpacing: 13, mainAxisSpacing: 9),
|
|
physics: NeverScrollableScrollPhysics(),
|
|
padding: EdgeInsets.all(21),
|
|
shrinkWrap: true,
|
|
itemBuilder: (context, index) {
|
|
bool shouldEnable = (widget.appo.clinicID == 17 && widget.appo.clinicID == 47 && appoButtonsList[index].caller == "openReschedule");
|
|
return InkWell(
|
|
onTap: shouldEnable
|
|
? null
|
|
: () {
|
|
_handleButtonClicks(appoButtonsList[index], model);
|
|
},
|
|
child: MedicalProfileItem(
|
|
title: appoButtonsList[index].title,
|
|
imagePath: appoButtonsList[index].icon,
|
|
subTitle: appoButtonsList[index].subtitle,
|
|
hasBadge: true,
|
|
isEnable: !shouldEnable,
|
|
imgColor: Color(0xff28323A),
|
|
),
|
|
);
|
|
},
|
|
itemCount: appoButtonsList.length,
|
|
);
|
|
}
|
|
|
|
_handleButtonClicks(AppoDetailsButton, ToDoCountProviderModel model) {
|
|
switch (AppoDetailsButton.caller) {
|
|
case "openReschedule":
|
|
widget.tabController.animateTo((widget.tabController.index + 1) % 2);
|
|
setState(() {
|
|
widget.enableFooterButton();
|
|
});
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'reschedule appointment');
|
|
break;
|
|
case "navigateToProject":
|
|
openMap(double.parse(widget.appo.latitude), double.parse(widget.appo.longitude));
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'hospital location');
|
|
break;
|
|
case "addReminder":
|
|
GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE = 'my appointment';
|
|
showReminderDialog(
|
|
context,
|
|
new DateFormat("dd MMM yyyy hh:mm")
|
|
.parse(DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate), widget.projectViewModel.isArabic) + " " + widget.appo.startTime),
|
|
//DateUtil.convertStringToDate(widget.appo.appointmentDate),
|
|
widget.appo.doctorNameObj,
|
|
"",
|
|
|
|
DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate), widget.projectViewModel.isArabic),
|
|
// DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.appo.appointmentDate)),
|
|
widget.appo.startTime,
|
|
onSuccess: () {
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
|
|
},
|
|
);
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'add reminder');
|
|
break;
|
|
case "goToTodoList":
|
|
// Navigator.of(context).pop();
|
|
navigateToToDoPage(context, model);
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'todo list');
|
|
break;
|
|
case "askDoc":
|
|
askYourDoc();
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'ask doctor');
|
|
break;
|
|
case "radiology":
|
|
openAppointmentRadiology();
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'radiology');
|
|
break;
|
|
case "labResult":
|
|
openAppointmentLabResults();
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'lab result');
|
|
break;
|
|
case "prescriptions":
|
|
openPrescriptionReport();
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'prescriptions');
|
|
break;
|
|
case "Survey":
|
|
rateAppointment();
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'survey');
|
|
break;
|
|
case "Insurance":
|
|
navigateToInsuranceApprovals(widget.appo.appointmentNo);
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'insurance');
|
|
break;
|
|
|
|
case "VitalSigns":
|
|
navigateToVitalSigns(widget.appo.appointmentNo, widget.appo.projectID);
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'vital sign');
|
|
break;
|
|
|
|
case "insertComplaint":
|
|
navigateToInsertComplaint();
|
|
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'raise complaint');
|
|
break;
|
|
}
|
|
}
|
|
|
|
_getAppointmentActionButtons() {
|
|
if (widget.appo != null) {
|
|
if (isConfirmed()) {
|
|
if (widget.appo.isOnlineCheckedIN) {
|
|
_getConfirmedCheckInAppoActionsList();
|
|
} else {
|
|
_getConfirmedAppoActionsList();
|
|
}
|
|
} else {
|
|
print("isConfirmed Null");
|
|
}
|
|
if (isBooked()) {
|
|
if (widget.appo.isOnlineCheckedIN) {
|
|
_getBookedCheckInAppoActionsList();
|
|
} else {
|
|
_getBookedAppoActionsList();
|
|
}
|
|
} else {
|
|
print("isBooked Null");
|
|
}
|
|
if (isArrived()) {
|
|
if (widget.appo.clinicID == 17) {
|
|
_getArrivedInvoiceAppoActionsList();
|
|
} else {
|
|
_getArrivedAppoActionsList();
|
|
}
|
|
} else {
|
|
print("isArrived Null");
|
|
}
|
|
} else {
|
|
print("Appo Null");
|
|
}
|
|
}
|
|
|
|
bool isConfirmed() {
|
|
return AppointmentType.isConfirmed(widget.appo);
|
|
}
|
|
|
|
bool isArrived() {
|
|
return AppointmentType.isArrived(widget.appo);
|
|
}
|
|
|
|
bool isCheckedIn() {
|
|
return widget.appo.isOnlineCheckedIN;
|
|
}
|
|
|
|
bool isBooked() {
|
|
return AppointmentType.isBooked(widget.appo);
|
|
}
|
|
|
|
Future<List<AppoDetailsButton>> _getBookedAppoActionsList() async {
|
|
print("_getBookedAppoActionsList");
|
|
BookedButtons bookedButtons = new BookedButtons();
|
|
print(bookedButtons.buttons);
|
|
List<AppoDetailsButton> buttonsList = [];
|
|
for (var i = 0; i < bookedButtons.buttons.length; i++) {
|
|
buttonsList.add(AppoDetailsButton(
|
|
title: bookedButtons.buttons[i]['title'],
|
|
subtitle: bookedButtons.buttons[i]['subtitle'],
|
|
icon: bookedButtons.buttons[i]['icon'],
|
|
caller: bookedButtons.buttons[i]['caller'],
|
|
));
|
|
}
|
|
setState(() {
|
|
appoButtonsList = buttonsList;
|
|
});
|
|
}
|
|
|
|
Future<List<AppoDetailsButton>> _getBookedCheckInAppoActionsList() async {
|
|
print("_getBookedCheckInAppoActionsList");
|
|
BookedButtonsAllowCheckIn bookedButtonsAllowCheckIn = new BookedButtonsAllowCheckIn();
|
|
print(bookedButtonsAllowCheckIn.buttons);
|
|
List<AppoDetailsButton> buttonsList = [];
|
|
for (var i = 0; i < bookedButtonsAllowCheckIn.buttons.length; i++) {
|
|
buttonsList.add(AppoDetailsButton(
|
|
title: bookedButtonsAllowCheckIn.buttons[i]['title'],
|
|
subtitle: bookedButtonsAllowCheckIn.buttons[i]['subtitle'],
|
|
icon: bookedButtonsAllowCheckIn.buttons[i]['icon'],
|
|
caller: bookedButtonsAllowCheckIn.buttons[i]['caller'],
|
|
));
|
|
}
|
|
setState(() {
|
|
appoButtonsList = buttonsList;
|
|
});
|
|
}
|
|
|
|
Future<List<AppoDetailsButton>> _getConfirmedAppoActionsList() async {
|
|
print("_getConfirmedAppoActionsList");
|
|
ConfirmedButtons confirmedButtons = new ConfirmedButtons();
|
|
print(confirmedButtons.buttons);
|
|
List<AppoDetailsButton> buttonsList = [];
|
|
for (var i = 0; i < confirmedButtons.buttons.length; i++) {
|
|
buttonsList.add(AppoDetailsButton(
|
|
title: confirmedButtons.buttons[i]['title'],
|
|
subtitle: confirmedButtons.buttons[i]['subtitle'],
|
|
icon: confirmedButtons.buttons[i]['icon'],
|
|
caller: confirmedButtons.buttons[i]['caller'],
|
|
));
|
|
}
|
|
setState(() {
|
|
appoButtonsList = buttonsList;
|
|
});
|
|
}
|
|
|
|
Future<List<AppoDetailsButton>> _getConfirmedCheckInAppoActionsList() async {
|
|
print("_getConfirmedAllowCheckInAppoActionsList");
|
|
ConfirmedButtonsAllowCheckIn confirmedButtonsAllowCheckIn = new ConfirmedButtonsAllowCheckIn();
|
|
print(confirmedButtonsAllowCheckIn.buttons);
|
|
List<AppoDetailsButton> buttonsList = [];
|
|
for (var i = 0; i < confirmedButtonsAllowCheckIn.buttons.length; i++) {
|
|
buttonsList.add(AppoDetailsButton(
|
|
title: confirmedButtonsAllowCheckIn.buttons[i]['title'],
|
|
subtitle: confirmedButtonsAllowCheckIn.buttons[i]['subtitle'],
|
|
icon: confirmedButtonsAllowCheckIn.buttons[i]['icon'],
|
|
caller: confirmedButtonsAllowCheckIn.buttons[i]['caller'],
|
|
));
|
|
}
|
|
setState(() {
|
|
appoButtonsList = buttonsList;
|
|
});
|
|
}
|
|
|
|
Future<List<AppoDetailsButton>> _getArrivedAppoActionsList() async {
|
|
print("_getArrivedAppoActionsList");
|
|
ArrivedButtons arrivedButtons = new ArrivedButtons();
|
|
print(arrivedButtons.buttons);
|
|
List<AppoDetailsButton> buttonsList = [];
|
|
for (var i = 0; i < arrivedButtons.buttons.length; i++) {
|
|
buttonsList.add(AppoDetailsButton(
|
|
title: arrivedButtons.buttons[i]['title'],
|
|
subtitle: arrivedButtons.buttons[i]['subtitle'],
|
|
icon: arrivedButtons.buttons[i]['icon'],
|
|
caller: arrivedButtons.buttons[i]['caller'],
|
|
));
|
|
}
|
|
setState(() {
|
|
appoButtonsList = buttonsList;
|
|
});
|
|
}
|
|
|
|
Future<List<AppoDetailsButton>> _getArrivedInvoiceAppoActionsList() async {
|
|
print("_getArrivedInvoiceAppoActionsList");
|
|
ArrivedButtons arrivedButtons = new ArrivedButtons();
|
|
List<AppoDetailsButton> buttonsList = [];
|
|
for (var i = 0; i < arrivedButtons.buttons.length; i++) {
|
|
buttonsList.add(AppoDetailsButton(
|
|
title: arrivedButtons.buttons[i]['title'],
|
|
subtitle: arrivedButtons.buttons[i]['subtitle'],
|
|
icon: arrivedButtons.buttons[i]['icon'],
|
|
caller: arrivedButtons.buttons[i]['caller'],
|
|
));
|
|
}
|
|
setState(() {
|
|
appoButtonsList = buttonsList;
|
|
});
|
|
}
|
|
|
|
// cancelAppointment() {
|
|
// ConfirmDialog.closeAlertDialog(context);
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
// DoctorsListService service = new DoctorsListService();
|
|
// service.cancelAppointment(widget.appo, context).then((res) {
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
// print(res);
|
|
// if (res['MessageStatus'] == 1) {
|
|
// getToDoCount();
|
|
// AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
// Navigator.of(context).pop();
|
|
// } else {
|
|
// AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
// }
|
|
// }).catchError((err) {
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
// print(err);
|
|
// });
|
|
// }
|
|
|
|
// getToDoCount() {
|
|
// toDoProvider.setState(0, true);
|
|
// ClinicListService service = new ClinicListService();
|
|
// service.getActiveAppointmentNo(context).then((res) {
|
|
// print(res['AppointmentActiveNumber']);
|
|
// if (res['MessageStatus'] == 1) {
|
|
// toDoProvider.setState(res['AppointmentActiveNumber'], true);
|
|
// } else {}
|
|
// }).catchError((err) {
|
|
// print(err);
|
|
// });
|
|
// }
|
|
|
|
openAppointmentLabResults() {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
DoctorsListService service = new DoctorsListService();
|
|
PatientLabOrders patientLabOrders = new PatientLabOrders();
|
|
service.getPatientLabOrdersByAppoNo(widget.appo.appointmentNo, widget.appo.projectID, widget.appo.clinicID, context).then((res) {
|
|
print(res['ListLabResultsByAppNo']);
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
if (res['ListLabResultsByAppNo'] != null) {
|
|
patientLabOrders.orderNo = res['ListLabResultsByAppNo'][0]['OrderNo'].toString();
|
|
patientLabOrders.invoiceNo = res['ListLabResultsByAppNo'][0]['InvoiceNo'].toString();
|
|
patientLabOrders.clinicID = widget.appo.clinicID;
|
|
patientLabOrders.clinicDescription = widget.appo.clinicName;
|
|
patientLabOrders.projectID = widget.appo.projectID.toString();
|
|
patientLabOrders.doctorName = widget.appo.doctorNameObj;
|
|
patientLabOrders.doctorImageURL = widget.appo.doctorImageURL;
|
|
patientLabOrders.speciality = widget.appo.doctorSpeciality;
|
|
patientLabOrders.projectName = widget.appo.projectName;
|
|
patientLabOrders.orderDate = DateUtil.convertStringToDate(widget.appo.appointmentDate);
|
|
patientLabOrders.doctorRate = widget.appo.doctorRate;
|
|
patientLabOrders.actualDoctorRate = widget.appo.actualDoctorRate;
|
|
patientLabOrders.noOfPatientsRate = widget.appo.noOfPatientsRate;
|
|
|
|
print(patientLabOrders.invoiceNo);
|
|
print(patientLabOrders.orderNo);
|
|
navigateToLabResults(patientLabOrders);
|
|
} else {
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
AppToast.showErrorToast(message: err);
|
|
});
|
|
}
|
|
|
|
openAppointmentRadiology() {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
DoctorsListService service = new DoctorsListService();
|
|
FinalRadiology finalRadiology = new FinalRadiology();
|
|
service.getPatientRadOrders(widget.appo.appointmentNo.toString(), context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
if (res['FinalRadiologyList'] != null) {
|
|
print(res['FinalRadiologyList']);
|
|
finalRadiology = new FinalRadiology.fromJson(res['FinalRadiologyList'][0]);
|
|
print(finalRadiology.reportData);
|
|
navigateToRadiologyDetails(finalRadiology);
|
|
} else {
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).noResultFound);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).noResultFound);
|
|
});
|
|
}
|
|
|
|
openPrescriptionReport() {
|
|
Prescriptions prescriptions = new Prescriptions();
|
|
|
|
prescriptions.doctorName = widget.appo.doctorNameObj;
|
|
prescriptions.appointmentNo = widget.appo.appointmentNo;
|
|
prescriptions.clinicID = widget.appo.clinicID;
|
|
prescriptions.projectID = widget.appo.projectID;
|
|
prescriptions.doctorImageURL = widget.appo.doctorImageURL;
|
|
prescriptions.speciality = widget.appo.doctorSpeciality;
|
|
prescriptions.name = widget.appo.projectName;
|
|
prescriptions.episodeID = widget.appo.episodeID;
|
|
prescriptions.setupID = widget.appo.setupID;
|
|
prescriptions.appointmentDate = widget.appo.appointmentDate;
|
|
prescriptions.nationalityFlagURL = "https://hmgwebservices.com/Images/flag/SAU.png";
|
|
prescriptions.doctorRate = widget.appo.doctorRate;
|
|
prescriptions.actualDoctorRate = widget.appo.actualDoctorRate;
|
|
prescriptions.noOfPatientsRate = widget.appo.noOfPatientsRate;
|
|
prescriptions.isInOutPatient = widget.appo.isInOutPatient;
|
|
prescriptions.doctorID = widget.appo.doctorID;
|
|
|
|
navigateToMedicinePrescriptionReport(prescriptions);
|
|
}
|
|
|
|
Future navigateToMedicinePrescriptionReport(Prescriptions prescriptions) async {
|
|
Navigator.push(context, FadePage(page: PrescriptionItemsPage(prescriptions: prescriptions)));
|
|
}
|
|
|
|
Future navigateToLabResults(PatientLabOrders patientLabOrders) async {
|
|
Navigator.push(context, FadePage(page: LaboratoryResultPage(patientLabOrders: patientLabOrders))).then((value) {});
|
|
}
|
|
|
|
Future navigateToRadiologyDetails(FinalRadiology finalRadiology) async {
|
|
Navigator.push(context, FadePage(page: RadiologyDetailsPage(finalRadiology: finalRadiology))).then((value) {});
|
|
}
|
|
|
|
static Future<void> openMap(double latitude, double longitude) async {
|
|
await MapLauncher.showMarker(
|
|
mapType: MapType.google,
|
|
coords: Coords(latitude, longitude),
|
|
title: "Sulaiman Al Habib",
|
|
description: "Appointment Location",
|
|
);
|
|
}
|
|
|
|
askYourDoc() {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
DoctorsListService service = new DoctorsListService();
|
|
service.isAllowedToAskDoctor(widget.appo.doctorID, context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(res['PatientDoctorAppointmentResultList']);
|
|
if (res['PatientDoctorAppointmentResultList'].length != 0) {
|
|
getCallRequestType();
|
|
} else {
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).askDocNotAllowed);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
AppToast.showErrorToast(message: err);
|
|
});
|
|
}
|
|
|
|
getCallRequestType() {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
DoctorsListService service = new DoctorsListService();
|
|
service.getCallRequestType(context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
List<AskDocRequestType> requestData = new List<AskDocRequestType>();
|
|
res['ListReqTypes'].forEach((element) {
|
|
requestData.add(new AskDocRequestType.fromJson(element));
|
|
});
|
|
Future.delayed(const Duration(milliseconds: 400), () {
|
|
showAskDocRequestDialog(requestData);
|
|
});
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
});
|
|
}
|
|
|
|
showAskDocRequestDialog(List<AskDocRequestType> requestData) {
|
|
showGeneralDialog(
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
transitionBuilder: (context, a1, a2, widget) {
|
|
final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
|
|
return Transform(
|
|
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
|
|
child: Opacity(
|
|
opacity: a1.value,
|
|
child: AskDocDialog(requestData: requestData),
|
|
),
|
|
);
|
|
},
|
|
transitionDuration: Duration(milliseconds: 500),
|
|
barrierDismissible: true,
|
|
barrierLabel: '',
|
|
context: context,
|
|
pageBuilder: (context, animation1, animation2) {})
|
|
.then((value) {
|
|
print("Dialog Closed");
|
|
print(value);
|
|
if (value != null) {
|
|
sendAskDocRequest(value);
|
|
}
|
|
});
|
|
}
|
|
|
|
sendAskDocRequest(int requestType) {
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
DoctorsListService service = new DoctorsListService();
|
|
service.sendAskDocCallRequest(widget.appo, requestType.toString(), context).then((res) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
if (res['MessageStatus'] == 1) {
|
|
AppToast.showSuccessToast(message: "Request Sent Successfully");
|
|
} else {
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
}
|
|
}).catchError((err) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
print(err);
|
|
AppToast.showErrorToast(message: err);
|
|
});
|
|
}
|
|
|
|
// confirmAppointment() {
|
|
// GifLoaderDialogUtils.showMyDialog(context);
|
|
// DoctorsListService service = new DoctorsListService();
|
|
// service.confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, widget.appo.projectID, widget.appo.isLiveCareAppointment, context).then((res) {
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
// if (res['MessageStatus'] == 1) {
|
|
// AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
|
|
// Navigator.of(context).pop();
|
|
// } else {
|
|
// AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
// }
|
|
// }).catchError((err) {
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
// print(err);
|
|
// });
|
|
// }
|
|
|
|
navigateToInsuranceApprovals(int appoNo) {
|
|
Navigator.push(context, FadePage(page: InsuranceApproval(appointmentNo: appoNo)));
|
|
}
|
|
|
|
navigateToVitalSigns(int appoNo, int projectID) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: VitalSignDetailsScreen(
|
|
appointmentNo: appoNo,
|
|
projectID: projectID,
|
|
isNotOneAppointment: false,
|
|
)));
|
|
}
|
|
|
|
navigateToInsertComplaint() {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: FeedbackHomePage(
|
|
messageType: MessageType.ComplaintOnAnAppointment,
|
|
appointment: widget.appo,
|
|
)));
|
|
}
|
|
|
|
navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) {
|
|
if (widget.projectViewModel.isLogin) {
|
|
if (model.count != 0) {
|
|
Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true)));
|
|
} else {
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty);
|
|
}
|
|
} else {
|
|
Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true)));
|
|
}
|
|
}
|
|
|
|
rateAppointment() {
|
|
widget.browser = new MyInAppBrowser();
|
|
var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1';
|
|
print(url);
|
|
launch(url);
|
|
}
|
|
}
|