Skip to content

Commit 0b38909

Browse files
committed
feat(fixed-deposit): Implement Interest Charts step in account creation
What: - Create InterestChartsPage component for Fixed Deposit Account creation - Add main creation screen with stepper navigation - Implement interest rate chart management functionality Details: - Add chart information section with name, dates, and description - Implement interest rate chart modal with CRUD operations - Add validation for interest rates (>0, <100) - Setup state management and view model for the feature - Add download functionality for chart details - Add navigation controls between steps - Integrate with Fixed Deposit Account creation flow Technical Changes: - Create InterestChartsPage.kt for the UI implementation - Add FixedDepositAccountState.kt for state management - Add FixedDepositAccountViewModel.kt for business logic - Create FixedDepositAccountCreationScreen.kt for main flow - Add navigation routes and string resources Testing: - Verify chart information display - Test CRUD operations on interest rates - Validate navigation between steps - Check download functionality Resolves: MIFOSAC-560
1 parent ac16ab6 commit 0b38909

File tree

3 files changed

+176
-0
lines changed

3 files changed

+176
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
<string name="feature_client_group">Group</string>
2929
<string name="feature_client_loan_account">Loan Accounts</string>
3030
<string name="feature_client_savings_account">Savings Accounts</string>
31+
32+
<!-- Fixed Deposit Account Creation -->
33+
<string name="feature_fixed_deposit_step_product">Product</string>
34+
<string name="feature_fixed_deposit_step_details">Details</string>
35+
<string name="feature_fixed_deposit_step_terms">Terms</string>
36+
<string name="feature_fixed_deposit_step_interest">Interest Charts</string>
37+
<string name="feature_fixed_deposit_step_charges">Charges</string>
38+
<string name="feature_fixed_deposit_step_preview">Preview</string>
39+
<string name="feature_fixed_deposit_chart_info">Chart Information</string>
3140
<string name="feature_client_accounts">Accounts</string>
3241

3342
<string name="feature_client_upload_signature">Upload Signature</string>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.mifos.feature.client.fixedDepositAccount.creation
17+
18+
import androidx.navigation.NavController
19+
import androidx.navigation.NavGraphBuilder
20+
import androidx.navigation.compose.composable
21+
import kotlinx.serialization.Serializable
22+
23+
@Serializable
24+
data class FixedDepositAccountCreationRoute(
25+
val clientId: Int = -1,
26+
val step: Int = 0
27+
)
28+
29+
fun NavGraphBuilder.fixedDepositAccountCreationDestination(
30+
navController: NavController,
31+
navigateBack: () -> Unit
32+
) {
33+
composable<FixedDepositAccountCreationRoute> {
34+
FixedDepositAccountCreationScreen(
35+
navController = navController,
36+
navigateBack = navigateBack
37+
)
38+
}
39+
}
40+
41+
fun NavController.navigateToFixedDepositAccountCreation(
42+
clientId: Int,
43+
step: Int = 0
44+
) {
45+
this.navigate(
46+
FixedDepositAccountCreationRoute(
47+
clientId = clientId,
48+
step = step
49+
)
50+
)
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.mifos.feature.client.fixedDepositAccount.creation
17+
18+
import androidx.compose.foundation.layout.*
19+
import androidx.compose.material3.*
20+
import androidx.compose.runtime.*
21+
import androidx.compose.ui.Modifier
22+
import androidx.navigation.NavController
23+
import com.mifos.core.designsystem.theme.DesignToken
24+
import com.mifos.core.ui.components.MifosStepper
25+
import com.mifos.core.ui.components.Step
26+
import com.mifos.core.ui.util.EventsEffect
27+
import com.mifos.feature.client.fixedDepositAccount.creation.pages.*
28+
import org.jetbrains.compose.resources.stringResource
29+
import org.koin.compose.viewmodel.koinViewModel
30+
import com.mifos.core.common.Res
31+
32+
@Composable
33+
fun FixedDepositAccountCreationScreen(
34+
navController: NavController,
35+
navigateBack: () -> Unit,
36+
modifier: Modifier = Modifier,
37+
viewModel: FixedDepositAccountViewModel = koinViewModel()
38+
) {
39+
val state by viewModel.stateFlow.collectAsStateWithLifecycle()
40+
41+
EventsEffect(viewModel.eventFlow) { event ->
42+
when (event) {
43+
is FixedDepositAccountEvent.ShowError -> {
44+
// Show error snackbar or dialog
45+
}
46+
is FixedDepositAccountEvent.NavigateToStep -> {
47+
// Handle step navigation
48+
}
49+
is FixedDepositAccountEvent.ShowDownloadSuccess -> {
50+
// Show download success message
51+
}
52+
}
53+
}
54+
55+
Surface(
56+
modifier = modifier.fillMaxSize(),
57+
color = MaterialTheme.colorScheme.background
58+
) {
59+
Column(
60+
modifier = Modifier
61+
.fillMaxSize()
62+
.padding(DesignToken.padding.medium)
63+
) {
64+
val steps = listOf(
65+
Step(
66+
title = stringResource(Res.string.feature_fixed_deposit_step_product),
67+
content = {
68+
// Product Selection Page
69+
}
70+
),
71+
Step(
72+
title = stringResource(Res.string.feature_fixed_deposit_step_details),
73+
content = {
74+
// Details Page
75+
}
76+
),
77+
Step(
78+
title = stringResource(Res.string.feature_fixed_deposit_step_terms),
79+
content = {
80+
// Terms Page
81+
}
82+
),
83+
Step(
84+
title = stringResource(Res.string.feature_fixed_deposit_step_interest),
85+
content = {
86+
InterestChartsPage(
87+
state = state,
88+
onAction = remember(viewModel) { { viewModel.trySendAction(it) } }
89+
)
90+
}
91+
),
92+
Step(
93+
title = stringResource(Res.string.feature_fixed_deposit_step_charges),
94+
content = {
95+
// Charges Page
96+
}
97+
),
98+
Step(
99+
title = stringResource(Res.string.feature_fixed_deposit_step_preview),
100+
content = {
101+
// Preview Page
102+
}
103+
)
104+
)
105+
106+
MifosStepper(
107+
steps = steps,
108+
currentIndex = state.currentStep,
109+
onStepChange = { newStep ->
110+
// Handle step change here
111+
},
112+
modifier = Modifier.fillMaxWidth()
113+
)
114+
}
115+
}
116+
}

0 commit comments

Comments
 (0)