diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 540276ba..f6ab4d58 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -7,49 +7,50 @@ FlutterApplication and put your custom class here. --> + android:icon="@mipmap/ic_launcher" + android:label="diplomaticquarterapp"> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" /> - + android:name="io.flutter.embedding.android.SplashScreenDrawable" + android:resource="@drawable/launch_background" /> + + + + + - - + + - - - - - + - - + + + + + diff --git a/assets/images/new-design/check_icon.png b/assets/images/new-design/check_icon.png new file mode 100644 index 00000000..c098b175 Binary files /dev/null and b/assets/images/new-design/check_icon.png differ diff --git a/assets/images/new-design/installment.png b/assets/images/new-design/installment.png new file mode 100644 index 00000000..034497ef Binary files /dev/null and b/assets/images/new-design/installment.png differ diff --git a/assets/images/new-design/mada.png b/assets/images/new-design/mada.png new file mode 100644 index 00000000..f65b970c Binary files /dev/null and b/assets/images/new-design/mada.png differ diff --git a/assets/images/new-design/mastercard.png b/assets/images/new-design/mastercard.png new file mode 100644 index 00000000..1d48b854 Binary files /dev/null and b/assets/images/new-design/mastercard.png differ diff --git a/assets/images/new-design/sadad.png b/assets/images/new-design/sadad.png new file mode 100644 index 00000000..35e0426c Binary files /dev/null and b/assets/images/new-design/sadad.png differ diff --git a/assets/images/new-design/visa.png b/assets/images/new-design/visa.png new file mode 100644 index 00000000..8d29703c Binary files /dev/null and b/assets/images/new-design/visa.png differ diff --git a/assets/json/bookedAllowCheckInButtons.json b/assets/json/bookedAllowCheckInButtons.json index e969da5a..5b5c4c5c 100644 --- a/assets/json/bookedAllowCheckInButtons.json +++ b/assets/json/bookedAllowCheckInButtons.json @@ -39,6 +39,6 @@ "title": "online", "subtitle": "payment", "icon": "assets/images/new-design/check-in.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" } ] \ No newline at end of file diff --git a/lib/config/config.dart b/lib/config/config.dart index 0d122736..09584325 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -45,6 +45,10 @@ const GET_PATIENT_SHARE = const GET_PATIENT_APPOINTMENT_HISTORY = "/Doctors.svc/REST/PateintHasAppoimentHistory"; +//URL to get patient appointment curfew history +const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = + "/Doctors.svc/REST/AppoimentHistoryForCurfew"; + //URL to confirm appointment const CONFIRM_APPOINTMENT = "/MobileNotifications.svc/REST/ConfirmAppointment"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c02444f4..d9425234 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -77,6 +77,7 @@ const Map> localizedValues = { 'online': {'en': 'Online', 'ar': 'الالكترونية'}, 'payment': {'en': 'Payment', 'ar': 'الدفع'}, 'cancel-nocaps': {'en': 'Cancel', 'ar': 'الغاء'}, + 'set-reminder': {'en': 'Set Reminder', 'ar': 'تعيين تذكير'}, 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, 'loginregister': {'en': 'Login / Register', 'ar': 'دخولتسجيل'}, @@ -156,5 +157,13 @@ const Map> localizedValues = { "arabic-change": {"en": "عربي", "ar": "English"}, "notification": {"en": "Notifications", "ar": "إشعارات"}, "app-settings": {"en": "App Settings", "ar": "إعدادات التطبيق"}, - "rate-app": {"en": "Rate Our App", "ar": "قيم التطبيق"} + "rate-app": {"en": "Rate Our App", "ar": "قيم التطبيق"}, + "before": {"en": "Before", "ar": "قبل"}, + "minute": {"en": "Minutes", "ar": "دقيقة"}, + "hour": {"en": "Hour", "ar": "ساعة"}, + "reminderSuccess": {"en": "The reminder has been added successfully", "ar": "يضاف التذكير بنجاح"}, + "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, + "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, + "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, + 'paymentMethod': {'en': 'Payment Method', 'ar': 'طريقة الدفع او السداد'}, }; diff --git a/lib/pages/MyAppointments/VisitTicket.dart b/lib/pages/MyAppointments/VisitTicket.dart new file mode 100644 index 00000000..a4dd0a5e --- /dev/null +++ b/lib/pages/MyAppointments/VisitTicket.dart @@ -0,0 +1,79 @@ +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.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/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:flutter/material.dart'; + +class VisitTicket extends StatefulWidget { + List appoList = []; + + @override + _VisitTicketState createState() => _VisitTicketState(); +} + +class _VisitTicketState extends State { + bool isLoading = false; + + @override + void initState() { + getPatientAppointmentCurfewHistory(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).todoList, + body: isLoading == false + ? SingleChildScrollView( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.appoList.length, + itemBuilder: (context, index) { + return DoctorView( + doctor: widget.appoList[index], + ); + }, + ), + ) + : AppCircularProgressIndicator(), + ); + } + + getPatientAppointmentCurfewHistory() { + loading(true); + DoctorsListService service = new DoctorsListService(); + service.getPatientAppointmentHistory(true).then((res) { + print(res['AppoimentAllHistoryResultList']); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['AppoimentAllHistoryResultList'].length != 0) { + widget.appoList.clear(); + res['AppoimentAllHistoryResultList'].forEach((v) { + widget.appoList.add(new DoctorList.fromJson(v)); + }); + } else {} + }); + loading(false); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + loading(false); + } + }).catchError((err) { + print(err); + loading(false); + }); + } + + loading(bool flag) { + setState(() { + isLoading = flag; + }); + } +} diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index b7b1e19e..98b32def 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -43,19 +43,19 @@ class ArrivedButtons { "title": "Insurance", "subtitle": "Approvals", "icon": "assets/images/new-design/insurance_approvals_icon-in.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" }, { "title": "Ask Your", "subtitle": "Doctor", "icon": "assets/images/new-design/ask_doctor_icon.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" }, { "title": "Survey", "subtitle": "Service", "icon": "assets/images/new-design/survey.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" } ]; } diff --git a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart index b7b1e19e..98b32def 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart @@ -43,19 +43,19 @@ class ArrivedButtons { "title": "Insurance", "subtitle": "Approvals", "icon": "assets/images/new-design/insurance_approvals_icon-in.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" }, { "title": "Ask Your", "subtitle": "Doctor", "icon": "assets/images/new-design/ask_doctor_icon.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" }, { "title": "Survey", "subtitle": "Service", "icon": "assets/images/new-design/survey.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" } ]; } diff --git a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart index 959e8010..374ebf45 100644 --- a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart @@ -43,7 +43,7 @@ class BookedButtonsAllowCheckIn { "title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, "icon": "assets/images/new-design/check-in.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" } ]; } diff --git a/lib/pages/MyAppointments/models/ConfirmedButtons.dart b/lib/pages/MyAppointments/models/ConfirmedButtons.dart index 17d99002..d5b7836e 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtons.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtons.dart @@ -33,17 +33,17 @@ class ConfirmedButtons { "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": "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)" + "caller": "goToTodoList" } ]; } diff --git a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart index 336995a8..1368e3f3 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart @@ -37,7 +37,7 @@ class ConfirmedButtonsAllowCheckIn { "title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, "icon": "assets/images/new-design/check-in.png", - "caller": "goToTodoList(31)" + "caller": "goToTodoList" } ]; } diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 4600b9b6..2aaf13d1 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.d 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/pages/MyAppointments/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -137,6 +138,14 @@ class _AppointmentActionsState extends State { openMap(double.parse(widget.appo.latitude), double.parse(widget.appo.longitude)); break; + + case "addReminder": + showReminderDialog(widget.appo); + break; + + case "goToTodoList": + Navigator.of(context).pop(); + break; } } @@ -321,8 +330,24 @@ class _AppointmentActionsState extends State { } } - showReminderDialog() { - + showReminderDialog(AppoitmentAllHistoryResultList appo) { + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: ReminderDialog(appo: appo), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); } confirmAppointment() { diff --git a/lib/pages/MyAppointments/widgets/custom_radio.dart b/lib/pages/MyAppointments/widgets/custom_radio.dart new file mode 100644 index 00000000..2d13c1ee --- /dev/null +++ b/lib/pages/MyAppointments/widgets/custom_radio.dart @@ -0,0 +1,94 @@ +import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; +import 'package:flutter/material.dart'; + +class CustomRadio extends StatefulWidget { + @override + createState() { + return new CustomRadioState(); + } +} + +class CustomRadioState extends State { + List sampleData = new List(); + + @override + void initState() { + super.initState(); + sampleData.add(new RadioModel(false, "Before 30 Mins", 30)); + sampleData.add(new RadioModel(false, 'Before 1 Hour', 60)); + sampleData.add(new RadioModel(false, 'Before 2 Hours', 120)); + sampleData.add(new RadioModel(false, 'Before 4 Hours', 240)); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + ListView.builder( + shrinkWrap: true, + itemCount: sampleData.length, + itemBuilder: (BuildContext context, int index) { + return new InkWell( + //highlightColor: Colors.red, + splashColor: Colors.transparent, + onTap: () { + setState(() { + sampleData.forEach((element) => element.isSelected = false); + sampleData[index].isSelected = true; + ReminderDialog.selectedDuration = + sampleData[index].duration * 60000; + }); + }, + child: new RadioItem(sampleData[index]), + ); + }, + ), + ], + ); + } +} + +class RadioItem extends StatelessWidget { + final RadioModel _item; + + RadioItem(this._item); + + @override + Widget build(BuildContext context) { + return new Container( + margin: new EdgeInsets.all(15.0), + child: new Row( + mainAxisSize: MainAxisSize.max, + children: [ + new Container( + height: 30.0, + width: 30.0, + child: new Center( + child: Image.asset("assets/images/new-design/check_icon.png", + width: 15.0, height: 15.0), + ), + decoration: new BoxDecoration( + color: _item.isSelected ? Colors.blue : Colors.transparent, + border: new Border.all( + width: 1.0, + color: _item.isSelected ? Colors.blue : Colors.grey), + borderRadius: const BorderRadius.all(const Radius.circular(50.0)), + ), + ), + new Container( + margin: new EdgeInsets.only(left: 15.0), + child: new Text(_item.text, style: TextStyle(fontSize: 16.0)), + ), + ], + ), + ); + } +} + +class RadioModel { + bool isSelected; + final String text; + final int duration; + + RadioModel(this.isSelected, this.text, this.duration); +} diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog.dart b/lib/pages/MyAppointments/widgets/reminder_dialog.dart index 168e41aa..238d41d7 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog.dart @@ -1,8 +1,134 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/custom_radio.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:flutter/material.dart'; +import 'package:manage_calendar_events/manage_calendar_events.dart'; + +class ReminderDialog extends StatefulWidget { + static var selectedDuration; + + AppoitmentAllHistoryResultList appo; + + ReminderDialog({@required this.appo}); + + @override + _ReminderDialogState createState() => _ReminderDialogState(); +} + +class _ReminderDialogState extends State { + final CalendarPlugin _myPlugin = CalendarPlugin(); -class ReminderDialog extends StatelessWidget { @override Widget build(BuildContext context) { - return Container(); + return Container( + child: Dialog( + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + child: Container( + height: MediaQuery.of(context).size.height * 0.55, + width: 450.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: EdgeInsets.all(20.0), + child: Text(TranslationBase.of(context).setReminder, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + fontFamily: "Open-Sans-Bold")), + ), + Container( + transform: Matrix4.translationValues(0.0, -30.0, 0.0), + child: CustomRadio(), + ), + Container( + width: MediaQuery.of(context).size.width, + height: 40.0, + margin: EdgeInsets.only(left: 30.0, top: 0.0, right: 30.0), + child: RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + side: BorderSide(color: Colors.blue)), + color: Colors.blue, + onPressed: () { + print(ReminderDialog.selectedDuration); + createCalendarEvent(); + }, + child: Text(TranslationBase.of(context).confirm, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontFamily: 'Open-Sans-Bold')), + ), + ), + Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0), + child: OutlineButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0)), + color: Colors.red, + borderSide: BorderSide(color: Colors.red), + highlightColor: Colors.red, + highlightedBorderColor: Colors.red, + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(TranslationBase.of(context).cancel_nocaps, + style: TextStyle( + color: Colors.red, + fontWeight: FontWeight.bold, + fontFamily: 'Open-Sans-Bold')), + ), + ), + ]), + ), + ), + ); + } + + createCalendarEvent() { + _myPlugin.hasPermissions().then((value) { + if (!value) { + _myPlugin.requestPermissions(); + } else { + _myPlugin.getCalendars().then((value) => {print(value.length)}); + } + }); + + CalendarEvent calendarEvent = new CalendarEvent( + eventId: widget.appo.appointmentNo.toString(), + title: "Doctor Appointment", + description: "You have an appointment with " + + widget.appo.doctorTitle + + " " + + widget.appo.doctorNameObj, + startDate: DateUtil.convertStringToDate(widget.appo.appointmentDate) + .subtract( + new Duration(microseconds: ReminderDialog.selectedDuration)), + endDate: DateUtil.convertStringToDate(widget.appo.appointmentDate), + location: widget.appo.projectName, + duration: new Duration(minutes: 15).inMinutes, + isAllDay: false, + hasAlarm: true); + + _myPlugin + .createEvent(calendarId: "207749556", event: calendarEvent) + .then((value) { + print("Cal event"); + print(value); + if (int.parse(value) == widget.appo.appointmentNo) { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + } + Navigator.of(context).pop(); + }).catchError((err) { + print("Cal Error"); + print(err); + Navigator.of(context).pop(); + }); } } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index a9d49e6a..b916ee22 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -12,7 +14,7 @@ import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; class ToDo extends StatefulWidget { - DoctorsListService service; + PatientShareResponse patientShareResponse; List appoList = []; var languageID; @@ -28,7 +30,7 @@ class _ToDoState extends State { @override void initState() { print("initState!!!!!"); - widget.service = new DoctorsListService(); + widget.patientShareResponse = new PatientShareResponse(); getPatientAppointmentHistory(); super.initState(); } @@ -299,6 +301,10 @@ class _ToDoState extends State { case 10: confirmAppointment(appo); break; + + case 20: + getPatientShare(context, appo); + break; } } @@ -444,9 +450,53 @@ class _ToDoState extends State { }); } + getPatientShare(context, AppoitmentAllHistoryResultList appo) { + loading(true); + DoctorsListService service = new DoctorsListService(); + service + .getPatientShare( + appo.appointmentNo.toString(), appo.clinicID, appo.projectID) + .then((res) { + loading(false); + widget.patientShareResponse = new PatientShareResponse.fromJson(res); + openPaymentDialog(appo, widget.patientShareResponse); + }).catchError((err) { + loading(false); + print(err); + }); + } + + 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; + return Transform( + transform: + Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: PaymentDialog( + appo: appo, patientShareResponse: patientShareResponse), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: false, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}) + .then((value) { + getPatientAppointmentHistory(); + }); + } + confirmAppointment(AppoitmentAllHistoryResultList appo) { loading(true); - widget.service + DoctorsListService service = new DoctorsListService(); + service .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID) .then((res) { if (res['MessageStatus'] == 1) { diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart new file mode 100644 index 00000000..6ee0daef --- /dev/null +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -0,0 +1,239 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class PaymentMethod extends StatefulWidget { + @override + _PaymentMethodState createState() => _PaymentMethodState(); +} + +class _PaymentMethodState extends State { + String selectedPaymentMethod = "mada"; + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).paymentMethod, + isShowAppBar: true, + body: Container( + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: SingleChildScrollView( + child: Container( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 0.0), + alignment: Alignment.center, + child: Text("Select Payment Method", + style: TextStyle( + fontSize: 26.0, fontWeight: FontWeight.bold)), + ), + Container( + margin: EdgeInsets.only(top: 25.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: Container( + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("mada"); + }, + child: Card( + elevation: 3.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "mada" + ? BorderSide( + color: Colors.green, width: 5.0) + : BorderSide( + color: Colors.transparent, width: 0.0), + ), + child: Container( + height: 120.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: Image.asset( + "assets/images/new-design/mada.png"), + ), + ), + ), + ), + ), + Expanded( + child: Container( + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("sadad"); + }, + child: Card( + elevation: 3.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "sadad" + ? BorderSide( + color: Colors.green, width: 5.0) + : BorderSide( + color: Colors.transparent, width: 0.0), + ), + child: Container( + height: 120.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: Image.asset( + "assets/images/new-design/sadad.png"), + ), + ), + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 25.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: Container( + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("visa"); + }, + child: Card( + elevation: 3.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "visa" + ? BorderSide( + color: Colors.green, width: 5.0) + : BorderSide( + color: Colors.transparent, width: 0.0), + ), + child: Container( + height: 120.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: Image.asset( + "assets/images/new-design/visa.png"), + ), + ), + ), + ), + ), + Expanded( + child: Container( + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("mastercard"); + }, + child: Card( + elevation: 3.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "mastercard" + ? BorderSide( + color: Colors.green, width: 5.0) + : BorderSide( + color: Colors.transparent, width: 0.0), + ), + child: Container( + height: 120.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: Image.asset( + "assets/images/new-design/mastercard.png"), + ), + ), + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 25.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: Container( + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("installment"); + }, + child: Card( + elevation: 3.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "installment" + ? BorderSide( + color: Colors.green, width: 5.0) + : BorderSide( + color: Colors.transparent, width: 0.0), + ), + child: Container( + height: 120.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: Image.asset( + "assets/images/new-design/installment.png"), + ), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ), + bottomSheet: Container( + width: MediaQuery.of(context).size.width, + height: 50.0, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0), + child: 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: () { +// navigateToBookSuccess(context); +// insertAppointment(context, widget.doctor); + }, + child: Text(TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ); + } + + updateSelectedPaymentMethod(String selectedMethod) { + setState(() { + selectedPaymentMethod = selectedMethod; + }); + } +} diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart new file mode 100644 index 00000000..8341c6de --- /dev/null +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -0,0 +1,226 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +class PaymentDialog extends StatefulWidget { + AppoitmentAllHistoryResultList appo; + PatientShareResponse patientShareResponse; + + PaymentDialog({@required this.appo, this.patientShareResponse}); + + @override + _PaymentDialogState createState() => _PaymentDialogState(); +} + +class _PaymentDialogState extends State { + @override + Widget build(BuildContext context) { + return Container( + child: Dialog( + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + child: Container( + height: MediaQuery.of(context).size.height * 0.62, + width: 450.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), + child: Text("Invoice Detail", + style: TextStyle( + fontSize: 25.0, + fontWeight: FontWeight.bold, + fontFamily: "Open-Sans-Bold")), + ), + Divider( + color: Colors.grey, + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text("Appointment Details", + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + fontFamily: "Open-Sans-Bold")), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text( + widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, + style: TextStyle( + color: Colors.grey[700], + fontSize: 15.0, + fontWeight: FontWeight.bold, + fontFamily: "Open-Sans-Bold")), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text(getDate(widget.appo.appointmentDate), + style: getTextStyle()), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text(widget.appo.projectName, style: getTextStyle()), + ), + Divider( + color: Colors.grey, + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), + child: Table( + children: [ + TableRow(children: [ + TableCell( + child: _getNormalText( + TranslationBase.of(context).patientShareToDo)), + TableCell( + child: _getNormalText(widget + .patientShareResponse.patientShare + .toString())), + ]), + TableRow(children: [ + TableCell( + child: _getNormalText( + TranslationBase.of(context).patientTaxToDo)), + TableCell( + child: _getNormalText(widget + .patientShareResponse.patientTaxAmount + .toString())), + ]), + TableRow(children: [ + TableCell( + child: _getNormalText(TranslationBase.of(context) + .patientShareTotalToDo)), + TableCell( + child: _getNormalText(widget + .patientShareResponse.patientShareWithTax + .toString())), + ]), + ], + ), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), + child: Text("You can pay by following options: ", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + fontFamily: "Open-Sans")), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), + child: Image.asset( + "assets/images/new-design/payment_options_invoice_confirmation.png", + width: 300), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 15.0), + child: Text( + "Are You Sure You Want To Make payment for this Appointment?", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14.0, + color: Colors.red[700], + fontFamily: "Open-Sans")), + ), + Divider( + color: Colors.grey, + ), + Container( + alignment: Alignment.center, + height: 40.0, + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + child: Text("Cancel", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, color: Colors.red[700])), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.of(context).pop(); + naviagetToPaymentMethod(context); + }, + child: Container( + child: Text("Ok", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + )), + ), + ), + ), + ], + ), + ), + ]), + ), + ), + ); + } + + _getNormalText(text) { + return Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0), + child: Text(text, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontFamily: 'Open-Sans', + letterSpacing: 0.5, + color: Colors.grey[700])), + ); + } + + TextStyle getTextStyle() { + return TextStyle( + color: Colors.grey[700], fontSize: 15.0, fontFamily: "Open-Sans-Bold"); + } + + Future naviagetToPaymentMethod(context) async { + Navigator.push( + context, MaterialPageRoute(builder: (context) => PaymentMethod())); + } + + String getDate(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString() + + " " + + dateObj.hour.toString() + + ":" + + getMinute(dateObj); + } + + String getMinute(DateTime dateObj) { + if (dateObj.minute == 0) { + return dateObj.minute.toString() + "0"; + } else { + return dateObj.minute.toString(); + } + } +} diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 04a3abd7..f4494d2f 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -271,6 +271,39 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getPatientAppointmentCurfewHistory(bool isActiveAppointment) async { + Map request; + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "IsActiveAppointment": isActiveAppointment, + "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(GET_PATIENT_APPOINTMENT_CURFEW_HISTORY, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future confirmAppointment(int appoNo, int clinicID, int projectID) async { Map request; var languageID = await sharedPref.getString(APP_LANGUAGE); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 76b3f2c5..81efd65b 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -259,6 +259,18 @@ class TranslationBase { localizedValues['notification'][locale.languageCode]; String get appsetting => localizedValues['app-settings'][locale.languageCode]; String get rateApp => localizedValues['rate-app'][locale.languageCode]; + String get setReminder => localizedValues['set-reminder'][locale.languageCode]; + String get before => localizedValues['before'][locale.languageCode]; + String get minute => localizedValues['minute'][locale.languageCode]; + String get hour => localizedValues['hour'][locale.languageCode]; + String get reminderSuccess => localizedValues['reminderSuccess'][locale.languageCode]; + String get patientShareToDo => localizedValues['patientShareToDo'][locale.languageCode]; + String get patientTaxToDo => localizedValues['patientTaxToDo'][locale.languageCode]; + String get patientShareTotalToDo => localizedValues['patientShareTotalToDo'][locale.languageCode]; + String get paymentMethod => localizedValues['paymentMethod'][locale.languageCode]; + + + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/pubspec.yaml b/pubspec.yaml index 50784aa5..464d6ef4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -81,6 +81,8 @@ dependencies: # Location Helper map_launcher: ^0.8.1 + manage_calendar_events: ^1.0.2 +