Walkin appointment booking implementation contd

dev_3.13.6_CR6750
haroon amjad 2 years ago
parent d65325f998
commit ca8533190a

@ -345,6 +345,8 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari
var GET_PATIENT_SHARE_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForWalkIn'; var GET_PATIENT_SHARE_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForWalkIn';
var CAN_PAY_FOR_FOR_WALKIN_APPOINTMENT = 'Services/Doctors.svc/REST/CanPayForWalkinAppointment';
//URL to get medicine and pharmacies list //URL to get medicine and pharmacies list
var CHANNEL = 3; var CHANNEL = 3;
var GENERAL_ID = 'Cs2020@2016\$2958'; var GENERAL_ID = 'Cs2020@2016\$2958';
@ -606,9 +608,9 @@ var GET_DENTAL_APPOINTMENT_INVOICE = "Services/Patients.svc/REST/HIS_eInvoiceFor
var SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = "Services/Notifications.svc/REST/SendInvoiceForDental"; var SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = "Services/Notifications.svc/REST/SendInvoiceForDental";
var GET_TAMARA_PLAN = 'https://mdlaboratories.com/tamaralive/Home/GetInstallments'; var GET_TAMARA_PLAN = 'https://mdlaboratories.com/tamara/Home/GetInstallments';
var GET_TAMARA_PAYMENT_STATUS = 'https://mdlaboratories.com/tamaralive/api/OnlineTamara/order_status?orderid='; var GET_TAMARA_PAYMENT_STATUS = 'https://mdlaboratories.com/tamara/api/OnlineTamara/order_status?orderid=';
var UPDATE_TAMARA_STATUS = 'Services/PayFort_Serv.svc/REST/Tamara_UpdateRequestStatus'; var UPDATE_TAMARA_STATUS = 'Services/PayFort_Serv.svc/REST/Tamara_UpdateRequestStatus';
@ -670,6 +672,8 @@ var GET_WE_CARE_TOUR_URL = 'Services/Consent.svc/Rest/Consent_VirtualJurny_Url_G
var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification'; var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification';
var INSERT_WALKIN_APPOINTMENT = "Services/Doctors.svc/REST/InsertWalkinAppointment";
//PAYFORT //PAYFORT
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";

