@@ -22,22 +22,19 @@ import androidx.compose.material3.HorizontalDivider
2222import androidx.compose.material3.Surface
2323import androidx.compose.runtime.Composable
2424import androidx.compose.runtime.getValue
25- import androidx.compose.runtime.mutableStateOf
2625import androidx.compose.runtime.remember
27- import androidx.compose.runtime.saveable.rememberSaveable
28- import androidx.compose.runtime.setValue
2926import androidx.compose.ui.Modifier
3027import androidx.compose.ui.unit.dp
3128import androidx.lifecycle.compose.collectAsStateWithLifecycle
3229import mifos_mobile.feature.accounts.generated.resources.Res
33- import mifos_mobile.feature.accounts.generated.resources.feature_account_title
3430import mifos_mobile.feature.accounts.generated.resources.feature_loan_account_title
3531import mifos_mobile.feature.accounts.generated.resources.feature_saving_account_title
3632import mifos_mobile.feature.accounts.generated.resources.feature_share_account_title
3733import org.jetbrains.compose.resources.stringResource
3834import org.koin.compose.viewmodel.koinViewModel
3935import org.mifos.mobile.core.designsystem.component.BasicDialogState
4036import org.mifos.mobile.core.designsystem.component.MifosBasicDialog
37+ import org.mifos.mobile.core.designsystem.component.MifosBottomSheet
4138import org.mifos.mobile.core.designsystem.component.MifosElevatedScaffold
4239import org.mifos.mobile.core.designsystem.component.rememberMifosPullToRefreshState
4340import org.mifos.mobile.core.designsystem.theme.DesignToken
@@ -115,17 +112,22 @@ internal fun AccountsDialog(
115112 onDismissRequest = { onAction(AccountsAction .DismissDialog ) },
116113 )
117114 }
118- AccountsState .DialogState .Filters -> SavingsAccountFilters (
119- state = state,
120- onAction = onAction,
115+ AccountsState .DialogState .Filters -> MifosBottomSheet (
116+ content = {
117+ SavingsAccountFilters (
118+ state = state,
119+ onAction = onAction,
120+ )
121+ },
121122 modifier = modifier,
123+ onDismiss = { onAction(AccountsAction .DismissDialog ) },
122124 )
123125 null -> {}
124126 }
125127}
126128
127129/* *
128- * Composable function that displays the Savings Account Filters Dialog .
130+ * Composable function that displays the Savings Account Filters Bottom Bar .
129131 *
130132 * @param state The state of the screen.
131133 * @param onAction The function to be called when an action is performed.
@@ -137,68 +139,51 @@ internal fun SavingsAccountFilters(
137139 onAction : (AccountsAction ) -> Unit ,
138140 modifier : Modifier = Modifier ,
139141) {
140- var isTypeExpanded by rememberSaveable { mutableStateOf(true ) }
141- var isStatusExpanded by rememberSaveable { mutableStateOf(true ) }
142-
143- MifosElevatedScaffold (
144- onNavigateBack = { onAction(AccountsAction .OnNavigateBack ) },
145- topBarTitle = stringResource(Res .string.feature_account_title),
146- bottomBar = {
147- Surface {
148- MifosPoweredCard (
149- modifier = modifier
150- .fillMaxWidth()
151- .navigationBarsPadding(),
152- )
153- }
154- },
142+ Column (
143+ modifier = modifier
144+ .fillMaxSize()
145+ .verticalScroll(rememberScrollState())
146+ .padding(DesignToken .padding.large)
147+ .padding(top = DesignToken .padding.large),
155148 ) {
156- Column (
157- modifier = Modifier
158- .fillMaxSize()
159- .verticalScroll(rememberScrollState())
160- .padding(DesignToken .padding.large)
161- .padding(top = DesignToken .padding.large),
162- ) {
163- FilterTopSection (
164- isAnyFilterSelected = state.isAnyFilterSelected,
165- resetFilters = {
166- onAction(AccountsAction .ResetFilters )
167- },
168- onApplyFilter = {
169- onAction(AccountsAction .GetFilterResults )
170- },
171- dismissDialog = {
172- onAction(AccountsAction .DismissDialog )
173- },
174- )
149+ FilterTopSection (
150+ isAnyFilterSelected = state.isAnyFilterSelected,
151+ resetFilters = {
152+ onAction(AccountsAction .ResetFilters )
153+ },
154+ onApplyFilter = {
155+ onAction(AccountsAction .GetFilterResults )
156+ },
157+ dismissDialog = {
158+ onAction(AccountsAction .DismissDialog )
159+ },
160+ )
175161
176- Spacer (Modifier .height(DesignToken .spacing.largeIncreased))
162+ Spacer (Modifier .height(DesignToken .spacing.largeIncreased))
177163
178- HorizontalDivider (modifier = Modifier .height(1 .dp))
164+ HorizontalDivider (modifier = Modifier .height(1 .dp))
179165
180- FilterSection (
181- title = " Type" ,
182- filtersSelected = state.accountTypeFiltersCount ? : 0 ,
183- isExpanded = isTypeExpanded,
184- onToggle = { isTypeExpanded = ! isTypeExpanded },
185- filters = state.checkboxOptions.filter { it.type == FilterType .ACCOUNT_TYPE },
186- onCheckChanged = { label ->
187- onAction(AccountsAction .ToggleCheckbox (label, FilterType .ACCOUNT_TYPE ))
188- },
189- )
166+ FilterSection (
167+ title = " Type" ,
168+ filtersSelected = state.accountTypeFiltersCount ? : 0 ,
169+ isExpanded = state. isTypeExpanded,
170+ onToggle = { onAction( AccountsAction . ToggleTypeExpanded ) },
171+ filters = state.checkboxOptions.filter { it.type == FilterType .ACCOUNT_TYPE },
172+ onCheckChanged = { label ->
173+ onAction(AccountsAction .ToggleCheckbox (label, FilterType .ACCOUNT_TYPE ))
174+ },
175+ )
190176
191- FilterSection (
192- title = " Status" ,
193- filtersSelected = state.accountStatusFiltersCount ? : 0 ,
194- isExpanded = isStatusExpanded,
195- onToggle = { isStatusExpanded = ! isStatusExpanded },
196- filters = state.checkboxOptions.filter { it.type == FilterType .ACCOUNT_STATUS },
197- onCheckChanged = { label ->
198- onAction(AccountsAction .ToggleCheckbox (label, FilterType .ACCOUNT_STATUS ))
199- },
200- )
201- }
177+ FilterSection (
178+ title = " Status" ,
179+ filtersSelected = state.accountStatusFiltersCount ? : 0 ,
180+ isExpanded = state.isStatusExpanded,
181+ onToggle = { onAction(AccountsAction .ToggleStatusExpanded ) },
182+ filters = state.checkboxOptions.filter { it.type == FilterType .ACCOUNT_STATUS },
183+ onCheckChanged = { label ->
184+ onAction(AccountsAction .ToggleCheckbox (label, FilterType .ACCOUNT_STATUS ))
185+ },
186+ )
202187 }
203188}
204189
@@ -207,13 +192,11 @@ internal fun SavingsAccountFilters(
207192 *
208193 * @param state The state of the screen.
209194 * @param onAction The function to be called when an action is performed.
210- * @param modifier Modifier to be applied to the layout.
211195 */
212196@Composable
213197internal fun AccountScreenContent (
214198 state : AccountsState ,
215199 onAction : (AccountsAction ) -> Unit ,
216- modifier : Modifier = Modifier ,
217200) {
218201 val isRefreshing = state.isRefreshing
219202 val pullToRefreshState = rememberMifosPullToRefreshState(
@@ -235,7 +218,7 @@ internal fun AccountScreenContent(
235218 bottomBar = {
236219 Surface {
237220 MifosPoweredCard (
238- modifier = modifier
221+ modifier = Modifier
239222 .fillMaxWidth()
240223 .navigationBarsPadding(),
241224 )
0 commit comments