Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed static checks failing
  • Loading branch information
sam-arth07 committed Oct 23, 2025
commit 6f94c416134ece0f3085712dce802d3c2851a781
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SavingsPayload {
var lockinPeriodFrequency: Int? = null
var lockinPeriodFrequencyType: Int? = null

var charges : List<ChargesPayload>? = null
var charges: List<ChargesPayload>? = null
var nominalAnnualInterestRateOverdraft: String? = null
var overdraftLimit: String? = null
var minOverdraftForInterestCalculation: String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ package com.mifos.feature.client.clientGeneral
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.client.clientDetailsProfile.ClientProfileDetailsRoute
import com.mifos.feature.client.clientProfile.ClientProfileRoute
import com.mifos.feature.client.navigation.ClientListScreenRoute
import com.mifos.feature.client.navigation.ClientScreens
import com.mifos.feature.client.navigation.navigateClientDetailsScreen
import com.mifos.feature.client.navigation.navigateToClientListScreen
import kotlinx.serialization.Serializable

@Serializable
Expand Down Expand Up @@ -58,7 +54,6 @@ fun NavController.navigateToClientProfileGeneralRoute(id: Int) {
)
}


fun NavController.navigateToClientProfileGeneralRouteOnStatus(id: Int) {
this.navigate(
ClientProfileGeneralRoute(id = id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ fun NavGraphBuilder.clientNavGraph(
onBackPressed = navController::popBackStack,
loadMoreSavingsAccountInfo = navController::navigateToDataTable,
loadDocuments = navController::navigateToDocumentListScreen,
onFinish = navController::navigateToClientProfileGeneralRouteOnStatus
onFinish = navController::navigateToClientProfileGeneralRouteOnStatus,
)

shareAccountDestination()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private fun SavingsAccountScaffold(
MifosStatusDialog(
status = state.screenState.status,
btnText = stringResource(Res.string.feature_savings_continue),
onConfirm = { if(state.screenState.status == ResultStatus.SUCCESS) onAction(SavingsAccountAction.Finish) else onAction(SavingsAccountAction.Retry) },
onConfirm = { if (state.screenState.status == ResultStatus.SUCCESS) onAction(SavingsAccountAction.Finish) else onAction(SavingsAccountAction.Retry) },
successTitle = stringResource(Res.string.feature_savings_success),
successMessage = state.screenState.msg,
failureTitle = stringResource(Res.string.feature_savings_failed),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal class SavingsAccountViewModel(
is SavingsAccountAction.Finish -> {
mutableStateFlow.update {
it.copy(
screenState = SavingsAccountState.ScreenState.Success
screenState = SavingsAccountState.ScreenState.Success,
)
}
sendEvent(SavingsAccountEvent.Finish)
Expand Down Expand Up @@ -124,7 +124,7 @@ internal class SavingsAccountViewModel(
submitSavingsApplication(createSavingsPayload())
}

private fun createSavingsPayload() : SavingsPayload {
private fun createSavingsPayload(): SavingsPayload {
val savingsPayload = SavingsPayload()
savingsPayload.apply {
locale = "en"
Expand All @@ -139,7 +139,7 @@ internal class SavingsAccountViewModel(
minRequiredOpeningBalance = state.minimumOpeningBalance
minRequiredBalance = state.monthlyMinimumBalance
lockinPeriodFrequency = state.frequency.let { if (it.isNotBlank()) it.toInt() else null }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use state.frequency.toIntOrNull() instead of creating long if else statement

lockinPeriodFrequencyType = state.freqTypeIndex.let { if (it != -1) it else null}
lockinPeriodFrequencyType = state.freqTypeIndex.let { if (it != -1) it else null }
charges = state.addedCharges.map { charges ->
ChargesPayload(
chargeId = charges.id,
Expand All @@ -162,7 +162,7 @@ internal class SavingsAccountViewModel(
val online = networkMonitor.isOnline.first()
if (online) {
createSavingsAccountUseCase(savingsPayload).collect { result ->
when(result) {
when (result) {
is DataState.Loading -> {
mutableStateFlow.update {
it.copy(
Expand All @@ -177,7 +177,7 @@ internal class SavingsAccountViewModel(
screenState = SavingsAccountState.ScreenState.ShowStatusDialog(
ResultStatus.SUCCESS,
getString(Res.string.feature_savings_new_savings_account_submitted_success),
)
),
)
}
}
Expand All @@ -203,7 +203,6 @@ internal class SavingsAccountViewModel(
}
}


private fun handleChargesAmountChangeError(error: StringResource?) {
mutableStateFlow.update {
it.copy(
Expand Down Expand Up @@ -648,14 +647,14 @@ constructor(
}

val isDetailsNextEnabled = submissionDate.isNotEmpty() &&
savingsProductSelected != -1 &&
fieldOfficerIndex != -1
savingsProductSelected != -1 &&
fieldOfficerIndex != -1

val isTermsNextEnabled = isDetailsNextEnabled &&
currencyIndex != -1 &&
interestCalcIndex != -1 &&
interestPostingPeriodIndex != -1 &&
interestCompPeriodIndex != -1
currencyIndex != -1 &&
interestCalcIndex != -1 &&
interestPostingPeriodIndex != -1 &&
interestCompPeriodIndex != -1
}

sealed interface SavingsAccountEvent {
Expand All @@ -668,7 +667,7 @@ sealed interface SavingsAccountAction {
data object NextStep : SavingsAccountAction
data object PreviousStep : SavingsAccountAction
data object Finish : SavingsAccountAction
data object SubmitSavingsApplication: SavingsAccountAction
data object SubmitSavingsApplication : SavingsAccountAction
data class OnStepChange(val newIndex: Int) : SavingsAccountAction
data class OnSubmissionDateChange(val date: String) : SavingsAccountAction
data class OnSubmissionDatePick(val state: Boolean) : SavingsAccountAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.mifos.core.designsystem.theme.DesignToken
import com.mifos.core.designsystem.theme.MifosTypography
import com.mifos.core.model.objects.payloads.ChargesPayload
import com.mifos.core.model.objects.payloads.SavingsPayload
import com.mifos.core.ui.components.MifosGeneralCard
import com.mifos.core.ui.components.MifosRowWithTextAndButton
import com.mifos.core.ui.components.MifosTwoButtonRow
import com.mifos.feature.savings.savingsAccountv2.SavingsAccountAction
import com.mifos.feature.savings.savingsAccountv2.SavingsAccountState
import org.jetbrains.compose.resources.stringResource
import kotlin.Int

@Composable
fun PreviewPage(
Expand Down Expand Up @@ -101,10 +98,15 @@ fun PreviewPage(
?: ""
),
stringResource(Res.string.step_terms_apply_withdrawal_fee) + " : "
to (state.isCheckedApplyWithdrawalFee.let {
if (it) stringResource(Res.string.feature_savings_yes)
else stringResource(Res.string.feature_savings_no)
}),
to (
state.isCheckedApplyWithdrawalFee.let {
if (it) {
stringResource(Res.string.feature_savings_yes)
} else {
stringResource(Res.string.feature_savings_no)
}
}
),
stringResource(Res.string.step_terms_is_allowed_overdraft) + " : " to (state.isCheckedOverdraftAllowed.let { if (it) stringResource(Res.string.feature_savings_yes) else stringResource(Res.string.feature_savings_no) }),
stringResource(Res.string.step_terms_lock_in_period) + " : " to
if (state.freqTypeIndex == -1) {
Expand Down