Walkin appointment implementation contd

merge-update-with-lab-changes
haroon amjad 1 year ago
parent b3f2904e9a
commit 984459d314

@ -333,6 +333,8 @@ var GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactionsSt
var SEND_CHECK_IN_NFC_REQUEST = 'Services/Patients.svc/REST/Patient_CheckAppointmentValidation_ForNFC';
var CHECK_SCANNED_NFC_QR_CODE = 'Services/Patients.svc/REST/Patient_ValidationMachine_ForNFC';
var HAS_DENTAL_PLAN = 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation';
var LASER_BODY_PARTS = 'Services/Patients.svc/REST/Laser_GetBodyPartsByCategory';
@ -668,10 +670,10 @@ var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification'
//PAYFORT
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";
var payFortEnvironment = FortEnvironment.production;
var applePayMerchantId = "merchant.com.hmgwebservices";
// var payFortEnvironment = FortEnvironment.test;
// var applePayMerchantId = "merchant.com.hmgwebservices.uat";
// var payFortEnvironment = FortEnvironment.production;
// var applePayMerchantId = "merchant.com.hmgwebservices";
var payFortEnvironment = FortEnvironment.test;
var applePayMerchantId = "merchant.com.hmgwebservices.uat";
class AppGlobal {
static var context;

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
@ -41,7 +42,10 @@ class BookConfirm extends StatefulWidget {
bool isLiveCareAppointment;
int initialSlotDuration;
BookConfirm({required this.doctor, required this.selectedDate, required this.isLiveCareAppointment, required this.selectedTime, required this.initialSlotDuration});
bool isWalkinAppointment = false;
BookConfirm(
{required this.doctor, required this.selectedDate, required this.isLiveCareAppointment, required this.selectedTime, required this.initialSlotDuration, required this.isWalkinAppointment});
late DoctorsListService service;
late PatientShareResponse patientShareResponse;
@ -212,10 +216,14 @@ class _BookConfirmState extends State<BookConfirm> {
elevation: 0,
onPressed: () async {
bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false;
if (isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor);
if (widget.isWalkinAppointment) {
getWalkinAppointmentPatientShare();
} else {
insertAppointment(context, widget.doctor, widget.initialSlotDuration);
if (isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor);
} else {
insertAppointment(context, widget.doctor, widget.initialSlotDuration);
}
}
},
child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, color: Colors.white)),
@ -226,6 +234,39 @@ class _BookConfirmState extends State<BookConfirm> {
);
}
openPaymentDialog(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) {
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: PaymentDialog(
appo: appo,
patientShareResponse: patientShareResponse,
isCashPatient: isCash,
onPaymentMethodSelected: () {},
),
),
);
},
transitionDuration: Duration(milliseconds: 500),
barrierDismissible: false,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) => SizedBox()).then((value) {
print(value);
if (value != null) {
// navigateToPaymentMethod(context, value as PatientShareResponse, appo);
// projectViewModel.analytics.todoList.to_do_list_confirm_payment_details(appo);
} else {
// projectViewModel.analytics.todoList.to_do_list_cancel_payment_details(appo);
}
});
}
Widget showInfo(String title, String des) {
return Container(
child: Row(
@ -253,6 +294,25 @@ class _BookConfirmState extends State<BookConfirm> {
);
}
getWalkinAppointmentPatientShare() {
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
GifLoaderDialogUtils.showMyDialog(context);
appo.doctorTitle = widget.doctor.doctorTitle;
appo.doctorNameObj = widget.doctor.name;
appo.appointmentDate = DateUtil.convertDateToString(DateTime.now());
appo.projectName = widget.doctor.projectName;
widget.service.getLiveCareAppointmentPatientShare("2016068106", 601, 15, projectViewModel.isArabic ? 1 : 2, context).then((res) {
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
GifLoaderDialogUtils.hideDialog(context);
openPaymentDialog(appo, widget.patientShareResponse!);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false);

@ -591,6 +591,7 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
selectedDate: DocAvailableAppointments.selectedDate!,
selectedTime: DocAvailableAppointments.selectedTime!,
initialSlotDuration: DocAvailableAppointments.initialSlotDuration!,
isWalkinAppointment: false,
),
),
);

@ -384,9 +384,7 @@ class _QRCodeState extends State<QRCode> {
sendNfcCheckInRequest(String nfcId, int checkInBy) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.sendCheckinNfcRequest(widget!.patientShareResponse!.appointmentNo!, nfcId, widget.patientShareResponse!.projectID!, checkInBy, context).then((res) {
print(res);

@ -208,7 +208,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
openTimeSlotsPickerForDate(DateTime dateStart, List<TimeSlot> freeSlots) {
dayEvents.clear();
DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0);
if (isWaitingAppointmentAvailable) {
if (isWaitingAppointmentAvailable && DateUtils.isSameDay(dateStart, DateTime.now())) {
dayEvents.add(TimeSlot(isoTime: TranslationBase.of(context).waitingAppointment, start: DateTime.now(), end: DateTime.now(), vidaDate: ""));
}
freeSlots.forEach((v) {

@ -2,6 +2,7 @@ import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:diplomaticquarterapp/core/model/privilege/ProjectDetailListModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
@ -220,6 +221,22 @@ class _WaitingAppointmentVerificationState extends State<WaitingAppointmentVerif
}
}
checkScannedNFCAndQRCode(String nfcId) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.checkScannedNFCAndQRCode(nfcId, projectViewModel.waitingAppointmentDoctor!.projectID!).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["returnValue"] == 1) {
navigateToBookConfirm(context);
} else {
AppToast.showErrorToast(message: "Invalid verification point scanned.");
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});
}
Future navigateToBookConfirm(context) async {
final DateFormat formatter = DateFormat('yyyy-MM-dd');
Navigator.push(
@ -231,6 +248,7 @@ class _WaitingAppointmentVerificationState extends State<WaitingAppointmentVerif
selectedDate: formatter.format(DateTime.now()),
selectedTime: TranslationBase.of(context).waitingAppointment,
initialSlotDuration: 15,
isWalkinAppointment: true,
),
),
);
@ -257,7 +275,7 @@ class _WaitingAppointmentVerificationState extends State<WaitingAppointmentVerif
Future.delayed(const Duration(milliseconds: 500), () {
showNfcReader(context, onNcfScan: (String nfcId) {
Future.delayed(const Duration(milliseconds: 100), () {
navigateToBookConfirm(context);
checkScannedNFCAndQRCode(nfcId);
});
}, onCancel: () {
// Navigator.of(context).pop();
@ -269,7 +287,7 @@ class _WaitingAppointmentVerificationState extends State<WaitingAppointmentVerif
startQRCodeScan() async {
String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent));
if (onlineCheckInQRCode != "") {
navigateToBookConfirm(context);
checkScannedNFCAndQRCode(onlineCheckInQRCode);
} else {}
}
}

@ -307,15 +307,18 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
Future navigateToBookConfirm(context) async {
Navigator.push(
context,
FadePage(
page: BookConfirm(
context,
FadePage(
page: BookConfirm(
doctor: getDoctorObject(),
isLiveCareAppointment: widget.appo.isLiveCareAppointment!,
selectedDate: DocAvailableAppointments.selectedDate!,
selectedTime: DocAvailableAppointments.selectedTime!,
initialSlotDuration: 0,
)));
isWalkinAppointment: false,
),
),
);
}
void getDoctorRatingsDetails() {

@ -1114,7 +1114,6 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
projectViewModel.analytics.todoList.to_do_list_cancel_payment_details(appo);
}
});
projectViewModel.analytics.todoList.to_do_list_pay_now(appo);
}

@ -1548,6 +1548,19 @@ class DoctorsListService extends BaseService {
return Future.value(localRes);
}
Future<Map> checkScannedNFCAndQRCode(String nfcCode, int projectId) async {
Map<String, dynamic> request;
request = {"NFC_Code": nfcCode, "ProjectID": projectId};
dynamic localRes;
await baseAppClient.post(CHECK_SCANNED_NFC_QR_CODE, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> checkIfHasDentalPlan(int projectID, BuildContext context) async {
Map<String, dynamic> request;

Loading…
Cancel
Save