Skip to content

Commit 799e41c

Browse files
authored
Implement New Share Account Charges Step (#2545)
1 parent 36fbf47 commit 799e41c

File tree

13 files changed

+577
-146
lines changed

13 files changed

+577
-146
lines changed

core/common/src/commonMain/kotlin/com/mifos/core/common/utils/ServerConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ data class ServerConfig(
3131
endPoint = "tt.mifos.community",
3232
apiPath = "/fineract-provider/api/v1/",
3333
port = "80",
34-
tenant = "default",
34+
tenant = "dev",
3535
)
3636

3737
val LOCALHOST = ServerConfig(

core/network/src/commonMain/kotlin/com/mifos/core/network/model/share/ShareTemplate.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
*/
1010
package com.mifos.core.network.model.share
1111

12+
import com.mifos.core.model.objects.template.client.ChargeAppliesTo
13+
import com.mifos.core.model.objects.template.client.ChargeCalculationType
14+
import com.mifos.core.model.objects.template.client.ChargePaymentMode
15+
import com.mifos.core.model.objects.template.client.ChargeTimeType
1216
import com.mifos.core.model.objects.template.client.Currency
1317
import kotlinx.serialization.SerialName
1418
import kotlinx.serialization.Serializable
@@ -25,6 +29,8 @@ data class ShareTemplate(
2529

2630
val productOptions: List<ProductOption> = emptyList(),
2731

32+
val chargeOptions: List<ChargeOptions> = emptyList(),
33+
2834
@SerialName("clientSavingsAccounts")
2935
val savingsAccountOptions: List<SavingsAccountOption>? = emptyList(),
3036

@@ -52,3 +58,17 @@ data class FrequencyTypeOption(
5258

5359
val value: String,
5460
)
61+
62+
@Serializable
63+
data class ChargeOptions(
64+
val id: Int? = null,
65+
val name: String? = null,
66+
val active: Boolean? = null,
67+
val penalty: Boolean? = null,
68+
val currency: Currency? = null,
69+
val amount: Double? = null,
70+
val chargeTimeType: ChargeTimeType? = null,
71+
val chargeAppliesTo: ChargeAppliesTo? = null,
72+
val chargeCalculationType: ChargeCalculationType? = null,
73+
val chargePaymentMode: ChargePaymentMode? = null,
74+
)

core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/AddChargeDialog.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ fun AddChargeBottomSheet(
5050
title: String,
5151
confirmText: String,
5252
dismissText: String,
53-
showDatePicker: Boolean,
53+
showDatePicker: Boolean = false,
5454
selectedChargeName: String,
55-
selectedDate: String,
55+
selectedDate: String? = null,
5656
chargeAmount: String,
5757
chargeType: String,
5858
chargeCollectedOn: String,
@@ -109,13 +109,15 @@ fun AddChargeBottomSheet(
109109
label = stringResource(Res.string.name),
110110
)
111111

112-
MifosDatePickerTextField(
113-
value = selectedDate,
114-
label = stringResource(Res.string.date),
115-
openDatePicker = { onDatePick(true) },
116-
)
112+
if (selectedDate != null) {
113+
MifosDatePickerTextField(
114+
value = selectedDate,
115+
label = stringResource(Res.string.date),
116+
openDatePicker = { onDatePick(true) },
117+
)
117118

118-
Spacer(Modifier.height(DesignToken.padding.large))
119+
Spacer(Modifier.height(DesignToken.padding.large))
120+
}
119121

120122
MifosOutlinedTextField(
121123
value = chargeAmount,
@@ -161,7 +163,7 @@ fun AddChargeBottomSheet(
161163
secondBtnText = confirmText,
162164
onFirstBtnClick = onDismiss,
163165
onSecondBtnClick = onConfirm,
164-
isSecondButtonEnabled = chargeAmount.isNotEmpty() && chargeType.isNotEmpty() && amountError.isNullOrEmpty(),
166+
isSecondButtonEnabled = chargeAmount.isNotEmpty() && amountError.isNullOrEmpty(),
165167
)
166168
}
167169
},

core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosActionsListingCardComponent.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ fun MifosActionsShareListingComponent(
602602
fun MifosActionsChargeListingComponent(
603603
chargeTitle: String,
604604
type: String,
605-
date: String,
605+
date: String? = null,
606606
collectedOn: String,
607607
amount: String,
608608
menuList: List<Actions> = listOf<Actions>(
@@ -645,11 +645,15 @@ fun MifosActionsChargeListingComponent(
645645
text = type,
646646
),
647647
)
648-
PrintTextUtil(
649-
TextUtil(
650-
text = date,
651-
),
652-
)
648+
if (
649+
date != null
650+
) {
651+
PrintTextUtil(
652+
TextUtil(
653+
text = date,
654+
),
655+
)
656+
}
653657
}
654658
Row(
655659
verticalAlignment = Alignment.CenterVertically,

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,19 @@
569569
<string name="feature_share_account_terms_type">Type</string>
570570
<string name="feature_share_account_terms_lock_in_period">Lock-in Period</string>
571571

572+
<string name="feature_share_account_charge">Charge</string>
573+
<string name="feature_share_account_charge_add_new">Add New</string>
574+
<string name="feature_share_account_charge_view">View</string>
575+
<string name="feature_share_account_charge_active_charge">Active Charge</string>
576+
<string name="feature_share_account_charge_add_new_charge">Add New Charge</string>
577+
<string name="feature_share_account_charge_date">Date</string>
578+
<string name="feature_share_account_charge_type">Type</string>
579+
<string name="feature_share_account_charge_collected_on">Collected On</string>
580+
<string name="feature_share_account_charge_view_charges">View Charges</string>
581+
<string name="feature_share_account_charge_edit_charge">Edit Charge</string>
582+
<string name="feature_share_account_charge_add">Add</string>
583+
<string name="feature_share_account_charge_btn_add_new">Add</string>
584+
572585

573586
<!-- Handle Error-->
574587
<string name="feature_share_account_field_empty">This field cannot be empty</string>

0 commit comments

Comments
 (0)