From 5f61f538fc09330acf683f444a9095a730cb0423 Mon Sep 17 00:00:00 2001 From: shashank-0-0 Date: Thu, 6 Nov 2025 22:17:07 +0530 Subject: [PATCH 1/2] fixed filter dialog confirm button --- .../values/feature_search_strings.xml | 2 ++ .../feature/search/components/FilterDialog.kt | 27 ++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml b/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml index a545ab7a61b..4ce4a968957 100644 --- a/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml +++ b/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml @@ -18,6 +18,8 @@ Clients clients + Apply + Close Clients diff --git a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt index 48e2fe0e115..63df732d4f2 100644 --- a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt +++ b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt @@ -10,6 +10,8 @@ package com.mifos.feature.search.components import androidclient.feature.search.generated.resources.Res +import androidclient.feature.search.generated.resources.feature_search_apply +import androidclient.feature.search.generated.resources.feature_search_close import androidclient.feature.search.generated.resources.feature_search_filter import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column @@ -22,6 +24,10 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.RadioButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.sp @@ -38,12 +44,17 @@ internal fun FilterDialog( onDismiss: () -> Unit, modifier: Modifier = Modifier, ) { + var selectedFilter by remember { mutableStateOf(selected) } + MifosDialogBox( title = stringResource(Res.string.feature_search_filter), showDialogState = true, - confirmButtonText = "", - dismissButtonText = "Close", - onConfirm = {}, + confirmButtonText = stringResource(Res.string.feature_search_apply), + dismissButtonText = stringResource(Res.string.feature_search_close), + onConfirm = { + onEvent(SearchScreenEvent.UpdateSelectedFilter(selectedFilter)) + onDismiss() + }, onDismiss = onDismiss, modifier = modifier, message = { @@ -55,20 +66,18 @@ internal fun FilterDialog( HorizontalDivider() FilterOption( text = "All", - selected = selected == null, + selected = selectedFilter == null, onSelected = { - onEvent(SearchScreenEvent.UpdateSelectedFilter(null)) - onDismiss() + selectedFilter = null }, ) HorizontalDivider() FilterOption.values.forEachIndexed { index, option -> FilterOption( text = option.label, - selected = option == selected, + selected = option == selectedFilter, onSelected = { - onEvent(SearchScreenEvent.UpdateSelectedFilter(option)) - onDismiss() + selectedFilter = option }, ) if (index != FilterOption.values.size - 1) { From 7a3e801c90f5a11bedd23b75d920a7be8d8b5c59 Mon Sep 17 00:00:00 2001 From: shashank-0-0 Date: Tue, 11 Nov 2025 19:56:26 +0530 Subject: [PATCH 2/2] Moved hardcoded string to String resources --- .../composeResources/values/feature_search_strings.xml | 1 + .../kotlin/com/mifos/feature/search/components/FilterDialog.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml b/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml index 4ce4a968957..98d9f886b5c 100644 --- a/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml +++ b/feature/search/src/commonMain/composeResources/values/feature_search_strings.xml @@ -20,6 +20,7 @@ clients Apply Close + All Clients diff --git a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt index 63df732d4f2..07698cd5fb1 100644 --- a/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt +++ b/feature/search/src/commonMain/kotlin/com/mifos/feature/search/components/FilterDialog.kt @@ -10,6 +10,7 @@ package com.mifos.feature.search.components import androidclient.feature.search.generated.resources.Res +import androidclient.feature.search.generated.resources.feature_search_all import androidclient.feature.search.generated.resources.feature_search_apply import androidclient.feature.search.generated.resources.feature_search_close import androidclient.feature.search.generated.resources.feature_search_filter @@ -65,7 +66,7 @@ internal fun FilterDialog( ) { HorizontalDivider() FilterOption( - text = "All", + text = stringResource(Res.string.feature_search_all), selected = selectedFilter == null, onSelected = { selectedFilter = null