From 049d455e3cd711e87e1f73cfefa8f7118a046dcc Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 4 Aug 2020 16:55:56 +0300 Subject: [PATCH] Implementing appointment details functions --- assets/images/new-design/Invoice.png | Bin 0 -> 2384 bytes .../new-design/generate_visit_ticket.png | Bin 0 -> 1313 bytes assets/images/new-design/survey.png | Bin 0 -> 5883 bytes lib/config/config.dart | 5 +- lib/config/localized_values.dart | 10 + lib/main.dart | 2 +- .../Appointments/DoctorListResponse.dart | 16 +- lib/pages/BookAppointment/BookConfirm.dart | 26 ++- .../components/DocAvailableAppointments.dart | 13 +- .../MyAppointments/AppointmentDetails.dart | 14 +- .../Components/AppointmentActions.dart | 200 ++++++++++++------ .../models/AppointmentType.dart | 16 +- .../MyAppointments/models/ArrivedButtons.dart | 61 ++++++ .../models/ArrivedButtonsAllowCheckIn.dart | 61 ++++++ .../MyAppointments/models/BookedButtons.dart | 33 +-- .../models/BookedButtonsAllowCheckIn.dart | 49 +++++ .../models/ConfirmedButtons.dart | 49 +++++ .../models/ConfirmedButtonsAllowCheckIn.dart | 43 ++++ lib/pages/ToDoList/ToDo.dart | 1 - .../appointment_services/GetDoctorsList.dart | 44 ++++ lib/uitl/date_uitl.dart | 11 + lib/uitl/translations_delegate_base.dart | 30 +++ lib/widgets/dialogs/confirm_dialog.dart | 56 +++++ 23 files changed, 619 insertions(+), 121 deletions(-) create mode 100644 assets/images/new-design/Invoice.png create mode 100644 assets/images/new-design/generate_visit_ticket.png create mode 100644 assets/images/new-design/survey.png create mode 100644 lib/pages/MyAppointments/models/ArrivedButtons.dart create mode 100644 lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart create mode 100644 lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart create mode 100644 lib/pages/MyAppointments/models/ConfirmedButtons.dart create mode 100644 lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart create mode 100644 lib/widgets/dialogs/confirm_dialog.dart diff --git a/assets/images/new-design/Invoice.png b/assets/images/new-design/Invoice.png new file mode 100644 index 0000000000000000000000000000000000000000..f109717e1ae081bab085da55a2ac870ffc3a86e8 GIT binary patch literal 2384 zcmV-W39t5vP)Px;3Q0skRCodHoC&NQRT;;5t)&f6q=1&#mc9}wYN3KlSxUmIEEWkSpaQa379(45 zK_DbXMG-~OQ47#GP7YdEP(BxavMqy?uPX+n8X;y z{jP&^U~f>Ar(k=i%nWxAf?|B7vR+hk;eEO6COEKm`9u^)O(miz#_wPQ3^p;i<*iNw z1=+@fnx#bNjnH)()5MpCt-J( z2mV=$Z5Z87V;t0`^h9RexpNDPXZ!i;n49OQkhq8Y%90qCoGzSMmJwe7( zcMMz&!C8ocn6#(Dm5`l5?M|5jd=;L6BViphW9BF)1VLJeg4~Oz3|oJORW+}fH+F-S za5tO|%OP#w;lL+<6zFtCeI1Sk%@OwiSZ7%41>5qg=eD&&=(#V=x?6k)hAG324%X49 z!5HX|9nMM4zUrA`-&(J-z;b7S=QrElkY+zn!uc-z7JyH<-_x%LXHw3(?uYNf1gK{l zsMuJqlJd8pC9gdiT(f0WWsH!^>HRDik#iR&`5WO)xCDkl)_ll5ktsCSlx-a|LVEC= zg3O1kBmYF%nP5I~`l~oub95xR$2#-m58dfRD`SKt)77asa520DI@GmD)*MYoWeZcs z=dk}Xcm*zoM(0vps10a@`1FKk&V+pO&w{-nSyx=czTs#QII)-lM}Wz{p3R}c@a5#7 z7gjA3RFk`s-DVzuM z;qUMdNM=x{u>Txvf=1@|+tV7I5K>)eA?r|_^GBFjbJ9s{{S!@RSKVNUnhe8XHW<#b z_9+S!z#KFNUIT@5x;qb^hQ37Plxi$ALF~_QV6M0UmcTpE3yFRtdxSu3q0a)=H(74C!MJ!oJvGIfTheZkz*$VO19D9*kVJSYn-Wa*s0!mq&B zCcbtz?8qo^h9!oe`H;3(I52E|6C43AgP&Uup5G1T7e|@1vmh;0L4J<6Cc;$M6?~dC z-$C6Ab72^K2@+F4^U6s0B1{4&0GfHksq`=5Rd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U}lFg__eJaCgvQ@I+cNYlXvvy0PLd4r+WBSR+sIIs}0d|b-%c@ zAKg{khketR4ZBM=GudW(IF=HB#VA_vzF^t>Xu{=ArcKC%>F9@4bMY;R@il*?a!1XF zy`j(nWYmIScVl*4q@aG zvx_0q+;gzUYfD%A*&`E`nt44UY3BxiA}+Sbe<`tGuaS> localizedValues = { 'viewQR': {'en': 'View QR Code', 'ar': 'عرض رمز الاستجابة السريعة'}, 'instruction': {'en': 'Instructions', 'ar': 'تعليمات'}, 'livecare': {'en': 'LiveCare', 'ar': 'لايف كير'}, + 'cancelAppoMsg': {'en': 'Are you sure you want to cancel this appointment?', 'ar': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟'}, 'upcoming-noAction': {'en': 'No Action Required', 'ar': 'لا يوجد إجراء مطلوب'}, 'upcoming-confirm': {'en': 'Please confirm the appointment to avoid cancellation', 'ar': 'يرجى تأكيد الموعد لتفادي الإلغاء'}, @@ -58,6 +59,15 @@ const Map> localizedValues = { 'upcoming-virtual': {'en': 'This is a virtual appointment, Please adhere to the instructions for a seamless experience.', 'ar': 'هذا موعد اتصال مرئي عن بعد ، يرجى اتباع تعليمات الخدمة.'}, 'upcoming-livecare': {'en': 'This is a LiveCare appointment', 'ar': 'هذا موعد لايف كير'}, 'upcoming-details': {'en': 'More Details', 'ar': 'المزيد'}, + 'reschedule': {'en': 'Reschedule', 'ar': 'إعادة جدولة'}, + 'raise': {'en': 'Raise', 'ar': 'رفع'}, + 'complaint': {'en': 'Complaint', 'ar': 'شكوى'}, + 'add': {'en': 'Add', 'ar': 'إضافة'}, + 'reminder': {'en': 'Reminder', 'ar': 'تذكير'}, + 'location': {'en': 'Locations', 'ar': 'مواقعنا'}, + 'online': {'en': 'Online', 'ar': 'الالكترونية'}, + 'payment': {'en': 'Payment', 'ar': 'الدفع'}, + 'cancel-nocaps': {'en': 'Cancel', 'ar': 'الغاء'}, 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, 'loginregister': {'en': 'Login / Register', 'ar': 'دخولتسجيل'}, diff --git a/lib/main.dart b/lib/main.dart index 06cf9652..20b8417c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,10 +3,10 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:provider/provider.dart'; + import 'config/size_config.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; -import 'pages/landing/landing_page.dart'; void main() { setupLocator(); diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 301ad79a..2f4ee2a0 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -8,12 +8,12 @@ class DoctorList { String projectName; int actualDoctorRate; int clinicRoomNo; - Null date; - Null dayName; + dynamic date; + dynamic dayName; int doctorID; String doctorImageURL; - Null doctorProfile; - Null doctorProfileInfo; + dynamic doctorProfile; + dynamic doctorProfileInfo; int doctorRate; int gender; String genderDescription; @@ -26,18 +26,18 @@ class DoctorList { String nationalityFlagURL; String nationalityID; String nationalityName; - Null nearestFreeSlot; + dynamic nearestFreeSlot; int noOfPatientsRate; int originalClinicID; int personRate; int projectDistanceInKiloMeters; String qR; - Null qRString; + dynamic qRString; int rateNumber; - Null serviceID; + dynamic serviceID; String setupID; List speciality; - Null workingHours; + dynamic workingHours; DoctorList( {this.clinicID, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 2666f327..c59cdd12 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -1,9 +1,11 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -354,6 +356,20 @@ class _BookConfirmState extends State { ); } + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo) { + ConfirmDialog.closeAlertDialog(context); + DoctorsListService service = new DoctorsListService(); + service.cancelAppointment(appo).then((res) { + if (res['MessageStatus'] == 1) { + insertAppointment(context, docObject); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }); + } + insertAppointment(context, DoctorList docObject) { widget.service .insertAppointment(docObject.doctorID, docObject.clinicID, @@ -368,7 +384,14 @@ class _BookConfirmState extends State { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { - print(err); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: err, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment(docObject, err)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); }); } @@ -427,7 +450,6 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { - print(widget.appoDateFormatted); // print(widget.appoTimeFormatted); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index df5d1b75..6a4ce655 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:loading_dialog/loading_dialog.dart'; import 'package:table_calendar/table_calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -252,8 +253,7 @@ class _DocAvailableAppointmentsState extends State DocAvailableAppointments.selectedTime = dayEvents[selectedButtonIndex].isoTime; - _scrollController.animateTo(0.0, duration: new Duration(seconds: 1), curve: Curves.ease); - +// _scrollController.animateTo(0.0, duration: new Duration(seconds: 1), curve: Curves.ease); }); } @@ -274,7 +274,8 @@ class _DocAvailableAppointmentsState extends State _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { - DocAvailableAppointments.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0])); + DocAvailableAppointments.selectedDate = dateFormatter + .format(DateUtil.convertStringToDate(freeSlotsResponse[0])); selectedDate = DateUtil.getMonthDayYearDateFormatted( DateUtil.convertStringToDate(freeSlotsResponse[0])); selectedDateJSON = freeSlotsResponse[0]; @@ -293,8 +294,7 @@ class _DocAvailableAppointmentsState extends State onPressed: () { setState(() { selectedButtonIndex = index; - DocAvailableAppointments.selectedTime = - dayEvents[index].isoTime; + DocAvailableAppointments.selectedTime = dayEvents[index].isoTime; print(DocAvailableAppointments.selectedTime); }); }, @@ -310,8 +310,7 @@ class _DocAvailableAppointmentsState extends State onPressed: () { setState(() { selectedButtonIndex = index; - DocAvailableAppointments.selectedTime = - dayEvents[index].isoTime; + DocAvailableAppointments.selectedTime = dayEvents[index].isoTime; print(DocAvailableAppointments.selectedTime); }); }, diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 4ba8738b..4e409cb5 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -12,6 +12,7 @@ import 'Components/AppointmentActions.dart'; class AppointmentDetails extends StatefulWidget { AppoitmentAllHistoryResultList appo; + static bool isLoading = false; AppointmentDetails({@required this.appo}); @@ -21,7 +22,7 @@ class AppointmentDetails extends StatefulWidget { class _AppointmentDetailsState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + static TabController _tabController; bool showFooterButton = false; @override @@ -30,6 +31,13 @@ class _AppointmentDetailsState extends State super.initState(); } + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + _tabController.dispose(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -161,7 +169,7 @@ class _AppointmentDetailsState extends State child: TabBarView( physics: NeverScrollableScrollPhysics(), children: [ - AppointmentActions(), + AppointmentActions(appo: widget.appo, tabController: _tabController), DocAvailableAppointments(doctor: getDoctorObject()) ], controller: _tabController, @@ -191,6 +199,8 @@ class _AppointmentDetailsState extends State selectedTime: DocAvailableAppointments.selectedTime))); } + + DoctorList getDoctorObject() { DoctorList docObj = new DoctorList(); docObj.doctorID = widget.appo.doctorID; diff --git a/lib/pages/MyAppointments/Components/AppointmentActions.dart b/lib/pages/MyAppointments/Components/AppointmentActions.dart index 6391096c..fb5fc7ff 100644 --- a/lib/pages/MyAppointments/Components/AppointmentActions.dart +++ b/lib/pages/MyAppointments/Components/AppointmentActions.dart @@ -1,27 +1,34 @@ -import 'dart:convert'; - +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentModel.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:flutter/material.dart'; class AppointmentActions extends StatefulWidget { + AppoitmentAllHistoryResultList appo; + TabController tabController; + + AppointmentActions({@required this.appo, @required this.tabController}); + @override _AppointmentActionsState createState() => _AppointmentActionsState(); } class _AppointmentActionsState extends State { List appoButtonsList = []; - var appointment = new AppointmentModel(); @override void initState() { - appointment.PatientStatusType = 0; - appointment.IsOnlineCheckedIN = true; - _getAppointmentActionButtons(); - super.initState(); } @@ -86,9 +93,9 @@ class _AppointmentActionsState extends State { Container( alignment: Alignment.bottomRight, margin: - EdgeInsets.fromLTRB(0.0, 20.0, 10.0, 8.0), + EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 8.0), child: Image.asset(e.icon, - width: 40.0, height: 40.0), + width: 45.0, height: 45.0), ), ], ), @@ -104,12 +111,33 @@ class _AppointmentActionsState extends State { _handleButtonClicks(AppoDetailsButton) { print(AppoDetailsButton.caller); + + switch (AppoDetailsButton.caller) { + case "openReschedule": + widget.tabController.animateTo((widget.tabController.index + 1) % 2); + break; + + case "onCancelAppointment": + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).cancelAppoMsg, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment()}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + break; + + case "confirmAppointment": + confirmAppointment(); + break; + } } _getAppointmentActionButtons() { - if (appointment != null) { + if (widget.appo != null) { if (isConfirmed()) { - if (appointment.IsOnlineCheckedIN) { + if (widget.appo.isOnlineCheckedIN) { _getConfirmedCheckInAppoActionsList(); } else { _getConfirmedAppoActionsList(); @@ -118,7 +146,7 @@ class _AppointmentActionsState extends State { print("isConfirmed Null"); } if (isBooked()) { - if (appointment.IsOnlineCheckedIN) { + if (widget.appo.isOnlineCheckedIN) { _getBookedCheckInAppoActionsList(); } else { _getBookedAppoActionsList(); @@ -127,7 +155,7 @@ class _AppointmentActionsState extends State { print("isBooked Null"); } if (isArrived()) { - if (appointment.ClinicID == 17) { + if (widget.appo.clinicID == 17) { _getArrivedInvoiceAppoActionsList(); } else { _getArrivedAppoActionsList(); @@ -141,34 +169,31 @@ class _AppointmentActionsState extends State { } bool isConfirmed() { - return AppointmentType.isConfirmed(this.appointment); + return AppointmentType.isConfirmed(widget.appo); } bool isArrived() { - return AppointmentType.isArrived(this.appointment); + return AppointmentType.isArrived(widget.appo); } bool isCheckedIn() { - return this.appointment.IsOnlineCheckedIN; + return widget.appo.isOnlineCheckedIN; } bool isBooked() { - return AppointmentType.isBooked(this.appointment); + return AppointmentType.isBooked(widget.appo); } Future> _getBookedAppoActionsList() async { print("_getBookedAppoActionsList"); - var bookButtonsJson; + print(BookedButtons.buttons); List buttonsList = []; - String data = await DefaultAssetBundle.of(context) - .loadString("assets/json/bookedButtons.json"); - bookButtonsJson = json.decode(data); - for (var i = 0; i < bookButtonsJson.length; i++) { + for (var i = 0; i < BookedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: bookButtonsJson[i]['title'], - subtitle: bookButtonsJson[i]['subtitle'], - icon: bookButtonsJson[i]['icon'], - caller: bookButtonsJson[i]['caller'], + title: BookedButtons.buttons[i]['title'], + subtitle: BookedButtons.buttons[i]['subtitle'], + icon: BookedButtons.buttons[i]['icon'], + caller: BookedButtons.buttons[i]['caller'], )); } setState(() { @@ -178,14 +203,14 @@ class _AppointmentActionsState extends State { Future> _getBookedCheckInAppoActionsList() async { print("_getBookedCheckInAppoActionsList"); - print(BookedButtons.buttons); + print(BookedButtonsAllowCheckIn.buttons); List buttonsList = []; - for (var i = 0; i < BookedButtons.buttons.length; i++) { + for (var i = 0; i < BookedButtonsAllowCheckIn.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: BookedButtons.buttons[i]['title'], - subtitle: BookedButtons.buttons[i]['subtitle'], - icon: BookedButtons.buttons[i]['icon'], - caller: BookedButtons.buttons[i]['caller'], + title: BookedButtonsAllowCheckIn.buttons[i]['title'], + subtitle: BookedButtonsAllowCheckIn.buttons[i]['subtitle'], + icon: BookedButtonsAllowCheckIn.buttons[i]['icon'], + caller: BookedButtonsAllowCheckIn.buttons[i]['caller'], )); } setState(() { @@ -194,17 +219,15 @@ class _AppointmentActionsState extends State { } Future> _getConfirmedAppoActionsList() async { - var bookButtonsJson; + print("_getConfirmedAppoActionsList"); + print(ConfirmedButtons.buttons); List buttonsList = []; - String data = await DefaultAssetBundle.of(context) - .loadString("assets/json/bookedButtons.json"); - bookButtonsJson = json.decode(data); - for (var i = 0; i < bookButtonsJson.length; i++) { + for (var i = 0; i < ConfirmedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: bookButtonsJson[i]['title'], - subtitle: bookButtonsJson[i]['subtitle'], - icon: bookButtonsJson[i]['icon'], - caller: bookButtonsJson[i]['caller'], + title: ConfirmedButtons.buttons[i]['title'], + subtitle: ConfirmedButtons.buttons[i]['subtitle'], + icon: ConfirmedButtons.buttons[i]['icon'], + caller: ConfirmedButtons.buttons[i]['caller'], )); } setState(() { @@ -213,17 +236,15 @@ class _AppointmentActionsState extends State { } Future> _getConfirmedCheckInAppoActionsList() async { - var bookButtonsJson; + print("_getConfirmedAllowCheckInAppoActionsList"); + print(ConfirmedButtonsAllowCheckIn.buttons); List buttonsList = []; - String data = await DefaultAssetBundle.of(context) - .loadString("assets/json/bookedButtons.json"); - bookButtonsJson = json.decode(data); - for (var i = 0; i < bookButtonsJson.length; i++) { + for (var i = 0; i < ConfirmedButtonsAllowCheckIn.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: bookButtonsJson[i]['title'], - subtitle: bookButtonsJson[i]['subtitle'], - icon: bookButtonsJson[i]['icon'], - caller: bookButtonsJson[i]['caller'], + title: ConfirmedButtonsAllowCheckIn.buttons[i]['title'], + subtitle: ConfirmedButtonsAllowCheckIn.buttons[i]['subtitle'], + icon: ConfirmedButtonsAllowCheckIn.buttons[i]['icon'], + caller: ConfirmedButtonsAllowCheckIn.buttons[i]['caller'], )); } setState(() { @@ -232,17 +253,15 @@ class _AppointmentActionsState extends State { } Future> _getArrivedAppoActionsList() async { - var bookButtonsJson; + print("_getArrivedAppoActionsList"); + print(ArrivedButtons.buttons); List buttonsList = []; - String data = await DefaultAssetBundle.of(context) - .loadString("assets/json/bookedButtons.json"); - bookButtonsJson = json.decode(data); - for (var i = 0; i < bookButtonsJson.length; i++) { + for (var i = 0; i < ArrivedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: bookButtonsJson[i]['title'], - subtitle: bookButtonsJson[i]['subtitle'], - icon: bookButtonsJson[i]['icon'], - caller: bookButtonsJson[i]['caller'], + title: ArrivedButtons.buttons[i]['title'], + subtitle: ArrivedButtons.buttons[i]['subtitle'], + icon: ArrivedButtons.buttons[i]['icon'], + caller: ArrivedButtons.buttons[i]['caller'], )); } setState(() { @@ -251,21 +270,64 @@ class _AppointmentActionsState extends State { } Future> _getArrivedInvoiceAppoActionsList() async { - var bookButtonsJson; + print("_getArrivedInvoiceAppoActionsList"); + print(ArrivedButtons.buttons); List buttonsList = []; - String data = await DefaultAssetBundle.of(context) - .loadString("assets/json/bookedButtons.json"); - bookButtonsJson = json.decode(data); - for (var i = 0; i < bookButtonsJson.length; i++) { + for (var i = 0; i < ArrivedButtons.buttons.length; i++) { buttonsList.add(AppoDetailsButton( - title: bookButtonsJson[i]['title'], - subtitle: bookButtonsJson[i]['subtitle'], - icon: bookButtonsJson[i]['icon'], - caller: bookButtonsJson[i]['caller'], + title: ArrivedButtons.buttons[i]['title'], + subtitle: ArrivedButtons.buttons[i]['subtitle'], + icon: ArrivedButtons.buttons[i]['icon'], + caller: ArrivedButtons.buttons[i]['caller'], )); } setState(() { appoButtonsList = buttonsList; }); } + + cancelAppointment() { + ConfirmDialog.closeAlertDialog(context); + loading(true); + DoctorsListService service = new DoctorsListService(); + service.cancelAppointment(widget.appo).then((res) { + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + loading(false); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + loading(false); + } + }).catchError((err) { + print(err); + loading(false); + }); + } + + confirmAppointment() { + loading(true); + DoctorsListService service = new DoctorsListService(); + service + .confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, + widget.appo.projectID) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + loading(false); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + loading(false); + } + }).catchError((err) { + print(err); + loading(false); + }); + } + + loading(bool flag) { + setState(() { + AppointmentDetails.isLoading = flag; + }); + } } diff --git a/lib/pages/MyAppointments/models/AppointmentType.dart b/lib/pages/MyAppointments/models/AppointmentType.dart index 2ac004f4a..1d0cc3d3 100644 --- a/lib/pages/MyAppointments/models/AppointmentType.dart +++ b/lib/pages/MyAppointments/models/AppointmentType.dart @@ -1,3 +1,5 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; + class AppointmentType { static var BOOKED = 0; static const BOOKED_STR = 'booked'; @@ -6,23 +8,23 @@ class AppointmentType { static var ARRIVED = 43; static const ARRIVED_STR = 'arrived'; - static bool isConfirmed(appo) { + static bool isConfirmed(AppoitmentAllHistoryResultList appo) { return AppointmentType.isValid(appo) && - appo.PatientStatusType == AppointmentType.CONFIRMED; + appo.patientStatusType == AppointmentType.CONFIRMED; } - static bool isBooked(appo) { + static bool isBooked(AppoitmentAllHistoryResultList appo) { return AppointmentType.isValid(appo) && - appo.PatientStatusType == AppointmentType.BOOKED; + appo.patientStatusType == AppointmentType.BOOKED; } - static bool isArrived(appo) { + static bool isArrived(AppoitmentAllHistoryResultList appo) { return AppointmentType.isValid(appo) && - appo.PatientStatusType == AppointmentType.ARRIVED; + appo.patientStatusType == AppointmentType.ARRIVED; } static isValid(appo) { - return appo != null && appo.PatientStatusType != null; + return appo != null && appo.patientStatusType != null; } static int getType(typeName) { diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart new file mode 100644 index 00000000..b7b1e19e --- /dev/null +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -0,0 +1,61 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; + +class ArrivedButtons { + static var buttons = [ + { + "title": "Arrived", + "subtitle": "Status", + "icon": "assets/images/new-design/waiting-room.png", + "caller": "openReschedule" + }, + { + "title": "Medicines", + "subtitle": "Prescriptions", + "icon": "assets/images/new-design/medicine_prescriptions_icon.png", + "caller": "onCancelAppointment" + }, + { + "title": "Radiology", + "subtitle": "Services", + "icon": "assets/images/new-design/radiology_service_icon.png", + "caller": "insertComplaint" + }, + { + "title": "Lab", + "subtitle": "Result", + "icon": "assets/images/new-design/lab_result_icon.png", + "caller": "addReminder" + }, + { + "title": "Vital Signs", + "subtitle": "Values", + "icon": "assets/images/new-design/location_icon.png", + "caller": "navigateToProject" + }, + { + "title": TranslationBase.of(AppGlobal.context).raise, + "subtitle": TranslationBase.of(AppGlobal.context).complaint, + "icon": "assets/images/new-design/Complaint_icon.png", + "caller": "insertComplaint" + }, + { + "title": "Insurance", + "subtitle": "Approvals", + "icon": "assets/images/new-design/insurance_approvals_icon-in.png", + "caller": "goToTodoList(31)" + }, + { + "title": "Ask Your", + "subtitle": "Doctor", + "icon": "assets/images/new-design/ask_doctor_icon.png", + "caller": "goToTodoList(31)" + }, + { + "title": "Survey", + "subtitle": "Service", + "icon": "assets/images/new-design/survey.png", + "caller": "goToTodoList(31)" + } + ]; +} diff --git a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart new file mode 100644 index 00000000..b7b1e19e --- /dev/null +++ b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart @@ -0,0 +1,61 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; + +class ArrivedButtons { + static var buttons = [ + { + "title": "Arrived", + "subtitle": "Status", + "icon": "assets/images/new-design/waiting-room.png", + "caller": "openReschedule" + }, + { + "title": "Medicines", + "subtitle": "Prescriptions", + "icon": "assets/images/new-design/medicine_prescriptions_icon.png", + "caller": "onCancelAppointment" + }, + { + "title": "Radiology", + "subtitle": "Services", + "icon": "assets/images/new-design/radiology_service_icon.png", + "caller": "insertComplaint" + }, + { + "title": "Lab", + "subtitle": "Result", + "icon": "assets/images/new-design/lab_result_icon.png", + "caller": "addReminder" + }, + { + "title": "Vital Signs", + "subtitle": "Values", + "icon": "assets/images/new-design/location_icon.png", + "caller": "navigateToProject" + }, + { + "title": TranslationBase.of(AppGlobal.context).raise, + "subtitle": TranslationBase.of(AppGlobal.context).complaint, + "icon": "assets/images/new-design/Complaint_icon.png", + "caller": "insertComplaint" + }, + { + "title": "Insurance", + "subtitle": "Approvals", + "icon": "assets/images/new-design/insurance_approvals_icon-in.png", + "caller": "goToTodoList(31)" + }, + { + "title": "Ask Your", + "subtitle": "Doctor", + "icon": "assets/images/new-design/ask_doctor_icon.png", + "caller": "goToTodoList(31)" + }, + { + "title": "Survey", + "subtitle": "Service", + "icon": "assets/images/new-design/survey.png", + "caller": "goToTodoList(31)" + } + ]; +} diff --git a/lib/pages/MyAppointments/models/BookedButtons.dart b/lib/pages/MyAppointments/models/BookedButtons.dart index 56102f37..1a76be63 100644 --- a/lib/pages/MyAppointments/models/BookedButtons.dart +++ b/lib/pages/MyAppointments/models/BookedButtons.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class BookedButtons { - static var buttons = [ { "title": TranslationBase.of(AppGlobal.context).confirm, @@ -10,47 +9,35 @@ class BookedButtons { "icon": "assets/images/new-design/confirm_icon.png", "caller": "confirmAppointment" }, -// { -// "title": "confirm", -// "subtitle": "Appointment", -// "icon": "assets/images/new-design/confirm_icon.png", -// "caller": "confirmAppointment" -// }, { - "title": "reschedule", - "subtitle": "appointment", + "title": TranslationBase.of(AppGlobal.context).reschedule, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, "icon": "assets/images/new-design/reschedule_icon.png", "caller": "openReschedule" }, { - "title": "cancel", - "subtitle": "appointment", + "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, "icon": "assets/images/new-design/cancel_icon.png", "caller": "onCancelAppointment" }, { - "title": "raise", - "subtitle": "complaint", + "title": TranslationBase.of(AppGlobal.context).raise, + "subtitle": TranslationBase.of(AppGlobal.context).complaint, "icon": "assets/images/new-design/Complaint_icon.png", "caller": "insertComplaint" }, { - "title": "add", - "subtitle": "reminder", + "title": TranslationBase.of(AppGlobal.context).add, + "subtitle": TranslationBase.of(AppGlobal.context).reminder, "icon": "assets/images/new-design/reminder_icon.png", "caller": "addReminder" }, { - "title": "hospital", - "subtitle": "locations", + "title": TranslationBase.of(AppGlobal.context).hospital, + "subtitle": TranslationBase.of(AppGlobal.context).location, "icon": "assets/images/new-design/location_icon.png", "caller": "navigateToProject" - }, - { - "title": "online", - "subtitle": "payment", - "icon": "assets/images/new-design/check-in.png", - "caller": "goToTodoList(31)" } ]; } diff --git a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart new file mode 100644 index 00000000..959e8010 --- /dev/null +++ b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart @@ -0,0 +1,49 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; + +class BookedButtonsAllowCheckIn { + static var buttons = [ + { + "title": TranslationBase.of(AppGlobal.context).confirm, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, + "icon": "assets/images/new-design/confirm_icon.png", + "caller": "confirmAppointment" + }, + { + "title": TranslationBase.of(AppGlobal.context).reschedule, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, + "icon": "assets/images/new-design/reschedule_icon.png", + "caller": "openReschedule" + }, + { + "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, + "icon": "assets/images/new-design/cancel_icon.png", + "caller": "onCancelAppointment" + }, + { + "title": TranslationBase.of(AppGlobal.context).raise, + "subtitle": TranslationBase.of(AppGlobal.context).complaint, + "icon": "assets/images/new-design/Complaint_icon.png", + "caller": "insertComplaint" + }, + { + "title": TranslationBase.of(AppGlobal.context).add, + "subtitle": TranslationBase.of(AppGlobal.context).reminder, + "icon": "assets/images/new-design/reminder_icon.png", + "caller": "addReminder" + }, + { + "title": TranslationBase.of(AppGlobal.context).hospital, + "subtitle": TranslationBase.of(AppGlobal.context).location, + "icon": "assets/images/new-design/location_icon.png", + "caller": "navigateToProject" + }, + { + "title": TranslationBase.of(AppGlobal.context).online, + "subtitle": TranslationBase.of(AppGlobal.context).payment, + "icon": "assets/images/new-design/check-in.png", + "caller": "goToTodoList(31)" + } + ]; +} diff --git a/lib/pages/MyAppointments/models/ConfirmedButtons.dart b/lib/pages/MyAppointments/models/ConfirmedButtons.dart new file mode 100644 index 00000000..17d99002 --- /dev/null +++ b/lib/pages/MyAppointments/models/ConfirmedButtons.dart @@ -0,0 +1,49 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; + +class ConfirmedButtons { + static var buttons = [ + { + "title": TranslationBase.of(AppGlobal.context).reschedule, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, + "icon": "assets/images/new-design/reschedule_icon.png", + "caller": "openReschedule" + }, + { + "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, + "icon": "assets/images/new-design/cancel_icon.png", + "caller": "onCancelAppointment" + }, + { + "title": TranslationBase.of(AppGlobal.context).raise, + "subtitle": TranslationBase.of(AppGlobal.context).complaint, + "icon": "assets/images/new-design/Complaint_icon.png", + "caller": "insertComplaint" + }, + { + "title": TranslationBase.of(AppGlobal.context).add, + "subtitle": TranslationBase.of(AppGlobal.context).reminder, + "icon": "assets/images/new-design/reminder_icon.png", + "caller": "addReminder" + }, + { + "title": TranslationBase.of(AppGlobal.context).hospital, + "subtitle": TranslationBase.of(AppGlobal.context).location, + "icon": "assets/images/new-design/location_icon.png", + "caller": "navigateToProject" + }, + { + "title": "Generate", + "subtitle": "Visit Ticket", + "icon": "assets/images/new-design/generate_visit_ticket.png", + "caller": "visitTicket" + }, + { + "title": TranslationBase.of(AppGlobal.context).online, + "subtitle": TranslationBase.of(AppGlobal.context).payment, + "icon": "assets/images/new-design/check-in.png", + "caller": "goToTodoList(31)" + } + ]; +} diff --git a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart new file mode 100644 index 00000000..336995a8 --- /dev/null +++ b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart @@ -0,0 +1,43 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; + +class ConfirmedButtonsAllowCheckIn { + static var buttons = [ + { + "title": TranslationBase.of(AppGlobal.context).reschedule, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, + "icon": "assets/images/new-design/reschedule_icon.png", + "caller": "openReschedule" + }, + { + "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, + "subtitle": TranslationBase.of(AppGlobal.context).appointment, + "icon": "assets/images/new-design/cancel_icon.png", + "caller": "onCancelAppointment" + }, + { + "title": TranslationBase.of(AppGlobal.context).raise, + "subtitle": TranslationBase.of(AppGlobal.context).complaint, + "icon": "assets/images/new-design/Complaint_icon.png", + "caller": "insertComplaint" + }, + { + "title": TranslationBase.of(AppGlobal.context).add, + "subtitle": TranslationBase.of(AppGlobal.context).reminder, + "icon": "assets/images/new-design/reminder_icon.png", + "caller": "addReminder" + }, + { + "title": TranslationBase.of(AppGlobal.context).hospital, + "subtitle": TranslationBase.of(AppGlobal.context).location, + "icon": "assets/images/new-design/location_icon.png", + "caller": "navigateToProject" + }, + { + "title": TranslationBase.of(AppGlobal.context).online, + "subtitle": TranslationBase.of(AppGlobal.context).payment, + "icon": "assets/images/new-design/check-in.png", + "caller": "goToTodoList(31)" + } + ]; +} diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index ddac2a55..39290d58 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -27,7 +27,6 @@ class _ToDoState extends State { @override void initState() { - print("initState"); widget.service = new DoctorsListService(); getPatientAppointmentHistory(); super.initState(); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 6511c189..04a3abd7 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1,8 +1,10 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class DoctorsListService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -305,4 +307,46 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future cancelAppointment(AppoitmentAllHistoryResultList appo) async { + Map request; + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "AppointmentID": appo.appointmentNo, + "ClinicID": appo.clinicID, + "ProjectID": appo.projectID, + "EndTime": appo.endTime, + "StartTime": appo.startTime, + "DoctorID": appo.doctorID, + "IsForLiveCare": appo.isLiveCareAppointment, + "OriginalClinicID": appo.originalClinicID, + "OriginalProjectID": appo.originalProjectID, + "StrAppointmentDate": DateUtil.getDateFormatted(appo.appointmentDate), + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": 0, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": 1, + "PatientID": 1231755, + "TokenID": "@dm!n", + "PatientTypeID": 1, + "PatientType": 1 + }; + + dynamic localRes; + + await baseAppClient.post(CANCEL_APPOINTMENT, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + } diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index c70e05b7..6b18428d 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -39,6 +39,17 @@ class DateUtil { return "Old Date"; } + static String getDateFormatted(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString(); + } + /// get month by /// [month] convert month number in to month name static getMonth(int month) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index ce4f96e5..29d51f03 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -195,6 +195,36 @@ class TranslationBase { String get upcomingDetails => localizedValues['upcoming-details'][locale.languageCode]; + + String get reschedule => + localizedValues['reschedule'][locale.languageCode]; + + String get raise => + localizedValues['raise'][locale.languageCode]; + + String get complaint => + localizedValues['complaint'][locale.languageCode]; + + String get add => + localizedValues['add'][locale.languageCode]; + + String get reminder => + localizedValues['reminder'][locale.languageCode]; + + String get location => + localizedValues['location'][locale.languageCode]; + + String get online => + localizedValues['online'][locale.languageCode]; + + String get payment => + localizedValues['payment'][locale.languageCode]; + + String get cancel_nocaps => + localizedValues['cancel-nocaps'][locale.languageCode]; + + String get cancelAppoMsg => + localizedValues['cancelAppoMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart new file mode 100644 index 00000000..85116d5f --- /dev/null +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -0,0 +1,56 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ConfirmDialog { + final BuildContext context; + + final confirmMessage; + final okText; + final cancelText; + final Function okFunction; + final Function cancelFunction; + + ConfirmDialog( + {@required this.context, + @required this.confirmMessage, + @required this.okText, + @required this.cancelText, + @required this.okFunction, + @required this.cancelFunction}); + + showAlertDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = FlatButton( + child: Text(this.cancelText), + onPressed: () { + Navigator.of(context).pop(); + }); + Widget continueButton = + FlatButton(child: Text(this.okText), onPressed: this.okFunction); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: Text(TranslationBase.of(context).confirm), + content: Text(this.confirmMessage), + actions: [ + cancelButton, + continueButton, + ], + ); + + // show the dialog + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + static closeAlertDialog(BuildContext context) { + Navigator.of(context).pop(); + } + +}