|
|
|
|
@ -139,6 +139,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
bool applyFilters = false;
|
|
|
|
|
|
|
|
|
|
bool isWaitingAppointmentAvailable = false;
|
|
|
|
|
bool isPatientRescheduleAppointment = false;
|
|
|
|
|
|
|
|
|
|
bool isWaitingAppointmentSelected = false;
|
|
|
|
|
int waitingAppointmentProjectID = 0;
|
|
|
|
|
@ -289,6 +290,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
isContinueDentalPlan = false;
|
|
|
|
|
isChiefComplaintsListLoading = true;
|
|
|
|
|
isWaitingAppointmentSelected = false;
|
|
|
|
|
isPatientRescheduleAppointment = false;
|
|
|
|
|
bodyTypes = [maleLaserCategory, femaleLaserCategory];
|
|
|
|
|
// getLocation();
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -427,6 +429,11 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setIsPatientRescheduleAppointment(bool isPatientRescheduleAppointment) {
|
|
|
|
|
this.isPatientRescheduleAppointment = isPatientRescheduleAppointment;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void onTabChanged(int index) {
|
|
|
|
|
calculationID = null;
|
|
|
|
|
isGetDocForHealthCal = false;
|
|
|
|
|
@ -854,64 +861,103 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
print(failure);
|
|
|
|
|
onError!(failure.message);
|
|
|
|
|
},
|
|
|
|
|
(apiResponse) {
|
|
|
|
|
(apiResponse) async {
|
|
|
|
|
if (apiResponse.messageStatus == 2) {
|
|
|
|
|
// onError!(apiResponse);
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!),
|
|
|
|
|
navigationService.navigatorKey.currentContext!,
|
|
|
|
|
child: Utils.getWarningWidget(
|
|
|
|
|
loadingText: apiResponse.data["ErrorEndUserMessage"],
|
|
|
|
|
isShowActionButtons: true,
|
|
|
|
|
onCancelTap: () {
|
|
|
|
|
navigationService.pop();
|
|
|
|
|
},
|
|
|
|
|
onConfirmTap: () async {
|
|
|
|
|
navigationService.pop();
|
|
|
|
|
PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel = PatientAppointmentHistoryResponseModel(
|
|
|
|
|
appointmentNo: apiResponse.data["SameClinicApptList"][0]['AppointmentNo'],
|
|
|
|
|
clinicID: apiResponse.data["SameClinicApptList"][0]['ClinicID'],
|
|
|
|
|
projectID: apiResponse.data["SameClinicApptList"][0]['ProjectID'],
|
|
|
|
|
endDate: apiResponse.data["SameClinicApptList"][0]['EndTime'],
|
|
|
|
|
startTime: apiResponse.data["SameClinicApptList"][0]['StartTime'],
|
|
|
|
|
doctorID: apiResponse.data["SameClinicApptList"][0]['DoctorID'],
|
|
|
|
|
isLiveCareAppointment: apiResponse.data["SameClinicApptList"][0]['IsLiveCareAppointment'],
|
|
|
|
|
originalClinicID: 0,
|
|
|
|
|
originalProjectID: 0,
|
|
|
|
|
appointmentDate: apiResponse.data["SameClinicApptList"][0]['AppointmentDate'],
|
|
|
|
|
);
|
|
|
|
|
if (isPatientRescheduleAppointment) {
|
|
|
|
|
PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel = PatientAppointmentHistoryResponseModel(
|
|
|
|
|
appointmentNo: apiResponse.data["SameClinicApptList"][0]['AppointmentNo'],
|
|
|
|
|
clinicID: apiResponse.data["SameClinicApptList"][0]['ClinicID'],
|
|
|
|
|
projectID: apiResponse.data["SameClinicApptList"][0]['ProjectID'],
|
|
|
|
|
endDate: apiResponse.data["SameClinicApptList"][0]['EndTime'],
|
|
|
|
|
startTime: apiResponse.data["SameClinicApptList"][0]['StartTime'],
|
|
|
|
|
doctorID: apiResponse.data["SameClinicApptList"][0]['DoctorID'],
|
|
|
|
|
isLiveCareAppointment: apiResponse.data["SameClinicApptList"][0]['IsLiveCareAppointment'],
|
|
|
|
|
originalClinicID: 0,
|
|
|
|
|
originalProjectID: 0,
|
|
|
|
|
appointmentDate: apiResponse.data["SameClinicApptList"][0]['AppointmentDate'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
LoaderBottomSheet.showLoader(
|
|
|
|
|
loadingText: LocaleKeys.reschedulingAppo.tr(context: navigationService.navigatorKey.currentContext!),
|
|
|
|
|
);
|
|
|
|
|
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
|
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr());
|
|
|
|
|
await insertSpecificAppointment(
|
|
|
|
|
onError: (err) {},
|
|
|
|
|
onSuccess: (apiResp) async {
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
|
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
navigationService.navigatorKey.currentContext!,
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
page: LandingNavigation(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
|
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr());
|
|
|
|
|
await insertSpecificAppointment(
|
|
|
|
|
onError: (err) {},
|
|
|
|
|
onSuccess: (apiResp) async {
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
|
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
|
|
|
|
|
setIsPatientRescheduleAppointment(false);
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
navigationService.navigatorKey.currentContext!,
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
page: LandingNavigation(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!),
|
|
|
|
|
navigationService.navigatorKey.currentContext!,
|
|
|
|
|
child: Utils.getWarningWidget(
|
|
|
|
|
loadingText: apiResponse.data["ErrorEndUserMessage"],
|
|
|
|
|
isShowActionButtons: true,
|
|
|
|
|
onCancelTap: () {
|
|
|
|
|
navigationService.pop();
|
|
|
|
|
},
|
|
|
|
|
onConfirmTap: () async {
|
|
|
|
|
navigationService.pop();
|
|
|
|
|
PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel = PatientAppointmentHistoryResponseModel(
|
|
|
|
|
appointmentNo: apiResponse.data["SameClinicApptList"][0]['AppointmentNo'],
|
|
|
|
|
clinicID: apiResponse.data["SameClinicApptList"][0]['ClinicID'],
|
|
|
|
|
projectID: apiResponse.data["SameClinicApptList"][0]['ProjectID'],
|
|
|
|
|
endDate: apiResponse.data["SameClinicApptList"][0]['EndTime'],
|
|
|
|
|
startTime: apiResponse.data["SameClinicApptList"][0]['StartTime'],
|
|
|
|
|
doctorID: apiResponse.data["SameClinicApptList"][0]['DoctorID'],
|
|
|
|
|
isLiveCareAppointment: apiResponse.data["SameClinicApptList"][0]['IsLiveCareAppointment'],
|
|
|
|
|
originalClinicID: 0,
|
|
|
|
|
originalProjectID: 0,
|
|
|
|
|
appointmentDate: apiResponse.data["SameClinicApptList"][0]['AppointmentDate'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
LoaderBottomSheet.showLoader(
|
|
|
|
|
loadingText: LocaleKeys.reschedulingAppo.tr(context: navigationService.navigatorKey.currentContext!),
|
|
|
|
|
);
|
|
|
|
|
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
|
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr());
|
|
|
|
|
await insertSpecificAppointment(
|
|
|
|
|
onError: (err) {},
|
|
|
|
|
onSuccess: (apiResp) async {
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
|
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
|
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
navigationService.navigatorKey.currentContext!,
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
page: LandingNavigation(),
|
|
|
|
|
),
|
|
|
|
|
(r) => false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else if (apiResponse.messageStatus == 1) {
|
|
|
|
|
if (apiResponse.data == null || apiResponse.data!.isEmpty) {
|
|
|
|
|
onError!("No free slots available".tr());
|
|
|
|
|
|