From 750746aabe7d94677c6ce9f8235057140be18398 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 13 Aug 2020 10:43:29 +0300 Subject: [PATCH] updates & fixes --- android/app/src/main/AndroidManifest.xml | 4 +- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 3 +- .../MyAppointments/AppointmentDetails.dart | 2 +- .../MyAppointments/models/ArrivedButtons.dart | 4 +- .../models/ArrivedButtonsAllowCheckIn.dart | 6 +- .../models/AskDocRequestTypeModel.dart | 92 ++++++ .../widgets/AppointmentActions.dart | 275 +++++++++++++----- .../widgets/PrescriptionReport.dart | 153 ++++++++++ .../MyAppointments/widgets/askDocDialog.dart | 93 ++++++ .../MyAppointments/widgets/custom_radio.dart | 32 +- .../appointment_services/GetDoctorsList.dart | 203 ++++++++++++- lib/uitl/date_uitl.dart | 20 ++ lib/uitl/translations_delegate_base.dart | 2 + lib/widgets/in_app_browser/InAppBrowser.dart | 11 +- 15 files changed, 795 insertions(+), 109 deletions(-) create mode 100644 lib/pages/MyAppointments/models/AskDocRequestTypeModel.dart create mode 100644 lib/pages/MyAppointments/widgets/PrescriptionReport.dart create mode 100644 lib/pages/MyAppointments/widgets/askDocDialog.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e6bbdf39..555b2fe8 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -17,6 +17,7 @@ -<<<<<<< HEAD -======= ->>>>>>> edd850490ef9ccdee72c9e8d3318f88be0677dce diff --git a/lib/config/config.dart b/lib/config/config.dart index 1ec4417c..3a775d04 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://hmgwebservices.com/Services'; +const BASE_URL = 'https://uat.hmgwebservices.com/Services'; const GET_PROJECT = '/Lists.svc/REST/GetProject'; @@ -88,6 +88,8 @@ const CREATE_ADVANCE_PAYMENT = "/Doctors.svc/REST/CreateAdvancePayment"; const ADD_ADVANCE_NUMBER_REQUEST = '/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; const IS_ALLOW_ASK_DOCTOR = '/Doctors.svc/REST/GetPatientDoctorAppointmentResult'; +const GET_CALL_REQUEST_TYPE = '/Doctors.svc/REST/GetCallRequestType_LOV'; +const SEND_CALL_REQUEST = '/Doctors.svc/REST/InsertCallInfo'; //URL to get medicine and pharmacies list const CHANNEL = 3; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index cbf9837d..7a99333e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -233,5 +233,6 @@ const Map> localizedValues = { "patientCard": {"en": "Patient Card ID: ", "ar": "رقم الاشتراك"}, "policyNumber": {"en": "Policy Number: ", "ar": "رقم بوليصة التاميت:"}, "seeDetails": {"en": "SEE DETAILS", "ar": "منافعك التامينية"}, - "insuranceCards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"} + "insuranceCards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, + "requestType": {"en": "Request Type", "ar": "نوع الاستفسار"} }; diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index d14858b3..e3538277 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -88,7 +88,7 @@ class _AppointmentDetailsState extends State ), ), Container( - margin: EdgeInsets.only(top: 10.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), alignment: Alignment.center, child: Text( widget.appo.doctorTitle + diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index d1009753..0fdeb44d 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -13,7 +13,7 @@ class ArrivedButtons { "title": "Medicines", "subtitle": "Prescriptions", "icon": "assets/images/new-design/medicine_prescriptions_icon.png", - "caller": "onCancelAppointment" + "caller": "prescriptions" }, { "title": "Radiology", @@ -55,7 +55,7 @@ class ArrivedButtons { "title": "Survey", "subtitle": "Service", "icon": "assets/images/new-design/survey.png", - "caller": "goToTodoList" + "caller": "Survey" } ]; } diff --git a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart index 00778ef7..e6ca437a 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart @@ -13,13 +13,13 @@ class ArrivedButtons { "title": "Medicines", "subtitle": "Prescriptions", "icon": "assets/images/new-design/medicine_prescriptions_icon.png", - "caller": "onCancelAppointment" + "caller": "prescriptions" }, { "title": "Radiology", "subtitle": "Services", "icon": "assets/images/new-design/radiology_service_icon.png", - "caller": "insertComplaint" + "caller": "radiology" }, { "title": "Lab", @@ -55,7 +55,7 @@ class ArrivedButtons { "title": "Survey", "subtitle": "Service", "icon": "assets/images/new-design/survey.png", - "caller": "goToTodoList" + "caller": "Survey" } ]; } diff --git a/lib/pages/MyAppointments/models/AskDocRequestTypeModel.dart b/lib/pages/MyAppointments/models/AskDocRequestTypeModel.dart new file mode 100644 index 00000000..6b276ef0 --- /dev/null +++ b/lib/pages/MyAppointments/models/AskDocRequestTypeModel.dart @@ -0,0 +1,92 @@ +class AskDocRequestType { + String setupID; + int parameterGroup; + int parameterType; + int parameterCode; + String description; + String descriptionN; + String alias; + String aliasN; + String prefix; + String suffix; + String isColorCodingRequired; + String backColor; + String foreColor; + bool isBuiltIn; + bool isActive; + int createdBy; + String createdOn; + String editedBy; + String editedOn; + String rowVer; + + AskDocRequestType( + {this.setupID, + this.parameterGroup, + this.parameterType, + this.parameterCode, + this.description, + this.descriptionN, + this.alias, + this.aliasN, + this.prefix, + this.suffix, + this.isColorCodingRequired, + this.backColor, + this.foreColor, + this.isBuiltIn, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn, + this.rowVer}); + + AskDocRequestType.fromJson(Map json) { + setupID = json['SetupID']; + parameterGroup = json['ParameterGroup']; + parameterType = json['ParameterType']; + parameterCode = json['ParameterCode']; + description = json['Description']; + descriptionN = json['DescriptionN']; + alias = json['Alias']; + aliasN = json['AliasN']; + prefix = json['Prefix']; + suffix = json['Suffix']; + isColorCodingRequired = json['IsColorCodingRequired']; + backColor = json['BackColor']; + foreColor = json['ForeColor']; + isBuiltIn = json['IsBuiltIn']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + rowVer = json['RowVer']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ParameterGroup'] = this.parameterGroup; + data['ParameterType'] = this.parameterType; + data['ParameterCode'] = this.parameterCode; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['Alias'] = this.alias; + data['AliasN'] = this.aliasN; + data['Prefix'] = this.prefix; + data['Suffix'] = this.suffix; + data['IsColorCodingRequired'] = this.isColorCodingRequired; + data['BackColor'] = this.backColor; + data['ForeColor'] = this.foreColor; + data['IsBuiltIn'] = this.isBuiltIn; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['RowVer'] = this.rowVer; + return data; + } +} diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 6f3a2005..2387db74 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -1,18 +1,25 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/PrescriptionReport.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_page.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/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -20,10 +27,12 @@ class AppointmentActions extends StatefulWidget { AppoitmentAllHistoryResultList appo; TabController tabController; final Function enableFooterButton; + MyInAppBrowser browser; - AppointmentActions({@required this.appo, - @required this.tabController, - @required this.enableFooterButton}); + AppointmentActions( + {@required this.appo, + @required this.tabController, + @required this.enableFooterButton}); @override _AppointmentActionsState createState() => _AppointmentActionsState(); @@ -40,9 +49,7 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { - var size = MediaQuery - .of(context) - .size; + var size = MediaQuery.of(context).size; final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; final double itemWidth = size.width / 2; @@ -58,58 +65,57 @@ class _AppointmentActionsState extends State { crossAxisCount: 2, childAspectRatio: (itemWidth / itemHeight), children: appoButtonsList - .map((e) => - GestureDetector( - onTap: () { - _handleButtonClicks(e); - }, - child: Container( - height: 100.0, - margin: EdgeInsets.all(9.0), - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey[400], - blurRadius: 2.0, - spreadRadius: 0.0) - ], - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - margin: - EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: Text(e.title, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFFc5272d), - letterSpacing: 1.0, - fontSize: 20.0)), + .map((e) => GestureDetector( + onTap: () { + _handleButtonClicks(e); + }, + child: Container( + height: 100.0, + margin: EdgeInsets.all(9.0), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey[400], + blurRadius: 2.0, + spreadRadius: 0.0) + ], + borderRadius: BorderRadius.circular(10), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + margin: + EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(e.title, + overflow: TextOverflow.clip, + style: TextStyle( + color: new Color(0xFFc5272d), + letterSpacing: 1.0, + fontSize: 20.0)), + ), + Container( + margin: + EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + child: Text(e.subtitle, + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.black, + letterSpacing: 1.0, + fontSize: 15.0)), + ), + Container( + alignment: Alignment.bottomRight, + margin: + EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0), + child: Image.asset(e.icon, + width: 45.0, height: 45.0), + ), + ], ), - Container( - margin: - EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Text(e.subtitle, - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.black, - letterSpacing: 1.0, - fontSize: 15.0)), - ), - Container( - alignment: Alignment.bottomRight, - margin: - EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0), - child: Image.asset(e.icon, - width: 45.0, height: 45.0), - ), - ], - ), - ), - )) + ), + )) .toList(), ), ), @@ -133,15 +139,9 @@ class _AppointmentActionsState extends State { case "onCancelAppointment": ConfirmDialog dialog = new ConfirmDialog( context: context, - confirmMessage: TranslationBase - .of(context) - .cancelAppoMsg, - okText: TranslationBase - .of(context) - .confirm, - cancelText: TranslationBase - .of(context) - .cancel_nocaps, + confirmMessage: TranslationBase.of(context).cancelAppoMsg, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => {cancelAppointment()}, cancelFunction: () => {}); dialog.showAlertDialog(context); @@ -171,6 +171,14 @@ class _AppointmentActionsState extends State { case "radiology": openAppointmentRadiology(); break; + + case "prescriptions": + openPrescriptionReport(); + break; + + case "Survey": + rateAppointment(); + break; } } @@ -345,18 +353,57 @@ class _AppointmentActionsState extends State { openAppointmentRadiology() { DoctorsListService service = new DoctorsListService(); FinalRadiology finalRadiology = new FinalRadiology(); - service.getPatientRadOrders(widget.appo.appointmentNo.toString(), context) + service + .getPatientRadOrders(widget.appo.appointmentNo.toString(), context) .then((res) { - if (res['MessageStatus'] == 1) { - print(res['FinalRadiologyList']); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } + print(res['FinalRadiologyList']); + finalRadiology = + new FinalRadiology.fromJson(res['FinalRadiologyList'][0]); + print(finalRadiology.reportData); + navigateToRadiologyDetails(finalRadiology); + }).catchError((err) { + print(err); + AppToast.showErrorToast(message: err); + }); + } + + openPrescriptionReport() { + List prescriptionReportEnhList = List(); + DoctorsListService service = new DoctorsListService(); + service.getPatientPrescriptionReports(widget.appo, context).then((res) { + res['ListPRM'].forEach((report) { + prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report)); + }); + print(prescriptionReportEnhList.length); + navigateToMedicinePrescriptionReport( + prescriptionReportEnhList, res['ListPRM']); }).catchError((err) { print(err); + AppToast.showErrorToast(message: err); }); } + Future navigateToMedicinePrescriptionReport( + List prescriptionReportEnhList, + dynamic listPres) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PrescriptionReportPage( + prescriptionReportEnhList: prescriptionReportEnhList, + listPres: listPres, + appo: widget.appo))); + } + + Future navigateToRadiologyDetails(FinalRadiology finalRadiology) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + RadiologyDetailsPage(finalRadiology: finalRadiology))) + .then((value) {}); + } + static Future openMap(double latitude, double longitude) async { String googleUrl = 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude'; @@ -389,19 +436,80 @@ class _AppointmentActionsState extends State { askYourDoc() { DoctorsListService service = new DoctorsListService(); - service - .isAllowedToAskDoctor(widget.appo.doctorID, context) - .then((res) { + service.isAllowedToAskDoctor(widget.appo.doctorID, context).then((res) { print(res['PatientDoctorAppointmentResultList']); if (res['PatientDoctorAppointmentResultList'].length != 0) { + getCallRequestType(); + } else { + AppToast.showErrorToast( + message: TranslationBase.of(context).askDocNotAllowed); + } + }).catchError((err) { + print(err); + }); + } + + getCallRequestType() { + DoctorsListService service = new DoctorsListService(); + service.getCallRequestType(context).then((res) { + List requestData = new List(); + res['ListReqTypes'].forEach((element) { + requestData.add(new AskDocRequestType.fromJson(element)); + }); +// print(requestData.length); + Utils.hideProgressDialog(); + Future.delayed(const Duration(milliseconds: 400), () { + showAskDocRequestDialog(requestData); + }); + }).catchError((err) { + print(err); + Utils.hideProgressDialog(); + }); + } + + showAskDocRequestDialog(List requestData) { + Utils.hideProgressDialog(); + 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: AskDocDialog(requestData: requestData), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}) + .then((value) { + print("Dialog Closed"); + print(value); + if (value != null) { + sendAskDocRequest(value); + } + }); + } + sendAskDocRequest(int requestType) { + DoctorsListService service = new DoctorsListService(); + service + .sendAskDocCallRequest(widget.appo, requestType.toString(), context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: "Request Sent Successfully"); } else { - AppToast.showErrorToast(message: TranslationBase - .of(context) - .askDocNotAllowed); + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { print(err); + AppToast.showErrorToast(message: err); }); } @@ -409,7 +517,7 @@ class _AppointmentActionsState extends State { DoctorsListService service = new DoctorsListService(); service .confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, - widget.appo.projectID, context) + widget.appo.projectID, context) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); @@ -422,6 +530,15 @@ class _AppointmentActionsState extends State { }); } + rateAppointment() { + widget.browser = new MyInAppBrowser(); + widget.browser.openBrowser('http://hmg.com/SitePages/pso.aspx?p=' + + widget.appo.projectID.toString() + + '.' + + widget.appo.appointmentNo.toString() + + '&c=1'); + } + loading(bool flag) { setState(() { AppointmentDetails.isLoading = flag; diff --git a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart new file mode 100644 index 00000000..ae19a900 --- /dev/null +++ b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart @@ -0,0 +1,153 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionReportPage extends StatefulWidget { + List prescriptionReportEnhList; + dynamic listPres; + AppoitmentAllHistoryResultList appo; + + PrescriptionReportPage({@required this.prescriptionReportEnhList, @required this.listPres, @required this.appo}); + + @override + _PrescriptionReportState createState() => _PrescriptionReportState(); +} + +class _PrescriptionReportState extends State { + @override + void initState() { + print(widget.prescriptionReportEnhList.length); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Items', + body: Container( + height: MediaQuery.of(context).size.height * 0.8, + child: ListView.builder( + itemBuilder: (context, index) => InkWell( + onTap: () { + navigateToPrescriptionDetails( + widget.prescriptionReportEnhList[index]); + }, + child: Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + widget.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(widget + .prescriptionReportEnhList[index].itemDescription)), + )), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), + ), + ), + itemCount: widget.prescriptionReportEnhList.length, + ), + ), + bottomSheet: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.2, + color: Colors.grey[100], + child: Column( + children: [ + Divider(), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Send Copy', + onTap: () { + sendPrescriptionReportEmail(); + }, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Resend order & deliver', + backgroundColor: Colors.green[200], + )) + ], + ), + ), + ); + } + + sendPrescriptionReportEmail() { + DoctorsListService service = new DoctorsListService(); + service.sendPrescriptionEmail(widget.appo.appointmentDate, widget.appo.setupID, widget.listPres, context).then((res) { + AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail'); + Utils.hideProgressDialog(); + }).catchError((err) { + print(err); + Utils.hideProgressDialog(); + AppToast.showErrorToast(message: err); + }); + } + + navigateToPrescriptionDetails(PrescriptionReportEnh prescriptionReportEnh) { + final PrescriptionReport prescriptionReport = new PrescriptionReport(); + + prescriptionReport.imageSRCUrl = prescriptionReportEnh.imageSRCUrl; + prescriptionReport.itemDescription = prescriptionReportEnh.itemDescription; + prescriptionReport.itemID = prescriptionReportEnh.itemID; + + prescriptionReport.routeN = prescriptionReportEnh.route; + prescriptionReport.route = prescriptionReportEnh.route; + + prescriptionReport.frequency = prescriptionReportEnh.frequency; + prescriptionReport.frequencyN = prescriptionReportEnh.frequency; + + prescriptionReport.doseDailyQuantity = + prescriptionReportEnh.doseDailyQuantity; + + prescriptionReport.days = prescriptionReportEnh.days; + + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: prescriptionReport, + ), + ), + ); + } +} diff --git a/lib/pages/MyAppointments/widgets/askDocDialog.dart b/lib/pages/MyAppointments/widgets/askDocDialog.dart new file mode 100644 index 00000000..15af9ae7 --- /dev/null +++ b/lib/pages/MyAppointments/widgets/askDocDialog.dart @@ -0,0 +1,93 @@ +import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +import 'custom_radio.dart'; + +class AskDocDialog extends StatefulWidget { + + List requestData; + + static int selectedParameterCode = 0; + + AskDocDialog({@required this.requestData}); + + @override + _AskDocDialogState createState() => _AskDocDialogState(); +} + +class _AskDocDialogState 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.77, + width: 450.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: EdgeInsets.all(20.0), + child: Text(TranslationBase.of(context).requestType, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + fontFamily: "Open-Sans-Bold")), + ), + Container( + transform: Matrix4.translationValues(0.0, -30.0, 0.0), + child: CustomRadio(requestData: widget.requestData), + ), + 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: () { + if(AskDocDialog.selectedParameterCode != 0) + Navigator.pop(context, AskDocDialog.selectedParameterCode); + else + AppToast.showErrorToast(message: "Please select request type to continue"); + }, + 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.pop(context, null); + }, + child: Text(TranslationBase.of(context).cancel_nocaps, + style: TextStyle( + color: Colors.red, + fontWeight: FontWeight.bold, + fontFamily: 'Open-Sans-Bold')), + ), + ), + ]), + ), + ), + ); + } +} diff --git a/lib/pages/MyAppointments/widgets/custom_radio.dart b/lib/pages/MyAppointments/widgets/custom_radio.dart index 2d13c1ee..2ea9a39c 100644 --- a/lib/pages/MyAppointments/widgets/custom_radio.dart +++ b/lib/pages/MyAppointments/widgets/custom_radio.dart @@ -1,7 +1,13 @@ +import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; import 'package:flutter/material.dart'; class CustomRadio extends StatefulWidget { + List requestData; + + CustomRadio({this.requestData}); + @override createState() { return new CustomRadioState(); @@ -14,10 +20,18 @@ class CustomRadioState extends State { @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)); + + if (widget.requestData != null) { + widget.requestData.forEach((element) { + sampleData.add( + new RadioModel(false, element.description, element.parameterCode)); + }); + } else { + 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 @@ -35,8 +49,14 @@ class CustomRadioState extends State { setState(() { sampleData.forEach((element) => element.isSelected = false); sampleData[index].isSelected = true; - ReminderDialog.selectedDuration = - sampleData[index].duration * 60000; + if (widget.requestData != null) { + AskDocDialog.selectedParameterCode = + sampleData[index].duration; + print(AskDocDialog.selectedParameterCode); + } else { + ReminderDialog.selectedDuration = + sampleData[index].duration * 60000; + } }); }, child: new RadioItem(sampleData[index]), diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 8a2bd80f..ff2e5f61 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -697,6 +697,107 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getCallRequestType(BuildContext context) async { + Utils.showProgressDialog(context); + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + await baseAppClient.post(GET_CALL_REQUEST_TYPE, + onSuccess: (response, statusCode) async { + localRes = response; + Utils.hideProgressDialog(); + }, onFailure: (String error, int statusCode) { + Utils.hideProgressDialog(); + throw error; + }, body: request); + return Future.value(localRes); + } + + Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, + String requestType, BuildContext context) async { + Utils.showProgressDialog(context); + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "ProjectID": appo.projectID, + "SetupID": appo.setupID, + "DoctorID": appo.doctorID, + "RequestType": requestType, + "RequestTypeID": requestType, + "PatientMobileNumber": authUser.mobileNumber, + "IsMessageSent": false, + "RequestDate": + DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) + .split(" ")[0], + "RequestTime": + DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) + .split(" ")[1], + "Remarks": "", + "Status": 1, + "CreatedBy": 102, + "CreatedOn": + DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) + .split(" ")[0], + "EditedBy": 102, + "EditedOn": + DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) + .split(" ")[0], + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + await baseAppClient.post(SEND_CALL_REQUEST, + onSuccess: (response, statusCode) async { + localRes = response; + Utils.hideProgressDialog(); + }, onFailure: (String error, int statusCode) { + Utils.hideProgressDialog(); + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientRadOrders(String appoNo, BuildContext context) async { Utils.showProgressDialog(context); Map request; @@ -727,15 +828,105 @@ class DoctorsListService extends BaseService { dynamic localRes; await baseAppClient.post(GET_PATIENT_ORDERS, onSuccess: (response, statusCode) async { - localRes = response; - Utils.hideProgressDialog(); - }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); - throw error; - }, body: request); + localRes = response; + Utils.hideProgressDialog(); + }, onFailure: (String error, int statusCode) { + Utils.hideProgressDialog(); + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getPatientPrescriptionReports( + AppoitmentAllHistoryResultList appo, BuildContext context) async { + Utils.showProgressDialog(context); + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "AppointmentNo": appo.appointmentNo, + "ClinicID": appo.clinicID, + "ProjectID": appo.projectID, + "EpisodeID": appo.episodeID, + "VersionID": req.VersionID, + "SetupID": appo.setupID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + await baseAppClient.post(GET_PRESCRIPTION_REPORT_ENH, + onSuccess: (response, statusCode) async { + localRes = response; + Utils.hideProgressDialog(); + }, onFailure: (String error, int statusCode) { + Utils.hideProgressDialog(); + throw error; + }, body: request); return Future.value(localRes); } + Future sendPrescriptionEmail(String appoDate, String setupId, + dynamic prescriptionReportEnhList, BuildContext context) async { + Utils.showProgressDialog(context); + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "AppointmentDate": appoDate, + "DateofBirth": authUser.dateofBirth, + "ListPrescriptions": prescriptionReportEnhList, + "PatientIditificationNum": authUser.patientIdentificationNo, + "PatientMobileNumber": authUser.mobileNumber, + "PatientName": authUser.firstName + " " + authUser.lastName, + "To": authUser.emailAddress, + "SetupID": setupId, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, + onSuccess: (response, statusCode) async { + localRes = response; + Utils.hideProgressDialog(); + }, onFailure: (String error, int statusCode) { + Utils.hideProgressDialog(); + throw error; + }, body: request); + return Future.value(localRes); + } Future createAdvancePayment( AppoitmentAllHistoryResultList appo, diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index e35fc41e..20bc6a2b 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -1,4 +1,5 @@ import 'package:intl/intl.dart'; + class DateUtil { /// convert String To Date function /// [date] String we want to convert @@ -145,6 +146,25 @@ class DateUtil { return ""; } + /// get data formatted like 2020-8-13 09:43:00 + /// [dateTime] convert DateTime to data formatted + static String getYearMonthDayHourMinSecDateFormatted(DateTime dateTime) { + if (dateTime != null) + return dateTime.year.toString() + + "-" + + dateTime.month.toString() + + "-" + + dateTime.day.toString() + + " " + + dateTime.hour.toString() + + ":" + + dateTime.minute.toString() + + ":" + + dateTime.second.toString(); + else + return ""; + } + static convertISODateToJsonDate(String isoDate) { return "/Date(" + DateFormat('mm-dd-yyy') diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a0e25c00..21e74ce2 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -332,6 +332,8 @@ class TranslationBase { String get seeDetails => localizedValues['seeDetails'][locale.languageCode]; String get insuranceCards => localizedValues['insuranceCards'][locale.languageCode]; + String get requestType => + localizedValues['requestType'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index fceba0c0..46c32ab6 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -5,8 +5,6 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; class MyInAppBrowser extends InAppBrowser { @@ -148,12 +146,11 @@ class MyInAppBrowser extends InAppBrowser { this.browser.openUrl( url: generateURL(amount, orderDesc, transactionID, projId, emailId, paymentMethod, authenticatedUser)); + } -// this.browser.openData( -// data: generateURL(amount, orderDesc, transactionID, projId, emailId, -// paymentMethod, authenticatedUser), -// baseUrl: -// "https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx"); + openBrowser(String url) { + this.browser = browser; + this.browser.openUrl(url: url); } String generateURL(