From 5606c88715b80e432d3892a45a5ec71a5791c7c6 Mon Sep 17 00:00:00 2001 From: Haroon Amjad Date: Mon, 14 Dec 2020 18:13:38 +0300 Subject: [PATCH] hot fixes --- lib/config/localized_values.dart | 4 + lib/core/service/medical/reports_service.dart | 13 +- .../insurance/insurance_card_screen.dart | 3 +- .../insurance/insurance_update_screen.dart | 198 ++++++++++-------- .../medical/reports/report_home_page.dart | 39 +++- .../medical/reports/report_list_widget.dart | 55 +++-- lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/buttons/secondary_button.dart | 2 +- 8 files changed, 192 insertions(+), 123 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 059b03ab..98bb0e74 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1162,4 +1162,8 @@ const Map localizedValues = { "en": "Please rate the clinic", "ar": "يرجى تقييم العيادة" }, + "fetch-data": { + "en": "Fetch Data", + "ar": "تحديث الان" + }, }; diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index 7acb92ea..b2f90e61 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -100,8 +100,6 @@ class ReportsService extends BaseService { String requestDate, String invoiceNo, int projectID, - String printID, - String procedureID, String stamp, String setupID) async { Map body = new Map(); @@ -114,19 +112,24 @@ class ReportsService extends BaseService { body['DateofBirth'] = user.dateofBirth; body['PatientIditificationNum'] = user.patientIdentificationNo; body['PatientMobileNumber'] = user.mobileNumber; - body['PatientName'] = user.firstName + " " + user.firstName; + body['PatientName'] = user.firstName + " " + user.lastName; body['ProjectName'] = projectName; body['ClinicName'] = clinicName; body['ProjectID'] = projectID; body['InvoiceNo'] = invoiceNo; - body['PrintedByName'] = user.firstName + " " + user.firstName; + body['PrintedByName'] = user.firstName + " " + user.lastName; + + dynamic response; hasError = false; await baseAppClient.post(SEND_MEDICAL_REPORT_EMAIL, - onSuccess: (dynamic response, int statusCode) {}, + onSuccess: (dynamic res, int statusCode) { + response = res; + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); + return response; } } diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 42357eea..71c09635 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -167,7 +167,8 @@ class _InsuranceCardState extends State { onTap: () => { getDetails(model.insurance[index]) }, - label: TranslationBase.of(context).seeDetails, + label: TranslationBase.of(context) + .seeDetails, textColor: Colors.white, ), width: double.infinity, diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index a7e7c32b..8be58af4 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -1,5 +1,10 @@ +import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import '../base/base_view.dart'; @@ -15,6 +20,7 @@ class InsuranceUpdate extends StatefulWidget { class _InsuranceUpdateState extends State with SingleTickerProviderStateMixin { TabController _tabController; + InsuranceCardService _insuranceCardService = locator(); @override void initState() { @@ -103,94 +109,109 @@ class _InsuranceUpdateState extends State itemCount: model.getAllSharedRecordsByStatusResponse .getAllSharedRecordsByStatusList.length, itemBuilder: (BuildContext context, int index) { - return Container( - margin: EdgeInsets.all(10.0), - child: Card( - margin: - EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only( - top: 2.0, - left: 10.0, - right: 20.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index] - .patientName, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, + return model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index] + .status == + 3 + ? Container( + margin: EdgeInsets.all(10.0), + child: Card( + margin: EdgeInsets.fromLTRB( + 8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(10), + ), + child: Container( + width: + MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 2.0, + left: 10.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts( + model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index] + .patientName, + fontSize: 14, + color: Colors.black, + fontWeight: + FontWeight.w500, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of( + context) + .fileno + + ": " + + model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList[ + index] + .patientID + .toString(), + fontSize: 14, + color: Colors.black, + fontWeight: + FontWeight.w500, + ) + ], + ), ), - SizedBox( - height: 8, + ), + if (false) + Expanded( + flex: 2, + child: Container( + margin: + EdgeInsets.only(top: 2.0), + child: Column( + children: [ + Container( + child: SecondaryButton( + label: TranslationBase + .of(context) + .fetchData, + small: true, + textColor: + Colors.white, + onTap: () { + getDetails( + model); + }, + ), + ), + ], + ), ), - Texts( - TranslationBase.of(context) - .fileno + - ": " + - model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index] - .patientID - .toString(), - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ) - ], - ), + ) + ], ), ), - if (false) - Expanded( - flex: 2, - child: Container( - // height: MediaQuery.of(context).size.height * 0.12, - margin: EdgeInsets.only(top: 2.0), - child: Column( - children: [ - Container( - child: SecondaryButton( - label: TranslationBase.of( - context) - .updateInsurance, - small: true, - textColor: Colors.white, - // color: Colors.grey, - ), - //height: 45, - // width:90 - ), - ], - ), - ), - ) - ], - ), - ), - ), - ); + ), + ) + : Container(); }) : Container(), ), @@ -309,4 +330,13 @@ class _InsuranceUpdateState extends State ), ); } + + getDetails(data) { + GifLoaderDialogUtils.showMyDialog(context); + _insuranceCardService.getInsuranceDetails(data).then((value) => { + GifLoaderDialogUtils.hideDialog(context), + Navigator.push(context, + FadePage(page: InsuranceCardDetails(data: value[0]['CheckList']))) + }); + } } diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 636d4e00..b99fb40f 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -37,9 +37,21 @@ class _HomeReportPageState extends State @override Widget build(BuildContext context) { - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); return BaseView( onModelReady: (model) => model.getReports(), //model.getPrescriptions(), builder: (_, model, widget) => AppScaffold( @@ -93,7 +105,8 @@ class _HomeReportPageState extends State Container( width: MediaQuery.of(context).size.width * 0.22, child: Center( - child: Texts(TranslationBase.of(context).requested), + child: + Texts(TranslationBase.of(context).requested), ), ), Container( @@ -105,13 +118,15 @@ class _HomeReportPageState extends State Container( width: MediaQuery.of(context).size.width * 0.22, child: Center( - child: Texts(TranslationBase.of(context).completed), + child: + Texts(TranslationBase.of(context).completed), ), ), Container( width: MediaQuery.of(context).size.width * 0.22, child: Center( - child: Texts(TranslationBase.of(context).cancelled), + child: + Texts(TranslationBase.of(context).cancelled), ), ), ], @@ -130,21 +145,23 @@ class _HomeReportPageState extends State controller: _tabController, children: [ ReportListWidget( - reportList: model.reportsOrderRequestList, + reportList: model.reportsOrderRequestList ), ReportListWidget( - reportList: model.reportsOrderReadyList, + reportList: model.reportsOrderReadyList ), ReportListWidget( - reportList: model.reportsOrderCompletedList, + reportList: model.reportsOrderCompletedList ), ReportListWidget( - reportList: model.reportsOrderCanceledList, + reportList: model.reportsOrderCanceledList ), ], ), ), - SizedBox(height: 110,) + SizedBox( + height: 110, + ) ], ), bottomSheet: Container( diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 4002b1ba..b838fd92 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; import 'package:diplomaticquarterapp/core/service/medical/reports_service.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -10,8 +13,9 @@ import 'package:flutter/material.dart'; class ReportListWidget extends StatelessWidget { final List reportList; + final Function onEmailTap; - ReportListWidget({@required this.reportList}); + ReportListWidget({@required this.reportList, this.onEmailTap}); @override Widget build(BuildContext context) { @@ -48,17 +52,6 @@ class ReportListWidget extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - reportList[index].status == 2 - ? Container( - child: InkWell( - onTap: sendReportEmail(), - child: Icon( - Icons.email, - color: Colors.red, - ), - ), - ) - : Container(), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -72,6 +65,21 @@ class ReportListWidget extends StatelessWidget { SizedBox(height: 12), ], ), + reportList[index].status == 2 + ? Container( + margin: EdgeInsets.only(left: 15.0, right: 15.0), + child: InkWell( + onTap: () { + sendReportEmail(reportList[index]); + }, + child: Icon( + Icons.email, + color: Theme.of(context).primaryColor, + size: 35.0, + ), + ), + ) + : Container(), ], ), ), @@ -86,21 +94,26 @@ class ReportListWidget extends StatelessWidget { } sendReportEmail(Reports report) { + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); ReportsService _reportsService = locator(); - _reportsService .sendEmailForMedicalReport( report.projectName, report.clinicDescription, report.doctorName, DateUtil.convertDateToString(report.requestDate), - report.invoiceNo.toString(), - report.projectID, - report.printID, - procedureID, - stamp, - setupID) - .then((value) {}) - .catchError(() {}); + report.invoiceNo.toString(), + report.projectID, + DateUtil.convertDateToString(report.requestDate), + report.setupId) + .then((value) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + print(value["IsSent"]); + AppToast.showSuccessToast( + message: TranslationBase.of(AppGlobal.context).emailSentSuccessfully); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + print(err); + }); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index fece63a2..9836fadf 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1018,6 +1018,7 @@ class TranslationBase { String get lastAppointment => localizedValues['last-appointment'][locale.languageCode]; String get rateClinic => localizedValues['rate-clinic'][locale.languageCode]; + String get fetchData => localizedValues['fetch-data'][locale.languageCode]; } diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 71a88554..ccb436fe 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -236,7 +236,7 @@ class _SecondaryButtonState extends State widget.label, style: TextStyle( color: widget.textColor, - fontSize: 17.0, + fontSize: widget.small ? 12.0 : 17.0, fontWeight: FontWeight.w800, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), ),