Skip to content

Commit 0bafcd3

Browse files
refactor: connected loan product details and application form (#2926)
1 parent 990ebd2 commit 0bafcd3

File tree

5 files changed

+76
-125
lines changed

5 files changed

+76
-125
lines changed

feature/loan-application/src/commonMain/kotlin/org/mifos/mobile/feature/loan/application/loanApplication/LoanApplyRoute.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ import kotlinx.serialization.Serializable
1616
import org.mifos.mobile.core.ui.composableWithSlideTransitions
1717

1818
@Serializable
19-
data object LoanApplyRoute
19+
data class LoanApplyRoute(
20+
val productId: Int,
21+
val productName: String,
22+
)
2023

21-
fun NavController.navigateToLoanApplyScreen(navOptions: NavOptions? = null) =
22-
navigate(LoanApplyRoute, navOptions)
24+
fun NavController.navigateToLoanApplyScreen(
25+
productId: Int,
26+
productName: String,
27+
navOptions: NavOptions? = null,
28+
) =
29+
navigate(LoanApplyRoute(productId, productName), navOptions)
2330

2431
fun NavGraphBuilder.loanApplyDestination(
2532
navigateBack: () -> Unit,

feature/loan-application/src/commonMain/kotlin/org/mifos/mobile/feature/loan/application/loanApplication/LoanApplyScreen.kt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import mifos_mobile.feature.loan_application.generated.resources.feature_apply_l
4242
import mifos_mobile.feature.loan_application.generated.resources.feature_apply_loan_label_loan_product
4343
import mifos_mobile.feature.loan_application.generated.resources.feature_apply_loan_label_principal_amount
4444
import mifos_mobile.feature.loan_application.generated.resources.feature_apply_loan_label_purpose
45-
import mifos_mobile.feature.loan_application.generated.resources.feature_apply_loan_title
45+
import mifos_mobile.feature.loan_application.generated.resources.feature_apply_loan_section_fill_details
4646
import org.jetbrains.compose.resources.stringResource
4747
import org.koin.compose.viewmodel.koinViewModel
4848
import org.mifos.mobile.core.common.DateHelper
@@ -77,9 +77,9 @@ internal fun LoanApplyScreen(
7777

7878
is LoanApplicationEvent.NavigateToConfirmDetailsScreen -> {
7979
navigateToConfirmDetailsScreen(
80-
state.selectedLoanProductId,
80+
state.loanProductId.toLong(),
8181
state.applicantName,
82-
state.selectedLoanProduct,
82+
state.loanProductName,
8383
state.selectedLoanPurpose,
8484
state.disbursementDate,
8585
state.principalAmount,
@@ -117,7 +117,7 @@ internal fun LoanAccountDialog(
117117
visibilityState = BasicDialogState.Shown(
118118
message = stringResource(dialogState.message),
119119
),
120-
onDismissRequest = { onAction(LoanApplicationAction.DismissDialog) },
120+
onDismissRequest = { onAction(LoanApplicationAction.ConfirmNavigation) },
121121
)
122122
}
123123

@@ -186,7 +186,7 @@ internal fun LoanAccountDialog(
186186

187187
is LoanApplicationDialogState.Network -> {
188188
MifosErrorComponent(
189-
isNetworkConnected = !state.networkUnavailable,
189+
isNetworkConnected = state.networkStatus,
190190
isRetryEnabled = true,
191191
onRetry = { onAction(LoanApplicationAction.Retry) },
192192
)
@@ -204,7 +204,7 @@ internal fun LoanAccountContent(
204204
) {
205205
MifosElevatedScaffold(
206206
onNavigateBack = { onAction(LoanApplicationAction.OnNavigateBack) },
207-
topBarTitle = stringResource(Res.string.feature_apply_loan_title),
207+
topBarTitle = stringResource(Res.string.feature_apply_loan_section_fill_details),
208208
bottomBar = {
209209
Surface {
210210
MifosPoweredCard(
@@ -235,11 +235,10 @@ internal fun LoanAccountContent(
235235
)
236236

237237
MifosOutlineDropdown(
238-
selectedText = state.selectedLoanProduct,
239-
items = state.productOptionsMap,
240-
onItemSelected = { id, product ->
241-
onAction(LoanApplicationAction.LoanProductChange(id, product))
242-
},
238+
selectedText = state.loanProductName,
239+
items = emptyMap(),
240+
enabled = false,
241+
onItemSelected = { _, _ -> },
243242
label = stringResource(Res.string.feature_apply_loan_label_loan_product),
244243
)
245244

@@ -249,7 +248,6 @@ internal fun LoanAccountContent(
249248
onItemSelected = { id, product ->
250249
onAction(LoanApplicationAction.PurposeOfLoanChange(product))
251250
},
252-
enabled = state.selectedLoanProduct != "",
253251
label = stringResource(Res.string.feature_apply_loan_label_purpose),
254252
)
255253

0 commit comments

Comments
 (0)