@ -48,14 +48,19 @@ class ProjectViewModel extends BaseViewModel {
GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel(); GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel();
int waitingAppointmentProjectID = 0; int waitingAppointmentProjectID = 0;
DoctorList? waitingAppointmentDoctor; DoctorList? waitingAppointmentDoctor;
String waitingAppointmentNFCCode = "";
setWaitingAppointmentDoctor(DoctorList waitingAppointmentDoctor) { setWaitingAppointmentDoctor(DoctorList waitingAppointmentDoctor) {
this.waitingAppointmentDoctor = waitingAppointmentDoctor; this.waitingAppointmentDoctor = waitingAppointmentDoctor;
notifyListeners(); notifyListeners();
} }
setWaitingAppointmentNFCCode(String waitingAppointmentNFCCode) {
this.waitingAppointmentNFCCode = waitingAppointmentNFCCode;
notifyListeners();
}
setWaitingAppointmentProjectID(int projectID) { setWaitingAppointmentProjectID(int projectID) {
this.waitingAppointmentProjectID = projectID; this.waitingAppointmentProjectID = projectID;
notifyListeners(); notifyListeners();

@ -382,7 +382,7 @@ class _BookConfirmState extends State<BookConfirm> {
customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!, customerName: projectViewModel.user.firstName! + " " + projectViewModel.user.lastName!,
// customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress,
customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com",
orderDescription: "Appointment Payment", orderDescription: "Walk-In appointment payment",
orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()),
merchantReference: transID, merchantReference: transID,
payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel,
@ -473,12 +473,12 @@ class _BookConfirmState extends State<BookConfirm> {
try { try {
if (selectedPaymentMethod == "TAMARA") { if (selectedPaymentMethod == "TAMARA") {
checkTamaraPaymentStatus(transID!, appo); checkTamaraPaymentStatus(transID!, appo);
if (tamaraPaymentStatus != null && tamaraPaymentStatus!.toLowerCase() == "approved") { // if (tamaraPaymentStatus != null && tamaraPaymentStatus!.toLowerCase() == "approved") {
updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID!, num.parse(selectedInstallments!), appo); // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID!, num.parse(selectedInstallments!), appo);
} else { // } else {
updateTamaraRequestStatus( // 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! : "", num.parse(selectedInstallments!), appo);
} // }
} else { } else {
checkPaymentStatus(appo); checkPaymentStatus(appo);
} }
@ -512,8 +512,7 @@ class _BookConfirmState extends State<BookConfirm> {
service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) { service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (tamaraPaymentStatus!.toLowerCase() == "approved") { if (tamaraPaymentStatus!.toLowerCase() == "approved") {
// markAppointmentForTamara(appo); insertWalkInAppointment(context, widget.doctor, widget.initialSlotDuration, tamaraOrderID);
// addAdvancedNumberRequestTamara("Tamara-Advance-0000", tamaraOrderID, appo.appointmentNo.toString(), appo);
} }
}).catchError((err) { }).catchError((err) {
print(err); print(err);
@ -525,6 +524,28 @@ class _BookConfirmState extends State<BookConfirm> {
} }
} }
addAdvancedNumberRequestTamara(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
markAppointmentForTamara(AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.markAppointmentForTamara(appo.projectID!, appo.appointmentNo.toString()).then((res) {
GifLoaderDialogUtils.hideDialog(context);
sendNfcCheckInRequest(projectViewModel.waitingAppointmentNFCCode, 2, int.parse(appo.appointmentNo), projectViewModel.waitingAppointmentProjectID);
}).catchError((err) {
print(err);
AppToast.showErrorToast(message: err);
GifLoaderDialogUtils.hideDialog(context);
});
}
checkPaymentStatus(AppoitmentAllHistoryResultList appo) { checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
String txn_ref; String txn_ref;
num amount; num amount;
@ -539,7 +560,7 @@ class _BookConfirmState extends State<BookConfirm> {
amount = res['Amount']; amount = res['Amount'];
payment_method = res['PaymentMethod']; payment_method = res['PaymentMethod'];
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
// createAdvancePayment(res, appo); insertWalkInAppointment(context, widget.doctor, widget.initialSlotDuration, res);
projectViewModel.analytics.appointment.payment_success( projectViewModel.analytics.appointment.payment_success(
appointment_type: 'Walk-In', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref); appointment_type: 'Walk-In', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref);
} else { } else {
@ -588,6 +609,23 @@ class _BookConfirmState extends State<BookConfirm> {
); );
} }
// canPayForWalkInAppointment() {
// GifLoaderDialogUtils.showMyDialog(context);
// widget.service
// .canPayForWalkInAppointment(
// widget.doctor.projectID!,
// widget.doctor.clinicID!,
// )
// .then((res) {
// GifLoaderDialogUtils.hideDialog(context);
// getWalkinAppointmentPatientShare();
// }).catchError((err) {
// GifLoaderDialogUtils.hideDialog(context);
// AppToast.showErrorToast(message: err);
// print(err);
// });
// }
getWalkinAppointmentPatientShare() { getWalkinAppointmentPatientShare() {
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -598,13 +636,18 @@ class _BookConfirmState extends State<BookConfirm> {
widget.service widget.service
.getPatientShareForWalkInAppointment( .getPatientShareForWalkInAppointment(
widget.doctor.projectID!,
widget.doctor.clinicID!, widget.doctor.clinicID!,
widget.doctor.projectID!,
widget.doctor.doctorID!,
) )
.then((res) { .then((res) {
widget.patientShareResponse = new PatientShareResponse.fromJson(res["OnlineCheckInAppointmentsWalkInModel"]); widget.patientShareResponse = new PatientShareResponse.fromJson(res["OnlineCheckInAppointmentsWalkInModel"]);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (widget.patientShareResponse.patientShareWithTax != 0 || widget.patientShareResponse.patientShareWithTax != 0.0) {
openPaymentDialog(appo, widget.patientShareResponse!); openPaymentDialog(appo, widget.patientShareResponse!);
} else {
insertWalkInAppointment(context, widget.doctor, widget.initialSlotDuration, null);
}
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
@ -679,11 +722,102 @@ class _BookConfirmState extends State<BookConfirm> {
}); });
} }
insertWalkInAppointment(context, DoctorList docObject, int initialSlotDuration, paymentRes) async {
GifLoaderDialogUtils.showMyDialog(
context,
);
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
appo.doctorID = docObject.doctorID;
appo.clinicID = docObject.clinicID;
appo.projectID = docObject.projectID;
widget.service
.insertWalkInAppointment(
docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context)
.then((res) {
if (res['MessageStatus'] == 1) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
appo.appointmentNo = res["AppointmentNo"]; // Add appointment No to the appointment project
Future.delayed(Duration(milliseconds: 500), () {
if (selectedPaymentMethod == "TAMARA") {
markAppointmentForTamara(appo);
addAdvancedNumberRequestTamara("Tamara-Advance-0000", paymentRes, res["AppointmentNo"].toString(), appo);
} else {
if (widget.patientShareResponse.patientShareWithTax != 0 || widget.patientShareResponse.patientShareWithTax != 0.0) {
createAdvancePayment(paymentRes, appo);
} else {
sendNfcCheckInRequest(projectViewModel.waitingAppointmentNFCCode, 2, int.parse(res["AppointmentNo"]), projectViewModel.waitingAppointmentProjectID);
}
}
});
} else {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
});
}
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(
context,
);
DoctorsListService service = new DoctorsListService();
String paymentReference = res['Fort_id'].toString();
service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
addAdvancedNumberRequest(
Utils.isVidaPlusProject(projectViewModel, appo.projectID!)
? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
: res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
paymentReference,
appo.appointmentNo.toString(),
appo);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
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);
sendNfcCheckInRequest(projectViewModel.waitingAppointmentNFCCode, 2, int.parse(appointmentID), projectViewModel.waitingAppointmentProjectID);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
sendNfcCheckInRequest(String nfcId, int checkInBy, int appoNo, int projectID) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.sendCheckinNfcRequest(appoNo, nfcId, projectID, checkInBy, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
_showMyDialog(res["SuccessMsg"], this.context);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
_showMyDialog(err, this.context);
});
}
insertAppointment(context, DoctorList docObject, int initialSlotDuration) async { insertAppointment(context, DoctorList docObject, int initialSlotDuration) async {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
String logs = await sharedPref.getString('selectedLogSlots'); String logs = await sharedPref.getString('selectedLogSlots');
List<dynamic> decodedLogs = json.decode(logs); List<dynamic> decodedLogs = json.decode(logs);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); GifLoaderDialogUtils.showMyDialog(
context,
);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service widget.service
// .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, 'null', null, null, projectViewModel) // .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, 'null', null, null, projectViewModel)
@ -741,7 +875,9 @@ class _BookConfirmState extends State<BookConfirm> {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
widget.selectedDate = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[0]; widget.selectedDate = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[0];
widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); GifLoaderDialogUtils.showMyDialog(
context,
);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service widget.service
.insertLiveCareScheduleAppointment( .insertLiveCareScheduleAppointment(
@ -805,7 +941,9 @@ class _BookConfirmState extends State<BookConfirm> {
getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) {
int languageID = projectViewModel.isArabic ? 1 : 2; int languageID = projectViewModel.isArabic ? 1 : 2;
String errorMsg = ""; String errorMsg = "";
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); GifLoaderDialogUtils.showMyDialog(
context,
);
widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) { widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) {
projectViewModel.selectedBodyPartList.clear(); projectViewModel.selectedBodyPartList.clear();
projectViewModel.laserSelectionDuration = 0; projectViewModel.laserSelectionDuration = 0;
@ -934,4 +1072,32 @@ class _BookConfirmState extends State<BookConfirm> {
), ),
); );
} }
Future<void> _showMyDialog(String message, BuildContext context) async {
return showDialog<void>(
context: context,
barrierDismissible: true, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Alert'),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(message),
],
),
),
actions: <Widget>[
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).pop();
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
},
),
],
);
},
);
}
} }

