Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ data class RecurringDepositAccountTemplate(
val adjustAdvanceTowardsFuturePayments: Boolean? = null,
val allowWithdrawal: Boolean? = null,
@IgnoredOnParcel val chargeOptions: List<ChargeOption>? = null,
// val charges: List<Any?>? = null,
val clientId: Int? = null,
val clientName: String? = null,
@IgnoredOnParcel val currency: Currency? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlinx.serialization.Serializable

@Serializable
data class RecurringDepositAccountPayload(
// val charges: List<Any>? = null,
val charges: List<ChargeItem>? = null,
val adjustAdvanceTowardsFuturePayments: Boolean? = null,
val allowWithdrawal: Boolean? = null,
val clientId: Int? = null,
Expand All @@ -39,3 +39,9 @@ data class RecurringDepositAccountPayload(
val recurringFrequencyType: Int? = null,
val submittedOnDate: String? = null,
)

@Serializable
data class ChargeItem(
val chargeId: Int? = null,
val amount: Double? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@
<string name="feature_share_account_charge_edit_charge">Edit Charge</string>
<string name="feature_share_account_charge_add">Add</string>
<string name="feature_share_account_charge_btn_add_new">Add</string>
<string name="feature_share_account_charge_click_on_add_new">Click on Add New to Add Charge</string>


<!-- Handle Error-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidclient.feature.client.generated.resources.feature_share_account_ba
import androidclient.feature.client.generated.resources.feature_share_account_charge_add
import androidclient.feature.client.generated.resources.feature_share_account_charge_add_new_charge
import androidclient.feature.client.generated.resources.feature_share_account_charge_btn_add_new
import androidclient.feature.client.generated.resources.feature_share_account_charge_click_on_add_new
import androidclient.feature.client.generated.resources.feature_share_account_charge_edit_charge
import androidclient.feature.client.generated.resources.feature_share_account_charge_view_charges
import androidclient.feature.client.generated.resources.feature_share_account_charges
Expand Down Expand Up @@ -48,6 +49,7 @@ import com.mifos.core.ui.components.Actions
import com.mifos.core.ui.components.AddChargeBottomSheet
import com.mifos.core.ui.components.MifosActionsChargeListingComponent
import com.mifos.core.ui.components.MifosBreadcrumbNavBar
import com.mifos.core.ui.components.MifosEmptyCard
import com.mifos.core.ui.components.MifosProgressIndicator
import com.mifos.core.ui.components.MifosProgressIndicatorOverlay
import com.mifos.core.ui.components.MifosStepper
Expand Down Expand Up @@ -118,6 +120,7 @@ fun CreateShareAccountDialog(
onAction = onAction,
)
}

is CreateShareAccountState.DialogState.SuccessResponseStatus -> {
LaunchedEffect(state.launchEffectKey) {
snackbarHostState.showSnackbar(
Expand All @@ -132,6 +135,7 @@ fun CreateShareAccountDialog(
}
}
}

null -> Unit
}
}
Expand Down Expand Up @@ -287,35 +291,42 @@ private fun ShowChargesDialog(
text = stringResource(Res.string.feature_share_account_charge_view_charges),
style = MifosTypography.titleMediumEmphasized,
)
state.addedCharges.forEachIndexed { index, charge ->
val chargesValue = state.chargeOptions
.firstOrNull { it.id == charge.chargeId }
MifosActionsChargeListingComponent(
chargeTitle = chargesValue?.name ?: "",
type = chargesValue?.chargeCalculationType?.value ?: "",
collectedOn = chargesValue?.chargeTimeType?.value ?: "",
amount = charge.amount.toString(),
onActionClicked = { action ->
when (action) {
is Actions.Delete -> {
onAction(
CreateShareAccountAction.DeleteChargeFromSelectedCharges(
index,
),
)
}
if (state.addedCharges.isNotEmpty()) {
state.addedCharges.forEachIndexed { index, charge ->
val chargesValue = state.chargeOptions
.firstOrNull { it.id == charge.chargeId }
MifosActionsChargeListingComponent(
chargeTitle = chargesValue?.name ?: "",
type = chargesValue?.chargeCalculationType?.value ?: "",
collectedOn = chargesValue?.chargeTimeType?.value ?: "",
amount = charge.amount.toString(),
onActionClicked = { action ->
when (action) {
is Actions.Delete -> {
expandedIndex = -1
onAction(
CreateShareAccountAction.DeleteChargeFromSelectedCharges(
index,
),
)
}

is Actions.Edit -> {
onAction(CreateShareAccountAction.EditChargeDialog(index))
}
is Actions.Edit -> {
onAction(CreateShareAccountAction.EditChargeDialog(index))
}

else -> {}
}
},
isExpanded = expandedIndex == index,
onExpandToggle = {
expandedIndex = if (expandedIndex == index) -1 else index
},
else -> {}
}
},
isExpanded = expandedIndex == index,
onExpandToggle = {
expandedIndex = if (expandedIndex == index) -1 else index
},
)
}
} else {
MifosEmptyCard(
msg = stringResource(Res.string.feature_share_account_charge_click_on_add_new),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fun ChargesPage(
modifier: Modifier = Modifier,
onAction: (CreateShareAccountAction) -> Unit,
) {
Column(modifier = Modifier.fillMaxSize()) {
Column(modifier = Modifier.fillMaxSize().padding(bottom = DesignToken.padding.large)) {
Column(
modifier = modifier.weight(1f).verticalScroll(rememberScrollState()),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fun TermsPage(
onValueChange = {
onAction(CreateShareAccountAction.OnTotalSharesChange(it))
},
label = stringResource(Res.string.feature_share_account_terms_total_shares),
label = stringResource(Res.string.feature_share_account_terms_total_shares) + "*",
config = MifosTextFieldConfig(
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Number,
Expand All @@ -162,7 +162,7 @@ fun TermsPage(
options = state.savingsAccountOptions.map {
it.accountNo + (it.savingsProductName?.let { name -> " - $name" }.orEmpty())
},
label = stringResource(Res.string.feature_share_account_terms_default_savings_account),
label = stringResource(Res.string.feature_share_account_terms_default_savings_account) + "*",
errorMessage = state.savingsAccountError?.let { stringResource(it) },
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@
<string name="amount">Amount</string>
<string name="type">Type</string>
<string name="collected_on">Collected On</string>
<string name="click_on_add_new">Click on Add New to Add Charge</string>


<!-- Repayment Schedule -->
<string name="repayment_schedule">Repayment Schedule</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidclient.feature.loan.generated.resources.add_new
import androidclient.feature.loan.generated.resources.add_new_charge
import androidclient.feature.loan.generated.resources.add_new_collateral
import androidclient.feature.loan.generated.resources.back
import androidclient.feature.loan.generated.resources.click_on_add_new
import androidclient.feature.loan.generated.resources.collateral
import androidclient.feature.loan.generated.resources.edit_charge
import androidclient.feature.loan.generated.resources.feature_loan_cancel
Expand Down Expand Up @@ -63,6 +64,7 @@ import com.mifos.core.ui.components.Actions
import com.mifos.core.ui.components.AddChargeBottomSheet
import com.mifos.core.ui.components.MifosActionsChargeListingComponent
import com.mifos.core.ui.components.MifosBreadcrumbNavBar
import com.mifos.core.ui.components.MifosEmptyCard
import com.mifos.core.ui.components.MifosListingComponentOutline
import com.mifos.core.ui.components.MifosListingRowItem
import com.mifos.core.ui.components.MifosProgressIndicator
Expand Down Expand Up @@ -393,7 +395,7 @@ private fun AddNewChargeDialog(
} else {
stringResource(Res.string.add)
},
dismissText = stringResource(Res.string.feature_loan_cancel),
dismissText = stringResource(Res.string.back),
showDatePicker = state.showChargesDatePick,
selectedChargeName = if (state.chooseChargeIndex == -1) {
""
Expand Down Expand Up @@ -481,34 +483,41 @@ private fun ShowChargesDialog(
)
}
} else {
state.addedCharges.forEachIndexed { index, it ->
MifosActionsChargeListingComponent(
chargeTitle = it.name.toString(),
type = it.type.toString(),
date = it.date,
collectedOn = it.collectedOn,
amount = it.amount.toString(),
onActionClicked = { action ->
when (action) {
is Actions.Delete -> {
onAction(
NewLoanAccountAction.DeleteChargeFromSelectedCharges(
index,
),
)
}
if (state.addedCharges.isNotEmpty()) {
state.addedCharges.forEachIndexed { index, it ->
MifosActionsChargeListingComponent(
chargeTitle = it.name.toString(),
type = it.type.toString(),
date = it.date,
collectedOn = it.collectedOn,
amount = it.amount.toString(),
onActionClicked = { action ->
when (action) {
is Actions.Delete -> {
expandedIndex = -1
onAction(
NewLoanAccountAction.DeleteChargeFromSelectedCharges(
index,
),
)
}

is Actions.Edit -> {
onAction(NewLoanAccountAction.EditChargeDialog(index))
}
is Actions.Edit -> {
onAction(NewLoanAccountAction.EditChargeDialog(index))
}

else -> {}
}
},
isExpanded = expandedIndex == index,
onExpandToggle = {
expandedIndex = if (expandedIndex == index) -1 else index
},
else -> {}
}
},
isExpanded = expandedIndex == index,
onExpandToggle = {
expandedIndex = if (expandedIndex == index) -1 else index
},
)
}
} else {
MifosEmptyCard(
msg = stringResource(Res.string.click_on_add_new),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,13 @@
<string name="feature_recurring_deposit_yes">Yes</string>
<string name="feature_recurring_deposit_no">No</string>
<string name="feature_recurring_deposit_empty_date">Empty Date</string>
<string name="feature_recurring_deposit_add_new_charge">Add New Charge</string>
<string name="feature_recurring_deposit_active_charge">Active Charge</string>
<string name="feature_recurring_deposit_btn_add_new">Add New</string>
<string name="feature_recurring_deposit_amount">Amount</string>
<string name="feature_recurring_deposit_collected_on">Collected On</string>
<string name="feature_recurring_deposit_btn_add">Add</string>
<string name="feature_recurring_deposit_edit_charge">Edit Charge</string>
<string name="feature_recurring_deposit_view_charge">View Charges</string>
<string name="feature_recurring_deposit_click_on_add_new">Click on Add New to Add Charge</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ import com.mifos.core.ui.components.MifosStepper
import com.mifos.core.ui.components.Step
import com.mifos.core.ui.util.EventsEffect
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.RecurringAccountAction.NavigateToStep
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.AddNewChargeDialog
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.ChargesPage
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.DetailsPage
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.InterestPage
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.RateChart
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.SettingPage
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.ShowChargesDialog
import com.mifos.feature.recurringDeposit.newRecurringDepositAccount.pages.TermsPage
import org.jetbrains.compose.resources.stringResource
import org.koin.compose.viewmodel.koinViewModel
Expand Down Expand Up @@ -83,6 +85,21 @@ fun RecurringAccountDialog(
onAction = onAction,
)
}
is RecurringAccountState.DialogState.AddNewCharge -> {
AddNewChargeDialog(
state = state,
isEdit = state.dialogState.edit,
onAction = onAction,
index = state.dialogState.index,
)
}

RecurringAccountState.DialogState.ShowCharges -> {
ShowChargesDialog(
state = state,
onAction = onAction,
)
}
null -> Unit
}
}
Expand Down Expand Up @@ -121,7 +138,8 @@ private fun RecurringAccountScaffold(
},
Step(name = stringResource(Res.string.feature_recurring_deposit_step_charges)) {
ChargesPage(
onNext = { onAction(RecurringAccountAction.OnNextPress) },
state = state,
onAction = onAction,
)
},
)
Expand Down
Loading