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 @@ -19,6 +19,7 @@ data class ClientAccounts(
var loanAccounts: List<LoanAccountEntity> = emptyList(),

var savingsAccounts: List<SavingsAccountEntity> = emptyList(),

) : Parcelable {
private fun getSavingsAccounts(wantRecurring: Boolean): List<SavingsAccountEntity> {
val result: MutableList<SavingsAccountEntity> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ data class SavingsAccountEntity(

val productId: Int? = null,

val shortProductName: String? = null,

val productName: String? = null,

@ColumnInfo(index = true, name = INHERIT_FIELD_NAME, typeAffinity = UNDEFINED, collate = UNSPECIFIED, defaultValue = VALUE_UNSPECIFIED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import kotlinx.coroutines.flow.flow
class CreateChargesUseCase(
private val repository: ChargeDialogRepository,
) {

operator fun invoke(
clientId: Int,
payload: ChargesPayload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ object GetClientsClientIdAccountMapper :
SavingsAccountEntity(
id = it.id?.toInt(),
accountNo = it.accountNo,
accountBalance = it.accountBalance,
productId = it.productId?.toInt(),
shortProductName = it.shortProductName,
productName = it.productName,
depositType = it.depositType?.let { deposit ->
SavingAccountDepositTypeEntity(
Expand Down Expand Up @@ -115,6 +117,7 @@ object GetClientsClientIdAccountMapper :
GetClientsSavingsAccounts(
id = it.id?.toLong(),
accountNo = it.accountNo,
accountBalance = it.accountBalance,
productId = it.productId?.toLong(),
productName = it.productName,
depositType = GetClientsSavingsAccountsDepositType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ data class GetClientsSavingsAccounts(

val accountNo: String? = null,

val accountBalance: Double? = null,

val currency: GetClientsSavingsAccountsCurrency? = null,

val depositType: GetClientsSavingsAccountsDepositType? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidclient.core.ui.generated.resources.core_ui_original_loan
import androidclient.core.ui.generated.resources.core_ui_outstanding
import androidclient.core.ui.generated.resources.core_ui_paid
import androidclient.core.ui.generated.resources.core_ui_quantity
import androidclient.core.ui.generated.resources.core_ui_savings_product
import androidclient.core.ui.generated.resources.core_ui_status
import androidclient.core.ui.generated.resources.core_ui_total_collateral_value
import androidclient.core.ui.generated.resources.core_ui_total_value
Expand Down Expand Up @@ -377,6 +376,7 @@ fun MifosActionsLoanListingComponent(
fun MifosActionsSavingsListingComponent(
accountNo: String,
savingsProduct: String,
savingsProductName: String,
lastActive: String,
balance: String,
menuList: List<Actions>,
Expand All @@ -391,16 +391,15 @@ fun MifosActionsSavingsListingComponent(
Column(
modifier = Modifier.padding(DesignToken.padding.large),
) {
MifosListingRowItem(
key = stringResource(Res.string.core_ui_account_no),
value = accountNo,
MifosListingRowItemHeader(
text = accountNo,
keyStyle = MifosTypography.titleSmallEmphasized,
valueStyle = MifosTypography.titleSmall,
)

Spacer(Modifier.height(DesignToken.padding.large))
MifosListingRowItem(
key = stringResource(Res.string.core_ui_savings_product),
value = savingsProduct,
key = savingsProduct,
value = savingsProductName,
)
Spacer(Modifier.height(DesignToken.padding.medium))
Column(
Expand All @@ -425,6 +424,7 @@ fun MifosActionsSavingsListingComponent(
bottomStart = DesignToken.padding.medium,
bottomEnd = DesignToken.padding.medium,
),
color = MaterialTheme.colorScheme.surfaceContainer,
) {
Column(
modifier = Modifier.padding(
Expand Down Expand Up @@ -627,7 +627,8 @@ fun PreviewMifosActionsSavingsListingComponent() {
MaterialTheme {
MifosActionsSavingsListingComponent(
accountNo = "SV9876",
savingsProduct = "Regular Savings",
savingsProduct = "Savings Product",
savingsProductName = "Wallet",
lastActive = "2025-08-15",
balance = "$1200",
menuList = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.mifos.core.designsystem.icon.MifosIcons
import com.mifos.core.designsystem.theme.AppColors
Expand Down Expand Up @@ -118,10 +119,22 @@ fun MifosListingRowItem(
MifosListingRowItem(
keyContent = {
if (key.isNotBlank()) {
Text(text = "$key:", style = keyStyle)
Text(
text = "$key:",
style = keyStyle,
maxLines = 1,
overflow = TextOverflow.Clip,
)
}
},
valueContent = { Text(text = value, style = valueStyle.copy(color = valueColor)) },
valueContent = {
Text(
text = value,
style = valueStyle.copy(color = valueColor),
overflow = TextOverflow.Clip,
maxLines = 1,
)
},
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@
<string name="client_profile_notes_title">Notes</string>
<string name="client_profile_notes_subtitle">Check or update note accounts</string>

<string name="client_empty_card_message">Click Here To View Filled State.</string>

<!-- Client Products -->
<string name="client_product_saving_account">Savings Products</string>
<string name="client_product_fixed_deposit_account">Fixed Deposit Products</string>
<string name="client_product_recurring_deposit_account">Recurring Deposit Products</string>
<string name="client_product_shares_account">Shares Products</string>

<!-- Client_Profile-General-Headers -->
<string name="client_profile_general_header_performance_history">Performance History</string>
Expand Down Expand Up @@ -252,6 +259,8 @@
<string name="client_profile_general_action_title_collateral_data">Collateral Data</string>
<string name="client_profile_general_action_subtitle_collateral_data">Check or update the account notes</string>

<!-- Client_Profile-Recurring Deposit Account Title -->
<string name="client_profile_recurring_deposit_account_title">Recurring Deposit Accounts</string>

<!-- Personal Info -->
<string name="gender">Gender</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidclient.feature.client.generated.resources.client_performance_histo
import androidclient.feature.client.generated.resources.client_profile_general_header_actions
import androidclient.feature.client.generated.resources.client_profile_general_header_linked_accounts
import androidclient.feature.client.generated.resources.client_profile_general_header_performance_history
import androidclient.feature.client.generated.resources.client_savings_not_avilable
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -239,28 +240,38 @@ fun PerformanceHistoryCard(state: ClientProfileGeneralState) {
val performanceHistory = state.performanceHistory
PerformanceHistoryRows(
stringResource(Res.string.client_performance_history_loan_cycle_count_label),
"${performanceHistory.loanCyclesCount}",
performanceHistory.loanCyclesCount?.toString()
?: stringResource(Res.string.client_savings_not_avilable),

)

PerformanceHistoryRows(
stringResource(Res.string.client_performance_history_active_loans_count_label),
"${performanceHistory.activeLoans}",
performanceHistory.activeLoans?.toString()
?: stringResource(Res.string.client_savings_not_avilable),
)

PerformanceHistoryRows(
stringResource(Res.string.client_performance_history_last_loan_amount_label),
"${state.currency} ${performanceHistory.lastLoanAmount}",

performanceHistory.lastLoanAmount?.let {
state.currency + " " + it.toString()
}
?: stringResource(Res.string.client_savings_not_avilable),
)

PerformanceHistoryRows(
stringResource(Res.string.client_performance_history_active_savings_label),
"${performanceHistory.activeSavingsCount}",
performanceHistory.activeSavingsCount?.toString()
?: stringResource(Res.string.client_savings_not_avilable),
)

PerformanceHistoryRows(
stringResource(Res.string.client_performance_history_total_savings_label),
"${state.currency} ${performanceHistory.lastLoanAmount}",
performanceHistory.totalSaving?.let {
state.currency + " " + it.toString()
}
?: stringResource(Res.string.client_savings_not_avilable),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.mifos.core.data.util.NetworkMonitor
import com.mifos.core.domain.useCases.GetClientDetailsUseCase
import com.mifos.core.ui.util.BaseViewModel
import com.mifos.feature.client.clientGeneral.ClientProfileGeneralEvent.OnActionClick
import com.mifos.room.entities.accounts.savings.SavingAccountDepositTypeEntity
import com.mifos.room.entities.client.ClientEntity
import com.mifos.room.entities.zipmodels.ClientAndClientAccounts
import kotlinx.coroutines.flow.update
Expand Down Expand Up @@ -58,11 +59,16 @@ internal class ClientProfileGeneralViewmodel(
val activeSavingsCount = savingAccounts?.count { it.status?.active == true } ?: 0

val totalSaving =
savingAccounts?.filter { it.status?.active == true }?.sumOf { it.accountBalance ?: 0.0 }
?: 0.0
savingAccounts?.filter {
it.status?.active == true &&
it.depositType?.serverType != SavingAccountDepositTypeEntity.ServerTypes.RECURRING &&
it.status?.closed == false
}?.sumOf {
it.accountBalance ?: 0.0
}

// TODO: No function yet created for calculating this value.
val lastLoanAmount = 0.0
val lastLoanAmount = null

return ClientProfileGeneralState.PerformanceHistory(
loanCyclesCount = loanCyclesCount,
Expand Down Expand Up @@ -148,11 +154,11 @@ data class ClientProfileGeneralState(
}

data class PerformanceHistory(
var loanCyclesCount: Int = 0,
var activeLoans: Int = 0,
var lastLoanAmount: Double = 0.0,
var activeSavingsCount: Int = 0,
var totalSaving: Double = 0.0,
var loanCyclesCount: Int? = null,
var activeLoans: Int? = null,
var lastLoanAmount: Double? = null,
var activeSavingsCount: Int? = null,
var totalSaving: Double? = null,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.mifos.feature.client.clientTransfer.ClientTransferViewModel
import com.mifos.feature.client.clientUpdateDefaultAccount.UpdateDefaultAccountViewModel
import com.mifos.feature.client.clientsList.ClientListViewModel
import com.mifos.feature.client.createNewClient.CreateNewClientViewModel
import com.mifos.feature.client.recurringDepositAccount.RecurringDepositAccountViewModel
import com.mifos.feature.client.savingsAccounts.SavingsAccountsViewModel
import com.mifos.feature.client.syncClientDialog.SyncClientsDialogViewModel
import org.koin.core.module.dsl.viewModelOf
Expand All @@ -56,6 +57,7 @@ val ClientModule = module {
viewModelOf(::UpdateDefaultAccountViewModel)
viewModelOf(::ClientClosureViewModel)
viewModelOf(::SavingsAccountsViewModel)
viewModelOf(::RecurringDepositAccountViewModel)
viewModelOf(::ClientCollateralViewModel)
viewModelOf(::ClientIdentitiesListViewModel)
viewModelOf(::ClientApplyNewApplicationsViewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import com.mifos.feature.client.clientUpdateDefaultAccount.navigateToUpdateDefau
import com.mifos.feature.client.clientUpdateDefaultAccount.updateDefaultAccountDestination
import com.mifos.feature.client.clientsList.ClientListScreen
import com.mifos.feature.client.createNewClient.CreateNewClientScreen
import com.mifos.feature.client.recurringDepositAccount.clientRecurringDepositAccountDestination
import com.mifos.feature.client.recurringDepositAccount.navigateToRecurringDepositAccountRoute
import com.mifos.feature.client.savingsAccounts.navigateToClientSavingsAccountsRoute
import com.mifos.feature.client.savingsAccounts.savingsAccountsDestination
import com.mifos.room.entities.accounts.savings.SavingAccountDepositTypeEntity
Expand Down Expand Up @@ -139,6 +141,15 @@ fun NavGraphBuilder.clientNavGraph(
savingAccounts = { clientId ->
navController.navigateToClientSavingsAccountsRoute(clientId)
},
recurringDepositAccounts = { clientId ->
navController.navigateToRecurringDepositAccountRoute(clientId)
},
)

clientRecurringDepositAccountDestination(
navigateBack = navController::popBackStack,
{},
{},
)

clientProfileDetailsDestination(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.feature.client.recurringDepositAccount

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import kotlinx.serialization.Serializable

@Serializable
data class RecurringDepositAccountRoute(
val clientId: Int = -1,
)

fun NavGraphBuilder.clientRecurringDepositAccountDestination(
navigateBack: () -> Unit,
onApproveAccount: (String) -> Unit,
onViewAccount: (String) -> Unit,
) {
composable<RecurringDepositAccountRoute> {
RecurringDepositAccountScreen(
navigateBack = navigateBack,
onApproveAccount = {
onApproveAccount(it)
},
onViewAccount = {
onViewAccount(it)
},
)
}
}

fun NavController.navigateToRecurringDepositAccountRoute(
clientId: Int,
) {
this.navigate(RecurringDepositAccountRoute(clientId = clientId))
}
Loading