Skip to content

Commit 11b3b28

Browse files
committed
refactor(feature:client): add defaults to charge options fields
1 parent 0269e38 commit 11b3b28

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

  • core/model/src/commonMain/kotlin/com/mifos/core/model/objects/template/client
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientChargeDialog

core/model/src/commonMain/kotlin/com/mifos/core/model/objects/template/client/ChargeOptions.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ import kotlinx.serialization.Serializable
2020
@Serializable
2121
@Parcelize
2222
data class ChargeOptions(
23-
val id: Int,
24-
val name: String,
25-
val active: Boolean,
26-
val penalty: Boolean,
27-
val currency: Currency,
28-
val amount: Double,
29-
val chargeTimeType: ChargeTimeType,
30-
val chargeAppliesTo: ChargeAppliesTo,
31-
val chargeCalculationType: ChargeCalculationType,
32-
val chargePaymentMode: ChargePaymentMode,
23+
val id: Int? = null,
24+
val name: String? = null,
25+
val active: Boolean? = null,
26+
val penalty: Boolean? = null,
27+
val currency: Currency? = null,
28+
val amount: Double? = null,
29+
val chargeTimeType: ChargeTimeType? = null,
30+
val chargeAppliesTo: ChargeAppliesTo? = null,
31+
val chargeCalculationType: ChargeCalculationType? = null,
32+
val chargePaymentMode: ChargePaymentMode? = null,
3333
val incomeOrLiabilityAccount: IncomeOrLiabilityAccount? = null,
3434
) : Parcelable

feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientChargeDialog/ChargeDialogScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ private fun ChargeDialogContent(
253253
label = stringResource(Res.string.feature_client_charge_name),
254254
readOnly = true,
255255
onOptionSelected = { index, value ->
256-
chargeId = chargeTemplate.chargeOptions[index].id
256+
chargeId = chargeTemplate.chargeOptions[index].id ?: -1
257257
chargeName = value
258258
chargeNameError = false
259259
},
260-
options = chargeTemplate.chargeOptions.map { it.name },
260+
options = chargeTemplate.chargeOptions.map { it.name ?: "" },
261261
errorMessage = if (chargeNameError) stringResource(Res.string.feature_client_message_field_required) else null,
262262
)
263263

0 commit comments

Comments
 (0)