From 4b4ac4819f110a034ccb5b4301831390f616dff0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 23 Feb 2022 14:54:11 +0300 Subject: [PATCH] no message --- lib/config/config.dart | 7 +- lib/config/localized_values.dart | 3 +- .../LakumInquiryInformationObjVersion.dart | 4 + lib/core/service/client/base_app_client.dart | 6 +- lib/main.dart | 8 +- .../Appointments/DoctorListResponse.dart | 24 +- .../OBGyneProcedureListResponse.dart | 136 +++++ lib/pages/BookAppointment/SearchResults.dart | 20 +- .../components/DocAvailableAppointments.dart | 2 - .../widgets/DentalComplaintCard.dart | 2 +- .../BookAppointment/widgets/DoctorView.dart | 22 +- .../ToDoList/ObGyne/ObGyne-TimeSlots.dart | 543 ++++++++++++++++++ lib/pages/ToDoList/ToDo.dart | 526 +++++++++++------ lib/pages/landing/landing_page.dart | 16 + .../pharmacies/screens/lakum-main-page.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 63 +- .../livecare_services/livecare_provider.dart | 37 +- lib/uitl/translations_delegate_base.dart | 2 + lib/widgets/drawer/app_drawer_widget.dart | 39 +- 19 files changed, 1214 insertions(+), 248 deletions(-) create mode 100644 lib/models/Appointments/OBGyneProcedureListResponse.dart create mode 100644 lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 78bd9baf..e1177a58 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -17,8 +17,8 @@ const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_ORDER_HISTORY = '/api/orders/items'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // const BASE_URL = 'http://10.50.100.198:3334/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; + const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -264,6 +264,9 @@ const GET_PATIENT_APPOINTMENT_HISTORY = const GET_OBGYNE_ORDERS_LIST = "services/Patients.svc/REST/HIS_OBGYNEProcedureGet"; +const GET_OBGYNE_DOCTORS_LIST = + "services/Doctors.svc/REST/HIS_ObgyneUltrasoundDoctors"; + const DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 706bec87..69c2b10d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -53,7 +53,7 @@ const Map localizedValues = { 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج '}, 'noSearchResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج الرجاء تغيير لغة البحث'}, 'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'}, - 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, + 'bookNow': {'en': 'Book Now', 'ar': 'احجز الآن'}, 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, 'appoInfo': {'en': 'Appointment Information', 'ar': 'معلومات الموعد'}, 'availableAppo': {'en': 'Available Appointments', 'ar': 'المواعيد المتاحة'}, @@ -1751,4 +1751,5 @@ const Map localizedValues = { "covidTestTodo": {"en": "Covid-19 Test", "ar": "فحص كورونا"}, "ancillaryOrdersPaymentConfirm": {"en": "Are you sure you want to make payment for selected orders?", "ar": "هل أنت متأكد أنك تريد سداد قيمة الطلبات المختارة؟"}, "successRegister": {"en": "Your account has been created.", "ar": "لقد تم إنشاء حسابك."}, + "pharmacyLiveCare": {"en": "Pharmacy LiveCare", "ar": "لايف كير صيدلية"}, }; diff --git a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart index e7948d7d..f1b64b1e 100644 --- a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart +++ b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart @@ -13,6 +13,7 @@ class LakumInquiryInformationObjVersion { num expiredPoints; String expiryDate; num gainedPoints; + num gainedPointsAmount; List gainedPointsAmountPerYear; List gainedPointsDetails; String lakumMessageStatus; @@ -44,6 +45,7 @@ class LakumInquiryInformationObjVersion { this.expiredPoints, this.expiryDate, this.gainedPoints, + this.gainedPointsAmount, this.gainedPointsAmountPerYear, this.gainedPointsDetails, this.lakumMessageStatus, @@ -85,6 +87,7 @@ class LakumInquiryInformationObjVersion { expiredPoints = json['ExpiredPoints']; expiryDate = json['ExpiryDate']; gainedPoints = json['GainedPoints']; + gainedPointsAmount = json['GainedPointsAmount']; if (json['GainedPointsAmountPerYear'] != null) { gainedPointsAmountPerYear = new List(); json['GainedPointsAmountPerYear'].forEach((v) { @@ -144,6 +147,7 @@ class LakumInquiryInformationObjVersion { data['ExpiredPoints'] = this.expiredPoints; data['ExpiryDate'] = this.expiryDate; data['GainedPoints'] = this.gainedPoints; + data['GainedPointsAmount'] = this.gainedPointsAmount; if (this.gainedPointsAmountPerYear != null) { data['GainedPointsAmountPerYear'] = this.gainedPointsAmountPerYear.map((v) => v).toList(); diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 7ffe9d9d..967e03c4 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -122,9 +122,9 @@ class BaseAppClient { } } - // body['IdentificationNo'] = 119116817; - // body['MobileNo'] = "9665023032857"; - body['PatientID'] = 1018977; //3844083 + // body['IdentificationNo'] = 2076117163; + // body['MobileNo'] = "966503109207"; + body['PatientID'] = 2380476; //3844083 body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/main.dart b/lib/main.dart index a3175350..12789f28 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -77,10 +77,10 @@ class _MyApp extends State { LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); }); - SystemChrome.setPreferredOrientations([ - DeviceOrientation.portraitUp, - DeviceOrientation.portraitDown, - ]); + // SystemChrome.setPreferredOrientations([ + // DeviceOrientation.portraitUp, + // DeviceOrientation.portraitDown, + // ]); // final themeNotifier = Provider.of(context); precacheImage(AssetImage('assets/images/powerd-by.jpg'), context); return LayoutBuilder( diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index d43dceb3..122f560f 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -1,22 +1,22 @@ class DoctorList { - int clinicID; + num clinicID; String clinicName; String doctorTitle; - int iD; + num iD; String name; - int projectID; + num projectID; String projectName; - int actualDoctorRate; - int clinicRoomNo; + num actualDoctorRate; + num clinicRoomNo; dynamic date; dynamic appointmentDate; dynamic dayName; - int doctorID; + num doctorID; String doctorImageURL; dynamic doctorProfile; dynamic doctorProfileInfo; - int doctorRate; - int gender; + num doctorRate; + num gender; String genderDescription; bool isAppointmentAllowed; bool isDoctorAllowVedioCall; @@ -30,13 +30,13 @@ class DoctorList { String nationalityID; String nationalityName; dynamic nearestFreeSlot; - int noOfPatientsRate; - int originalClinicID; - int personRate; + num noOfPatientsRate; + num originalClinicID; + num personRate; dynamic projectDistanceInKiloMeters; String qR; dynamic qRString; - int rateNumber; + num rateNumber; dynamic serviceID; String setupID; List speciality; diff --git a/lib/models/Appointments/OBGyneProcedureListResponse.dart b/lib/models/Appointments/OBGyneProcedureListResponse.dart new file mode 100644 index 00000000..ca45583a --- /dev/null +++ b/lib/models/Appointments/OBGyneProcedureListResponse.dart @@ -0,0 +1,136 @@ +class OBGyneProcedureListResponse { + String setupID; + int projectID; + int episodeID; + int appointmentNo; + int orderNo; + String procedureId; + int lineItemNo; + String orderDate; + int orderType; + int patientType; + int patientID; + int price; + int orderStatus; + bool isApprovalRequired; + bool isApprovalCreated; + bool isInvoiced; + bool isReferralInvoiced; + bool isEROrder; + bool isCash; + int uniqueRowID; + int status; + int clinicID; + int doctorID; + String procedureName; + String procedureNameN; + String clinicDescription; + String clinicDescriptionN; + String doctorName; + String doctorNameN; + String projectDescription; + String projectDescriptionN; + + OBGyneProcedureListResponse( + {this.setupID, + this.projectID, + this.episodeID, + this.appointmentNo, + this.orderNo, + this.procedureId, + this.lineItemNo, + this.orderDate, + this.orderType, + this.patientType, + this.patientID, + this.price, + this.orderStatus, + this.isApprovalRequired, + this.isApprovalCreated, + this.isInvoiced, + this.isReferralInvoiced, + this.isEROrder, + this.isCash, + this.uniqueRowID, + this.status, + this.clinicID, + this.doctorID, + this.procedureName, + this.procedureNameN, + this.clinicDescription, + this.clinicDescriptionN, + this.doctorName, + this.doctorNameN, + this.projectDescription, + this.projectDescriptionN}); + + OBGyneProcedureListResponse.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + episodeID = json['EpisodeID']; + appointmentNo = json['AppointmentNo']; + orderNo = json['OrderNo']; + procedureId = json['ProcedureId']; + lineItemNo = json['LineItemNo']; + orderDate = json['OrderDate']; + orderType = json['OrderType']; + patientType = json['PatientType']; + patientID = json['PatientID']; + price = json['Price']; + orderStatus = json['OrderStatus']; + isApprovalRequired = json['IsApprovalRequired']; + isApprovalCreated = json['IsApprovalCreated']; + isInvoiced = json['IsInvoiced']; + isReferralInvoiced = json['IsReferralInvoiced']; + isEROrder = json['IsEROrder']; + isCash = json['IsCash']; + uniqueRowID = json['UniqueRowID']; + status = json['Status']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + procedureName = json['ProcedureName']; + procedureNameN = json['ProcedureNameN']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + projectDescription = json['ProjectDescription']; + projectDescriptionN = json['ProjectDescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['EpisodeID'] = this.episodeID; + data['AppointmentNo'] = this.appointmentNo; + data['OrderNo'] = this.orderNo; + data['ProcedureId'] = this.procedureId; + data['LineItemNo'] = this.lineItemNo; + data['OrderDate'] = this.orderDate; + data['OrderType'] = this.orderType; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['Price'] = this.price; + data['OrderStatus'] = this.orderStatus; + data['IsApprovalRequired'] = this.isApprovalRequired; + data['IsApprovalCreated'] = this.isApprovalCreated; + data['IsInvoiced'] = this.isInvoiced; + data['IsReferralInvoiced'] = this.isReferralInvoiced; + data['IsEROrder'] = this.isEROrder; + data['IsCash'] = this.isCash; + data['UniqueRowID'] = this.uniqueRowID; + data['Status'] = this.status; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['ProcedureName'] = this.procedureName; + data['ProcedureNameN'] = this.procedureNameN; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['ProjectDescription'] = this.projectDescription; + data['ProjectDescriptionN'] = this.projectDescriptionN; + return data; + } +} diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index ba35a0f3..b29fa825 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; -// import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -13,15 +13,16 @@ class SearchResults extends StatefulWidget { List doctorsList = []; List patientDoctorAppointmentListHospital; bool isLiveCareAppointment; + bool isObGyneAppointment; + OBGyneProcedureListResponse obGyneProcedureListResponse; - SearchResults({@required this.doctorsList, this.patientDoctorAppointmentListHospital, @required this.isLiveCareAppointment}); + SearchResults({@required this.doctorsList, this.patientDoctorAppointmentListHospital, this.isObGyneAppointment = false, @required this.isLiveCareAppointment, this.obGyneProcedureListResponse}); @override _SearchResultsState createState() => _SearchResultsState(); } class _SearchResultsState extends State { - // var event = RobotProvider(); List tempList = []; ProjectViewModel projectViewModel; @@ -41,27 +42,28 @@ class _SearchResultsState extends State { return Container( height: 12, margin: EdgeInsets.only(left: 21, right: 21), - // color: Color(0xffD9D9D9), ); }, itemBuilder: (context, index) { return AppExpandableNotifier( - title: (widget.patientDoctorAppointmentListHospital[index].distanceInKMs != "0") ? widget.patientDoctorAppointmentListHospital[index].filterName + " - " + widget.patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km : widget.patientDoctorAppointmentListHospital[index].filterName, + title: (widget.patientDoctorAppointmentListHospital[index].distanceInKMs != "0") + ? widget.patientDoctorAppointmentListHospital[index].filterName + " - " + widget.patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km + : widget.patientDoctorAppointmentListHospital[index].filterName, isTitleSingleLine: false, bodyWidget: ListView.separated( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21), itemBuilder: (context, _index) { - //widget.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList[_index].speciality = null; final doctor = widget.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList[_index]; return DoctorView( doctor: doctor, isLiveCareAppointment: widget.isLiveCareAppointment, - onTap: (){ + isObGyneAppointment: widget.isObGyneAppointment, + obGyneProcedureListResponse: widget.obGyneProcedureListResponse, + onTap: () { projectViewModel.analytics.appointment.book_appointment_select_doctor(appointment_type: 'regular', doctor: doctor); - } - ); + }); }, separatorBuilder: (context, index) => SizedBox(height: 14), itemCount: widget.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList.length), diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 2e81b7bc..0e7a3dc6 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -293,8 +293,6 @@ class _DocAvailableAppointmentsState extends State wit if (res['FreeTimeSlots'].length != 0) { DocAvailableAppointments.areAppointmentsAvailable = true; freeSlotsResponse = res['FreeTimeSlots']; - print("res['FreeTimeSlots']"); - print(res['FreeTimeSlots'].length); _getJSONSlots().then((value) { setState(() => { diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart index 3c56aa24..e5935ff3 100644 --- a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -93,6 +93,6 @@ class _DentalComplaintCardState extends State { } Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { - Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); + Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital, isLiveCareAppointment: false))); } } diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 2d113545..ae781cb3 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -18,10 +20,12 @@ import '../DoctorProfile.dart'; class DoctorView extends StatelessWidget { final DoctorList doctor; bool isLiveCareAppointment; + bool isObGyneAppointment; bool isShowFlag; + OBGyneProcedureListResponse obGyneProcedureListResponse; final VoidCallback onTap; - DoctorView({@required this.doctor, @required this.isLiveCareAppointment, this.isShowFlag = true, this.onTap}); + DoctorView({@required this.doctor, @required this.isLiveCareAppointment, this.isObGyneAppointment = false, this.isShowFlag = true, this.onTap, this.obGyneProcedureListResponse}); ProjectViewModel projectViewModel; @@ -30,9 +34,13 @@ class DoctorView extends StatelessWidget { projectViewModel = Provider.of(context); return InkWell( onTap: () { - if (isShowFlag) getDoctorsProfile(context, doctor, isAppo: true); - (onTap ?? (){})(); // For log analytics of doctor click from book appointment - }, + if (isObGyneAppointment) { + next(context); + } else { + if (isShowFlag) getDoctorsProfile(context, doctor, isAppo: true); + (onTap ?? () {})(); // For log analytics of doctor click from book appointment + } + }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.all( @@ -85,7 +93,7 @@ class DoctorView extends StatelessWidget { children: [ if (doctor.clinicName != null) MyRichText(TranslationBase.of(context).clinic + ":", doctor.clinicName, projectViewModel.isArabic), if (doctor.projectName != null) MyRichText(TranslationBase.of(context).branch, doctor.projectName, projectViewModel.isArabic), - if (doctor.speciality != null) + if (doctor.speciality != null && doctor.speciality.length > 0) Text( this.doctor.speciality[0].trim(), // getDoctorSpeciality(this.doctor.speciality).trim(), @@ -184,6 +192,10 @@ class DoctorView extends StatelessWidget { } } + void next(BuildContext context) { + Navigator.push(context, FadePage(page: ObGyneTimeSlots(projectID: doctor.projectID, selectedClinicID: doctor.clinicID, selectedDoctorID: doctor.doctorID, obGyneProcedureListResponse: obGyneProcedureListResponse))); + } + Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { Navigator.push( context, diff --git a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart new file mode 100644 index 00000000..2a5339bb --- /dev/null +++ b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart @@ -0,0 +1,543 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +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/uitl/utils_new.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:intl/intl.dart'; +import 'package:provider/provider.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; + +class ObGyneTimeSlots extends StatefulWidget { + int projectID; + static bool areSlotsAvailable = false; + static DateTime selectedAppoDateTime; + static String selectedDate; + static String selectedTime; + + int selectedClinicID; + int selectedDoctorID; + + OBGyneProcedureListResponse obGyneProcedureListResponse; + + var language; + + ObGyneTimeSlots({@required this.projectID, this.selectedClinicID, this.selectedDoctorID, this.obGyneProcedureListResponse}); + + @override + _CovidTimeSlotsState createState() => _CovidTimeSlotsState(); +} + +class _CovidTimeSlotsState extends State with TickerProviderStateMixin { + Map _events; + AnimationController _animationController; + CalendarController _calendarController; + + AppSharedPreferences sharedPref = new AppSharedPreferences(); + + var selectedDate = ""; + dynamic selectedDateJSON; + dynamic jsonFreeSlots; + + List docFreeSlots = []; + List dayEvents = []; + + int selectedButtonIndex = 0; + + dynamic freeSlotsResponse; + + ScrollController _scrollController; + + ToDoCountProviderModel toDoProvider; + ProjectViewModel projectViewModel; + + @override + void initState() { + final _selectedDay = DateTime.now(); + + _scrollController = new ScrollController(); + + _events = { + _selectedDay: ['Event A0'] + }; + + WidgetsBinding.instance.addPostFrameCallback((_) => getCovidFreeSlots(context, widget.projectID)); + + _calendarController = CalendarController(); + _animationController = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 50), + ); + + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + _calendarController.dispose(); + super.dispose(); + } + + void _onDaySelected(DateTime day, ProjectViewModel projectViewModel) { + final DateFormat formatter = DateFormat('yyyy-MM-dd'); + setState(() { + this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day, projectViewModel.isArabic ? "ar" : "en"); + openTimeSlotsPickerForDate(day, docFreeSlots); + ObGyneTimeSlots.selectedDate = formatter.format(day); + _calendarController.selectedDate = day; + print(ObGyneTimeSlots.selectedDate); + }); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + toDoProvider = Provider.of(context); + return AppScaffold( + appBarTitle: TranslationBase.of(context).bookAppo, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + TranslationBase.of(context).selectAppo, + style: TextStyle( + color: Colors.black, + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(12), + Container( + decoration: cardRadius(12), + child: _buildTableCalendarWithBuilders(projectViewModel), + ), + mHeight(12), + Text( + selectedDate, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.64, + ), + ), + mHeight(8), + ObGyneTimeSlots.areSlotsAvailable + ? Container( + height: 40, + child: ListView.builder( + controller: _scrollController, + scrollDirection: Axis.horizontal, + itemCount: dayEvents.length, + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 0 : 5.0, left: index == 0 ? 0 : 5), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + side: BorderSide( + color: index == selectedButtonIndex ? CustomColors.green : Colors.black, //Color of the border + style: BorderStyle.solid, //Style of the border + width: 1.5, //width of the border + ), + ), + minWidth: MediaQuery.of(context).size.width * 0.2, + child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index)), + ); + }, + ), + ) + : Center( + child: Padding( + padding: const EdgeInsets.only(left: 12.0, right: 12.0), + child: Text(TranslationBase.of(context).noSlotsError, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.grey)), + )), + ], + ), + ), + SizedBox( + height: 100.0, + ), + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.zero, + decoration: cardRadius(0), + child: Container( + width: double.infinity, + padding: EdgeInsets.all(12), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + disabledTextColor: Colors.white, + elevation: 0, + disabledColor: Colors.grey[500], + onPressed: () { + bookCovidTestAppointment(); + }, + child: Text( + TranslationBase.of(context).bookAppo, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + ), + ), + ), + ), + ), + ) + ], + ), + ); + } + + Widget _buildTableCalendarWithBuilders(ProjectViewModel projectViewModel) { + return SfCalendar( + controller: _calendarController, + minDate: DateTime.now(), + showNavigationArrow: true, + headerStyle: CalendarHeaderStyle(textAlign: TextAlign.center, textStyle: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46)), + viewHeaderStyle: ViewHeaderStyle(dayTextStyle: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.black)), + view: CalendarView.month, + todayHighlightColor: CustomColors.green, + selectionDecoration: containerColorRadiusBorderWidthCircular(Colors.transparent, 4, CustomColors.green, 2.5), + cellBorderColor: Colors.white, + dataSource: MeetingDataSource(_getDataSource()), + monthViewSettings: const MonthViewSettings(appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, showTrailingAndLeadingDates: false, appointmentDisplayCount: 1), + onTap: (CalendarTapDetails details) { + _calendarController.selectedDate = details.date; + _onDaySelected(details.date, projectViewModel); + }, + ); + } + + List _getDataSource() { + final List meetings = []; + _events.forEach((key, value) { + final DateTime startTime = DateTime(key.year, key.month, key.day, 9, 0, 0); + final DateTime endTime = startTime.add(const Duration(minutes: 20)); + meetings.add(Meeting("", startTime, endTime, CustomColors.green, false)); + }); + return meetings; + } + + openTimeSlotsPickerForDate(DateTime dateStart, List freeSlots) { + dayEvents.clear(); + DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); + + freeSlots.forEach((v) { + if (v.start == dateStartObj) dayEvents.add(v); + }); + + setState(() { + if (dayEvents.length != 0) { + ObGyneTimeSlots.areSlotsAvailable = true; + selectedButtonIndex = 0; + ObGyneTimeSlots.selectedTime = dayEvents[selectedButtonIndex].isoTime; + } else + ObGyneTimeSlots.areSlotsAvailable = false; + }); + } + + Future> _getJSONSlots() async { + Map _eventsParsed; + List slotsList = []; + DateTime date; + final DateFormat formatter = DateFormat('HH:mm'); + final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); + for (var i = 0; i < freeSlotsResponse.length; i++) { + date = DateUtil.convertStringToDate(freeSlotsResponse[i]); + 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)); + } + _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); + setState(() { + ObGyneTimeSlots.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0])); + selectedDate = DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0])); + selectedDateJSON = freeSlotsResponse[0]; + }); + openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); + _calendarController.selectedDate = DateUtil.convertStringToDate(selectedDateJSON); + return _eventsParsed; + } + + Widget getNormalButton(int index) { + return RaisedButton( + color: Colors.white, + elevation: 0, + textColor: new Color(0xFF60686b), + onPressed: () { + setState(() { + selectedButtonIndex = index; + ObGyneTimeSlots.selectedTime = dayEvents[index].isoTime; + print(ObGyneTimeSlots.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), + ); + } + + Widget getSelectedButton(int index) { + return RaisedButton( + color: CustomColors.green, + //Color of the border + elevation: 0, + textColor: Colors.white, + onPressed: () { + setState(() { + selectedButtonIndex = index; + ObGyneTimeSlots.selectedTime = dayEvents[index].isoTime; + print(ObGyneTimeSlots.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), + ); + } + + bookCovidTestAppointment() { + if (ObGyneTimeSlots.areSlotsAvailable) { + GifLoaderDialogUtils.showMyDialog(context); + DoctorList docObject = new DoctorList(); + docObject.doctorID = widget.selectedDoctorID; + docObject.clinicID = widget.selectedClinicID; + docObject.projectID = widget.projectID; + insertAppointmentCovidTest(context, docObject); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).selectSlot); + } + } + + // updateCovidQuestionnaire(context, String appoNo) async { + // DoctorsListService service = new DoctorsListService(); + // service.updateCovidQuestionnaire(appoNo, widget.projectID, widget.selectedProject.testTypeEnum, widget.selectedProject.testProcedureEnum).then((res) {}).catchError((err) { + // print(err); + // }); + // } + + insertAppointmentCovidTest(context, DoctorList docObject) { + DoctorsListService service = new DoctorsListService(); + AppoitmentAllHistoryResultList appo; + service + .insertAppointment( + docObject.doctorID, docObject.clinicID, docObject.projectID, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, context, widget.obGyneProcedureListResponse.procedureId) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); + updateObGyneAppointment(res['AppointmentNo']); + getToDoCount(); + // 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']; + appo.projectID = res['SameClinicApptList'][0]['ProjectID']; + appo.endTime = res['SameClinicApptList'][0]['EndTime']; + appo.startTime = res['SameClinicApptList'][0]['StartTime']; + appo.doctorID = res['SameClinicApptList'][0]['DoctorID']; + appo.isLiveCareAppointment = false; + appo.originalClinicID = 0; + appo.originalProjectID = 0; + appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate']; + + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment(docObject, appo, context)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + }).catchError((err) { + AppToast.showErrorToast(message: err); + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + updateObGyneAppointment(String appoNo) { + DoctorsListService service = new DoctorsListService(); + service + .updateObGyneAppointment(widget.obGyneProcedureListResponse.episodeID, int.parse(appoNo), widget.obGyneProcedureListResponse.orderNo, widget.obGyneProcedureListResponse.procedureId, + widget.obGyneProcedureListResponse.lineItemNo, widget.obGyneProcedureListResponse.uniqueRowID) + .then((res) {}) + .catchError((err) { + print(err); + }); + } + + getToDoCount() { + toDoProvider.setState(0, true, toDoProvider.notificationsCount); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + } else {} + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { + ConfirmDialog.closeAlertDialog(context); + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.cancelAppointment(appo, context).then((res) { + if (res['MessageStatus'] == 1) { + // Future.delayed(new Duration(milliseconds: 1500), () { + insertAppointmentCovidTest(context, docObject); + // }); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }); + } + + // getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + // DoctorsListService service = new DoctorsListService(); + // service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { + // GifLoaderDialogUtils.hideDialog(context); + // print(res); + // widget.patientShareResponse = new PatientShareResponse.fromJson(res); + // // updateCovidQuestionnaire(context, appointmentNo); + // navigateToPaymentAlert(); + // }).catchError((err) { + // GifLoaderDialogUtils.hideDialog(context); + // print(err); + // }); + // } + // + // navigateToPaymentAlert() { + // Navigator.push( + // context, + // FadePage( + // page: CovidPaymentAlert(patientShareResponse: widget.patientShareResponse), + // ), + // ); + // } + + getCovidFreeSlots(BuildContext context, int projectID) { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getDoctorFreeSlots(widget.selectedDoctorID, widget.selectedClinicID, widget.projectID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + if (res['FreeTimeSlots'].length != 0) { + print(res['FreeTimeSlots']); + freeSlotsResponse = res['FreeTimeSlots']; + _getJSONSlots().then((value) => { + setState(() => { + _events.clear(), + _events = value, + // if (widget.doctorSchedule != null) + // {_onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])), _calendarController.selectedDate = DateUtil.convertStringToDate(widget.doctorSchedule['Date'])} + }) + }); + } else {} + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err.toString()); + print(err); + }); + } +} + +class MeetingDataSource extends CalendarDataSource { + MeetingDataSource(List source) { + appointments = source; + } + + @override + DateTime getStartTime(int index) { + return _getMeetingData(index).from; + } + + @override + DateTime getEndTime(int index) { + return _getMeetingData(index).to; + } + + @override + String getSubject(int index) { + return _getMeetingData(index).eventName; + } + + @override + Color getColor(int index) { + return _getMeetingData(index).background; + } + + @override + bool isAllDay(int index) { + return _getMeetingData(index).isAllDay; + } + + Meeting _getMeetingData(int index) { + final dynamic meeting = appointments[index]; + Meeting meetingData; + if (meeting is Meeting) { + meetingData = meeting; + } + return meetingData; + } +} + +class Meeting { + Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay); + + String eventName; + DateTime from; + DateTime to; + Color background; + bool isAllDay; +} diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 8ba1139a..cc3af6f7 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -2,14 +2,16 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; -import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; @@ -36,6 +38,7 @@ import 'package:rating_bar/rating_bar.dart'; class ToDo extends StatefulWidget { PatientShareResponse patientShareResponse; List appoList = []; + List obGyneAppoList = []; var languageID; MyInAppBrowser browser; @@ -48,7 +51,7 @@ class ToDo extends StatefulWidget { _ToDoState createState() => _ToDoState(); } -class _ToDoState extends State { +class _ToDoState extends State with SingleTickerProviderStateMixin { AppSharedPreferences sharedPref = AppSharedPreferences(); List imagesInfo = List(); @@ -56,10 +59,12 @@ class _ToDoState extends State { CountdownTimerController controller; ProjectViewModel projectViewModel; + TabController _tabController; @override void initState() { widget.patientShareResponse = new PatientShareResponse(); + _tabController = TabController(length: 2, vsync: this); WidgetsBinding.instance.addPostFrameCallback((_) { getPatientAppointmentHistory(); }); @@ -70,6 +75,12 @@ class _ToDoState extends State { controller = CountdownTimerController(endTime: endTime); } + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + @override Widget build(BuildContext context) { toDoProvider = Provider.of(context); @@ -85,173 +96,305 @@ class _ToDoState extends State { description: TranslationBase.of(context).infoTodo, onTap: widget.onBackClick, backgroundColor: CustomColors.appBackgroudGrey2Color, - body: SingleChildScrollView( - child: Column( - children: [ - Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: widget.appoList.length, - itemBuilder: (context, index) { - return Container( - width: double.infinity, - margin: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), - decoration: cardRadius(12), - padding: EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).appointments), Text(TranslationBase.of(context).orders)], + onTap: (index) { + if (index == 1) { + getOBGyneOrdersList(); + } + }, + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.appoList.length, + itemBuilder: (context, index) { + return Container( + width: double.infinity, + margin: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), + decoration: cardRadius(12), + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: const EdgeInsets.only(top: 4.0), - child: widget.appoList[index].clinicID == 265 - ? Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: SvgPicture.asset("assets/images/new/CoronaIcon.svg", width: 35.0, height: 35.0), - ) - : widget.appoList[index].isLiveCareAppointment - ? SvgPicture.asset("assets/images/new/virtual.svg") - : SvgPicture.asset("assets/images/new/hospital-visit.svg"), - - // SvgPicture.asset("assets/images/new/virtual.svg"), - ), - Column( + Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: Text( - widget.appoList[index].clinicID == 265 - ? TranslationBase.of(context).covidTestTodo - : widget.appoList[index].isLiveCareAppointment - ? TranslationBase.of(context).liveCareAppo - : TranslationBase.of(context).walkinAppo, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + padding: const EdgeInsets.only(top: 4.0), + child: widget.appoList[index].clinicID == 265 + ? Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: SvgPicture.asset("assets/images/new/CoronaIcon.svg", width: 35.0, height: 35.0), + ) + : widget.appoList[index].isLiveCareAppointment + ? SvgPicture.asset("assets/images/new/virtual.svg") + : SvgPicture.asset("assets/images/new/hospital-visit.svg"), + + // SvgPicture.asset("assets/images/new/virtual.svg"), ), - Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: CountdownTimer( - controller: new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), - widgetBuilder: (_, CurrentRemainingTime time) { - return time != null - ? Text( - '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + - TranslationBase.of(context).upcomingTimeLeft, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)) - : Container(); - }, - ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + widget.appoList[index].clinicID == 265 + ? TranslationBase.of(context).covidTestTodo + : widget.appoList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCareAppo + : TranslationBase.of(context).walkinAppo, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: CountdownTimer( + controller: new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + widgetBuilder: (_, CurrentRemainingTime time) { + return time != null + ? Text( + '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + TranslationBase.of(context).upcomingTimeLeft, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)) + : Container(); + }, + ), + ), + ], ), ], ), + Container( + child: InkWell( + onTap: () { + performNextAction(widget.appoList[index]); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: getNextActionButtonColor(widget.appoList[index].nextAction), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + getNextActionText(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ), ], ), - Container( - child: InkWell( - onTap: () { - performNextAction(widget.appoList[index]); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), - decoration: BoxDecoration( - color: getNextActionButtonColor(widget.appoList[index].nextAction), - border: Border.all(color: Colors.white, width: 1), - borderRadius: BorderRadius.circular(6), - ), - child: Text( - getNextActionText(widget.appoList[index].nextAction), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + url: widget.appoList[index].doctorImageURL, + width: 52, + height: 52, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + ], + ), + ], ), ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + getNextActionDescription(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), + ), + ), + InkWell( + onTap: () { + navigateToAppointmentDetails(context, widget.appoList[index]); + }, + child: Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle( + fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), ), ), ], ), - Padding( - padding: const EdgeInsets.only(top: 8.0), - child: Text( - widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - LargeAvatar( - name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - url: widget.appoList[index].doctorImageURL, - width: 52, - height: 52, + ); + }, + ), + ), + Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.obGyneAppoList.length, + itemBuilder: (context, index) { + return Container( + width: double.infinity, + margin: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), + decoration: cardRadius(12), + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: SvgPicture.asset("assets/images/new/ultrasound.svg", width: 20.0, height: 20.0), + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text(TranslationBase.of(context).walkinAppo, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + ], + ), + ], + ), + Container( + child: InkWell( + onTap: () { + getOBGyneDoctorsList(widget.obGyneAppoList[index].projectID, widget.obGyneAppoList[index].setupID, widget.obGyneAppoList[index]); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: CustomColors.green, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + TranslationBase.of(context).bookNow, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ), + ], ), - SizedBox(width: 11), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).appointmentDate + ": ", - DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)), projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName, + url: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", + width: 52, + height: 52, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - RatingBar.readOnly( - initialRating: widget.appoList[index].actualDoctorRate.toDouble(), - size: 16.0, - filledColor: Color(0XFFD02127), - emptyColor: Color(0XFFD02127), - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - ), + MyRichText(TranslationBase.of(context).clinic + ": ", widget.obGyneAppoList[index].clinicDescription, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).orderDate + ": ", + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.obGyneAppoList[index].orderDate)).split(" ")[0], projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, widget.obGyneAppoList[index].projectDescription, projectViewModel.isArabic), ], ), - ], - ), + ), + ], ), ], ), - Padding( - padding: const EdgeInsets.only(top: 12.0), - child: Text( - getNextActionDescription(widget.appoList[index].nextAction), - style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), - ), - ), - InkWell( - onTap: () { - navigateToAppointmentDetails(context, widget.appoList[index]); - }, - child: Padding( - padding: const EdgeInsets.only(top: 0.0), - child: Text( - TranslationBase.of(context).moreDetails, - style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), - ), - ), - ), - ], - ), - ); - }, - ), - ), - SizedBox( - height: 120.0, + ); + }, + ), + ), + ], ), - ], - ), + ), + SizedBox( + height: 120.0, + ), + ], ), ); } @@ -492,33 +635,74 @@ class _ToDoState extends State { } getOBGyneOrdersList() { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getOBGyneOrdersList(context).then((res) { - print(res['HIS_OBGYNEProcedureGet_List']); - // widget.appoList.clear(); - // GifLoaderDialogUtils.hideDialog(context); - // if (res['MessageStatus'] == 1) { - // setState(() { - // if (res['AppoimentAllHistoryResultList'].length != 0) { - // widget.appoList.clear(); - // res['AppoimentAllHistoryResultList'].forEach((v) { - // widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); - // }); - // } else { - // Navigator.of(context).popAndPushNamed(HOME); - // } - // }); - // } else { - // AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - // } + widget.obGyneAppoList.clear(); + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['HIS_OBGYNEProcedureGet_List'].length != 0) { + widget.obGyneAppoList.clear(); + res['HIS_OBGYNEProcedureGet_List'].forEach((v) { + widget.obGyneAppoList.add(new OBGyneProcedureListResponse.fromJson(v)); + }); + } else { + // Navigator.of(context).popAndPushNamed(HOME); + } + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - // GifLoaderDialogUtils.hideDialog(context); - // err != null ?? AppToast.showErrorToast(message: err); }); } + getOBGyneDoctorsList(int projectID, String setupID, OBGyneProcedureListResponse obGyneProcedureListResponse) { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + List doctorsList = []; + List _patientDoctorAppointmentListHospital = []; + service.getOBGyneDoctorsList(projectID, setupID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['HIS_ObgyneUltrasoundDoctorsList'][0]); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['HIS_ObgyneUltrasoundDoctorsList'].length != 0) { + res['HIS_ObgyneUltrasoundDoctorsList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + print(doctorsList.length); + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + } + }); + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital, obGyneProcedureListResponse); + } else { + // Navigator.of(context).popAndPushNamed(HOME); + } + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital, OBGyneProcedureListResponse obGyneProcedureListResponse) { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, isObGyneAppointment: true, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital, obGyneProcedureListResponse: obGyneProcedureListResponse))); + } + getPatientAppointmentHistory() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); @@ -533,10 +717,9 @@ class _ToDoState extends State { widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); }); } else { - Navigator.of(context).popAndPushNamed(HOME); + // Navigator.of(context).popAndPushNamed(HOME); } }); - getOBGyneOrdersList(); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -603,14 +786,7 @@ class _ToDoState extends State { } Future navigateToQR(context, String appoQR, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appintment) async { - Navigator.push( - context, - FadePage( - page: QRCode( - patientShareResponse: patientShareResponse, - appoQR: appoQR, - appointment: appintment - ))).then((value) { + Navigator.push(context, FadePage(page: QRCode(patientShareResponse: patientShareResponse, appoQR: appoQR, appointment: appintment))).then((value) { getPatientAppointmentHistory(); }); } @@ -635,11 +811,10 @@ class _ToDoState extends State { context: context, pageBuilder: (context, animation1, animation2) {}) .then((value) { - if (value != null) { projectViewModel.analytics.todoList.to_do_list_confirm_payment_details(appo); navigateToPaymentMethod(context, value, appo); - }else{ + } else { projectViewModel.analytics.todoList.to_do_list_cancel_payment_details(appo); } }); @@ -766,7 +941,6 @@ class _ToDoState extends State { } confirmAppointment(AppoitmentAllHistoryResultList appo) { - GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 40ff61f9..3a980884 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -18,6 +18,7 @@ import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; @@ -201,6 +202,21 @@ class _LandingPageState extends State with WidgetsBindingObserver { }); } + getToDoCount() { + toDoProvider.setState(0, true, toDoProvider.notificationsCount); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + } else {} + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + @override void didChangeAppLifecycleState(AppLifecycleState state) { super.didChangeAppLifecycleState(state); diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index 5dc60fda..c93804fc 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -88,7 +88,7 @@ class LakumMainPage extends StatelessWidget { SizedBox( width: 8, ), - LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, + LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmount, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), SizedBox( width: 8, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index d42fbe3a..15a97515 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -514,15 +514,8 @@ class DoctorsListService extends BaseService { Request req = appGlobal.getPublicRequest(); request = { - "VersionID": req.VersionID, - "Channel": req.Channel, "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": req.IPAdress, "ProjectID": 15, - "generalid": req.generalid, - "PatientOutSA": 0, - "SessionID": "YckwoXhUmWBsnHKEKig", - "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, @@ -539,6 +532,38 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getOBGyneDoctorsList(int projectID, String setupID, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "ProjectID": projectID, + "SetupID": setupID, + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + + await baseAppClient.post(GET_OBGYNE_DOCTORS_LIST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientAppointmentHistory(bool isActiveAppointment, BuildContext context, {bool isForCOC = false}) async { Map request; @@ -1485,4 +1510,28 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + + Future updateObGyneAppointment(int episodeID, int appointmentNo, int orderNo, String procedureId, int lineItemNo, int uniqueRowID) async { + Map request; + + request = { + "EpisodeID": episodeID, + "AppointmentNo": appointmentNo, + "OrderNo": orderNo, + "ProcedureId": procedureId, + "ProcedureAppointmentNo": appointmentNo, + "LineItemNo": lineItemNo, + "UniqueRowID": uniqueRowID + }; + + dynamic localRes; + await baseAppClient.post(UPDATE_COVID_QUESTIONNAIRE, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + } diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 552b7d16..441de08d 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; -import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; @@ -25,11 +24,7 @@ class LiveCareService extends BaseService { authUser = data; } - request = { - "Age": authUser.age != null ? authUser.age : 0, - "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 - }; + request = {"Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0}; dynamic localRes; @@ -49,11 +44,7 @@ class LiveCareService extends BaseService { authUser = data; } - request = { - "Age": authUser.age != null ? authUser.age : 0, - "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 - }; + request = {"Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0}; dynamic localRes; @@ -99,10 +90,6 @@ class LiveCareService extends BaseService { authUser = data; } - // var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); -// Request req = appGlobal.getPublicRequest(); -// request = {"LanguageID": languageID == 'ar' ? 1 : 2, "TokenID": "", "SessionID": "YckwoXhUmWBsnHKEKig"}; - dynamic localRes; await baseAppClient.post(GET_LIVECARE_HISTORY, onSuccess: (response, statusCode) async { @@ -113,6 +100,26 @@ class LiveCareService extends BaseService { return Future.value(localRes); } + Future getPatientInfoByQR(String clientID, BuildContext context) async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Map request; + request = {"clientid": clientID, "patientid": authUser.patientID, "isOutKsa": authUser.outSA == 1 ? true : false, "appLang": languageID == 'ar' ? "1" : "2"}; + + dynamic localRes; + + await baseAppClient.post("https://vcallapi.hmg.com/api/PharmaLiveCare/getPatientInfoByQR", onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isExternal: true); + return Future.value(localRes); + } + Future getLivecareClinicTiming(int serviceID, BuildContext context) async { Map request; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a367df0d..9ed7671a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2827,6 +2827,8 @@ class TranslationBase { String get ancillaryOrdersPaymentConfirm => localizedValues["ancillaryOrdersPaymentConfirm"][locale.languageCode]; String get covidTestTodo => localizedValues["covidTestTodo"][locale.languageCode]; String get successRegister => localizedValues["successRegister"][locale.languageCode]; + String get pharmacyLiveCare => localizedValues["pharmacyLiveCare"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index e8572670..c74eb3d3 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,3 +1,4 @@ +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -15,12 +16,11 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notifications_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/call_page_bkp.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.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/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; @@ -194,11 +194,23 @@ class _AppDrawerState extends State { Navigator.of(context).pushNamed( MY_FAMILIY, ); - locator().hamburgerMenu.logMenuItemClick('my family'); }, ) : SizedBox(), + InkWell( + child: DrawerItem(TranslationBase.of(context).pharmacyLiveCare, SvgPicture.asset("assets/images/new/Live_Care.svg"), + isImageIcon: true, + bottomLine: false, + textColor: Theme.of(context).textTheme.bodyText1.color, + iconColor: Theme.of(context).textTheme.bodyText1.color, + sideArrow: true, + letterSpacing: -0.84, + projectProvider: projectProvider), + onTap: () { + readQRCode(); + }, + ), FutureBuilder( future: getFamilyFiles(), // async work builder: (BuildContext context, AsyncSnapshot snapshot) { @@ -435,11 +447,7 @@ class _AppDrawerState extends State { locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); String patientID = '2001273'; GifLoaderDialogUtils.showMyDialog(context); - projectProvider - .platformBridge() - .connectHMGInternetWifi(patientID) - .then((value) => {GifLoaderDialogUtils.hideDialog(context)}) - .catchError((err) { + projectProvider.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}).catchError((err) { print(err.toString()); }); }, @@ -636,8 +644,19 @@ class _AppDrawerState extends State { }) .catchError((err) { print(err); - //Utils.hideProgressDialog(); - // GifLoaderDialogUtils.hideDialog(context); + }); + } + + readQRCode() async { + String result = (await BarcodeScanner.scan())?.rawContent; + print(result); + GifLoaderDialogUtils.showMyDialog(context); + LiveCareService service = new LiveCareService(); + service.getPatientInfoByQR(result, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); }); }