diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 5fca126c..a78763ca 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart' import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/doctor_post_pre_images_page.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; @@ -19,7 +20,6 @@ import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_material_pickers/flutter_material_pickers.dart'; import 'package:rating_bar/rating_bar.dart'; import 'BookConfirm.dart'; @@ -115,7 +115,14 @@ class _DoctorProfileState extends State with TickerProviderStateM widget.doctor.noOfPatientsRate, "", ), - onTap: () {}, + onTap: () { + Navigator.push( + context, + FadePage( + page: SchedulePage(widget.doctor), + ), + ); + }, onRatingAndReviewTap: () { getDoctorRatingsDetails(); }, diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart index fc5c96e8..4477f38a 100644 --- a/lib/pages/BookAppointment/book_reminder_page.dart +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -194,7 +194,7 @@ class _BookReminderPageState extends State { disabledTextColor: Colors.white, disabledColor: CustomColors.green, onPressed: () async { - if (await Permission.contacts.request().isGranted) { + if (await Permission.calendar.request().isGranted) { _showReminderDialog(context); } else { requestPermissions().then((results) { diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index f9ed2bf7..96c2b882 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel. import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/DocAvailableAppointments.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -17,7 +18,6 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -44,10 +44,17 @@ class _AppointmentDetailsState extends State with SingleTick ToDoCountProviderModel toDoProvider; + DoctorList doctorList = new DoctorList(); + @override void initState() { _tabController = new TabController(length: 2, vsync: this); AppointmentDetails.showFooterButton = false; + + doctorList.doctorID = widget.appo.doctorID; + doctorList.clinicID = widget.appo.clinicID; + doctorList.projectID = widget.appo.projectID; + super.initState(); } @@ -165,7 +172,14 @@ class _AppointmentDetailsState extends State with SingleTick buttonIcon: 'assets/images/new/Boo_ Appointment.svg', showConfirmMessageDialog: false, onRatingAndReviewTap: getDoctorRatingsDetails, - onTap: () {}, + onTap: () { + Navigator.push( + context, + FadePage( + page: SchedulePage(doctorList), + ), + ); + }, ), SizedBox(height: 10), TabBar( @@ -256,11 +270,18 @@ class _AppointmentDetailsState extends State with SingleTick Expanded( child: DefaultButton( TranslationBase.of(context).cancel, - () => { - // Navigator.of(context).push(FadePage(page: Register())), + () { + 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); }, - color: Color(0xffEAEAEA), - textColor: Color(0xff000000), + // color: Color(0xffEAEAEA), + // textColor: Color(0xff000000), ), ), ); @@ -269,7 +290,8 @@ class _AppointmentDetailsState extends State with SingleTick Expanded( child: DefaultButton( TranslationBase.of(context).reviewAppointment, - DocAvailableAppointments.areSlotsAvailable ? goToBookConfirm : null, + goToBookConfirm, + // DocAvailableAppointments.areSlotsAvailable ? goToBookConfirm : null, color: Color(0xFFD02127), disabledColor: Color(0xff28323A).withOpacity(0.3), ), diff --git a/lib/pages/MyAppointments/models/ConfirmedButtons.dart b/lib/pages/MyAppointments/models/ConfirmedButtons.dart index a684781f..7ba3ce1c 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtons.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtons.dart @@ -4,12 +4,12 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class ConfirmedButtons { var buttons = [ {"title": TranslationBase.of(AppGlobal.context).reschedule, "subtitle": TranslationBase.of(AppGlobal.context).appointment, "icon": "reschedule.svg", "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).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": "raise_comp.svg", "caller": "insertComplaint"}, {"title": TranslationBase.of(AppGlobal.context).add, "subtitle": TranslationBase.of(AppGlobal.context).reminder, "icon": "add_reminder.svg", "caller": "addReminder"}, {"title": TranslationBase.of(AppGlobal.context).hospital, "subtitle": TranslationBase.of(AppGlobal.context).location, "icon": "hosp_location.svg", "caller": "navigateToProject"}, diff --git a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart index effd3722..1f9f2d8a 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart @@ -9,12 +9,12 @@ class ConfirmedButtonsAllowCheckIn { "icon": "reschedule.svg", "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).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, diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 298b121c..7053d7fb 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -47,8 +47,7 @@ class _ToDoState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); List imagesInfo = List(); @@ -62,11 +61,8 @@ class _ToDoState extends State { if (authenticatedUserObject.isLogin) getPatientData(); }); super.initState(); - imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png')); int endTime = DateTime.now().millisecondsSinceEpoch + 1000 * 30; controller = CountdownTimerController(endTime: endTime); } @@ -93,12 +89,8 @@ class _ToDoState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.appoList.length, itemBuilder: (context, index) { - print("ttt "+getNextActionImage(widget - .appoList[index] - .nextAction)); - print("ttt "+widget - .appoList[index] - .nextAction.toString()); + print("ttt " + getNextActionImage(widget.appoList[index].nextAction)); + print("ttt " + widget.appoList[index].nextAction.toString()); return Container( margin: EdgeInsets.all(10.0), child: Column( @@ -120,50 +112,23 @@ class _ToDoState extends State { children: [ Row( children: [ - Image.asset( - "assets/images/new-design/time_icon.png", - width: 20.0, - height: 20.0), + Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), Container( - margin: EdgeInsets.only( - left: 10.0, right: 10.0), + margin: EdgeInsets.only(left: 10.0, right: 10.0), child: Text( DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - widget.appoList[index] - .appointmentDate), - projectViewModel.isArabic - ? "ar" - : "en") + + DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + " " + - widget.appoList[index].startTime - .substring(0, 5), + widget.appoList[index].startTime.substring(0, 5), style: TextStyle(fontSize: 10.0)), ), - !widget.appoList[index] - .isLiveCareAppointment - ? Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0) - : Container(), + !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), Container( - margin: EdgeInsets.only( - left: 5.0, right: 5.0), - child: widget.appoList[index] - .isLiveCareAppointment + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: widget.appoList[index].isLiveCareAppointment ? Container() - : Text( - widget.appoList[index] - .projectName != - null - ? widget.appoList[index] - .projectName - : "-", - overflow: TextOverflow.clip, - maxLines: 2, - style: - TextStyle(fontSize: 10.0)), + : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), ), ], ), @@ -179,76 +144,39 @@ class _ToDoState extends State { Expanded( flex: 1, child: Container( - height: MediaQuery.of(context) - .size - .height * - 0.1, + height: MediaQuery.of(context).size.height * 0.1, margin: EdgeInsets.only(top: 5.0), child: ClipRRect( - borderRadius: - BorderRadius.circular(100.0), - child: Image.network( - widget.appoList[index] - .doctorImageURL, - fit: BoxFit.fill), + borderRadius: BorderRadius.circular(100.0), + child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), ), ), ), Expanded( flex: 3, child: Container( - margin: EdgeInsets.only( - top: 10.0, - left: 20.0, - right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - widget.appoList[index] - .doctorTitle + - " " + - widget.appoList[index] - .doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: - FontWeight.bold, - letterSpacing: 1.0)), + Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: 1.0)), Container( - margin: EdgeInsets.only( - top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality(widget - .appoList[index] - .doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), + margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), + style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), ), Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, 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], + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], isHalfAllowed: true, - halfFilledIcon: - Icons.star_half, + halfFilledIcon: Icons.star_half, filledIcon: Icons.star, emptyIcon: Icons.star, ), @@ -256,28 +184,14 @@ class _ToDoState extends State { ), Container( child: CountdownTimer( - controller: new CountdownTimerController( - endTime: DateTime.now() - .millisecondsSinceEpoch + - (widget - .appoList[ - index] - .remaniningHoursTocanPay * - 1000) * - 60), - widgetBuilder: (_, - CurrentRemainingTime - time) { + controller: + new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + widgetBuilder: (_, CurrentRemainingTime time) { return time != null ? Text( '${time.days != null ? time.days : "0"}:${time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours}:${time.min}:${time.sec} ' + - TranslationBase.of( - context) - .upcomingTimeLeft, - style: TextStyle( - fontSize: 12.0, - color: Color( - 0xff40ACC9))) + TranslationBase.of(context).upcomingTimeLeft, + style: TextStyle(fontSize: 12.0, color: Color(0xff40ACC9))) : Container(); }, ), @@ -289,29 +203,15 @@ class _ToDoState extends State { Expanded( flex: 1, child: InkWell( - onTap: () => performNextAction( - widget.appoList[index]), + onTap: () => performNextAction(widget.appoList[index]), child: Container( margin: EdgeInsets.only(top: 20.0), child: Column( children: [ - Image.asset( - getNextActionImage(widget - .appoList[index] - .nextAction), - width: 50.0, - height: 50.0), + Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), Container( - margin: - EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget - .appoList[index] - .nextAction), - textAlign: - TextAlign.center, - style: TextStyle( - fontSize: 12.0)), + margin: EdgeInsets.only(top: 5.0), + child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), ) ], ), @@ -329,33 +229,18 @@ class _ToDoState extends State { Expanded( flex: 2, child: Container( - child: Text( - getNextActionDescription(widget - .appoList[index].nextAction), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[700])), + child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 12.0, color: Colors.grey[700])), ), ), Expanded( flex: 1, child: GestureDetector( onTap: () { - navigateToAppointmentDetails( - context, - widget.appoList[index]); + navigateToAppointmentDetails(context, widget.appoList[index]); }, child: Container( - child: Text( - TranslationBase.of(context) - .upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: - new Color(0xFF40ACC9), - decoration: TextDecoration - .underline)), + child: Text(TranslationBase.of(context).upcomingDetails, + textAlign: TextAlign.end, style: TextStyle(fontSize: 12.0, color: new Color(0xFF40ACC9), decoration: TextDecoration.underline)), ), ), ) @@ -368,38 +253,21 @@ class _ToDoState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(10.0), - bottomRight: Radius.circular(10.0)), + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), color: Color(0xff20bc44), ), height: 30.0, - padding: EdgeInsets.only(right:15), - margin: EdgeInsets.symmetric(horizontal:20), + padding: EdgeInsets.only(right: 15), + margin: EdgeInsets.symmetric(horizontal: 20), transform: Matrix4.translationValues(0.0, -8.0, 0.0), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ + widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/video.png") : Image.asset("assets/images/new-design/walkin.png"), widget.appoList[index].isLiveCareAppointment - ? Image.asset( - "assets/images/new-design/video.png") - : Image.asset( - "assets/images/new-design/walkin.png"), - widget.appoList[index].isLiveCareAppointment - ? Text( - TranslationBase.of(context).videoAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)) - : Text( - TranslationBase.of(context) - .walkinAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)) + ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) ], ), ), @@ -428,15 +296,11 @@ class _ToDoState extends State { break; case 15: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic_disabled.png" - : "assets/images/new-design/pay_online_button_disabled.png"; + return widget.languageID == 'ar' ? "assets/images/new-design/pay_online_button_arabic_disabled.png" : "assets/images/new-design/pay_online_button_disabled.png"; break; case 20: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic.png" - : "assets/images/new-design/pay_online_button.png"; + return widget.languageID == 'ar' ? "assets/images/new-design/pay_online_button_arabic.png" : "assets/images/new-design/pay_online_button.png"; break; case 30: @@ -567,8 +431,7 @@ class _ToDoState extends State { } getLanguageID() async { - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { widget.languageID = languageID; }); @@ -605,12 +468,8 @@ class _ToDoState extends State { return docSpeciality; } - Future navigateToAppointmentDetails(context, appo) async { - Navigator.push( - context, - FadePage( - page: AppointmentDetails(appo: appo))) - .then((value) { + Future navigateToAppointmentDetails(context, AppoitmentAllHistoryResultList appo) async { + Navigator.push(context, FadePage(page: AppointmentDetails(appo: appo, parentIndex: appo.patientStatusType == 42 ? 1 : 0))).then((value) { getPatientAppointmentHistory(); }); } @@ -626,8 +485,7 @@ class _ToDoState extends State { if (res['AppoimentAllHistoryResultList'].length != 0) { widget.appoList.clear(); res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList - .add(new AppoitmentAllHistoryResultList.fromJson(v)); + widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); }); } else { Navigator.of(context).popAndPushNamed(HOME); @@ -649,10 +507,7 @@ class _ToDoState extends State { getLiveCareAppointmentPatientShare(context, service, appo); } else { GifLoaderDialogUtils.showMyDialog(context); - service - .getPatientShare(appo.appointmentNo.toString(), appo.clinicID, - appo.projectID, context) - .then((res) { + service.getPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); openPaymentDialog(appo, widget.patientShareResponse); @@ -664,13 +519,9 @@ class _ToDoState extends State { } } - getLiveCareAppointmentPatientShare(context, DoctorsListService service, - AppoitmentAllHistoryResultList appo) { + getLiveCareAppointmentPatientShare(context, DoctorsListService service, AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); - service - .getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), - appo.clinicID, appo.projectID, context) - .then((res) { + service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); @@ -706,33 +557,28 @@ class _ToDoState extends State { }); } - Future navigateToQR( - context, String appoQR, PatientShareResponse patientShareResponse) async { + Future navigateToQR(context, String appoQR, PatientShareResponse patientShareResponse) async { Navigator.push( context, FadePage( page: QRCode( - patientShareResponse: patientShareResponse, - appoQR: appoQR, - ))).then((value) { + patientShareResponse: patientShareResponse, + appoQR: appoQR, + ))).then((value) { getPatientAppointmentHistory(); }); } - openPaymentDialog(AppoitmentAllHistoryResultList appo, - PatientShareResponse patientShareResponse) { + openPaymentDialog(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) { showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionBuilder: (context, a1, a2, widget) { - final curvedValue = - Curves.easeInOutBack.transform(a1.value) - 1.0; + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; return Transform( - transform: - Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), child: Opacity( opacity: a1.value, - child: PaymentDialog( - appo: appo, patientShareResponse: patientShareResponse), + child: PaymentDialog(appo: appo, patientShareResponse: patientShareResponse), ), ); }, @@ -750,22 +596,13 @@ class _ToDoState extends State { }); } - openPayment( - String paymentMethod, - AuthenticatedUser authenticatedUser, - double amount, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) { - widget.browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { + widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); widget.browser.openPaymentBrowser( amount, "Appointment check in", - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo.projectID.toString(), authenticatedUser.emailAddress, paymentMethod, @@ -810,12 +647,7 @@ class _ToDoState extends State { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - context) - .then((res) { + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { @@ -833,36 +665,20 @@ class _ToDoState extends State { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], - res['Fort_id'], res['PaymentMethod'], context) - .then((res) { + service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['OnlineCheckInAppointments'][0]); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - appo.appointmentNo.toString(), - appo, - res['OnlineCheckInAppointments'][0]); + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString(), appo, res['OnlineCheckInAppointments'][0]); }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); }); } - addAdvancedNumberRequest( - String advanceNumber, - String paymentReference, - String appointmentID, - AppoitmentAllHistoryResultList appo, - dynamic apptData) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo, dynamic apptData) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (appo.isLiveCareAppointment) addVIDARequestInsert(advanceNumber, paymentReference, apptData); @@ -874,13 +690,10 @@ class _ToDoState extends State { }); } - addVIDARequestInsert( - String advanceNumber, String paymentReference, dynamic apptData) { + addVIDARequestInsert(String advanceNumber, String paymentReference, dynamic apptData) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .addVIDARequest(advanceNumber, paymentReference, apptData, context) - .then((res) { + service.addVIDARequest(advanceNumber, paymentReference, apptData, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res); }).catchError((err) { @@ -892,8 +705,7 @@ class _ToDoState extends State { getPatientData() async { AppSharedPreferences sharedPref = AppSharedPreferences(); if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); setState(() { print(data); authUser = data; @@ -902,31 +714,20 @@ class _ToDoState extends State { } } - Future navigateToPaymentMethod( - context, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) async { + Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); } - Navigator.push( - context, FadePage(page: PaymentMethod())) - .then((value) { + Navigator.push(context, FadePage(page: PaymentMethod())).then((value) { print(value); getPatientAppointmentHistory(); if (value != null) { - openPayment( - value, - authUser, - double.parse(patientShareResponse.patientShareWithTax.toString()), - patientShareResponse, - appo); + openPayment(value, authUser, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } }); } @@ -934,10 +735,7 @@ class _ToDoState extends State { confirmAppointment(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, - appo.isLiveCareAppointment, context) - .then((res) { + service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); @@ -958,10 +756,7 @@ class _ToDoState extends State { insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, - appo.serviceID, appo.doctorID, context) - .then((res) { + service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index ee4822bb..e8fa0b65 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -242,6 +242,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { requestPermissions().then((results) { _firebaseMessaging.getToken().then((String token) { + print("Firebase Token: " + token); sharedPref.setString(PUSH_TOKEN, token); if (token != null && DEVICE_TOKEN == "") { DEVICE_TOKEN = token; diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 5cf1c8e3..fe4e9cda 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -282,7 +282,9 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(48) ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) : null, + onTap: () { + if (projectViewModel.havePrivilege(48)) Navigator.push(context, FadePage(page: ActiveMedicationsPage())); + }, child: MedicalProfileItem( title: TranslationBase.of(context).myMedical, imagePath: 'active_medication.svg', @@ -594,8 +596,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => - projectViewModel.havePrivilege(48) ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) : null, + onTap: () => projectViewModel.havePrivilege(48) ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).myMedical, imagePath: 'active_medications.png', @@ -614,15 +615,11 @@ class Utils { ) : null, child: MedicalProfileItem( - title: TranslationBase.of(context).myDoctor, - imagePath: 'doctor_icon.png', - subTitle: TranslationBase.of(context).myDoctorSubtitle, - isEnable: projectViewModel.havePrivilege(6)), + title: TranslationBase.of(context).myDoctor, imagePath: 'doctor_icon.png', subTitle: TranslationBase.of(context).myDoctorSubtitle, isEnable: projectViewModel.havePrivilege(6)), )); medical.add(InkWell( - onTap: () => - projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: MyInvoices())) : null, + onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: MyInvoices())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).myInvoice, imagePath: 'Invoice.png', @@ -632,8 +629,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => - projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, + onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).eye, imagePath: 'eye_measurement_icon.png', @@ -664,8 +660,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => - projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, + onTap: () => projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).insuranceApproval, imagePath: 'insurance_approvals_icon.png', @@ -695,8 +690,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => - projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null, + onTap: () => projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).medical, imagePath: 'medical_reports_icon.png', @@ -706,8 +700,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => - projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null, + onTap: () => projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).monthly, imagePath: 'monthly_reports_icon.png', @@ -717,8 +710,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => - projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null, + onTap: () => projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).sick, imagePath: 'sick_leaves_icons.png', @@ -826,8 +818,8 @@ class Utils { }); } - static bool route(Route route, {@required Type equalsTo}){ - if((route is FadePage)){ + static bool route(Route route, {@required Type equalsTo}) { + if ((route is FadePage)) { return route.page.runtimeType == equalsTo; } return route.runtimeType == equalsTo; @@ -875,13 +867,7 @@ class Utils { } } -Widget applyShadow( - {Color color = Colors.grey, - double shadowOpacity = 0.5, - double spreadRadius = 2, - double blurRadius = 7, - Offset offset = const Offset(2, 2), - @required Widget child}) { +Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { return Container( decoration: BoxDecoration( boxShadow: [ @@ -897,7 +883,6 @@ Widget applyShadow( ); } - Future userData() async { var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER)); return userData; @@ -922,19 +907,18 @@ openAppStore({String androidPackageName, String iOSAppID}) async { } } -String labelFrom({@required String className}){ +String labelFrom({@required String className}) { RegExp exp = RegExp(r'(?<=[a-z])[A-Z]'); String result = className.replaceAllMapped(exp, (m) { var str = m.group(0); - if(str != null){ + if (str != null) { return ('_' + str); } return ""; }); - if(result.isEmpty) - return className; + if (result.isEmpty) return className; result = result.replaceAll("_", " "); return result;