From 750746aabe7d94677c6ce9f8235057140be18398 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 13 Aug 2020 10:43:29 +0300 Subject: [PATCH 1/7] 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( From 206f9a437100795a193e3a94fa39f42b704c0bab Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 13 Aug 2020 10:44:06 +0300 Subject: [PATCH 2/7] fixes --- lib/core/service/client/base_app_client.dart | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 651650cf..9586b862 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -24,18 +24,18 @@ class BaseAppClient { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); // String token = await sharedPref.getString(TOKEN); - body['SetupID'] = SETUP_ID; - body['VersionID'] = VERSION_ID; - body['Channel'] = CHANNEL; - body['LanguageID'] = LANGUAGE; - body['IPAdress'] = IP_ADDRESS; - body['generalid'] = GENERAL_ID; - body['PatientOutSA'] = PATIENT_OUT_SA; - body['SessionID'] = SESSION_ID; - body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; - body['DeviceTypeID'] = DeviceTypeID; - body['PatientType'] = PATIENT_TYPE; - body['PatientTypeID'] = PATIENT_TYPE_ID; +// body['SetupID'] = SETUP_ID; +// body['VersionID'] = VERSION_ID; +// body['Channel'] = CHANNEL; +// body['LanguageID'] = LANGUAGE; +// body['IPAdress'] = IP_ADDRESS; +// body['generalid'] = GENERAL_ID; +// body['PatientOutSA'] = PATIENT_OUT_SA; +// body['SessionID'] = SESSION_ID; +// body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; +// body['DeviceTypeID'] = DeviceTypeID; +// body['PatientType'] = PATIENT_TYPE; +// body['PatientTypeID'] = PATIENT_TYPE_ID; body['TokenID'] = '@dm!n'; body['PatientID'] = 1231755; From 7972d01dff53b7ce5c96204a6ae317d0c8644237 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 13 Aug 2020 14:46:11 +0300 Subject: [PATCH 3/7] Insurance Approval implemented --- lib/config/config.dart | 2 +- .../model/insurance/insurance_approval.dart | 17 +++++++++--- lib/core/model/insurance/insurance_card.dart | 2 +- .../insurance/insurance_card_update.dart | 1 + lib/core/service/client/base_app_client.dart | 26 +++++++++---------- lib/core/service/insurance_service.dart | 21 ++++++++++++--- .../viewModels/insurance_card_View_model.dart | 19 +++++++++----- .../MyAppointments/models/ArrivedButtons.dart | 2 +- .../models/ArrivedButtonsAllowCheckIn.dart | 2 +- .../widgets/AppointmentActions.dart | 18 ++++++++----- .../insurance/insurance_approval_screen.dart | 21 ++++++++++----- .../insurance/insurance_card_screen.dart | 21 ++++++++------- lib/pages/landing/landing_page.dart | 3 ++- 13 files changed, 101 insertions(+), 54 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 3a775d04..549d54fe 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://uat.hmgwebservices.com/Services'; +const BASE_URL = 'https://hmgwebservices.com/Services'; const GET_PROJECT = '/Lists.svc/REST/GetProject'; diff --git a/lib/core/model/insurance/insurance_approval.dart b/lib/core/model/insurance/insurance_approval.dart index 4df6d882..894fad46 100644 --- a/lib/core/model/insurance/insurance_approval.dart +++ b/lib/core/model/insurance/insurance_approval.dart @@ -43,9 +43,11 @@ class InsuranceApprovalModel { int approvalNo; String approvalStatusDescption; int unUsedCount; + //String companyName; String expiryDate; String rceiptOn; + int appointmentNo; InsuranceApprovalModel( {this.versionID, @@ -72,8 +74,11 @@ class InsuranceApprovalModel { //this.companyName, this.expiryDate, this.rceiptOn, - this.approvalDetails}); + this.approvalDetails, + this.appointmentNo}); + InsuranceApprovalDetails x = InsuranceApprovalDetails(); + InsuranceApprovalModel.fromJson(Map json) { try { rceiptOn = json['ReceiptOn']; @@ -102,6 +107,7 @@ class InsuranceApprovalModel { clinicName = json['ClinicName']; approvalDetails = InsuranceApprovalDetails.fromJson(json['ApporvalDetails'][0]); + appointmentNo = json['AppointmentNo']; } catch (e) { print(e); } @@ -122,8 +128,13 @@ class InsuranceApprovalModel { data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; - data['EXuldAPPNO'] = this.eXuldAPPNO; - data['ProjectID'] = this.projectID; + if (appointmentNo == null) { + data['EXuldAPPNO'] = this.eXuldAPPNO; + data['ProjectID'] = this.projectID; + } + if (appointmentNo != null) { + data['AppointmentNo'] = this.appointmentNo; + } return data; } } diff --git a/lib/core/model/insurance/insurance_card.dart b/lib/core/model/insurance/insurance_card.dart index 1c02705b..998df241 100644 --- a/lib/core/model/insurance/insurance_card.dart +++ b/lib/core/model/insurance/insurance_card.dart @@ -42,7 +42,7 @@ class InsuranceCardModel { this.companyName, this.patientCardID, this.isActive, - this.cardValidTo, + this.cardValidTo }); InsuranceCardModel.fromJson(Map json) { diff --git a/lib/core/model/insurance/insurance_card_update.dart b/lib/core/model/insurance/insurance_card_update.dart index fd5e0db5..6f5331ce 100644 --- a/lib/core/model/insurance/insurance_card_update.dart +++ b/lib/core/model/insurance/insurance_card_update.dart @@ -16,6 +16,7 @@ class InsuranceUpdateModel { int deviceTypeID; String createdOn; String statusDescription; + int appointmentNo; InsuranceUpdateModel( {this.patientID, diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 05cb0f8b..ec75bb5b 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -25,18 +25,18 @@ class BaseAppClient { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); var user = await sharedPref.getObject(USER_PROFILE); - body['SetupID'] = SETUP_ID; - body['VersionID'] = VERSION_ID; - body['Channel'] = CHANNEL; - body['LanguageID'] = LANGUAGE; - body['IPAdress'] = IP_ADDRESS; - body['generalid'] = GENERAL_ID; - // body['PatientOutSA'] = PATIENT_OUT_SA; - body['SessionID'] = null; //SESSION_ID; - body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; - body['DeviceTypeID'] = DeviceTypeID; - body['PatientType'] = PATIENT_TYPE; - body['PatientTypeID'] = PATIENT_TYPE_ID; +// body['SetupID'] = SETUP_ID; +// body['VersionID'] = VERSION_ID; +// body['Channel'] = CHANNEL; +// body['LanguageID'] = LANGUAGE; +// body['IPAdress'] = IP_ADDRESS; +// body['generalid'] = GENERAL_ID; +// // body['PatientOutSA'] = PATIENT_OUT_SA; +// body['SessionID'] = null; //SESSION_ID; +// body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; +// body['DeviceTypeID'] = DeviceTypeID; +// body['PatientType'] = PATIENT_TYPE; +// body['PatientTypeID'] = PATIENT_TYPE_ID; if (user != null) { body['TokenID'] = token; //user['TokenID']; body['PatientID'] = user['PatientID']; @@ -93,6 +93,6 @@ class BaseAppClient { } String getSessionId(String id) { - return id.replaceAll('/[^a-zA-Z ]', ''); + return id.replaceAll(RegExp('/[^a-zA-Z ]'), ''); } } diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index 6f0d2142..8850e953 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; -import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update.dart'; -import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; class InsuranceCardService extends BaseService { List _cardList = List(); @@ -10,7 +10,9 @@ class InsuranceCardService extends BaseService { List _insuranceApproval = List(); List get cardList => _cardList; + List get updatedCard => _cardUpdated; + List get insuranceApproval => _insuranceApproval; clearInsuranceCard() { @@ -96,11 +98,24 @@ class InsuranceCardService extends BaseService { }, body: _insuranceUpdateModel.toJson()); } - Future getInsuranceApproval() async { + Future getInsuranceApproval({int appointmentNo}) async { hasError = false; // _cardList.clear(); + if(appointmentNo != null) { + _insuranceApprovalModel.appointmentNo = appointmentNo; + _insuranceApprovalModel.eXuldAPPNO = null; + _insuranceApprovalModel.projectID = null; + } else { + _insuranceApprovalModel.appointmentNo = null; + _insuranceApprovalModel.eXuldAPPNO = 0; + _insuranceApprovalModel.projectID = 0; + } + await baseAppClient.post(GET_PAtIENTS_INSURANCE_APPROVALS, onSuccess: (dynamic response, int statusCode) { + print(response['HIS_Approval_List'].length); + _insuranceApproval.clear(); + _insuranceApproval.length = 0; response['HIS_Approval_List'].forEach((item) { _insuranceApproval.add(InsuranceApprovalModel.fromJson(item)); }); diff --git a/lib/core/viewModels/insurance_card_View_model.dart b/lib/core/viewModels/insurance_card_View_model.dart index 1d13257f..a6975360 100644 --- a/lib/core/viewModels/insurance_card_View_model.dart +++ b/lib/core/viewModels/insurance_card_View_model.dart @@ -1,12 +1,11 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; +import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update.dart'; -import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; +import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; -import 'base_view_model.dart'; import '../../locator.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; -import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; +import 'base_view_model.dart'; class InsuranceViewModel extends BaseViewModel { bool hasError = false; @@ -14,8 +13,10 @@ class InsuranceViewModel extends BaseViewModel { InsuranceCardService _insuranceCardService = locator(); List get insurance => _insuranceCardService.cardList; + List get insuranceUpdate => _insuranceCardService.updatedCard; + List get insuranceApproval => _insuranceCardService.insuranceApproval; @@ -43,11 +44,15 @@ class InsuranceViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getInsuranceApproval() async { + Future getInsuranceApproval({int appointmentNo}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _insuranceCardService.getInsuranceApproval(); + if (appointmentNo != null) + await _insuranceCardService.getInsuranceApproval( + appointmentNo: appointmentNo); + else + await _insuranceCardService.getInsuranceApproval(); if (_insuranceCardService.hasError) { error = _insuranceCardService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index 0fdeb44d..df7ee3c8 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -43,7 +43,7 @@ class ArrivedButtons { "title": "Insurance", "subtitle": "Approvals", "icon": "assets/images/new-design/insurance_approvals_icon.png", - "caller": "goToTodoList" + "caller": "Insurance" }, { "title": "Ask Your", diff --git a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart index e6ca437a..2e1034b7 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart @@ -43,7 +43,7 @@ class ArrivedButtons { "title": "Insurance", "subtitle": "Approvals", "icon": "assets/images/new-design/insurance_approvals_icon.png", - "caller": "goToTodoList" + "caller": "Insurance" }, { "title": "Ask Your", diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 2387db74..4852909b 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor 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'; @@ -13,6 +12,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButton 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/insurance/insurance_approval_screen.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'; @@ -20,6 +20,7 @@ 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:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -179,6 +180,10 @@ class _AppointmentActionsState extends State { case "Survey": rateAppointment(); break; + + case "Insurance": + navigateToInsuranceApprovals(widget.appo.appointmentNo); + break; } } @@ -530,6 +535,11 @@ class _AppointmentActionsState extends State { }); } + navigateToInsuranceApprovals(int appoNo) { + Navigator.push( + context, FadePage(page: InsuranceApproval(appointmentNo: appoNo))); + } + rateAppointment() { widget.browser = new MyInAppBrowser(); widget.browser.openBrowser('http://hmg.com/SitePages/pso.aspx?p=' + @@ -538,10 +548,4 @@ class _AppointmentActionsState extends State { widget.appo.appointmentNo.toString() + '&c=1'); } - - loading(bool flag) { - setState(() { - AppointmentDetails.isLoading = flag; - }); - } } diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 041adb82..9cc40692 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -1,14 +1,18 @@ -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:flutter/cupertino.dart'; -import '../base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../base/base_view.dart'; class InsuranceApproval extends StatefulWidget { + int appointmentNo; + + InsuranceApproval({this.appointmentNo}); + @override _InsuranceApprovalState createState() => _InsuranceApprovalState(); } @@ -17,7 +21,10 @@ class _InsuranceApprovalState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getInsuranceApproval(), + onModelReady: widget.appointmentNo != null + ? (model) => + model.getInsuranceApproval(appointmentNo: widget.appointmentNo) + : (model) => model.getInsuranceApproval(), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( isShowAppBar: true, diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 282538c2..70d164ff 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -1,17 +1,20 @@ -import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:flutter/cupertino.dart'; -import '../base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/others/rounded_container.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../base/base_view.dart'; class InsuranceCard extends StatefulWidget { + int appointmentNo; + + InsuranceCard({this.appointmentNo}); + @override _InsuranceCardState createState() => _InsuranceCardState(); } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index c3bee59e..7920e1d4 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; @@ -81,7 +82,7 @@ class _LandingPageState extends State { physics: NeverScrollableScrollPhysics(), controller: pageController, children: [ - HomePage(), MedicalProfilePage(), MyAdmissionsPage(), ToDo()], + HomePage(), MedicalProfilePage(), MyAdmissionsPage(), ToDo(), BookingOptions()], // Please do not remove the BookingOptions from this array ), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), ); From 3b881f1ab3ef1032a042df5343dce50667be160a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 16 Aug 2020 11:38:00 +0300 Subject: [PATCH 4/7] appointment details scenarios handled --- lib/pages/MyAppointments/widgets/AppointmentActions.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 4852909b..1176140b 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -380,8 +380,12 @@ class _AppointmentActionsState extends State { prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report)); }); print(prescriptionReportEnhList.length); - navigateToMedicinePrescriptionReport( - prescriptionReportEnhList, res['ListPRM']); + if (prescriptionReportEnhList.length != 0) { + navigateToMedicinePrescriptionReport( + prescriptionReportEnhList, res['ListPRM']); + } else { + AppToast.showErrorToast(message: "Sorry there is no data"); + } }).catchError((err) { print(err); AppToast.showErrorToast(message: err); From b9d913e6a51af479e7633b70684b3c6e11680ff4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 17 Aug 2020 16:30:15 +0300 Subject: [PATCH 5/7] Merge fixes & updates --- lib/core/service/client/base_app_client.dart | 36 ++++++++----- lib/pages/BookAppointment/BookSuccess.dart | 2 + lib/pages/ToDoList/ToDo.dart | 1 + .../appointment_services/GetDoctorsList.dart | 14 +++--- lib/widgets/in_app_browser/InAppBrowser.dart | 50 +++---------------- 5 files changed, 40 insertions(+), 63 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index ec75bb5b..a72d15a7 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -59,24 +59,34 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - if (isAllowAny) { + if (parsed['Response_Message'] != null) { onSuccess(parsed, statusCode); - } else if (!parsed['IsAuthenticated']) { - if (parsed['isSMSSent'] == true) { + } else { + if (isAllowAny) { onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 1) { + } else if (!parsed['IsAuthenticated']) { + if (parsed['isSMSSent'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + logout(); + } + } else if (parsed['MessageStatus'] == 1 || + parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logout(); + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + onFailure( + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { - onSuccess(parsed, statusCode); - } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); } } } else { diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index cdad398f..163c42e2 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -109,11 +109,13 @@ class _BookSuccessState extends State { 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.ellipsis, style: _getTextStyling()), ), ], diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index a7e06342..24b7aa74 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index ff2e5f61..05205de2 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -42,14 +42,14 @@ class DoctorsListService extends BaseService { "PatientOutSA": 0, "TokenID": "", "DeviceTypeID": req.DeviceTypeID, - "SessionID": null, + "SessionID": "YckwoXhUmWBsnHKEKig", "ClinicID": clinicID, "ProjectID": projectID, "ContinueDentalPlan": false, "IsSearchAppointmnetByClinicID": true, - "PatientID": authUser.patientID, - "gender": authUser.gender, - "age": authUser.age, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "gender": authUser.gender != null ? authUser.gender : 0, + "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, "Latitude": 0, "Longitude": 0, @@ -95,9 +95,9 @@ class DoctorsListService extends BaseService { "ContinueDentalPlan": false, "IsSearchAppointmnetByClinicID": false, "DoctorName": docName, - "PatientID": authUser.patientID, - "gender": authUser.gender, - "age": authUser.age, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "gender": authUser.gender != null ? authUser.gender : 0, + "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, "Latitude": 0, "Longitude": 0, diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 46c32ab6..6722971d 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -8,18 +8,17 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; class MyInAppBrowser extends InAppBrowser { -// static String SERVICE_URL = -// 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // ignore: non_constant_identifier_names - static String SERVICE_URL = - 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT -// static String PREAUTH_SERVICE_URL = -// 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT +// static String SERVICE_URL = +// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE static String PREAUTH_SERVICE_URL = - 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + +// static String PREAUTH_SERVICE_URL = +// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store static List successURLS = [ 'success', @@ -50,41 +49,6 @@ class MyInAppBrowser extends InAppBrowser { @override Future onLoadStart(String url) async { onLoadStartCallback(url); - // print("\n\nStarted $url\n\n"); - -// if (successURLS.length != 0) { -// successURLS.forEach((element) { -// if (url.contains(element)) { -// try { -// if (browser.isOpened()) browser.close(); -// isPaymentDone = true; -// Utils.hideProgressDialog(); -// return; -// } on MissingPluginException catch (exception) { -// Utils.hideProgressDialog(); -// } catch (error) { -// Utils.hideProgressDialog(); -// } -// } -// }); -// } -// -// if (errorURLS.length != 0) { -// errorURLS.forEach((element) { -// if (url.contains(element)) { -// try { -// if (browser.isOpened()) browser.close(); -// isPaymentDone = false; -// Utils.hideProgressDialog(); -// return; -// } on MissingPluginException catch (exception) { -// Utils.hideProgressDialog(); -// } catch (error) { -// Utils.hideProgressDialog(); -// } -// } -// }); -// } } @override From 2b0e35a907d68621d65334728275e6082af6c946 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 18 Aug 2020 16:56:50 +0300 Subject: [PATCH 6/7] fix issues in base app client --- lib/core/service/base_service.dart | 8 +- lib/core/service/client/base_app_client.dart | 27 +- lib/core/service/medical/medical_service.dart | 21 + .../service/medical/vital_sign_service.dart | 23 +- lib/core/viewModels/base_view_model.dart | 16 + .../medical/medical_view_model.dart | 22 + lib/locator.dart | 5 +- .../insurance/insurance_update_screen.dart | 1 - lib/pages/medical/medical_profile_page.dart | 581 ++++++++++++------ lib/uitl/app_shared_preferences.dart | 7 + .../medical/medical_profile_item.dart | 2 +- 11 files changed, 498 insertions(+), 215 deletions(-) create mode 100644 lib/core/service/medical/medical_service.dart create mode 100644 lib/core/viewModels/medical/medical_view_model.dart diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index aee938c6..bef0e1f4 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -13,11 +13,11 @@ class BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); BaseService() { - getUser(); + _getUser(); } - getUser() async { - user = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - + _getUser() async { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null) user = AuthenticatedUser.fromJson(userData); } } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a72d15a7..3811fc8a 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -24,21 +24,22 @@ class BaseAppClient { try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); -// body['SetupID'] = SETUP_ID; -// body['VersionID'] = VERSION_ID; -// body['Channel'] = CHANNEL; -// body['LanguageID'] = LANGUAGE; -// body['IPAdress'] = IP_ADDRESS; -// body['generalid'] = GENERAL_ID; -// // body['PatientOutSA'] = PATIENT_OUT_SA; -// body['SessionID'] = null; //SESSION_ID; -// body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; -// body['DeviceTypeID'] = DeviceTypeID; -// body['PatientType'] = PATIENT_TYPE; -// body['PatientTypeID'] = PATIENT_TYPE_ID; + body['SetupID'] = body.containsKey('SetupID') ? body['SetupID']!=null? body['SetupID'] :SETUP_ID :SETUP_ID; + body['VersionID'] = body.containsKey('VersionID') ? body['VersionID']!=null? body['VersionID'] :VERSION_ID :VERSION_ID; + body['Channel'] = CHANNEL; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + body['IPAdress'] = IP_ADDRESS; + body['generalid'] = GENERAL_ID; + body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA']!=null? body['PatientOutSA'] :PATIENT_OUT_SA :PATIENT_OUT_SA; + body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; + body['DeviceTypeID'] = DeviceTypeID; + body['PatientType'] = body.containsKey('PatientType') ? body['PatientType']!=null? body['PatientType'] :PATIENT_TYPE :PATIENT_TYPE; + body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID']!=null? body['PatientTypeID'] :PATIENT_TYPE_ID :PATIENT_TYPE_ID; if (user != null) { - body['TokenID'] = token; //user['TokenID']; + body['TokenID'] = token; body['PatientID'] = user['PatientID']; body['PatientOutSA'] = user['OutSA']; body['SessionID'] = getSessionId(token); diff --git a/lib/core/service/medical/medical_service.dart b/lib/core/service/medical/medical_service.dart new file mode 100644 index 00000000..95d45012 --- /dev/null +++ b/lib/core/service/medical/medical_service.dart @@ -0,0 +1,21 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; + +class MedicalService extends BaseService { + List appoitmentAllHistoryResultList = List(); + + getAppointmentHistory() async { + await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, + onSuccess: (response, statusCode) async { + appoitmentAllHistoryResultList.clear(); + response['AppoimentAllHistoryResultList'].forEach((appoitment) { + appoitmentAllHistoryResultList + .add(AppoitmentAllHistoryResultList.fromJson(appoitment)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } +} diff --git a/lib/core/service/medical/vital_sign_service.dart b/lib/core/service/medical/vital_sign_service.dart index 813332cc..1add63cf 100644 --- a/lib/core/service/medical/vital_sign_service.dart +++ b/lib/core/service/medical/vital_sign_service.dart @@ -4,23 +4,20 @@ import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model. import '../base_service.dart'; class VitalSignService extends BaseService { - List vitalSignResModelList = List(); + Map body = Map(); - Future getPatientRadOrders () async { + Future getPatientRadOrders() async { hasError = false; await baseAppClient.post(GET_PATIENT_VITAL_SIGN, onSuccess: (dynamic response, int statusCode) { - vitalSignResModelList.clear(); - response['List_DoctorPatientVitalSign'].forEach((vital) { - vitalSignResModelList.add(VitalSignResModel.fromJson(vital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: Map()); + vitalSignResModelList.clear(); + response['List_DoctorPatientVitalSign'].forEach((vital) { + vitalSignResModelList.add(VitalSignResModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); } - - - } diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index 497a96b6..08fc7a9d 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -1,4 +1,7 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; class BaseViewModel extends ChangeNotifier { @@ -9,8 +12,21 @@ class BaseViewModel extends ChangeNotifier { String error = ""; + AuthenticatedUser user; + AppSharedPreferences sharedPref = AppSharedPreferences(); + void setState(ViewState viewState) { _state = viewState; notifyListeners(); } + + BaseViewModel() { + _getUser(); + } + + _getUser() async { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null) user = AuthenticatedUser.fromJson(userData); + notifyListeners(); + } } diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart new file mode 100644 index 00000000..b5db9d80 --- /dev/null +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/medical/medical_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; + +class MedicalViewModel extends BaseViewModel { + List get appoitmentAllHistoryResultList => + List(); + + MedicalService _medicalService = locator(); + + getAppointmentHistory() { + setState(ViewState.Busy); + _medicalService.getAppointmentHistory(); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index f884edcb..529c9e90 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -4,6 +4,7 @@ import 'package:get_it/get_it.dart'; import 'core/service/feedback/feedback_service.dart'; import 'core/service/hospital_service.dart'; import 'core/service/medical/labs_service.dart'; +import 'core/service/medical/medical_service.dart'; import 'core/service/medical/my_doctor_service.dart'; import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; @@ -11,6 +12,7 @@ import 'core/service/medical/vital_sign_service.dart'; import 'core/viewModels/feedback/feedback_view_model.dart'; import 'core/viewModels/hospital_view_model.dart'; import 'core/viewModels/medical/labs_view_model.dart'; +import 'core/viewModels/medical/medical_view_model.dart'; import 'core/viewModels/medical/my_doctor_view_model.dart'; import 'core/viewModels/medical/prescriptions_view_model.dart'; import 'core/viewModels/medical/radiology_view_model.dart'; @@ -34,7 +36,7 @@ void setupLocator() { locator.registerLazySingleton(() => FeedbackService()); locator.registerLazySingleton(() => InsuranceCardService()); locator.registerLazySingleton(() => VitalSignService()); - + locator.registerLazySingleton(() => MedicalService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -46,4 +48,5 @@ void setupLocator() { locator.registerFactory(() => FeedbackViewModel()); locator.registerFactory(() => VitalSignViewModel()); locator.registerFactory(() => InsuranceViewModel()); + locator.registerFactory(() => MedicalViewModel()); } diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index 9ef7c524..9cfa41a9 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -299,7 +299,6 @@ class _InsuranceUpdateState extends State ); }), ), - //////////////// ], )) ], diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index d3c4e378..08e5ba6b 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -1,16 +1,21 @@ import 'dart:math'; +import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; +import '../../locator.dart'; import 'doctor/doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; @@ -22,202 +27,414 @@ class MedicalProfilePage extends StatefulWidget { } class _MedicalProfilePageState extends State { + @override Widget build(BuildContext context) { - return AppScaffold( - body: CustomScrollView( - physics: BouncingScrollPhysics(), - key: PageStorageKey("medical"), - slivers: [ - SliverPersistentHeader( - delegate: SliverAppBarDelegate( - maxHeight: 200.0, - minHeight: 200.0, - child: Container( - width: double.infinity, - height: 200, - color: Colors.grey, - ), - ), - ), - SliverPersistentHeader( - delegate: SliverAppBarDelegate( - maxHeight: double.maxFinite, - minHeight: double.maxFinite, - child: Padding( - padding: EdgeInsets.symmetric(vertical: 12.0), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: DoctorHomePage())); - }, - child: MedicalProfileItem( - title: 'My Doctor', - imagePath: 'doctor_icon.png', - subTitle: 'List', - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () {}, - child: MedicalProfileItem( - title: 'Lab', - imagePath: 'lab_result_icon.png', - subTitle: 'Result', + return BaseView( + onModelReady: (model) => model.getAppointmentHistory(), + builder: (_, model, widget) => AppScaffold( + baseViewModel: model, + body: SafeArea( + child: SingleChildScrollView( + child: Column( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + width: double.infinity, + color: Colors.grey, + height: 150, + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 12.0), + child: Column( + children: [ + Container( + width: double.infinity, + height: 30, ), - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push( - context, FadePage(page: RadiologyHomePage())), - child: MedicalProfileItem( - title: 'Radiology', - imagePath: 'radiology_icon.png', - subTitle: 'Service', + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: MyAppointments())); + }, + child: MedicalProfileItem( + title: 'My Appointments', + imagePath: 'my_appointment_icon.png', + subTitle: 'List', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => Navigator.push(context, + FadePage(page: RadiologyHomePage())), + child: MedicalProfileItem( + title: 'Radiology', + imagePath: 'radiology_icon.png', + subTitle: 'Service', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () {}, + child: MedicalProfileItem( + title: 'Lab', + imagePath: 'lab_result_icon.png', + subTitle: 'Result', + ), + ), + ), + ], ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: HomePrescriptionsPage())); - }, - child: MedicalProfileItem( - title: 'Medicines', - imagePath: 'prescription_icon.png', - subTitle: 'Prescriptions', + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HomePrescriptionsPage())); + }, + child: MedicalProfileItem( + title: 'Medicines', + imagePath: 'prescription_icon.png', + subTitle: 'Prescriptions', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: VitalSignDetailsScreen())), + child: MedicalProfileItem( + title: 'Vital Signs', + imagePath: 'medical_history_icon.png', + subTitle: 'Reports', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () => Navigator.push( +// context, FadePage(page: RadiologyHomePage())), + child: MedicalProfileItem( + title: 'My Medicines ', + imagePath: 'radiology_icon.png', + subTitle: 'Service', + ), + ), + ), + ], ), - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: InsuranceCard())); - }, - child: MedicalProfileItem( - title: 'Insurance', - imagePath: 'insurance_card_icon.png', - subTitle: 'Card', + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: DoctorHomePage())); + }, + child: MedicalProfileItem( + title: 'My Doctor', + imagePath: 'doctor_icon.png', + subTitle: 'List', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push(context, +// FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'Eye', + imagePath: + 'insurance_approvals_icon.png', + subTitle: 'Measurement', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push(context, + FadePage(page: InsuranceCard())); + }, + child: MedicalProfileItem( + title: 'Insurance', + imagePath: 'insurance_card_icon.png', + subTitle: 'Card', + ), + ), + ), + ], ), - ), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Update Insurance', + imagePath: 'insurance_card_icon.png', + subTitle: 'card', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'Insurance Approval', + imagePath: 'insurance_approvals_icon.png', + subTitle: '', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Allergies', + imagePath: 'medical_history_icon.png', + subTitle: 'Diagnosed', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'My Vaccines', + imagePath: 'insurance_card_icon.png', + subTitle: 'card', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'Medical', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Reports', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Monthly', + imagePath: 'medical_history_icon.png', + subTitle: 'Report', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Sick', + imagePath: 'insurance_card_icon.png', + subTitle: 'Leaves', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'My Balance', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Credit', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Patient Call', + imagePath: 'medical_history_icon.png', + subTitle: 'Service', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Smart Watches', + imagePath: 'insurance_card_icon.png', + subTitle: 'Pairing', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'My Trackers', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Service', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Ask Your', + imagePath: 'medical_history_icon.png', + subTitle: 'Doctor', + ), + ), + ]), + Row(children: [ + Expanded( + flex: 1, + child: InkWell( + //TODO +// onTap: () { +// Navigator.push( +// context, FadePage(page: DoctorHomePage())); +// }, + child: MedicalProfileItem( + title: 'Internet', + imagePath: 'insurance_card_icon.png', + subTitle: 'Pairing', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( +// onTap: () { +// Navigator.push( +// context, FadePage(page: InsuranceApproval())); +// }, + child: MedicalProfileItem( + title: 'My Trackers', + imagePath: 'insurance_approvals_icon.png', + subTitle: 'Service', + ), + ), + ), + Expanded( + flex: 1, + child: MedicalProfileItem( + title: 'Ask Your', + imagePath: 'medical_history_icon.png', + subTitle: 'Doctor', + ), + ), + ]), + ], ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: InsuranceApproval())); - }, - child: MedicalProfileItem( - title: 'Insurance Approval', - imagePath: 'insurance_approvals_icon.png', - subTitle: 'Card', - ), - ), - ) - ], - ), - Row(children: [ - Expanded( - flex: 1, - child: MedicalProfileItem( - title: 'Medical', - imagePath: 'medical_history_icon.png', - subTitle: 'Reports', + ) + ], + ), + if (model.user != null) + Positioned( + top: 110, + left: 20, + right: 20, + child: Container( + width: double.infinity, + height: 70, + decoration: BoxDecoration( + color: Colors.grey[600], + shape: BoxShape.rectangle, + border: Border.all( + color: Colors.transparent, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: VitalSignDetailsScreen())), - child: MedicalProfileItem( - title: 'Vital Signs', - imagePath: 'medical_history_icon.png', - subTitle: 'Reports', - ), - ), - ), - ]), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: InsuranceUpdate())); - }, - child: MedicalProfileItem( - title: 'Insurance Update', - imagePath: 'insurance_card_icon.png', - subTitle: 'Card', + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 8, ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () {}, - child: MedicalProfileItem( - title: 'new', - imagePath: 'insurance_card_icon.png', - subTitle: 'Card', + Texts( + model.user.firstName + + " " + + model.user.lastName, + color: Colors.white, ), - ), - ) - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: MyAppointments())); - }, - child: MedicalProfileItem( - title: 'My Appointments', - imagePath: 'my_appointment_icon.png', - subTitle: 'List', + SizedBox( + height: 8, ), - ), - ), - Expanded( - flex: 1, - child: Container(), + Texts( + '${model.user.patientID}', + color: Colors.white, + ), + ], ), - ], - ), - ], - ), + ), + ) + ], ), - ), + ], ), - ]), + ), + ), + ), ); } } diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 86a30f79..3ea323df 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -47,6 +47,13 @@ class AppSharedPreferences { return prefs.getString(key); } + /// Get String [key] the key was saved + getStringWithDefaultValue(String key, String defaultVal) async { + final SharedPreferences prefs = await _prefs; + String value = prefs.getString(key); + return value == null ? defaultVal : value; + } + /// Get List of String [key] the key was saved getStringList(String key) async { final SharedPreferences prefs = await _prefs; diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index 6357d830..e2baa1e4 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -26,7 +26,7 @@ class MedicalProfileItem extends StatelessWidget { Text( title, style: TextStyle( - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier, color: Hexcolor('#B8382C'), fontWeight: FontWeight.bold), ), From 5619b8c06fd8b31275c920af4781a4d4a2885b0b Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 18 Aug 2020 16:59:15 +0300 Subject: [PATCH 7/7] fix issues in feedback --- lib/core/service/client/base_app_client.dart | 3 +-- lib/core/service/feedback/feedback_service.dart | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 3811fc8a..53f91de7 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -24,8 +24,7 @@ class BaseAppClient { try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); body['SetupID'] = body.containsKey('SetupID') ? body['SetupID']!=null? body['SetupID'] :SETUP_ID :SETUP_ID; body['VersionID'] = body.containsKey('VersionID') ? body['VersionID']!=null? body['VersionID'] :VERSION_ID :VERSION_ID; diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index 39065f48..575e4110 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/model/feedback/request_insert_coc_item.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; @@ -19,6 +20,7 @@ class FeedbackService extends BaseService { String attachment, AppointmentHistory appointHistory}) async { hasError = false; + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); _requestInsertCOCItem.attachment = attachment; _requestInsertCOCItem.title = title; @@ -31,7 +33,7 @@ class FeedbackService extends BaseService { _requestInsertCOCItem.patientName = user.firstName + " " + user.lastName; _requestInsertCOCItem.fileName = ""; _requestInsertCOCItem.appVersion = VERSION_ID; - _requestInsertCOCItem.uILanguage = "ar"; //TODO Change it to be dynamic + _requestInsertCOCItem.uILanguage = languageID; //TODO Change it to be dynamic _requestInsertCOCItem.browserInfo = Platform.localHostname; _requestInsertCOCItem.deviceInfo = Platform.localHostname; _requestInsertCOCItem.resolution = "400x847";