From 725b9a12da233db194e9e9001c1a583b506e10ad Mon Sep 17 00:00:00 2001 From: "taha.alam@cloudsolutions.com.sa" Date: Mon, 2 Feb 2026 16:43:56 +0300 Subject: [PATCH] search field hidden for add procedure as two search field is visible, login with wrong cred will show the appropitate message, and discharge summary is not visible for the patient that does has any. --- lib/client/base_app_client.dart | 1 + lib/core/service/authentication_service.dart | 2 +- .../discharge_Summary_widget.dart | 59 +++++----- .../procedures/add_procedure_page.dart | 1 + .../entity_list_checkbox_search_widget.dart | 105 +++++++++--------- 5 files changed, 89 insertions(+), 79 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 35e7b332..f2985d97 100755 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -171,6 +171,7 @@ class BaseAppClient { } if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) { + if (body['OTP_SendType'] != null) { if (parsed['ErrorCode'] == '699') { onSuccess(parsed, statusCode); diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart index dcde0fff..cc10e6b9 100644 --- a/lib/core/service/authentication_service.dart +++ b/lib/core/service/authentication_service.dart @@ -62,7 +62,7 @@ class AuthenticationService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: userInfo.toJson()); + }, body: userInfo.toJson(), isAllowAny: true); } catch (error) { hasError = true; super.error = error.toString(); diff --git a/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart index a361b814..41239744 100644 --- a/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart +++ b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart @@ -46,34 +46,36 @@ class _DischargeSummaryWidgetState extends State { headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomRow( - label: TranslationBase.of(context).doctorName + ": ", - value: widget.dischargeSummary.createdByName.toString() ?? "".toString(), - isCopyable: false, - ), - CustomRow( - label: TranslationBase.of(context).branch + ": ", - value: widget.dischargeSummary.projectName.toString() ?? "".toString(), - isCopyable: false, - ), - CustomRow( - label: TranslationBase.of(context).clinicName + ": ", - value: widget.dischargeSummary.clinicName.toString() ?? "".toString(), - isCopyable: false, - ), - CustomRow( - label: TranslationBase.of(context).dischargeDate + ": ", - value: AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).day.toString() + - " " + - AppDateUtils.getMonth(AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).month).toString().substring(0, 3) + - ' ' + - AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).year.toString(), - isCopyable: false, - ), - ], + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRow( + label: TranslationBase.of(context).doctorName + ": ", + value: widget.dischargeSummary.createdByName.toString() ?? "".toString(), + isCopyable: false, + ), + CustomRow( + label: TranslationBase.of(context).branch + ": ", + value: widget.dischargeSummary.projectName.toString() ?? "".toString(), + isCopyable: false, + ), + CustomRow( + label: TranslationBase.of(context).clinicName + ": ", + value: widget.dischargeSummary.clinicName.toString() ?? "".toString(), + isCopyable: false, + ), + CustomRow( + label: TranslationBase.of(context).dischargeDate + ": ", + value: AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).day.toString() + + " " + + AppDateUtils.getMonth(AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).month).toString().substring(0, 3) + + ' ' + + AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).year.toString(), + isCopyable: false, + ), + ], + ), ), Column( crossAxisAlignment: CrossAxisAlignment.end, @@ -89,6 +91,7 @@ class _DischargeSummaryWidgetState extends State { ), ], ), + bodyWidget: Row( children: [ Column( diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index 761cf377..a87016cb 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -147,6 +147,7 @@ class _AddProcedurePageState extends State { EntityListCheckboxSearchWidget( model: widget.model, masterList: model.categoriesList[0].entityList!, + shouldDisplaySearchField: false, removeProcedure: (item) { EntityList? itemToBeRemoved = entityList.firstWhere((element) => item.procedureId == element.procedureId, orElse: () => EntityList()); if (itemToBeRemoved.procedureId != null) { diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index 481cb3e8..165d47ec 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -20,6 +20,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { final bool Function(EntityList) isEntityListSelected; final List masterList; Function(String val) selectedType; + final bool shouldDisplaySearchField; EntityListCheckboxSearchWidget({ Key? key, @@ -30,6 +31,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { required this.addProcedure, required this.isEntityListSelected, required this.selectedType, + this.shouldDisplaySearchField = true, }) : super(key: key); @override @@ -231,59 +233,62 @@ class _EntityListCheckboxSearchWidgetState extends State(Color(0xFFD02127)), + Visibility( + visible: widget.shouldDisplaySearchField, + child: Padding( + padding: const EdgeInsets.only(bottom: 12.0), + child: AppTextFieldCustom( + suffixWidget: _isSearching + ? Padding( + padding: const EdgeInsets.all(12.0), + child: SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor: AlwaysStoppedAnimation(Color(0xFFD02127)), + ), + ), + ) + : InkWell( + onTap: () { + if (procedureName.text.length >= 3) { + widget.model.filterSearchResults( + procedureName.text, widget.masterList, items); + WidgetsBinding.instance.addPostFrameCallback((_) { + // if (mounted) { + // setState(() {}); + // } + }); + } + }, + child: Icon( + Icons.search, + size: 25.0, + ), ), - ), - ) - : InkWell( - onTap: () { - if (procedureName.text.length >= 3) { - widget.model.filterSearchResults( - procedureName.text, widget.masterList, items); - WidgetsBinding.instance.addPostFrameCallback((_) { - // if (mounted) { - // setState(() {}); - // } - }); + hintText: TranslationBase.of(context).searchProcedureHere, + isTextFieldHasSuffix: false, + maxLines: 1, + minLines: 1, + hasBorder: true, + controller: procedureName, + onChanged: (value) { + _onSearchChanged(value ?? ''); + }, + onFieldSubmitted: () { + if (procedureName.text.length >= 3) { + widget.model.filterSearchResults( + procedureName.text, widget.masterList, items); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + setState(() {}); } - }, - child: Icon( - Icons.search, - size: 25.0, - ), - ), - hintText: TranslationBase.of(context).searchProcedureHere, - isTextFieldHasSuffix: false, - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - onChanged: (value) { - _onSearchChanged(value ?? ''); - }, - onFieldSubmitted: () { - if (procedureName.text.length >= 3) { - widget.model.filterSearchResults( - procedureName.text, widget.masterList, items); - WidgetsBinding.instance.addPostFrameCallback((_) { - if (mounted) { - setState(() {}); + }); } - }); - } - }, - ), + }, + ), + ), ), if (items.isEmpty && procedureName.text.length >= 3) Center(