From c52d7cd5273dc45984609bd91d43c50b66898fc9 Mon Sep 17 00:00:00 2001 From: zaid_daoud Date: Wed, 30 Aug 2023 10:18:25 +0300 Subject: [PATCH] Preventive Maintenance [Most Recent] --- lib/models/visits/visits_search.dart | 6 +++++- lib/views/pages/user/visits/regular_visits_page.dart | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/models/visits/visits_search.dart b/lib/models/visits/visits_search.dart index 4e6159f2..aa91d444 100644 --- a/lib/models/visits/visits_search.dart +++ b/lib/models/visits/visits_search.dart @@ -29,7 +29,7 @@ class VisitsSearch { this.expectedDateTo, this.deviceNumber, this.deviceName, - this.mostRecent, + this.mostRecent = true, }); fromSearch(VisitsSearch newSearch) { @@ -58,6 +58,10 @@ class VisitsSearch { _search["siteId"] = hospital.id; } + if (mostRecent != null) { + _search["mostRecent"] = mostRecent; + } + if (brand != null && brand.isNotEmpty) { // todo get new key _search[""] = brand; diff --git a/lib/views/pages/user/visits/regular_visits_page.dart b/lib/views/pages/user/visits/regular_visits_page.dart index c9d16a45..c2ded666 100644 --- a/lib/views/pages/user/visits/regular_visits_page.dart +++ b/lib/views/pages/user/visits/regular_visits_page.dart @@ -107,7 +107,7 @@ class _RegularVisitsPageState extends State with TickerProvid ), ), Visibility( - visible: _visitsProvider.visitsSearch.toMap().isNotEmpty, + visible: (_visitsProvider.visitsSearch.toMap()..remove("mostRecent")).isNotEmpty, child: Padding( padding: const EdgeInsets.all(8.0), child: AButton(