From ebc5ba7743c2d59cd40c67190e158ddab5b8a3e0 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 27 Jan 2021 10:33:30 +0200 Subject: [PATCH 01/29] some fixes --- lib/config/localized_values.dart | 3 + .../patient-doctor-referral-service.dart | 5 +- .../viewModel/patient-referral-viewmodel.dart | 4 +- .../profile/UCAF/UCAF-detail-screen.dart | 19 +- .../profile/UCAF/UCAF-input-screen.dart | 43 ++-- .../referral/refer-patient-screen.dart | 55 +++-- .../vital_sign/vital_sign_details_screen.dart | 190 ++++++++++-------- lib/util/translations_delegate_base.dart | 13 ++ .../shared/dialogs/dailog-list-select.dart | 2 +- 9 files changed, 209 insertions(+), 125 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2de1f3d1..f70e13c8 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -674,4 +674,7 @@ const Map> localizedValues = { 'en': "Referral Remark : ", 'ar': "ملاحظة الإحالة :" }, + 'icd': {'en': "ICD", 'ar': "التصنيف الدولي للأمراض" + // 'icd': {'en': "ICD", 'ar': " " + }, }; diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index 2f18540a..f452cfb6 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -32,13 +32,14 @@ class PatientReferralService extends LookupService { "Channel": 9, "TokenID": "", "SessionID": "i1UJwCTSqt", - "IsLoginForDoctorApp": true + "IsLoginForDoctorApp": true, + // "MemberID": memberID }; dynamic localRes; await baseAppClient.post(url, onSuccess: (response, statusCode) async { if (response['MessageStatus'] == 1) { - projectsList = response['ListProject']; + projectsList = response['ProjectInfo']; } else { // handel error projectsList = ListProject; diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index abe39224..b9987601 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -94,8 +94,8 @@ class PatientReferralViewModel extends BaseViewModel { DoctorProfileModel doctorProfile = await getDoctorProfile(); if (doctorProfile != null) { dynamic _selectedBranch = { - "ID": doctorProfile.projectID, - "Desciption": doctorProfile.projectName + "facilityId": doctorProfile.projectID, + "facilityName": doctorProfile.projectName }; return _selectedBranch; } diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 489c462d..0831fffe 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -284,7 +284,24 @@ class DiagnosisWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "${diagnosis.icdCode10ID} ${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}", + "${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).icd}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${diagnosis.icdCode10ID}}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 0116ce46..1a9ac4fa 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -144,24 +144,31 @@ class _UCAFInputScreenState extends State { ), ], ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${model.patientVitalSigns.temperatureCelcius}(C), ${model.patientVitalSigns.temperatureCelcius * (9 / 5) + 32}(F)", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + SizedBox( + width: 4, + ), + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${model.patientVitalSigns.temperatureCelcius}(C), ${(model.patientVitalSigns.temperatureCelcius * (9 / 5) + 32).toStringAsFixed(2)}(F)", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 2c5311cc..04eba96e 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -74,14 +75,14 @@ class _PatientMakeReferralScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - if (model.state == ViewState.BusyLocal) + /*if (model.state == ViewState.BusyLocal) Container( color: Colors.white, width: 50, height: 50, child: AppLoaderWidget( containerColor: Colors.white, - )), + )),*/ Column( children: [ PatientPageHeaderWidget(patient), @@ -95,17 +96,16 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? ReferralForm(model, screenSize) : PatientReferralItemWidget( - patientName: model.patientReferral[0].patientName, - referralStatus: "${model.patientReferral[0].referralStatus}", - isReferredTo: true, - isSameBranch: model.patientReferral[0] - .isReferralDoctorSameBranch, - referralDoctorName: - model.patientReferral[0].referredByDoctorInfo, - clinicDescription: null, - remark: - model.patientReferral[0].remarksFromSource - ), + patientName: model.patientReferral[0].patientName, + referralStatus: + "${model.patientReferral[0].referralStatus}", + isReferredTo: true, + isSameBranch: model + .patientReferral[0].isReferralDoctorSameBranch, + referralDoctorName: + model.patientReferral[0].referredByDoctorInfo, + clinicDescription: null, + remark: model.patientReferral[0].remarksFromSource), ], ), if (model.patientReferral.length == 0) @@ -124,7 +124,7 @@ class _PatientMakeReferralScreenState extends State { .makeReferral( patient, appointmentDate.toIso8601String(), - _selectedBranch['ID'], + _selectedBranch['facilityId'], _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text) @@ -180,7 +180,12 @@ class _PatientMakeReferralScreenState extends State { model.getDoctorBranch().then((value) { _selectedBranch = value; if (_referTo['id'] == 1) { - model.getClinics(_selectedBranch['ID']); + GifLoaderDialogUtils.showMyDialog(context); + model + .getClinics(_selectedBranch['facilityId']) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); } }); }); @@ -217,15 +222,19 @@ class _PatientMakeReferralScreenState extends State { ? () { ListSelectDialog dialog = ListSelectDialog( list: model.branchesList, - attributeName: 'Desciption', - attributeValueId: 'ID', + attributeName: 'facilityName', + attributeValueId: 'facilityId', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { _selectedBranch = selectedValue; _selectedClinic = null; _selectedDoctor = null; - model.getClinics(_selectedBranch['ID']); + GifLoaderDialogUtils.showMyDialog(context); + model + .getClinics(_selectedBranch['facilityId']) + .then((_) => + GifLoaderDialogUtils.hideDialog(context)); }); }, ); @@ -242,7 +251,7 @@ class _PatientMakeReferralScreenState extends State { decoration: textFieldSelectorDecoration( TranslationBase.of(context).branch, _selectedBranch != null - ? _selectedBranch['Desciption'] + ? _selectedBranch['facilityName'] : null, true), enabled: false, @@ -268,8 +277,12 @@ class _PatientMakeReferralScreenState extends State { setState(() { _selectedDoctor = null; _selectedClinic = selectedValue; - model.getClinicDoctors( - _selectedClinic['ClinicID'].toString()); + GifLoaderDialogUtils.showMyDialog(context); + model + .getClinicDoctors( + _selectedClinic['ClinicID'].toString()) + .then((_) => + GifLoaderDialogUtils.hideDialog(context)); }); }, ); diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index ad312625..45cd8d14 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; import 'package:doctor_app_flutter/lookups/patient_lookup.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -9,13 +10,15 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; class VitalSignDetailsScreen extends StatelessWidget { - int appointmentNo; int projectID; bool isNotOneAppointment; - VitalSignDetailsScreen({this.appointmentNo, this.projectID,this.isNotOneAppointment=true}); + + VitalSignDetailsScreen( + {this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); @override Widget build(BuildContext context) { @@ -23,10 +26,11 @@ class VitalSignDetailsScreen extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; String from = routeArgs['from']; String to = routeArgs['to']; - String imageBasePath = 'assets/images/'; + String imageBasePath = 'assets/images/'; return BaseView( - onModelReady: (model) => model.getPatientVitalSignHistory(patient, from, to), + onModelReady: (model) => + model.getPatientVitalSignHistory(patient, from, to), builder: (_, mode, widget) => AppScaffold( isShowAppBar: true, baseViewModel: mode, @@ -38,16 +42,19 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () =>isNotOneAppointment? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Height, - pageTitle: TranslationBase.of(context).height, - vitalList: mode.patientVitalSignsHistory, - ), - ), - ):null, + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Height, + pageTitle: + TranslationBase.of(context).height, + vitalList: mode.patientVitalSignsHistory, + ), + ), + ) + : null, child: Container( child: VitalSignItem( des: TranslationBase.of(context).height, @@ -58,16 +65,19 @@ class VitalSignDetailsScreen extends StatelessWidget { ), ), InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Weight, - pageTitle: TranslationBase.of(context).weight, - vitalList: mode.patientVitalSignsHistory, - ), - ), - ):null, + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Weight, + pageTitle: + TranslationBase.of(context).weight, + vitalList: mode.patientVitalSignsHistory, + ), + ), + ) + : null, child: VitalSignItem( des: TranslationBase.of(context).weight, imagePath: "${imageBasePath}vital_weight.png", @@ -80,17 +90,20 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.BodyMeasurements, - pageTitle: TranslationBase.of(context) - .bodyMeasurements, - vitalList: mode.patientVitalSignsHistory, - ), - ), - ): null, + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: + vitalSignDetails.BodyMeasurements, + pageTitle: TranslationBase.of(context) + .bodyMeasurements, + vitalList: mode.patientVitalSignsHistory, + ), + ), + ) + : null, child: VitalSignItem( des: TranslationBase.of(context).body, imagePath: "${imageBasePath}vital_body_mass.png", @@ -99,21 +112,24 @@ class VitalSignDetailsScreen extends StatelessWidget { ), ), InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Temperature, - pageTitle: - TranslationBase.of(context).temperature, - vitalList: mode.patientVitalSignsHistory, - ), - ), - ):null, + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Temperature, + pageTitle: TranslationBase.of(context) + .temperature, + vitalList: mode.patientVitalSignsHistory, + ), + ), + ) + : null, child: Container( child: VitalSignItem( des: TranslationBase.of(context).temperature, - imagePath: "${imageBasePath}vital_temperature.png", + imagePath: + "${imageBasePath}vital_temperature.png", lastVal: mode.temperatureCelcius, unit: TranslationBase.of(context).tempC, ), @@ -124,16 +140,19 @@ class VitalSignDetailsScreen extends StatelessWidget { Row( children: [ InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.heart, - pageTitle: TranslationBase.of(context).heart, - vitalList: mode.patientVitalSignsHistory, - ), - ), - ):null, + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.heart, + pageTitle: + TranslationBase.of(context).heart, + vitalList: mode.patientVitalSignsHistory, + ), + ), + ) + : null, child: VitalSignItem( des: TranslationBase.of(context).heart, imagePath: "${imageBasePath}vital_heart_rate.png", @@ -142,17 +161,19 @@ class VitalSignDetailsScreen extends StatelessWidget { ), ), InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Respiration, - pageTitle: - TranslationBase.of(context).respirationRate, - vitalList: mode.patientVitalSignsHistory, - ), - ), - ):null, + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Respiration, + pageTitle: TranslationBase.of(context) + .respirationRate, + vitalList: mode.patientVitalSignsHistory, + ), + ), + ) + : null, child: VitalSignItem( des: TranslationBase.of(context).respirationRate, imagePath: "${imageBasePath}vital_respiration.png", @@ -166,19 +187,23 @@ class VitalSignDetailsScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.BloodPressure, - pageTitle: TranslationBase.of(context).bloodPressure, - vitalList: mode.patientVitalSignsHistory, - ), - ), - ):null, + onTap: () => isNotOneAppointment + ? Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.BloodPressure, + pageTitle: TranslationBase.of(context) + .bloodPressure, + vitalList: mode.patientVitalSignsHistory, + ), + ), + ) + : null, child: VitalSignItem( des: TranslationBase.of(context).bloodPressure, - imagePath: "${imageBasePath}vital_blood-pressure.png", + imagePath: + "${imageBasePath}vital_blood-pressure.png", lastVal: mode.bloodPressure, unit: TranslationBase.of(context).sysDias, ), @@ -189,7 +214,12 @@ class VitalSignDetailsScreen extends StatelessWidget { ), ) : Center( - child: AppText('No Data'), + child: AppText( + TranslationBase.of(context).vitalSignEmptyMsg, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), ), ), ); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 43a51237..a49873a7 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1013,21 +1013,30 @@ class TranslationBase { String get createdBy => localizedValues['createdBy'][locale.languageCode]; String get editedBy => localizedValues['editedBy'][locale.languageCode]; + String get currentMedications => localizedValues['currentMedications'][locale.languageCode]; + String get noItem => localizedValues['noItem'][locale.languageCode]; + String get postUcafSuccessMsg => localizedValues['postUcafSuccessMsg'][locale.languageCode]; + String get vitalSignDetailEmpty => localizedValues['vitalSignDetailEmpty'][locale.languageCode]; + String get onlyOfftimeHoliday => localizedValues['onlyOfftimeHoliday'][locale.languageCode]; + String get active => localizedValues['active'][locale.languageCode]; + String get hold => localizedValues['hold'][locale.languageCode]; + String get loading => localizedValues['loading'][locale.languageCode]; String get assessmentErrorMsg => localizedValues['assessmentErrorMsg'][locale.languageCode]; + String get examinationErrorMsg => localizedValues['examinationErrorMsg'][locale.languageCode]; @@ -1036,10 +1045,14 @@ class TranslationBase { String get chiefComplaintErrorMsg => localizedValues['chiefComplaintErrorMsg'][locale.languageCode]; + String get referralStatus => localizedValues['referralStatus'][locale.languageCode]; + String get referralRemark => localizedValues['referralRemark'][locale.languageCode]; + + String get icd => localizedValues['icd'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index fa33a72d..b6df1f6f 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -47,8 +47,8 @@ class _ListSelectDialogState extends State { Widget continueButton = FlatButton( child: Text(this.widget.okText), onPressed: () { - this.widget.okFunction(widget.selectedValue); Navigator.of(context).pop(); + this.widget.okFunction(widget.selectedValue); }); // set up the AlertDialog AlertDialog alert = AlertDialog( From 2273808333ce236bb723e94a02a29af0e15b3fbe Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 27 Jan 2021 10:56:05 +0200 Subject: [PATCH 02/29] translation --- lib/screens/patients/patients_screen.dart | 2 +- lib/util/date-utils.dart | 4 ++-- lib/widgets/patients/profile/patient_profile_widget.dart | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 1a55153e..50b89148 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -616,7 +616,7 @@ class _PatientsScreenState extends State { .white, ), AppText( - " ${DateUtils.getAgeByBirthday(item.dateofBirth)}", + " ${DateUtils.getAgeByBirthday(item.dateofBirth, context)}", fontSize: 1.8 * SizeConfig diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index 84b4167f..af90acf6 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -217,7 +217,7 @@ class DateUtils { } } - static String getAgeByBirthday(dynamic birthday){ + static String getAgeByBirthday(dynamic birthday, BuildContext context){ // https://leechy.dev/calculate-dates-diff-in-dart DateTime birthDate = DateUtils.getDateTimeFromServerFormat(birthday); final now = DateTime.now(); @@ -232,7 +232,7 @@ class DateUtils { final monthAgo = new DateTime(now.year, now.month - 1, birthDate.day); days = now.difference(monthAgo).inDays + 1; } - return "$years Yr $months Mnth $days Day"; + return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}"; } } diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index c289431b..4834e412 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -117,7 +117,7 @@ class PatientProfileWidget extends StatelessWidget { height: 4, ), AppText( - "${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${DateUtils.getAgeByBirthday(patient.dateofBirth)/*patient.age*/}", + "${DateUtils.convertDateFromServerFormat(patient.dateofBirth, 'dd-MM-yyyy')} / ${DateUtils.getAgeByBirthday(patient.dateofBirth, context)/*patient.age*/}", fontWeight: FontWeight.normal, fontSize: 1.6 * SizeConfig.textMultiplier, ), From 75efcde0bca3f5c63674678e72338ef0bf93224c Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 27 Jan 2021 12:30:17 +0200 Subject: [PATCH 03/29] fix ios --- android/app/google-services.json | 21 +- ios/GoogleService-Info .plist | 34 ++ ios/Podfile.lock | 378 +++++++++++++++++- ios/Runner.xcodeproj/project.pbxproj | 13 +- ios/Runner/AppDelegate.swift | 2 - ios/Runner/GoogleService-Info.plist | 34 ++ ios/Runner/Info.plist | 9 +- ios/Runner/RunnerRelease.entitlements | 8 + lib/config/localized_values.dart | 3 + lib/main.dart | 5 +- lib/screens/dashboard_screen.dart | 10 +- lib/util/translations_delegate_base.dart | 3 + .../patient-referral-item-widget.dart | 27 +- pubspec.lock | 92 ++++- pubspec.yaml | 10 +- 15 files changed, 614 insertions(+), 35 deletions(-) create mode 100644 ios/GoogleService-Info .plist create mode 100644 ios/Runner/GoogleService-Info.plist create mode 100644 ios/Runner/RunnerRelease.entitlements diff --git a/android/app/google-services.json b/android/app/google-services.json index 3c00f05c..27e5dfb1 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,34 +1,41 @@ { "project_info": { - "project_number": "1008895414777", - "project_id": "doctorapp-9f172", - "storage_bucket": "doctorapp-9f172.appspot.com" + "project_number": "1097451043303", + "project_id": "doctor-app-35ddc", + "storage_bucket": "doctor-app-35ddc.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:1008895414777:android:d00fe21d6955c21b1f6d28", + "mobilesdk_app_id": "1:1097451043303:android:f82ecce9562ecaad866542", "android_client_info": { "package_name": "com.example.doctor_app_flutter" } }, "oauth_client": [ { - "client_id": "1008895414777-3mg88j5ocs5r1au7rf4sh3f4pgsri2f2.apps.googleusercontent.com", + "client_id": "1097451043303-u7bl21167fq5b7u06cqpq621psv9s3qh.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyCNncEIj8ehVUSxV89rx0x1NaWp8t1YVkw" + "current_key": "AIzaSyChu44P8Dp8jtRqnoDR2mdjqKgSKQq-FPY" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "1008895414777-3mg88j5ocs5r1au7rf4sh3f4pgsri2f2.apps.googleusercontent.com", + "client_id": "1097451043303-u7bl21167fq5b7u06cqpq621psv9s3qh.apps.googleusercontent.com", "client_type": 3 + }, + { + "client_id": "1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "com.hmg.doctorApp" + } } ] } diff --git a/ios/GoogleService-Info .plist b/ios/GoogleService-Info .plist new file mode 100644 index 00000000..81c3af44 --- /dev/null +++ b/ios/GoogleService-Info .plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre + API_KEY + AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo + GCM_SENDER_ID + 1097451043303 + PLIST_VERSION + 1 + BUNDLE_ID + com.hmg.doctorApp + PROJECT_ID + doctor-app-35ddc + STORAGE_BUCKET + doctor-app-35ddc.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:1097451043303:ios:0e9b87e77dcf397d866542 + + \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 40d9a06a..aa3e21b8 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,9 +1,235 @@ PODS: + - abseil/algorithm (0.20200225.0): + - abseil/algorithm/algorithm (= 0.20200225.0) + - abseil/algorithm/container (= 0.20200225.0) + - abseil/algorithm/algorithm (0.20200225.0): + - abseil/base/config + - abseil/algorithm/container (0.20200225.0): + - abseil/algorithm/algorithm + - abseil/base/core_headers + - abseil/meta/type_traits + - abseil/base (0.20200225.0): + - abseil/base/atomic_hook (= 0.20200225.0) + - abseil/base/base (= 0.20200225.0) + - abseil/base/base_internal (= 0.20200225.0) + - abseil/base/bits (= 0.20200225.0) + - abseil/base/config (= 0.20200225.0) + - abseil/base/core_headers (= 0.20200225.0) + - abseil/base/dynamic_annotations (= 0.20200225.0) + - abseil/base/endian (= 0.20200225.0) + - abseil/base/errno_saver (= 0.20200225.0) + - abseil/base/exponential_biased (= 0.20200225.0) + - abseil/base/log_severity (= 0.20200225.0) + - abseil/base/malloc_internal (= 0.20200225.0) + - abseil/base/periodic_sampler (= 0.20200225.0) + - abseil/base/pretty_function (= 0.20200225.0) + - abseil/base/raw_logging_internal (= 0.20200225.0) + - abseil/base/spinlock_wait (= 0.20200225.0) + - abseil/base/throw_delegate (= 0.20200225.0) + - abseil/base/atomic_hook (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/base/base (0.20200225.0): + - abseil/base/atomic_hook + - abseil/base/base_internal + - abseil/base/config + - abseil/base/core_headers + - abseil/base/dynamic_annotations + - abseil/base/log_severity + - abseil/base/raw_logging_internal + - abseil/base/spinlock_wait + - abseil/meta/type_traits + - abseil/base/base_internal (0.20200225.0): + - abseil/base/config + - abseil/meta/type_traits + - abseil/base/bits (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/base/config (0.20200225.0) + - abseil/base/core_headers (0.20200225.0): + - abseil/base/config + - abseil/base/dynamic_annotations (0.20200225.0) + - abseil/base/endian (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/base/errno_saver (0.20200225.0): + - abseil/base/config + - abseil/base/exponential_biased (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/base/log_severity (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/base/malloc_internal (0.20200225.0): + - abseil/base/base + - abseil/base/base_internal + - abseil/base/config + - abseil/base/core_headers + - abseil/base/dynamic_annotations + - abseil/base/raw_logging_internal + - abseil/base/periodic_sampler (0.20200225.0): + - abseil/base/core_headers + - abseil/base/exponential_biased + - abseil/base/pretty_function (0.20200225.0) + - abseil/base/raw_logging_internal (0.20200225.0): + - abseil/base/atomic_hook + - abseil/base/config + - abseil/base/core_headers + - abseil/base/log_severity + - abseil/base/spinlock_wait (0.20200225.0): + - abseil/base/base_internal + - abseil/base/core_headers + - abseil/base/errno_saver + - abseil/base/throw_delegate (0.20200225.0): + - abseil/base/config + - abseil/base/raw_logging_internal + - abseil/container/compressed_tuple (0.20200225.0): + - abseil/utility/utility + - abseil/container/inlined_vector (0.20200225.0): + - abseil/algorithm/algorithm + - abseil/base/core_headers + - abseil/base/throw_delegate + - abseil/container/inlined_vector_internal + - abseil/memory/memory + - abseil/container/inlined_vector_internal (0.20200225.0): + - abseil/base/core_headers + - abseil/container/compressed_tuple + - abseil/memory/memory + - abseil/meta/type_traits + - abseil/types/span + - abseil/memory (0.20200225.0): + - abseil/memory/memory (= 0.20200225.0) + - abseil/memory/memory (0.20200225.0): + - abseil/base/core_headers + - abseil/meta/type_traits + - abseil/meta (0.20200225.0): + - abseil/meta/type_traits (= 0.20200225.0) + - abseil/meta/type_traits (0.20200225.0): + - abseil/base/config + - abseil/numeric/int128 (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/strings/internal (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/base/endian + - abseil/base/raw_logging_internal + - abseil/meta/type_traits + - abseil/strings/str_format (0.20200225.0): + - abseil/strings/str_format_internal + - abseil/strings/str_format_internal (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/meta/type_traits + - abseil/numeric/int128 + - abseil/strings/strings + - abseil/types/span + - abseil/strings/strings (0.20200225.0): + - abseil/base/base + - abseil/base/bits + - abseil/base/config + - abseil/base/core_headers + - abseil/base/endian + - abseil/base/raw_logging_internal + - abseil/base/throw_delegate + - abseil/memory/memory + - abseil/meta/type_traits + - abseil/numeric/int128 + - abseil/strings/internal + - abseil/time (0.20200225.0): + - abseil/time/internal (= 0.20200225.0) + - abseil/time/time (= 0.20200225.0) + - abseil/time/internal (0.20200225.0): + - abseil/time/internal/cctz (= 0.20200225.0) + - abseil/time/internal/cctz (0.20200225.0): + - abseil/time/internal/cctz/civil_time (= 0.20200225.0) + - abseil/time/internal/cctz/time_zone (= 0.20200225.0) + - abseil/time/internal/cctz/civil_time (0.20200225.0): + - abseil/base/config + - abseil/time/internal/cctz/time_zone (0.20200225.0): + - abseil/base/config + - abseil/time/internal/cctz/civil_time + - abseil/time/time (0.20200225.0): + - abseil/base/base + - abseil/base/core_headers + - abseil/base/raw_logging_internal + - abseil/numeric/int128 + - abseil/strings/strings + - abseil/time/internal/cctz/civil_time + - abseil/time/internal/cctz/time_zone + - abseil/types (0.20200225.0): + - abseil/types/any (= 0.20200225.0) + - abseil/types/bad_any_cast (= 0.20200225.0) + - abseil/types/bad_any_cast_impl (= 0.20200225.0) + - abseil/types/bad_optional_access (= 0.20200225.0) + - abseil/types/bad_variant_access (= 0.20200225.0) + - abseil/types/compare (= 0.20200225.0) + - abseil/types/optional (= 0.20200225.0) + - abseil/types/span (= 0.20200225.0) + - abseil/types/variant (= 0.20200225.0) + - abseil/types/any (0.20200225.0): + - abseil/base/config + - abseil/base/core_headers + - abseil/meta/type_traits + - abseil/types/bad_any_cast + - abseil/utility/utility + - abseil/types/bad_any_cast (0.20200225.0): + - abseil/base/config + - abseil/types/bad_any_cast_impl + - abseil/types/bad_any_cast_impl (0.20200225.0): + - abseil/base/config + - abseil/base/raw_logging_internal + - abseil/types/bad_optional_access (0.20200225.0): + - abseil/base/config + - abseil/base/raw_logging_internal + - abseil/types/bad_variant_access (0.20200225.0): + - abseil/base/config + - abseil/base/raw_logging_internal + - abseil/types/compare (0.20200225.0): + - abseil/base/core_headers + - abseil/meta/type_traits + - abseil/types/optional (0.20200225.0): + - abseil/base/base_internal + - abseil/base/config + - abseil/base/core_headers + - abseil/memory/memory + - abseil/meta/type_traits + - abseil/types/bad_optional_access + - abseil/utility/utility + - abseil/types/span (0.20200225.0): + - abseil/algorithm/algorithm + - abseil/base/core_headers + - abseil/base/throw_delegate + - abseil/meta/type_traits + - abseil/types/variant (0.20200225.0): + - abseil/base/base_internal + - abseil/base/config + - abseil/base/core_headers + - abseil/meta/type_traits + - abseil/types/bad_variant_access + - abseil/utility/utility + - abseil/utility/utility (0.20200225.0): + - abseil/base/base_internal + - abseil/base/config + - abseil/meta/type_traits - Alamofire (4.9.1) - barcode_scan (0.0.1): - Flutter - MTBBarcodeScanner - SwiftProtobuf + - BoringSSL-GRPC (0.0.7): + - BoringSSL-GRPC/Implementation (= 0.0.7) + - BoringSSL-GRPC/Interface (= 0.0.7) + - BoringSSL-GRPC/Implementation (0.0.7): + - BoringSSL-GRPC/Interface (= 0.0.7) + - BoringSSL-GRPC/Interface (0.0.7) + - cloud_firestore (0.14.3): + - Firebase/CoreOnly (~> 6.33.0) + - Firebase/Firestore (~> 6.33.0) + - firebase_core + - Flutter + - cloud_firestore_web (0.1.0): + - Flutter - connectivity (0.0.1): - Flutter - Reachability @@ -13,12 +239,40 @@ PODS: - Flutter - device_info (0.0.1): - Flutter + - Firebase/Analytics (6.33.0): + - Firebase/Core + - Firebase/Auth (6.33.0): + - Firebase/CoreOnly + - FirebaseAuth (~> 6.9.2) + - Firebase/Core (6.33.0): + - Firebase/CoreOnly + - FirebaseAnalytics (= 6.8.3) - Firebase/CoreOnly (6.33.0): - FirebaseCore (= 6.10.3) + - Firebase/Firestore (6.33.0): + - Firebase/CoreOnly + - FirebaseFirestore (~> 1.18.0) - Firebase/Messaging (6.33.0): - Firebase/CoreOnly - FirebaseMessaging (~> 4.7.0) - - firebase_core (0.5.3): + - Firebase/Storage (6.33.0): + - Firebase/CoreOnly + - FirebaseStorage (~> 3.9.0) + - firebase_analytics (6.2.0): + - Firebase/Analytics (~> 6.33.0) + - Firebase/CoreOnly (~> 6.33.0) + - firebase_core + - Flutter + - firebase_analytics_web (0.1.0): + - Flutter + - firebase_auth (0.18.3): + - Firebase/Auth (~> 6.33.0) + - Firebase/CoreOnly (~> 6.33.0) + - firebase_core + - Flutter + - firebase_auth_web (0.1.0): + - Flutter + - firebase_core (0.5.2): - Firebase/CoreOnly (~> 6.33.0) - Flutter - firebase_core_web (0.1.0): @@ -28,6 +282,25 @@ PODS: - Firebase/Messaging (~> 6.33.0) - firebase_core - Flutter + - firebase_storage (5.0.1): + - Firebase/CoreOnly (~> 6.33.0) + - Firebase/Storage (~> 6.33.0) + - firebase_core + - Flutter + - FirebaseAnalytics (6.8.3): + - FirebaseCore (~> 6.10) + - FirebaseInstallations (~> 1.6) + - GoogleAppMeasurement (= 6.8.3) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/MethodSwizzler (~> 6.7) + - GoogleUtilities/Network (~> 6.7) + - "GoogleUtilities/NSData+zlib (~> 6.7)" + - nanopb (~> 1.30906.0) + - FirebaseAuth (6.9.2): + - FirebaseCore (~> 6.10) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/Environment (~> 6.7) + - GTMSessionFetcher/Core (~> 1.1) - FirebaseCore (6.10.3): - FirebaseCoreDiagnostics (~> 1.6) - GoogleUtilities/Environment (~> 6.7) @@ -37,6 +310,18 @@ PODS: - GoogleUtilities/Environment (~> 6.7) - GoogleUtilities/Logger (~> 6.7) - nanopb (~> 1.30906.0) + - FirebaseFirestore (1.18.0): + - abseil/algorithm (= 0.20200225.0) + - abseil/base (= 0.20200225.0) + - abseil/memory (= 0.20200225.0) + - abseil/meta (= 0.20200225.0) + - abseil/strings/strings (= 0.20200225.0) + - abseil/time (= 0.20200225.0) + - abseil/types (= 0.20200225.0) + - FirebaseCore (~> 6.10) + - "gRPC-C++ (~> 1.28.0)" + - leveldb-library (~> 1.22) + - nanopb (~> 1.30906.0) - FirebaseInstallations (1.7.0): - FirebaseCore (~> 6.10) - GoogleUtilities/Environment (~> 6.7) @@ -55,11 +340,20 @@ PODS: - GoogleUtilities/Reachability (~> 6.7) - GoogleUtilities/UserDefaults (~> 6.7) - Protobuf (>= 3.9.2, ~> 3.9) + - FirebaseStorage (3.9.1): + - FirebaseCore (~> 6.10) + - GTMSessionFetcher/Core (~> 1.1) - Flutter (1.0.0) - flutter_flexible_toast (0.0.1): - Flutter - flutter_plugin_android_lifecycle (0.0.1): - Flutter + - GoogleAppMeasurement (6.8.3): + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/MethodSwizzler (~> 6.7) + - GoogleUtilities/Network (~> 6.7) + - "GoogleUtilities/NSData+zlib (~> 6.7)" + - nanopb (~> 1.30906.0) - GoogleDataTransport (7.5.1): - nanopb (~> 1.30906.0) - GoogleUtilities/AppDelegateSwizzler (6.7.2): @@ -70,6 +364,8 @@ PODS: - PromisesObjC (~> 1.2) - GoogleUtilities/Logger (6.7.2): - GoogleUtilities/Environment + - GoogleUtilities/MethodSwizzler (6.7.2): + - GoogleUtilities/Logger - GoogleUtilities/Network (6.7.2): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" @@ -79,10 +375,36 @@ PODS: - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (6.7.2): - GoogleUtilities/Logger + - "gRPC-C++ (1.28.2)": + - "gRPC-C++/Implementation (= 1.28.2)" + - "gRPC-C++/Interface (= 1.28.2)" + - "gRPC-C++/Implementation (1.28.2)": + - abseil/container/inlined_vector (= 0.20200225.0) + - abseil/memory/memory (= 0.20200225.0) + - abseil/strings/str_format (= 0.20200225.0) + - abseil/strings/strings (= 0.20200225.0) + - abseil/types/optional (= 0.20200225.0) + - "gRPC-C++/Interface (= 1.28.2)" + - gRPC-Core (= 1.28.2) + - "gRPC-C++/Interface (1.28.2)" + - gRPC-Core (1.28.2): + - gRPC-Core/Implementation (= 1.28.2) + - gRPC-Core/Interface (= 1.28.2) + - gRPC-Core/Implementation (1.28.2): + - abseil/container/inlined_vector (= 0.20200225.0) + - abseil/memory/memory (= 0.20200225.0) + - abseil/strings/str_format (= 0.20200225.0) + - abseil/strings/strings (= 0.20200225.0) + - abseil/types/optional (= 0.20200225.0) + - BoringSSL-GRPC (= 0.0.7) + - gRPC-Core/Interface (= 1.28.2) + - gRPC-Core/Interface (1.28.2) + - GTMSessionFetcher/Core (1.5.0) - hexcolor (0.0.1): - Flutter - imei_plugin (0.0.1): - Flutter + - leveldb-library (1.22) - local_auth (0.0.1): - Flutter - maps_launcher (0.0.1): @@ -132,13 +454,20 @@ PODS: DEPENDENCIES: - Alamofire - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) + - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) + - cloud_firestore_web (from `.symlinks/plugins/cloud_firestore_web/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) + - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) + - firebase_analytics_web (from `.symlinks/plugins/firebase_analytics_web/ios`) + - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) + - firebase_auth_web (from `.symlinks/plugins/firebase_auth_web/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) + - firebase_storage (from `.symlinks/plugins/firebase_storage/ios`) - Flutter (from `Flutter`) - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) @@ -164,15 +493,26 @@ DEPENDENCIES: SPEC REPOS: trunk: + - abseil - Alamofire + - BoringSSL-GRPC - Firebase + - FirebaseAnalytics + - FirebaseAuth - FirebaseCore - FirebaseCoreDiagnostics + - FirebaseFirestore - FirebaseInstallations - FirebaseInstanceID - FirebaseMessaging + - FirebaseStorage + - GoogleAppMeasurement - GoogleDataTransport - GoogleUtilities + - "gRPC-C++" + - gRPC-Core + - GTMSessionFetcher + - leveldb-library - MTBBarcodeScanner - nanopb - OpenTok @@ -185,6 +525,10 @@ SPEC REPOS: EXTERNAL SOURCES: barcode_scan: :path: ".symlinks/plugins/barcode_scan/ios" + cloud_firestore: + :path: ".symlinks/plugins/cloud_firestore/ios" + cloud_firestore_web: + :path: ".symlinks/plugins/cloud_firestore_web/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" connectivity_for_web: @@ -193,12 +537,22 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/connectivity_macos/ios" device_info: :path: ".symlinks/plugins/device_info/ios" + firebase_analytics: + :path: ".symlinks/plugins/firebase_analytics/ios" + firebase_analytics_web: + :path: ".symlinks/plugins/firebase_analytics_web/ios" + firebase_auth: + :path: ".symlinks/plugins/firebase_auth/ios" + firebase_auth_web: + :path: ".symlinks/plugins/firebase_auth_web/ios" firebase_core: :path: ".symlinks/plugins/firebase_core/ios" firebase_core_web: :path: ".symlinks/plugins/firebase_core_web/ios" firebase_messaging: :path: ".symlinks/plugins/firebase_messaging/ios" + firebase_storage: + :path: ".symlinks/plugins/firebase_storage/ios" Flutter: :path: Flutter flutter_flexible_toast: @@ -243,28 +597,46 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/url_launcher_windows/ios" SPEC CHECKSUMS: + abseil: 6c8eb7892aefa08d929b39f9bb108e5367e3228f Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 + BoringSSL-GRPC: 8edf627ee524575e2f8d19d56f068b448eea3879 + cloud_firestore: 19c6f947dd14be9d71695ea23eefde67cd8829c8 + cloud_firestore_web: 9ec3dc7f5f98de5129339802d491c1204462bfec connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 + firebase_analytics: 52ba26fcfb9cc90f76b36c4e5200cc0a7e9024eb + firebase_analytics_web: 7d539061ea4af07563a0e21044af89cab70efec0 + firebase_auth: 240419f6b00dea39c60a2a9c4379c16c4a4b02fb + firebase_auth_web: 0955c07bcc06e84af76b9d4e32e6f31518f2d7de + firebase_core: 350ba329d1641211bc6183a3236893cafdacfea7 firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 + firebase_storage: d5cf595245e1770ef7081b026f603771bf5dd547 + FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 + FirebaseAuth: c92d49ada7948d1a23466e3db17bc4c2039dddc3 FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 + FirebaseFirestore: adff4877869ca91a11250cc0989a6cd56bad163f FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a + FirebaseStorage: 15e0f15ef3c7fec3d1899d68623e47d4447066b4 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 + GoogleAppMeasurement: 966e88df9d19c15715137bb2ddaf52373f111436 GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 + "gRPC-C++": 13d8ccef97d5c3c441b7e3c529ef28ebee86fad2 + gRPC-Core: 4afa11bfbedf7cdecd04de535a9e046893404ed5 + GTMSessionFetcher: b3503b20a988c4e20cc189aa798fd18220133f52 hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 imei_plugin: cb1af7c223ac2d82dcd1457a7137d93d65d2a3cd + leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb @@ -292,4 +664,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.0.rc.1 +COCOAPODS: 1.10.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index dcd750d8..f35ae084 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 29211E4225C172B700DD740D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 29211E4125C172B700DD740D /* GoogleService-Info.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -34,6 +35,8 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 29211CD725C165D600DD740D /* RunnerRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerRelease.entitlements; sourceTree = ""; }; + 29211E4125C172B700DD740D /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -108,6 +111,8 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 29211E4125C172B700DD740D /* GoogleService-Info.plist */, + 29211CD725C165D600DD740D /* RunnerRelease.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -204,6 +209,7 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 29211E4225C172B700DD740D /* GoogleService-Info.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -354,7 +360,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -437,7 +443,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -486,7 +492,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -530,6 +536,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/RunnerRelease.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 4512a3b1..b97c7000 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,7 +1,6 @@ import UIKit import Flutter import OpenTok - // Created by Mohammad Aljammal & Elham Rababah on 24/06/20. // Copyright © 2020 Cloud. All rights reserved. @@ -23,7 +22,6 @@ import OpenTok _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - let controller : FlutterViewController = window?.rootViewController as! FlutterViewController let videoCallChannel = FlutterMethodChannel(name: "Dr.cloudSolution/videoCall", binaryMessenger: controller.binaryMessenger) diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist new file mode 100644 index 00000000..81c3af44 --- /dev/null +++ b/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre + API_KEY + AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo + GCM_SENDER_ID + 1097451043303 + PLIST_VERSION + 1 + BUNDLE_ID + com.hmg.doctorApp + PROJECT_ID + doctor-app-35ddc + STORAGE_BUCKET + doctor-app-35ddc.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:1097451043303:ios:0e9b87e77dcf397d866542 + + \ No newline at end of file diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index d0d77b5e..01dc72ef 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -47,10 +47,13 @@ NSCameraUsageDescription - ${PRODUCT_NAME} always camera use - + App requires access to camera incase you are interested to attach images to your Qr Code. + NSPhotoLibraryUsageDescription + Need to upload image + NSMicrophoneUsageDescription ${PRODUCT_NAME} always Microphone use - + FirebaseAppDelegateProxyEnabled + diff --git a/ios/Runner/RunnerRelease.entitlements b/ios/Runner/RunnerRelease.entitlements new file mode 100644 index 00000000..903def2a --- /dev/null +++ b/ios/Runner/RunnerRelease.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0ef7fe31..eea62b2a 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -677,5 +677,8 @@ const Map> localizedValues = { 'ICDName': { 'en': "ICDName", 'ar': "اسم ال ICD" + }, 'patient-name': { + 'en': "Patient Name", + 'ar': "اسم المريص" }, }; diff --git a/lib/main.dart b/lib/main.dart index 1283da1e..79994205 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -13,7 +14,9 @@ import './routes.dart'; import 'config/config.dart'; import 'locator.dart'; -void main() { +void main()async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(); setupLocator(); runApp(MyApp()); } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index fc9a8bf8..717dbaa6 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -64,7 +64,15 @@ class _DashboardScreenState extends State { projectsProvider = Provider.of(context); projectsProvider.getDoctorClinicsList(); - _firebaseMessaging.setAutoInitEnabled(true); + // _firebaseMessaging.setAutoInitEnabled(true); + _firebaseMessaging.requestNotificationPermissions( + const IosNotificationSettings( + sound: true, badge: true, alert: true, provisional: true)); + _firebaseMessaging.onIosSettingsRegistered + .listen((IosNotificationSettings settings) { + print("Settings registered: $settings"); + }); + _firebaseMessaging.getToken().then((String token) async { if (token != '') { DEVICE_TOKEN = token; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 01c8d90b..4d843141 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1042,6 +1042,9 @@ String get ICDName => localizedValues['referralStatus'][locale.languageCode]; String get referralRemark => localizedValues['referralRemark'][locale.languageCode]; + + String get patientName => + localizedValues['patient-name'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index fb8276c8..aaaa4e81 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -35,14 +35,7 @@ class PatientReferralItemWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Center( - child: AppText( - patientName != null ? "${patientName}" : "", - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), + if (referralStatus != null) Row( children: [ @@ -107,7 +100,7 @@ class PatientReferralItemWidget extends StatelessWidget { child: AppText( referralDoctorName != null ? "${TranslationBase.of(context).dr} $referralDoctorName" - : "", + : "-", color: Colors.black, fontWeight: FontWeight.bold, fontSize: 12, @@ -135,6 +128,22 @@ class PatientReferralItemWidget extends StatelessWidget { ), ], ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).patientName}: ", + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + patientName??'-', + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), SizedBox( height: 8, ), diff --git a/pubspec.lock b/pubspec.lock index d49ad4a1..e6bd04c0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -183,6 +183,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0-nullsafety.1" + cloud_firestore: + dependency: "direct main" + description: + name: cloud_firestore + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.3" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1" code_builder: dependency: transitive description: @@ -323,27 +344,76 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.2.1" - firebase_core: + firebase: + dependency: transitive + description: + name: firebase + url: "https://pub.dartlang.org" + source: hosted + version: "7.3.3" + firebase_analytics: + dependency: "direct main" + description: + name: firebase_analytics + url: "https://pub.dartlang.org" + source: hosted + version: "6.2.0" + firebase_analytics_platform_interface: + dependency: transitive + description: + name: firebase_analytics_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + firebase_analytics_web: dependency: transitive + description: + name: firebase_analytics_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + url: "https://pub.dartlang.org" + source: hosted + version: "0.18.3" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + firebase_auth_web: + dependency: "direct main" + description: + name: firebase_auth_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2" + firebase_core: + dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.3" + version: "0.5.2" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.0.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.1+1" + version: "0.2.1" firebase_messaging: dependency: "direct main" description: @@ -351,6 +421,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.0.3" + firebase_storage: + dependency: "direct main" + description: + name: firebase_storage + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.1" + firebase_storage_platform_interface: + dependency: transitive + description: + name: firebase_storage_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" fixnum: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 887ac913..3b7ab800 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,8 +62,14 @@ dependencies: #chart fl_chart: ^0.12.1 - #firebase - firebase_messaging: ^7.0.0 + # Firebase + firebase_core: ^0.5.2 + firebase_analytics: ^6.2.0 + firebase_auth: 0.18.3 + firebase_auth_web: ^0.3.2 + firebase_storage: ^5.0.1 + firebase_messaging: ^7.0.3 + cloud_firestore: ^0.14.3 #GIF image flutter_gifimage: ^1.0.1 From 6820e2d0974759dbee6ce29a4bfd7a3df826aa13 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 27 Jan 2021 12:56:03 +0200 Subject: [PATCH 04/29] remark fix in allergies --- .../subjective/update_allergies_widget.dart | 26 ++++++++++++++----- .../soap_update/update_assessment_page.dart | 12 +++++---- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index df0cb683..14718f4c 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -120,13 +120,25 @@ class _UpdateAllergiesWidgetState extends State { ), Padding( padding: const EdgeInsets.symmetric(vertical: 8), - child: Container( - width: MediaQuery.of(context).size.width * 0.6, - child: AppText( - selectedAllergy.remark ?? '', - fontSize: 10, - color: Colors.grey, - ), + child: Row( + children: [ + AppText( + selectedAllergy.remark != null || + selectedAllergy.remark == '' + ? TranslationBase.of(context).remarks + " : " + : '', + fontWeight: FontWeight.bold, + fontSize: 13, + ), + Container( + width: MediaQuery.of(context).size.width * 0.55, + child: AppText( + selectedAllergy.remark ?? '', + fontSize: 10, + color: Colors.grey, + ), + ), + ], ), ), DividerWithSpacesAround() diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index 61bf27f3..9c8eaf63 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -342,11 +342,13 @@ class _UpdateAssessmentPageState extends State { height: 6, ), AppText( - TranslationBase.of(context).remarks + " : ", - fontWeight: FontWeight - .bold, - fontSize: 13, - ), + assessment.remark != null || + assessment.remark == '' + ? TranslationBase.of(context).remarks + " : " + : '', + fontWeight: FontWeight.bold, + fontSize: 13, + ), Container( width: MediaQuery .of(context) From 7b914dab331dad0d8c9985c1bd4eae022159d28e Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 27 Jan 2021 13:07:26 +0200 Subject: [PATCH 05/29] fix android --- android/app/build.gradle | 8 ++-- pubspec.lock | 86 +--------------------------------------- pubspec.yaml | 9 +---- 3 files changed, 7 insertions(+), 96 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index da345fc2..af0821ee 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 30 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -40,7 +40,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.doctor_app_flutter" minSdkVersion 18 - targetSdkVersion 29 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -73,10 +73,10 @@ dependencies { implementation 'com.opentok.android:opentok-android-sdk:2.16.5' //permissions implementation 'pub.devrel:easypermissions:0.4.0' -implementation 'com.google.firebase:firebase-core:9.6.1' //retrofit implementation 'com.squareup.retrofit2:retrofit:2.6.2' implementation 'com.squareup.retrofit2:converter-gson:2.6.2' implementation 'com.squareup.okhttp3:logging-interceptor:3.14.1' - apply plugin: 'com.google.gms.google-services' + } +apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index e6bd04c0..8a1531c1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -183,27 +183,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0-nullsafety.1" - cloud_firestore: - dependency: "direct main" - description: - name: cloud_firestore - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.3" - cloud_firestore_platform_interface: - dependency: transitive - description: - name: cloud_firestore_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.0" - cloud_firestore_web: - dependency: transitive - description: - name: cloud_firestore_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.1" code_builder: dependency: transitive description: @@ -344,57 +323,8 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.2.1" - firebase: - dependency: transitive - description: - name: firebase - url: "https://pub.dartlang.org" - source: hosted - version: "7.3.3" - firebase_analytics: - dependency: "direct main" - description: - name: firebase_analytics - url: "https://pub.dartlang.org" - source: hosted - version: "6.2.0" - firebase_analytics_platform_interface: - dependency: transitive - description: - name: firebase_analytics_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - firebase_analytics_web: - dependency: transitive - description: - name: firebase_analytics_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.1" - firebase_auth: - dependency: "direct main" - description: - name: firebase_auth - url: "https://pub.dartlang.org" - source: hosted - version: "0.18.3" - firebase_auth_platform_interface: - dependency: transitive - description: - name: firebase_auth_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" - firebase_auth_web: - dependency: "direct main" - description: - name: firebase_auth_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.2" firebase_core: - dependency: "direct main" + dependency: transitive description: name: firebase_core url: "https://pub.dartlang.org" @@ -421,20 +351,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.0.3" - firebase_storage: - dependency: "direct main" - description: - name: firebase_storage - url: "https://pub.dartlang.org" - source: hosted - version: "5.0.1" - firebase_storage_platform_interface: - dependency: transitive - description: - name: firebase_storage_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" fixnum: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3b7ab800..1e0b6734 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,14 +62,9 @@ dependencies: #chart fl_chart: ^0.12.1 - # Firebase - firebase_core: ^0.5.2 - firebase_analytics: ^6.2.0 - firebase_auth: 0.18.3 - firebase_auth_web: ^0.3.2 - firebase_storage: ^5.0.1 + # Firebase firebase_messaging: ^7.0.3 - cloud_firestore: ^0.14.3 + #GIF image flutter_gifimage: ^1.0.1 From 6b0e87ce55210055c6695b6ddb61811cc8d76363 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 27 Jan 2021 13:18:51 +0200 Subject: [PATCH 06/29] bugs fix --- .../medical-file/medical_file_page.dart | 4 + .../entity_list_checkbox_search_widget.dart | 81 +++++++++++-------- lib/screens/procedures/procedure_screen.dart | 9 +-- 3 files changed, 54 insertions(+), 40 deletions(-) diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index a5fab36e..c4553c07 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -34,6 +34,10 @@ class _MedicalFilePageState extends State { child: SingleChildScrollView( child: Container( child: Column( + // mainAxisAlignment: model.medicalFileList.length != 0 && + // model.medicalFileList != null + // ? MainAxisAlignment.start + // : MainAxisAlignment.center, children: [ PatientPageHeaderWidget(patient), Divider( diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index 4f236a4b..7036bc0d 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; @@ -71,43 +72,53 @@ class _EntityListCheckboxSearchWidgetState SizedBox( height: 15, ), - Column( - children: items.map((historyInfo) { - return Column( - children: [ - Row( - children: [ - Checkbox( - value: widget - .isEntityListSelected(historyInfo), - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget.removeHistory(historyInfo); - } else { - widget.addHistory(historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts(historyInfo.procedureName, - variant: "bodyText", - bold: true, - color: Colors.black), + items.length != 0 + ? Column( + children: items.map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: widget.isEntityListSelected( + historyInfo), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts( + historyInfo.procedureName, + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], ), - ), - ], + DividerWithSpacesAround(), + ], + ); + }).toList(), + ) + : Center( + child: Container( + child: AppText( + "There's no procedures for this category", + color: Color(0xFFB9382C)), ), - DividerWithSpacesAround(), - ], - ); - }).toList(), - ), + ) ], ), )), diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 05850316..d6d38a54 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -438,11 +438,10 @@ class _ProcedureScreenState extends State { 0.10, child: AppText( - model - .procedureList[0] - .entityList[index] - .remarks - .toString(), + model.procedureList[0].entityList[index].remarks != + null + ? model.procedureList[0].entityList[index].remarks.toString() + : "", fontSize: 11.5, ), From c2df29102917555134b2db7d65769088465162d2 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 28 Jan 2021 09:18:49 +0200 Subject: [PATCH 07/29] DA - 286 Fix --- lib/config/localized_values.dart | 9 +++- .../viewModel/patient-referral-viewmodel.dart | 50 +++++++++++++------ .../referral/my-referral-detail-screen.dart | 2 +- .../referral/referred-patient-screen.dart | 2 +- lib/util/translations_delegate_base.dart | 5 ++ .../patient-referral-item-widget.dart | 23 +++++---- pubspec.lock | 16 +++--- 7 files changed, 71 insertions(+), 36 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 06aadac0..6b6b6939 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -686,6 +686,11 @@ const Map> localizedValues = { 'months': {'en': "Months", 'ar': "أشهر"}, 'years': {'en': "Years", 'ar': "سنين"}, 'hr': {'en': "HR", 'ar': "س"}, - 'min': {'en': "Min", 'ar': "د"} - // 'icd': {'en': "ICD", 'ar': " "} + 'min': {'en': "Min", 'ar': "د"}, + 'referralStatusHold': {'en': "Hold", 'ar': "معلق"}, + 'referralStatusActive': {'en': "Active", 'ar': "نشط"}, + 'referralStatusCancelled': {'en': "Cancelled", 'ar': "ملغاة"}, + 'referralStatusCompleted': {'en': "Completed", 'ar': "مكتمل"}, + 'referralStatusNotSeen': {'en': "NotSeen", 'ar': "لم يرى"}, + // 'icd': {'en': "ICD", 'ar': " "}, }; diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index b9987601..5771d1db 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -8,6 +8,8 @@ import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/cupertino.dart'; import '../../locator.dart'; @@ -40,8 +42,8 @@ class PatientReferralViewModel extends BaseViewModel { error = _referralPatientService.error; setState(ViewState.Error); } else { - if(patientReferral.length == 0){ - await getMasterLookup(MasterKeysService.physiotherapyGoals); + if (patientReferral.length == 0) { + await getMasterLookup(MasterKeysService.physiotherapyGoals); } else { setState(ViewState.Idle); } @@ -126,7 +128,8 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future responseReferral(PendingReferral pendingReferral, bool isAccepted) async { + Future responseReferral( + PendingReferral pendingReferral, bool isAccepted) async { setState(ViewState.Busy); await _referralPatientService.responseReferral(pendingReferral, isAccepted); if (_referralPatientService.hasError) { @@ -136,14 +139,11 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future makeReferral(PatiantInformtion patient, - String isoStringDate, - int projectID, - int clinicID, - int doctorID, - String remarks) async { + Future makeReferral(PatiantInformtion patient, String isoStringDate, + int projectID, int clinicID, int doctorID, String remarks) async { setState(ViewState.Busy); - await _referralPatientService.makeReferral(patient, isoStringDate, projectID, clinicID, doctorID, remarks); + await _referralPatientService.makeReferral( + patient, isoStringDate, projectID, clinicID, doctorID, remarks); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.Error); @@ -152,18 +152,40 @@ class PatientReferralViewModel extends BaseViewModel { } } - Future getPatientDetails(String fromDate, String toDate, int patientMrn, int appointmentNo) async { + Future getPatientDetails( + String fromDate, String toDate, int patientMrn, int appointmentNo) async { setState(ViewState.Busy); - await _referralPatientService.getPatientArrivalList(toDate, fromDate: fromDate, patientMrn: patientMrn, appointmentNo: appointmentNo); + await _referralPatientService.getPatientArrivalList(toDate, + fromDate: fromDate, + patientMrn: patientMrn, + appointmentNo: appointmentNo); if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.Error); + error = _referralPatientService.error; + setState(ViewState.Error); } else { setState(ViewState.Idle); } } + /* * model .getPatientArrivalList()*/ + + String getReferralStatusNameByCode(int statusCode, BuildContext context) { + switch (statusCode) { + case 1: + return TranslationBase.of(context).referralStatusHold; + case 2: + return TranslationBase.of(context).referralStatusActive; + case 4: + return TranslationBase.of(context).referralStatusCancelled; + case 46: + return TranslationBase.of(context).referralStatusCompleted; + case 63: + return TranslationBase.of(context).referralStatusNotSeen; + default: + return "-"; + } + } } diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 9d3c9f00..b76df591 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -42,7 +42,7 @@ class MyReferralDetailScreen extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, - body: model.patientArrivalList != null + body: model.patientArrivalList != null && model.patientArrivalList.length > 0 ? Column( children: [ Expanded( diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index c1880908..4dc0e647 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -48,7 +48,7 @@ class ReferredPatientScreen extends StatelessWidget { patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", referralStatus: - "${model.getReferredPatientItem(index).referralStatus}", + "${model.getReferralStatusNameByCode(model.getReferredPatientItem(index).referralStatus, context)}", isReferredTo: true, isSameBranch: model .getReferredPatientItem(index) diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index fe2526bc..71409538 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1060,6 +1060,11 @@ String get ICDName => String get min => localizedValues['min'][locale.languageCode]; String get months => localizedValues['months'][locale.languageCode]; String get years => localizedValues['years'][locale.languageCode]; + String get referralStatusHold => localizedValues['referralStatusHold'][locale.languageCode]; + String get referralStatusActive => localizedValues['referralStatusActive'][locale.languageCode]; + String get referralStatusCancelled => localizedValues['referralStatusCancelled'][locale.languageCode]; + String get referralStatusCompleted => localizedValues['referralStatusCompleted'][locale.languageCode]; + String get referralStatusNotSeen => localizedValues['referralStatusNotSeen'][locale.languageCode]; String get patientName => localizedValues['patient-name'][locale.languageCode]; diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index aaaa4e81..db45a015 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -70,7 +70,7 @@ class PatientReferralItemWidget extends StatelessWidget { isReferredTo ? "${TranslationBase.of(context).referTo}: " : "${TranslationBase.of(context).referredFrom}: ", - color: Colors.black, + color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 12, ), @@ -78,8 +78,8 @@ class PatientReferralItemWidget extends StatelessWidget { isSameBranch ? TranslationBase.of(context).sameBranch : TranslationBase.of(context).otherBranch, - color: Colors.grey, - fontWeight: FontWeight.normal, + color: Colors.black, + fontWeight: FontWeight.bold, fontSize: 12, ), ], @@ -116,23 +116,26 @@ class PatientReferralItemWidget extends StatelessWidget { children: [ AppText( "${TranslationBase.of(context).clinic}: ", - color: Colors.black, + color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 12, ), AppText( clinicDescription, - color: Colors.grey, - fontWeight: FontWeight.normal, + color: Colors.black, + fontWeight: FontWeight.bold, fontSize: 12, ), ], ), + SizedBox( + height: 8, + ), Row( children: [ AppText( "${TranslationBase.of(context).patientName}: ", - color: Colors.black, + color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 12, ), @@ -140,7 +143,7 @@ class PatientReferralItemWidget extends StatelessWidget { patientName??'-', color: Colors.black, fontWeight: FontWeight.bold, - fontSize: 16, + fontSize: 12, ), ], ), @@ -157,8 +160,8 @@ class PatientReferralItemWidget extends StatelessWidget { ), AppText( remark, - color: Colors.grey, - fontWeight: FontWeight.normal, + color: Colors.black, + fontWeight: FontWeight.bold, fontSize: 12, ), ], diff --git a/pubspec.lock b/pubspec.lock index 8a1531c1..e51c9489 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -105,7 +105,7 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "1.10.13" + version: "1.11.0" build_runner_core: dependency: transitive description: @@ -329,21 +329,21 @@ packages: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.2" + version: "0.5.3" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "0.2.1+1" firebase_messaging: dependency: "direct main" description: @@ -510,7 +510,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.1" + version: "0.6.2" json_annotation: dependency: transitive description: @@ -706,7 +706,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.3.2+4" + version: "4.3.3" pub_semver: dependency: transitive description: @@ -776,7 +776,7 @@ packages: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" + version: "0.0.2+2" shelf: dependency: transitive description: @@ -935,7 +935,7 @@ packages: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" win32: dependency: transitive description: From b9b5ec09e45f1667504438096afb7b06c6c95d45 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 28 Jan 2021 09:54:03 +0200 Subject: [PATCH 08/29] fix : DA-248 --- .../patients/profile/profile_medical_info_widget.dart | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index e839a0b9..b5b60619 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -8,7 +8,6 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -140,14 +139,6 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).myReferral, nameLine2: TranslationBase.of(context).patient, icon: 'note.png'), - if (selectedPatientType != 0 && selectedPatientType != 5) - PatientProfileButton( - key: key, - patient: patient, - route: PATIENT_ORDERS, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).list, - icon: 'radiology-1.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, From a64088320f26ac823947160ca82c1d28f6da2ea9 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 28 Jan 2021 10:33:12 +0200 Subject: [PATCH 09/29] DA-259 translation bug --- lib/config/localized_values.dart | 1 + .../patients/profile/referral/referred-patient-screen.dart | 2 +- lib/util/translations_delegate_base.dart | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 6b6b6939..47e7ab39 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -52,6 +52,7 @@ const Map> localizedValues = { 'referPatient': {'en': 'Referral Patient', 'ar': 'إحالة مريض'}, 'myReferral': {'en': 'My Referral', 'ar': 'إحالة'}, 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, + 'referredPatient': {'en': 'Referred Patient', 'ar': 'المرضى المحالين'}, 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, 'middleName': {'en': 'Middle Name', 'ar': 'اسم الاب'}, 'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'}, diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 4dc0e647..a842e6ae 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -14,7 +14,7 @@ class ReferredPatientScreen extends StatelessWidget { onModelReady: (model) => model.getMyReferredPatient(), builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).referPatient, + appBarTitle: TranslationBase.of(context).referredPatient, body: model.listMyReferredPatientModel == null || model.listMyReferredPatientModel.length == 0 ? Center( diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 71409538..77937a32 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -117,6 +117,8 @@ class TranslationBase { String get myReferredPatient => localizedValues['myReferredPatient'][locale.languageCode]; + String get referredPatient => + localizedValues['referredPatient'][locale.languageCode]; String get firstName => localizedValues['firstName'][locale.languageCode]; From b267342c038841a792e460763ef01dd45994887a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 28 Jan 2021 15:29:09 +0200 Subject: [PATCH 10/29] fixing issues --- .../prescription/prescription_screen.dart | 59 +- .../procedures/add-procedure-form.dart | 323 +++++++++++ lib/screens/procedures/procedure_screen.dart | 522 +----------------- lib/screens/procedures/update-procedure.dart | 209 +++++++ 4 files changed, 564 insertions(+), 549 deletions(-) create mode 100644 lib/screens/procedures/add-procedure-form.dart create mode 100644 lib/screens/procedures/update-procedure.dart diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 2b71ab8e..3dfd5bdc 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.da import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -248,61 +249,7 @@ class _NewPrescriptionScreenState extends State { child: Container( child: Column( children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + - ' ' + - patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - //if (model.prescriptionList.length > 0) - Row( - children: [ - AppText( - TranslationBase.of(context).age2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 5.0, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, - ), - ], - ) - ], - ), - ), + PatientPageHeaderWidget(patient), Divider( height: 1.0, thickness: 1.0, @@ -489,7 +436,7 @@ class _NewPrescriptionScreenState extends State { context) .size .height * - 0.295, + 0.3019, width: MediaQuery.of( context) .size diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart new file mode 100644 index 00000000..81452c63 --- /dev/null +++ b/lib/screens/procedures/add-procedure-form.dart @@ -0,0 +1,323 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; +import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:flutter/material.dart'; + +import 'entity_list_checkbox_search_widget.dart'; + +postProcedure( + {ProcedureViewModel model, + String remarks, + String orderType, + PatiantInformtion patient, + List entityList}) async { + PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); + List controls = List(); + List controlsProcedure = List(); + + postProcedureReqModel.appointmentNo = patient.appointmentNo; + + postProcedureReqModel.episodeID = patient.episodeNo; + postProcedureReqModel.patientMRN = patient.patientMRN; + entityList.forEach((element) { + controls.add( + Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks), + ); + controls.add( + Controls( + code: "ordertype", + controlValue: + orderType.toString().isNotEmpty ? orderType.toString() : '1'), + ); + }); + + entityList.forEach((element) { + controlsProcedure.add(Procedures( + category: element.categoryID, + procedure: element.procedureId, + controls: controls)); + }); + postProcedureReqModel.procedures = controlsProcedure; + + await model.postProcedure(postProcedureReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been added'); + } +} + +void addSelectedProcedure( + context, ProcedureViewModel model, PatiantInformtion patient) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return AddSelectedProcedure( + model: model, + patient: patient, + ); + }); +} + +class AddSelectedProcedure extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + + const AddSelectedProcedure({Key key, this.model, this.patient}) + : super(key: key); + @override + _AddSelectedProcedureState createState() => + _AddSelectedProcedureState(patient: patient, model: model); +} + +class _AddSelectedProcedureState extends State { + int selectedType; + ProcedureViewModel model; + PatiantInformtion patient; + _AddSelectedProcedureState({this.patient, this.model}); + TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + List entityList = List(); + dynamic selectedCategory; + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + onModelReady: (model) => model.getCategory(), + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: (BuildContext context, ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .selectProcedures + .toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 10.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.categoryList != null && + model.categoryList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.categoryList, + attributeName: 'categoryName', + attributeValueId: 'categoryId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + selectedCategory = selectedValue; + model.getProcedureCategory( + categoryName: selectedCategory[ + 'categoryName']); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + //model.getProcedureCategory(); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .procedureCategorise, + selectedCategory != null + ? selectedCategory['categoryName'] + : null, + true, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: + widget.model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ), + ), + SizedBox( + height: 15.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Row( + children: [ + AppText( + TranslationBase.of(context).orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 1, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).regular), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 0, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).urgent), + ], + ), + ), + SizedBox( + height: 15.0, + ), + TextFields( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 50.0, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addSelectedProcedures, + onPressed: () { + Navigator.pop(context); + postProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + model: widget.model, + remarks: remarksController.text); + }, + ), + ], + ), + ), + ], + ) + ], + ), + ), + ), + ); + }), + ), + ); + } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index d6d38a54..9fb8510c 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -11,10 +11,13 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; +import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -58,57 +61,7 @@ class _ProcedureScreenState extends State { child: Container( child: Column( children: [ - Padding( - padding: EdgeInsets.all(12.0), - child: Row( - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).age2, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 5.0, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, - ), - ], - ) - ], - ), - ), + PatientPageHeaderWidget(patient), Divider( height: 1.0, thickness: 1.0, @@ -320,7 +273,7 @@ class _ProcedureScreenState extends State { context) .size .height * - 0.2, + 0.21, width: MediaQuery.of( context) .size @@ -376,6 +329,30 @@ class _ProcedureScreenState extends State { ), ], ), + Row( + children: [ + AppText( + 'Order.NO' + + " : ", + fontWeight: + FontWeight + .w700, + fontSize: + 15.0, + ), + AppText( + model + .procedureList[ + 0] + .entityList[ + index] + .orderNo + .toString(), + fontSize: + 13.0, + ), + ], + ), Row( children: [ Container( @@ -580,445 +557,4 @@ class _ProcedureScreenState extends State { )), ); } - - void updateProcedureForm(context, - {String procedureName, - PatiantInformtion patient, - String procedureId, - String remarks, - String categoreId}) { - ProcedureViewModel model = ProcedureViewModel(); - TextEditingController remarksController = TextEditingController(); - TextEditingController orderController = TextEditingController(); - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return Container( - height: MediaQuery.of(context).size.height * 0.55, - child: Form( - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - procedureName.toUpperCase(), - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 30.0, - ), - Container( - child: Row( - children: [ - AppText(TranslationBase.of(context).orderType), - Radio( - activeColor: Color(0xFFB9382C), - value: 0, - groupValue: selectedType, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).regular), - Radio( - activeColor: Color(0xFFB9382C), - groupValue: selectedType, - value: 1, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).urgent), - ], - ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: remarks, - controller: remarksController, - maxLines: 5, - minLines: 3, - ), - ), - SizedBox( - height: 100.0, - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .updateProcedure - .toUpperCase(), - onPressed: () { - Navigator.pop(context); - updateProcedure( - categorieId: categoreId, - procedureId: procedureId, - patient: patient, - model: model, - remarks: remarksController.text); - // authorizationForm(context); - }, - ), - ], - ), - ), - ], - ), - ), - )); - }); - } -} - -postProcedure( - {ProcedureViewModel model, - String remarks, - PatiantInformtion patient, - List entityList}) async { - PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - List controls = List(); - List controlsProcedure = List(); - - postProcedureReqModel.appointmentNo = patient.appointmentNo; - - postProcedureReqModel.episodeID = patient.episodeNo; - postProcedureReqModel.patientMRN = patient.patientMRN; - entityList.forEach((element) { - controls.add( - Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks), - ); - }); - - entityList.forEach((element) { - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); - }); - postProcedureReqModel.procedures = controlsProcedure; - - await model.postProcedure(postProcedureReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been added'); - } -} - -updateProcedure( - {ProcedureViewModel model, - String remarks, - String procedureId, - PatiantInformtion patient, - String categorieId}) async { - UpdateProcedureRequestModel updateProcedureReqModel = - new UpdateProcedureRequestModel(); - List controls = List(); - ProcedureDetail controlsProcedure = new ProcedureDetail(); - - updateProcedureReqModel.appointmentNo = patient.appointmentNo; - - updateProcedureReqModel.episodeID = patient.episodeNo; - updateProcedureReqModel.patientMRN = patient.patientMRN; - updateProcedureReqModel.lineItemNo = 1; - updateProcedureReqModel.orderNo = 0; - - controls.add( - Controls(code: "02", controlValue: remarks.isEmpty ? '' : remarks), - ); - - controlsProcedure.procedure = procedureId; - controlsProcedure.category = categorieId; - controlsProcedure.controls = controls; - - // controlsProcedure.add(ProcedureDetail( - // category: categorieId, procedure: procedureId, controls: controls)); - updateProcedureReqModel.procedureDetail = controlsProcedure; - - await model.updateProcedure( - updateProcedureRequestModel: updateProcedureReqModel, - mrn: patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('procedure has been updated'); - } -} - -void addSelectedProcedure( - context, ProcedureViewModel model, PatiantInformtion patient) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext bc) { - return AddSelectedProcedure( - model: model, - patient: patient, - ); - }); -} - -class AddSelectedProcedure extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - - const AddSelectedProcedure({Key key, this.model, this.patient}) - : super(key: key); - @override - _AddSelectedProcedureState createState() => - _AddSelectedProcedureState(patient: patient, model: model); -} - -class _AddSelectedProcedureState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - _AddSelectedProcedureState({this.patient, this.model}); - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - dynamic selectedCategory; - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getCategory(), - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - NetworkBaseView( - baseViewModel: model, - child: DraggableScrollableSheet( - minChildSize: 0.90, - initialChildSize: 0.95, - maxChildSize: 1.0, - builder: (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 1.20, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .selectProcedures - .toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: 10.0, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.categoryList != null && - model.categoryList.length > 0 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.categoryList, - attributeName: 'categoryName', - attributeValueId: 'categoryId', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - selectedCategory = selectedValue; - model.getProcedureCategory( - categoryName: selectedCategory[ - 'categoryName']); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - //model.getProcedureCategory(); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .procedureCategorise, - selectedCategory != null - ? selectedCategory['categoryName'] - : null, - true, - suffixIcon: Icon( - Icons.search, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - if (widget.model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - widget.model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => - isEntityListSelected(master), - ), - ), - SizedBox( - height: 15.0, - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Row( - children: [ - AppText( - TranslationBase.of(context).orderType), - Radio( - activeColor: Color(0xFFB9382C), - value: 0, - groupValue: selectedType, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).regular), - Radio( - activeColor: Color(0xFFB9382C), - groupValue: selectedType, - value: 1, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).urgent), - ], - ), - ), - SizedBox( - height: 15.0, - ), - TextFields( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 3, - maxLines: 5, - ), - SizedBox( - height: 50.0, - ), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .addSelectedProcedures, - onPressed: () { - Navigator.pop(context); - postProcedure( - entityList: entityList, - patient: patient, - model: widget.model, - remarks: remarksController.text); - }, - ), - ], - ), - ), - ], - ) - ], - ), - ), - ), - ); - }), - ), - ); - } - - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } } diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart new file mode 100644 index 00000000..0b0a0c5a --- /dev/null +++ b/lib/screens/procedures/update-procedure.dart @@ -0,0 +1,209 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +void updateProcedureForm(context, + {String procedureName, + PatiantInformtion patient, + String orderType, + String procedureId, + String remarks, + String categoreId}) { + ProcedureViewModel model = ProcedureViewModel(); + TextEditingController remarksController = TextEditingController(); + TextEditingController orderController = TextEditingController(); + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext bc) { + return UpdateProcedureWidget( + procedureName: procedureName, + remarks: remarks, + remarksController: remarksController, + patient: patient, + model: model, + procedureId: procedureId, + categoryId: categoreId, + ); + }); +} + +class UpdateProcedureWidget extends StatefulWidget { + final PatiantInformtion patient; + final ProcedureViewModel model; + final String procedureName; + final String remarks; + final TextEditingController remarksController; + final String procedureId; + final String categoryId; + + UpdateProcedureWidget( + {this.model, + this.procedureName, + this.remarks, + this.remarksController, + this.patient, + this.procedureId, + this.categoryId}); + @override + _UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState(); +} + +class _UpdateProcedureWidgetState extends State { + int selectedType = 0; + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + @override + Widget build(BuildContext context) { + return StatefulBuilder(builder: + (BuildContext context, StateSetter setState /*You can rename this!*/) { + return Container( + height: MediaQuery.of(context).size.height * 0.55, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.procedureName.toUpperCase(), + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 30.0, + ), + Container( + child: Row( + children: [ + AppText(TranslationBase.of(context).orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 0, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).urgent), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 1, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).regular), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: + Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: widget.remarks, + controller: widget.remarksController, + maxLines: 5, + minLines: 3, + ), + ), + SizedBox( + height: 100.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .updateProcedure + .toUpperCase(), + onPressed: () { + Navigator.pop(context); + updateProcedure( + orderType: selectedType.toString(), + categorieId: widget.categoryId, + procedureId: widget.procedureId, + patient: widget.patient, + model: widget.model, + remarks: widget.remarksController.text); + // authorizationForm(context); + }, + ), + ], + ), + ), + ], + ), + ), + )); + }); + } + + updateProcedure( + {ProcedureViewModel model, + String remarks, + String orderType, + String procedureId, + PatiantInformtion patient, + String categorieId}) async { + UpdateProcedureRequestModel updateProcedureReqModel = + new UpdateProcedureRequestModel(); + List controls = List(); + ProcedureDetail controlsProcedure = new ProcedureDetail(); + + updateProcedureReqModel.appointmentNo = patient.appointmentNo; + + updateProcedureReqModel.episodeID = patient.episodeNo; + updateProcedureReqModel.patientMRN = patient.patientMRN; + updateProcedureReqModel.lineItemNo = 1; + updateProcedureReqModel.orderNo = 0; + + controls.add( + Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks), + ); + controls.add( + Controls(code: "ordertype", controlValue: "1"), + ); + + controlsProcedure.procedure = procedureId; + controlsProcedure.category = categorieId; + controlsProcedure.controls = controls; + + // controlsProcedure.add(ProcedureDetail( + // category: categorieId, procedure: procedureId, controls: controls)); + updateProcedureReqModel.procedureDetail = controlsProcedure; + + await model.updateProcedure( + updateProcedureRequestModel: updateProcedureReqModel, + mrn: patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + model.getProcedure(mrn: patient.patientMRN); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('procedure has been updated'); + } + } +} From de1d0283d234bd5a7c371ac7daad4bcda4624237 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 28 Jan 2021 15:47:08 +0200 Subject: [PATCH 11/29] some lables and translation changes and add search functionality for ListSelectDialog --- lib/config/localized_values.dart | 3 + .../referral/my-referral-detail-screen.dart | 15 ++-- .../referral/my-referral-patient-screen.dart | 14 ++-- .../referral/refer-patient-screen.dart | 73 ++++--------------- .../referral/referred-patient-screen.dart | 8 ++ lib/util/translations_delegate_base.dart | 4 + .../patient-referral-item-widget.dart | 47 +++++++++++- .../shared/dialogs/dailog-list-select.dart | 65 ++++++++++++++--- 8 files changed, 147 insertions(+), 82 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 47e7ab39..23132079 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -53,6 +53,7 @@ const Map> localizedValues = { 'myReferral': {'en': 'My Referral', 'ar': 'إحالة'}, 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, 'referredPatient': {'en': 'Referred Patient', 'ar': 'المرضى المحالين'}, + 'referredOn': {'en': 'referred On : ', 'ar': ' : تمت الإحالة في'}, 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, 'middleName': {'en': 'Middle Name', 'ar': 'اسم الاب'}, 'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'}, @@ -693,5 +694,7 @@ const Map> localizedValues = { 'referralStatusCancelled': {'en': "Cancelled", 'ar': "ملغاة"}, 'referralStatusCompleted': {'en': "Completed", 'ar': "مكتمل"}, 'referralStatusNotSeen': {'en': "NotSeen", 'ar': "لم يرى"}, + 'clinicSearch': {'en': "Search Clinic", 'ar': "بحث عن عيادة"}, + 'doctorSearch': {'en': "Search Doctor", 'ar': "بحث عن طبيب"}, // 'icd': {'en': "ICD", 'ar': " "}, }; diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index b76df591..433fe232 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -42,7 +42,8 @@ class MyReferralDetailScreen extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, - body: model.patientArrivalList != null && model.patientArrivalList.length > 0 + body: model.patientArrivalList != null && + model.patientArrivalList.length > 0 ? Column( children: [ Expanded( @@ -77,6 +78,7 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), PatientReferralItemWidget( + "${pendingReferral.patientID}", patientName: pendingReferral.patientName, referralStatus: null, isReferredTo: false, @@ -86,6 +88,7 @@ class MyReferralDetailScreen extends StatelessWidget { pendingReferral.referredByDoctorInfo, clinicDescription: null, remark: pendingReferral.remarksFromSource, + referredOn: pendingReferral.referredOn, ), SizedBox( child: GridView.count( @@ -147,8 +150,9 @@ class MyReferralDetailScreen extends StatelessWidget { hPadding: 8, vPadding: 12, handler: () async { - await model.responseReferral(pendingReferral, true); - if(model.state == ViewState.ErrorLocal){ + await model.responseReferral( + pendingReferral, true); + if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } }, @@ -166,8 +170,9 @@ class MyReferralDetailScreen extends StatelessWidget { hPadding: 8, vPadding: 12, handler: () async { - await model.responseReferral(pendingReferral, true); - if(model.state == ViewState.ErrorLocal){ + await model.responseReferral( + pendingReferral, true); + if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } }, diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index 311e2f12..ab2beaf8 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -23,8 +23,7 @@ class MyReferralPatientScreen extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, - body: model.pendingReferral == null || - model.pendingReferral.length == 0 + body: model.pendingReferral == null || model.pendingReferral.length == 0 ? Center( child: AppText( TranslationBase.of(context).referralEmptyMsg, @@ -62,6 +61,7 @@ class MyReferralPatientScreen extends StatelessWidget { ...List.generate( model.pendingReferral.length, (index) => PatientReferralItemWidget( + "${model.pendingReferral[index].patientID}", patientName: model.pendingReferral[index].patientName, referralStatus: null, isReferredTo: false, @@ -72,13 +72,13 @@ class MyReferralPatientScreen extends StatelessWidget { clinicDescription: null, remark: model.pendingReferral[index].remarksFromSource, + referredOn: model.pendingReferral[index].referredOn, infoIcon: InkWell( onTap: () { - Navigator.of(context).pushNamed( - MY_REFERRAL_DETAIL, - arguments: { - 'referral': model.pendingReferral[index] - }); + Navigator.of(context) + .pushNamed(MY_REFERRAL_DETAIL, arguments: { + 'referral': model.pendingReferral[index] + }); }, child: Icon( Icons.info_outline, diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 04eba96e..a3d74430 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -1,17 +1,14 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; -import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; @@ -20,8 +17,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; -import '../../../QR_reader_screen.dart'; - class PatientMakeReferralScreen extends StatefulWidget { // previous design page is: ReferPatientScreen @override @@ -96,6 +91,7 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? ReferralForm(model, screenSize) : PatientReferralItemWidget( + "${model.patientReferral[0].patientID}", patientName: model.patientReferral[0].patientName, referralStatus: "${model.patientReferral[0].referralStatus}", @@ -105,7 +101,9 @@ class _PatientMakeReferralScreenState extends State { referralDoctorName: model.patientReferral[0].referredByDoctorInfo, clinicDescription: null, - remark: model.patientReferral[0].remarksFromSource), + remark: model.patientReferral[0].remarksFromSource, + referredOn: model.patientReferral[0].referredOn, + ), ], ), if (model.patientReferral.length == 0) @@ -201,7 +199,7 @@ class _PatientMakeReferralScreenState extends State { } : null, child: TextField( - decoration: textFieldSelectorDecoration( + decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).referTo, _referTo != null ? _referTo['name'] : null, true), @@ -248,7 +246,7 @@ class _PatientMakeReferralScreenState extends State { } : null, child: TextField( - decoration: textFieldSelectorDecoration( + decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).branch, _selectedBranch != null ? _selectedBranch['facilityName'] @@ -272,6 +270,8 @@ class _PatientMakeReferralScreenState extends State { list: model.clinicsList, attributeName: 'ClinicDescription', attributeValueId: 'ClinicID', + usingSearch: true, + hintSearchText: TranslationBase.of(context).clinicSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { @@ -296,7 +296,7 @@ class _PatientMakeReferralScreenState extends State { } : null, child: TextField( - decoration: textFieldSelectorDecoration( + decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).clinic, _selectedClinic != null ? _selectedClinic['ClinicDescription'] @@ -320,6 +320,8 @@ class _PatientMakeReferralScreenState extends State { list: model.doctorsList, attributeName: 'DoctorName', attributeValueId: 'DoctorID', + usingSearch: true, + hintSearchText: TranslationBase.of(context).doctorSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { @@ -337,7 +339,7 @@ class _PatientMakeReferralScreenState extends State { } : null, child: TextField( - decoration: textFieldSelectorDecoration( + decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).doctor, _selectedDoctor != null ? _selectedDoctor['DoctorName'] @@ -355,7 +357,7 @@ class _PatientMakeReferralScreenState extends State { child: InkWell( onTap: () => _selectDate(context, model), child: TextField( - decoration: textFieldSelectorDecoration( + decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).chooseAppointment, appointmentDate != null ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" @@ -374,7 +376,7 @@ class _PatientMakeReferralScreenState extends State { ), Container( child: TextField( - decoration: textFieldSelectorDecoration( + decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).remarks, null, false), enabled: true, controller: _remarksController, @@ -453,49 +455,4 @@ class _PatientMakeReferralScreenState extends State { });*/ } } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { - return BoxDecoration( - color: containerColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: borderColor, - width: 2.0, - )), - ); - } } diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index a842e6ae..323a9a9b 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -45,6 +46,7 @@ class ReferredPatientScreen extends StatelessWidget { ...List.generate( model.listMyReferredPatientModel.length, (index) => PatientReferralItemWidget( + "${model.getReferredPatientItem(index).patientId}", patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", referralStatus: @@ -62,6 +64,12 @@ class ReferredPatientScreen extends StatelessWidget { remark: model .getReferredPatientItem(index) .referringDoctorRemarks, + referredOn: model + .getReferredPatientItem(index) + .referralDate != + null + ? DateUtils.convertDateFromServerFormat(model.getReferredPatientItem(index).referralDate, "dd/MM/yyyy") + : null, ), ), ], diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 77937a32..4963484d 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -119,6 +119,8 @@ class TranslationBase { localizedValues['myReferredPatient'][locale.languageCode]; String get referredPatient => localizedValues['referredPatient'][locale.languageCode]; + String get referredOn => + localizedValues['referredOn'][locale.languageCode]; String get firstName => localizedValues['firstName'][locale.languageCode]; @@ -1067,6 +1069,8 @@ String get ICDName => String get referralStatusCancelled => localizedValues['referralStatusCancelled'][locale.languageCode]; String get referralStatusCompleted => localizedValues['referralStatusCompleted'][locale.languageCode]; String get referralStatusNotSeen => localizedValues['referralStatusNotSeen'][locale.languageCode]; + String get clinicSearch => localizedValues['clinicSearch'][locale.languageCode]; + String get doctorSearch => localizedValues['doctorSearch'][locale.languageCode]; String get patientName => localizedValues['patient-name'][locale.languageCode]; diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index db45a015..ab89ab33 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -4,15 +4,18 @@ import 'package:flutter/material.dart'; class PatientReferralItemWidget extends StatelessWidget { final String patientName; + final String patientID; final String referralStatus; final isReferredTo; final isSameBranch; final String referralDoctorName; final String clinicDescription; final String remark; + final String referredOn; final Widget infoIcon; - PatientReferralItemWidget({ + PatientReferralItemWidget( + this.patientID, { this.patientName, this.referralStatus, this.isReferredTo = false, @@ -20,6 +23,7 @@ class PatientReferralItemWidget extends StatelessWidget { this.referralDoctorName, this.clinicDescription, this.remark, + this.referredOn, this.infoIcon, }); @@ -35,7 +39,6 @@ class PatientReferralItemWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (referralStatus != null) Row( children: [ @@ -131,6 +134,25 @@ class PatientReferralItemWidget extends StatelessWidget { SizedBox( height: 8, ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).patientID}: ", + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + patientID ?? '-', + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ], + ), + SizedBox( + height: 8, + ), Row( children: [ AppText( @@ -140,7 +162,7 @@ class PatientReferralItemWidget extends StatelessWidget { fontSize: 12, ), AppText( - patientName??'-', + patientName ?? '-', color: Colors.black, fontWeight: FontWeight.bold, fontSize: 12, @@ -166,6 +188,25 @@ class PatientReferralItemWidget extends StatelessWidget { ), ], ), + SizedBox( + height: 8, + ), + Row( + children: [ + AppText( + TranslationBase.of(context).referredOn, + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + referredOn ?? '-', + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ], + ), SizedBox( height: 16, ), diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index b6df1f6f..f972e790 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -2,6 +2,8 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; class ListSelectDialog extends StatefulWidget { @@ -12,24 +14,32 @@ class ListSelectDialog extends StatefulWidget { final Function(dynamic) okFunction; dynamic selectedValue; final Widget searchWidget; + final bool usingSearch; + final String hintSearchText; - ListSelectDialog( - {@required this.list, - @required this.attributeName, - @required this.attributeValueId, - @required this.okText, - @required this.okFunction, - this.searchWidget}); + ListSelectDialog({ + @required this.list, + @required this.attributeName, + @required this.attributeValueId, + @required this.okText, + @required this.okFunction, + this.searchWidget, + this.usingSearch = false, + this.hintSearchText, + }); @override _ListSelectDialogState createState() => _ListSelectDialogState(); } class _ListSelectDialogState extends State { + List items = List(); + @override void initState() { - super.initState(); widget.selectedValue = widget.selectedValue ?? widget.list[0]; + items.addAll(widget.list); + super.initState(); } @override @@ -69,7 +79,21 @@ class _ListSelectDialogState extends State { child: Column( children: [ if (widget.searchWidget != null) widget.searchWidget, - ...widget.list + if(widget.usingSearch) + Container( + height: MediaQuery.of(context).size.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + widget.hintSearchText ?? TranslationBase + .of(context) + .search, null, false, suffixIcon: Icon(Icons.search,)), + enabled: true, + keyboardType: TextInputType.text, + onChanged: (value) { + filterSearchResults(value); + }, + )), + ...items .map((item) => RadioListTile( title: Text("${item[widget.attributeName].toString()}"), groupValue: widget.selectedValue[widget.attributeValueId] @@ -95,4 +119,27 @@ class _ListSelectDialogState extends State { static closeAlertDialog(BuildContext context) { Navigator.of(context).pop(); } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.list); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if ("${item[widget.attributeName].toString()}".toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.list); + }); + } + } } From 34692b94c27a7557432724099ab96e340004ef8b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 28 Jan 2021 17:22:21 +0200 Subject: [PATCH 12/29] fix : DA-264 --- lib/config/localized_values.dart | 3 +- lib/util/translations_delegate_base.dart | 3 + .../subjective/update_allergies_widget.dart | 2 + .../subjective/update_subjective_page.dart | 26 +- .../soap_update/update_assessment_page.dart | 6 +- .../soap_update/update_objective_page.dart | 2 + .../profile/soap_update/update_plan_page.dart | 3 + lib/widgets/shared/TextFields.dart | 220 ++++++++++------ lib/widgets/shared/new_text_Field.dart | 239 ++++++++++++++++++ 9 files changed, 411 insertions(+), 93 deletions(-) create mode 100644 lib/widgets/shared/new_text_Field.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 06aadac0..c045f330 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -686,6 +686,7 @@ const Map> localizedValues = { 'months': {'en': "Months", 'ar': "أشهر"}, 'years': {'en': "Years", 'ar': "سنين"}, 'hr': {'en': "HR", 'ar': "س"}, - 'min': {'en': "Min", 'ar': "د"} + 'min': {'en': "Min", 'ar': "د"}, + 'appointmentNumber': {'en': "Appointment Number", 'ar': "رقم الموعد"} // 'icd': {'en': "ICD", 'ar': " "} }; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index fe2526bc..a622a1b5 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1063,6 +1063,9 @@ String get ICDName => String get patientName => localizedValues['patient-name'][locale.languageCode]; + + String get appointmentNumber => + localizedValues['appointmentNumber'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 14718f4c..9e0e4e0e 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -410,6 +410,8 @@ class _AddAllergiesState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( + hasLabelText: remarkController.text != ''?true:false, + showLabelText: true, hintText: TranslationBase.of(context).remarks, fontSize: 13.5, // hintColor: Colors.black, diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index f4ad30ab..95c4063e 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -267,19 +267,21 @@ class _UpdateSubjectivePageState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( - hintText: TranslationBase - .of(context) + hasLabelText: complaintsController.text != '' + ? true + : false, + hintText: TranslationBase.of(context) .addChiefComplaints, fontSize: 13.5, // hintColor: Colors.black, + showLabelText: true, fontWeight: FontWeight.w600, maxLines: 25, minLines: 13, controller: complaintsController, validator: (value) { if (value == null || value == "") - return TranslationBase - .of(context) + return TranslationBase.of(context) .emptyMessage; else if (value.length < 25) return TranslationBase @@ -296,6 +298,10 @@ class _UpdateSubjectivePageState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( + hasLabelText: illnessController.text != '' + ? true + : false, + showLabelText: true, hintText: TranslationBase .of(context) .historyOfPresentIllness, @@ -322,17 +328,23 @@ class _UpdateSubjectivePageState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( - hintText: TranslationBase.of(context) + hasLabelText: medicationController.text != '' + ? true + : false, + showLabelText: true, + hintText: TranslationBase + .of(context) .currentMedications, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, - maxLines: 2, + maxLines: 23, minLines: 1, controller: medicationController, validator: (value) { if (value == null || value == "") - return TranslationBase.of(context) + return TranslationBase + .of(context) .emptyMessage; else return null; diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index 9c8eaf63..542d4196 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -569,9 +569,11 @@ class _AddAssessmentDetailsState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( - hintText: "Appointment Number", + hintText: TranslationBase.of(context).appointmentNumber, fontSize: 13.5, // hintColor: Colors.black, + hasLabelText: appointmentIdController.text != ''?true:false, + showLabelText: true, fontWeight: FontWeight.w600, readOnly: true, controller: appointmentIdController, @@ -735,6 +737,8 @@ class _AddAssessmentDetailsState extends State { fontWeight: FontWeight.w600, maxLines: 18, minLines: 5, + hasLabelText: remarkController.text != ''?true:false, + showLabelText: true, controller: remarkController, onChanged:(value) { widget.mySelectedAssessment.remark = remarkController.text; diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index adf1e3d2..93182207 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -319,6 +319,8 @@ class _UpdateObjectivePageState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( + hasLabelText: remarksController.text != ''?true:false, + showLabelText: true, hintText: TranslationBase.of(context).remarks, fontSize: 13.5, // hintColor: Colors.black, diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart index 04b2b73d..e1388ef1 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -137,6 +137,7 @@ class _UpdatePlanPageState extends State { margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( + hintText: TranslationBase .of(context) .addProgressNote, @@ -361,6 +362,8 @@ class _UpdatePlanPageState extends State { margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: TextFields( + hasLabelText: progressNoteController.text != ''?true:false, + showLabelText: true, hintText: TranslationBase.of(context).addProgressNote, fontSize: 13.5, // hintColor: Colors.black, diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index 20885eb3..8563bb41 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -74,7 +74,9 @@ class TextFields extends StatefulWidget { this.autoValidate = false, this.fillColor, this.hintColor, - this.onTapTextFields}) + this.hasBorder = true, + this.onTapTextFields, + this.hasLabelText = false, this.showLabelText= false}) : super(key: key); final String hintText; @@ -111,6 +113,9 @@ class TextFields extends StatefulWidget { final bool borderOnlyError; final Color hintColor; final Color fillColor; + final bool hasBorder; + final bool showLabelText; + bool hasLabelText; @override _TextFieldsState createState() => _TextFieldsState(); @@ -208,93 +213,140 @@ class _TextFieldsState extends State { offset: Offset(0.0, 13.0), blurRadius: focus ? 34.0 : 12.0) ]), - child: TextFormField( - onTap: widget.onTapTextFields, - keyboardAppearance: Theme.of(context).brightness, - scrollPhysics: BouncingScrollPhysics(), - autovalidate: widget.autoValidate, - textCapitalization: widget.textCapitalization, - onFieldSubmitted: widget.inputAction == TextInputAction.next - ? (widget.onSubmit != null - ? widget.onSubmit - : (val) { - _focusNode.nextFocus(); - }) - : widget.onSubmit, - textInputAction: widget.inputAction, - minLines: widget.minLines ?? 1, - maxLines: widget.maxLines ?? 1, - maxLengthEnforced: widget.maxLengthEnforced, - initialValue: widget.initialValue, - onChanged: widget.onChanged, - focusNode: _focusNode, - maxLength: widget.maxLength ?? null, - controller: widget.controller, - keyboardType: widget.keyboardType, - readOnly: _determineReadOnly(), - obscureText: widget.type == "password" && !view ? true : false, - autofocus: widget.autoFocus ?? false, - validator: widget.validator, - onSaved: widget.onSaved, - style: Theme.of(context) - .textTheme - .bodyText1 - .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), - inputFormatters: widget.keyboardType == TextInputType.phone - ? [ - WhitelistingTextInputFormatter.digitsOnly, - _mobileFormatter, - ] - : widget.inputFormatters, - decoration: InputDecoration( - counterText: "", - hintText: widget.hintText, - hintStyle: TextStyle( - fontSize: widget.fontSize, - fontWeight: widget.fontWeight, - color: widget.hintColor ?? Theme.of(context).hintColor, - ), - contentPadding: widget.padding != null - ? widget.padding - : EdgeInsets.symmetric( + child: Column( + children: [ + TextFormField( + onTap: widget.onTapTextFields, + keyboardAppearance: Theme.of(context).brightness, + scrollPhysics: BouncingScrollPhysics(), + autovalidate: widget.autoValidate, + textCapitalization: widget.textCapitalization, + onFieldSubmitted: widget.inputAction == TextInputAction.next + ? (widget.onSubmit != null + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) + : widget.onSubmit, + textInputAction: widget.inputAction, + minLines: widget.minLines ?? 1, + maxLines: widget.maxLines ?? 1, + maxLengthEnforced: widget.maxLengthEnforced, + initialValue: widget.initialValue, + onChanged: (value){ + if(widget.showLabelText) { + if((value== null || value =='' )) { + setState(() { + widget.hasLabelText = false; + }); + }else{ + setState(() { + widget.hasLabelText = true; + }); + } + } + + + widget.onChanged(value); + } , + focusNode: _focusNode, + maxLength: widget.maxLength ?? null, + controller: widget.controller, + keyboardType: widget.keyboardType, + readOnly: _determineReadOnly(), + obscureText: widget.type == "password" && !view ? true : false, + autofocus: widget.autoFocus ?? false, + validator: widget.validator, + onSaved: widget.onSaved, + style: Theme.of(context) + .textTheme + .bodyText1 + .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + inputFormatters: widget.keyboardType == TextInputType.phone + ? [ + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] + : widget.inputFormatters, + decoration: InputDecoration( + labelText: widget.hasLabelText ? widget.hintText : null, + labelStyle: TextStyle( + + fontSize: widget.fontSize, + fontWeight: widget.fontWeight, + color: widget.hintColor ?? Theme + .of(context) + .hintColor, + ), + counterText: "", + hintText: widget.hintText, + hintStyle: TextStyle( + fontSize: widget.fontSize, + fontWeight: widget.fontWeight, + color: widget.hintColor ?? Theme + .of(context) + .hintColor, + ), + contentPadding: widget.padding != null + ? widget.padding + : EdgeInsets.symmetric( vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, horizontal: 16.0), - filled: true, - fillColor: widget.bare - ? Colors.transparent - : Theme.of(context).backgroundColor, - suffixIcon: _buildSuffixIcon(), - prefixIcon: widget.prefixIcon, - errorStyle: TextStyle( - fontSize: 12.0, - fontWeight: widget.fontWeight, - height: widget.borderOnlyError ? 0.0 : null), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(widget.bare ? 0.0 : 0.5), - width: 1.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(widget.bare ? 0.0 : 0.5), - width: 1.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0), + filled: true, + fillColor: widget.bare + ? Colors.transparent + : Theme + .of(context) + .backgroundColor, + suffixIcon: _buildSuffixIcon(), + prefixIcon: widget.prefixIcon, + errorStyle: TextStyle( + fontSize: 12.0, + fontWeight: widget.fontWeight, + height: widget.borderOnlyError ? 0.0 : null), + errorBorder: OutlineInputBorder( + borderSide: widget.hasBorder ? BorderSide( + color: Theme + .of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0) : BorderSide( + color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder ? BorderRadius.circular( + widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0),), + focusedErrorBorder: OutlineInputBorder( + borderSide: widget.hasBorder ? BorderSide( + color: Theme + .of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: 1.0) : BorderSide( + color: Colors.transparent, width: 0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), + focusedBorder: OutlineInputBorder( + borderSide: widget.hasBorder ? BorderSide( + color: Colors.grey, width: 1.0) : BorderSide( + color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder ? BorderRadius.circular( + widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0),), + disabledBorder: OutlineInputBorder( + borderSide: widget.hasBorder ? BorderSide( + color: Colors.grey, width: 1.0) : BorderSide( + color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder ? BorderRadius.circular( + widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0)), + enabledBorder: OutlineInputBorder( + borderSide: widget.hasBorder ? BorderSide( + color: Colors.grey, width: 1.0) : BorderSide( + color: Colors.transparent, width: 0), + borderRadius: widget.hasBorder ? BorderRadius.circular( + widget.bare ? 0.0 : 8.0) : BorderRadius.circular(0.0), + ), + ), ), - ), + ], ), + )); } } diff --git a/lib/widgets/shared/new_text_Field.dart b/lib/widgets/shared/new_text_Field.dart new file mode 100644 index 00000000..ad9eb580 --- /dev/null +++ b/lib/widgets/shared/new_text_Field.dart @@ -0,0 +1,239 @@ +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class NumberTextInputFormatter extends TextInputFormatter { + @override + TextEditingValue formatEditUpdate( + TextEditingValue oldValue, TextEditingValue newValue) { + final int newTextLength = newValue.text.length; + int selectionIndex = newValue.selection.end; + int usedSubstringIndex = 0; + final StringBuffer newText = StringBuffer(); + if (newTextLength >= 1) { + newText.write('('); + if (newValue.selection.end >= 1) selectionIndex++; + } + if (newTextLength >= 4) { + newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); + if (newValue.selection.end >= 3) selectionIndex += 2; + } + if (newTextLength >= 7) { + newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); + if (newValue.selection.end >= 6) selectionIndex++; + } + if (newTextLength >= 11) { + newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); + if (newValue.selection.end >= 10) selectionIndex++; + } + // Dump the rest. + if (newTextLength >= usedSubstringIndex) + newText.write(newValue.text.substring(usedSubstringIndex)); + return TextEditingValue( + text: newText.toString(), + selection: TextSelection.collapsed(offset: selectionIndex), + ); + } +} + +final _mobileFormatter = NumberTextInputFormatter(); + +class NewTextFields extends StatefulWidget { + NewTextFields( + {Key key, + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly: false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.onTap, + this.fontSize = 16.0, + this.fontWeight = FontWeight.w700, + this.autoValidate = false, + this.hintColor,this.isEnabled=true}) + : super(key: key); + + final String hintText; + + // final String initialValue; + final String type; + final bool autoFocus; + final IconData suffixIcon; + final Color suffixIconColor; + final Icon prefixIcon; + final VoidCallback onTap; + final TextEditingController controller; + final TextInputType keyboardType; + final FormFieldValidator validator; + final Function onSaved; + final Function onSuffixTap; + final Function onChanged; + final Function onSubmit; + final bool readOnly; + final int maxLength; + final int minLines; + final int maxLines; + final bool maxLengthEnforced; + final bool bare; + final bool isEnabled; + final TextInputAction inputAction; + final double fontSize; + final FontWeight fontWeight; + final bool keepPadding; + final TextCapitalization textCapitalization; + final List inputFormatters; + final bool autoValidate; + final EdgeInsets padding; + final bool focus; + final bool borderOnlyError; + final Color hintColor; + final String initialValue; + @override + _NewTextFieldsState createState() => _NewTextFieldsState(); +} + +class _NewTextFieldsState extends State { + final FocusNode _focusNode = FocusNode(); + bool focus = false; + bool view = false; + + @override + void initState() { + super.initState(); + _focusNode.addListener(() { + setState(() { + focus = _focusNode.hasFocus; + }); + }); + } + + @override + void didUpdateWidget(NewTextFields oldWidget) { + if (widget.focus) _focusNode.requestFocus(); + super.didUpdateWidget(oldWidget); + } + + @override + void dispose() { + _focusNode.dispose(); + super.dispose(); + } + + + bool _determineReadOnly() { + if (widget.readOnly != null && widget.readOnly) { + _focusNode.unfocus(); + return true; + } else { + return false; + } + } + + @override + Widget build(BuildContext context) { + return AnimatedContainer( + duration: Duration(milliseconds: 300), + decoration:BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Container( + margin: EdgeInsets.only(top: 8), + + child: TextFormField( + enabled: widget.isEnabled, + initialValue: widget.initialValue, + keyboardAppearance: Theme.of(context).brightness, + scrollPhysics: BouncingScrollPhysics(), + autovalidate: widget.autoValidate, + textCapitalization: widget.textCapitalization, + onFieldSubmitted: widget.inputAction == TextInputAction.next + ? (widget.onSubmit != null + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) + : widget.onSubmit, + textInputAction: widget.inputAction, + minLines: widget.minLines ?? 1, + maxLines: widget.maxLines ?? 1, + maxLengthEnforced: widget.maxLengthEnforced, + onChanged: widget.onChanged, + focusNode: _focusNode, + maxLength: widget.maxLength ?? null, + controller: widget.controller, + keyboardType: widget.keyboardType, + readOnly: _determineReadOnly(), + obscureText: widget.type == "password" && !view ? true : false, + autofocus: widget.autoFocus ?? false, + validator: widget.validator, + onSaved: widget.onSaved, + + style: Theme.of(context) + .textTheme + .body2 + .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + inputFormatters: widget.keyboardType == TextInputType.phone + ? [ + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] + : widget.inputFormatters, + decoration: InputDecoration( + labelText: widget.hintText, + labelStyle: TextStyle(color: Colors.black), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(0.5), + width: 1.0), + borderRadius: BorderRadius.circular(12.0)), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(0.5), + width: 1.0), + borderRadius: BorderRadius.circular(8.0)), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12)), + disabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12)), + enabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12), + ), + ), + ), + ), + ); + } +} From febdadc92499f85151914f855f9ecd5ffc176c8b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 28 Jan 2021 17:28:12 +0200 Subject: [PATCH 13/29] fix : DA-264 --- lib/widgets/shared/new_text_Field.dart | 239 ------------------------- 1 file changed, 239 deletions(-) delete mode 100644 lib/widgets/shared/new_text_Field.dart diff --git a/lib/widgets/shared/new_text_Field.dart b/lib/widgets/shared/new_text_Field.dart deleted file mode 100644 index ad9eb580..00000000 --- a/lib/widgets/shared/new_text_Field.dart +++ /dev/null @@ -1,239 +0,0 @@ -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -class NumberTextInputFormatter extends TextInputFormatter { - @override - TextEditingValue formatEditUpdate( - TextEditingValue oldValue, TextEditingValue newValue) { - final int newTextLength = newValue.text.length; - int selectionIndex = newValue.selection.end; - int usedSubstringIndex = 0; - final StringBuffer newText = StringBuffer(); - if (newTextLength >= 1) { - newText.write('('); - if (newValue.selection.end >= 1) selectionIndex++; - } - if (newTextLength >= 4) { - newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); - if (newValue.selection.end >= 3) selectionIndex += 2; - } - if (newTextLength >= 7) { - newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); - if (newValue.selection.end >= 6) selectionIndex++; - } - if (newTextLength >= 11) { - newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); - if (newValue.selection.end >= 10) selectionIndex++; - } - // Dump the rest. - if (newTextLength >= usedSubstringIndex) - newText.write(newValue.text.substring(usedSubstringIndex)); - return TextEditingValue( - text: newText.toString(), - selection: TextSelection.collapsed(offset: selectionIndex), - ); - } -} - -final _mobileFormatter = NumberTextInputFormatter(); - -class NewTextFields extends StatefulWidget { - NewTextFields( - {Key key, - this.type, - this.hintText, - this.suffixIcon, - this.autoFocus, - this.onChanged, - this.initialValue, - this.minLines, - this.maxLines, - this.inputFormatters, - this.padding, - this.focus = false, - this.maxLengthEnforced = true, - this.suffixIconColor, - this.inputAction, - this.onSubmit, - this.keepPadding = true, - this.textCapitalization = TextCapitalization.none, - this.controller, - this.keyboardType, - this.validator, - this.borderOnlyError = false, - this.onSaved, - this.onSuffixTap, - this.readOnly: false, - this.maxLength, - this.prefixIcon, - this.bare = false, - this.onTap, - this.fontSize = 16.0, - this.fontWeight = FontWeight.w700, - this.autoValidate = false, - this.hintColor,this.isEnabled=true}) - : super(key: key); - - final String hintText; - - // final String initialValue; - final String type; - final bool autoFocus; - final IconData suffixIcon; - final Color suffixIconColor; - final Icon prefixIcon; - final VoidCallback onTap; - final TextEditingController controller; - final TextInputType keyboardType; - final FormFieldValidator validator; - final Function onSaved; - final Function onSuffixTap; - final Function onChanged; - final Function onSubmit; - final bool readOnly; - final int maxLength; - final int minLines; - final int maxLines; - final bool maxLengthEnforced; - final bool bare; - final bool isEnabled; - final TextInputAction inputAction; - final double fontSize; - final FontWeight fontWeight; - final bool keepPadding; - final TextCapitalization textCapitalization; - final List inputFormatters; - final bool autoValidate; - final EdgeInsets padding; - final bool focus; - final bool borderOnlyError; - final Color hintColor; - final String initialValue; - @override - _NewTextFieldsState createState() => _NewTextFieldsState(); -} - -class _NewTextFieldsState extends State { - final FocusNode _focusNode = FocusNode(); - bool focus = false; - bool view = false; - - @override - void initState() { - super.initState(); - _focusNode.addListener(() { - setState(() { - focus = _focusNode.hasFocus; - }); - }); - } - - @override - void didUpdateWidget(NewTextFields oldWidget) { - if (widget.focus) _focusNode.requestFocus(); - super.didUpdateWidget(oldWidget); - } - - @override - void dispose() { - _focusNode.dispose(); - super.dispose(); - } - - - bool _determineReadOnly() { - if (widget.readOnly != null && widget.readOnly) { - _focusNode.unfocus(); - return true; - } else { - return false; - } - } - - @override - Widget build(BuildContext context) { - return AnimatedContainer( - duration: Duration(milliseconds: 300), - decoration:BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Container( - margin: EdgeInsets.only(top: 8), - - child: TextFormField( - enabled: widget.isEnabled, - initialValue: widget.initialValue, - keyboardAppearance: Theme.of(context).brightness, - scrollPhysics: BouncingScrollPhysics(), - autovalidate: widget.autoValidate, - textCapitalization: widget.textCapitalization, - onFieldSubmitted: widget.inputAction == TextInputAction.next - ? (widget.onSubmit != null - ? widget.onSubmit - : (val) { - _focusNode.nextFocus(); - }) - : widget.onSubmit, - textInputAction: widget.inputAction, - minLines: widget.minLines ?? 1, - maxLines: widget.maxLines ?? 1, - maxLengthEnforced: widget.maxLengthEnforced, - onChanged: widget.onChanged, - focusNode: _focusNode, - maxLength: widget.maxLength ?? null, - controller: widget.controller, - keyboardType: widget.keyboardType, - readOnly: _determineReadOnly(), - obscureText: widget.type == "password" && !view ? true : false, - autofocus: widget.autoFocus ?? false, - validator: widget.validator, - onSaved: widget.onSaved, - - style: Theme.of(context) - .textTheme - .body2 - .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), - inputFormatters: widget.keyboardType == TextInputType.phone - ? [ - WhitelistingTextInputFormatter.digitsOnly, - _mobileFormatter, - ] - : widget.inputFormatters, - decoration: InputDecoration( - labelText: widget.hintText, - labelStyle: TextStyle(color: Colors.black), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(0.5), - width: 1.0), - borderRadius: BorderRadius.circular(12.0)), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(0.5), - width: 1.0), - borderRadius: BorderRadius.circular(8.0)), - focusedBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12)), - disabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12)), - enabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12), - ), - ), - ), - ), - ); - } -} From 494479f1d91862563a78cd1f7ed126b463a20f09 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 28 Jan 2021 17:32:11 +0200 Subject: [PATCH 14/29] fix : DA-264 fix merge error --- lib/config/localized_values.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 32c01444..8096b5b6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -687,13 +687,10 @@ const Map> localizedValues = { 'years': {'en': "Years", 'ar': "سنين"}, 'hr': {'en': "HR", 'ar': "س"}, 'min': {'en': "Min", 'ar': "د"}, - 'appointmentNumber': {'en': "Appointment Number", 'ar': "رقم الموعد"} - // 'icd': {'en': "ICD", 'ar': " "} - 'min': {'en': "Min", 'ar': "د"}, + 'appointmentNumber': {'en': "Appointment Number", 'ar': "رقم الموعد"}, 'referralStatusHold': {'en': "Hold", 'ar': "معلق"}, 'referralStatusActive': {'en': "Active", 'ar': "نشط"}, 'referralStatusCancelled': {'en': "Cancelled", 'ar': "ملغاة"}, 'referralStatusCompleted': {'en': "Completed", 'ar': "مكتمل"}, 'referralStatusNotSeen': {'en': "NotSeen", 'ar': "لم يرى"}, - // 'icd': {'en': "ICD", 'ar': " "}, }; From deca96f62e9bc9f91a383e0a6d26031aae82cc60 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 28 Jan 2021 21:21:51 +0200 Subject: [PATCH 15/29] bug fix --- lib/screens/prescription/prescription_screen.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 3dfd5bdc..8f53ef69 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -817,7 +817,7 @@ class _NewPrescriptionScreenState extends State { children: [ Container( height: MediaQuery.of(context).size.height * - 0.070, + 0.060, width: double.infinity, child: Row( children: [ @@ -825,7 +825,7 @@ class _NewPrescriptionScreenState extends State { width: MediaQuery.of(context) .size .width * - 0.550, + 0.500, child: TextFields( inputFormatters: [ LengthLimitingTextInputFormatter( @@ -863,7 +863,7 @@ class _NewPrescriptionScreenState extends State { width: MediaQuery.of(context) .size .width * - 0.3200, + 0.3700, child: InkWell( onTap: unitsList != null ? () { @@ -908,6 +908,9 @@ class _NewPrescriptionScreenState extends State { ], ), ), + SizedBox( + height: 12, + ), Container( height: MediaQuery.of(context).size.height * 0.070, From 9b5899d4e6ffe701f54c5c0371e292da2157061e Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Fri, 29 Jan 2021 19:57:50 +0200 Subject: [PATCH 16/29] bug fix --- lib/screens/prescription/prescription_screen.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 8f53ef69..1f45deb1 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -1214,8 +1214,8 @@ class _NewPrescriptionScreenState extends State { covered: true, dose: newDoseStreangth.isNotEmpty ? int.parse(newDoseStreangth) - : int.parse( - doseStreangth), //frequency.isNotEmpty ? int.parse(dose) : 1, + : int.parse(doseStreangth), + //frequency.isNotEmpty ? int.parse(dose) : 1, itemId: drugId, doseUnitId: newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit), From 29de472c66d3a6d3b27173a3a11527030b49abfb Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sat, 30 Jan 2021 00:11:57 +0200 Subject: [PATCH 17/29] bug fix --- lib/core/model/medical_file_model.dart | 75 ++++++++++++++++++- .../medical-file/medical_file_details.dart | 30 ++++---- .../prescription/prescription_screen.dart | 9 ++- 3 files changed, 98 insertions(+), 16 deletions(-) diff --git a/lib/core/model/medical_file_model.dart b/lib/core/model/medical_file_model.dart index 4e9d8f3e..f2b4ce3c 100644 --- a/lib/core/model/medical_file_model.dart +++ b/lib/core/model/medical_file_model.dart @@ -169,6 +169,7 @@ class Consulations { List lstPhysicalExam; List lstProcedure; List lstMedicalHistory; + List lstCheifComplaint; Consulations( {this.admissionNo, @@ -194,7 +195,8 @@ class Consulations { this.lstAssessments, this.lstPhysicalExam, this.lstProcedure, - this.lstMedicalHistory}); + this.lstMedicalHistory, + this.lstCheifComplaint}); Consulations.fromJson(Map json) { admissionNo = json['AdmissionNo']; @@ -223,6 +225,12 @@ class Consulations { lstAssessments.add(new LstAssessments.fromJson(v)); }); } + if (json['lstCheifComplaint'] != null) { + lstCheifComplaint = new List(); + json['lstCheifComplaint'].forEach((v) { + lstCheifComplaint.add(new LstCheifComplaint.fromJson(v)); + }); + } if (json['lstPhysicalExam'] != null) { lstPhysicalExam = new List(); json['lstPhysicalExam'].forEach((v) { @@ -269,6 +277,10 @@ class Consulations { data['lstAssessments'] = this.lstAssessments.map((v) => v.toJson()).toList(); } + if (this.lstCheifComplaint != null) { + data['lstCheifComplaint'] = + this.lstCheifComplaint.map((v) => v.toJson()).toList(); + } if (this.lstPhysicalExam != null) { data['lstPhysicalExam'] = this.lstPhysicalExam.map((v) => v.toJson()).toList(); @@ -284,6 +296,67 @@ class Consulations { } } +class LstCheifComplaint { + int appointmentNo; + String cCDate; + String chiefComplaint; + String currentMedication; + int episodeID; + String hOPI; + int patientID; + String patientType; + int projectID; + String projectName; + String setupID; + String dispalyName; + + LstCheifComplaint( + {this.appointmentNo, + this.cCDate, + this.chiefComplaint, + this.currentMedication, + this.episodeID, + this.hOPI, + this.patientID, + this.patientType, + this.projectID, + this.projectName, + this.setupID, + this.dispalyName}); + + LstCheifComplaint.fromJson(Map json) { + appointmentNo = json['AppointmentNo']; + cCDate = json['CCDate']; + chiefComplaint = json['ChiefComplaint']; + currentMedication = json['CurrentMedication']; + episodeID = json['EpisodeID']; + hOPI = json['HOPI']; + patientID = json['PatientID']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + setupID = json['SetupID']; + dispalyName = json['dispalyName']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['CCDate'] = this.cCDate; + data['ChiefComplaint'] = this.chiefComplaint; + data['CurrentMedication'] = this.currentMedication; + data['EpisodeID'] = this.episodeID; + data['HOPI'] = this.hOPI; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['SetupID'] = this.setupID; + data['dispalyName'] = this.dispalyName; + return data; + } +} + class LstAssessments { int appointmentNo; String condition; diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index f7525391..a148610b 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -188,16 +188,18 @@ class _MedicalFileDetailsState extends State { .consulations .length != 0) - AppText( - model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations[0] - .doctorName - .toUpperCase(), - fontWeight: FontWeight.w700, + Expanded( + child: AppText( + model + .medicalFileList[0] + .entityList[0] + .timelines[encounterNumber] + .timeLineEvents[0] + .consulations[0] + .doctorName + .toUpperCase(), + fontWeight: FontWeight.w700, + ), ), ], ), @@ -315,7 +317,7 @@ class _MedicalFileDetailsState extends State { .timelines[encounterNumber] .timeLineEvents[0] .consulations[0] - .lstMedicalHistory + .lstCheifComplaint .length, itemBuilder: (BuildContext ctxt, int index) { @@ -338,9 +340,9 @@ class _MedicalFileDetailsState extends State { encounterNumber] .timeLineEvents[0] .consulations[0] - .lstMedicalHistory[ + .lstCheifComplaint[ index] - .history + .hOPI .trim(), ), ), @@ -795,7 +797,7 @@ class _MedicalFileDetailsState extends State { .consulations[0] .lstPhysicalExam[ index] - .examType), + .examDesc), ], ), Row( diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 1f45deb1..cef99164 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -946,7 +946,7 @@ class _NewPrescriptionScreenState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).route, + 'Route', route != null ? route['name'] : null, @@ -1181,6 +1181,13 @@ class _NewPrescriptionScreenState extends State { }); } + // String getName(String num) { + // dynamic x = routeList.where((i) { + // return i['id'] == int.parse(num); + // }).first(); + // return x.toString(); + // } + updatePrescription( {PrescriptionViewModel model, int drugId, From b63c7aff257be90b7f9f6adcf7eb727117cb6904 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 31 Jan 2021 10:18:52 +0200 Subject: [PATCH 18/29] Fix DA-331 vital signs uncorrect temperature value --- lib/core/service/patient-ucaf-service.dart | 2 +- .../patient/vital_sign/patient-vital-sign-data.dart | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart index 38f2407b..e7ecc9f2 100644 --- a/lib/core/service/patient-ucaf-service.dart +++ b/lib/core/service/patient-ucaf-service.dart @@ -41,7 +41,7 @@ class UcafService extends LookupService { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; - // body['AppointmentNo'] = patient.appointmentNo; + body['AppointmentNo'] = patient.appointmentNo; // body['EpisodeID'] = patient.episodeNo; await baseAppClient.post( diff --git a/lib/models/patient/vital_sign/patient-vital-sign-data.dart b/lib/models/patient/vital_sign/patient-vital-sign-data.dart index b7fe77cb..57133a08 100644 --- a/lib/models/patient/vital_sign/patient-vital-sign-data.dart +++ b/lib/models/patient/vital_sign/patient-vital-sign-data.dart @@ -8,7 +8,7 @@ class VitalSignData { var bodyMassIndex; int fio2; int headCircumCm; - int heightCm; + var heightCm; int idealBodyWeightLbs; bool isPainManagementDone; bool isVitalsRequired; @@ -26,10 +26,10 @@ class VitalSignData { int respirationPattern; int sao2; int status; - int temperatureCelcius; + var temperatureCelcius; int temperatureCelciusMethod; - int waistSizeInch; - int weightKg; + var waistSizeInch; + var weightKg; VitalSignData( {this.appointmentNo, From e6527527290ff13b9f64b0c37edc4741e84fe94a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 31 Jan 2021 11:00:24 +0200 Subject: [PATCH 19/29] fix : DA-334 --- ios/Podfile.lock | 378 +----------------- .../subjective/update_allergies_widget.dart | 2 +- lib/widgets/shared/app_drawer_widget.dart | 12 +- 3 files changed, 5 insertions(+), 387 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index aa3e21b8..fb65ae25 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,235 +1,9 @@ PODS: - - abseil/algorithm (0.20200225.0): - - abseil/algorithm/algorithm (= 0.20200225.0) - - abseil/algorithm/container (= 0.20200225.0) - - abseil/algorithm/algorithm (0.20200225.0): - - abseil/base/config - - abseil/algorithm/container (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/base (0.20200225.0): - - abseil/base/atomic_hook (= 0.20200225.0) - - abseil/base/base (= 0.20200225.0) - - abseil/base/base_internal (= 0.20200225.0) - - abseil/base/bits (= 0.20200225.0) - - abseil/base/config (= 0.20200225.0) - - abseil/base/core_headers (= 0.20200225.0) - - abseil/base/dynamic_annotations (= 0.20200225.0) - - abseil/base/endian (= 0.20200225.0) - - abseil/base/errno_saver (= 0.20200225.0) - - abseil/base/exponential_biased (= 0.20200225.0) - - abseil/base/log_severity (= 0.20200225.0) - - abseil/base/malloc_internal (= 0.20200225.0) - - abseil/base/periodic_sampler (= 0.20200225.0) - - abseil/base/pretty_function (= 0.20200225.0) - - abseil/base/raw_logging_internal (= 0.20200225.0) - - abseil/base/spinlock_wait (= 0.20200225.0) - - abseil/base/throw_delegate (= 0.20200225.0) - - abseil/base/atomic_hook (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/base (0.20200225.0): - - abseil/base/atomic_hook - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/base/dynamic_annotations - - abseil/base/log_severity - - abseil/base/raw_logging_internal - - abseil/base/spinlock_wait - - abseil/meta/type_traits - - abseil/base/base_internal (0.20200225.0): - - abseil/base/config - - abseil/meta/type_traits - - abseil/base/bits (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/config (0.20200225.0) - - abseil/base/core_headers (0.20200225.0): - - abseil/base/config - - abseil/base/dynamic_annotations (0.20200225.0) - - abseil/base/endian (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/errno_saver (0.20200225.0): - - abseil/base/config - - abseil/base/exponential_biased (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/log_severity (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/malloc_internal (0.20200225.0): - - abseil/base/base - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/base/dynamic_annotations - - abseil/base/raw_logging_internal - - abseil/base/periodic_sampler (0.20200225.0): - - abseil/base/core_headers - - abseil/base/exponential_biased - - abseil/base/pretty_function (0.20200225.0) - - abseil/base/raw_logging_internal (0.20200225.0): - - abseil/base/atomic_hook - - abseil/base/config - - abseil/base/core_headers - - abseil/base/log_severity - - abseil/base/spinlock_wait (0.20200225.0): - - abseil/base/base_internal - - abseil/base/core_headers - - abseil/base/errno_saver - - abseil/base/throw_delegate (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/container/compressed_tuple (0.20200225.0): - - abseil/utility/utility - - abseil/container/inlined_vector (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/base/throw_delegate - - abseil/container/inlined_vector_internal - - abseil/memory/memory - - abseil/container/inlined_vector_internal (0.20200225.0): - - abseil/base/core_headers - - abseil/container/compressed_tuple - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/types/span - - abseil/memory (0.20200225.0): - - abseil/memory/memory (= 0.20200225.0) - - abseil/memory/memory (0.20200225.0): - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/meta (0.20200225.0): - - abseil/meta/type_traits (= 0.20200225.0) - - abseil/meta/type_traits (0.20200225.0): - - abseil/base/config - - abseil/numeric/int128 (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/strings/internal (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/endian - - abseil/base/raw_logging_internal - - abseil/meta/type_traits - - abseil/strings/str_format (0.20200225.0): - - abseil/strings/str_format_internal - - abseil/strings/str_format_internal (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/numeric/int128 - - abseil/strings/strings - - abseil/types/span - - abseil/strings/strings (0.20200225.0): - - abseil/base/base - - abseil/base/bits - - abseil/base/config - - abseil/base/core_headers - - abseil/base/endian - - abseil/base/raw_logging_internal - - abseil/base/throw_delegate - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/numeric/int128 - - abseil/strings/internal - - abseil/time (0.20200225.0): - - abseil/time/internal (= 0.20200225.0) - - abseil/time/time (= 0.20200225.0) - - abseil/time/internal (0.20200225.0): - - abseil/time/internal/cctz (= 0.20200225.0) - - abseil/time/internal/cctz (0.20200225.0): - - abseil/time/internal/cctz/civil_time (= 0.20200225.0) - - abseil/time/internal/cctz/time_zone (= 0.20200225.0) - - abseil/time/internal/cctz/civil_time (0.20200225.0): - - abseil/base/config - - abseil/time/internal/cctz/time_zone (0.20200225.0): - - abseil/base/config - - abseil/time/internal/cctz/civil_time - - abseil/time/time (0.20200225.0): - - abseil/base/base - - abseil/base/core_headers - - abseil/base/raw_logging_internal - - abseil/numeric/int128 - - abseil/strings/strings - - abseil/time/internal/cctz/civil_time - - abseil/time/internal/cctz/time_zone - - abseil/types (0.20200225.0): - - abseil/types/any (= 0.20200225.0) - - abseil/types/bad_any_cast (= 0.20200225.0) - - abseil/types/bad_any_cast_impl (= 0.20200225.0) - - abseil/types/bad_optional_access (= 0.20200225.0) - - abseil/types/bad_variant_access (= 0.20200225.0) - - abseil/types/compare (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - abseil/types/span (= 0.20200225.0) - - abseil/types/variant (= 0.20200225.0) - - abseil/types/any (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/bad_any_cast - - abseil/utility/utility - - abseil/types/bad_any_cast (0.20200225.0): - - abseil/base/config - - abseil/types/bad_any_cast_impl - - abseil/types/bad_any_cast_impl (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/bad_optional_access (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/bad_variant_access (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/compare (0.20200225.0): - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/optional (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/types/bad_optional_access - - abseil/utility/utility - - abseil/types/span (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/base/throw_delegate - - abseil/meta/type_traits - - abseil/types/variant (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/bad_variant_access - - abseil/utility/utility - - abseil/utility/utility (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/meta/type_traits - Alamofire (4.9.1) - barcode_scan (0.0.1): - Flutter - MTBBarcodeScanner - SwiftProtobuf - - BoringSSL-GRPC (0.0.7): - - BoringSSL-GRPC/Implementation (= 0.0.7) - - BoringSSL-GRPC/Interface (= 0.0.7) - - BoringSSL-GRPC/Implementation (0.0.7): - - BoringSSL-GRPC/Interface (= 0.0.7) - - BoringSSL-GRPC/Interface (0.0.7) - - cloud_firestore (0.14.3): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Firestore (~> 6.33.0) - - firebase_core - - Flutter - - cloud_firestore_web (0.1.0): - - Flutter - connectivity (0.0.1): - Flutter - Reachability @@ -239,39 +13,11 @@ PODS: - Flutter - device_info (0.0.1): - Flutter - - Firebase/Analytics (6.33.0): - - Firebase/Core - - Firebase/Auth (6.33.0): - - Firebase/CoreOnly - - FirebaseAuth (~> 6.9.2) - - Firebase/Core (6.33.0): - - Firebase/CoreOnly - - FirebaseAnalytics (= 6.8.3) - Firebase/CoreOnly (6.33.0): - FirebaseCore (= 6.10.3) - - Firebase/Firestore (6.33.0): - - Firebase/CoreOnly - - FirebaseFirestore (~> 1.18.0) - Firebase/Messaging (6.33.0): - Firebase/CoreOnly - FirebaseMessaging (~> 4.7.0) - - Firebase/Storage (6.33.0): - - Firebase/CoreOnly - - FirebaseStorage (~> 3.9.0) - - firebase_analytics (6.2.0): - - Firebase/Analytics (~> 6.33.0) - - Firebase/CoreOnly (~> 6.33.0) - - firebase_core - - Flutter - - firebase_analytics_web (0.1.0): - - Flutter - - firebase_auth (0.18.3): - - Firebase/Auth (~> 6.33.0) - - Firebase/CoreOnly (~> 6.33.0) - - firebase_core - - Flutter - - firebase_auth_web (0.1.0): - - Flutter - firebase_core (0.5.2): - Firebase/CoreOnly (~> 6.33.0) - Flutter @@ -282,25 +28,6 @@ PODS: - Firebase/Messaging (~> 6.33.0) - firebase_core - Flutter - - firebase_storage (5.0.1): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Storage (~> 6.33.0) - - firebase_core - - Flutter - - FirebaseAnalytics (6.8.3): - - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleAppMeasurement (= 6.8.3) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/MethodSwizzler (~> 6.7) - - GoogleUtilities/Network (~> 6.7) - - "GoogleUtilities/NSData+zlib (~> 6.7)" - - nanopb (~> 1.30906.0) - - FirebaseAuth (6.9.2): - - FirebaseCore (~> 6.10) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/Environment (~> 6.7) - - GTMSessionFetcher/Core (~> 1.1) - FirebaseCore (6.10.3): - FirebaseCoreDiagnostics (~> 1.6) - GoogleUtilities/Environment (~> 6.7) @@ -310,18 +37,6 @@ PODS: - GoogleUtilities/Environment (~> 6.7) - GoogleUtilities/Logger (~> 6.7) - nanopb (~> 1.30906.0) - - FirebaseFirestore (1.18.0): - - abseil/algorithm (= 0.20200225.0) - - abseil/base (= 0.20200225.0) - - abseil/memory (= 0.20200225.0) - - abseil/meta (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/time (= 0.20200225.0) - - abseil/types (= 0.20200225.0) - - FirebaseCore (~> 6.10) - - "gRPC-C++ (~> 1.28.0)" - - leveldb-library (~> 1.22) - - nanopb (~> 1.30906.0) - FirebaseInstallations (1.7.0): - FirebaseCore (~> 6.10) - GoogleUtilities/Environment (~> 6.7) @@ -340,20 +55,11 @@ PODS: - GoogleUtilities/Reachability (~> 6.7) - GoogleUtilities/UserDefaults (~> 6.7) - Protobuf (>= 3.9.2, ~> 3.9) - - FirebaseStorage (3.9.1): - - FirebaseCore (~> 6.10) - - GTMSessionFetcher/Core (~> 1.1) - Flutter (1.0.0) - flutter_flexible_toast (0.0.1): - Flutter - flutter_plugin_android_lifecycle (0.0.1): - Flutter - - GoogleAppMeasurement (6.8.3): - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/MethodSwizzler (~> 6.7) - - GoogleUtilities/Network (~> 6.7) - - "GoogleUtilities/NSData+zlib (~> 6.7)" - - nanopb (~> 1.30906.0) - GoogleDataTransport (7.5.1): - nanopb (~> 1.30906.0) - GoogleUtilities/AppDelegateSwizzler (6.7.2): @@ -364,8 +70,6 @@ PODS: - PromisesObjC (~> 1.2) - GoogleUtilities/Logger (6.7.2): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (6.7.2): - - GoogleUtilities/Logger - GoogleUtilities/Network (6.7.2): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" @@ -375,36 +79,10 @@ PODS: - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (6.7.2): - GoogleUtilities/Logger - - "gRPC-C++ (1.28.2)": - - "gRPC-C++/Implementation (= 1.28.2)" - - "gRPC-C++/Interface (= 1.28.2)" - - "gRPC-C++/Implementation (1.28.2)": - - abseil/container/inlined_vector (= 0.20200225.0) - - abseil/memory/memory (= 0.20200225.0) - - abseil/strings/str_format (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - "gRPC-C++/Interface (= 1.28.2)" - - gRPC-Core (= 1.28.2) - - "gRPC-C++/Interface (1.28.2)" - - gRPC-Core (1.28.2): - - gRPC-Core/Implementation (= 1.28.2) - - gRPC-Core/Interface (= 1.28.2) - - gRPC-Core/Implementation (1.28.2): - - abseil/container/inlined_vector (= 0.20200225.0) - - abseil/memory/memory (= 0.20200225.0) - - abseil/strings/str_format (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - BoringSSL-GRPC (= 0.0.7) - - gRPC-Core/Interface (= 1.28.2) - - gRPC-Core/Interface (1.28.2) - - GTMSessionFetcher/Core (1.5.0) - hexcolor (0.0.1): - Flutter - imei_plugin (0.0.1): - Flutter - - leveldb-library (1.22) - local_auth (0.0.1): - Flutter - maps_launcher (0.0.1): @@ -422,7 +100,7 @@ PODS: - Flutter - "permission_handler (5.0.1+1)": - Flutter - - PromisesObjC (1.2.10) + - PromisesObjC (1.2.11) - Protobuf (3.13.0) - Reachability (3.2) - shared_preferences (0.0.1): @@ -454,20 +132,13 @@ PODS: DEPENDENCIES: - Alamofire - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) - - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) - - cloud_firestore_web (from `.symlinks/plugins/cloud_firestore_web/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) - - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - - firebase_analytics_web (from `.symlinks/plugins/firebase_analytics_web/ios`) - - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - - firebase_auth_web (from `.symlinks/plugins/firebase_auth_web/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - - firebase_storage (from `.symlinks/plugins/firebase_storage/ios`) - Flutter (from `Flutter`) - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) @@ -493,26 +164,15 @@ DEPENDENCIES: SPEC REPOS: trunk: - - abseil - Alamofire - - BoringSSL-GRPC - Firebase - - FirebaseAnalytics - - FirebaseAuth - FirebaseCore - FirebaseCoreDiagnostics - - FirebaseFirestore - FirebaseInstallations - FirebaseInstanceID - FirebaseMessaging - - FirebaseStorage - - GoogleAppMeasurement - GoogleDataTransport - GoogleUtilities - - "gRPC-C++" - - gRPC-Core - - GTMSessionFetcher - - leveldb-library - MTBBarcodeScanner - nanopb - OpenTok @@ -525,10 +185,6 @@ SPEC REPOS: EXTERNAL SOURCES: barcode_scan: :path: ".symlinks/plugins/barcode_scan/ios" - cloud_firestore: - :path: ".symlinks/plugins/cloud_firestore/ios" - cloud_firestore_web: - :path: ".symlinks/plugins/cloud_firestore_web/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" connectivity_for_web: @@ -537,22 +193,12 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/connectivity_macos/ios" device_info: :path: ".symlinks/plugins/device_info/ios" - firebase_analytics: - :path: ".symlinks/plugins/firebase_analytics/ios" - firebase_analytics_web: - :path: ".symlinks/plugins/firebase_analytics_web/ios" - firebase_auth: - :path: ".symlinks/plugins/firebase_auth/ios" - firebase_auth_web: - :path: ".symlinks/plugins/firebase_auth_web/ios" firebase_core: :path: ".symlinks/plugins/firebase_core/ios" firebase_core_web: :path: ".symlinks/plugins/firebase_core_web/ios" firebase_messaging: :path: ".symlinks/plugins/firebase_messaging/ios" - firebase_storage: - :path: ".symlinks/plugins/firebase_storage/ios" Flutter: :path: Flutter flutter_flexible_toast: @@ -597,46 +243,28 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/url_launcher_windows/ios" SPEC CHECKSUMS: - abseil: 6c8eb7892aefa08d929b39f9bb108e5367e3228f Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 - BoringSSL-GRPC: 8edf627ee524575e2f8d19d56f068b448eea3879 - cloud_firestore: 19c6f947dd14be9d71695ea23eefde67cd8829c8 - cloud_firestore_web: 9ec3dc7f5f98de5129339802d491c1204462bfec connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_analytics: 52ba26fcfb9cc90f76b36c4e5200cc0a7e9024eb - firebase_analytics_web: 7d539061ea4af07563a0e21044af89cab70efec0 - firebase_auth: 240419f6b00dea39c60a2a9c4379c16c4a4b02fb - firebase_auth_web: 0955c07bcc06e84af76b9d4e32e6f31518f2d7de firebase_core: 350ba329d1641211bc6183a3236893cafdacfea7 firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 - firebase_storage: d5cf595245e1770ef7081b026f603771bf5dd547 - FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 - FirebaseAuth: c92d49ada7948d1a23466e3db17bc4c2039dddc3 FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 - FirebaseFirestore: adff4877869ca91a11250cc0989a6cd56bad163f FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a - FirebaseStorage: 15e0f15ef3c7fec3d1899d68623e47d4447066b4 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 - GoogleAppMeasurement: 966e88df9d19c15715137bb2ddaf52373f111436 GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 - "gRPC-C++": 13d8ccef97d5c3c441b7e3c529ef28ebee86fad2 - gRPC-Core: 4afa11bfbedf7cdecd04de535a9e046893404ed5 - GTMSessionFetcher: b3503b20a988c4e20cc189aa798fd18220133f52 hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 imei_plugin: cb1af7c223ac2d82dcd1457a7137d93d65d2a3cd - leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb @@ -645,7 +273,7 @@ SPEC CHECKSUMS: path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 - PromisesObjC: b14b1c6b68e306650688599de8a45e49fae81151 + PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d @@ -664,4 +292,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.0 +COCOAPODS: 1.10.0.rc.1 diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 9e0e4e0e..086a8e1e 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -124,7 +124,7 @@ class _UpdateAllergiesWidgetState extends State { children: [ AppText( selectedAllergy.remark != null || - selectedAllergy.remark == '' + selectedAllergy.remark != '' ? TranslationBase.of(context).remarks + " : " : '', fontWeight: FontWeight.bold, diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 11664510..2d0812d4 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -93,22 +93,12 @@ class _AppDrawerState extends State { ? Padding( padding: EdgeInsets.only(top: 10), child: AppText( - authProvider.doctorProfile?.doctorName, + TranslationBase.of(context).dr +authProvider.doctorProfile?.doctorName, fontWeight: FontWeight.bold, color: Colors.black, fontSize: SizeConfig.textMultiplier * 2, )) : SizedBox(), - AppText( - projectsProvider.isArabic - ? authProvider - .doctorProfile.titleDescriptionN ?? - "" - : authProvider - .doctorProfile?.titleDescription ?? - "", - fontWeight: FontWeight.normal, - color: Colors.black87), ], ), ), From f84902b73bb9ca3503242dd1ab8db895ac6ae07b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 31 Jan 2021 12:04:51 +0200 Subject: [PATCH 20/29] fix : DA-333 --- lib/screens/patients/patient_search_screen.dart | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 39f7fe65..1e68d196 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -472,10 +472,21 @@ class _PatientSearchScreenState extends State { ); }).toList(); }, - onChanged: (String newValue) => { + onChanged: (String newValue) { setState(() { _selectedLocation = newValue; - }) + }); + if (newValue == '1') + { + _patientSearchFormValues + .PatientOutSA = false; + } + else + { + _patientSearchFormValues + .PatientOutSA = true; + } + }, items: LOCATIONS.map((item) { !projectsProvider.isArabic From 2b07d16f00c12ad10d5228327ad79f6848c10596 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 31 Jan 2021 12:45:12 +0200 Subject: [PATCH 21/29] fix : DA-303 --- lib/client/base_app_client.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index e38db07c..604e6f30 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -70,7 +70,7 @@ class BaseAppClient { body['Channel'] = CHANNEL; body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; - body['PatientOutSA'] = 0; // PATIENT_OUT_SA; + body['PatientOutSA'] = body['PatientOutSA']??0; // PATIENT_OUT_SA; if (body['VidaAuthTokenID'] == null) { body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); @@ -96,9 +96,9 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - onFailure(getError(parsed), statusCode); - //await helpers.logout(); - //helpers.showErrorToast('Your session expired Please login agian'); + // onFailure(getError(parsed), statusCode); + await helpers.logout(); + helpers.showErrorToast('Your session expired Please login agian'); } else if (parsed['MessageStatus'] == 1) { if (!parsed['IsAuthenticated']) onFailure(getError(parsed), statusCode); From cfb9ea30cb99821c87885aa7605a430668de0eb2 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 31 Jan 2021 15:23:36 +0200 Subject: [PATCH 22/29] fix : DA-335 --- .../profile/profile-welcome-widget.dart | 28 +++++++++++-------- lib/widgets/shared/app_drawer_widget.dart | 20 +++++++++---- lib/widgets/shared/profile_image_widget.dart | 18 +++++++++--- 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index ce05b83e..ac61f838 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -62,20 +62,24 @@ final double height; mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).backgroundColor, - borderRadius: BorderRadius.all( - Radius.circular(10.0), + + CircleAvatar( + + // radius: (52) + child: ClipRRect( + borderRadius:BorderRadius.circular(10), + + child: Image.network( + authProvider + .doctorProfile.doctorImageURL, + fit: BoxFit.fill, + width: 70, + height: 60, ), ), - height: 50, - width: 60, - child: Image.network( - authProvider.doctorProfile.doctorImageURL, -// fit: BoxFit.fill, - ), - ), + backgroundColor: Colors.transparent, + ) + ], ), ), diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 2d0812d4..a29d764e 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -83,11 +83,21 @@ class _AppDrawerState extends State { children: [ authProvider.doctorProfile != null ? CircleAvatar( - radius: SizeConfig.imageSizeMultiplier * 12, - backgroundImage: NetworkImage( - authProvider.doctorProfile.doctorImageURL), - backgroundColor: Colors.white, - ) + radius: + SizeConfig.imageSizeMultiplier * 12, + // radius: (52) + child: ClipRRect( + borderRadius:BorderRadius.circular(50), + + child: Image.network( + authProvider + .doctorProfile.doctorImageURL, + fit: BoxFit.fill, + width: 700, + ), + ), + backgroundColor: Colors.transparent, + ) : SizedBox(), authProvider.doctorProfile != null ? Padding( diff --git a/lib/widgets/shared/profile_image_widget.dart b/lib/widgets/shared/profile_image_widget.dart index db22a13a..3db93f9d 100644 --- a/lib/widgets/shared/profile_image_widget.dart +++ b/lib/widgets/shared/profile_image_widget.dart @@ -34,11 +34,21 @@ class ProfileImageWidget extends StatelessWidget { Container( height: height, width: width, - child: CircleAvatar( - radius: SizeConfig.imageSizeMultiplier * 12, - backgroundImage: NetworkImage(url), + child:CircleAvatar( + radius: + SizeConfig.imageSizeMultiplier * 12, + // radius: (52) + child: ClipRRect( + borderRadius:BorderRadius.circular(50), + + child: Image.network( + url, + fit: BoxFit.fill, + width: 700, + ), + ), backgroundColor: Colors.transparent, - ), + ) ), name == null || des == null ? SizedBox() From 23c826b37f3448c804b446e8814b812d0c60d4a1 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 31 Jan 2021 16:09:28 +0200 Subject: [PATCH 23/29] bug fix --- lib/screens/prescription/prescription_screen.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index cef99164..238a3812 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -559,6 +559,14 @@ class _NewPrescriptionScreenState extends State { ), Row( children: [ + AppText( + TranslationBase.of(context) + .doctorName + + ": ", + fontWeight: + FontWeight + .w600, + ), Expanded( child: AppText( From 6a5e1345277e14e15a6092042726a80aed65918d Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 31 Jan 2021 16:34:17 +0200 Subject: [PATCH 24/29] =?UTF-8?q?fix=20=C2=A0remark=20and=20step=20widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../patients/profile/soap_update/steps_widget.dart | 14 +++++++------- .../subjective/update_allergies_widget.dart | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/widgets/patients/profile/soap_update/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart index ac5bee65..a5bcf434 100644 --- a/lib/widgets/patients/profile/soap_update/steps_widget.dart +++ b/lib/widgets/patients/profile/soap_update/steps_widget.dart @@ -75,7 +75,7 @@ class StepsWidget extends StatelessWidget { AppText( "SUBJECTIVE", fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: 14, ), ], ), @@ -125,7 +125,7 @@ class StepsWidget extends StatelessWidget { AppText( "OBJECTIVE", fontWeight: FontWeight.bold, - fontSize:SizeConfig.textMultiplier * 2.0, + fontSize:14, ), ], ), @@ -178,7 +178,7 @@ class StepsWidget extends StatelessWidget { AppText( "ASSESSMENT", fontWeight: FontWeight.bold, - fontSize:SizeConfig.textMultiplier * 2.0, + fontSize:14, ), ], ), @@ -230,7 +230,7 @@ class StepsWidget extends StatelessWidget { "PLAN", fontWeight: FontWeight.bold, textAlign: TextAlign.center, - fontSize:SizeConfig.textMultiplier * 2.0, + fontSize:14, ), ), ], @@ -347,7 +347,7 @@ class StepsWidget extends StatelessWidget { AppText( "هدف", fontWeight: FontWeight.bold, - fontSize:SizeConfig.textMultiplier * 2.0, + fontSize:14, ), ], ), @@ -400,7 +400,7 @@ class StepsWidget extends StatelessWidget { child: AppText( "تقدير", fontWeight: FontWeight.bold, - fontSize:SizeConfig.textMultiplier * 2.0, + fontSize:14, ), ), ], @@ -453,7 +453,7 @@ class StepsWidget extends StatelessWidget { child: AppText( "خطة", fontWeight: FontWeight.bold, - fontSize:SizeConfig.textMultiplier * 2.0, + fontSize:14, ), ), ], diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 086a8e1e..09297ab3 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -123,7 +123,7 @@ class _UpdateAllergiesWidgetState extends State { child: Row( children: [ AppText( - selectedAllergy.remark != null || + selectedAllergy.remark != null && selectedAllergy.remark != '' ? TranslationBase.of(context).remarks + " : " : '', From 5b5954c6f32689187548a34b4633bb04e4b23c36 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 31 Jan 2021 17:09:23 +0200 Subject: [PATCH 25/29] working on Admission request feature adding lookup --- lib/config/config.dart | 2 + lib/core/enum/master_lookup_key.dart | 5 +- .../model/admissionRequest/ward-model.dart | 26 ++ lib/core/service/base/lookup-service.dart | 8 + .../patient-admission-request-service.dart | 58 ++++ .../patient-admission-request-viewmodel.dart | 57 ++- .../profile/UCAF/UCAF-detail-screen.dart | 2 +- .../profile/UCAF/UCAF-input-screen.dart | 30 +- .../admission-request-detail-screen.dart | 7 +- .../admission-request_second-screen.dart | 328 +++++++++++------- 10 files changed, 381 insertions(+), 142 deletions(-) create mode 100644 lib/core/model/admissionRequest/ward-model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 1205d14c..abd07c03 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -191,6 +191,8 @@ const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; const DRUG_TO_DRUG = 'Services/DoctorApplication.svc/REST/DrugToDrugInteraction'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; +const GET_WARDS = 'Services/DoctorApplication.svc/REST/GetWards'; +const GET_DIAGNOSIS_TYPES = 'Services/DoctorApplication.svc/REST/DiagnosisTypes'; var selectedPatientType = 1; diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index f1ba1d46..e0c8ccc3 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -12,7 +12,8 @@ enum MasterKeysService { DiagnosisType, ICD10, TemperatureMethods, - Speciality + Speciality, + AdmissionRequestType, } extension SelectedMasterKeysService on MasterKeysService { @@ -57,6 +58,8 @@ extension SelectedMasterKeysService on MasterKeysService { return 2005; case MasterKeysService.Speciality: return 10; + case MasterKeysService.AdmissionRequestType: + return 2019; break; } } diff --git a/lib/core/model/admissionRequest/ward-model.dart b/lib/core/model/admissionRequest/ward-model.dart new file mode 100644 index 00000000..606758d3 --- /dev/null +++ b/lib/core/model/admissionRequest/ward-model.dart @@ -0,0 +1,26 @@ +class WardModel{ + + String description; + String descriptionN; + int floorID; + bool isActive; + + WardModel( + {this.description, this.descriptionN, this.floorID, this.isActive}); + + WardModel.fromJson(Map json) { + description = json['description']; + descriptionN = json['descriptionN']; + floorID = json['floorID']; + isActive = json['isActive']; + } + + Map toJson() { + final Map data = new Map(); + data['description'] = this.description; + data['descriptionN'] = this.descriptionN; + data['floorID'] = this.floorID; + data['isActive'] = this.isActive; + return data; + } +} \ No newline at end of file diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 3bc6e61e..48a78ae7 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -37,6 +37,7 @@ class LookupService extends BaseService { List listOfICD10 = []; List listOfTemperatureMethods = []; List listOfSpeciality = []; + List listOfAdmissionType = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -145,6 +146,13 @@ class LookupService extends BaseService { .add(MasterKeyModel.fromJson(v)); }); break; + case MasterKeysService.AdmissionRequestType: + listOfAdmissionType.clear(); + entryList.forEach((v) { + // listOfAdmissionType.add(MasterKeyModel.fromJson(v)); + listOfAdmissionType.add(v); + }); + break; } } diff --git a/lib/core/service/patient-admission-request-service.dart b/lib/core/service/patient-admission-request-service.dart index 62932908..dca7b60d 100644 --- a/lib/core/service/patient-admission-request-service.dart +++ b/lib/core/service/patient-admission-request-service.dart @@ -1,9 +1,14 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/ward-model.dart'; import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class AdmissionRequestService extends LookupService { List doctorsList = []; List specialityList = []; + List wardList = []; + List diagnosisTypesList = []; + List allergiesLookupList = []; setSpecialityList() { specialityList.clear(); @@ -12,6 +17,13 @@ class AdmissionRequestService extends LookupService { }); } + setAllergies() { + allergiesLookupList.clear(); + allergiesList.forEach((element) { + allergiesLookupList.add(element.toJson()); + }); + } + Future getDoctorsList() async { hasError = false; @@ -28,4 +40,50 @@ class AdmissionRequestService extends LookupService { body: Map(), ); } + + Future getWardList() async { + hasError = false; + + await baseAppClient.post( + GET_WARDS, + onSuccess: (dynamic response, int statusCode) { + wardList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + // wardList.add(WardModel.fromJson(v)); + wardList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + + Future getDiagnosisTypesList() async { + hasError = false; + + await baseAppClient.post( + GET_DIAGNOSIS_TYPES, + onSuccess: (dynamic response, int statusCode) { + diagnosisTypesList.clear(); + if (response['AdmissionDiagnosisList'] != null && + response['AdmissionDiagnosisList']['entityList'] != null) { + response['AdmissionDiagnosisList']['entityList'].forEach((v) { + // diagnosisTypesList.add(MasterKeyModel.fromJson(v)); + diagnosisTypesList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } } diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart index 15f54e5d..d427eb67 100644 --- a/lib/core/viewModel/patient-admission-request-viewmodel.dart +++ b/lib/core/viewModel/patient-admission-request-viewmodel.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/ward-model.dart'; import 'package:doctor_app_flutter/core/service/patient-admission-request-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; @@ -15,20 +16,24 @@ class AdmissionRequestViewModel extends BaseViewModel{ List get speciality => _admissionRequestService.specialityList; + List get wardList => _admissionRequestService.wardList; + + List get admissionTypeList => _admissionRequestService.listOfAdmissionType; + + List get diagnosisTypesList => _admissionRequestService.diagnosisTypesList; + + List get allergiesList => _admissionRequestService.allergiesLookupList; + String selectedLanguage; Future getLanguage() async { selectedLanguage = await sharedPref.getString(APP_Language); } - Future getMasterLookup() async { - setState(ViewState.Busy); + Future getSpecialityList() async { await getLanguage(); - await _admissionRequestService.getMasterLookup(MasterKeysService.Speciality); - if (_admissionRequestService.hasError) { - error = _admissionRequestService.error; - setState(ViewState.Error); - } else { + await getMasterLookup(MasterKeysService.Speciality); + if (!_admissionRequestService.hasError) { _admissionRequestService.setSpecialityList(); await getClinicDoctors(); } @@ -43,4 +48,42 @@ class AdmissionRequestViewModel extends BaseViewModel{ } else setState(ViewState.Idle); } + + Future getWards() async { + setState(ViewState.Busy); + await _admissionRequestService.getWardList(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getDiagnosis() async { + setState(ViewState.Busy); + await _admissionRequestService.getDiagnosisTypesList(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future getAllergies() async { + await getMasterLookup(MasterKeysService.Allergies); + if (!_admissionRequestService.hasError) { + _admissionRequestService.setAllergies(); + } + } + + Future getMasterLookup(MasterKeysService keysService) async { + setState(ViewState.Busy); + await _admissionRequestService.getMasterLookup(keysService); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } } \ No newline at end of file diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 0831fffe..71955b0c 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -301,7 +301,7 @@ class DiagnosisWidget extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 2.0, ), AppText( - "${diagnosis.icdCode10ID}}", + "${diagnosis.icdCode10ID}", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, ), diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 1a9ac4fa..9b9ae5a5 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -222,19 +222,19 @@ class _UCAFInputScreenState extends State { ), Container( child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .additionalTextComplaints, - helpers.parseHtmlString(model - .patientChiefComplaintList[0] - .chiefComplaint), - false), - enabled: false, - controller: _additionalComplaintsController, - keyboardType: TextInputType.text, - /*minLines: 4, - maxLines: 6,*/ - )), + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .additionalTextComplaints, + helpers.parseHtmlString(model + .patientChiefComplaintList[0] + .chiefComplaint), + false), + enabled: false, + controller: _additionalComplaintsController, + keyboardType: TextInputType.multiline, + minLines: 1, + maxLines: 15, + )), SizedBox( height: 16, ), @@ -363,7 +363,9 @@ class _UCAFInputScreenState extends State { false), enabled: true, controller: _signsController, - keyboardType: TextInputType.text, + keyboardType: TextInputType.multiline, + minLines: null, + maxLines: null, )), SizedBox( height: 16, diff --git a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart index 7ccc3ade..76ce6e2b 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-detail-screen.dart @@ -14,7 +14,6 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; -import 'admission-request_second-screen.dart'; class AdmissionRequestDetailScreen extends StatefulWidget { @override @@ -35,7 +34,7 @@ class _AdmissionRequestDetailScreenState final screenSize = MediaQuery.of(context).size; return BaseView( - onModelReady: (model) => model.getMasterLookup(), + onModelReady: (model) => model.getSpecialityList(), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).admissionRequest, @@ -178,6 +177,10 @@ class _AdmissionRequestDetailScreenState list: model.doctorsList, attributeName: 'DoctorName', attributeValueId: 'DoctorID', + usingSearch: true, + hintSearchText: + TranslationBase.of(context) + .doctorSearch, okText: TranslationBase.of(context) .ok, diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 3c1e06dc..b65b7f43 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -1,18 +1,24 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; import '../../../../routes.dart'; @@ -33,15 +39,17 @@ class _AdmissionRequestSecondScreenState bool _preAnesthesiaReferred = false; dynamic _selectedWard; dynamic _selectedAdmissionType; + dynamic _selectedDiagnosis; + dynamic _selectedAllergies; @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - // onModelReady: (model) => model.getMasterLookup(), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).admissionRequest, @@ -179,40 +187,44 @@ class _AdmissionRequestSecondScreenState Container( height: screenSize.height * 0.070, child: InkWell( - onTap: - /*model.doctorsList != null && - model.doctorsList.length > 0 + onTap: model.wardList != null && + model.wardList.length > 0 ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - :*/ - null, + openListDialogField('description', + 'description', model.wardList, + (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } + : () async { + await model.getWards(); + if (model.state == ViewState.Idle && + model.wardList.length > 0) { + openListDialogField('description', + 'description', model.wardList, + (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, child: TextField( decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).ward, - /* _selectedWard != null - ? _selectedWard['DoctorName'] - :*/ - null, + _selectedWard != null + ? _selectedWard['description'] + : null, true), enabled: false, ), @@ -238,41 +250,51 @@ class _AdmissionRequestSecondScreenState Container( height: screenSize.height * 0.070, child: InkWell( - onTap: - /*model.doctorsList != null && - model.doctorsList.length > 0 + onTap: model.admissionTypeList != null && + model.admissionTypeList.length > 0 ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - :*/ - null, + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } + : () async { + await model.getMasterLookup( + MasterKeysService + .AdmissionRequestType); + if (model.state == ViewState.Idle && + model.admissionTypeList.length > + 0) { + openListDialogField('nameEn', + 'id', model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, child: TextField( decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context) .admissionType, - /* _admissionType != null - ? _admissionType['DoctorName'] - :*/ - null, + _selectedAdmissionType != null + ? _selectedAdmissionType[ + 'nameEn'] + : null, true), enabled: false, ), @@ -284,41 +306,51 @@ class _AdmissionRequestSecondScreenState Container( height: screenSize.height * 0.070, child: InkWell( - onTap: - /*model.doctorsList != null && - model.doctorsList.length > 0 + onTap: model.diagnosisTypesList != null && + model.diagnosisTypesList.length > 0 ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - :*/ - null, + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = + selectedValue; + }); + }); + } + : () async { + await model.getDiagnosis(); + if (model.state == ViewState.Idle && + model.diagnosisTypesList + .length > + 0) { + openListDialogField( + 'nameEn', + 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, child: TextField( decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context) .diagnosis, - /* _admissionType != null - ? _admissionType['DoctorName'] - :*/ - null, + _selectedDiagnosis != null + ? _selectedDiagnosis['nameEn'] + : null, true), enabled: false, ), @@ -347,41 +379,48 @@ class _AdmissionRequestSecondScreenState Container( height: screenSize.height * 0.070, child: InkWell( - onTap: - /*model.doctorsList != null && - model.doctorsList.length > 0 + onTap: model.allergiesList != null && + model.allergiesList.length > 0 ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: model.doctorsList, - attributeName: 'DoctorName', - attributeValueId: 'DoctorID', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - :*/ - null, + openListDialogField('nameEn', 'id', + model.allergiesList, + (selectedValue) { + setState(() { + _selectedAllergies = + selectedValue; + }); + }); + } + : () async { + await model.getAllergies(); + if (model.state == ViewState.Idle && + model.allergiesList.length > + 0) { + openListDialogField('nameEn', + 'id', model.allergiesList, + (selectedValue) { + setState(() { + _selectedAllergies = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, child: TextField( decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context) .allergies, - /* _admissionType != null - ? _admissionType['DoctorName'] - :*/ - null, + _selectedAllergies != null + ? _selectedAllergies['nameEn'] + : null, true), enabled: false, ), @@ -426,4 +465,59 @@ class _AdmissionRequestSecondScreenState updateDate(picked); } } + + void openListDialogField(String attributeName, String attributeValueId, + List list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + +/* + onTap: model.wardList != null && + model.wardList.length > 0 + ? () { + openListDialogField('description', + 'description', model.wardList, + (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } + : () async { + await model.getWards(); + if (model.state == ViewState.Idle && + model.wardList.length > 0) { + openListDialogField('description', + 'description', model.wardList, + (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + */ } From 7505a6b6b0b0813fd115ffd91fdd7629b91556e7 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 31 Jan 2021 17:32:22 +0200 Subject: [PATCH 26/29] =?UTF-8?q?fix=20=C2=A0allergy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../subjective/update_allergies_widget.dart | 130 ++++++++++++------ .../soap_update/update_soap_index.dart | 2 +- 2 files changed, 90 insertions(+), 42 deletions(-) diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 09297ab3..afd14809 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -31,9 +31,6 @@ class UpdateAllergiesWidget extends StatefulWidget { } class _UpdateAllergiesWidgetState extends State { - - TextEditingController remarkController = TextEditingController(); - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -237,6 +234,9 @@ class _AddAllergiesState extends State { MasterKeyModel _selectedAllergySeverity; MasterKeyModel _selectedAllergy; TextEditingController remarkController = TextEditingController(); + TextEditingController severityController = TextEditingController(); + TextEditingController allergyController = TextEditingController(); + GlobalKey key = new GlobalKey>(); bool isFormSubmitted = false; @@ -244,23 +244,27 @@ class _AddAllergiesState extends State { String hintText, String selectedText, bool isDropDown, {IconData icon}) { return InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, + fontSize: 10, + color: Theme + .of(context) + .hintColor, + fontWeight: FontWeight.w700 ), ); } @@ -314,6 +318,7 @@ class _AddAllergiesState extends State { ? () { setState(() { _selectedAllergy = null; + allergyController.text = null; }); } : null, @@ -326,7 +331,15 @@ class _AddAllergiesState extends State { ? _selectedAllergy.nameEn : null, true, icon: EvaIcons.search), itemSubmitted: (item) => - setState(() => _selectedAllergy = item), + setState(() { + _selectedAllergy = item; + allergyController.text = + projectViewModel.isArabic + ? _selectedAllergy + .nameAr + : _selectedAllergy + .nameEn; + }), key: key, suggestions: model.allergiesList, itemBuilder: (context, suggestion) => @@ -334,27 +347,44 @@ class _AddAllergiesState extends State { child: Texts( projectViewModel.isArabic ? suggestion .nameAr : suggestion.nameEn), - padding: EdgeInsets.all(8.0)), + padding: EdgeInsets.all(2.0)), itemSorter: (a, b) => 1, itemFilter: (suggestion, input) => suggestion.nameAr.toLowerCase().startsWith( input.toLowerCase()) || suggestion.nameEn.toLowerCase() .startsWith(input.toLowerCase()), - ) : TextField( - decoration: textFieldSelectorDecoration( - TranslationBase - .of(context) - .selectAllergy, - _selectedAllergy != null - ? projectViewModel.isArabic - ? _selectedAllergy.nameAr - : _selectedAllergy.nameEn - : null, - true, - icon: EvaIcons.search), - enabled: false, - ), + ) : + TextFields( + onTapTextFields: model.allergiesList != null + ? () { + setState(() { + _selectedAllergy = null; + allergyController.text = null; + }); + } + : null, + hasLabelText: allergyController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .selectAllergy, + fontSize: 13.5, + readOnly: true, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: allergyController, + suffixIcon: EvaIcons.search, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }) ), ), if(isFormSubmitted && _selectedAllergy == null) @@ -362,10 +392,9 @@ class _AddAllergiesState extends State { SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergySeverityList != null + TextFields( + onTapTextFields: model + .allergySeverityList != null ? () { MasterKeyDailog dialog = MasterKeyDailog( list: model.allergySeverityList, @@ -376,6 +405,13 @@ class _AddAllergiesState extends State { setState(() { _selectedAllergySeverity = selectedValue; + + severityController.text = + projectViewModel.isArabic + ? _selectedAllergySeverity + .nameAr + : _selectedAllergySeverity + .nameEn; }); }, ); @@ -388,21 +424,33 @@ class _AddAllergiesState extends State { ); } : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase - .of(context) - .selectSeverity, - _selectedAllergySeverity != null - ? projectViewModel.isArabic?_selectedAllergySeverity.nameAr:_selectedAllergySeverity.nameEn - : null, - true), - enabled: false, - ), - ), + hasLabelText: severityController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .selectSeverity, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: severityController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), SizedBox( + height: 5, ), - if(isFormSubmitted && _selectedAllergySeverity == null) + if(isFormSubmitted && + _selectedAllergySeverity == null) CustomValidationError(), + SizedBox( height: 10, ), diff --git a/lib/widgets/patients/profile/soap_update/update_soap_index.dart b/lib/widgets/patients/profile/soap_update/update_soap_index.dart index 61e5a4b4..5c646121 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -37,7 +37,7 @@ class _UpdateSoapIndexState extends State GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel(); changePageViewIndex(pageIndex) { - changeLoadingState(true); + if (pageIndex != _currentIndex) changeLoadingState(true); _controller.jumpToPage(pageIndex); } From d66811546f18f3a36ca8a55a124cc22d6db4a0fb Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 31 Jan 2021 20:37:37 +0200 Subject: [PATCH 27/29] refactoring my code --- .../prescription/prescription_screen.dart | 722 +---------------- .../update_prescription_form.dart | 746 ++++++++++++++++++ lib/screens/procedures/procedure_screen.dart | 17 - 3 files changed, 747 insertions(+), 738 deletions(-) create mode 100644 lib/screens/prescription/update_prescription_form.dart diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 238a3812..290aadca 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -1,30 +1,15 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/screens/prescription/update_prescription_form.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; class NewPrescriptionScreen extends StatefulWidget { @override @@ -38,198 +23,10 @@ class _NewPrescriptionScreenState extends State { int testNum = 0; int strengthChar; PatiantInformtion patient; - dynamic route; - dynamic doseTime; - dynamic frequencyUpdate; - dynamic updatedDuration; - dynamic units; - - List doseTimeList; - List routeList; - List frequencyList; - List durationList; - List unitsList; @override void initState() { super.initState(); - routeList = List(); - doseTimeList = List(); - frequencyList = List(); - durationList = List(); - unitsList = List(); - - dynamic unit1 = {"id": 1, "name": "MG"}; - dynamic unit2 = {"id": 2, "name": "MCG"}; - dynamic unit3 = {"id": 3, "name": "GM"}; - dynamic frequency1 = {"id": 2, "name": "2 Times a day"}; - dynamic frequency2 = {"id": 3, "name": "3 Times a day"}; - dynamic frequency3 = {"id": 4, "name": "4 Times a day"}; - dynamic frequency4 = {"id": 8, "name": "As Needed"}; - dynamic frequency5 = {"id": 9, "name": "Bed Time"}; - dynamic frequency6 = {"id": 11, "name": "Every Other Day"}; - dynamic frequency7 = {"id": 29, "name": "Every Eight Hours"}; - dynamic frequency8 = {"id": 34, "name": "As Directed"}; - dynamic frequency9 = {"id": 22, "name": "Once Per Month"}; - dynamic frequency10 = {"id": 2, "name": "3 Times a day"}; - dynamic frequency11 = {"id": 21, "name": "Every 3 hours"}; - dynamic frequency12 = {"id": 20, "name": "Once a Week"}; - dynamic frequency13 = {"id": 12, "name": "Every Half Hour"}; - dynamic frequency14 = {"id": 10, "name": "4 Times a Day"}; - dynamic frequency15 = {"id": 24, "name": "Once Every 2 Months"}; - dynamic frequency16 = {"id": 25, "name": "Every One Hour"}; - dynamic frequency17 = {"id": 26, "name": "Every Two Hours"}; - dynamic frequency18 = {"id": 28, "name": "Every Six Hours"}; - dynamic doseTime1 = {"id": 1, "name": "Before Meals"}; - dynamic doseTime2 = {"id": 2, "name": "After Meals"}; - dynamic doseTime3 = {"id": 3, "name": "With Meals"}; - dynamic doseTime4 = {"id": 4, "name": "In The Morning"}; - dynamic doseTime5 = {"id": 5, "name": "In the Evening"}; - dynamic doseTime6 = {"id": 6, "name": "After Supper"}; - dynamic doseTime7 = {"id": 7, "name": "With Supper"}; - dynamic doseTime8 = {"id": 8, "name": "Before Breakfast"}; - dynamic doseTime9 = {"id": 9, "name": "In the Afternoon"}; - dynamic doseTime10 = {"id": 10, "name": "While wake"}; - dynamic doseTime11 = {"id": 12, "name": "Any Time"}; - dynamic doseTime12 = {"id": 21, "name": "Bed Time"}; - dynamic doseTime13 = {"id": 13, "name": "30 Minutes Before Meals"}; - dynamic doseTime14 = {"id": 14, "name": "1 Hour Before Meals"}; - dynamic doseTime15 = {"id": 15, "name": "2 Hours After Meal"}; - dynamic doseTime16 = {"id": 16, "name": "After Breakfast"}; - dynamic doseTime17 = {"id": 17, "name": "Before Lunch"}; - dynamic doseTime18 = {"id": 18, "name": "After Lunch"}; - dynamic doseTime19 = {"id": 20, "name": "After Dinner"}; - dynamic doseTime20 = {"id": 21, "name": "Bed Time"}; - dynamic doseTime21 = {"id": 11, "name": "Now"}; - dynamic route1 = {"id": 7, "name": "By Mouth"}; - dynamic route2 = {"id": 10, "name": "Inhale by Mouth"}; - dynamic route3 = {"id": 15, "name": "for INJECTION"}; - dynamic route4 = {"id": 17, "name": "Drops"}; - dynamic route5 = {"id": 18, "name": "Rub On"}; - dynamic route6 = {"id": 20, "name": "Spary"}; - dynamic route7 = {"id": 27, "name": "In Both EYES"}; - dynamic route8 = {"id": 28, "name": "In Both Ears"}; - dynamic route9 = {"id": 32, "name": "Intramuscular"}; - dynamic route10 = {"id": 60, "name": "TRANSDERMAL"}; - dynamic route11 = {"id": 59, "name": "OROPHARYNGEAL"}; - dynamic route12 = {"id": 15, "name": "for INJECTION"}; - dynamic route13 = {"id": 58, "name": "SUBCUTANEOUS"}; - dynamic route14 = {"id": 57, "name": "NASOGASTRIC"}; - dynamic route15 = {"id": 56, "name": "IRRIGATION"}; - dynamic route16 = {"id": 55, "name": "INTRAVITREAL"}; - dynamic route17 = {"id": 54, "name": "INTRAVENOUS BOLUS"}; - dynamic route18 = {"id": 51, "name": "EPIDURAL"}; - dynamic route19 = {"id": 47, "name": "Parenteral"}; - dynamic route20 = {"id": 43, "name": "IM"}; - dynamic route21 = {"id": 42, "name": "IV"}; - dynamic route22 = {"id": 41, "name": "Sublingual"}; - dynamic route23 = {"id": 40, "name": "For Nebulization"}; - dynamic route24 = {"id": 39, "name": "Nasal"}; - dynamic route25 = {"id": 37, "name": "Inserted into Vagina"}; - dynamic route26 = {"id": 36, "name": "Inserted into Rectum"}; - dynamic route27 = {"id": 31, "name": "In Each Nostril"}; - dynamic duration1 = {"id": 1, "name": "For 1 Day"}; - dynamic duration2 = {"id": 2, "name": "For 2 Days"}; - dynamic duration3 = {"id": 3, "name": "For 3 Days"}; - dynamic duration4 = {"id": 4, "name": "For 4 Days"}; - dynamic duration5 = {"id": 5, "name": "For 5 Days"}; - dynamic duration6 = {"id": 6, "name": "For 6 Days"}; - dynamic duration7 = {"id": 7, "name": "For 7 Days"}; - dynamic duration8 = {"id": 8, "name": "For 8 Days"}; - dynamic duration9 = {"id": 9, "name": "For 9 Days"}; - dynamic duration10 = {"id": 10, "name": "For 10 Days"}; - dynamic duration11 = {"id": 14, "name": "For 14 Days"}; - dynamic duration12 = {"id": 21, "name": "For 21 Days"}; - dynamic duration13 = {"id": 30, "name": "For 30 Days"}; - dynamic duration14 = {"id": 45, "name": "For 45 Days"}; - dynamic duration15 = {"id": 60, "name": "For 60 Days"}; - dynamic duration16 = {"id": 90, "name": "For 90 Days"}; - - durationList.add(duration1); - durationList.add(duration2); - durationList.add(duration3); - durationList.add(duration4); - durationList.add(duration5); - durationList.add(duration6); - durationList.add(duration7); - durationList.add(duration8); - durationList.add(duration9); - durationList.add(duration10); - durationList.add(duration11); - durationList.add(duration12); - durationList.add(duration13); - durationList.add(duration14); - durationList.add(duration15); - durationList.add(duration16); - frequencyList.add(frequency1); - frequencyList.add(frequency2); - frequencyList.add(frequency3); - frequencyList.add(frequency4); - frequencyList.add(frequency5); - frequencyList.add(frequency6); - frequencyList.add(frequency7); - frequencyList.add(frequency8); - frequencyList.add(frequency9); - frequencyList.add(frequency10); - frequencyList.add(frequency11); - frequencyList.add(frequency12); - frequencyList.add(frequency13); - frequencyList.add(frequency14); - frequencyList.add(frequency15); - frequencyList.add(frequency16); - frequencyList.add(frequency17); - frequencyList.add(frequency18); - doseTimeList.add(doseTime1); - doseTimeList.add(doseTime2); - doseTimeList.add(doseTime3); - doseTimeList.add(doseTime4); - doseTimeList.add(doseTime5); - doseTimeList.add(doseTime6); - doseTimeList.add(doseTime7); - doseTimeList.add(doseTime8); - doseTimeList.add(doseTime9); - doseTimeList.add(doseTime10); - doseTimeList.add(doseTime11); - doseTimeList.add(doseTime12); - doseTimeList.add(doseTime13); - doseTimeList.add(doseTime14); - doseTimeList.add(doseTime15); - doseTimeList.add(doseTime16); - doseTimeList.add(doseTime17); - doseTimeList.add(doseTime18); - doseTimeList.add(doseTime19); - doseTimeList.add(doseTime20); - doseTimeList.add(doseTime21); - routeList.add(route1); - routeList.add(route2); - routeList.add(route3); - routeList.add(route4); - routeList.add(route5); - routeList.add(route6); - routeList.add(route7); - routeList.add(route8); - routeList.add(route9); - routeList.add(route10); - routeList.add(route11); - routeList.add(route12); - routeList.add(route13); - routeList.add(route14); - routeList.add(route15); - routeList.add(route16); - routeList.add(route17); - routeList.add(route18); - routeList.add(route19); - routeList.add(route20); - routeList.add(route21); - routeList.add(route22); - routeList.add(route23); - routeList.add(route24); - routeList.add(route25); - routeList.add(route26); - routeList.add(route27); - unitsList.add(unit1); - unitsList.add(unit2); - unitsList.add(unit3); } Widget build(BuildContext context) { @@ -773,521 +570,4 @@ class _NewPrescriptionScreenState extends State { }); } } - - void updatePrescriptionForm( - {context, - String drugName, - int drugId, - String remarks, - PrescriptionViewModel model, - PatiantInformtion patient, - String rouat, - String frequency, - String dose, - String duration, - String doseStreangth, - String doseUnit, - String enteredRemarks, - String startDate}) { - TextEditingController remarksController = TextEditingController(); - TextEditingController doseController = TextEditingController(); - TextEditingController frequencyController = TextEditingController(); - TextEditingController routeController = TextEditingController(); - showModalBottomSheet( - context: context, - isScrollControlled: true, - builder: (BuildContext context) { - return StatefulBuilder(builder: (BuildContext context, - StateSetter setState /*You can rename this!*/) { - return DraggableScrollableSheet( - initialChildSize: 0.90, - maxChildSize: 0.90, - minChildSize: 0.6, - builder: - (BuildContext context, ScrollController scrollController) { - return Container( - height: MediaQuery.of(context).size.height * 1.0, - child: Form( - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 20.0, vertical: 12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - drugName.toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: 10.0, - ), - Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * - 0.060, - width: double.infinity, - child: Row( - children: [ - Container( - width: MediaQuery.of(context) - .size - .width * - 0.500, - child: TextFields( - inputFormatters: [ - LengthLimitingTextInputFormatter( - 4) - ], - hintText: - TranslationBase.of(context) - .strength, - controller: strengthController, - keyboardType: TextInputType.number, - onChanged: (String value) { - setState(() { - strengthChar = value.length; - }); - if (strengthChar >= 4) { - DrAppToastMsg.showErrorToast( - "Only 4 Digits allowed for strength"); - } - }, - // validator: (value) { - // if (value.isEmpty && - // strengthController.text.length > - // 4) - // return TranslationBase.of(context) - // .emptyMessage; - // else - // return null; - // }, - ), - ), - SizedBox( - width: 10.0, - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.3700, - child: InkWell( - onTap: unitsList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: unitsList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - units = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - 'UNIT Type', - units != null - ? units['name'] - : null, - true), - enabled: false, - ), - ), - ), - ], - ), - ), - SizedBox( - height: 12, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: routeList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: routeList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - route = selectedValue; - }); - if (route == null) { - route = route['id']; - } - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - 'Route', - route != null - ? route['name'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: doseTimeList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: doseTimeList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - doseTime = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .doseTime, - doseTime != null - ? doseTime['name'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: frequencyList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: frequencyList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - frequencyUpdate = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .frequency, - frequencyUpdate != null - ? frequencyUpdate['name'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: durationList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: durationList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - updatedDuration = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .duration, - updatedDuration != null - ? updatedDuration['name'] - .toString() - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: remarks, - controller: remarksController, - maxLines: 7, - minLines: 4, - ), - ), - SizedBox( - height: 12.0, - ), - SizedBox( - height: MediaQuery.of(context).size.height * - 0.12, - ), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 2), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: 'update prescription' - .toUpperCase(), - onPressed: () { - updatePrescription( - newDoseStreangth: - strengthController - .text.isNotEmpty - ? strengthController - .text - : doseStreangth, - newUnit: units != null - ? units['id'].toString() - : doseUnit, - doseUnit: doseUnit, - doseStreangth: doseStreangth, - duration: duration, - startDate: startDate, - doseId: dose, - frequencyId: frequency, - routeId: rouat, - patient: patient, - model: model, - newDuration: updatedDuration != - null - ? updatedDuration['id'] - .toString() - : duration, - drugId: drugId, - remarks: remarksController.text, - route: route != null - ? route['id'].toString() - : rouat, - frequency: frequencyUpdate != null - ? frequencyUpdate['id'] - .toString() - : frequency, - dose: doseTime != null - ? doseTime['id'].toString() - : dose, - enteredRemarks: enteredRemarks); - Navigator.pop(context); - }, - ), - ], - ), - ), - ], - ), - ], - ), - ), - )); - }); - }); - }); - } - - // String getName(String num) { - // dynamic x = routeList.where((i) { - // return i['id'] == int.parse(num); - // }).first(); - // return x.toString(); - // } - - updatePrescription( - {PrescriptionViewModel model, - int drugId, - String frequencyId, - String remarks, - String dose, - String doseId, - String frequency, - String route, - String routeId, - String startDate, - String doseUnit, - String doseStreangth, - String newDoseStreangth, - String duration, - String newDuration, - String newUnit, - String enteredRemarks, - PatiantInformtion patient}) async { - //PrescriptionViewModel model = PrescriptionViewModel(); - PostPrescriptionReqModel updatePrescriptionReqModel = - new PostPrescriptionReqModel(); - List sss = List(); - - updatePrescriptionReqModel.appointmentNo = patient.appointmentNo; - updatePrescriptionReqModel.clinicID = patient.clinicId; - updatePrescriptionReqModel.episodeID = patient.episodeNo; - updatePrescriptionReqModel.patientMRN = patient.patientMRN; - - sss.add(PrescriptionRequestModel( - covered: true, - dose: newDoseStreangth.isNotEmpty - ? int.parse(newDoseStreangth) - : int.parse(doseStreangth), - //frequency.isNotEmpty ? int.parse(dose) : 1, - itemId: drugId, - doseUnitId: - newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit), - route: route.isNotEmpty ? int.parse(route) : int.parse(routeId), - frequency: frequency.isNotEmpty - ? int.parse(frequency) - : int.parse(frequencyId), - remarks: remarks.isEmpty ? enteredRemarks : remarks, - approvalRequired: true, - icdcode10Id: "test2", - doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId), - duration: newDuration.isNotEmpty - ? int.parse(newDuration) - : int.parse(duration), - doseStartDate: startDate)); - updatePrescriptionReqModel.prescriptionRequestModel = sss; - //postProcedureReqModel.procedures = controlsProcedure; - - await model.updatePrescription( - updatePrescriptionReqModel, patient.patientMRN); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast('Medication has been updated'); - } - } - - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown - ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) - : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } } diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart new file mode 100644 index 00000000..01986813 --- /dev/null +++ b/lib/screens/prescription/update_prescription_form.dart @@ -0,0 +1,746 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class UpdatePrescriptionForm extends StatefulWidget { + final String drugName; + final String doseStreangth; + final int drugId; + final String remarks; + final PatiantInformtion patient; + final String duration; + final String route; + final String dose; + final String doseUnit; + final String enteredRemarks; + final String startDate; + final String frequency; + final PrescriptionViewModel model; + + UpdatePrescriptionForm( + {this.drugName, + this.doseStreangth, + this.drugId, + this.remarks, + this.patient, + this.duration, + this.route, + this.dose, + this.startDate, + this.doseUnit, + this.enteredRemarks, + this.frequency, + this.model}); + @override + _UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState(); +} + +class _UpdatePrescriptionFormState extends State { + TextEditingController strengthController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); + int testNum = 0; + int strengthChar; + PatiantInformtion patient; + dynamic route; + dynamic doseTime; + dynamic frequencyUpdate; + dynamic updatedDuration; + dynamic units; + + List doseTimeList; + List routeList; + List frequencyList; + List durationList; + List unitsList; + + @override + void initState() { + super.initState(); + routeList = List(); + doseTimeList = List(); + frequencyList = List(); + durationList = List(); + unitsList = List(); + + dynamic unit1 = {"id": 1, "name": "MG"}; + dynamic unit2 = {"id": 2, "name": "MCG"}; + dynamic unit3 = {"id": 3, "name": "GM"}; + dynamic frequency1 = {"id": 2, "name": "2 Times a day"}; + dynamic frequency2 = {"id": 3, "name": "3 Times a day"}; + dynamic frequency3 = {"id": 4, "name": "4 Times a day"}; + dynamic frequency4 = {"id": 8, "name": "As Needed"}; + dynamic frequency5 = {"id": 9, "name": "Bed Time"}; + dynamic frequency6 = {"id": 11, "name": "Every Other Day"}; + dynamic frequency7 = {"id": 29, "name": "Every Eight Hours"}; + dynamic frequency8 = {"id": 34, "name": "As Directed"}; + dynamic frequency9 = {"id": 22, "name": "Once Per Month"}; + dynamic frequency10 = {"id": 2, "name": "3 Times a day"}; + dynamic frequency11 = {"id": 21, "name": "Every 3 hours"}; + dynamic frequency12 = {"id": 20, "name": "Once a Week"}; + dynamic frequency13 = {"id": 12, "name": "Every Half Hour"}; + dynamic frequency14 = {"id": 10, "name": "4 Times a Day"}; + dynamic frequency15 = {"id": 24, "name": "Once Every 2 Months"}; + dynamic frequency16 = {"id": 25, "name": "Every One Hour"}; + dynamic frequency17 = {"id": 26, "name": "Every Two Hours"}; + dynamic frequency18 = {"id": 28, "name": "Every Six Hours"}; + dynamic doseTime1 = {"id": 1, "name": "Before Meals"}; + dynamic doseTime2 = {"id": 2, "name": "After Meals"}; + dynamic doseTime3 = {"id": 3, "name": "With Meals"}; + dynamic doseTime4 = {"id": 4, "name": "In The Morning"}; + dynamic doseTime5 = {"id": 5, "name": "In the Evening"}; + dynamic doseTime6 = {"id": 6, "name": "After Supper"}; + dynamic doseTime7 = {"id": 7, "name": "With Supper"}; + dynamic doseTime8 = {"id": 8, "name": "Before Breakfast"}; + dynamic doseTime9 = {"id": 9, "name": "In the Afternoon"}; + dynamic doseTime10 = {"id": 10, "name": "While wake"}; + dynamic doseTime11 = {"id": 12, "name": "Any Time"}; + dynamic doseTime12 = {"id": 21, "name": "Bed Time"}; + dynamic doseTime13 = {"id": 13, "name": "30 Minutes Before Meals"}; + dynamic doseTime14 = {"id": 14, "name": "1 Hour Before Meals"}; + dynamic doseTime15 = {"id": 15, "name": "2 Hours After Meal"}; + dynamic doseTime16 = {"id": 16, "name": "After Breakfast"}; + dynamic doseTime17 = {"id": 17, "name": "Before Lunch"}; + dynamic doseTime18 = {"id": 18, "name": "After Lunch"}; + dynamic doseTime19 = {"id": 20, "name": "After Dinner"}; + dynamic doseTime20 = {"id": 21, "name": "Bed Time"}; + dynamic doseTime21 = {"id": 11, "name": "Now"}; + dynamic route1 = {"id": 7, "name": "By Mouth"}; + dynamic route2 = {"id": 10, "name": "Inhale by Mouth"}; + dynamic route3 = {"id": 15, "name": "for INJECTION"}; + dynamic route4 = {"id": 17, "name": "Drops"}; + dynamic route5 = {"id": 18, "name": "Rub On"}; + dynamic route6 = {"id": 20, "name": "Spary"}; + dynamic route7 = {"id": 27, "name": "In Both EYES"}; + dynamic route8 = {"id": 28, "name": "In Both Ears"}; + dynamic route9 = {"id": 32, "name": "Intramuscular"}; + dynamic route10 = {"id": 60, "name": "TRANSDERMAL"}; + dynamic route11 = {"id": 59, "name": "OROPHARYNGEAL"}; + dynamic route12 = {"id": 15, "name": "for INJECTION"}; + dynamic route13 = {"id": 58, "name": "SUBCUTANEOUS"}; + dynamic route14 = {"id": 57, "name": "NASOGASTRIC"}; + dynamic route15 = {"id": 56, "name": "IRRIGATION"}; + dynamic route16 = {"id": 55, "name": "INTRAVITREAL"}; + dynamic route17 = {"id": 54, "name": "INTRAVENOUS BOLUS"}; + dynamic route18 = {"id": 51, "name": "EPIDURAL"}; + dynamic route19 = {"id": 47, "name": "Parenteral"}; + dynamic route20 = {"id": 43, "name": "IM"}; + dynamic route21 = {"id": 42, "name": "IV"}; + dynamic route22 = {"id": 41, "name": "Sublingual"}; + dynamic route23 = {"id": 40, "name": "For Nebulization"}; + dynamic route24 = {"id": 39, "name": "Nasal"}; + dynamic route25 = {"id": 37, "name": "Inserted into Vagina"}; + dynamic route26 = {"id": 36, "name": "Inserted into Rectum"}; + dynamic route27 = {"id": 31, "name": "In Each Nostril"}; + dynamic duration1 = {"id": 1, "name": "For 1 Day"}; + dynamic duration2 = {"id": 2, "name": "For 2 Days"}; + dynamic duration3 = {"id": 3, "name": "For 3 Days"}; + dynamic duration4 = {"id": 4, "name": "For 4 Days"}; + dynamic duration5 = {"id": 5, "name": "For 5 Days"}; + dynamic duration6 = {"id": 6, "name": "For 6 Days"}; + dynamic duration7 = {"id": 7, "name": "For 7 Days"}; + dynamic duration8 = {"id": 8, "name": "For 8 Days"}; + dynamic duration9 = {"id": 9, "name": "For 9 Days"}; + dynamic duration10 = {"id": 10, "name": "For 10 Days"}; + dynamic duration11 = {"id": 14, "name": "For 14 Days"}; + dynamic duration12 = {"id": 21, "name": "For 21 Days"}; + dynamic duration13 = {"id": 30, "name": "For 30 Days"}; + dynamic duration14 = {"id": 45, "name": "For 45 Days"}; + dynamic duration15 = {"id": 60, "name": "For 60 Days"}; + dynamic duration16 = {"id": 90, "name": "For 90 Days"}; + + durationList.add(duration1); + durationList.add(duration2); + durationList.add(duration3); + durationList.add(duration4); + durationList.add(duration5); + durationList.add(duration6); + durationList.add(duration7); + durationList.add(duration8); + durationList.add(duration9); + durationList.add(duration10); + durationList.add(duration11); + durationList.add(duration12); + durationList.add(duration13); + durationList.add(duration14); + durationList.add(duration15); + durationList.add(duration16); + frequencyList.add(frequency1); + frequencyList.add(frequency2); + frequencyList.add(frequency3); + frequencyList.add(frequency4); + frequencyList.add(frequency5); + frequencyList.add(frequency6); + frequencyList.add(frequency7); + frequencyList.add(frequency8); + frequencyList.add(frequency9); + frequencyList.add(frequency10); + frequencyList.add(frequency11); + frequencyList.add(frequency12); + frequencyList.add(frequency13); + frequencyList.add(frequency14); + frequencyList.add(frequency15); + frequencyList.add(frequency16); + frequencyList.add(frequency17); + frequencyList.add(frequency18); + doseTimeList.add(doseTime1); + doseTimeList.add(doseTime2); + doseTimeList.add(doseTime3); + doseTimeList.add(doseTime4); + doseTimeList.add(doseTime5); + doseTimeList.add(doseTime6); + doseTimeList.add(doseTime7); + doseTimeList.add(doseTime8); + doseTimeList.add(doseTime9); + doseTimeList.add(doseTime10); + doseTimeList.add(doseTime11); + doseTimeList.add(doseTime12); + doseTimeList.add(doseTime13); + doseTimeList.add(doseTime14); + doseTimeList.add(doseTime15); + doseTimeList.add(doseTime16); + doseTimeList.add(doseTime17); + doseTimeList.add(doseTime18); + doseTimeList.add(doseTime19); + doseTimeList.add(doseTime20); + doseTimeList.add(doseTime21); + routeList.add(route1); + routeList.add(route2); + routeList.add(route3); + routeList.add(route4); + routeList.add(route5); + routeList.add(route6); + routeList.add(route7); + routeList.add(route8); + routeList.add(route9); + routeList.add(route10); + routeList.add(route11); + routeList.add(route12); + routeList.add(route13); + routeList.add(route14); + routeList.add(route15); + routeList.add(route16); + routeList.add(route17); + routeList.add(route18); + routeList.add(route19); + routeList.add(route20); + routeList.add(route21); + routeList.add(route22); + routeList.add(route23); + routeList.add(route24); + routeList.add(route25); + routeList.add(route26); + routeList.add(route27); + unitsList.add(unit1); + unitsList.add(unit2); + unitsList.add(unit3); + } + + @override + Widget build(BuildContext context) { + return StatefulBuilder(builder: + (BuildContext context, StateSetter setState /*You can rename this!*/) { + return DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.6, + builder: (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Form( + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.drugName.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 10.0, + ), + Column( + children: [ + Container( + height: + MediaQuery.of(context).size.height * 0.060, + width: double.infinity, + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * + 0.500, + child: TextFields( + inputFormatters: [ + LengthLimitingTextInputFormatter(4) + ], + hintText: + TranslationBase.of(context).strength, + controller: strengthController, + keyboardType: TextInputType.number, + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 4) { + DrAppToastMsg.showErrorToast( + "Only 4 Digits allowed for strength"); + } + }, + // validator: (value) { + // if (value.isEmpty && + // strengthController.text.length > + // 4) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), + ), + SizedBox( + width: 10.0, + ), + Container( + width: MediaQuery.of(context).size.width * + 0.3700, + child: InkWell( + onTap: unitsList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: unitsList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + units = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + 'UNIT Type', + units != null + ? units['name'] + : null, + true), + enabled: false, + ), + ), + ), + ], + ), + ), + SizedBox( + height: 12, + ), + Container( + height: + MediaQuery.of(context).size.height * 0.070, + child: InkWell( + onTap: routeList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: routeList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + }); + if (route == null) { + route = route['id']; + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + 'Route', + route != null ? route['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * 0.070, + child: InkWell( + onTap: doseTimeList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: doseTimeList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).doseTime, + doseTime != null + ? doseTime['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * 0.070, + child: InkWell( + onTap: frequencyList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: frequencyList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + frequencyUpdate = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).frequency, + frequencyUpdate != null + ? frequencyUpdate['name'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * 0.070, + child: InkWell( + onTap: durationList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: durationList, + attributeName: 'name', + attributeValueId: 'id', + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + updatedDuration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).duration, + updatedDuration != null + ? updatedDuration['name'].toString() + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: widget.remarks, + controller: remarksController, + maxLines: 7, + minLines: 4, + ), + ), + SizedBox( + height: 12.0, + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.12, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'update prescription'.toUpperCase(), + onPressed: () { + updatePrescription( + newDoseStreangth: + strengthController.text.isNotEmpty + ? strengthController.text + : widget.doseStreangth, + newUnit: units != null + ? units['id'].toString() + : widget.doseUnit, + doseUnit: widget.doseUnit, + doseStreangth: widget.doseStreangth, + duration: widget.duration, + startDate: widget.startDate, + doseId: widget.dose, + frequencyId: widget.frequency, + routeId: widget.route, + patient: widget.patient, + model: widget.model, + newDuration: updatedDuration != null + ? updatedDuration['id'].toString() + : widget.duration, + drugId: widget.drugId, + remarks: remarksController.text, + route: route != null + ? route['id'].toString() + : widget.route, + frequency: frequencyUpdate != null + ? frequencyUpdate['id'].toString() + : widget.frequency, + dose: doseTime != null + ? doseTime['id'].toString() + : widget.dose, + enteredRemarks: + widget.enteredRemarks); + Navigator.pop(context); + }, + ), + ], + ), + ), + ], + ), + ], + ), + ), + )); + }); + }); + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + updatePrescription( + {PrescriptionViewModel model, + int drugId, + String frequencyId, + String remarks, + String dose, + String doseId, + String frequency, + String route, + String routeId, + String startDate, + String doseUnit, + String doseStreangth, + String newDoseStreangth, + String duration, + String newDuration, + String newUnit, + String enteredRemarks, + PatiantInformtion patient}) async { + //PrescriptionViewModel model = PrescriptionViewModel(); + PostPrescriptionReqModel updatePrescriptionReqModel = + new PostPrescriptionReqModel(); + List sss = List(); + + updatePrescriptionReqModel.appointmentNo = patient.appointmentNo; + updatePrescriptionReqModel.clinicID = patient.clinicId; + updatePrescriptionReqModel.episodeID = patient.episodeNo; + updatePrescriptionReqModel.patientMRN = patient.patientMRN; + + sss.add(PrescriptionRequestModel( + covered: true, + dose: newDoseStreangth.isNotEmpty + ? int.parse(newDoseStreangth) + : int.parse(doseStreangth), + //frequency.isNotEmpty ? int.parse(dose) : 1, + itemId: drugId, + doseUnitId: + newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit), + route: route.isNotEmpty ? int.parse(route) : int.parse(routeId), + frequency: frequency.isNotEmpty + ? int.parse(frequency) + : int.parse(frequencyId), + remarks: remarks.isEmpty ? enteredRemarks : remarks, + approvalRequired: true, + icdcode10Id: "test2", + doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId), + duration: newDuration.isNotEmpty + ? int.parse(newDuration) + : int.parse(duration), + doseStartDate: startDate)); + updatePrescriptionReqModel.prescriptionRequestModel = sss; + //postProcedureReqModel.procedures = controlsProcedure; + + await model.updatePrescription( + updatePrescriptionReqModel, patient.patientMRN); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else if (model.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast('Medication has been updated'); + } + } +} + +void updatePrescriptionForm( + {context, + String drugName, + int drugId, + String remarks, + PrescriptionViewModel model, + PatiantInformtion patient, + String rouat, + String frequency, + String dose, + String duration, + String doseStreangth, + String doseUnit, + String enteredRemarks, + String startDate}) { + TextEditingController remarksController = TextEditingController(); + TextEditingController doseController = TextEditingController(); + TextEditingController frequencyController = TextEditingController(); + TextEditingController routeController = TextEditingController(); + showModalBottomSheet( + context: context, + isScrollControlled: true, + builder: (BuildContext context) { + return UpdatePrescriptionForm( + drugName: drugName, + patient: patient, + doseStreangth: doseStreangth, + remarks: remarks, + drugId: drugId, + enteredRemarks: enteredRemarks, + duration: duration, + dose: dose, + doseUnit: doseUnit, + frequency: frequency, + route: rouat, + startDate: startDate, + model: model, + ); + }); +} diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 9fb8510c..ca126609 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -1,32 +1,15 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; -import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; -import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; class ProcedureScreen extends StatefulWidget { @override From 15dd0f7c1a222d9dbff984577500a3d314e5c14e Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Feb 2021 13:58:46 +0200 Subject: [PATCH 28/29] bug fix --- lib/core/enum/master_lookup_key.dart | 28 +- lib/core/service/base/lookup-service.dart | 77 +- lib/core/service/prescription_service.dart | 3 +- lib/core/viewModel/medicine_view_model.dart | 94 +- .../prescription/add_prescription_form.dart | 262 +---- .../prescription/prescription_screen.dart | 1 - .../update_prescription_form.dart | 918 ++++++++---------- lib/screens/procedures/update-procedure.dart | 306 ++++-- 8 files changed, 832 insertions(+), 857 deletions(-) diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index f1ba1d46..58faa986 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -12,7 +12,13 @@ enum MasterKeysService { DiagnosisType, ICD10, TemperatureMethods, - Speciality + Speciality, + MedicationStrength, + MedicationDuration, + MedicationRoute, + MedicationFrequency, + MedicationDoseTime, + MedicationIndications, } extension SelectedMasterKeysService on MasterKeysService { @@ -45,7 +51,8 @@ extension SelectedMasterKeysService on MasterKeysService { break; case MasterKeysService.physiotherapyGoals: return 117; - break;case MasterKeysService.DiagnosisCondition: + break; + case MasterKeysService.DiagnosisCondition: return 34; break; case MasterKeysService.DiagnosisType: @@ -57,6 +64,23 @@ extension SelectedMasterKeysService on MasterKeysService { return 2005; case MasterKeysService.Speciality: return 10; + case MasterKeysService.MedicationStrength: + return 2100; + break; + case MasterKeysService.MedicationDuration: + return 118; + break; + case MasterKeysService.MedicationRoute: + return 32; + break; + case MasterKeysService.MedicationFrequency: + return 31; + break; + case MasterKeysService.MedicationDoseTime: + return 30; + break; + case MasterKeysService.MedicationIndications: + return 450; break; } } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 3bc6e61e..1acc8cec 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -11,6 +11,13 @@ class LookupService extends BaseService { List get allergySeverityList => _allergySeverityList; List _allergySeverityList = []; + List medicationStrengthList = []; + List medicationDurationList = []; + List medicationRouteList = []; + List medicationFrequencyList = []; + List medicationDoseTimeList = []; + List medicationIndicationsList = []; + List get historyFamilyList => _historyFamilyList; List _historyFamilyList = []; @@ -32,11 +39,11 @@ class LookupService extends BaseService { List _physicalExaminationList = []; // List listOfPhysiotherapyGoals = []; - List listOfDiagnosisType = []; - List listOfDiagnosisCondition = []; - List listOfICD10 = []; - List listOfTemperatureMethods = []; - List listOfSpeciality = []; + List listOfDiagnosisType = []; + List listOfDiagnosisCondition = []; + List listOfICD10 = []; + List listOfTemperatureMethods = []; + List listOfSpeciality = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -110,42 +117,72 @@ class LookupService extends BaseService { }); break; - case MasterKeysService.DiagnosisType: - listOfDiagnosisType.clear(); + case MasterKeysService.DiagnosisType: + listOfDiagnosisType.clear(); entryList.forEach((v) { - listOfDiagnosisType - .add(MasterKeyModel.fromJson(v)); + listOfDiagnosisType.add(MasterKeyModel.fromJson(v)); }); break; - case MasterKeysService.DiagnosisCondition: - listOfDiagnosisCondition.clear(); + case MasterKeysService.DiagnosisCondition: + listOfDiagnosisCondition.clear(); entryList.forEach((v) { - listOfDiagnosisCondition - .add(MasterKeyModel.fromJson(v)); + listOfDiagnosisCondition.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.ICD10: listOfICD10.clear(); entryList.forEach((v) { - listOfICD10 - .add(MasterKeyModel.fromJson(v)); + listOfICD10.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.TemperatureMethods: listOfTemperatureMethods.clear(); entryList.forEach((v) { - listOfTemperatureMethods - .add(MasterKeyModel.fromJson(v)); + listOfTemperatureMethods.add(MasterKeyModel.fromJson(v)); }); break; case MasterKeysService.Speciality: listOfSpeciality.clear(); entryList.forEach((v) { - listOfSpeciality - .add(MasterKeyModel.fromJson(v)); + listOfSpeciality.add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.MedicationStrength: + medicationStrengthList.clear(); + entryList.forEach((v) { + medicationStrengthList.add(v); + }); + break; + case MasterKeysService.MedicationDuration: + medicationDurationList.clear(); + entryList.forEach((v) { + medicationDurationList.add(v); + }); + break; + case MasterKeysService.MedicationRoute: + medicationRouteList.clear(); + entryList.forEach((v) { + medicationRouteList.add(v); + }); + break; + case MasterKeysService.MedicationFrequency: + medicationFrequencyList.clear(); + entryList.forEach((v) { + medicationFrequencyList.add(v); + }); + break; + case MasterKeysService.MedicationDoseTime: + medicationDoseTimeList.clear(); + entryList.forEach((v) { + medicationDoseTimeList.add(v); + }); + break; + case MasterKeysService.MedicationIndications: + medicationIndicationsList.clear(); + entryList.forEach((v) { + medicationIndicationsList.add(v); }); break; } } - } diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 9fcf4c2d..b7f9e80e 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -6,12 +6,13 @@ import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; -class PrescriptionService extends BaseService { +class PrescriptionService extends LookupService { List _prescriptionList = List(); List get prescriptionList => _prescriptionList; List _drugsList = List(); diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index 23dd0306..5b7c2f6a 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -1,5 +1,7 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; import 'package:doctor_app_flutter/core/service/medicine_service.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart'; @@ -8,10 +10,25 @@ import 'base_view_model.dart'; class MedicineViewModel extends BaseViewModel { MedicineService _medicineService = locator(); + PrescriptionService _prescriptionService = locator(); + get pharmacyItemsList => _medicineService.pharmacyItemsList; + get pharmaciesList => _medicineService.pharmaciesList; - PrescriptionService _prescriptionService = locator(); + get medicationStrengthList => _prescriptionService.medicationStrengthList; + + get medicationDurationList => _prescriptionService.medicationDurationList; + + get medicationRouteList => _prescriptionService.medicationRouteList; + + get medicationFrequencyList => _prescriptionService.medicationFrequencyList; + + get medicationIndicationsList => + _prescriptionService.medicationIndicationsList; + + get medicationDoseTimeList => _prescriptionService.medicationDoseTimeList; + List get allMedicationList => _prescriptionService.allMedicationList; @@ -35,6 +52,72 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getMedicationStrength() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationStrength); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationRoute() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationRoute); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationIndications() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationIndications); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationDoseTime() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationDoseTime); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationFrequency() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationFrequency); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMedicationDuration() async { + setState(ViewState.Busy); + await _prescriptionService + .getMasterLookup(MasterKeysService.MedicationDuration); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future getPharmaciesList(int itemId) async { setState(ViewState.Busy); await _medicineService.getPharmaciesList(itemId); @@ -44,4 +127,13 @@ class MedicineViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + dynamic getLookupById(List list, String id) { + for (int i = 0; i < list.length; i++) { + if (list[i]['id'].toString() == id) { + return list[i]; + } + } + return null; + } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 1d481904..a8279634 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -127,13 +127,7 @@ class _PrescriptionFormWidgetState extends State { dynamic indication; dynamic units; - List strengthList; - List routeList; - List frequencyList; - List durationList; - List doseTimeList; List indicationList; - List unitsList; String routeInatial = 'By Mouth'; //PatiantInformtion patient; @@ -142,111 +136,9 @@ class _PrescriptionFormWidgetState extends State { super.initState(); selectedType = 1; referToList = List(); - strengthList = List(); - routeList = List(); - frequencyList = List(); - durationList = List(); - doseTimeList = List(); - indicationList = List(); - unitsList = List(); - dynamic unit1 = {"id": 1, "name": "MG"}; - dynamic unit2 = {"id": 2, "name": "MCG"}; - dynamic unit3 = {"id": 3, "name": "GM"}; - dynamic regularOrder = {"id": 1, "name": "regular Order"}; - dynamic urgentOrder = {"id": 2, "name": "urgent Order"}; - dynamic strength1 = {"id": 1, "name": "1"}; - dynamic strength2 = {"id": 2, "name": "2"}; - dynamic strength3 = {"id": 3, "name": "3"}; - dynamic strength4 = {"id": 4, "name": "4"}; - dynamic strength5 = {"id": 5, "name": "5"}; - dynamic strength6 = {"id": 6, "name": "6"}; - dynamic strength7 = {"id": 7, "name": "7"}; - dynamic strength8 = {"id": 8, "name": "8"}; - dynamic strength9 = {"id": 9, "name": "9"}; - dynamic route1 = {"id": 7, "name": "By Mouth"}; - dynamic route2 = {"id": 10, "name": "Inhale by Mouth"}; - dynamic route3 = {"id": 15, "name": "for INJECTION"}; - dynamic route4 = {"id": 17, "name": "Drops"}; - dynamic route5 = {"id": 18, "name": "Rub On"}; - dynamic route6 = {"id": 20, "name": "Spary"}; - dynamic route7 = {"id": 27, "name": "In Both EYES"}; - dynamic route8 = {"id": 28, "name": "In Both Ears"}; - dynamic route9 = {"id": 32, "name": "Intramuscular"}; - dynamic route10 = {"id": 60, "name": "TRANSDERMAL"}; - dynamic route11 = {"id": 59, "name": "OROPHARYNGEAL"}; - dynamic route12 = {"id": 15, "name": "for INJECTION"}; - dynamic route13 = {"id": 58, "name": "SUBCUTANEOUS"}; - dynamic route14 = {"id": 57, "name": "NASOGASTRIC"}; - dynamic route15 = {"id": 56, "name": "IRRIGATION"}; - dynamic route16 = {"id": 55, "name": "INTRAVITREAL"}; - dynamic route17 = {"id": 54, "name": "INTRAVENOUS BOLUS"}; - dynamic route18 = {"id": 51, "name": "EPIDURAL"}; - dynamic route19 = {"id": 47, "name": "Parenteral"}; - dynamic route20 = {"id": 43, "name": "IM"}; - dynamic route21 = {"id": 42, "name": "IV"}; - dynamic route22 = {"id": 41, "name": "Sublingual"}; - dynamic route23 = {"id": 40, "name": "For Nebulization"}; - dynamic route24 = {"id": 39, "name": "Nasal"}; - dynamic route25 = {"id": 37, "name": "Inserted into Vagina"}; - dynamic route26 = {"id": 36, "name": "Inserted into Rectum"}; - dynamic route27 = {"id": 31, "name": "In Each Nostril"}; - dynamic frequency1 = {"id": 2, "name": "2 Times a day"}; - dynamic frequency2 = {"id": 3, "name": "3 Times a day"}; - dynamic frequency3 = {"id": 4, "name": "4 Times a day"}; - dynamic frequency4 = {"id": 8, "name": "As Needed"}; - dynamic frequency5 = {"id": 9, "name": "Bed Time"}; - dynamic frequency6 = {"id": 11, "name": "Every Other Day"}; - dynamic frequency7 = {"id": 29, "name": "Every Eight Hours"}; - dynamic frequency8 = {"id": 34, "name": "As Directed"}; - dynamic frequency9 = {"id": 22, "name": "Once Per Month"}; - dynamic frequency10 = {"id": 2, "name": "3 Times a day"}; - dynamic frequency11 = {"id": 21, "name": "Every 3 hours"}; - dynamic frequency12 = {"id": 20, "name": "Once a Week"}; - dynamic frequency13 = {"id": 12, "name": "Every Half Hour"}; - dynamic frequency14 = {"id": 10, "name": "4 Times a Day"}; - dynamic frequency15 = {"id": 24, "name": "Once Every 2 Months"}; - dynamic frequency16 = {"id": 25, "name": "Every One Hour"}; - dynamic frequency17 = {"id": 26, "name": "Every Two Hours"}; - dynamic frequency18 = {"id": 28, "name": "Every Six Hours"}; + indicationList = List(); - dynamic duration1 = {"id": 1, "name": "For 1 Day"}; - dynamic duration2 = {"id": 2, "name": "For 2 Days"}; - dynamic duration3 = {"id": 3, "name": "For 3 Days"}; - dynamic duration4 = {"id": 4, "name": "For 4 Days"}; - dynamic duration5 = {"id": 5, "name": "For 5 Days"}; - dynamic duration6 = {"id": 6, "name": "For 6 Days"}; - dynamic duration7 = {"id": 7, "name": "For 7 Days"}; - dynamic duration8 = {"id": 8, "name": "For 8 Days"}; - dynamic duration9 = {"id": 9, "name": "For 9 Days"}; - dynamic duration10 = {"id": 10, "name": "For 10 Days"}; - dynamic duration11 = {"id": 14, "name": "For 14 Days"}; - dynamic duration12 = {"id": 21, "name": "For 21 Days"}; - dynamic duration13 = {"id": 30, "name": "For 30 Days"}; - dynamic duration14 = {"id": 45, "name": "For 45 Days"}; - dynamic duration15 = {"id": 60, "name": "For 60 Days"}; - dynamic duration16 = {"id": 90, "name": "For 90 Days"}; - dynamic doseTime1 = {"id": 1, "name": "Before Meals"}; - dynamic doseTime2 = {"id": 2, "name": "After Meals"}; - dynamic doseTime3 = {"id": 3, "name": "With Meals"}; - dynamic doseTime4 = {"id": 4, "name": "In The Morning"}; - dynamic doseTime5 = {"id": 5, "name": "In the Evening"}; - dynamic doseTime6 = {"id": 6, "name": "After Supper"}; - dynamic doseTime7 = {"id": 7, "name": "With Supper"}; - dynamic doseTime8 = {"id": 8, "name": "Before Breakfast"}; - dynamic doseTime9 = {"id": 9, "name": "In the Afternoon"}; - dynamic doseTime10 = {"id": 10, "name": "While wake"}; - dynamic doseTime11 = {"id": 12, "name": "Any Time"}; - dynamic doseTime12 = {"id": 21, "name": "Bed Time"}; - dynamic doseTime13 = {"id": 13, "name": "30 Minutes Before Meals"}; - dynamic doseTime14 = {"id": 14, "name": "1 Hour Before Meals"}; - dynamic doseTime15 = {"id": 15, "name": "2 Hours After Meal"}; - dynamic doseTime16 = {"id": 16, "name": "After Breakfast"}; - dynamic doseTime17 = {"id": 17, "name": "Before Lunch"}; - dynamic doseTime18 = {"id": 18, "name": "After Lunch"}; - dynamic doseTime19 = {"id": 20, "name": "After Dinner"}; - dynamic doseTime20 = {"id": 21, "name": "Bed Time"}; - dynamic doseTime21 = {"id": 11, "name": "Now"}; dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"}; dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; @@ -261,9 +153,6 @@ class _PrescriptionFormWidgetState extends State { dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"}; - unitsList.add(unit1); - unitsList.add(unit2); - unitsList.add(unit3); indicationList.add(indication1); indicationList.add(indication2); indicationList.add(indication3); @@ -274,102 +163,6 @@ class _PrescriptionFormWidgetState extends State { indicationList.add(indication8); indicationList.add(indication9); indicationList.add(indication10); - - doseTimeList.add(doseTime1); - doseTimeList.add(doseTime2); - doseTimeList.add(doseTime3); - doseTimeList.add(doseTime4); - doseTimeList.add(doseTime5); - doseTimeList.add(doseTime6); - doseTimeList.add(doseTime7); - doseTimeList.add(doseTime8); - doseTimeList.add(doseTime9); - doseTimeList.add(doseTime10); - doseTimeList.add(doseTime11); - doseTimeList.add(doseTime12); - doseTimeList.add(doseTime13); - doseTimeList.add(doseTime14); - doseTimeList.add(doseTime15); - doseTimeList.add(doseTime16); - doseTimeList.add(doseTime17); - doseTimeList.add(doseTime18); - doseTimeList.add(doseTime19); - doseTimeList.add(doseTime20); - doseTimeList.add(doseTime21); - - doseTimeList.add(doseTime12); - frequencyList.add(frequency1); - frequencyList.add(frequency2); - frequencyList.add(frequency3); - frequencyList.add(frequency4); - frequencyList.add(frequency5); - frequencyList.add(frequency6); - frequencyList.add(frequency7); - frequencyList.add(frequency8); - frequencyList.add(frequency9); - frequencyList.add(frequency10); - frequencyList.add(frequency11); - frequencyList.add(frequency12); - frequencyList.add(frequency13); - frequencyList.add(frequency14); - frequencyList.add(frequency15); - frequencyList.add(frequency16); - frequencyList.add(frequency17); - frequencyList.add(frequency18); - routeList.add(route1); - routeList.add(route2); - routeList.add(route3); - routeList.add(route4); - routeList.add(route5); - routeList.add(route6); - routeList.add(route7); - routeList.add(route8); - routeList.add(route9); - routeList.add(route10); - routeList.add(route11); - routeList.add(route12); - routeList.add(route13); - routeList.add(route14); - routeList.add(route15); - routeList.add(route16); - routeList.add(route17); - routeList.add(route18); - routeList.add(route19); - routeList.add(route20); - routeList.add(route21); - routeList.add(route22); - routeList.add(route23); - routeList.add(route24); - routeList.add(route25); - routeList.add(route26); - routeList.add(route27); - strengthList.add(strength1); - strengthList.add(strength2); - strengthList.add(strength3); - strengthList.add(strength4); - strengthList.add(strength5); - strengthList.add(strength6); - strengthList.add(strength7); - strengthList.add(strength8); - strengthList.add(strength9); - durationList.add(duration1); - durationList.add(duration2); - durationList.add(duration3); - durationList.add(duration4); - durationList.add(duration5); - durationList.add(duration6); - durationList.add(duration7); - durationList.add(duration8); - durationList.add(duration9); - durationList.add(duration10); - durationList.add(duration11); - durationList.add(duration12); - durationList.add(duration13); - durationList.add(duration14); - durationList.add(duration15); - durationList.add(duration16); - referToList.add(regularOrder); - referToList.add(urgentOrder); } setSelectedType(int val) { @@ -388,6 +181,12 @@ class _PrescriptionFormWidgetState extends State { return BaseView( onModelReady: (model) async { await model.getMedicationList(); + await model.getMedicationStrength(); + await model.getMedicationDuration(); + await model.getMedicationRoute(); + await model.getMedicationFrequency(); + await model.getMedicationDoseTime(); + await model.getMedicationIndications(); }, builder: (BuildContext context, MedicineViewModel model, Widget child) => NetworkBaseView( @@ -564,12 +363,14 @@ class _PrescriptionFormWidgetState extends State { MediaQuery.of(context).size.width * 0.350, child: InkWell( - onTap: unitsList != null + onTap: model.medicationStrengthList != + null ? () { ListSelectDialog dialog = ListSelectDialog( - list: unitsList, - attributeName: 'name', + list: model + .medicationStrengthList, + attributeName: 'nameEn', attributeValueId: 'id', okText: TranslationBase.of( context) @@ -596,7 +397,7 @@ class _PrescriptionFormWidgetState extends State { textFieldSelectorDecoration( 'UNIT Type', units != null - ? units['name'] + ? units['nameEn'] : null, true), enabled: false, @@ -610,12 +411,12 @@ class _PrescriptionFormWidgetState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: routeList != null + onTap: model.medicationRouteList != null ? () { ListSelectDialog dialog = ListSelectDialog( - list: routeList, - attributeName: 'name', + list: model.medicationRouteList, + attributeName: 'nameEn', attributeValueId: 'id', okText: TranslationBase.of(context) @@ -642,7 +443,9 @@ class _PrescriptionFormWidgetState extends State { child: TextField( decoration: textFieldSelectorDecoration( TranslationBase.of(context).route, - route != null ? route['name'] : null, + route != null + ? route['nameEn'] + : null, true), enabled: false, ), @@ -652,12 +455,13 @@ class _PrescriptionFormWidgetState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: frequencyList != null + onTap: model.medicationFrequencyList != null ? () { ListSelectDialog dialog = ListSelectDialog( - list: frequencyList, - attributeName: 'name', + list: + model.medicationFrequencyList, + attributeName: 'nameEn', attributeValueId: 'id', okText: TranslationBase.of(context) @@ -681,7 +485,7 @@ class _PrescriptionFormWidgetState extends State { decoration: textFieldSelectorDecoration( TranslationBase.of(context).frequency, frequency != null - ? frequency['name'] + ? frequency['nameEn'] : null, true), enabled: false, @@ -692,12 +496,13 @@ class _PrescriptionFormWidgetState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: doseTimeList != null + onTap: model.medicationDoseTimeList != null ? () { ListSelectDialog dialog = ListSelectDialog( - list: doseTimeList, - attributeName: 'name', + list: + model.medicationDoseTimeList, + attributeName: 'nameEn', attributeValueId: 'id', okText: TranslationBase.of(context) @@ -721,7 +526,7 @@ class _PrescriptionFormWidgetState extends State { decoration: textFieldSelectorDecoration( TranslationBase.of(context).doseTime, doseTime != null - ? doseTime['name'] + ? doseTime['nameEn'] : null, true), enabled: false, @@ -795,12 +600,13 @@ class _PrescriptionFormWidgetState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: durationList != null + onTap: model.medicationDurationList != null ? () { ListSelectDialog dialog = ListSelectDialog( - list: durationList, - attributeName: 'name', + list: + model.medicationDurationList, + attributeName: 'nameEn', attributeValueId: 'id', okText: TranslationBase.of(context) @@ -824,7 +630,7 @@ class _PrescriptionFormWidgetState extends State { decoration: textFieldSelectorDecoration( TranslationBase.of(context).duration, duration != null - ? duration['name'] + ? duration['nameEn'] : null, true), enabled: false, diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 290aadca..c7c4c60e 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -179,7 +179,6 @@ class _NewPrescriptionScreenState extends State { model.prescriptionList[0] .rowcount, (index) => Container( - //height: 240, child: Column( children: [ Row( diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 01986813..5c7c6e76 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -2,14 +2,17 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -60,551 +63,426 @@ class _UpdatePrescriptionFormState extends State { dynamic updatedDuration; dynamic units; - List doseTimeList; - List routeList; - List frequencyList; - List durationList; - List unitsList; - @override void initState() { super.initState(); - routeList = List(); - doseTimeList = List(); - frequencyList = List(); - durationList = List(); - unitsList = List(); - - dynamic unit1 = {"id": 1, "name": "MG"}; - dynamic unit2 = {"id": 2, "name": "MCG"}; - dynamic unit3 = {"id": 3, "name": "GM"}; - dynamic frequency1 = {"id": 2, "name": "2 Times a day"}; - dynamic frequency2 = {"id": 3, "name": "3 Times a day"}; - dynamic frequency3 = {"id": 4, "name": "4 Times a day"}; - dynamic frequency4 = {"id": 8, "name": "As Needed"}; - dynamic frequency5 = {"id": 9, "name": "Bed Time"}; - dynamic frequency6 = {"id": 11, "name": "Every Other Day"}; - dynamic frequency7 = {"id": 29, "name": "Every Eight Hours"}; - dynamic frequency8 = {"id": 34, "name": "As Directed"}; - dynamic frequency9 = {"id": 22, "name": "Once Per Month"}; - dynamic frequency10 = {"id": 2, "name": "3 Times a day"}; - dynamic frequency11 = {"id": 21, "name": "Every 3 hours"}; - dynamic frequency12 = {"id": 20, "name": "Once a Week"}; - dynamic frequency13 = {"id": 12, "name": "Every Half Hour"}; - dynamic frequency14 = {"id": 10, "name": "4 Times a Day"}; - dynamic frequency15 = {"id": 24, "name": "Once Every 2 Months"}; - dynamic frequency16 = {"id": 25, "name": "Every One Hour"}; - dynamic frequency17 = {"id": 26, "name": "Every Two Hours"}; - dynamic frequency18 = {"id": 28, "name": "Every Six Hours"}; - dynamic doseTime1 = {"id": 1, "name": "Before Meals"}; - dynamic doseTime2 = {"id": 2, "name": "After Meals"}; - dynamic doseTime3 = {"id": 3, "name": "With Meals"}; - dynamic doseTime4 = {"id": 4, "name": "In The Morning"}; - dynamic doseTime5 = {"id": 5, "name": "In the Evening"}; - dynamic doseTime6 = {"id": 6, "name": "After Supper"}; - dynamic doseTime7 = {"id": 7, "name": "With Supper"}; - dynamic doseTime8 = {"id": 8, "name": "Before Breakfast"}; - dynamic doseTime9 = {"id": 9, "name": "In the Afternoon"}; - dynamic doseTime10 = {"id": 10, "name": "While wake"}; - dynamic doseTime11 = {"id": 12, "name": "Any Time"}; - dynamic doseTime12 = {"id": 21, "name": "Bed Time"}; - dynamic doseTime13 = {"id": 13, "name": "30 Minutes Before Meals"}; - dynamic doseTime14 = {"id": 14, "name": "1 Hour Before Meals"}; - dynamic doseTime15 = {"id": 15, "name": "2 Hours After Meal"}; - dynamic doseTime16 = {"id": 16, "name": "After Breakfast"}; - dynamic doseTime17 = {"id": 17, "name": "Before Lunch"}; - dynamic doseTime18 = {"id": 18, "name": "After Lunch"}; - dynamic doseTime19 = {"id": 20, "name": "After Dinner"}; - dynamic doseTime20 = {"id": 21, "name": "Bed Time"}; - dynamic doseTime21 = {"id": 11, "name": "Now"}; - dynamic route1 = {"id": 7, "name": "By Mouth"}; - dynamic route2 = {"id": 10, "name": "Inhale by Mouth"}; - dynamic route3 = {"id": 15, "name": "for INJECTION"}; - dynamic route4 = {"id": 17, "name": "Drops"}; - dynamic route5 = {"id": 18, "name": "Rub On"}; - dynamic route6 = {"id": 20, "name": "Spary"}; - dynamic route7 = {"id": 27, "name": "In Both EYES"}; - dynamic route8 = {"id": 28, "name": "In Both Ears"}; - dynamic route9 = {"id": 32, "name": "Intramuscular"}; - dynamic route10 = {"id": 60, "name": "TRANSDERMAL"}; - dynamic route11 = {"id": 59, "name": "OROPHARYNGEAL"}; - dynamic route12 = {"id": 15, "name": "for INJECTION"}; - dynamic route13 = {"id": 58, "name": "SUBCUTANEOUS"}; - dynamic route14 = {"id": 57, "name": "NASOGASTRIC"}; - dynamic route15 = {"id": 56, "name": "IRRIGATION"}; - dynamic route16 = {"id": 55, "name": "INTRAVITREAL"}; - dynamic route17 = {"id": 54, "name": "INTRAVENOUS BOLUS"}; - dynamic route18 = {"id": 51, "name": "EPIDURAL"}; - dynamic route19 = {"id": 47, "name": "Parenteral"}; - dynamic route20 = {"id": 43, "name": "IM"}; - dynamic route21 = {"id": 42, "name": "IV"}; - dynamic route22 = {"id": 41, "name": "Sublingual"}; - dynamic route23 = {"id": 40, "name": "For Nebulization"}; - dynamic route24 = {"id": 39, "name": "Nasal"}; - dynamic route25 = {"id": 37, "name": "Inserted into Vagina"}; - dynamic route26 = {"id": 36, "name": "Inserted into Rectum"}; - dynamic route27 = {"id": 31, "name": "In Each Nostril"}; - dynamic duration1 = {"id": 1, "name": "For 1 Day"}; - dynamic duration2 = {"id": 2, "name": "For 2 Days"}; - dynamic duration3 = {"id": 3, "name": "For 3 Days"}; - dynamic duration4 = {"id": 4, "name": "For 4 Days"}; - dynamic duration5 = {"id": 5, "name": "For 5 Days"}; - dynamic duration6 = {"id": 6, "name": "For 6 Days"}; - dynamic duration7 = {"id": 7, "name": "For 7 Days"}; - dynamic duration8 = {"id": 8, "name": "For 8 Days"}; - dynamic duration9 = {"id": 9, "name": "For 9 Days"}; - dynamic duration10 = {"id": 10, "name": "For 10 Days"}; - dynamic duration11 = {"id": 14, "name": "For 14 Days"}; - dynamic duration12 = {"id": 21, "name": "For 21 Days"}; - dynamic duration13 = {"id": 30, "name": "For 30 Days"}; - dynamic duration14 = {"id": 45, "name": "For 45 Days"}; - dynamic duration15 = {"id": 60, "name": "For 60 Days"}; - dynamic duration16 = {"id": 90, "name": "For 90 Days"}; - - durationList.add(duration1); - durationList.add(duration2); - durationList.add(duration3); - durationList.add(duration4); - durationList.add(duration5); - durationList.add(duration6); - durationList.add(duration7); - durationList.add(duration8); - durationList.add(duration9); - durationList.add(duration10); - durationList.add(duration11); - durationList.add(duration12); - durationList.add(duration13); - durationList.add(duration14); - durationList.add(duration15); - durationList.add(duration16); - frequencyList.add(frequency1); - frequencyList.add(frequency2); - frequencyList.add(frequency3); - frequencyList.add(frequency4); - frequencyList.add(frequency5); - frequencyList.add(frequency6); - frequencyList.add(frequency7); - frequencyList.add(frequency8); - frequencyList.add(frequency9); - frequencyList.add(frequency10); - frequencyList.add(frequency11); - frequencyList.add(frequency12); - frequencyList.add(frequency13); - frequencyList.add(frequency14); - frequencyList.add(frequency15); - frequencyList.add(frequency16); - frequencyList.add(frequency17); - frequencyList.add(frequency18); - doseTimeList.add(doseTime1); - doseTimeList.add(doseTime2); - doseTimeList.add(doseTime3); - doseTimeList.add(doseTime4); - doseTimeList.add(doseTime5); - doseTimeList.add(doseTime6); - doseTimeList.add(doseTime7); - doseTimeList.add(doseTime8); - doseTimeList.add(doseTime9); - doseTimeList.add(doseTime10); - doseTimeList.add(doseTime11); - doseTimeList.add(doseTime12); - doseTimeList.add(doseTime13); - doseTimeList.add(doseTime14); - doseTimeList.add(doseTime15); - doseTimeList.add(doseTime16); - doseTimeList.add(doseTime17); - doseTimeList.add(doseTime18); - doseTimeList.add(doseTime19); - doseTimeList.add(doseTime20); - doseTimeList.add(doseTime21); - routeList.add(route1); - routeList.add(route2); - routeList.add(route3); - routeList.add(route4); - routeList.add(route5); - routeList.add(route6); - routeList.add(route7); - routeList.add(route8); - routeList.add(route9); - routeList.add(route10); - routeList.add(route11); - routeList.add(route12); - routeList.add(route13); - routeList.add(route14); - routeList.add(route15); - routeList.add(route16); - routeList.add(route17); - routeList.add(route18); - routeList.add(route19); - routeList.add(route20); - routeList.add(route21); - routeList.add(route22); - routeList.add(route23); - routeList.add(route24); - routeList.add(route25); - routeList.add(route26); - routeList.add(route27); - unitsList.add(unit1); - unitsList.add(unit2); - unitsList.add(unit3); } @override Widget build(BuildContext context) { return StatefulBuilder(builder: (BuildContext context, StateSetter setState /*You can rename this!*/) { - return DraggableScrollableSheet( - initialChildSize: 0.90, - maxChildSize: 0.90, - minChildSize: 0.6, - builder: (BuildContext context, ScrollController scrollController) { - return Container( - height: MediaQuery.of(context).size.height * 1.0, - child: Form( - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - widget.drugName.toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: 10.0, - ), - Column( + return BaseView( + onModelReady: (model) async { + await model.getMedicationList(); + await model.getMedicationStrength(); + await model.getMedicationDuration(); + await model.getMedicationRoute(); + await model.getMedicationFrequency(); + await model.getMedicationDoseTime(); + await model.getMedicationIndications(); + route = model.getLookupById(model.medicationRouteList, widget.route); + doseTime = + model.getLookupById(model.medicationDoseTimeList, widget.dose); + updatedDuration = model.getLookupById( + model.medicationDurationList, widget.duration); + units = model.getLookupById( + model.medicationStrengthList, widget.doseUnit); + frequencyUpdate = model.getLookupById( + model.medicationFrequencyList, widget.frequency); + }, + builder: + (BuildContext context, MedicineViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.6, + builder: + (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.0, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - height: - MediaQuery.of(context).size.height * 0.060, - width: double.infinity, - child: Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * - 0.500, - child: TextFields( - inputFormatters: [ - LengthLimitingTextInputFormatter(4) - ], - hintText: - TranslationBase.of(context).strength, - controller: strengthController, - keyboardType: TextInputType.number, - onChanged: (String value) { - setState(() { - strengthChar = value.length; - }); - if (strengthChar >= 4) { - DrAppToastMsg.showErrorToast( - "Only 4 Digits allowed for strength"); - } - }, - // validator: (value) { - // if (value.isEmpty && - // strengthController.text.length > - // 4) - // return TranslationBase.of(context) - // .emptyMessage; - // else - // return null; - // }, - ), - ), - SizedBox( - width: 10.0, - ), - Container( - width: MediaQuery.of(context).size.width * - 0.3700, - child: InkWell( - onTap: unitsList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: unitsList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - units = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - 'UNIT Type', - units != null - ? units['name'] - : null, - true), - enabled: false, - ), - ), - ), - ], - ), + AppText( + widget.drugName.toUpperCase(), + fontWeight: FontWeight.w900, ), SizedBox( - height: 12, + height: 10.0, ), - Container( - height: - MediaQuery.of(context).size.height * 0.070, - child: InkWell( - onTap: routeList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: routeList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { + Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * + 0.060, + width: double.infinity, + child: Row( + children: [ + Container( + width: + MediaQuery.of(context).size.width * + 0.500, + child: TextFields( + inputFormatters: [ + LengthLimitingTextInputFormatter(4) + ], + hintText: TranslationBase.of(context) + .strength, + controller: strengthController, + keyboardType: TextInputType.number, + onChanged: (String value) { setState(() { - route = selectedValue; + strengthChar = value.length; }); - if (route == null) { - route = route['id']; + if (strengthChar >= 4) { + DrAppToastMsg.showErrorToast( + "Only 4 Digits allowed for strength"); } }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - 'Route', - route != null ? route['name'] : null, - true), - enabled: false, + // validator: (value) { + // if (value.isEmpty && + // strengthController.text.length > + // 4) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), + ), + SizedBox( + width: 10.0, + ), + Container( + width: + MediaQuery.of(context).size.width * + 0.3700, + child: InkWell( + onTap: model.medicationStrengthList != + null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationStrengthList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + units = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'UNIT Type', + units != null + ? units['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + ], + ), ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: - MediaQuery.of(context).size.height * 0.070, - child: InkWell( - onTap: doseTimeList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: doseTimeList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - doseTime = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).doseTime, - doseTime != null - ? doseTime['name'] - : null, - true), - enabled: false, + SizedBox( + height: 12, ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: - MediaQuery.of(context).size.height * 0.070, - child: InkWell( - onTap: frequencyList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: frequencyList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - frequencyUpdate = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).frequency, - frequencyUpdate != null - ? frequencyUpdate['name'] - : null, - true), - enabled: false, + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationRouteList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.medicationRouteList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + }); + if (route == null) { + route = route['id']; + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + 'Route', + route != null + ? route['nameEn'] + : null, + true), + enabled: false, + ), + ), ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: - MediaQuery.of(context).size.height * 0.070, - child: InkWell( - onTap: durationList != null - ? () { - ListSelectDialog dialog = - ListSelectDialog( - list: durationList, - attributeName: 'name', - attributeValueId: 'id', - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - updatedDuration = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).duration, - updatedDuration != null - ? updatedDuration['name'].toString() - : null, - true), - enabled: false, + SizedBox( + height: 12.0, ), - ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: widget.remarks, - controller: remarksController, - maxLines: 7, - minLines: 4, - ), - ), - SizedBox( - height: 12.0, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.12, - ), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 2), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: 'update prescription'.toUpperCase(), - onPressed: () { - updatePrescription( - newDoseStreangth: - strengthController.text.isNotEmpty - ? strengthController.text - : widget.doseStreangth, - newUnit: units != null - ? units['id'].toString() - : widget.doseUnit, - doseUnit: widget.doseUnit, - doseStreangth: widget.doseStreangth, - duration: widget.duration, - startDate: widget.startDate, - doseId: widget.dose, - frequencyId: widget.frequency, - routeId: widget.route, - patient: widget.patient, - model: widget.model, - newDuration: updatedDuration != null - ? updatedDuration['id'].toString() - : widget.duration, - drugId: widget.drugId, - remarks: remarksController.text, - route: route != null - ? route['id'].toString() - : widget.route, - frequency: frequencyUpdate != null - ? frequencyUpdate['id'].toString() - : widget.frequency, - dose: doseTime != null - ? doseTime['id'].toString() - : widget.dose, - enteredRemarks: - widget.enteredRemarks); - Navigator.pop(context); - }, + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationDoseTimeList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: + model.medicationDoseTimeList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).doseTime, + doseTime != null + ? doseTime['nameEn'] + : null, + true), + enabled: false, + ), ), - ], - ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationFrequencyList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: + model.medicationFrequencyList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + frequencyUpdate = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).frequency, + frequencyUpdate != null + ? frequencyUpdate['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationDurationList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: + model.medicationDurationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: + TranslationBase.of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + updatedDuration = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).duration, + updatedDuration != null + ? updatedDuration['nameEn'] + .toString() + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: widget.remarks, + controller: remarksController, + maxLines: 7, + minLines: 4, + ), + ), + SizedBox( + height: 12.0, + ), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.12, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: + 'update prescription'.toUpperCase(), + onPressed: () { + updatePrescription( + newDoseStreangth: + strengthController + .text.isNotEmpty + ? strengthController.text + : widget.doseStreangth, + newUnit: units != + null + ? units['id'].toString() + : widget.doseUnit, + doseUnit: widget.doseUnit, + doseStreangth: widget + .doseStreangth, + duration: widget.duration, + startDate: widget.startDate, + doseId: widget.dose, + frequencyId: widget.frequency, + routeId: widget.route, + patient: widget.patient, + model: widget.model, + newDuration: + updatedDuration != + null + ? updatedDuration[ + 'id'] + .toString() + : widget.duration, + drugId: widget.drugId, + remarks: remarksController.text, + route: route != + null + ? route['id'].toString() + : widget.route, + frequency: + frequencyUpdate != + null + ? frequencyUpdate['id'] + .toString() + : widget.frequency, + dose: doseTime != null + ? doseTime['id'].toString() + : widget.dose, + enteredRemarks: + widget.enteredRemarks); + Navigator.pop(context); + }, + ), + ], + ), + ), + ], ), ], ), - ], - ), - ), - )); - }); + ), + )); + }), + ), + ); }); } diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 0b0a0c5a..8ed40dc3 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -2,14 +2,19 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -68,102 +73,189 @@ class _UpdateProcedureWidgetState extends State { }); } + List entityList = List(); + dynamic selectedCategory; @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; return StatefulBuilder(builder: (BuildContext context, StateSetter setState /*You can rename this!*/) { - return Container( - height: MediaQuery.of(context).size.height * 0.55, - child: Form( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - widget.procedureName.toUpperCase(), - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 30.0, - ), - Container( - child: Row( - children: [ - AppText(TranslationBase.of(context).orderType), - Radio( - activeColor: Color(0xFFB9382C), - value: 0, - groupValue: selectedType, - onChanged: (value) { - setSelectedType(value); - }, + return BaseView( + onModelReady: (model) => model.getCategory(), + builder: + (BuildContext context, ProcedureViewModel model, Widget child) => + NetworkBaseView( + baseViewModel: model, + child: Container( + height: MediaQuery.of(context).size.height * 0.95, + child: Form( + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.procedureName.toUpperCase(), + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 30.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.categoryList != null && + model.categoryList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.categoryList, + attributeName: 'categoryName', + attributeValueId: 'categoryId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + selectedCategory = selectedValue; + model.getProcedureCategory( + categoryName: selectedCategory[ + 'categoryName']); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + //model.getProcedureCategory(); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).procedureCategorise, + selectedCategory != null + ? selectedCategory['categoryName'] + : null, + true, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + )), + enabled: false, + ), ), - Text(TranslationBase.of(context).urgent), - Radio( - activeColor: Color(0xFFB9382C), - groupValue: selectedType, - value: 1, - onChanged: (value) { - setSelectedType(value); - }, + ), + if (widget.model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: + widget.model.categoriesList[0].entityList, + removeHistory: (item) { + setState(() { + entityList.remove(item); + }); + }, + addHistory: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: (master) => + isEntityListSelected(master), + ), ), - Text(TranslationBase.of(context).regular), - ], - ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: - Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: widget.remarks, - controller: widget.remarksController, - maxLines: 5, - minLines: 3, - ), - ), - SizedBox( - height: 100.0, - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .updateProcedure - .toUpperCase(), - onPressed: () { - Navigator.pop(context); - updateProcedure( - orderType: selectedType.toString(), - categorieId: widget.categoryId, - procedureId: widget.procedureId, - patient: widget.patient, - model: widget.model, - remarks: widget.remarksController.text); - // authorizationForm(context); - }, + Container( + child: Row( + children: [ + AppText(TranslationBase.of(context).orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 0, + groupValue: selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).urgent), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 1, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).regular), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: widget.remarks, + controller: widget.remarksController, + maxLines: 5, + minLines: 3, + ), + ), + SizedBox( + height: 50.0, + ), + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .updateProcedure + .toUpperCase(), + onPressed: () { + Navigator.pop(context); + updateProcedure( + orderType: selectedType.toString(), + categorieId: widget.categoryId, + procedureId: widget.procedureId, + entityList: entityList, + patient: widget.patient, + model: widget.model, + remarks: widget.remarksController.text); + // authorizationForm(context); + }, + ), + ], ), - ], - ), + ), + ], ), - ], - ), - ), - )); + ), + )), + ), + ); }); } updateProcedure( {ProcedureViewModel model, String remarks, + String newProcedureId, + String newCategorieId, + List entityList, String orderType, String procedureId, PatiantInformtion patient, @@ -187,10 +279,15 @@ class _UpdateProcedureWidgetState extends State { Controls(code: "ordertype", controlValue: "1"), ); - controlsProcedure.procedure = procedureId; + entityList.isNotEmpty + ? entityList.forEach((element) { + controlsProcedure.procedure = element.procedureId; + controlsProcedure.category = element.categoryID; + controlsProcedure.controls = controls; + }) + : controlsProcedure.procedure = procedureId; controlsProcedure.category = categorieId; controlsProcedure.controls = controls; - // controlsProcedure.add(ProcedureDetail( // category: categorieId, procedure: procedureId, controls: controls)); updateProcedureReqModel.procedureDetail = controlsProcedure; @@ -206,4 +303,45 @@ class _UpdateProcedureWidgetState extends State { DrAppToastMsg.showSuccesToast('procedure has been updated'); } } + + bool isEntityListSelected(EntityList masterKey) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } } From d78aa2321d48ed35624a0f5e244f9df17cb7bce4 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 2 Feb 2021 14:04:20 +0200 Subject: [PATCH 29/29] bug fix --- lib/core/enum/master_lookup_key.dart | 2 +- lib/core/service/base/lookup-service.dart | 2 +- pubspec.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index 7cb6f1cf..889be9a7 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -19,7 +19,7 @@ enum MasterKeysService { MedicationFrequency, MedicationDoseTime, MedicationIndications, - Speciality, + AdmissionRequestType, } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 774cd4ad..0c361003 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -44,7 +44,7 @@ class LookupService extends BaseService { List listOfICD10 = []; List listOfTemperatureMethods = []; List listOfSpeciality = []; - List listOfAdmissionType = []; + List listOfAdmissionType = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; diff --git a/pubspec.lock b/pubspec.lock index e51c9489..31666673 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -510,7 +510,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3-nullsafety.1" json_annotation: dependency: transitive description: @@ -552,7 +552,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -823,7 +823,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" stream_channel: dependency: transitive description: @@ -958,5 +958,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" + dart: ">=2.10.0 <=2.11.0-213.1.beta" flutter: ">=1.22.0 <2.0.0"