From a64088320f26ac823947160ca82c1d28f6da2ea9 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 28 Jan 2021 10:33:12 +0200 Subject: [PATCH 1/2] 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 de1d0283d234bd5a7c371ac7daad4bcda4624237 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 28 Jan 2021 15:47:08 +0200 Subject: [PATCH 2/2] 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); + }); + } + } }