@ -522,7 +522,18 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
// navigateToDentalComplaints(context); // navigateToDentalComplaints(context);
// } else { // } else {
if (DocAvailableAppointments.selectedTime == TranslationBase.of(context).waitingAppointment) { if (DocAvailableAppointments.selectedTime == TranslationBase.of(context).waitingAppointment) {
navigateToWaitingAppointment(context); if (projectViewModel.isLogin) {
canPayForWalkInAppointment();
} else {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).loginToUseService,
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {navigateToLogin()},
cancelFunction: () => {});
dialog.showAlertDialog(context);
}
} else { } else {
if (DocAvailableAppointments.areSlotsAvailable) { if (DocAvailableAppointments.areSlotsAvailable) {
if (projectViewModel.isLogin) { if (projectViewModel.isLogin) {
@ -607,4 +618,17 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
), ),
); );
} }
canPayForWalkInAppointment() {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.canPayForWalkInAppointment(widget.doctor.projectID!, widget.doctor.clinicID!, widget.doctor.doctorID!).then((res) {
GifLoaderDialogUtils.hideDialog(context);
navigateToWaitingAppointment(context);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
} }

@ -353,7 +353,8 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
if (res['FreeTimeSlots'].length != 0) { if (res['FreeTimeSlots'].length != 0) {
isWaitingAppointmentAvailable = res['IsAllowToBookWaitingAppointment']; // true; // isWaitingAppointmentAvailable = res['IsAllowToBookWaitingAppointment']; // true;
isWaitingAppointmentAvailable = true; // true;
DocAvailableAppointments.initialSlotDuration = res['InitialSlotDuration']; DocAvailableAppointments.initialSlotDuration = res['InitialSlotDuration'];
DocAvailableAppointments.areAppointmentsAvailable = true; DocAvailableAppointments.areAppointmentsAvailable = true;
freeSlotsResponse = res['FreeTimeSlots']; freeSlotsResponse = res['FreeTimeSlots'];

@ -226,6 +226,7 @@ class _WaitingAppointmentVerificationState extends State<WaitingAppointmentVerif
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service.checkScannedNFCAndQRCode(nfcId, projectViewModel.waitingAppointmentDoctor!.projectID!).then((res) { service.checkScannedNFCAndQRCode(nfcId, projectViewModel.waitingAppointmentDoctor!.projectID!).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
projectViewModel.setWaitingAppointmentNFCCode(nfcId);
if (res["returnValue"] == 1) { if (res["returnValue"] == 1) {
navigateToBookConfirm(context); navigateToBookConfirm(context);
} else { } else {
@ -260,6 +261,7 @@ class _WaitingAppointmentVerificationState extends State<WaitingAppointmentVerif
locationUtils.getCurrentLocation(callBack: (value) { locationUtils.getCurrentLocation(callBack: (value) {
projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, projectViewModel.waitingAppointmentProjectID); projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, projectViewModel.waitingAppointmentProjectID);
double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000;
projectViewModel.setWaitingAppointmentNFCCode(projectDetailListModel.checkInQrCode!);
print(dist); print(dist);
if (dist <= projectDetailListModel.geofenceRadius!) { if (dist <= projectDetailListModel.geofenceRadius!) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);

@ -22,8 +22,7 @@ import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doct
import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart'; import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family;
as family;
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
@ -76,8 +75,7 @@ class LandingPage extends StatefulWidget {
class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver { class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
var authProvider = new AuthProvider(); var authProvider = new AuthProvider();
AppointmentRateViewModel appointmentRateViewModel = AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
locator<AppointmentRateViewModel>();
int currentTab = 0; int currentTab = 0;
late PageController pageController; late PageController pageController;
@ -94,8 +92,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
bool _showBottomNavigationBar = true; bool _showBottomNavigationBar = true;
///inject the user data ///inject the user data
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
final authService = new AuthProvider(); final authService = new AuthProvider();
@ -122,22 +119,17 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
"appointmentdate": "2022-01-19", "appointmentdate": "2022-01-19",
"appointmenttime": "12:10", "appointmenttime": "12:10",
"PatientName": "Testing", "PatientName": "Testing",
"session_id": "session_id": "1_MX40NjIwOTk2Mn5-MTY0NzI1NjYxNDI2OX5ySXhlVjZjam13RFdMVmdleWVsSDhzQkx-fg",
"1_MX40NjIwOTk2Mn5-MTY0NzI1NjYxNDI2OX5ySXhlVjZjam13RFdMVmdleWVsSDhzQkx-fg",
"token": "token":
"T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9OGMyY2IyYWFiZmZmMzI4ZmEwMjgxNDdmMGFhZGI0N2JiZjdmZWY4MjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWTBOekkxTmpZeE5ESTJPWDV5U1hobFZqWmphbTEzUkZkTVZtZGxlV1ZzU0RoelFreC1mZyZjcmVhdGVfdGltZT0xNjQ3MjU2NjE0Jm5vbmNlPTAuMjgzNDgyNjM1NDczNjQ2OCZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjQ3MjU4NDE0JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9", "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9OGMyY2IyYWFiZmZmMzI4ZmEwMjgxNDdmMGFhZGI0N2JiZjdmZWY4MjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWTBOekkxTmpZeE5ESTJPWDV5U1hobFZqWmphbTEzUkZkTVZtZGxlV1ZzU0RoelFreC1mZyZjcmVhdGVfdGltZT0xNjQ3MjU2NjE0Jm5vbmNlPTAuMjgzNDgyNjM1NDczNjQ2OCZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjQ3MjU4NDE0JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9",
"DoctorImageURL": "DoctorImageURL": "https://image.shutterstock.com/image-vector/sample-stamp-square-grunge-sign-260nw-1474408826.jpg",
"https://image.shutterstock.com/image-vector/sample-stamp-square-grunge-sign-260nw-1474408826.jpg",
"callerID": "9920", "callerID": "9920",
"PatientID": "1231755", "PatientID": "1231755",
"is_call": "true" "is_call": "true"
}; };
void _requestIOSPermissions() { void _requestIOSPermissions() {
flutterLocalNotificationsPlugin flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()?.requestPermissions(
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin>()
?.requestPermissions(
alert: true, alert: true,
badge: true, badge: true,
sound: true, sound: true,
@ -153,8 +145,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
return Future.value(false); return Future.value(false);
} else { } else {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
if (currentBackPressTime == null || if (currentBackPressTime == null || now.difference(currentBackPressTime!) > Duration(seconds: 2)) {
now.difference(currentBackPressTime!) > Duration(seconds: 2)) {
currentBackPressTime = now; currentBackPressTime = now;
AppToast.showToast(message: TranslationBase.of(context).pressAgain); AppToast.showToast(message: TranslationBase.of(context).pressAgain);
return Future.value(false); return Future.value(false);
@ -169,18 +160,14 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
List<ImagesInfo> imagesInfo = []; List<ImagesInfo> imagesInfo = [];
imagesInfo.add( imagesInfo.add(
ImagesInfo( ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png',
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'),
imageAr:
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'),
); );
imagesInfo.add( imagesInfo.add(
ImagesInfo( ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png',
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'),
imageAr:
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'),
); );
Navigator.push( Navigator.push(
@ -199,11 +186,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
} }
if (tab == 4) { if (tab == 4) {
List<ImagesInfo> imagesInfo = []; List<ImagesInfo> imagesInfo = [];
imagesInfo.add(ImagesInfo( imagesInfo.add(
imageEn: ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png'));
'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png'));
Navigator.push( Navigator.push(
context, context,
@ -248,8 +232,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
}); });
}); });
projectViewModel.analytics.bottomTabNavigation projectViewModel.analytics.bottomTabNavigation.log(tabIndex: tab, isLoggedIn: projectViewModel.isLogin);
.log(tabIndex: tab, isLoggedIn: projectViewModel.isLogin);
} }
getToDoCount() { getToDoCount() {
@ -260,11 +243,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
print(res['AppointmentActiveNumber']); print(res['AppointmentActiveNumber']);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
// toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount);
toDoProvider.setState( toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount);
res['AppointmentActiveNumber'],
res['AncillaryOrderListCount'],
true,
toDoProvider.notificationsCount);
} else {} } else {}
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -303,10 +282,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { if (projectViewModel.isLogin && !projectViewModel.isLoginChild) {
int languageID = int languageID = Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 1 : 2;
Provider.of<ProjectViewModel>(context, listen: false).isArabic
? 1
: 2;
familyFileProvider.getSharedRecordByStatus(languageID); familyFileProvider.getSharedRecordByStatus(languageID);
} }
// Future.delayed(Duration(seconds: 3)).then((result) async { // Future.delayed(Duration(seconds: 3)).then((result) async {
@ -346,7 +322,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
startZoom(); startZoom();
// HMG_Geofencing(context).loadZones().then((instance) => instance.init()); // HMG_Geofencing(context).loadZones().then((instance) => instance.init());
} }
void startZoom(){
void startZoom() {
var zoom = ZoomVideoSdk(); var zoom = ZoomVideoSdk();
InitConfig initConfig = InitConfig( InitConfig initConfig = InitConfig(
domain: "zoom.us", domain: "zoom.us",
@ -476,20 +453,14 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
getNotificationCount(token) async { getNotificationCount(token) async {
if (await sharedPref.getObject(USER_PROFILE) != null) { if (await sharedPref.getObject(USER_PROFILE) != null) {
var data = var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
if (data != null) { if (data != null) {
authService.getDashboard().then((value) => { authService.getDashboard().then((value) => {
if (value != null) if (value != null)
{ {
setState(() { setState(() {
notificationCount = value['List_PatientDashboard'][0] notificationCount =
['UnreadPatientNotificationCount'] > value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString();
99
? '99+'
: value['List_PatientDashboard'][0]
['UnreadPatientNotificationCount']
.toString();
model.setState(model.count, 0, true, notificationCount); model.setState(model.count, 0, true, notificationCount);
sharedPref.setString(NOTIFICATION_COUNT, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
}) })
@ -519,11 +490,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
getText(currentTab).toUpperCase(), getText(currentTab).toUpperCase(),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: currentTab == 0 color: currentTab == 0 ? CustomColors.backgroudGreyColor : Theme.of(context).textTheme.headline1!.color,
? CustomColors.backgroudGreyColor fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
: Theme.of(context).textTheme.headline1!.color,
fontFamily:
projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
// bold: true, // bold: true,
), ),
leading: Builder( leading: Builder(
@ -532,14 +500,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
children: <Widget>[ children: <Widget>[
currentTab == 0 currentTab == 0
? IconButton( ? IconButton(
icon: SvgPicture.asset( icon: SvgPicture.asset("assets/images/new/menu.svg"),
"assets/images/new/menu.svg"), color: Theme.of(context).textTheme.headline1!.color,
color: Theme.of(context) onPressed: () => Scaffold.of(context).openDrawer(),
.textTheme
.headline1!
.color,
onPressed: () =>
Scaffold.of(context).openDrawer(),
) )
: IconButton( : IconButton(
icon: Icon(Icons.arrow_back), icon: Icon(Icons.arrow_back),
@ -550,9 +513,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
pageController.jumpToPage(0); pageController.jumpToPage(0);
}, },
), ),
projectViewModel.isLogin && projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild
model.notificationsCount != null &&
!projectViewModel.isLoginChild
? Positioned( ? Positioned(
right: projectViewModel.isArabic ? 35 : 0, right: projectViewModel.isArabic ? 35 : 0,
top: 5, top: 5,
@ -570,8 +531,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
model.notificationsCount.toString(), model.notificationsCount.toString(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: fontSize: projectViewModel.isArabic ? 8 : 9,
projectViewModel.isArabic ? 8 : 9,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -655,8 +615,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
index: currentTab, index: currentTab,
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: floatingActionButton: (projectViewModel.havePrivilege(34) && currentTab == 0)
(projectViewModel.havePrivilege(34) && currentTab == 0)
? FloatingButton( ? FloatingButton(
elevation: true, elevation: true,
onTap: () { onTap: () {
@ -692,22 +651,13 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
await PushNotificationHandler.getInstance().requestPermissions(); await PushNotificationHandler.getInstance().requestPermissions();
// authService.selectDeviceImei(token).then((SelectDeviceIMEIRES? value) => setUserValues(value)); // authService.selectDeviceImei(token).then((SelectDeviceIMEIRES? value) => setUserValues(value));
if (authenticatedUserObject.isLogin) { if (authenticatedUserObject.isLogin) {
var data = var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
if (data != null) { if (data != null) {
authService authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {});
.registeredAuthenticatedUser(data, token, 0, 0)
.then((res) => {});
authService.getDashboard().then((value) async { authService.getDashboard().then((value) async {
setState(() { setState(() {
if (value != null) { if (value != null && value['List_PatientDashboard'].length != 0) {
notificationCount = value['List_PatientDashboard'][0] notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString();
['UnreadPatientNotificationCount'] >
99
? '99+'
: value['List_PatientDashboard'][0]
['UnreadPatientNotificationCount']
.toString();
model.setState(model.count, 0, true, notificationCount); model.setState(model.count, 0, true, notificationCount);
sharedPref.setString(NOTIFICATION_COUNT, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
FlutterAppIconBadge.updateBadge(int.parse(notificationCount)); FlutterAppIconBadge.updateBadge(int.parse(notificationCount));

@ -334,6 +334,58 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> insertWalkInAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, int languageID, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
Request req = appGlobal.getPublicRequest();
request = {
"IsForLiveCare": false,
"ProjectID": projectID,
"ClinicID": clinicID,
"DoctorID": docID,
"StartTime": selectedTime,
"SelectedTime": selectedTime,
"EndTime": selectedTime,
"InitialSlotDuration": initialSlotDuration,
"StrAppointmentDate": selectedDate,
"IsVirtual": false,
"DeviceType": Platform.isIOS ? 'iOS' : 'Android',
"BookedBy": 102,
"VisitType": 1,
"VisitFor": 1,
"GenderID": authUser.gender,
"Age": authUser.age != null ? authUser.age : 0,
"VersionID": req.VersionID,
"Channel": req.Channel,
"IPAdress": req.IPAdress,
"generalid": req.generalid,
"PatientOutSA": authUser.outSA,
"SessionID": "YckwoXhUmWBsnHKEKig",
"isDentalAllowedBackend": false,
"DeviceTypeID": req.DeviceTypeID,
"PatientID": authUser.patientID,
"PatientTypeID": authUser.patientType,
"PatientType": authUser.patientType
};
dynamic localRes;
try {
await baseAppClient.post(INSERT_WALKIN_APPOINTMENT, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
} catch (e) {
return Future.error(e);
}
}
Future<Map> insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, int languageID, BuildContext context, Future<Map> insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, int languageID, BuildContext context,
[String? procedureID, num? testTypeEnum, num? testProcedureEnum, ProjectViewModel? projectViewModel]) async { [String? procedureID, num? testTypeEnum, num? testProcedureEnum, ProjectViewModel? projectViewModel]) async {
Map<String, dynamic> request; Map<String, dynamic> request;
@ -615,9 +667,9 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> getPatientShareForWalkInAppointment(int clinicID, int projectID) async { Future<Map> getPatientShareForWalkInAppointment(int clinicID, int projectID, int doctorID) async {
Map<String, dynamic> request; Map<String, dynamic> request;
request = {"ProjectID": projectID, "ClinicID": clinicID}; request = {"ProjectID": projectID, "ClinicID": clinicID, "DoctorID": doctorID};
dynamic localRes; dynamic localRes;
await baseAppClient.post(GET_PATIENT_SHARE_FOR_WALKIN_APPOINTMENT, onSuccess: (response, statusCode) async { await baseAppClient.post(GET_PATIENT_SHARE_FOR_WALKIN_APPOINTMENT, onSuccess: (response, statusCode) async {
localRes = response; localRes = response;
@ -628,6 +680,19 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> canPayForWalkInAppointment(int clinicID, int projectID, int doctorID) async {
Map<String, dynamic> request;
request = {"ProjectID": projectID, "ClinicID": clinicID, "DoctorID": doctorID, "StartTime": "12:00", "EndTime": "12:00"};
dynamic localRes;
await baseAppClient.post(CAN_PAY_FOR_FOR_WALKIN_APPOINTMENT, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getPatientAppointmentHistory(bool isActiveAppointment, int languageID, BuildContext context, {bool isForCOC = false, isForUpcomming = false, IsForArrived = false}) async { Future<Map> getPatientAppointmentHistory(bool isActiveAppointment, int languageID, BuildContext context, {bool isForCOC = false, isForUpcomming = false, IsForArrived = false}) async {
Map<String, dynamic> request; Map<String, dynamic> request;

@ -343,7 +343,7 @@ class MyInAppBrowser extends InAppBrowser {
form = form.replaceFirst('PROJECT_ID_VALUE', projId); form = form.replaceFirst('PROJECT_ID_VALUE', projId);
form = form.replaceFirst('PAYMENT_OPTION_VALUE', paymentMethod); form = form.replaceFirst('PAYMENT_OPTION_VALUE', paymentMethod);
form = form.replaceFirst('LANG_VALUE', currentLanguageID); form = form.replaceFirst('LANG_VALUE', currentLanguageID);
form = form.replaceFirst('SERVICE_URL_VALUE', "https://mdlaboratories.com/tamaralive/Home/Checkout"); form = form.replaceFirst('SERVICE_URL_VALUE', "https://mdlaboratories.com/tamara/Home/Checkout");
form = form.replaceFirst('INSTALLMENTS_VALUE', installments); form = form.replaceFirst('INSTALLMENTS_VALUE', installments);
form = form.replaceFirst('CUSTNATIONALID_VALUE', authUser.patientIdentificationNo!); form = form.replaceFirst('CUSTNATIONALID_VALUE', authUser.patientIdentificationNo!);

Loading…
Cancel
Save