|
|
|
@ -9,13 +9,13 @@ import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.da
|
|
|
|
|
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/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
|
|
|
|
import 'package:table_calendar/table_calendar.dart';
|
|
|
|
|
|
|
|
|
|
class CovidTimeSlots extends StatefulWidget {
|
|
|
|
@ -469,9 +469,7 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bookCovidTestAppointment() {
|
|
|
|
|
// Navigator.push(context,
|
|
|
|
|
// MaterialPageRoute(builder: (context) => CovidPaymentAlert()));
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorList docObject = new DoctorList();
|
|
|
|
|
docObject.doctorID = widget.selectedDoctorID;
|
|
|
|
|
docObject.clinicID = widget.selectedClinicID;
|
|
|
|
@ -494,11 +492,12 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots>
|
|
|
|
|
print(res);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
AppToast.showSuccessToast(message: "Appointment Booked Successfully");
|
|
|
|
|
Future.delayed(new Duration(milliseconds: 1800), () {
|
|
|
|
|
getPatientShare(context, res['AppointmentNo'], docObject.clinicID,
|
|
|
|
|
docObject.projectID, docObject);
|
|
|
|
|
});
|
|
|
|
|
// Future.delayed(new Duration(milliseconds: 1800), () {
|
|
|
|
|
getPatientShare(context, res['AppointmentNo'], docObject.clinicID,
|
|
|
|
|
docObject.projectID, docObject);
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo'];
|
|
|
|
|
appo.clinicID = res['SameClinicApptList'][0]['DoctorID'];
|
|
|
|
@ -521,28 +520,32 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots>
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo,
|
|
|
|
|
BuildContext context) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
ConfirmDialog.closeAlertDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.cancelAppointment(appo, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
Future.delayed(new Duration(milliseconds: 1500), () {
|
|
|
|
|
insertAppointmentCovidTest(context, docObject);
|
|
|
|
|
});
|
|
|
|
|
// Future.delayed(new Duration(milliseconds: 1500), () {
|
|
|
|
|
insertAppointmentCovidTest(context, docObject);
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPatientShare(context, String appointmentNo, int clinicID, int projectID,
|
|
|
|
@ -551,17 +554,14 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots>
|
|
|
|
|
service
|
|
|
|
|
.getPatientShare(appointmentNo, clinicID, projectID, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
print(res);
|
|
|
|
|
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
|
|
|
|
|
})
|
|
|
|
|
.catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
})
|
|
|
|
|
.showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6))
|
|
|
|
|
.then((value) {
|
|
|
|
|
navigateToPaymentAlert();
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
|
|
|
|
|
navigateToPaymentAlert();
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
navigateToPaymentAlert() {
|
|
|
|
@ -573,8 +573,10 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCovidFreeSlots(BuildContext context, int projectID) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
CovidDriveThruService service = new CovidDriveThruService();
|
|
|
|
|
service.getCovidFreeSlots(context, projectID).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(res['COVID19_FreeTimeSlots']);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
if (res['COVID19_FreeTimeSlots'].length != 0) {
|
|
|
|
@ -592,11 +594,13 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots>
|
|
|
|
|
});
|
|
|
|
|
} else {}
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|