From 0181043da802816a0b7ff5b89b09ea4a9ddbadd4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 2 Dec 2020 10:28:39 +0300 Subject: [PATCH] Ereferral fixes, smartwatch health data integration --- lib/config/localized_values.dart | 4 + .../get_all_projects_response_model.dart | 76 ++++++++++ .../e_referral_service.dart | 26 +++- .../e_referral_view_model.dart | 55 +++++-- .../new_e_referral_index_page.dart | 54 ++++--- .../new_e_referral_step_one_page.dart | 78 +++++----- .../new_e_referral_step_three_page.dart | 135 +++++++++++------- .../new_e_referral_step_two_page.dart | 2 +- .../dialogs/select_project_dialog.dart | 129 +++++++++++++++++ .../E-Referral/e_referral_page.dart | 4 +- .../health_data_list.dart | 38 ++++- .../smart_watch_instructions.dart | 19 ++- .../medical/vital_sign/vital_sign_item.dart | 6 +- lib/theme/theme_value.dart | 1 + lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/bottom_options/BottomSheet.dart | 2 +- 16 files changed, 484 insertions(+), 146 deletions(-) create mode 100644 lib/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart create mode 100644 lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 29a4203e..ab0ac7bb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1132,5 +1132,9 @@ const Map localizedValues = { "en": "UPDATE THE APP", "ar": "تحديث التطبيق" }, + "ereferralSaveSuccess": { + "en": "The referral request has been submitted successfully, you will be contacted ASAP to complete the process. Referral request no is ", + "ar": " تم إرسال طلب الإحالة بنجاح ، وسيتم الاتصال بك في أسرع وقت ممكن لإكمال العملية. رقم طلب الإحالة" + }, }; diff --git a/lib/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart new file mode 100644 index 00000000..438f1630 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart @@ -0,0 +1,76 @@ +class GetAllProjectsResponseModel { + String desciption; + Null desciptionN; + int iD; + String legalName; + String legalNameN; + String name; + Null nameN; + String phoneNumber; + String setupID; + int distanceInKilometers; + bool isActive; + String latitude; + String longitude; + int mainProjectID; + Null projectOutSA; + bool usingInDoctorApp; + + GetAllProjectsResponseModel( + {this.desciption, + this.desciptionN, + this.iD, + this.legalName, + this.legalNameN, + this.name, + this.nameN, + this.phoneNumber, + this.setupID, + this.distanceInKilometers, + this.isActive, + this.latitude, + this.longitude, + this.mainProjectID, + this.projectOutSA, + this.usingInDoctorApp}); + + GetAllProjectsResponseModel.fromJson(Map json) { + desciption = json['Desciption']; + desciptionN = json['DesciptionN']; + iD = json['ID']; + legalName = json['LegalName']; + legalNameN = json['LegalNameN']; + name = json['Name']; + nameN = json['NameN']; + phoneNumber = json['PhoneNumber']; + setupID = json['SetupID']; + distanceInKilometers = json['DistanceInKilometers']; + isActive = json['IsActive']; + latitude = json['Latitude']; + longitude = json['Longitude']; + mainProjectID = json['MainProjectID']; + projectOutSA = json['ProjectOutSA']; + usingInDoctorApp = json['UsingInDoctorApp']; + } + + Map toJson() { + final Map data = new Map(); + data['Desciption'] = this.desciption; + data['DesciptionN'] = this.desciptionN; + data['ID'] = this.iD; + data['LegalName'] = this.legalName; + data['LegalNameN'] = this.legalNameN; + data['Name'] = this.name; + data['NameN'] = this.nameN; + data['PhoneNumber'] = this.phoneNumber; + data['SetupID'] = this.setupID; + data['DistanceInKilometers'] = this.distanceInKilometers; + data['IsActive'] = this.isActive; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['MainProjectID'] = this.mainProjectID; + data['ProjectOutSA'] = this.projectOutSA; + data['UsingInDoctorApp'] = this.usingInDoctorApp; + return data; + } +} diff --git a/lib/core/service/AlHabibMedicalService/e_referral_service.dart b/lib/core/service/AlHabibMedicalService/e_referral_service.dart index 6c356f5c..6e8da51b 100644 --- a/lib/core/service/AlHabibMedicalService/e_referral_service.dart +++ b/lib/core/service/AlHabibMedicalService/e_referral_service.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; @@ -14,6 +15,9 @@ class EReferralService extends BaseService { List _allCities = List(); List get allCities => _allCities; + List _allProjects = List(); + List get allProjects => _allProjects; + List _allReferral = List(); List get allReferral => _allReferral; String _activationCode; @@ -53,6 +57,20 @@ class EReferralService extends BaseService { }, body: {}); } + Future getAllProjects() async { + await baseAppClient.post(GET_PROJECT, + onSuccess: (dynamic response, int statusCode) { + _allProjects.clear(); + response['ListProject'].forEach((city) { + _allProjects + .add(GetAllProjectsResponseModel.fromJson(city)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {}); + } + Future sendActivationCodeForEReferral( SendActivationCodeForEReferralRequestModel @@ -60,6 +78,7 @@ class EReferralService extends BaseService { hasError = false; await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_E_REFERRAL, onSuccess: (dynamic response, int statusCode) { + print(response["VerificationCode"]); _activationCode = response["VerificationCode"]; _logInTokenID = response["LogInTokenID"]; @@ -86,19 +105,20 @@ class EReferralService extends BaseService { }, body: checkActivationCodeForEReferralRequestModel.toJson()); } - Future createEReferral( + Future createEReferral( CreateEReferralRequestModel createEReferralRequestModel ) async { hasError = false; + dynamic localRes; await baseAppClient.post(CREATE_E_REFERRAL/*'Services/Patients.svc/REST/CreateEReferral'*/, onSuccess: (dynamic response, int statusCode) { // TODO Waiting for fix service - var asd= ("EEEEEE"); - + localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: createEReferralRequestModel.toJson()); + return Future.value(localRes); } Future getEReferrals( diff --git a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart index 1972e08f..45adb6d3 100644 --- a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart +++ b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; @@ -18,64 +19,92 @@ class EReferralViewModel extends BaseViewModel { List get relationTypes => _eReferralService.relationTypes; + List get allCities => _eReferralService.allCities; - List get allReferral => _eReferralService.allReferral; + List get allHospitals => + _eReferralService.allProjects; + List get allReferral => + _eReferralService.allReferral; - void getRelationTypes() async { + void getRelationTypes() async { setState(ViewState.Busy); await _eReferralService.getRelationTypes(); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.Error); - } else{ + } else { setState(ViewState.Idle); } } - void getAllCities() async { + + void getAllCities() async { setState(ViewState.Busy); await _eReferralService.getAllCities(); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.Error); - } else{ + } else { setState(ViewState.Idle); } } - void sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { + void getAllProjects() async { + setState(ViewState.Busy); + await _eReferralService.getAllProjects(); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + void sendActivationCodeForEReferral( + SendActivationCodeForEReferralRequestModel + sendActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); - await _eReferralService.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + await _eReferralService.sendActivationCodeForEReferral( + sendActivationCodeForEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); - } else{ + } else { setState(ViewState.Idle); } } - checkActivationCodeForEReferral(CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel) async { + checkActivationCodeForEReferral( + CheckActivationCodeForEReferralResponseModel + checkActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); - await _eReferralService.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); + await _eReferralService.checkActivationCodeForEReferral( + checkActivationCodeForEReferralRequestModel); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); - } else{ + } else { setState(ViewState.Idle); } } - void createEReferral( + Future createEReferral( CreateEReferralRequestModel createEReferralRequestModel) async { + dynamic localRes; setState(ViewState.BusyLocal); - await _eReferralService.createEReferral(createEReferralRequestModel); + await _eReferralService + .createEReferral(createEReferralRequestModel) + .then((response) { + localRes = response; + }); if (_eReferralService.hasError) { error = _eReferralService.error; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } + return Future.value(localRes); } getEReferrals(SearchEReferralRequestModel searchEReferralRequestModel) async { diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart index fb2b94c6..2cb179b8 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart @@ -40,34 +40,32 @@ class _StartIndexForNewEReferralState extends State @override Widget build(BuildContext context) { return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.9, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - NewEReferralStepOnePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepTowPage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepThreePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - ], - ), + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.9, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + NewEReferralStepOnePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepTowPage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepThreePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + ], ), ), ), 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 62799c6d..db549626 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 @@ -6,28 +6,29 @@ import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.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/translations_delegate_base.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'; import 'package:flutter/material.dart'; - 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 { @@ -64,27 +65,25 @@ class _NewEReferralStepOnePageState extends State { context: context, barrierDismissible: false, child: EReferralConfirmSMSDialog( - phoneNumber: _selectedCountry['code']+_mobileTextController.text, - onSucces: (){ - 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; - - - } - - - ), + phoneNumber: _selectedCountry['code'] + _mobileTextController.text, + onSucces: () { + 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; + }), ).then((value) { print("dialog dismissed"); print(value); - if (value != null && value) { - - } + if (value != null && value) {} }); } + return BaseView( onModelReady: (model) => model.getRelationTypes(), builder: (_, model, widget) => AppScaffold( @@ -92,7 +91,7 @@ class _NewEReferralStepOnePageState extends State { body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.all(12), + margin: EdgeInsets.all(10), child: Center( child: FractionallySizedBox( widthFactor: 0.9, @@ -100,11 +99,10 @@ class _NewEReferralStepOnePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 20, + height: 80, ), Center( child: Texts( -// TranslationBase.of(context).advancePaymentLabel, "Referral requester information", textAlign: TextAlign.center, ), @@ -185,34 +183,30 @@ class _NewEReferralStepOnePageState extends State { ), ), bottomSheet: Container( - height: MediaQuery - .of(context) - .size - .height * 0.1, + height: MediaQuery.of(context).size.height * 0.1, width: double.infinity, padding: EdgeInsets.all(9), child: SecondaryButton( textColor: Colors.white, label: "Next", - onTap: () async { - SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel = - SendActivationCodeForEReferralRequestModel( + onTap: () async { + SendActivationCodeForEReferralRequestModel + sendActivationCodeForEReferralRequestModel = + SendActivationCodeForEReferralRequestModel( zipCode: _selectedCountry['code'], - patientMobileNumber: int.parse( - _mobileTextController.text),); - await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + patientMobileNumber: int.parse(_mobileTextController.text), + ); + await model.sendActivationCodeForEReferral( + sendActivationCodeForEReferralRequestModel); showSMSDialog(); }, loading: model.state == ViewState.BusyLocal, - disabled: - _nameTextController.text.isEmpty || + disabled: _nameTextController.text.isEmpty || _selectedRelation == null || _mobileTextController.text.isEmpty, ), ))); - - } void confirmSelectRelationTypeDialog( @@ -261,12 +255,8 @@ class _NewEReferralStepOnePageState extends State { } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled({ - Key key, - this.controller, - this.code - }) : super(key: key); - + const MobileNumberTextFiled({Key key, this.controller, this.code}) + : super(key: key); final TextEditingController controller; final String code; 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 d84b9d61..cb9f03df 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 @@ -1,21 +1,23 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import '../dialogs/select_city_dialog.dart'; - class NewEReferralStepThreePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; @@ -32,7 +34,8 @@ class NewEReferralStepThreePage extends StatefulWidget { class _NewEReferralStepThreePageState extends State { TextEditingController _nameTextController = TextEditingController(); TextEditingController _mobileTextController = TextEditingController(); - GetAllCitiesResponseModel _selectedCity; + + GetAllProjectsResponseModel _selectedHospital; GetAllSharedRecordsByStatusList selectedPatientFamily; List medicalReportImages = []; @@ -50,6 +53,7 @@ class _NewEReferralStepThreePageState extends State { @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model) => model.getAllProjects(), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( @@ -64,7 +68,7 @@ class _NewEReferralStepThreePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 20, + height: 80, ), Center( child: Texts( @@ -103,8 +107,13 @@ class _NewEReferralStepThreePageState extends State { ImageOptions.showImageOptions(context, (String image) { 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); }); }); }, @@ -158,15 +167,17 @@ class _NewEReferralStepThreePageState extends State { width: 8, ), Texts( - medicalReportImages[index].fileName, + medicalReportImages[index] + .fileName, ), ], ), InkWell( onTap: () { setState(() { - medicalReportImages - .remove(medicalReportImages[index]); + medicalReportImages.remove( + medicalReportImages[ + index]); }); }, child: Icon( @@ -205,7 +216,7 @@ class _NewEReferralStepThreePageState extends State { ), InkWell( onTap: () => - confirmSelectCityDialog(model.allCities), + confirmSelectHospital(model.allHospitals), child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -262,12 +273,12 @@ class _NewEReferralStepThreePageState extends State { ], ), ), - if(isPatientInsured) - SizedBox( - height: 12, - ), + if (isPatientInsured) + SizedBox( + height: 12, + ), Opacity( - opacity: isPatientInsured?1:0, + opacity: isPatientInsured ? 1 : 0, child: Container( padding: EdgeInsets.only(top: 10), decoration: BoxDecoration( @@ -276,16 +287,21 @@ class _NewEReferralStepThreePageState extends State { ), child: Column( children: [ - InkWell( onTap: () { ImageOptions.showImageOptions(context, (String image) { 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 + ]; }); }); }, @@ -333,8 +349,8 @@ class _NewEReferralStepThreePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - FontAwesomeIcons.paperclip), + Icon(FontAwesomeIcons + .paperclip), SizedBox( width: 8, ), @@ -346,8 +362,9 @@ class _NewEReferralStepThreePageState extends State { InkWell( onTap: () { setState(() { - insuredPatientImages - .remove(insuredPatientImages[index]); + insuredPatientImages.remove( + insuredPatientImages[ + index]); }); }, child: Icon( @@ -378,50 +395,72 @@ class _NewEReferralStepThreePageState extends State { textColor: Colors.white, label: "Submit", onTap: () async { - this.widget.createEReferralRequestModel.medicalReportAttachment = medicalReportImages; - this.widget.createEReferralRequestModel.insuranceCardAttachment = insuredPatientImages.length !=0?insuredPatientImages[0]:null; - this.widget.createEReferralRequestModel.isInsuredPatient = isPatientInsured; + 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 = 15; - this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; - + this.widget.createEReferralRequestModel.preferredBranchCode = + _selectedHospital.iD; + this.widget.createEReferralRequestModel.preferredBranchName = + _selectedHospital.desciption; + this.widget.createEReferralRequestModel.otherRelationship = + ""; - // this.widget.createEReferralRequestModel.fullName= ""; - this.widget.createEReferralRequestModel.otherRelationship= ""; - // this.widget.createEReferralRequestModel.; - // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; - // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; - - await model.createEReferral(this.widget.createEReferralRequestModel); + await model + .createEReferral(this.widget.createEReferralRequestModel) + .then((value) { + AlertDialogBox( + context: context, + confirmMessage: + TranslationBase.of(context).ereferralSaveSuccess + + value['ReferralNumber'].toString(), + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + navigateToHome(context); + }).showAlertDialog(context); + }); }, loading: model.state == ViewState.BusyLocal, - disabled: medicalReportImages.length == 0 , + disabled: medicalReportImages.length == 0, ), ))); } - void confirmSelectCityDialog(List cities) { + Future navigateToHome(context) async { + Navigator.of(context).popAndPushNamed(HOME); + } + + void confirmSelectHospital(List projects) { showDialog( context: context, - child: SelectCityDialog( - cities: cities, - selectedCity: _selectedCity, + child: SelectHospitalDialog( + hospitals: projects, + selectedHospital: _selectedHospital, onValueSelected: (value) { setState(() { - _selectedCity = value; + _selectedHospital = value; }); }, ), ); } - String getRelationName() { - if (_selectedCity != null) - return _selectedCity.description; + if (_selectedHospital != null) + return _selectedHospital.desciption; else - return "Select Relationship" /*TranslationBase.of(context).selectHospital*/; + return "Select Hospital*" /*TranslationBase.of(context).selectHospital*/; } - } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index 5f85fe12..34616def 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -71,7 +71,7 @@ class _NewEReferralStepTowPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 30, + height: 80, ), Center( child: Texts( diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart new file mode 100644 index 00000000..3a3cc083 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_project_dialog.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_projects_response_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +class SelectHospitalDialog extends StatefulWidget { + + final List hospitals; + final Function(GetAllProjectsResponseModel) onValueSelected; + GetAllProjectsResponseModel selectedHospital; + + SelectHospitalDialog( + {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + + @override + _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); +} + +class _SelectHospitalDialogState extends State { + + @override + void initState() { + super.initState(); + widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.hospitals.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedHospital = widget.hospitals[index]; + }); + }, + child: ListTile( + title: Text(widget.hospitals[index].desciption), + leading: Radio( + value: widget.hospitals[index], + groupValue: widget.selectedHospital, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedHospital = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedHospital); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart index 9f836860..f50e67fa 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -88,13 +88,13 @@ class _EReferralPageState extends State Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts("New Referral"), + child: Texts("New Referral", fontSize: 14.0), ), ), Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts("Search for Referrals"), + child: Texts("Search for Referrals", fontSize: 14.0), ), ), ], diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart index 2f9a3e60..763948c0 100644 --- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; class HealthDataList extends StatefulWidget { @@ -8,6 +9,19 @@ class HealthDataList extends StatefulWidget { } class _HealthDataListState extends State { + List dataTypes = List(); + + @override + void initState() { + dataTypes.add(DataType.DISTANCE); + dataTypes.add(DataType.STEP_COUNT); + dataTypes.add(DataType.HEART_RATE); + dataTypes.add(DataType.SLEEP); + dataTypes.add(DataType.ENERGY); + + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -132,7 +146,7 @@ class _HealthDataListState extends State { width: MediaQuery.of(context).size.width * 0.8, child: Button( onTap: () { -// launch(model.radImageURL); + readAll(); }, label: 'Sync Health Data', backgroundColor: Colors.grey[800], @@ -142,4 +156,26 @@ class _HealthDataListState extends State { ), )); } + + void readLast() async { + final result = await FitKit.readLast(DataType.DISTANCE); + print(result); + print(result); + } + + void readAll() async { + if (await FitKit.requestPermissions(dataTypes)) { + for (DataType type in dataTypes) { + final results = await FitKit.read( + type, + dateFrom: DateTime.now().subtract(Duration(days: 15)), + dateTo: DateTime.now(), + limit: 100, + ); + print(results); + print(results.length); + } + readLast(); + } + } } diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart index eb0c1675..3f07693b 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -31,6 +31,7 @@ class _SmartWatchInstructionsState extends State { return AppScaffold( appBarTitle: "Sync Health Data", isShowAppBar: true, + isShowDecPage: false, body: Container( child: Platform.isIOS ? _getAppleWatchInstructions() @@ -88,6 +89,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 1", style: TextStyle( @@ -108,8 +111,12 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 2", + overflow: TextOverflow.clip, + softWrap: true, style: TextStyle( fontSize: 12.0)), ) @@ -135,6 +142,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 3", style: TextStyle( @@ -155,6 +164,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 4", style: TextStyle( @@ -182,6 +193,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 5", style: TextStyle( @@ -202,6 +215,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + margin: EdgeInsets.only(left: 5.0), + width: 105.0, child: Text( "Apple Watch Series 6", style: TextStyle( @@ -427,7 +442,7 @@ class _SmartWatchInstructionsState extends State { width: MediaQuery.of(context).size.width, margin: EdgeInsets.symmetric(horizontal: 5.0), child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 0.0), color: Colors.white.withOpacity(1.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -657,7 +672,7 @@ class _SmartWatchInstructionsState extends State { style: TextStyle(fontSize: 17.0)), ), Container( - margin: EdgeInsets.all(15.0), + margin: EdgeInsets.all(12.0), child: ButtonTheme( shape: RoundedRectangleBorder( borderRadius: diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index fb44772d..a42e26d5 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -46,7 +46,7 @@ class VitalSignItem extends StatelessWidget { des, style: TextStyle( fontSize: 1.7 * SizeConfig.textMultiplier, - color: HexColor('#B8382C'), + color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold, ), ), @@ -76,11 +76,11 @@ class VitalSignItem extends StatelessWidget { text: TextSpan( style: TextStyle(color: Colors.black), children: [ - TextSpan(text: lastVal), + TextSpan(text: lastVal + " "), TextSpan( text: unit, style: TextStyle( - color: HexColor('#B8382C'), + color: Theme.of(context).textTheme.headline1.color, ), ), ]), diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index bc80f47c..aedd0fbf 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -65,6 +65,7 @@ final blueBackground = Color(0xFFFFFFFF); }, ), hintColor: Colors.grey[400], + accentColor: Color(0xffB8382C), disabledColor: Colors.grey[300], errorColor: Color.fromRGBO(235, 80, 60, 1.0), scaffoldBackgroundColor: Color(0xffEEEEEE), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 845fa869..4e0edcfd 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -890,6 +890,7 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get descriptionVaccination => localizedValues['description-vaccination'][locale.languageCode]; String get dueDate => localizedValues['due-date'][locale.languageCode]; String get appUpdate => localizedValues['appUpdate'][locale.languageCode]; + String get ereferralSaveSuccess => localizedValues['ereferralSaveSuccess'][locale.languageCode]; } diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index 66ee36c4..f8a99c17 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -15,7 +15,7 @@ class ImageOptions { return _BottomSheet( children: [ _BottomSheetItem( - title: "Select file souse", + title: "Select file source", ), _BottomSheetItem( title: "Gallery",