diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d0f75943..c25df5b6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -56,6 +56,7 @@ const Map localizedValues = { 'availableAppo': {'en': 'Available Appointments', 'ar': 'المواعيد المتاحة'}, 'gender': {'en': 'Gender', 'ar': 'الجنس'}, 'nationality': {'en': 'Nationality', 'ar': 'الجنسية'}, + 'neverWait': {'en': 'Never wait in queue', 'ar': 'لا تنتظر في قائمة الانتظار'}, 'docQualifications': {'en': 'Doctor Qualifications', 'ar': 'مؤهلات الطبيب'}, 'confirmAppoHeading': {'en': 'Kindly review your Appointment', 'ar': 'يرجى تأكيد موعدك'}, 'patientInfo': {'en': 'Patient Information', 'ar': 'معلومات المريض'}, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 89e247b4..037b2e43 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -25,6 +25,7 @@ import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import 'BookSuccess.dart'; +import 'book_reminder_page.dart'; class BookConfirm extends StatefulWidget { DoctorList doctor; @@ -192,7 +193,7 @@ class _BookConfirmState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 40.0, child: RaisedButton( - color:CustomColors.green, + color: CustomColors.green, textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), @@ -203,7 +204,7 @@ class _BookConfirmState extends State { insertLiveCareScheduledAppointment(context, widget.doctor); } }, - child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0,letterSpacing: -0.48)), + child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), ), ), ), @@ -404,6 +405,19 @@ class _BookConfirmState extends State { return widget.appoDateFormatted; } + DateTime getDateTime() { + var parts = widget.selectedTime.split(':'); + + try { + var dateObj = new DateTime(int.parse(widget.selectedDate.split("-")[0]), int.parse(widget.selectedDate.split("-")[1]), int.parse(widget.selectedDate.split("-")[2]), int.parse(parts[0].trim()), + int.parse(parts[1].trim()), 0, 0); + return dateObj; + } catch (e) { + var dateObj = new DateTime(int.parse(widget.selectedDate.split("-")[0]), int.parse(widget.selectedDate.split("-")[1]), int.parse(widget.selectedDate.split("-")[2]), 0, 0, 0, 0); + return dateObj; + } + } + String getDoctorSpeciality(List docSpecial) { String docSpeciality = ""; docSpecial.forEach((v) { @@ -430,6 +444,16 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { GifLoaderDialogUtils.hideDialog(context); Navigator.push( - context, FadePage(page: BookSuccess(docObject: docObject, patientShareResponse: patientShareResponse, appoDateFormatted: widget.appoDateFormatted, appoTimeFormatted: widget.selectedTime))); + context, + FadePage( + page: BookReminderPage( + docObject: docObject, + patientShareResponse: patientShareResponse, + appoDateFormatted: widget.appoDateFormatted, + appoTimeFormatted: widget.selectedTime, + dateTime: getDateTime(), + ), + ), + ); } } diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 26a5b0fe..28d12203 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -3,18 +3,24 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:intl/intl.dart'; import 'QRCode.dart'; @@ -23,17 +29,12 @@ class BookSuccess extends StatefulWidget { DoctorList docObject; MyInAppBrowser browser; - final ChromeSafariBrowser chromeBrowser = - new MyChromeSafariBrowser(new MyInAppBrowser()); + final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser()); String appoDateFormatted; String appoTimeFormatted; - BookSuccess( - {@required this.patientShareResponse, - @required this.docObject, - @required this.appoDateFormatted, - @required this.appoTimeFormatted}); + BookSuccess({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted}); @override _BookSuccessState createState() => _BookSuccessState(); @@ -45,119 +46,52 @@ class _BookSuccessState extends State { @override Widget build(BuildContext context) { - return Scaffold( + return AppScaffold( + appBarTitle: widget.docObject.doctorTitle + " " + widget.docObject.name, + isShowDecPage: false, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ + DoctorHeader( + headerModel: HeaderModel( + widget.docObject.name, + widget.docObject.doctorImageURL, + widget.docObject.speciality, + "", + widget.docObject.projectName, + null, + null, + widget.docObject.nationalityFlagURL, + widget.docObject.doctorRate, + null, + widget.docObject.noOfPatientsRate, + "", + ), + isNeedToShowButton: false, + ), Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.only(bottom: 10.0), - color: new Color(0xFF20bc44), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 40.0), - child: Text(TranslationBase.of(context).bookSuccess, - style: TextStyle( - color: Colors.white, - fontSize: 18.0, - fontWeight: FontWeight.bold, - letterSpacing: 0.9)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 20.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(10.0), - child: Image.asset( - "assets/images/new-design/check-icon.png", - fit: BoxFit.fill, - height: 80.0, - width: 80.0), - ), - Container( - width: MediaQuery.of(context).size.width * 0.62, - margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Text(widget.docObject.projectName, - overflow: TextOverflow.clip, - style: _getTextStyling()), - Container( - margin: EdgeInsets.only(top: 5.0), - child: - Text("Insurance", style: _getTextStyling()), - ), - Container( - margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text(widget.docObject.clinicName, - overflow: TextOverflow.clip, - style: _getTextStyling()), - ), - Container( - margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text( - widget.appoDateFormatted + - ", " + - widget.appoTimeFormatted, - overflow: TextOverflow.clip, - style: _getTextStyling()), - ), - Container( - width: MediaQuery.of(context).size.width * 0.65, - margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text( - widget.docObject.doctorTitle + - " " + - widget.docObject.name, - overflow: TextOverflow.clip, - style: _getTextStyling()), - ), - ], - ), - ), - ], - ), + alignment: Alignment.center, + color: CustomColors.green, + child: Table( + border: TableBorder(verticalInside: BorderSide(width: 0.5, color: Colors.white)), + children: [ + TableRow( + children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShare)), + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareWithTax)), + ], ), - Container( - alignment: Alignment.center, - decoration: BoxDecoration( - border: Border.all(color: Colors.white, width: 0.5)), - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0), - child: Table( - border: TableBorder( - verticalInside: - BorderSide(width: 0.5, color: Colors.white)), - children: [ - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientShare)), - TableCell( - child: _getNormalText(TranslationBase.of(context) - .patientShareWithTax)), - ]), - TableRow(children: [ - TableCell( - child: _getHeadingText("SR " + - widget.patientShareResponse.patientShare - .toString())), - TableCell( - child: _getHeadingText("SR " + - widget - .patientShareResponse.patientShareWithTax - .toString())), - ]), - ], - ), + TableRow( + children: [ + TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShare.toString())), + TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShareWithTax.toString())), + ], ), ], ), @@ -166,7 +100,7 @@ class _BookSuccessState extends State { ], ), ), - bottomNavigationBar: getBottomContainer(), + bottomSheet: getBottomContainer(), ); } @@ -215,8 +149,7 @@ class _BookSuccessState extends State { // navigateToQR(context); getAppoQR(context); }, - child: Text(TranslationBase.of(context).viewQR.toUpperCase(), - style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).viewQR.toUpperCase(), style: TextStyle(fontSize: 18.0)), ), ), ], @@ -226,48 +159,55 @@ class _BookSuccessState extends State { Widget _getPayNowButtons() { return Container( - alignment: Alignment.bottomCenter, - height: MediaQuery.of(context).size.height * 0.2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - startPaymentProcess(); - }, - child: Text(TranslationBase.of(context).payNow.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), + color: CustomColors.appBackgroudGreyColor, + child: Container( + color: CustomColors.appBackgroudGreyColor, + margin: EdgeInsets.all(14), + height: 45.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + startPaymentProcess(); + }, + child: Text(TranslationBase.of(context).payNow.toUpperCase(), style: TextStyle(fontSize: 18.0)), + ), + ), ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xffc5272d), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - navigateToHome(context); - }, - child: Text(TranslationBase.of(context).payLater.toUpperCase(), - style: TextStyle(fontSize: 18.0)), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: new Color(0xffc5272d), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + navigateToHome(context); + }, + child: Text(TranslationBase.of(context).payLater.toUpperCase(), style: TextStyle(fontSize: 18.0)), + ), + ), ), - ), - ], + ], + ), ), ); } @@ -292,23 +232,16 @@ class _BookSuccessState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { - AppoitmentAllHistoryResultList appo = - new AppoitmentAllHistoryResultList(); + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.clinicID = widget.docObject.clinicID; appo.projectID = widget.docObject.projectID; appo.appointmentNo = widget.patientShareResponse.appointmentNo; appo.serviceID = widget.patientShareResponse.serviceID; - appo.isLiveCareAppointment = - widget.patientShareResponse.isLiveCareAppointment; + appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment; appo.doctorID = widget.patientShareResponse.doctorID; confirmAppointment(appo); }, - child: Text( - widget.patientShareResponse.isLiveCareAppointment - ? TranslationBase.of(context) - .confirmLiveCare - .toUpperCase() - : TranslationBase.of(context).confirm.toUpperCase(), + child: Text(widget.patientShareResponse.isLiveCareAppointment ? TranslationBase.of(context).confirmLiveCare.toUpperCase() : TranslationBase.of(context).confirm.toUpperCase(), style: TextStyle(fontSize: 18.0)), ), ), @@ -326,9 +259,7 @@ class _BookSuccessState extends State { onPressed: () { navigateToHome(context); }, - child: Text( - TranslationBase.of(context).confirmLater.toUpperCase(), - style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).confirmLater.toUpperCase(), style: TextStyle(fontSize: 18.0)), ), ), ], @@ -337,6 +268,7 @@ class _BookSuccessState extends State { } Widget getNextActionWidget() { + print(widget.patientShareResponse.nextAction); switch (widget.patientShareResponse.nextAction) { case 0: return Container(); @@ -390,8 +322,7 @@ class _BookSuccessState extends State { Container( margin: EdgeInsets.only(top: 30.0, bottom: 40.0), alignment: Alignment.center, - child: Text(TranslationBase.of(context).confirmAppo, - style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), + child: Text(TranslationBase.of(context).confirmAppo, style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), ), Flex( direction: Axis.horizontal, @@ -406,9 +337,7 @@ class _BookSuccessState extends State { _getBulletPoint("1"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text(TranslationBase.of(context).upcomingConfirm, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).upcomingConfirm, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -429,10 +358,7 @@ class _BookSuccessState extends State { _getBulletPoint("2"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).upcomingConfirmMore, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).upcomingConfirmMore, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -455,10 +381,7 @@ class _BookSuccessState extends State { confirmAppointment(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - 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']); @@ -480,10 +403,7 @@ class _BookSuccessState extends State { insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - 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']); @@ -499,77 +419,49 @@ class _BookSuccessState extends State { } Widget _getPayNowAppo() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.only(top: 20.0, bottom: 0.0), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).payNowBookSuccess, - style: TextStyle( - fontSize: 20.0, - letterSpacing: 0.8, - fontWeight: FontWeight.bold)), - ), - Container( - alignment: Alignment.center, - child: Image.asset("assets/images/new-design/no-wait-queue.png", - width: 120.0, height: 120.0), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - _getBulletPoint("1"), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).payNowBookSuccesstext1, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), - ), - ], - ), - ), + return Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + TranslationBase.of(context).payNowBookSuccess, + style: TextStyle( + fontSize: 24.0, + letterSpacing: -1.44, + fontWeight: FontWeight.bold, ), - ], - ), - Container( - margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), - child: Image.asset("assets/images/new-design/payment-method.png"), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(top: 0.0, left: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - _getBulletPoint("2"), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).payNowBookSuccesstext2, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 13.0)), - ), - ], - ), - ), + ), + Text( + TranslationBase.of(context).neverWait, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.54, + fontWeight: FontWeight.w600, ), - ], - ), - ], + ), + mHeight(24), + Text(TranslationBase.of(context).payNowBookSuccesstext1, + overflow: TextOverflow.fade, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.36, + )), + Container( + margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), + child: Image.asset("assets/images/new-design/payment-method.png"), + ), + Text( + TranslationBase.of(context).payNowBookSuccesstext2, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.36, + ), + ), + ], + ), ); } @@ -577,11 +469,9 @@ class _BookSuccessState extends State { navigateToPaymentMethod(context, widget.patientShareResponse); } - Future navigateToPaymentMethod( - context, PatientShareResponse patientShareResponse) async { + Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse) 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; }); @@ -592,45 +482,26 @@ class _BookSuccessState extends State { appo.clinicID = widget.patientShareResponse.clinicID; appo.appointmentNo = widget.patientShareResponse.appointmentNo; - Navigator.push( - context, FadePage(page: PaymentMethod())) - .then((value) { + Navigator.push(context, FadePage(page: PaymentMethod())).then((value) { print(value); if (value != null) { - openPayment( - value, - authUser, - double.parse(patientShareResponse.patientShareWithTax.toString()), - patientShareResponse, - appo); + openPayment(value, authUser, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } }); } - openPayment( - String paymentMethod, - AuthenticatedUser authenticatedUser, - double amount, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) async { + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { if (paymentMethod == "ApplePay") { await widget.chromeBrowser.open( url: "https://applepay-datatrans-sample.herokuapp.com/", - options: ChromeSafariBrowserClassOptions( - android: AndroidChromeCustomTabsOptions( - addDefaultShareMenuItem: false), - ios: IOSSafariOptions(barCollapsingEnabled: true))); + options: ChromeSafariBrowserClassOptions(android: AndroidChromeCustomTabsOptions(addDefaultShareMenuItem: false), ios: IOSSafariOptions(barCollapsingEnabled: true))); } else { - widget.browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); + 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, @@ -676,12 +547,7 @@ class _BookSuccessState 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) { print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; @@ -701,12 +567,7 @@ class _BookSuccessState extends State { getApplePayAPQ(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); print("Printing Payment Status Reponse!!!!"); print(res); @@ -726,15 +587,9 @@ class _BookSuccessState extends State { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { 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) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - appo.appointmentNo.toString()); + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString()); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); @@ -742,13 +597,9 @@ class _BookSuccessState extends State { }); } - addAdvancedNumberRequest( - String advanceNumber, String paymentReference, String appointmentID) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID) { DoctorsListService service = new DoctorsListService(); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) { print(res); getAppoQR(context); }).catchError((err) { @@ -766,13 +617,11 @@ class _BookSuccessState extends State { Container( margin: EdgeInsets.only(top: 30.0, bottom: 40.0), alignment: Alignment.center, - child: Text(TranslationBase.of(context).noNeedToWaitInLine, - style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), + child: Text(TranslationBase.of(context).noNeedToWaitInLine, style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), ), Container( alignment: Alignment.center, - child: Image.asset("assets/images/new-design/device_icon.png", - width: 120.0, height: 120.0), + child: Image.asset("assets/images/new-design/device_icon.png", width: 120.0, height: 120.0), ), Flex( direction: Axis.horizontal, @@ -791,10 +640,7 @@ class _BookSuccessState extends State { _getBulletPoint("1"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).useQRAppoAttend, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).useQRAppoAttend, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -806,10 +652,7 @@ class _BookSuccessState extends State { _getBulletPoint("2"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).passQRAppoAttend, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).passQRAppoAttend, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -821,10 +664,7 @@ class _BookSuccessState extends State { _getBulletPoint("3"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).sitWaitingQR, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).sitWaitingQR, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -889,14 +729,18 @@ class _BookSuccessState extends State { _getHeadingText(text) { return Container( - padding: EdgeInsets.only(bottom: 10.0), - child: Text(text, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 26.0, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.white))); + padding: EdgeInsets.only(bottom: 10.0, left: 20, right: 20), + child: Text( + text, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + color: Colors.white, + fontWeight: FontWeight.w600, + ), + ), + ); } Future navigateToHome(context) async { @@ -905,9 +749,7 @@ class _BookSuccessState extends State { getAppoQR(context) { DoctorsListService service = new DoctorsListService(); - service - .generateAppointmentQR(widget.patientShareResponse, context) - .then((res) { + service.generateAppointmentQR(widget.patientShareResponse, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); navigateToQR(context, res['AppointmentQR']); @@ -930,15 +772,16 @@ class _BookSuccessState extends State { _getNormalText(text) { return Container( - margin: EdgeInsets.only(top: 5.0), - padding: EdgeInsets.only(top: 5.0, bottom: 5.0), + margin: EdgeInsets.only(top: 5.0, left: 20, right: 20), + padding: EdgeInsets.only(top: 5.0, bottom: 0), child: Text(text, - textAlign: TextAlign.center, + textAlign: TextAlign.start, style: TextStyle( - fontSize: 12, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.white)), + fontSize: 12, + letterSpacing: -0.36, + color: Colors.white, + fontWeight: FontWeight.w600, + )), ); } } diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart new file mode 100644 index 00000000..3007003a --- /dev/null +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -0,0 +1,220 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:flutter/material.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; + +import 'BookSuccess.dart'; + +class BookReminderPage extends StatelessWidget { + PatientShareResponse patientShareResponse; + DoctorList docObject; + + MyInAppBrowser browser; + final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser()); + String selectedTime; + String appoDateFormatted; + String appoTimeFormatted; + DateTime dateTime; + + BookReminderPage({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted,this.dateTime}); + + @override + Widget build(BuildContext context) { + // print("selectedTime "+selectedTime??""); + print("appoDateFormatted "+appoDateFormatted??""); + print("appoTimeFormatted "+appoDateFormatted??""); + return AppScaffold( + appBarTitle: docObject.doctorTitle + " " + docObject.name, + isShowDecPage: false, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + DoctorHeader( + headerModel: HeaderModel( + docObject.name, + docObject.doctorImageURL, + docObject.speciality, + "", + docObject.projectName, + null, + null, + docObject.nationalityFlagURL, + docObject.doctorRate, + null, + docObject.noOfPatientsRate, + "", + ), + isNeedToShowButton: false, + ), + Expanded( + child: Container( + width: double.infinity, + height: double.infinity, + padding: EdgeInsets.only(bottom: 70), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + Icons.notifications_active, + size: 60, + ), + Text( + "Would you like to set a reminder for this appointment in your calendar?", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + mFlex(1), + Container( + width: double.infinity, + child: Card( + shape: cardRadius(12), + margin: EdgeInsets.all(10), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + circularAviator( + 30, + icon: Icons.done_rounded, + iconColor: Colors.white, + bcColor: CustomColors.green, + brColor: CustomColors.green, + ), + mWidth(10), + Expanded( + child: AutoSizeText( + "Appointment is successfully booked", + maxLines: 1, + minFontSize: 6, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.65, + ), + ), + ) + ], + ), + ), + ), + ), + ], + ), + ), + ), + ), + ], + ), + bottomSheet: Container( + color: CustomColors.appBackgroudGreyColor, + child: Container( + color: CustomColors.appBackgroudGreyColor, + margin: EdgeInsets.all(14), + height: 45.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFEAEAEA), + onPressed: () { + navigateToBookSuccess(context); + }, + child: Text(TranslationBase.of(context).no, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), + ), + ), + ), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: new Color(0xffc5272d), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: CustomColors.green, + onPressed: () { + _showReminderDialog(context); + }, + child: Text(TranslationBase.of(context).yes, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), + ), + ), + ), + ], + ), + ), + ), + ); + } + + Future navigateToBookSuccess(BuildContext context) async { + Navigator.push(context, FadePage(page: BookSuccess(docObject: docObject, patientShareResponse: patientShareResponse, appoDateFormatted: appoDateFormatted, appoTimeFormatted: appoTimeFormatted))); + } + + Future _showReminderDialog(BuildContext context) async { + return showDialog( + context: context, + barrierDismissible: true, // user must tap button! + builder: (BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), //this right here + child: ReminderDialog( + onClick: (int i) async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + calendarUtils.createOrUpdateEvent(title: "title",description: "descriptipn",scheduleDateTime:dateTime).then((value) { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }); + if (i == 0) { + // Before 30 mints + + } else if (i == 1) { + // Before 1 hour + + } else if (i == 2) { + // Before 1 hour and 30 mints + + } else if (i == 3) { + // Before 2 hours + } + }, + ), + ); + }, + ); + } +} diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart new file mode 100644 index 00000000..5aec2d74 --- /dev/null +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -0,0 +1,139 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; + +class ReminderDialog extends StatefulWidget { + Function onClick; + + ReminderDialog({this.onClick}); + + @override + _ReminderDialogState createState() => _ReminderDialogState(); +} + +class _ReminderDialogState extends State { + int i = 0; + + @override + Widget build(BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width / 0.8, + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon( + Icons.notifications_active, + size: 50, + ), + IconButton( + icon: Icon(Icons.clear), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + mHeight(20), + Text( + "When would you like to set a reminder for this appointment?", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + mHeight(20), + Text( + "Please select from below options:", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + ListTile( + contentPadding: EdgeInsets.zero, + title: const Text('Before 30 Mins'), + leading: Radio( + value: 0, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + ), + ListTile( + contentPadding: EdgeInsets.zero, + title: const Text('Before 1 Hour'), + leading: Radio( + value: 1, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + ), + ListTile( + contentPadding: EdgeInsets.zero, + title: const Text('Before 1 Hour and 30 Mins'), + leading: Radio( + value: 2, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + ), + ListTile( + contentPadding: EdgeInsets.zero, + title: const Text('Before 2 Hours'), + leading: Radio( + value: 3, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + ), + mHeight(12), + InkWell( + onTap: () { + widget.onClick(i); + Navigator.pop(context); + }, + child: Container( + width: double.infinity, + height: 45, + decoration: containerRadius(CustomColors.green, 12), + child: Center( + child: Text( + "Save", + style: TextStyle( + fontSize: 16, + letterSpacing: -0.48, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ) + ], + ), + ); + } +} diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart index 546d9b2d..25fbd88d 100644 --- a/lib/uitl/CalendarUtils.dart +++ b/lib/uitl/CalendarUtils.dart @@ -29,12 +29,7 @@ class CalendarUtils { return _completer.future; } - Future createOrUpdateEvents( - {List scheduleList, - String title, - String description, - List scheduleDateTime, - List daysOfWeek}) async { + Future createOrUpdateEvents({List scheduleList, String title, String description, List scheduleDateTime, List daysOfWeek}) async { List events = List(); scheduleDateTime.forEach((element) { RecurrenceRule recurrenceRule = RecurrenceRule( @@ -42,12 +37,7 @@ class CalendarUtils { daysOfWeek: daysOfWeek, endDate: element, ); - Event event = Event(writableCalendars.id, - recurrenceRule: recurrenceRule, - start: element, - end: element.add(Duration(minutes: 30)), - title: title, - description: description); + Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: element, end: element.add(Duration(minutes: 30)), title: title, description: description); events.add(event); }); @@ -56,6 +46,17 @@ class CalendarUtils { }); } + Future createOrUpdateEvent({ String title, String description, DateTime scheduleDateTime}) async { + RecurrenceRule recurrenceRule = RecurrenceRule( + RecurrenceFrequency.Daily, + // daysOfWeek: daysOfWeek, + endDate: scheduleDateTime, + ); + Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTime, end: scheduleDateTime.add(Duration(minutes: 30)), title: title, description: description); + print("object"); + deviceCalendarPlugin.createOrUpdateEvent(event); + } + deleteEvent(Calendar _calendar, Event _event) async { await deviceCalendarPlugin.deleteEvent(_calendar.id, _event.eventId); } @@ -64,8 +65,7 @@ class CalendarUtils { String calendarId, RetrieveEventsParams retrieveEventsParams, ) async { - return await deviceCalendarPlugin.retrieveEvents( - calendarId, retrieveEventsParams); + return await deviceCalendarPlugin.retrieveEvents(calendarId, retrieveEventsParams); } Future createCalendar( @@ -73,7 +73,6 @@ class CalendarUtils { Color calendarColor, String localAccountName, }) async { - return await deviceCalendarPlugin.createCalendar(calendarName, - calendarColor: calendarColor, localAccountName: localAccountName); + return await deviceCalendarPlugin.createCalendar(calendarName, calendarColor: calendarColor, localAccountName: localAccountName); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index df7cfc53..8892d0f8 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -92,6 +92,7 @@ class TranslationBase { String get patientShare => localizedValues['patientShare'][locale.languageCode]; + String get neverWait => localizedValues['neverWait'][locale.languageCode]; String get patientShareWithTax => localizedValues['patientShareWithTax'][locale.languageCode]; String get confirmAppo => localizedValues['confirmAppo'][locale.languageCode];