From ea82219e9e8766d5ffb269d2eec5c0db17788bc1 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Sun, 2 Apr 2023 11:45:36 +0300 Subject: [PATCH] Appointment logs --- lib/config/config.dart | 12 +++-- lib/core/service/client/base_app_client.dart | 2 +- lib/models/Appointments/timeSlot.dart | 4 +- lib/pages/BookAppointment/BookConfirm.dart | 15 +++++- .../components/DocAvailableAppointments.dart | 21 +++++++- .../appointment_services/GetDoctorsList.dart | 48 +++++++++++++++++++ 6 files changed, 90 insertions(+), 12 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index ec7f6255..ff79067a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,9 +20,9 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:3334/'; - var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; - +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // Pharmacy UAT URLs // var BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // var PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -36,7 +36,7 @@ var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; // var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/'; // RC API URL -var RC_BASE_URL = 'https://rc.hmg.com/'; +var RC_BASE_URL = 'https://rc.hmg.com/mobile/'; var PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; @@ -321,7 +321,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 10.1; +var VERSION_ID = 10.3; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -587,6 +587,8 @@ var GET_ONESIGNAL_VOIP_TOKEN = 'https://onesignal.com/api/v1/players'; var CANCEL_PHARMA_LIVECARE_REQUEST = 'https://vcallapi.hmg.com/api/PharmaLiveCare/SendPaymentStatus'; +var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLogs'; + class AppGlobal { static var context; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 6a421073..a87d71e7 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -161,7 +161,7 @@ class BaseAppClient { if (AppGlobal.isNetworkDebugEnabled) { print("URL : $url"); final jsonBody = json.encode(body); - print(jsonBody); + print(jsonBody); } if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) { diff --git a/lib/models/Appointments/timeSlot.dart b/lib/models/Appointments/timeSlot.dart index 58926fac..b7f1a8cc 100644 --- a/lib/models/Appointments/timeSlot.dart +++ b/lib/models/Appointments/timeSlot.dart @@ -4,7 +4,7 @@ class TimeSlot { String isoTime; DateTime start; DateTime end; - - TimeSlot({@required this.isoTime, @required this.start, @required this.end}); + String vidaDate; + TimeSlot({@required this.isoTime, @required this.start, @required this.end, this.vidaDate}); } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 635f74a0..473c8650 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -269,9 +271,10 @@ class _BookConfirmState extends State { }); } - insertAppointment(context, DoctorList docObject, int initialSlotDuration) { + insertAppointment(context, DoctorList docObject, int initialSlotDuration) async{ final timeSlot = DocAvailableAppointments.selectedAppoDateTime; - + String logs = await sharedPref.getString('selectedLogSlots'); + List decodedLogs = json.decode(logs); GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; widget.service @@ -284,6 +287,14 @@ class _BookConfirmState extends State { getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); getToDoCount(); }); + + widget.service.logDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, decodedLogs,res['AppointmentNo'], context).then((res) { + if (res['MessageStatus'] == 1) { + print("Logs Saved"); + }else{ + print("Error Saving logs"); + } + }); projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); } else { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 71c9d0b2..04f6d1b0 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -16,7 +16,7 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; - +import 'dart:convert'; import '../../../uitl/date_uitl.dart'; class DocAvailableAppointments extends StatefulWidget { @@ -58,6 +58,7 @@ class _DocAvailableAppointmentsState extends State wit var language; bool isLiveCareSchedule; + // String selectedLogSlots =''; @override void didUpdateWidget(covariant DocAvailableAppointments oldWidget) { @@ -212,6 +213,22 @@ class _DocAvailableAppointmentsState extends State wit if (dayEvents.length != 0) { DocAvailableAppointments.areSlotsAvailable = true; selectedButtonIndex = 0; + // selectedLogSlots = dayEvents[selectedButtonIndex].toString(); + List> timeList =[]; + for(var i =0; i timeSlot={ + "isoTime":dayEvents[i].isoTime, + "start":dayEvents[i].start.toString(), + "end":dayEvents[i].end.toString(), + "vidaDate":dayEvents[i].vidaDate + }; + timeList.add(timeSlot); + } + + + + AppSharedPreferences sharedPref = new AppSharedPreferences(); + sharedPref.setString('selectedLogSlots', json.encode(timeList)); DocAvailableAppointments.selectedTime = dayEvents[selectedButtonIndex].isoTime; } else DocAvailableAppointments.areSlotsAvailable = false; @@ -229,7 +246,7 @@ class _DocAvailableAppointmentsState extends State wit ? DateUtil.convertStringToDate(freeSlotsResponse[i]) : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[i], widget.doctor.projectID); slotsList.add(FreeSlot(date, ['slot'])); - docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date)); + docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: freeSlotsResponse[i])); } _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 0e8a8865..428b96fd 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'dart:io'; import 'package:diplomaticquarterapp/config/config.dart'; @@ -1754,4 +1755,51 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + + + + Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { + Map requestFreeSlots; + Map request; + + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + requestFreeSlots = { + "DoctorID": docID, + "IsBookingForLiveCare": 0, + "ClinicID": clinicID, + "ProjectID": projectID, + "OriginalClinicID": clinicID, + "days": 0, + "isReschadual": false, + "VersionID": req.VersionID, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "generalid": "Cs2020@2016\$2958", + "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, + "SessionID": null, + "isDentalAllowedBackend": false, + "DeviceTypeID": 1 + }; + + request = { + "ClinicID": clinicID, + "ProjectID": projectID, + "AppointmentNo":appoNumber, + "DoctorFreeSlotRequest":requestFreeSlots, + "DoctorFreeSlotResponse":selectedfreeSlots, + "Value1":docID + }; + dynamic localRes; + await baseAppClient.post(INSERT_FREE_SLOTS_LOGS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + + }