From f7e3aff82e42e595c99a2c07171ea68a9faa98f3 Mon Sep 17 00:00:00 2001 From: himeshr Date: Thu, 1 Aug 2024 14:23:23 +0530 Subject: [PATCH] #1461 | Fix display and hide of appliedFiltersV2 --- .../src/action/customDashboard/CustomDashboardActions.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/openchs-android/src/action/customDashboard/CustomDashboardActions.js b/packages/openchs-android/src/action/customDashboard/CustomDashboardActions.js index ac1ab1325..ba3f45a9a 100644 --- a/packages/openchs-android/src/action/customDashboard/CustomDashboardActions.js +++ b/packages/openchs-android/src/action/customDashboard/CustomDashboardActions.js @@ -27,12 +27,16 @@ function loadCurrentDashboardInfo(context, state) { state.customDashboardFilters = selectedFilterValues; if (state.activeDashboardUUID) { state.reportCardSectionMappings = getReportsCards(state.activeDashboardUUID, context); - state.hasFiltersSet = selectedFilterValues && Object.values(selectedFilterValues).length > 0 - && Object.values(selectedFilterValues).some(sfv => !_.isNil(sfv) && !_.isEmpty(sfv)); + state.hasFiltersSet = getHasFiltersSet(selectedFilterValues); } return state; } +function getHasFiltersSet(selectedFilterValues) { + return selectedFilterValues && Object.values(selectedFilterValues).length > 0 + && Object.values(selectedFilterValues).some(sfv => !_.isNil(sfv) && !_.isEmpty(sfv)); +} + function getViewName(standardReportCardType) { switch (true) { case _.isNil(standardReportCardType) : @@ -132,6 +136,7 @@ class CustomDashboardActions { const {selectedFilterValues} = customDashboardService.getDashboardData(state.activeDashboardUUID); newState.customDashboardFilters = selectedFilterValues; + newState.hasFiltersSet = getHasFiltersSet(selectedFilterValues); const userSettings = userInfoService.getUserSettingsObject(); const I18n = context.get(MessageService).getI18n();