diff --git a/assets/images/new-design/Invoice.png b/assets/images/new-design/Invoice.png new file mode 100644 index 00000000..f109717e Binary files /dev/null and b/assets/images/new-design/Invoice.png differ diff --git a/assets/images/new-design/generate_visit_ticket.png b/assets/images/new-design/generate_visit_ticket.png new file mode 100644 index 00000000..5d250853 Binary files /dev/null and b/assets/images/new-design/generate_visit_ticket.png differ diff --git a/assets/images/new-design/survey.png b/assets/images/new-design/survey.png new file mode 100644 index 00000000..e822c870 Binary files /dev/null and b/assets/images/new-design/survey.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index eeb9e6d3..e216a312 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -34,6 +34,9 @@ const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasApp //URL to confirm appointment const CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment"; +//URL to cancel appointment +const CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment"; + const GET_PHARMCY_ITEMS = "/Lists.svc/REST/GetPharmcyItems_Region"; const GET_PHARMACY_LIST = "/Patients.svc/REST/GetPharmcyList"; @@ -48,7 +51,7 @@ class AppGlobal { request.IPAdress = "10.20.10.20"; request.generalid = 'Cs2020@2016\$2958'; request.PatientOutSA = 0; - request.SessionID = null; + request.SessionID = "wEVNbagIkaNhGECWZjHaA"; request.TokenID = "@dm!n"; request.isDentalAllowedBackend = false; request.DeviceTypeID = Platform.isIOS ? 1 : 2; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b513cc35..1f5c8c3c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -49,6 +49,7 @@ const Map> 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(); + } + +}