Skip to content

Commit 38c179b

Browse files
authored
Enhance Terms and setting screen of recurring account (#2550)
1 parent a8e9954 commit 38c179b

File tree

13 files changed

+747
-528
lines changed

13 files changed

+747
-528
lines changed

core/ui/src/commonMain/kotlin/com/mifos/core/ui/util/TextFieldsValidator.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,11 @@ object TextFieldsValidator {
5454
else -> null
5555
}
5656
}
57+
58+
fun dropDownEmptyValidator(input: Boolean): StringResource? {
59+
return when {
60+
input -> Res.string.error_field_empty
61+
else -> null
62+
}
63+
}
5764
}

feature/client/src/commonMain/composeResources/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@
593593
<string name="charges_view_charges">View Charges</string>
594594
<string name="charges_client_update_not_support_error_msg">Updating client charges is not supported. Please delete the existing charge and create a new one.</string>
595595

596+
<!--Fixed Deposit Account -->
596597
<string name="feature_fixed_deposit_deposit_amount">Deposit Amount</string>
597598
<string name="feature_fixed_deposit_deposit_period_type">Deposit Period Type</string>
598599
<string name="feature_fixed_interest_compounding">Interest Compounding</string>

feature/client/src/commonMain/kotlin/com/mifos/feature/client/newFixedDepositAccount/CreateFixedDepositAccountViewmodel.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,29 @@ class CreateFixedDepositAccountViewmodel(
9090
}
9191

9292
DataState.Loading -> {
93-
setLoadingState()
93+
mutableStateFlow.update {
94+
it.copy(
95+
isOverlayLoading = true,
96+
)
97+
}
9498
}
9599
}
96100
}
97101
}
98102

99-
private fun setLoadingState() {
103+
private fun setSuccessState() {
100104
mutableStateFlow.update {
101105
it.copy(
102-
screenState = NewFixedDepositAccountState.ScreenState.Loading,
106+
screenState = NewFixedDepositAccountState.ScreenState.Success,
107+
isOverlayLoading = false,
103108
)
104109
}
105110
}
106-
107-
private fun setSuccessState() {
108-
mutableStateFlow.update {
109-
it.copy(screenState = NewFixedDepositAccountState.ScreenState.Success)
110-
}
111-
}
112111
private fun setErrorState(message: String) {
113112
mutableStateFlow.update {
114113
it.copy(
115114
screenState = NewFixedDepositAccountState.ScreenState.Error(message),
115+
isOverlayLoading = false,
116116
)
117117
}
118118
}
@@ -274,6 +274,7 @@ data class NewFixedDepositAccountState(
274274
val fixedDepositAccountDetail: FixedDepositAccountDetailsState = FixedDepositAccountDetailsState(),
275275
val fixedDepositAccountTerms: FixedDepositAccountTermsState = FixedDepositAccountTermsState(),
276276
val template: FixedDepositTemplate = FixedDepositTemplate(),
277+
val isOverlayLoading: Boolean = false,
277278
) {
278279
sealed interface ScreenState {
279280
data class Error(val message: String) : ScreenState

feature/recurringDeposit/src/commonMain/kotlin/com/mifos/feature/recurringDeposit/newRecurringDepositAccount/RecurringAccountScreen.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
package com.mifos.feature.recurringDeposit.newRecurringDepositAccount
1111

1212
import androidclient.feature.recurringdeposit.generated.resources.Res
13-
import androidclient.feature.recurringdeposit.generated.resources.feature_recurring_deposit_create_recurring_deposit_account
1413
import androidclient.feature.recurringdeposit.generated.resources.feature_recurring_deposit_step_charges
1514
import androidclient.feature.recurringdeposit.generated.resources.feature_recurring_deposit_step_details
1615
import androidclient.feature.recurringdeposit.generated.resources.feature_recurring_deposit_step_interest
@@ -28,6 +27,7 @@ import com.mifos.core.designsystem.component.MifosScaffold
2827
import com.mifos.core.ui.components.MifosBreadcrumbNavBar
2928
import com.mifos.core.ui.components.MifosErrorComponent
3029
import com.mifos.core.ui.components.MifosProgressIndicator
30+
import com.mifos.core.ui.components.MifosProgressIndicatorOverlay
3131
import com.mifos.core.ui.components.MifosStepper
3232
import com.mifos.core.ui.components.Step
3333
import com.mifos.core.ui.util.EventsEffect
@@ -104,8 +104,6 @@ private fun RecurringAccountScaffold(
104104
)
105105

106106
MifosScaffold(
107-
title = stringResource(Res.string.feature_recurring_deposit_create_recurring_deposit_account),
108-
onBackPressed = { onAction(RecurringAccountAction.NavigateBack) },
109107
modifier = modifier,
110108
) { paddingValues ->
111109
Column(
@@ -141,5 +139,8 @@ private fun RecurringAccountScaffold(
141139
}
142140
}
143141
}
142+
if (state.isOverlayLoading) {
143+
MifosProgressIndicatorOverlay()
144+
}
144145
}
145146
}

0 commit comments

Comments
 (0)