Skip to content

Commit 48b1dee

Browse files
authored
New Fixed Deposits Account Settings Step (#2555)
1 parent ec227fc commit 48b1dee

File tree

25 files changed

+929
-291
lines changed

25 files changed

+929
-291
lines changed

core/data/src/commonMain/kotlin/com/mifos/core/data/repository/FixedDepositRepository.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ import kotlinx.coroutines.flow.Flow
1616
interface FixedDepositRepository {
1717
fun getFixedDepositTemplate(
1818
clientId: Int,
19-
productId: Int?,
19+
productId: Int? = null,
2020
): Flow<DataState<FixedDepositTemplate>>
2121
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.core.model.objects.template.recurring
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class MaturityInstructionOption(
16+
val code: String? = null,
17+
val id: Int? = null,
18+
val value: String? = null,
19+
)

core/network/src/commonMain/kotlin/com/mifos/core/network/model/FixedDepositTemplate.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ package com.mifos.core.network.model
1111

1212
import com.mifos.core.model.objects.account.saving.FieldOfficerOptions
1313
import com.mifos.core.model.objects.template.recurring.Currency
14+
import com.mifos.core.model.objects.template.recurring.MaturityInstructionOption
1415
import com.mifos.core.model.objects.template.recurring.interest.InterestCalculationDaysInYearTypeOption
1516
import com.mifos.core.model.objects.template.recurring.interest.InterestCalculationTypeOption
1617
import com.mifos.core.model.objects.template.recurring.interest.InterestCompoundingPeriodTypeOption
1718
import com.mifos.core.model.objects.template.recurring.interest.InterestPostingPeriodTypeOption
19+
import com.mifos.core.model.objects.template.recurring.period.LockinPeriodFrequencyTypeOption
1820
import com.mifos.core.model.objects.template.recurring.period.PeriodFrequencyTypeOption
1921
import kotlinx.serialization.SerialName
2022
import kotlinx.serialization.Serializable
@@ -52,4 +54,6 @@ data class FixedDepositTemplate(
5254
@SerialName("interestCalculationTypeOptions")
5355
val interestCalculationTypeOptions: List<InterestCalculationTypeOption>? = null,
5456

57+
val lockinPeriodFrequencyTypeOptions: List<LockinPeriodFrequencyTypeOption>? = null,
58+
val maturityInstructionOptions: List<MaturityInstructionOption>? = null,
5559
)

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,4 +605,19 @@
605605
<string name="feature_fixed_deposit_terms_page">Terms</string>
606606
<string name="feature_fixed_deposit_deposit_period">Deposit Period</string>
607607

608+
<string name="feature_fixed_deposit_setting_lock_in_period">Lock-in-Period</string>
609+
<string name="feature_fixed_deposit_setting_frequency">Frequency</string>
610+
<string name="feature_fixed_deposit_setting_type">Type</string>
611+
<string name="feature_fixed_deposit_setting_minimum_deposit_term">Minimum Deposit Term</string>
612+
<string name="feature_fixed_deposit_setting_thereafter_in_multiples">And thereafter, in Multiples of</string>
613+
<string name="feature_fixed_deposit_setting_maximum_deposit_term">Maximum Deposit Term</string>
614+
<string name="feature_fixed_deposit_setting_interest_transfer">Interest Transfer</string>
615+
<string name="feature_fixed_deposit_setting_linked_saving_account">Transfer Interest to Linked Savings Account?</string>
616+
<string name="feature_fixed_deposit_setting_maturity_instructions">Maturity Instructions</string>
617+
<string name="feature_fixed_deposit_setting_investing_account">Investing Account</string>
618+
<string name="feature_fixed_deposit_setting_pre_mature_closure">For Pre-mature closure</string>
619+
<string name="feature_fixed_deposit_setting_apply_penal_interest">Apply Penal Interest (less)</string>
620+
<string name="feature_fixed_deposit_setting_penal_interest">Penal Interest (%%)</string>
621+
<string name="feature_fixed_deposit_setting_period">Period</string>
622+
608623
</resources>

feature/client/src/commonMain/kotlin/com/mifos/feature/client/createShareAccount/pages/ChargesPage.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ fun ChargesPage(
9898
text = state.addedCharges.size.toString() + " " + stringResource(Res.string.feature_share_account_charge_active_charge),
9999
btnEnabled = state.addedCharges.isNotEmpty(),
100100
)
101+
Spacer(Modifier.height(DesignToken.padding.large))
101102
}
102103
MifosTwoButtonRow(
103104
firstBtnText = stringResource(Res.string.feature_share_account_back),

feature/client/src/commonMain/kotlin/com/mifos/feature/client/createShareAccount/pages/DetailsPage.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ fun DetailsPage(
146146
onSecondBtnClick = {
147147
onAction(CreateShareAccountAction.OnDetailNext)
148148
},
149-
modifier = Modifier.padding(top = DesignToken.padding.small),
150149
)
151150
}
152151
}

