From 85d68b038867dfca37f3e1a29482dd58ec3ab8c8 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 5 Oct 2021 15:42:27 +0300 Subject: [PATCH 1/7] ereferral fixes --- lib/core/service/vaccine_service.dart | 3 - .../new_e_referral_step_one_page.dart | 123 ++++-------- .../new_e_referral_step_three_page.dart | 188 ++++++------------ .../E-Referral/search_for_referrals_page.dart | 42 ++-- 4 files changed, 121 insertions(+), 235 deletions(-) diff --git a/lib/core/service/vaccine_service.dart b/lib/core/service/vaccine_service.dart index f4ff7176..238ae3e5 100644 --- a/lib/core/service/vaccine_service.dart +++ b/lib/core/service/vaccine_service.dart @@ -16,9 +16,6 @@ class VaccineService extends BaseService { body['To'] = "0"; body['From'] = "0"; - // body['PatientID'] = 1018977; - // body['TokenID'] = "@dm!n"; - hasError = false; _vaccineList.clear(); await baseAppClient.post(GET_VACCINES, diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index 3510dde0..d653cdc3 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -10,13 +10,12 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; @@ -28,13 +27,10 @@ class NewEReferralStepOnePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepOnePage( - {Key key, this.createEReferralRequestModel, this.changePageViewIndex}) - : super(key: key); + const NewEReferralStepOnePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); @override - _NewEReferralStepOnePageState createState() => - _NewEReferralStepOnePageState(); + _NewEReferralStepOnePageState createState() => _NewEReferralStepOnePageState(); } class _NewEReferralStepOnePageState extends State { @@ -49,14 +45,7 @@ class _NewEReferralStepOnePageState extends State { // todo create a model for Country // todo use country from the json - dynamic _selectedCountry = { - "name": "Saudi Arabia", - "name_ar": "المملكة العربية السعودية", - "code": "966", - "countryCode": "SA", - "pattern": "5xxxxxxxx", - "maxLength": 9 - }; + dynamic _selectedCountry = {"name": "Saudi Arabia", "name_ar": "المملكة العربية السعودية", "code": "966", "countryCode": "SA", "pattern": "5xxxxxxxx", "maxLength": 9}; AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; @@ -120,16 +109,14 @@ class _NewEReferralStepOnePageState extends State { ), Center( child: Texts( - TranslationBase.of(context) - .referralRequesterInformation, + TranslationBase.of(context).referralRequesterInformation, ), ), SizedBox( height: 12, ), NewTextFields( - hintText: TranslationBase.of(context) - .enterReferralRequesterName, + hintText: TranslationBase.of(context).enterReferralRequesterName, controller: _nameTextController, ), SizedBox( @@ -141,15 +128,10 @@ class _NewEReferralStepOnePageState extends State { padding: EdgeInsets.all(12), width: double.infinity, height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getCountryName()), - Icon(Icons.arrow_drop_down) - ], + children: [Texts(getCountryName()), Icon(Icons.arrow_drop_down)], ), ), ), @@ -158,9 +140,7 @@ class _NewEReferralStepOnePageState extends State { ), MobileNumberTextFiled( controller: _mobileTextController, - code: _selectedCountry == null - ? "11" - : _selectedCountry["code"], + code: _selectedCountry == null ? "11" : _selectedCountry["code"], ), SizedBox( height: 12, @@ -175,21 +155,15 @@ class _NewEReferralStepOnePageState extends State { height: 12, ), InkWell( - onTap: () => confirmSelectRelationTypeDialog( - model.relationTypes), + onTap: () => confirmSelectRelationTypeDialog(model.relationTypes), child: Container( padding: EdgeInsets.all(12), width: double.infinity, height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getRelationName()), - Icon(Icons.arrow_drop_down) - ], + children: [Texts(getRelationName()), Icon(Icons.arrow_drop_down)], ), ), ), @@ -204,22 +178,19 @@ class _NewEReferralStepOnePageState extends State { padding: EdgeInsets.all(9), child: DefaultButton( TranslationBase.of(context).next, - (_nameTextController.text.isEmpty || - _selectedRelation == null || - _mobileTextController.text.isEmpty) + (_nameTextController.text.isEmpty || _selectedRelation == null || _mobileTextController.text.isEmpty) ? null : () async { - SendActivationCodeForEReferralRequestModel - sendActivationCodeForEReferralRequestModel = - SendActivationCodeForEReferralRequestModel( - zipCode: _selectedCountry['code'], - patientMobileNumber: - int.parse(_mobileTextController.text), - ); - await model.sendActivationCodeForEReferral( - sendActivationCodeForEReferralRequestModel); - - showSMSDialog(model); + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel = SendActivationCodeForEReferralRequestModel( + zipCode: _selectedCountry['code'], + patientMobileNumber: int.parse(_mobileTextController.text), + ); + await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + GifLoaderDialogUtils.hideDialog(context); + showSMSDialog(model); + }); }, disabledColor: Colors.grey, ), @@ -228,30 +199,24 @@ class _NewEReferralStepOnePageState extends State { void submit(EReferralViewModel model, code) async { final activationCode = code; - // ToDo call service - CheckActivationCodeForEReferralResponseModel - checkActivationCodeForEReferralRequestModel = - new CheckActivationCodeForEReferralResponseModel( - activationCode: activationCode); - await model.checkActivationCodeForEReferral( - checkActivationCodeForEReferralRequestModel); - if (model.state == ViewState.ErrorLocal) { - // Utils.showErrorToast(model.error); - } else { - Navigator.of(context).pop(); - widget.changePageViewIndex(1); - widget.createEReferralRequestModel.requesterName = - _nameTextController.text; - widget.createEReferralRequestModel.requesterContactNo = - _selectedCountry['code'].toString().substring(1) + - _mobileTextController.text; - widget.createEReferralRequestModel.requesterRelationship = - _selectedRelation.iD; - } + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel = new CheckActivationCodeForEReferralResponseModel(activationCode: activationCode); + await model.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); + if (model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + } else { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pop(); + widget.changePageViewIndex(1); + widget.createEReferralRequestModel.requesterName = _nameTextController.text; + widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString().substring(1) + _mobileTextController.text; + widget.createEReferralRequestModel.requesterRelationship = _selectedRelation.iD; + } + }); } - void confirmSelectRelationTypeDialog( - List relations) { + void confirmSelectRelationTypeDialog(List relations) { showDialog( context: context, child: SelectRelationTypeDialog( @@ -302,9 +267,7 @@ class _NewEReferralStepOnePageState extends State { } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled( - {Key key, this.controller, this.code, this.onChange}) - : super(key: key); + const MobileNumberTextFiled({Key key, this.controller, this.code, this.onChange}) : super(key: key); final TextEditingController controller; final String code; @@ -314,8 +277,7 @@ class MobileNumberTextFiled extends StatelessWidget { Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(15), color: Colors.white), child: Row(textDirection: TextDirection.ltr, children: [ Expanded( flex: 1, @@ -337,8 +299,7 @@ class MobileNumberTextFiled extends StatelessWidget { controller: controller, onChanged: onChange, keyboardType: TextInputType.phone, - decoration: InputDecoration( - border: InputBorder.none, hintText: '5xxxxxxxx'), + decoration: InputDecoration(border: InputBorder.none, hintText: '5xxxxxxxx'), ), ), ) diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart index 0b248291..7a1a954b 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -11,12 +11,12 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -29,13 +29,10 @@ class NewEReferralStepThreePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepThreePage( - {Key key, this.createEReferralRequestModel, this.changePageViewIndex}) - : super(key: key); + const NewEReferralStepThreePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); @override - _NewEReferralStepThreePageState createState() => - _NewEReferralStepThreePageState(); + _NewEReferralStepThreePageState createState() => _NewEReferralStepThreePageState(); } class _NewEReferralStepThreePageState extends State { @@ -104,8 +101,7 @@ class _NewEReferralStepThreePageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.symmetric( - horizontal: 9), + padding: const EdgeInsets.symmetric(horizontal: 9), child: Texts( TranslationBase.of(context).medicalReport, color: Colors.grey, @@ -120,21 +116,14 @@ class _NewEReferralStepThreePageState extends State { context, (String image, File file) { setState(() { - EReferralAttachment - eReferralAttachment = - new EReferralAttachment( - fileName: - 'image ${medicalReportImages.length + 1}.png', - base64String: image); - medicalReportImages - .add(eReferralAttachment); + EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${medicalReportImages.length + 1}.png', base64String: image); + medicalReportImages.add(eReferralAttachment); }); }, ); }, child: Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), + margin: EdgeInsets.only(left: 10, right: 10, top: 15), height: 50, decoration: BoxDecoration( border: Border.all(color: Colors.grey), @@ -144,10 +133,8 @@ class _NewEReferralStepThreePageState extends State { ), child: Center( child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.attach_file), Texts( @@ -169,30 +156,24 @@ class _NewEReferralStepThreePageState extends State { margin: EdgeInsets.all(10), padding: EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - FontAwesomeIcons.paperclip), + Icon(FontAwesomeIcons.paperclip), SizedBox( width: 8, ), Texts( - medicalReportImages[index] - .fileName, + medicalReportImages[index].fileName, ), ], ), InkWell( onTap: () { setState(() { - medicalReportImages.remove( - medicalReportImages[ - index]); + medicalReportImages.remove(medicalReportImages[index]); }); }, child: Icon( @@ -210,27 +191,22 @@ class _NewEReferralStepThreePageState extends State { ), Container( padding: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( children: [ Container( width: double.infinity, decoration: containerRadius(Colors.white, 12), margin: EdgeInsets.only(left: 20, right: 20), - padding: EdgeInsets.only( - left: 10, right: 10, top: 12, bottom: 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), child: Row( children: [ Flexible( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context) - .preferredBranch, + TranslationBase.of(context).preferredBranch, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -239,38 +215,24 @@ class _NewEReferralStepThreePageState extends State { ), Container( height: 18, - child: - DropdownButtonHideUnderline( + child: DropdownButtonHideUnderline( child: DropdownButton( key: projectDropdownKey, - hint: Text(TranslationBase.of( - context) - .selectPreferredBranch), + hint: Text(TranslationBase.of(context).selectPreferredBranch), value: projectDropdownValue, iconSize: 0, isExpanded: true, - style: TextStyle( - fontSize: 14, - letterSpacing: -0.56, - color: Colors.black), - items: - projectsList.map((item) { - return new DropdownMenuItem< - String>( - value: item.mainProjectID - .toString() + - "," + - item.name.toString(), - child: - new Text(item.name), + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.mainProjectID.toString() + "," + item.name.toString(), + child: new Text(item.name), ); }).toList(), onChanged: (newValue) { setState(() { - projectDropdownValue = - newValue; - print( - projectDropdownValue); + projectDropdownValue = newValue; + print(projectDropdownValue); }); }, ), @@ -289,9 +251,7 @@ class _NewEReferralStepThreePageState extends State { height: 12, ), Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( children: [ Row( @@ -337,25 +297,16 @@ class _NewEReferralStepThreePageState extends State { children: [ InkWell( onTap: () { - ImageOptions.showImageOptions(context, - (String image, File file) { + ImageOptions.showImageOptions(context, (String image, File file) { setState(() { - EReferralAttachment - eReferralAttachment = - new EReferralAttachment( - fileName: - 'image ${medicalReportImages.length + 1}.png', - base64String: image); + EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${medicalReportImages.length + 1}.png', base64String: image); - insuredPatientImages = [ - eReferralAttachment - ]; + insuredPatientImages = [eReferralAttachment]; }); }); }, child: Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), + margin: EdgeInsets.only(left: 10, right: 10, top: 15), height: 50, decoration: BoxDecoration( border: Border.all(color: Colors.grey), @@ -365,10 +316,8 @@ class _NewEReferralStepThreePageState extends State { ), child: Center( child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.attach_file), Texts( @@ -390,15 +339,12 @@ class _NewEReferralStepThreePageState extends State { margin: EdgeInsets.all(10), padding: EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon(FontAwesomeIcons - .paperclip), + Icon(FontAwesomeIcons.paperclip), SizedBox( width: 8, ), @@ -410,9 +356,7 @@ class _NewEReferralStepThreePageState extends State { InkWell( onTap: () { setState(() { - insuredPatientImages.remove( - insuredPatientImages[ - index]); + insuredPatientImages.remove(insuredPatientImages[index]); }); }, child: Icon( @@ -444,44 +388,24 @@ class _NewEReferralStepThreePageState extends State { medicalReportImages.length == 0 ? null : () async { - this - .widget - .createEReferralRequestModel - .medicalReportAttachment = medicalReportImages; - this - .widget - .createEReferralRequestModel - .insuranceCardAttachment = - insuredPatientImages.length != 0 - ? insuredPatientImages[0] - : null; - this - .widget - .createEReferralRequestModel - .isInsuredPatient = isPatientInsured; - // ToDo make the preferred Branch info dynamic - this - .widget - .createEReferralRequestModel - .preferredBranchCode = - num.tryParse(projectDropdownValue.split(",")[0]); - this - .widget - .createEReferralRequestModel - .preferredBranchName = - projectDropdownValue.split(",")[1]; - this - .widget - .createEReferralRequestModel - .otherRelationship = ""; - await model.createEReferral( - this.widget.createEReferralRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast( - message: "Referral sent successfully"); - } + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + this.widget.createEReferralRequestModel.medicalReportAttachment = medicalReportImages; + this.widget.createEReferralRequestModel.insuranceCardAttachment = insuredPatientImages.length != 0 ? insuredPatientImages[0] : null; + this.widget.createEReferralRequestModel.isInsuredPatient = isPatientInsured; + // ToDo make the preferred Branch info dynamic + this.widget.createEReferralRequestModel.preferredBranchCode = num.tryParse(projectDropdownValue.split(",")[0]); + this.widget.createEReferralRequestModel.preferredBranchName = projectDropdownValue.split(",")[1]; + this.widget.createEReferralRequestModel.otherRelationship = ""; + await model.createEReferral(this.widget.createEReferralRequestModel); + if (model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Utils.showErrorToast(model.error); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: "Referral sent successfully"); + } + }); }, disabledColor: Colors.grey, color: Color(0xff359846), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart index 9eefc39e..12a716d2 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -57,25 +57,29 @@ class _SearchForReferralsPageState extends State { return BaseView( onModelReady: (model) async { if (projectViewModel.isLogin) { - SearchEReferralRequestModel searchEReferralRequestModel = - new SearchEReferralRequestModel( - patientMobileNumber: (projectViewModel.user.outSA == 0 - ? "966" - : "971") + - projectViewModel.user.mobileNumber - .substring(1, projectViewModel.user.mobileNumber.length), - ); - if (selectedCriteria.value == 1) { - searchEReferralRequestModel.identificationNo = - _searchTextController.text; - searchEReferralRequestModel.referralNumber = 0; - } else { - searchEReferralRequestModel.referralNumber = - int.parse(_searchTextController.text); - searchEReferralRequestModel.identificationNo = - projectViewModel.user.patientIdentificationNo; - } - await model.getEReferrals(searchEReferralRequestModel); + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + SearchEReferralRequestModel searchEReferralRequestModel = + new SearchEReferralRequestModel( + patientMobileNumber: (projectViewModel.user.outSA == 0 + ? "966" + : "971") + + projectViewModel.user.mobileNumber + .substring(1, projectViewModel.user.mobileNumber.length), + ); + if (selectedCriteria.value == 1) { + searchEReferralRequestModel.identificationNo = + _searchTextController.text; + searchEReferralRequestModel.referralNumber = 0; + } else { + searchEReferralRequestModel.referralNumber = + int.parse(_searchTextController.text); + searchEReferralRequestModel.identificationNo = + projectViewModel.user.patientIdentificationNo; + } + await model.getEReferrals(searchEReferralRequestModel); + GifLoaderDialogUtils.hideDialog(context); + }); } }, builder: (_, model, widget) => AppScaffold( From 22c6a8ce42f732f91907f7cbfa424e72c5fcee46 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 5 Oct 2021 15:43:01 +0300 Subject: [PATCH 2/7] no message --- lib/config/config.dart | 4 +- .../home_health_care_service.dart | 2 + .../home_health_care_view_model.dart | 5 +- .../new_Home_health_care_step_one_page.dart | 16 +- .../new_Home_health_care_step_three_page.dart | 23 +- .../new_home_health_care_page.dart | 251 +++++++++++++----- .../rapid-response-team/rrt-place-order.dart | 2 + 7 files changed, 209 insertions(+), 94 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 7840b97d..d7ffabcd 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index fdf51326..5c0b13f4 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -20,6 +20,7 @@ class HomeHealthCareService extends BaseService { dynamic hhcResponse; bool isOrderUpdated; CustomerInfo customerInfo; + int requestNo; Future getHHCAllServices(HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; await baseAppClient.post(HHC_GET_ALL_SERVICES, onSuccess: (dynamic response, int statusCode) { @@ -77,6 +78,7 @@ class HomeHealthCareService extends BaseService { hasError = false; await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { hhcResponse = response; + requestNo = response['RequestNo']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index 0957ceb1..47e6815e 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -32,6 +32,7 @@ class HomeHealthCareViewModel extends BaseViewModel { bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated; + int get orderId => _homeHealthCareService.requestNo; GetHHCAllPresOrdersResponseModel pendingOrder; List patientERHHCInsertServicesList = List(); @@ -112,8 +113,8 @@ class HomeHealthCareViewModel extends BaseViewModel { // await _customerAddressesService.getCustomerInfo(); setState(ViewState.ErrorLocal); } else { - await _pharmacyModuleService.createUser(); - // await _customerAddressesService.getCustomerInfo(); + // await _pharmacyModuleService.createUser(); + await _customerAddressesService.getCustomerInfo(); await getCustomerAddresses(); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 4e4342f4..b429ca4a 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -107,15 +107,15 @@ class _NewHomeHealthCareStepOnePageState extends State { - widget.model.setState(ViewState.Idle), - Navigator.push( - context, - FadePage( - page: HomeHealthCarePage(), - ), - ) - }); + widget.model.insertPresPresOrder(order: widget.patientERInsertPresOrderRequestModel).then((value) { + widget.model.setState(ViewState.Idle); + if (widget.model.orderId != null) { + showCMCConfirmDialog( + context, + widget.model.orderId.toString(), + onClick: () { + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: HomeHealthCarePage)); + }, + ); + } + }); }, color: CustomColors.green, ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index 4b06d220..d6e9b353 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -72,8 +72,9 @@ class _NewHomeHealthCarePageState extends State with Tick child: ConfirmCancelOrderDialog( model: model, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); model.setState(ViewState.Busy); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); + await model.updateHHCPresOrder(updatePresOrderRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); @@ -107,61 +108,59 @@ class _NewHomeHealthCarePageState extends State with Tick scrollDirection: Axis.horizontal, children: [ widget.model.pendingOrder != null - ? FractionallySizedBox( - widthFactor: 0.9, - child: SingleChildScrollView( - child: Container( - // margin: EdgeInsets.all(10), - child: Container( - width: double.infinity, - padding: EdgeInsets.only(left: 12, right: 12, top: 12), - child: Card( - shape: cardRadius(12), - elevation: 2, - margin: EdgeInsets.zero, - color: Color(0xffcd9e1b), - clipBehavior: Clip.antiAlias, - child: Container( - // decoration: containerColorRadiusLeft(Colors.white, 12), - margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), - padding: EdgeInsets.all(12), - // color: Colors.white, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - ), - ), - // clipBehavior: Clip.antiAlias, - child: Row( + ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ + (Container( + decoration: BoxDecoration( + color: Color(0xffCC9B14), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + // decoration: containerColorRadiusLeft(Colors.white, 12), + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, + Text( + (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).OrderStatus + - ' ' + - (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), - bold: false, - fontSize: 12, - color: Color(0xffcd9e1b), - fontWeight: FontWeight.bold, - ), - Texts( - TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), - fontWeight: FontWeight.w600, - fontSize: 18, - ), - Texts( - TranslationBase.of(context).serviceName, - fontSize: 12, - fontWeight: FontWeight.w600, + Text( + TranslationBase.of(context).serviceName + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), ...List.generate( widget.model.hhcAllOrderDetail.length, @@ -172,29 +171,135 @@ class _NewHomeHealthCarePageState extends State with Tick bold: false, ), ), - ), + ) ], - )), - Column( - children: [ - Texts( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), - fontSize: 14, + ) + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (widget.model.pendingOrder.status == 1 || widget.model.pendingOrder.status == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), ), - mHeight(8), - // SecondaryButton( - // onTap: () { - // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - // }, - // label: TranslationBase.of(context).cancel, - // color: Colors.red[900], - // small: true, - // ) - ], + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), ), - ], - ))), - )))) + ], + ), + ], + ), + ), + )) + ]) + + // FractionallySizedBox( + // widthFactor: 0.9, + // child: SingleChildScrollView( + // child: Container( + // // margin: EdgeInsets.all(10), + // child: Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 12, right: 12, top: 12), + // child: Card( + // shape: cardRadius(12), + // elevation: 2, + // margin: EdgeInsets.zero, + // color: Color(0xffcd9e1b), + // clipBehavior: Clip.antiAlias, + // child: Container( + // // decoration: containerColorRadiusLeft(Colors.white, 12), + // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), + // padding: EdgeInsets.all(12), + // // color: Colors.white, + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // color: Colors.white, + // borderRadius: BorderRadius.only( + // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // ), + // ), + // // clipBehavior: Clip.antiAlias, + // child: Row( + // children: [ + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).OrderStatus + + // ' ' + + // (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + // bold: false, + // fontSize: 12, + // color: Color(0xffcd9e1b), + // fontWeight: FontWeight.bold, + // ), + // Texts( + // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + // fontWeight: FontWeight.w600, + // fontSize: 18, + // ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // fontWeight: FontWeight.w600, + // ), + // ...List.generate( + // widget.model.hhcAllOrderDetail.length, + // (index) => Container( + // child: Texts( + // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), + // fontSize: 13, + // bold: false, + // ), + // ), + // ), + // ], + // )), + // Column( + // children: [ + // Texts( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + // fontSize: 14, + // ), + // mHeight(8), + // // SecondaryButton( + // // onTap: () { + // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + // // }, + // // label: TranslationBase.of(context).cancel, + // // color: Colors.red[900], + // // small: true, + // // ) + // ], + // ), + // ], + // ))), + // )))) : NewHomeHealthCareStepOnePage( changePageViewIndex: _changeCurrentTab, patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, diff --git a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart index ec44de1e..8087c5fe 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart @@ -14,6 +14,8 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; class RRTPlaceOrderPage extends StatelessWidget { TranslationBase localize; From 89e1aa70c0ef0de65d7715f0ed7182e63ce82a06 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 5 Oct 2021 18:50:43 +0300 Subject: [PATCH 3/7] updates --- lib/config/localized_values.dart | 3 +- lib/pages/BookAppointment/BookConfirm.dart | 2 +- .../Covid-DriveThru/Covid-TimeSlots.dart | 2 +- lib/pages/ErService/ErOptions.dart | 3 +- lib/pages/MyAppointments/SchedulePage.dart | 12 +- .../prescription_details_page.dart | 26 -- .../rate_appointment_doctor.dart | 354 ++++++++---------- lib/uitl/translations_delegate_base.dart | 2 + 8 files changed, 171 insertions(+), 233 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d1355ada..179d9fe8 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1516,7 +1516,7 @@ const Map localizedValues = { "RRTRequestSuccess": { "en": "Request has been sent successfully, You will be contacted soon.", "ar": "تم إرسال الطلب بنجاح ، وسيتم الاتصال بك باسرع وقت ممكن" }, "rateDoctorAppo": { "en": "Rate DR & Appointment", "ar": "معدل الدكتور والتعيين" }, "invoice": { "en": "Invoice", "ar": "الفاتورة" }, - "requestedDate": { "en": "Reqeusted Date", "ar": "التاريخ " }, + "requestedDate": { "en": "Requested Date", "ar": "التاريخ " }, "callDuration": { "en": "Call Duration", "ar": "مدة الاتصال" }, "alreadyRated": { "en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً" }, "insuranceCompany": { "en": "Insurance Company", "ar": "شركة تأمين" }, @@ -1526,4 +1526,5 @@ const Map localizedValues = { "otherInfo": {"en": "Other details", "ar": "تفاصيل أخرى"}, "medicalReport": {"en": "Medical Report", "ar": "تقرير طبي"}, "insuredPatient": {"en": "Insured Patient", "ar": "هل لدى المريض تامين؟"}, + "rateDoctor": {"en": "Rate Doctor", "ar": "تقييم الطبيب"}, }; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 43eed6ed..fe49fd52 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -307,7 +307,7 @@ class _BookConfirmState extends State { AppoitmentAllHistoryResultList appo; widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, context).then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); Future.delayed(new Duration(milliseconds: 500), () { diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index d3accfe1..5cdfd9d9 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -451,7 +451,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, CovidTimeSlots.selectedTime, CovidTimeSlots.selectedDate, context, widget.selectedProcedure.procedureID) .then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); getToDoCount(); getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); } else { diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index 0a5f6ae4..1fbda90c 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -75,13 +75,14 @@ class _ErOptionsState extends State { ), InkWell( onTap: () { - Navigator.push(context, FadePage(page: DdServicesPage())); + // Navigator.push(context, FadePage(page: DdServicesPage())); }, child: MedicalProfileItem( title: "ED", imagePath: 'assets/images/new-design/AM.PNG', subTitle: TranslationBase.of(context).service, isPngImage: true, + isEnable: false, ), ), InkWell( diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index a452b787..3dea8b50 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -162,13 +162,19 @@ class _SchedulePageState extends State { weeks[index][index2]['WorkingHours'], fontWeight: FontWeight.w500, ), - ) + ), + Icon(projectViewModel.isArabic + ? Icons + .arrow_back_ios_outlined + : Icons + .arrow_forward_ios_outlined, size: 16.0), ], ) ]))), - ) + ), ], - )))); + ) + ))); }, )), PageViewIndicator( diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index cf5afd77..9289ed75 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -179,33 +179,7 @@ class PrescriptionDetailsPage extends StatelessWidget { AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); }, ); - return; - 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: PrescriptionReminderDialog( - eventId: prescriptionReport.itemID.toString(), - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - startDate: startDate, - endDate: endDate, - location: prescriptionReport.remarks, - days: 1, - ), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); }, iconData: Icons.notifications_active, color: Color(0xffEAEAEA), diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index 7197b070..e7c9ef6e 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -1,20 +1,16 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_clinic.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; class RateAppointmentDoctor extends StatefulWidget { @override @@ -30,214 +26,172 @@ class _RateAppointmentDoctorState extends State { Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, baseViewModel: model, - body: Scaffold( - backgroundColor: Colors.grey[200], - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text(TranslationBase.of(context).rate), - leading: Builder( - builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.menu), - color: Colors.white, - onPressed: () => Scaffold.of(context).openDrawer(), - ); - }, - ), - centerTitle: true, - ), - drawer: SafeArea(child: AppDrawer()), - body: FractionallySizedBox( - widthFactor: 1, - child: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(12), - child: Column( - children: [ - SizedBox( - height: 25, //5598 - ), - Texts( - TranslationBase.of(context).lastVisit, - bold: true, - color: Colors.black, - ), - SizedBox( - height: 25, - ), - Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - ), + appBarTitle: TranslationBase.of(context).rateDoctor, + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 25, //5598 + ), + Text( + TranslationBase.of(context).lastVisit, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox( + height: 25, + ), + Container( + child: DoctorView( + doctor: getDoctorObject(model), + isLiveCareAppointment: false, + isShowFlag: false, + ), + ), + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + child: Card( + elevation: 0, + shape: cardRadius(10), + child: Padding( + padding: const EdgeInsets.all(12.0), child: Column( - children: [ - SizedBox( - height: 8, - ), - LargeAvatar( - name: model.appointmentDetails.doctorName, - url: model.appointmentDetails.doctorImageURL, - width: 110, - height: 110, - ), - SizedBox( - height: 22, - ), - Texts( - TranslationBase.of(context).dr + " " + model.appointmentDetails.doctorName, - bold: true, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).tapTitle, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), SizedBox( - height: 4, + height: 12, ), - Texts( - model.appointmentDetails.clinicName != null ? model.appointmentDetails.clinicName : "", - bold: true, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...List.generate( + 5, + (index) => AnimatedSwitcher( + duration: Duration(milliseconds: 1000), + switchInCurve: Curves.elasticOut, + switchOutCurve: Curves.elasticIn, + transitionBuilder: (Widget child, Animation animation) { + return ScaleTransition(child: child, scale: animation); + }, + child: Container( + key: ValueKey(rating), + child: IconButton( + iconSize: 45.0, + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + color: rating >= (index + 1) ? Color.fromRGBO(255, 186, 0, 1.0) : Colors.grey[400], + // Theme.of(context).hintColor, + icon: Icon(rating >= (index + 1) ? Icons.star : Icons.star)), + ), + ), + ) + ], ), - SizedBox( - height: 8, - ) ], ), ), - SizedBox( - height: 12, - ), - Center( - child: Texts( - TranslationBase.of(context).tapTitle, - textAlign: TextAlign.center, - )), - SizedBox( - height: 12, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ...List.generate( - 5, - (index) => AnimatedSwitcher( - duration: Duration(milliseconds: 1000), - switchInCurve: Curves.elasticOut, - switchOutCurve: Curves.elasticIn, - transitionBuilder: - (Widget child, Animation animation) { - return ScaleTransition( - child: child, scale: animation); - }, - child: Container( - key: ValueKey(rating), - child: IconButton( - iconSize: 45.0, - onPressed: () { - setState(() { - rating = index + 1; - }); - }, - color: rating >= (index + 1) - ? Color.fromRGBO(255, 186, 0, 1.0) - : Colors.grey[400], - // Theme.of(context).hintColor, - icon: Icon(rating >= (index + 1) - ? EvaIcons.star - : EvaIcons.star)), - ), - ), - ) - ], - ), - SizedBox( - height: 12, - ), - Form( - key: formKey, - child: TextFields( - hintText: TranslationBase.of(context).notes, - minLines: 4, - maxLines: 4, - // validator: (value) { - // if (value.isEmpty) - // return 'Please enter your note'; - // else if (rating == 0) return 'Rating cannot be \"0\"'; - // return null; - // }, - onChanged: (value) { - setState(() { - note = value; - }); - }, + ), + ), + SizedBox( + height: 12, + ), + Card( + elevation: 0, + shape: cardRadius(10), + child: Padding( + padding: EdgeInsets.all(8.0), + child: TextField( + maxLines: 5, + decoration: InputDecoration.collapsed( + hintText: TranslationBase.of(context).notes, + hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16)), + onChanged: (value) { + setState(() { + note = value; + }); + }, + ))), + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).later, + () { + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), ), - ), - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () async { - final form = formKey.currentState; - if (form.validate() && rating>0 ) { - form.save(); - Navigator.push( - context, - FadePage( - page: RateAppointmentClinic( - appointmentDetails: - model.appointmentDetails, - doctorNote: note, - doctorRate: rating, - ), - ), - ); - } - }, - label: TranslationBase.of(context).next, - disabled: (model.state == ViewState.BusyLocal || rating==0), - loading: model.state == ViewState.BusyLocal, - textColor: Theme.of(context).backgroundColor), - ), - SizedBox( - height: 12, + ); + }, + color: Color(0xffEAEAEA), + textColor: Color(0xff2B353E), + ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).next, + () { + final form = formKey.currentState; + if (form.validate() && rating > 0) { + form.save(); + Navigator.push( + context, + FadePage( + page: RateAppointmentClinic( + appointmentDetails: model.appointmentDetails, + doctorNote: note, + doctorRate: rating, ), - InkWell( - onTap: () { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ); - }, - child: Texts( - TranslationBase.of(context).later, - decoration: TextDecoration.underline, - color: HexColor('#151DFE'), - fontSize: 18, - ), - ) - ], - ), - ) - ], + ), + ); + } + }, + // iconData: Icons.notifications_active, + color: Color(0xff359846), ), ), - ), + ], ), ), ), ); } + + DoctorList getDoctorObject(AppointmentRateViewModel model) { + DoctorList doctor = new DoctorList(); + + doctor.name = model.appointmentDetails.doctorName; + doctor.doctorImageURL = model.appointmentDetails.doctorImageURL; + doctor.clinicName = model.appointmentDetails.clinicName; + doctor.projectName = model.appointmentDetails.projectName; + doctor.actualDoctorRate = 5; + + return doctor; + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 92aeacf2..0fceca4a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2322,6 +2322,8 @@ class TranslationBase { String get insuredPatientReferral => localizedValues["insuredPatient"][locale.languageCode]; + String get rateDoctor => localizedValues["rateDoctor"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { From 19edcc210e32b3c64a0b0ba3c53dc456b8349607 Mon Sep 17 00:00:00 2001 From: Haroon Amjad Date: Tue, 5 Oct 2021 23:46:01 +0300 Subject: [PATCH 4/7] Rate appointment UI implemented --- assets/images/new/appointment-rating/1.svg | 3 + assets/images/new/appointment-rating/2.svg | 3 + assets/images/new/appointment-rating/3.svg | 3 + assets/images/new/appointment-rating/4.svg | 3 + assets/images/new/appointment-rating/5.svg | 3 + lib/config/localized_values.dart | 1 + .../rate_appointment_clinic.dart | 397 +++++++++++------- .../rate_appointment_doctor.dart | 67 ++- lib/uitl/translations_delegate_base.dart | 2 + 9 files changed, 297 insertions(+), 185 deletions(-) create mode 100644 assets/images/new/appointment-rating/1.svg create mode 100644 assets/images/new/appointment-rating/2.svg create mode 100644 assets/images/new/appointment-rating/3.svg create mode 100644 assets/images/new/appointment-rating/4.svg create mode 100644 assets/images/new/appointment-rating/5.svg diff --git a/assets/images/new/appointment-rating/1.svg b/assets/images/new/appointment-rating/1.svg new file mode 100644 index 00000000..8c732769 --- /dev/null +++ b/assets/images/new/appointment-rating/1.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/appointment-rating/2.svg b/assets/images/new/appointment-rating/2.svg new file mode 100644 index 00000000..60ae2909 --- /dev/null +++ b/assets/images/new/appointment-rating/2.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/appointment-rating/3.svg b/assets/images/new/appointment-rating/3.svg new file mode 100644 index 00000000..324918df --- /dev/null +++ b/assets/images/new/appointment-rating/3.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/appointment-rating/4.svg b/assets/images/new/appointment-rating/4.svg new file mode 100644 index 00000000..a983815e --- /dev/null +++ b/assets/images/new/appointment-rating/4.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/appointment-rating/5.svg b/assets/images/new/appointment-rating/5.svg new file mode 100644 index 00000000..4600b411 --- /dev/null +++ b/assets/images/new/appointment-rating/5.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 179d9fe8..c80c87ac 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1527,4 +1527,5 @@ const Map localizedValues = { "medicalReport": {"en": "Medical Report", "ar": "تقرير طبي"}, "insuredPatient": {"en": "Insured Patient", "ar": "هل لدى المريض تامين؟"}, "rateDoctor": {"en": "Rate Doctor", "ar": "تقييم الطبيب"}, + "rateAppointment": {"en": "Rate Appointment", "ar": "سعر التعيين"}, }; diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index 15c040ab..c6ab88ab 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -1,27 +1,35 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class RateAppointmentClinic extends StatefulWidget { final AppointmentDetails appointmentDetails; final String doctorNote; final int doctorRate; - RateAppointmentClinic({this.appointmentDetails, this.doctorRate, this.doctorNote}); + RateAppointmentClinic( + {this.appointmentDetails, this.doctorRate, this.doctorNote}); @override _RateAppointmentClinicState createState() => _RateAppointmentClinicState(); @@ -34,164 +42,253 @@ class _RateAppointmentClinicState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, baseViewModel: model, - body: Scaffold( - backgroundColor: Colors.grey[200], - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text('Rate'), - leading: Builder( - builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.menu), - color: Colors.white, - onPressed: () => Scaffold.of(context).openDrawer(), - ); - }, - ), - centerTitle: true, - ), - drawer: SafeArea(child: AppDrawer()), - body: FractionallySizedBox( - widthFactor: 1, - child: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(12), - child: Column( - children: [ - SizedBox( - height: 25, - ), - Texts( - TranslationBase.of(context).lastAppointment, - bold: true, - color: Colors.black, - ), - SizedBox( - height: 25, + appBarTitle: TranslationBase.of(context).rateAppointment, + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 25, + ), + Text( + TranslationBase.of(context).lastAppointment, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16), + ), + SizedBox( + height: 25, + ), + Card( + elevation: 0, + shape: cardRadius(10), + child: Padding( + padding: const EdgeInsets.only( + left: 12, right: 12, top: 12, bottom: 12), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + model.appointmentDetails.projectName, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, + height: 25 / 16), + ), + Text( + model.appointmentDetails.startTime, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, + height: 25 / 16), + ), + ], + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + url: + 'https://hmgwebservices.com/Images/Hospitals/' + + model.appointmentDetails.projectID + .toString() + + '.jpg', + width: 48, + height: 48, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + myRichText( + TranslationBase.of(context).clinic + ":", + model.appointmentDetails.projectName, + projectViewModel.isArabic), + myRichText( + TranslationBase.of(context).date + ":", + DateUtil.getMonthDayYearDateFormatted( + DateUtil.convertStringToDate(model + .appointmentDetails + .appointmentDate)), + projectViewModel.isArabic), + ], + ), + ), + ], + ), + ], ), - Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - ), + ), + ), + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + child: Card( + elevation: 0, + shape: cardRadius(10), + child: Padding( + padding: const EdgeInsets.all(12.0), child: Column( - children: [ - SizedBox( - height: 8, - ), - LargeAvatar( - url: 'https://hmgwebservices.com/Images/Hospitals/' + model.appointmentDetails.projectID.toString() + '.jpg', - name: model.appointmentDetails.clinicName, - width: 110, - height: 110, - ), - SizedBox( - height: 22, - ), - Texts( - model.appointmentDetails.projectName, - fontSize: 22, - fontWeight: FontWeight.bold, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).rateClinic, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16), ), SizedBox( - height: 4, + height: 12, ), - Texts( - DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(model.appointmentDetails.appointmentDate)), - ), - SizedBox( - height: 8, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...List.generate( + 5, + (index) => AnimatedSwitcher( + duration: Duration(milliseconds: 300), + switchInCurve: Curves.elasticOut, + switchOutCurve: Curves.elasticIn, + transitionBuilder: (Widget child, + Animation animation) { + return ScaleTransition( + child: child, scale: animation); + }, + child: rating == (index + 1) + ? Container( + margin: EdgeInsets.only( + left: 3.0, right: 3.0), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(100), + border: Border.all( + width: 3, + color: CustomColors.green)), + key: ValueKey(rating), + child: IconButton( + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + iconSize: 35, + icon: SvgPicture.asset( + 'assets/images/new/appointment-rating/' + + (index + 1).toString() + + '.svg'), + ), + ) + : Container( + key: ValueKey(rating), + child: IconButton( + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + iconSize: 35, + icon: SvgPicture.asset( + 'assets/images/new/appointment-rating/' + + (index + 1).toString() + + '.svg'), + ), + ), + ), + ) + ], ), - Texts(model.appointmentDetails.startTime), - SizedBox( - height: 8, - ) ], ), ), - SizedBox( - height: 12, - ), - Center( - child: Texts( - TranslationBase.of(context).rateClinic, - textAlign: TextAlign.center, - )), - SizedBox( - height: 12, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ...List.generate( - 5, - (index) => AnimatedSwitcher( - duration: Duration(milliseconds: 1000), - switchInCurve: Curves.elasticOut, - switchOutCurve: Curves.elasticIn, - transitionBuilder: (Widget child, Animation animation) { - return ScaleTransition(child: child, scale: animation); - }, - child: Container( - key: ValueKey(rating), - child: IconButton( - //iconSize: 45.0, - onPressed: () { - setState(() { - rating = index + 1; - }); - }, - iconSize: rating == (index + 1) ? 60 : 40, - // Theme.of(context).hintColor, - icon: Image.asset('assets/images/' + (index + 1).toString() + '.png')), - ), - ), - ) - ], - ), - SizedBox(height: 12), - SizedBox( - height: 12, - ), - ], + ), ), - ), + SizedBox(height: 12), + SizedBox( + height: 12, + ), + ], ), ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.15, - width: double.infinity, - color: Colors.grey[200], - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () async { - if (rating > 0) { + ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).later, + () { + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), + ), + ); + }, + color: Color(0xffEAEAEA), + textColor: Color(0xff2B353E), + ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).submit, + rating <= 0 + ? null + : () { model .sendAppointmentRate( - rating, widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note) + rating, + widget.appointmentDetails.appointmentNo, + widget.appointmentDetails.projectID, + widget.appointmentDetails.doctorID, + widget.appointmentDetails.clinicID, + note) .then( (value) => { model .sendDoctorRate( widget.doctorRate, - widget.appointmentDetails.appointmentNo, + widget + .appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note, - widget.appointmentDetails.appointmentDate, + widget.appointmentDetails + .appointmentDate, widget.appointmentDetails.doctorName, widget.appointmentDetails.projectName, widget.appointmentDetails.clinicName) @@ -205,36 +302,12 @@ class _RateAppointmentClinicState extends State { }), }, ); - } else { - AppToast.showErrorToast(message: 'please rate the clinic'); - } - }, - label: TranslationBase.of(context).submit, - disabled: (model.state == ViewState.Busy || rating == 0), - // loading: model.state == ViewState.BusyLocal, - textColor: Theme.of(context).backgroundColor), + }, + color: Color(0xff359846), + disabledColor: Colors.grey, ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ); - }, - child: Texts( - TranslationBase.of(context).later, - decoration: TextDecoration.underline, - color: HexColor('#151DFE'), - fontSize: 18, - ), - ) - ], - ), + ), + ], ), ), ), diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index e7c9ef6e..241412e9 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.da import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_clinic.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; @@ -42,7 +43,12 @@ class _RateAppointmentDoctorState extends State { ), Text( TranslationBase.of(context).lastVisit, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16), ), SizedBox( height: 25, @@ -69,7 +75,12 @@ class _RateAppointmentDoctorState extends State { children: [ Text( TranslationBase.of(context).tapTitle, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16), ), SizedBox( height: 12, @@ -83,8 +94,10 @@ class _RateAppointmentDoctorState extends State { duration: Duration(milliseconds: 1000), switchInCurve: Curves.elasticOut, switchOutCurve: Curves.elasticIn, - transitionBuilder: (Widget child, Animation animation) { - return ScaleTransition(child: child, scale: animation); + transitionBuilder: (Widget child, + Animation animation) { + return ScaleTransition( + child: child, scale: animation); }, child: Container( key: ValueKey(rating), @@ -95,9 +108,13 @@ class _RateAppointmentDoctorState extends State { rating = index + 1; }); }, - color: rating >= (index + 1) ? Color.fromRGBO(255, 186, 0, 1.0) : Colors.grey[400], + color: rating >= (index + 1) + ? Color.fromRGBO(255, 186, 0, 1.0) + : Colors.grey[400], // Theme.of(context).hintColor, - icon: Icon(rating >= (index + 1) ? Icons.star : Icons.star)), + icon: Icon(rating >= (index + 1) + ? Icons.star + : Icons.star)), ), ), ) @@ -120,7 +137,12 @@ class _RateAppointmentDoctorState extends State { maxLines: 5, decoration: InputDecoration.collapsed( hintText: TranslationBase.of(context).notes, - hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16)), + hintStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16)), onChanged: (value) { setState(() { note = value; @@ -156,24 +178,23 @@ class _RateAppointmentDoctorState extends State { Expanded( child: DefaultButton( TranslationBase.of(context).next, - () { - final form = formKey.currentState; - if (form.validate() && rating > 0) { - form.save(); - Navigator.push( - context, - FadePage( - page: RateAppointmentClinic( - appointmentDetails: model.appointmentDetails, - doctorNote: note, - doctorRate: rating, - ), - ), - ); - } - }, + rating <= 0 + ? null + : () { + Navigator.push( + context, + FadePage( + page: RateAppointmentClinic( + appointmentDetails: model.appointmentDetails, + doctorNote: note, + doctorRate: rating, + ), + ), + ); + }, // iconData: Icons.notifications_active, color: Color(0xff359846), + disabledColor: Colors.grey, ), ), ], diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0fceca4a..8b3c72cf 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2324,6 +2324,8 @@ class TranslationBase { String get rateDoctor => localizedValues["rateDoctor"][locale.languageCode]; + String get rateAppointment => localizedValues["rateAppointment"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { From 5410b826c32b8fc58f7558ddece6f1f3122b8024 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 6 Oct 2021 10:43:36 +0300 Subject: [PATCH 5/7] prescriptions new ui updated. --- .../medical/prescriptions_view_model.dart | 5 + .../prescriptions_home_page.dart | 18 ++- .../prescriptions/prescriptions_page.dart | 128 ++++++++---------- lib/widgets/Loader/gif_loader_container.dart | 25 ++-- 4 files changed, 86 insertions(+), 90 deletions(-) diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 568d2ed8..2f86e5a1 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -31,6 +31,11 @@ class PrescriptionsViewModel extends BaseViewModel { List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList; List get prescriptionsOrderList => filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital; + + List prescriptionsOrderListByValue(filterValue) { + return filterValue == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital; + } + get isMedDeliveryAllowed => _prescriptionsService.isMedDeliveryAllowed; getPrescriptions() async { setState(ViewState.Busy); diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 6fdba0e4..26c8dc22 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -26,7 +27,7 @@ class _HomePrescriptionsPageState extends State with Sing @override void initState() { super.initState(); - _tabController = TabController(length: 2, vsync: this); + _tabController = TabController(length: 3, vsync: this); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/0.png')); imagesInfo.add(ImagesInfo( @@ -74,7 +75,8 @@ class _HomePrescriptionsPageState extends State with Sing letterSpacing: -0.48, ), tabs: [ - Text(TranslationBase.of(context).prescriptions, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + Text(TranslationBase.of(context).byClinic, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + Text(TranslationBase.of(context).byHospital, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), Text(TranslationBase.of(context).orderLog, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), ], ), @@ -84,9 +86,19 @@ class _HomePrescriptionsPageState extends State with Sing controller: _tabController, children: [ PrescriptionsPage( + FilterType.Clinic, prescriptionsViewModel: model, showOrderLog: () async { - _tabController.animateTo(1); + _tabController.animateTo(2); + await model.getPrescriptionsOrders(showLoading: true); + setState(() {}); + }, + ), + PrescriptionsPage( + FilterType.Hospital, + prescriptionsViewModel: model, + showOrderLog: () async { + _tabController.animateTo(2); await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index 3fabcd8b..4d9eb463 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -16,86 +16,66 @@ import 'package:provider/provider.dart'; class PrescriptionsPage extends StatelessWidget { final VoidCallback showOrderLog; + final FilterType filterType; final PrescriptionsViewModel prescriptionsViewModel; - const PrescriptionsPage({Key key, this.prescriptionsViewModel, this.showOrderLog}) : super(key: key); + const PrescriptionsPage(this.filterType, {Key key, this.prescriptionsViewModel, this.showOrderLog}) : super(key: key); @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - baseViewModel: prescriptionsViewModel, - body: FractionallySizedBox( - widthFactor: 1.0, - child: ListView( + baseViewModel: prescriptionsViewModel, + body: ListView.separated( physics: BouncingScrollPhysics(), - children: [ - Row( - children: [ - MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, prescriptionsViewModel.filterType, () { - prescriptionsViewModel.setFilterType(FilterType.Clinic); - }), - MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, prescriptionsViewModel.filterType, () { - prescriptionsViewModel.setFilterType(FilterType.Hospital); - }), - ], - ), - ListView.separated( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.only(top: 12), - separatorBuilder: (context, index) { - return Container( - height: 12, - margin: EdgeInsets.only(left: 21, right: 21), - // color: Color(0xffD9D9D9), - ); - }, - itemBuilder: (context, index) { - List prescriptionsList = prescriptionsViewModel.prescriptionsOrderList[index].prescriptionsList; - return AppExpandableNotifier( - title: prescriptionsViewModel.prescriptionsOrderList[index].filterName, - bodyWidget: ListView.separated( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), - itemBuilder: (context, _index) { - Prescriptions prescriptions = prescriptionsList[_index]; - return DoctorCard( - onTap: () async { - final _shouldRecallApi = await Navigator.push( - context, - FadePage( - page: PrescriptionItemsPage( - prescriptions: prescriptions, - ), - ), - ); - if (_shouldRecallApi != null) { - showOrderLog(); - } - }, - name: prescriptions.doctorName, - profileUrl: prescriptions.doctorImageURL, - rating: prescriptions.actualDoctorRate.toDouble(), - subName: prescriptions.name, - isInOutPatient: prescriptions.isInOutPatient, - isLiveCareAppointment: prescriptions.isLiveCareAppointment, - // appointmentTime: DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions - // .appointmentDate)), - date: DateUtil.convertStringToDate(prescriptions - .appointmentDate) //projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), - ); - }, - separatorBuilder: (context, index) => SizedBox(height: 14), - itemCount: prescriptionsList.length), - ); - }, - itemCount: prescriptionsViewModel.prescriptionsOrderList.length, - ) - ], - ), - ), - ); + padding: EdgeInsets.only(top: 12), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + List prescriptionsList = prescriptionsViewModel.prescriptionsOrderListByValue(filterType)[index].prescriptionsList; + return AppExpandableNotifier( + title: prescriptionsViewModel.prescriptionsOrderListByValue(filterType)[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + Prescriptions prescriptions = prescriptionsList[_index]; + return DoctorCard( + onTap: () async { + final _shouldRecallApi = await Navigator.push( + context, + FadePage( + page: PrescriptionItemsPage( + prescriptions: prescriptions, + ), + ), + ); + if (_shouldRecallApi != null) { + showOrderLog(); + } + }, + name: prescriptions.doctorName, + profileUrl: prescriptions.doctorImageURL, + rating: prescriptions.actualDoctorRate.toDouble(), + subName: prescriptions.name, + isInOutPatient: prescriptions.isInOutPatient, + isLiveCareAppointment: prescriptions.isLiveCareAppointment, + // appointmentTime: DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions + // .appointmentDate)), + date: DateUtil.convertStringToDate(prescriptions + .appointmentDate) //projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: prescriptionsList.length), + ); + }, + itemCount: prescriptionsViewModel.prescriptionsOrderListByValue(filterType).length, + )); } } diff --git a/lib/widgets/Loader/gif_loader_container.dart b/lib/widgets/Loader/gif_loader_container.dart index b7a20339..75083d1a 100644 --- a/lib/widgets/Loader/gif_loader_container.dart +++ b/lib/widgets/Loader/gif_loader_container.dart @@ -6,8 +6,7 @@ class GifLoaderContainer extends StatefulWidget { _GifLoaderContainerState createState() => _GifLoaderContainerState(); } -class _GifLoaderContainerState extends State - with TickerProviderStateMixin { +class _GifLoaderContainerState extends State with TickerProviderStateMixin { GifController controller1; @override @@ -15,8 +14,9 @@ class _GifLoaderContainerState extends State controller1 = GifController(vsync: this); WidgetsBinding.instance.addPostFrameCallback((_) { - controller1.repeat( - min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); + try { + controller1.repeat(min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); + } catch (ex) {} }); super.initState(); } @@ -30,14 +30,13 @@ class _GifLoaderContainerState extends State @override Widget build(BuildContext context) { return Center( - //progress-loading.gif + //progress-loading.gif child: Container( - // margin: EdgeInsets.only(bottom: 40), - child: GifImage( - controller: controller1, - image: AssetImage( - "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), - ), - )); + // margin: EdgeInsets.only(bottom: 40), + child: GifImage( + controller: controller1, + image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + ), + )); } -} \ No newline at end of file +} From df31c82fd5ecd30924232289833cc6ea8131af94 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 6 Oct 2021 12:18:11 +0300 Subject: [PATCH 6/7] doctor header review on tap improvement. --- lib/models/header_model.dart | 5 +- lib/pages/BookAppointment/BookConfirm.dart | 1 + lib/pages/BookAppointment/BookSuccess.dart | 1 + lib/pages/BookAppointment/DoctorProfile.dart | 1 + .../BookAppointment/book_reminder_page.dart | 5 +- .../MyAppointments/AppointmentDetails.dart | 20 +- lib/pages/medical/eye/EyeHomePage.dart | 10 +- .../my_invoices/invoice_detail_page.dart | 156 +++--------- .../prescription_details_page.dart | 1 + .../prescription_items_page.dart | 1 + .../radiology/radiology_details_page.dart | 1 + .../LabResult/laboratory_result_widget.dart | 1 + lib/widgets/new_design/doctor_header.dart | 235 +++++++++++++++++- 13 files changed, 294 insertions(+), 144 deletions(-) diff --git a/lib/models/header_model.dart b/lib/models/header_model.dart index f80091f3..b1da8b17 100644 --- a/lib/models/header_model.dart +++ b/lib/models/header_model.dart @@ -1,5 +1,6 @@ class HeaderModel { String doctorName; + int doctorId; String doctorImageURL; List speciality; String invoiceNo; @@ -12,6 +13,6 @@ class HeaderModel { int totalReviews; String email; - HeaderModel(this.doctorName, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.date, this.time, this.nationalityFlagURL, this.doctorRate, this.actualDoctorRate, - this.totalReviews, this.email); + HeaderModel(this.doctorName, this.doctorId, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.date, this.time, this.nationalityFlagURL, this.doctorRate, + this.actualDoctorRate, this.totalReviews, this.email); } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index fe49fd52..4a47dee1 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -74,6 +74,7 @@ class _BookConfirmState extends State { DoctorHeader( headerModel: HeaderModel( widget.doctor.name, + widget.doctor.doctorID, widget.doctor.doctorImageURL, widget.doctor.speciality, "", diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index d9499eeb..2c278f5e 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -60,6 +60,7 @@ class _BookSuccessState extends State { DoctorHeader( headerModel: HeaderModel( widget.docObject.name, + widget.docObject.doctorID, widget.docObject.doctorImageURL, widget.docObject.speciality, "", diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 6d3a3afa..5e35d06a 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -103,6 +103,7 @@ class _DoctorProfileState extends State with TickerProviderStateM DoctorHeader( headerModel: HeaderModel( widget.doctor.name, + widget.doctor.doctorID, widget.doctor.doctorImageURL, widget.doctor.speciality, "", diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart index fcdd8fd4..8066e369 100644 --- a/lib/pages/BookAppointment/book_reminder_page.dart +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -70,6 +70,7 @@ class _BookReminderPageState extends State { DoctorHeader( headerModel: HeaderModel( widget.docObject.name, + widget.docObject.doctorID, widget.docObject.doctorImageURL, widget.docObject.speciality, "", @@ -191,7 +192,7 @@ class _BookReminderPageState extends State { disabledTextColor: Colors.white, disabledColor: CustomColors.green, onPressed: () async { - print(widget.patientShareResponse.appointmentNo); + print(widget.patientShareResponse.appointmentNo); showReminderDialog( context, widget.dateTime, @@ -201,7 +202,7 @@ class _BookReminderPageState extends State { widget.appoTimeFormatted, onSuccess: () { AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - navigateToBookSuccess(context); + navigateToBookSuccess(context); }, ); }, diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 13b86071..8bcfe9ca 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -94,6 +94,7 @@ class _AppointmentDetailsState extends State with SingleTick DoctorHeader( headerModel: HeaderModel( widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, + widget.appo.doctorID, widget.appo.doctorImageURL, widget.appo.doctorSpeciality, "", @@ -107,7 +108,8 @@ class _AppointmentDetailsState extends State with SingleTick "", //model.user.emailAddress, ), - isNeedToShowButton: (widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, + isNeedToShowButton: + (widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, buttonTitle: TranslationBase.of(context).schedule, buttonIcon: 'assets/images/new/Boo_ Appointment.svg', showConfirmMessageDialog: false, @@ -357,13 +359,15 @@ class _AppointmentDetailsState extends State with SingleTick width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black))), - Container( - margin: EdgeInsets.only(top: 10.0), - child: SizedBox( - width: getRatingWidth(doctorDetailsList[0].patientNumber), - height: 6.0, - child: Container( - color: Colors.green[700], + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), ), ), ), diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 4c945f7a..3d59af3d 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -41,10 +41,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat super.initState(); _tabController = TabController(length: 2, vsync: this); _tabController.addListener(() { - - setState(() { - - }); + setState(() {}); }); } @@ -61,7 +58,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat builder: (_, model, w) => AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, + appBarTitle: widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, showNewAppBarTitle: true, showNewAppBar: true, backgroundColor: CustomColors.appBackgroudGreyColor, @@ -70,6 +67,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat DoctorHeader( headerModel: HeaderModel( widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, + widget.appointmentAllHistoryResultList.doctorID, widget.appointmentAllHistoryResultList.doctorImageURL, widget.appointmentAllHistoryResultList.doctorSpeciality, "", @@ -83,7 +81,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat "", //model.user.emailAddress, ), - isNeedToShowButton: _tabController.index==0?true:projectViewModel.havePrivilege(15), + isNeedToShowButton: _tabController.index == 0 ? true : projectViewModel.havePrivilege(15), showConfirmMessageDialog: true, onRatingAndReviewTap: getDoctorRatingsDetails, onTap: () { diff --git a/lib/pages/medical/my_invoices/invoice_detail_page.dart b/lib/pages/medical/my_invoices/invoice_detail_page.dart index 13fd8e6f..0f35a96f 100644 --- a/lib/pages/medical/my_invoices/invoice_detail_page.dart +++ b/lib/pages/medical/my_invoices/invoice_detail_page.dart @@ -27,8 +27,7 @@ class InvoiceDetail extends StatefulWidget { final DentalInvoiceDetailResponse dentalInvoiceDetailResponse; final BuildContext context; - InvoiceDetail(this.doctor, this.listDentalAppointments, - this.dentalInvoiceDetailResponse, this.context); + InvoiceDetail(this.doctor, this.listDentalAppointments, this.dentalInvoiceDetailResponse, this.context); @override _InvoiceDetailState createState() => _InvoiceDetailState(); @@ -50,11 +49,7 @@ class _InvoiceDetailState extends State { ProjectViewModel projectViewModel = Provider.of(context); generateInvoiceDetails(); return AppScaffold( - appBarTitle: widget.doctor.doctorTitle != null - ? widget.doctor.doctorTitle.toString() - : TranslationBase.of(context).dr + - " " + - widget.doctor.name.toString(), + appBarTitle: widget.doctor.doctorTitle != null ? widget.doctor.doctorTitle.toString() : TranslationBase.of(context).dr + " " + widget.doctor.name.toString(), isShowAppBar: true, isShowDecPage: false, showNewAppBar: true, @@ -67,6 +62,7 @@ class _InvoiceDetailState extends State { DoctorHeader( headerModel: HeaderModel( widget.doctor.name, + widget.doctor.doctorID, widget.doctor.doctorImageURL, widget.doctor.speciality, widget.doctor.clinicName, @@ -76,7 +72,7 @@ class _InvoiceDetailState extends State { widget.doctor.nationalityFlagURL, widget.doctor.doctorRate, widget.doctor.actualDoctorRate, - widget.doctor.noOfPatientsRate, + widget.doctor.noOfPatientsRate ?? 0, projectViewModel.user.emailAddress), onTap: () { sendInvoiceEmail(); @@ -86,8 +82,7 @@ class _InvoiceDetailState extends State { child: Card( elevation: 3.0, shape: cardRadius(12), - margin: EdgeInsets.only( - left: 16, top: 8, right: 16, bottom: 16), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -112,8 +107,7 @@ class _InvoiceDetailState extends State { child: Card( elevation: 3.0, shape: cardRadius(12), - margin: EdgeInsets.only( - left: 16, top: 8, right: 16, bottom: 16), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( @@ -121,29 +115,12 @@ class _InvoiceDetailState extends State { children: [ Container( margin: EdgeInsets.only(bottom: 10.0), - child: Text(TranslationBase.of(context).cardDetail, - style: TextStyle( - color: Colors.black, - letterSpacing: -0.64, - fontSize: 18.0, - fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).cardDetail, style: TextStyle(color: Colors.black, letterSpacing: -0.64, fontSize: 18.0, fontWeight: FontWeight.bold)), ), - myRichText( - TranslationBase.of(context).insuranceCompany + - ": ", - widget.dentalInvoiceDetailResponse - .listEInvoiceForDental[0].companyName, - projectViewModel.isArabic), + myRichText(TranslationBase.of(context).insuranceCompany + ": ", widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].companyName, projectViewModel.isArabic), myRichText( TranslationBase.of(context).insuranceID + ": ", - widget - .dentalInvoiceDetailResponse - .listEInvoiceForDental[0] - .insuranceID != - null - ? widget.dentalInvoiceDetailResponse - .listEInvoiceForDental[0].insuranceID - : "N/A", + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID != null ? widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID : "N/A", projectViewModel.isArabic), ], ), @@ -155,8 +132,7 @@ class _InvoiceDetailState extends State { child: Card( elevation: 3.0, shape: cardRadius(12), - margin: EdgeInsets.only( - left: 16, top: 8, right: 16, bottom: 16), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( @@ -164,13 +140,7 @@ class _InvoiceDetailState extends State { children: [ Container( margin: EdgeInsets.only(bottom: 10.0), - child: Text( - TranslationBase.of(context).totalBalance, - style: TextStyle( - letterSpacing: -0.64, - color: Colors.black, - fontSize: 18.0, - fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).totalBalance, style: TextStyle(letterSpacing: -0.64, color: Colors.black, fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( width: double.infinity, @@ -178,15 +148,10 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).discount), + child: _getNormalText(TranslationBase.of(context).discount), ), Expanded( - child: _getNormalText( - this.totalDiscount.toString() + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(this.totalDiscount.toString() + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -198,26 +163,13 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context) - .totalVAT - .toString() + - " (" + - widget - .dentalInvoiceDetailResponse - .listEInvoiceForDental[0] - .listConsultation[0] - .vATPercentage - .toString() + - "%): "), + child: _getNormalText(TranslationBase.of(context).totalVAT.toString() + + " (" + + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].vATPercentage.toString() + + "%): "), ), Expanded( - child: _getNormalText( - num.tryParse(this.totalVAT.toString()) - .toStringAsFixed(2) + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(num.tryParse(this.totalVAT.toString()).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -229,15 +181,10 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).total), + child: _getNormalText(TranslationBase.of(context).total), ), Expanded( - child: _getNormalText( - this.subTotal.toString() + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(this.subTotal.toString() + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -249,15 +196,10 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).paid), + child: _getNormalText(TranslationBase.of(context).paid), ), Expanded( - child: _getNormalText( - this.grandTotal.toString() + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(this.grandTotal.toString() + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -284,10 +226,8 @@ class _InvoiceDetailState extends State { List listConsultations = new List(); - widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation - .forEach((item) { - var i = listConsultations - .indexWhere((x) => x.procedureID == item.procedureID); + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.forEach((item) { + var i = listConsultations.indexWhere((x) => x.procedureID == item.procedureID); if (i <= -1) { listConsultations.add(item); } @@ -308,16 +248,10 @@ class _InvoiceDetailState extends State { GifLoaderDialogUtils.showMyDialog(widget.context); MyInvoicesService myInvoicesService = new MyInvoicesService(); - myInvoicesService - .sendDentalAppointmentInvoiceEmail( - widget.listDentalAppointments.projectID, - widget.listDentalAppointments.appointmentNo, - widget.context) - .then((res) { + myInvoicesService.sendDentalAppointmentInvoiceEmail(widget.listDentalAppointments.projectID, widget.listDentalAppointments.appointmentNo, widget.context).then((res) { GifLoaderDialogUtils.hideDialog(widget.context); if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast( - message: TranslationBase.of(widget.context).emailSentSuccessfully); + AppToast.showSuccessToast(message: TranslationBase.of(widget.context).emailSentSuccessfully); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -342,37 +276,17 @@ class _InvoiceDetailState extends State { ], ), ); - for (int i = 0; - i < - widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length; - i++) { + for (int i = 0; i < widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length; i++) { tableRow.add( TableRow(children: [ - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].procedureName}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].quantity}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].price.toString() + " " + TranslationBase.of(context).sar}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].total.toString() + " " + TranslationBase.of(context).sar}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].procedureName}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].quantity}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].price.toString() + " " + TranslationBase.of(context).sar}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].total.toString() + " " + TranslationBase.of(context).sar}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), ]), ); } diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 9289ed75..5b47d8f9 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -38,6 +38,7 @@ class PrescriptionDetailsPage extends StatelessWidget { DoctorHeader( headerModel: HeaderModel( prescriptions.doctorName, + prescriptions.doctorID, prescriptions.doctorImageURL, prescriptions.speciality, "", diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 8695a88f..1b593d07 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -49,6 +49,7 @@ class PrescriptionItemsPage extends StatelessWidget { DoctorHeader( headerModel: HeaderModel( prescriptions.doctorName, + prescriptions.doctorID, prescriptions.doctorImageURL, prescriptions.speciality, "", diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 1a61def8..e84a5063 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -40,6 +40,7 @@ class RadiologyDetailsPage extends StatelessWidget { DoctorHeader( headerModel: new HeaderModel( finalRadiology.doctorName, + finalRadiology.doctorID, finalRadiology.doctorImageURL, finalRadiology.speciality, finalRadiology.invoiceNo.toString(), diff --git a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart index 82d53327..ba88263b 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -44,6 +44,7 @@ class _LaboratoryResultWidgetState extends State { DoctorHeader( headerModel: HeaderModel( widget.patientLabOrder.doctorName, + widget.patientLabOrder.doctorID, widget.patientLabOrder.doctorImageURL, widget.patientLabOrder.speciality, widget.billNo, diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 06f392bd..df882a7c 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -1,6 +1,10 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/medical/doctor_card.dart'; @@ -27,7 +31,7 @@ class DoctorHeader extends StatelessWidget { this.isNeedToShowButton = true, this.buttonIcon, this.showConfirmMessageDialog = true, - this.onRatingAndReviewTap}) + @required this.onRatingAndReviewTap}) : super(key: key); ProjectViewModel projectViewModel; @@ -100,7 +104,11 @@ class DoctorHeader extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell( - onTap: onRatingAndReviewTap, + onTap: () { + if ((headerModel?.totalReviews ?? 0) > 0) { + getDoctorRatingsDetails(context); + } + }, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, @@ -122,10 +130,10 @@ class DoctorHeader extends StatelessWidget { style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, - color: onRatingAndReviewTap != null ? Colors.blue[600] : Color(0xff2B353E), + color: (headerModel?.totalReviews ?? 0) > 0 ? Colors.blue[600] : Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12, - decoration: onRatingAndReviewTap != null ? TextDecoration.underline : null, + decoration: (headerModel?.totalReviews ?? 0) > 0 ? TextDecoration.underline : null, ), ), ], @@ -141,7 +149,8 @@ class DoctorHeader extends StatelessWidget { }, child: Container( padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), - decoration: BoxDecoration(color: Color(0XFFD02127), borderRadius: projectViewModel.isArabic ? BorderRadius.only(topRight: Radius.circular(10)) : BorderRadius.only(topLeft: Radius.circular(10))), + decoration: BoxDecoration( + color: Color(0XFFD02127), borderRadius: projectViewModel.isArabic ? BorderRadius.only(topRight: Radius.circular(10)) : BorderRadius.only(topLeft: Radius.circular(10))), child: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -175,4 +184,220 @@ class DoctorHeader extends StatelessWidget { ), ); } + + void getDoctorRatingsDetails(context) { + GifLoaderDialogUtils.showMyDialog(context); + List doctorDetailsList = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsRatingDetails(headerModel.doctorId, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + doctorDetailsList.clear(); + res['DoctorRatingDetailsList'].forEach((v) { + doctorDetailsList.add(new DoctorRateDetails.fromJson(v)); + }); + showRatingDialog(doctorDetailsList, context); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + void showRatingDialog(List doctorDetailsList, context) { + 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: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + // height: 400.0, + width: MediaQuery.of(context).size.width * 0.8, + color: Colors.white, + child: Column( + children: [ + Container( + alignment: Alignment.center, + width: MediaQuery.of(context).size.width, + color: Theme.of(context).primaryColor, + margin: EdgeInsets.only(bottom: 5.0), + padding: EdgeInsets.all(10.0), + child: Text(TranslationBase.of(context).doctorRating, style: TextStyle(fontSize: 22.0, color: Colors.white))), + Container(margin: EdgeInsets.only(top: 0.0), child: Text(this.headerModel.actualDoctorRate.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: RatingBar.readOnly( + initialRating: this.headerModel.actualDoctorRate.toDouble(), + size: 35.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(this.headerModel.totalReviews.toString() + " " + TranslationBase.of(context).reviews, style: TextStyle(fontSize: 14.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[1].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffB7B723), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[2].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEBA727), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[3].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEB7227), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[4].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffE20C0C), + ), + ), + ), + ], + ), + ), + Container(margin: EdgeInsets.only(top: 40.0), child: Divider()), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Align( + alignment: FractionalOffset.bottomCenter, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 40.0, + child: RaisedButton( + elevation: 0.0, + color: Colors.white, + textColor: Colors.red, + hoverColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(TranslationBase.of(context).cancel, style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + } + + double getRatingWidth(int patientNumber) { + var width = (patientNumber / this.headerModel.totalReviews) * 100; + return width; + } } From 6099738a5c44ff838653764fd11ccbf875fdbbf7 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 6 Oct 2021 15:20:00 +0300 Subject: [PATCH 7/7] improvements --- lib/config/localized_values.dart | 30 +++++++----- .../BookAppointment/widgets/DoctorView.dart | 6 ++- .../widgets/reminder_dialog.dart | 12 ++--- .../prescription_details_page.dart | 26 ++++++++++ lib/uitl/translations_delegate_base.dart | 6 ++- .../data_display/medical/doctor_card.dart | 49 ++++++++++++------- 6 files changed, 90 insertions(+), 39 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c80c87ac..0bd3fad3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -61,6 +61,9 @@ const Map localizedValues = { 'neverWait': {'en': 'Never wait in queue', 'ar': 'لا تنتظر في قائمة الانتظار'}, 'reminderTitle': {'en': 'You have appointment with Dr. ', 'ar': 'لديك موعد مع د'}, 'appointmentCalendar': {'en': 'Would you like to set a reminder for this appointment in your calendar?', 'ar': 'هل ترغب في تعيين تذكير لهذا الموعد في التقويم الخاص بك؟'}, + 'appointmentReminder': {'en': 'Would you like to set a reminder for this appointment?', 'ar': 'هل ترغب في تعيين تذكير لهذا الموعد؟'}, + 'prescriptionReminder': {'en': 'Would you like to set a reminder for this prescription?', 'ar': 'هل ترغب في تعيين تذكير لهذه الوصفة؟'}, + 'please_select_from_below_options': {'en': 'Please select from below options:', 'ar': 'الرجاء التحديد من الخيارات أدناه:'}, 'appointmentSuccess': {'en': 'Appointment is successfully booked', 'ar': 'تم حجز الموعد بنجاح'}, 'docQualifications': {'en': 'Doctor Qualifications', 'ar': 'مؤهلات الطبيب'}, 'pressAgain': {'en': 'Press again to exit the app', 'ar': 'اضغط مرة أخرى للخروج من التطبيق'}, @@ -916,7 +919,8 @@ const Map localizedValues = { "iAcceptTermsConditions": {"en": "I Accept the Terms And Conditions", "ar": "أوافق على الشروط والأحكام"}, "YouCanPayByTheFollowingOptions": {"en": "You can pay by the following Options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, "RRTDDetails": { - "en": "The RRT service provides medical service for urgent and stable cases, not life-threatening situations or extremities, and the service includes providing medical care from a complete medical team at home.", + "en": + "The RRT service provides medical service for urgent and stable cases, not life-threatening situations or extremities, and the service includes providing medical care from a complete medical team at home.", "ar": "توفر خدمة فريق الاستجابة السريع RRT خدمه طبيه للحالات المستعجله والمستقره وليست الحالات المهدده للحياه او الاطراف ، وتشمل الخدمه تقديم رعايه طبيه من فريق طبي متكامل بالمنزل." }, "rrtService": {"en": "RRT Service", "ar": "خدمة RRT"}, @@ -1119,7 +1123,7 @@ const Map localizedValues = { "en": "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", "ar": "\nتعرض هذه الخدمة أقرب فرع\n من بين جميع فروع مجموعة \nالحبيب الطبية بناءً على موقعك الحالي." }, - "NearestEr": {"en": "Nearest ER", "ar":"اقرب طوارئ"}, + "NearestEr": {"en": "Nearest ER", "ar": "اقرب طوارئ"}, "infoCMC": { "en": "Through this service, you can request a set of tests that help you and your doctor to understand the current health condition and then identify potential risks.", "ar": "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" @@ -1508,18 +1512,18 @@ const Map localizedValues = { "secondTri": {"en": "Second Trimester Ends (27 weeks):", "ar": "تاريخ انتهاء الثلث الثاني 27 اسبوع: "}, "thirdTri": {"en": "Third Trimester, Estimated Due Date (40 weeks):", "ar": "تاريخ احتمال الولادة 40 اسبوع:"}, "seeDoctorsList": {"en": "See List Of Doctors", "ar": "اعرض قائمة الأطباء"}, - "covidQuestionnaire": { "en": "Please answer below questionnaire:", "ar": "الرجاء الإجابة على الاستبيان أدناه:" }, - "covidBookAppo": { "en": "Booking Appointment For: ", "ar": "موعد الحجز لـ: " }, - "emptySchedule": { "en": "Doctor has no schedule.", "ar": "لا يوجد جدول حضور مسجل للطبيب" }, - "serviceNotAvailable": { "en": "Dear, this service is not available now, please try again later", "ar": "عزيزي المراجع, هذه الخدمة غير متوفرة الان يرجى المحاوله لاحقا"}, + "covidQuestionnaire": {"en": "Please answer below questionnaire:", "ar": "الرجاء الإجابة على الاستبيان أدناه:"}, + "covidBookAppo": {"en": "Booking Appointment For: ", "ar": "موعد الحجز لـ: "}, + "emptySchedule": {"en": "Doctor has no schedule.", "ar": "لا يوجد جدول حضور مسجل للطبيب"}, + "serviceNotAvailable": {"en": "Dear, this service is not available now, please try again later", "ar": "عزيزي المراجع, هذه الخدمة غير متوفرة الان يرجى المحاوله لاحقا"}, "doctorScheduleNot": {"en": "Doctor schedule not available", "ar": "جدول الطبيب غير متوفر"}, - "RRTRequestSuccess": { "en": "Request has been sent successfully, You will be contacted soon.", "ar": "تم إرسال الطلب بنجاح ، وسيتم الاتصال بك باسرع وقت ممكن" }, - "rateDoctorAppo": { "en": "Rate DR & Appointment", "ar": "معدل الدكتور والتعيين" }, - "invoice": { "en": "Invoice", "ar": "الفاتورة" }, - "requestedDate": { "en": "Requested Date", "ar": "التاريخ " }, - "callDuration": { "en": "Call Duration", "ar": "مدة الاتصال" }, - "alreadyRated": { "en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً" }, - "insuranceCompany": { "en": "Insurance Company", "ar": "شركة تأمين" }, + "RRTRequestSuccess": {"en": "Request has been sent successfully, You will be contacted soon.", "ar": "تم إرسال الطلب بنجاح ، وسيتم الاتصال بك باسرع وقت ممكن"}, + "rateDoctorAppo": {"en": "Rate DR & Appointment", "ar": "معدل الدكتور والتعيين"}, + "invoice": {"en": "Invoice", "ar": "الفاتورة"}, + "requestedDate": {"en": "Requested Date", "ar": "التاريخ "}, + "callDuration": {"en": "Call Duration", "ar": "مدة الاتصال"}, + "alreadyRated": {"en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً"}, + "insuranceCompany": {"en": "Insurance Company", "ar": "شركة تأمين"}, "preferredBranch": {"en": "Preferred Branch", "ar": "الفرع المفضل"}, "selectPreferredBranch": {"en": "Select Preferred Branch", "ar": "اختر الفرع المفضل"}, "patientLocated": {"en": "Where the patient located", "ar": "اين موقع المريض"}, diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index f909ce53..1ae738cf 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -99,7 +99,11 @@ class DoctorView extends StatelessWidget { filledIcon: Icons.star, emptyIcon: Icons.star_border, ), - if (isShowFlag) Image.network(this.doctor.nationalityFlagURL, width: 22.0, height: 22.0) + Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + ), + // if (isShowFlag) Image.network(this.doctor.nationalityFlagURL, width: 22.0, height: 22.0) ], ), ], diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 1e580712..2eb5e062 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -115,7 +115,7 @@ class _ReminderDialogState extends State { ), mHeight(20), Text( - "When would you like to set a reminder for this appointment?", + TranslationBase.of(context).appointmentReminder, style: TextStyle( fontSize: 16, color: Color(0xff2B353E), @@ -125,7 +125,7 @@ class _ReminderDialogState extends State { ), mHeight(20), Text( - "Please select from below options:", + TranslationBase.of(context).pleaseSelectFromBelowOptions, style: TextStyle( fontSize: 12, color: Color(0xff2B353E), @@ -135,7 +135,7 @@ class _ReminderDialogState extends State { ), ListTile( contentPadding: EdgeInsets.zero, - title: const Text('Before 30 Mins'), + title: Text(TranslationBase.of(context).appoReminder30), leading: Radio( value: 0, groupValue: i, @@ -148,7 +148,7 @@ class _ReminderDialogState extends State { ), ListTile( contentPadding: EdgeInsets.zero, - title: const Text('Before 1 Hour'), + title: Text(TranslationBase.of(context).appoReminder60), leading: Radio( value: 1, groupValue: i, @@ -161,7 +161,7 @@ class _ReminderDialogState extends State { ), ListTile( contentPadding: EdgeInsets.zero, - title: const Text('Before 1 Hour and 30 Mins'), + title: Text(TranslationBase.of(context).appoReminder90), leading: Radio( value: 2, groupValue: i, @@ -174,7 +174,7 @@ class _ReminderDialogState extends State { ), ListTile( contentPadding: EdgeInsets.zero, - title: const Text('Before 2 Hours'), + title: Text(TranslationBase.of(context).appoReminder120), leading: Radio( value: 3, groupValue: i, diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 5b47d8f9..860a362e 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -181,6 +181,32 @@ class PrescriptionDetailsPage extends StatelessWidget { }, ); return; + + 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: PrescriptionReminderDialog( + eventId: prescriptionReport.itemID.toString(), + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + startDate: startDate, + endDate: endDate, + location: prescriptionReport.remarks, + days: 1, + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); }, iconData: Icons.notifications_active, color: Color(0xffEAEAEA), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 8b3c72cf..682da6a6 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -108,6 +108,11 @@ class TranslationBase { String get appointmentCalendar => localizedValues['appointmentCalendar'][locale.languageCode]; + String get appointmentReminder => localizedValues['appointmentReminder'][locale.languageCode]; + String get prescriptionReminder => localizedValues['prescriptionReminder'][locale.languageCode]; + + String get pleaseSelectFromBelowOptions => localizedValues['please_select_from_below_options'][locale.languageCode]; + String get appointmentSuccess => localizedValues['appointmentSuccess'][locale.languageCode]; String get confirm => localizedValues['confirm'][locale.languageCode]; @@ -2325,7 +2330,6 @@ class TranslationBase { String get rateDoctor => localizedValues["rateDoctor"][locale.languageCode]; String get rateAppointment => localizedValues["rateAppointment"][locale.languageCode]; - } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 8ddca1b2..a8f87e25 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -94,17 +94,19 @@ class DoctorCard extends StatelessWidget { ), ) : BoxDecoration(), - child: isShowInOutPatient ? RotatedBox( - quarterTurns: 3, - child: Text( - isLiveCareAppointment - ? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach - : !isInOutPatient - ? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach - : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, - style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), - ), - ) : Container(), + child: isShowInOutPatient + ? RotatedBox( + quarterTurns: 3, + child: Text( + isLiveCareAppointment + ? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach + : !isInOutPatient + ? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach + : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), + ), + ) + : Container(), ), Expanded( child: Padding( @@ -147,6 +149,7 @@ class DoctorCard extends StatelessWidget { ), Row( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ LargeAvatar( name: name, @@ -201,14 +204,24 @@ class DoctorCard extends StatelessWidget { ], ), ), - if (onEmailTap != null && projectViewModel.havePrivilege(17)) - InkWell( - onTap: onEmailTap, - child: Icon( - Icons.email, - color: Theme.of(context).primaryColor, - ), + SizedBox( + height: 48, + child: Align( + alignment: Alignment.bottomCenter, + child: (onEmailTap != null && projectViewModel.havePrivilege(17)) + ? InkWell( + onTap: onEmailTap, + child: Icon( + Icons.email, + color: Theme.of(context).primaryColor, + ), + ) + : Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + ), ), + ), ], ), ],