From aab2a557c8c8e688337a2e3908b9d222e1c39681 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 <50428976+WaseemAbbasi22@users.noreply.github.com> Date: Tue, 31 Mar 2026 16:03:38 +0300 Subject: [PATCH] search fixes --- lib/controllers/api_routes/urls.dart | 8 +-- .../providers/api/all_requests_provider.dart | 3 +- lib/models/search_all_requests_model.dart | 52 ++++++++++++++++--- .../my_request/all_requests_search_page.dart | 7 ++- 4 files changed, 56 insertions(+), 14 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 256c6646..71efe347 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -3,13 +3,13 @@ class URLs { static const String appReleaseBuildNumber = "36"; - static const host1 = "https://atomsm.hmg.com"; // production url + // static const host1 = "https://atomsm.hmg.com"; // production url // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url - // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url + static const host1 = "https://atomsmuat.hmg.com"; // local UAT url - // static final String _baseUrl = "$_host/mobile"; // host local UAT + static final String _baseUrl = "$_host/mobile"; // host local UAT // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis - static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM + // static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM // static final String _baseUrl = "$_host/v4/mobile"; // v4 for Demo module // static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation // static final String _baseUrl = "$_host/v6/mobile"; // for asset delivery module diff --git a/lib/controllers/providers/api/all_requests_provider.dart b/lib/controllers/providers/api/all_requests_provider.dart index 533f5b9a..de05fc92 100644 --- a/lib/controllers/providers/api/all_requests_provider.dart +++ b/lib/controllers/providers/api/all_requests_provider.dart @@ -173,7 +173,8 @@ class AllRequestsProvider extends ChangeNotifier { // loan module if (context.settingProvider.isUserFlowMedical && !context.userProvider.isNurse) { - list = [16]; + // list = [16]; + list.add(16); } return list; diff --git a/lib/models/search_all_requests_model.dart b/lib/models/search_all_requests_model.dart index 0e78d2e0..80ad8647 100644 --- a/lib/models/search_all_requests_model.dart +++ b/lib/models/search_all_requests_model.dart @@ -28,13 +28,51 @@ class SearchAllRequestsModel { this.isArchived = false, }); - void resetSearchValues() { - requestNumber?.controller?.text = ""; - assetName?.controller?.text = ""; - assetNo?.controller?.text = ""; - manufacture?.controller?.text = ""; - sn?.controller?.text = ""; - model?.controller?.text = ""; +//older function + // void resetSearchValues() { + // requestNumber?.controller?.text = ""; + // assetName?.controller?.text = ""; + // assetNo?.controller?.text = ""; + // manufacture?.controller?.text = ""; + // sn?.controller?.text = ""; + // model?.controller?.text = ""; + // isArchived = false; + // } + + void resetSearchValuesAndController({String? except}) { + final field = except?.toLowerCase(); + debugPrint("selected tag is $field"); + + if (field != 'requestnumber') { + requestNumber?.controller?.text = ""; + requestNumber?.value = null; + } + + if (field != 'assetname') { + assetName?.controller?.text = ""; + assetName?.value = null; + } + + if (field != 'assetno') { + assetNo?.controller?.text = ""; + assetNo?.value = null; + } + + if (field != 'manufacture') { + manufacture?.controller?.text = ""; + manufacture?.value = null; + } + + if (field != 'sn') { + sn?.controller?.text = ""; + sn?.value = null; + } + + if (field != 'model') { + model?.controller?.text = ""; + model?.value = null; + } + isArchived = false; } } diff --git a/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart b/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart index bde4ba6f..192ebc9e 100644 --- a/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart +++ b/lib/new_views/pages/land_page/my_request/all_requests_search_page.dart @@ -79,7 +79,8 @@ class _AllRequestsSearchPageState extends State { style: AppTextStyles.bodyText2.copyWith(color: const Color(0xFF4A8DB7)), ).paddingAll(8).onPress(() { setState(() { - search!.resetSearchValues(); + // search!.resetSearchValues(); + search?.resetSearchValuesAndController(except: null); }); }), ], @@ -103,7 +104,9 @@ class _AllRequestsSearchPageState extends State { onSelect: (value) { if (search!.searchBySelectedValue != value) { search!.searchBySelectedValue = value; - search!.resetSearchValues(); + // search!.resetSearchValues(); + search?.resetSearchValuesAndController(except: value.label); + setState(() {}); } },