feature/client/src/commonMain/kotlin/com/mifos/feature/client/createShareAccount/pages/PreviewPage.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ import androidclient.feature.client.generated.resources.feature_share_account_te
3030
import androidclient.feature.client.generated.resources.feature_share_account_terms_total_shares
3131
import androidx.compose.foundation.layout.Arrangement
3232
import androidx.compose.foundation.layout.Column
33+
import androidx.compose.foundation.layout.Spacer
3334
import androidx.compose.foundation.layout.fillMaxSize
35+
import androidx.compose.foundation.layout.height
3436
import androidx.compose.foundation.layout.padding
3537
import androidx.compose.foundation.rememberScrollState
3638
import androidx.compose.foundation.verticalScroll
@@ -87,6 +89,7 @@ fun PreviewPage(
8789
text = state.addedCharges.size.toString() + " " + stringResource(Res.string.feature_share_account_charge_active_charge),
8890
btnEnabled = state.addedCharges.isNotEmpty(),
8991
)
92+
Spacer(Modifier.height(DesignToken.padding.large))
9093
}
9194
MifosTwoButtonRow(
9295
firstBtnText = stringResource(Res.string.feature_share_account_back),
@@ -97,7 +100,6 @@ fun PreviewPage(
97100
onSecondBtnClick = {
98101
onAction(CreateShareAccountAction.SubmitShareAccount)
99102
},
100-
modifier = Modifier.padding(top = DesignToken.padding.small),
101103
)
102104
}
103105
}

feature/client/src/commonMain/kotlin/com/mifos/feature/client/createShareAccount/pages/TermsPage.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ fun TermsPage(
224224
errorMessage = state.minActivePeriodFreqTypeError?.let { stringResource(it) },
225225
)
226226

