diff --git a/lib/config/config.dart b/lib/config/config.dart index 221c407a..0d122736 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,29 +1,28 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'dart:io'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://hmgweb.com/'; +const BASE_URL = 'https://hmgwebservices.com/Services'; const GET_PROJECT = '/Lists.svc/REST/GetProject'; -//const BASE_URL = 'https://uat.hmgweb.com/'; // UAT Environment - ///Doctor const GET_MY_DOCTOR = '/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; const GET_DOCTOR_PROFILE = '/Doctors.svc/REST/GetDocProfiles'; const GET_DOCTOR_RATING = '/Doctors.svc/REST/dr_GetAvgDoctorRating'; - ///Prescriptions const PRESCRIPTIONS = '/Patients.svc/REST/GetPrescriptionApptList'; -const GET_PRESCRIPTIONS_ALL_ORDERS = '/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; -const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport'; -const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail'; +const GET_PRESCRIPTIONS_ALL_ORDERS = + '/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; +const GET_PRESCRIPTION_REPORT = '/Patients.svc/REST/INP_GetPrescriptionReport'; +const SEND_PRESCRIPTION_EMAIL = '/Notifications.svc/REST/SendPrescriptionEmail'; -//const BASE_URL = 'https://hmgweb.com/'; // Production Environment -//const BASE_URL = 'https://uat.hmgweb.com/'; // UAT Environment +//const BASE_URL = 'https://hmgwebservices.com/Services'; // Production Environment +//const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment //URL to get clinic list const GET_CLINICS_LIST_URL = "/lists.svc/REST/GetClinicCentralized"; @@ -35,13 +34,16 @@ const GET_DOCTORS_LIST_URL = "/Doctors.svc/REST/SearchDoctorsByTime"; const GET_DOCTOR_FREE_SLOTS = "/Doctors.svc/REST/GetDoctorFreeSlots"; //URL to insert appointment -const INSERT_SPECIFIC_APPOINTMENT = "/Doctors.svc/REST/InsertSpecificAppointment"; +const INSERT_SPECIFIC_APPOINTMENT = + "/Doctors.svc/REST/InsertSpecificAppointment"; //URL to get patient share -const GET_PATIENT_SHARE = "/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; +const GET_PATIENT_SHARE = + "/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNO"; //URL to get patient appointment history -const GET_PATIENT_APPOINTMENT_HISTORY = "/Doctors.svc/REST/PateintHasAppoimentHistory"; +const GET_PATIENT_APPOINTMENT_HISTORY = + "/Doctors.svc/REST/PateintHasAppoimentHistory"; //URL to confirm appointment const CONFIRM_APPOINTMENT = "/MobileNotifications.svc/REST/ConfirmAppointment"; @@ -72,7 +74,6 @@ class AppGlobal { request.generalid = 'Cs2020@2016\$2958'; request.VersionID = VERSION_ID; //5.3; //3.6; request.Channel = CHANNEL; //3; -// request.LanguageID = await sharedPref.getString(APP_LANGUAGE); request.IPAdress = IP_ADDRESS; //"10.20.10.20"; request.generalid = GENERAL_ID; //'Cs2020@2016\$2958'; request.PatientOutSA = 0; @@ -84,5 +85,3 @@ class AppGlobal { return request; } } - - diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index c48c3e3f..91182e17 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -46,14 +46,18 @@ class BaseAppClient { } // await helpers.logout(); //helpers.showErrorToast('Your session expired Please login agian'); - var asd =""; + var asd = ""; // TODO create logout fun } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } } } } else { diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index c59cdd12..5b4b9975 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -371,6 +371,7 @@ class _BookConfirmState extends State { } insertAppointment(context, DoctorList docObject) { + AppoitmentAllHistoryResultList appo; widget.service .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate) @@ -381,17 +382,29 @@ class _BookConfirmState extends State { getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + 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)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); } }).catchError((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); + print(err); }); } diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 4e409cb5..4f94c47b 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -8,7 +8,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'Components/AppointmentActions.dart'; +import 'widgets/AppointmentActions.dart'; class AppointmentDetails extends StatefulWidget { AppoitmentAllHistoryResultList appo; diff --git a/lib/pages/MyAppointments/Components/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart similarity index 95% rename from lib/pages/MyAppointments/Components/AppointmentActions.dart rename to lib/pages/MyAppointments/widgets/AppointmentActions.dart index fb5fc7ff..4600b9b6 100644 --- a/lib/pages/MyAppointments/Components/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -12,6 +12,7 @@ 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'; +import 'package:url_launcher/url_launcher.dart'; class AppointmentActions extends StatefulWidget { AppoitmentAllHistoryResultList appo; @@ -131,6 +132,11 @@ class _AppointmentActionsState extends State { case "confirmAppointment": confirmAppointment(); break; + + case "navigateToProject": + openMap(double.parse(widget.appo.latitude), + double.parse(widget.appo.longitude)); + break; } } @@ -305,6 +311,20 @@ class _AppointmentActionsState extends State { }); } + static Future openMap(double latitude, double longitude) async { + String googleUrl = + 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude'; + if (await canLaunch(googleUrl)) { + await launch(googleUrl); + } else { + throw 'Could not open the map.'; + } + } + + showReminderDialog() { + + } + confirmAppointment() { loading(true); DoctorsListService service = new DoctorsListService(); diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog.dart b/lib/pages/MyAppointments/widgets/reminder_dialog.dart new file mode 100644 index 00000000..168e41aa --- /dev/null +++ b/lib/pages/MyAppointments/widgets/reminder_dialog.dart @@ -0,0 +1,8 @@ +import 'package:flutter/material.dart'; + +class ReminderDialog extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container(); + } +} diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 39290d58..a9d49e6a 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -27,6 +27,7 @@ class _ToDoState extends State { @override void initState() { + print("initState!!!!!"); widget.service = new DoctorsListService(); getPatientAppointmentHistory(); super.initState(); @@ -153,7 +154,10 @@ class _ToDoState extends State { mainAxisSize: MainAxisSize.max, children: [ RatingBar.readOnly( - initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + initialRating: widget + .appoList[index] + .actualDoctorRate + .toDouble(), size: 20.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], @@ -406,12 +410,18 @@ class _ToDoState extends State { Future navigateToAppointmentDetails(context, appo) async { Navigator.push( - context, MaterialPageRoute(builder: (context) => AppointmentDetails(appo: appo))); + context, + MaterialPageRoute( + builder: (context) => AppointmentDetails(appo: appo))) + .then((value) { + getPatientAppointmentHistory(); + }); } getPatientAppointmentHistory() { loading(true); - widget.service.getPatientAppointmentHistory(true).then((res) { + DoctorsListService service = new DoctorsListService(); + service.getPatientAppointmentHistory(true).then((res) { print(res['AppoimentAllHistoryResultList']); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 8e8f84e4..4c6d1ad5 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; @@ -69,7 +70,7 @@ class _LandingPageState extends State { body: PageView( physics: NeverScrollableScrollPhysics(), controller: pageController, - children: [Container(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()], + children: [Container(), MedicalProfilePage(), MyAdmissionsPage(), ToDo(), BookingOptions()], ), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), );