227+
Spacer(Modifier.height(DesignToken.padding.small))
228+
227229
Text(
228230
text = stringResource(Res.string.feature_share_account_terms_lock_in_period),
229231
style = MifosTypography.labelLargeEmphasized,
@@ -263,6 +265,7 @@ fun TermsPage(
263265
label = stringResource(Res.string.feature_share_account_terms_type),
264266
errorMessage = state.lockInPeriodFreqTypeError?.let { stringResource(it) },
265267
)
268+
Spacer(Modifier.height(DesignToken.padding.large))
266269
}
267270
MifosTwoButtonRow(
268271
firstBtnText = stringResource(Res.string.feature_share_account_back),
@@ -273,7 +276,6 @@ fun TermsPage(
273276
onSecondBtnClick = {
274277
onAction(CreateShareAccountAction.OnTermsNext)
275278
},
276-
modifier = Modifier.padding(top = DesignToken.padding.small),
277279
)
278280
}
279281
}

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import androidclient.feature.client.generated.resources.step_details
1515
import androidclient.feature.client.generated.resources.step_interest
1616
import androidclient.feature.client.generated.resources.step_settings
1717
import androidclient.feature.client.generated.resources.step_terms
18-
import androidclient.feature.client.generated.resources.title_new_fixed_deposit_account
1918
import androidx.compose.foundation.layout.Column
2019
import androidx.compose.foundation.layout.fillMaxWidth
2120
import androidx.compose.runtime.Composable
@@ -27,6 +26,7 @@ import com.mifos.core.designsystem.component.MifosScaffold
2726
import com.mifos.core.ui.components.MifosBreadcrumbNavBar
2827
import com.mifos.core.ui.components.MifosErrorComponent
2928
import com.mifos.core.ui.components.MifosProgressIndicator
29+
import com.mifos.core.ui.components.MifosProgressIndicatorOverlay
3030
import com.mifos.core.ui.components.MifosStepper
3131
import com.mifos.core.ui.components.Step
3232
import com.mifos.core.ui.util.EventsEffect
@@ -55,7 +55,7 @@ internal fun CreateFixedDepositAccountScreen(
5555
}
5656
FixedDepositAccountScaffold(
5757
navController = navController,
58-
newFixedDepositAccountState = state,
58+
state = state,
5959
onAction = { viewModel.trySendAction(it) },
6060
modifier = modifier,
6161
)
@@ -64,28 +64,29 @@ internal fun CreateFixedDepositAccountScreen(
6464
@Composable
6565
private fun FixedDepositAccountScaffold(
6666
navController: NavController,
67-
newFixedDepositAccountState: NewFixedDepositAccountState,
67+
state: NewFixedDepositAccountState,
6868
onAction: (NewFixedDepositAccountAction) -> Unit,
6969
modifier: Modifier = Modifier,
7070
) {
7171
val steps =
7272
listOf(
7373
Step(stringResource(Res.string.step_details)) {
7474
DetailsPage(
75-
state = newFixedDepositAccountState,
75+
state = state,
7676
onAction = onAction,
7777
)
7878
},
7979
Step(name = stringResource(Res.string.step_terms)) {
8080
TermsPage(
81-
state = newFixedDepositAccountState,
81+
state = state,
8282
onAction = onAction,
8383
)
8484
},
8585

8686
Step(name = stringResource(Res.string.step_settings)) {
8787
SettingPage(
88-
onNext = { onAction(NewFixedDepositAccountAction.OnNextPress) },
88+
state = state,
89+
onAction = onAction,
8990
)
9091
},
9192
Step(name = stringResource(Res.string.step_interest)) {
@@ -101,17 +102,14 @@ private fun FixedDepositAccountScaffold(
101102
)
102103

103104
MifosScaffold(
104-
title = stringResource(Res.string.title_new_fixed_deposit_account),
105-
onBackPressed = { onAction(NewFixedDepositAccountAction.NavigateBack) },
106105
modifier = modifier,
107-
108106
) { paddingValues ->
109107
Column {
110108
MifosBreadcrumbNavBar(navController)
111-
when (newFixedDepositAccountState.screenState) {
109+
when (state.screenState) {
112110
is NewFixedDepositAccountState.ScreenState.Error -> {
113111
MifosErrorComponent(
114-
message = newFixedDepositAccountState.screenState.message,
112+
message = state.screenState.message,
115113
isRetryEnabled = true,
116114
) {
117115
onAction(NewFixedDepositAccountAction.Retry)
@@ -125,7 +123,7 @@ private fun FixedDepositAccountScaffold(
125123
is NewFixedDepositAccountState.ScreenState.Success -> {
126124
MifosStepper(
127125
steps = steps,
128-
currentIndex = newFixedDepositAccountState.currentStep,
126+
currentIndex = state.currentStep,
129127
onStepChange = { newIndex ->
130128
onAction(NewFixedDepositAccountAction.OnStepChange(newIndex))
131129
},
@@ -136,5 +134,8 @@ private fun FixedDepositAccountScaffold(
136134
}
137135
}
138136
}
137+
if (state.isOverlayLoading) {
138+
MifosProgressIndicatorOverlay()
139+
}
139140
}
140141
}

0 commit comments

Comments
 (0)