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 @@ -76,6 +76,7 @@ import com.mifos.room.entities.templates.clients.SavingProductOptionsEntity
import com.mifos.room.entities.templates.clients.StaffOptionsEntity
import com.mifos.room.entities.templates.loans.LoanRepaymentTemplateEntity
import com.mifos.room.entities.templates.savings.SavingsAccountTransactionTemplateEntity
import com.mifos.room.typeconverters.ClientTypeConverters
import com.mifos.room.typeconverters.CustomTypeConverters

@Database(
Expand Down Expand Up @@ -151,6 +152,7 @@ import com.mifos.room.typeconverters.CustomTypeConverters
)
@TypeConverters(
CustomTypeConverters::class,
ClientTypeConverters::class,
)
actual abstract class MifosDatabase : RoomDatabase() {
actual abstract val centerDao: CenterDao
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package com.mifos.room.entities.accounts.loans

import com.mifos.core.model.objects.account.loan.Currency
import com.mifos.core.model.utils.Parcelable
import com.mifos.core.model.utils.Parcelize
import com.mifos.room.utils.ColumnInfo
Expand Down Expand Up @@ -67,6 +68,8 @@ data class LoanAccountEntity(

val productName: String? = null,

val currency: Currency? = null,

@ColumnInfo(index = true, name = INHERIT_FIELD_NAME, typeAffinity = UNDEFINED, collate = UNSPECIFIED, defaultValue = VALUE_UNSPECIFIED)
val status: LoanStatusEntity? = null,

Expand All @@ -76,4 +79,10 @@ data class LoanAccountEntity(
val loanCycle: Int? = null,

val inArrears: Boolean? = null,

val originalLoan: Double? = null,

val loanBalance: Double? = null,

val amountPaid: Double? = null,
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,30 @@
*/
package com.mifos.room.typeconverters

class ClientTypeConverters
import com.mifos.core.model.objects.account.loan.Currency
import com.mifos.room.entities.accounts.loans.LoanAccountEntity
import com.mifos.room.utils.TypeConverter
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json

class ClientTypeConverters {
@TypeConverter
fun fromCurrency(type: Currency?): String? {
return type?.let { Json.encodeToString(it) }
}

@TypeConverter
fun toCurrency(json: String?): Currency? {
return json?.let { Json.decodeFromString(it) }
}

@TypeConverter
fun fromLoanAccountEntity(type: LoanAccountEntity?): String? {
return type?.let { Json.encodeToString(it) }
}

@TypeConverter
fun toLoanAccountEntity(json: String?): LoanAccountEntity? {
return json?.let { Json.decodeFromString(it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import androidx.compose.material.icons.outlined.HomeWork
import androidx.compose.material.icons.outlined.Mail
import androidx.compose.material.icons.outlined.MobileFriendly
import androidx.compose.material.icons.outlined.Numbers
import androidx.compose.material.icons.outlined.Payments
import androidx.compose.material.icons.outlined.PersonOutline
import androidx.compose.material.icons.outlined.Savings
import androidx.compose.material.icons.outlined.Visibility
Expand Down Expand Up @@ -221,4 +222,5 @@ object MifosIcons {
val ApproveAccount = Icons.Outlined.CheckCircle
val UploadAgain = Icons.Outlined.FileUpload
val DeleteDocument = Icons.Outlined.DeleteOutline
val MakeRepayment = Icons.Outlined.Payments
}
4 changes: 4 additions & 0 deletions core/ui/src/commonMain/composeResources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@
<string name="core_ui_transfer_external_id">Transfer External ID</string>
<string name="core_ui_settlement_date">Settlement Date</string>
<string name="core_ui_purchase_price_ratio">Purchase Price Ratio</string>

<string name="core_ui_click_here_to_view_filled_state">Click Here To View Filled State.</string>
<string name="core_ui_no_item_found">No Item Found</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,13 @@ fun MifosActionsLoanListingComponent(
menuList: List<Actions>,
onActionClicked: (Actions) -> Unit,
) {
var isActive by rememberSaveable { mutableStateOf(false) }

MifosActionsListingComponentOutline {
Column {
Column(
modifier = Modifier.padding(DesignToken.padding.large),
modifier = Modifier.padding(DesignToken.padding.large)
.onClick { isActive = !isActive },
) {
MifosListingRowItem(
key = stringResource(Res.string.core_ui_account_no),
Expand Down Expand Up @@ -330,40 +333,59 @@ fun MifosActionsLoanListingComponent(
value = type,
)
}
Surface(
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(
bottomStart = DesignToken.padding.medium,
bottomEnd = DesignToken.padding.medium,
),
) {
Column(
modifier = Modifier.padding(
vertical = DesignToken.padding.small,
if (isActive) {
Surface(
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(
bottomStart = DesignToken.padding.medium,
bottomEnd = DesignToken.padding.medium,
),
) {
menuList.map { menuItem ->
Row(
modifier = Modifier.fillMaxWidth()
.height(DesignToken.sizes.avatarMedium)
.clickable {
onActionClicked(menuItem)
},
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Start,
) {
Icon(
modifier = Modifier.padding(horizontal = DesignToken.padding.large),
imageVector = menuItem.icon,
contentDescription = "",
)
Column(
modifier = Modifier.padding(
vertical = DesignToken.padding.small,
),
) {
menuList.map { menuItem ->
Row(
modifier = Modifier.fillMaxWidth()
.height(DesignToken.sizes.avatarMedium)
.clickable {
onActionClicked(menuItem)
},
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Start,
) {
Icon(
modifier = Modifier.padding(horizontal = DesignToken.padding.large),
imageVector = menuItem.icon,
contentDescription = "",
)
menuList.map { menuItem ->
Row(
modifier = Modifier.fillMaxWidth()
.height(DesignToken.sizes.avatarMedium)
.clickable {
onActionClicked(menuItem)
},
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Start,
) {
Icon(
modifier = Modifier.padding(horizontal = DesignToken.padding.large),
imageVector = menuItem.icon,
contentDescription = "",
)

Text(
modifier = Modifier.fillMaxWidth(),
text = menuItem.name,
color = MaterialTheme.colorScheme.onSurface,
fontSize = MaterialTheme.typography.bodyLarge.fontSize,
)
Text(
modifier = Modifier.fillMaxWidth(),
text = menuItem.name,
color = MaterialTheme.colorScheme.onSurface,
fontSize = MaterialTheme.typography.bodyLarge.fontSize,
)
}
}
}
}
}
}
Expand Down Expand Up @@ -560,6 +582,7 @@ fun MifosActionsClientFeeListingComponent(
enum class Actions(val icon: ImageVector) {
ViewAccount(MifosIcons.ViewAccount),
ApproveAccount(MifosIcons.ApproveAccount),
MakeRepayment(MifosIcons.MakeRepayment),
ViewDocument(MifosIcons.ViewDocument),
UploadAgain(MifosIcons.UploadAgain),
DeleteDocument(MifosIcons.DeleteDocument),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
package com.mifos.core.ui.components

import androidclient.core.ui.generated.resources.Res
import androidclient.core.ui.generated.resources.core_ui_click_here_to_view_filled_state
import androidclient.core.ui.generated.resources.core_ui_no_item_found
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -19,17 +22,18 @@ import androidx.compose.ui.Modifier
import com.mifos.core.designsystem.theme.DesignToken
import com.mifos.core.designsystem.theme.MifosTheme
import com.mifos.core.designsystem.theme.MifosTypography
import org.jetbrains.compose.resources.stringResource
import org.jetbrains.compose.ui.tooling.preview.Preview

@Composable
fun MifosEmptyCard(
msg: String,
msg: String = stringResource(Res.string.core_ui_click_here_to_view_filled_state),
modifier: Modifier = Modifier,
) {
MifosListingComponentOutline {
Column(modifier.fillMaxWidth()) {
Text(
text = "No Item Found",
text = stringResource(Res.string.core_ui_no_item_found),
style = MifosTypography.titleSmallEmphasized,
)
Spacer(Modifier.height((DesignToken.padding.medium)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
See https://github.com/openMF/android-client/blob/master/LICENSE.md
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">

<path
android:fillColor="#FF191C20"
android:pathData="M5.83763 5.00065H14.171L9.99597 10.2507L5.83763 5.00065ZM3.54597 4.67565C5.2293 6.83398 8.33763 10.834 8.33763 10.834V15.834C8.33763 16.2923 8.71263 16.6673 9.17097 16.6673H10.8376C11.296 16.6673 11.671 16.2923 11.671 15.834V10.834C11.671 10.834 14.771 6.83398 16.4543 4.67565C16.8793 4.12565 16.4876 3.33398 15.796 3.33398H4.2043C3.51263 3.33398 3.12097 4.12565 3.54597 4.67565Z "
/>
</vector>
android:pathData="M5.83763 5.00065H14.171L9.99597 10.2507L5.83763 5.00065ZM3.54597 4.67565C5.2293 6.83398 8.33763 10.834 8.33763 10.834V15.834C8.33763 16.2923 8.71263 16.6673 9.17097 16.6673H10.8376C11.296 16.6673 11.671 16.2923 11.671 15.834V10.834C11.671 10.834 14.771 6.83398 16.4543 4.67565C16.8793 4.12565 16.4876 3.33398 15.796 3.33398H4.2043C3.51263 3.33398 3.12097 4.12565 3.54597 4.67565Z"/>
</vector>

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
See https://github.com/openMF/android-client/blob/master/LICENSE.md
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">

<path
android:fillColor="#FF191C20"
android:pathData="M13.3137 12.0598H12.6553L12.422 11.8348C13.422 10.6681 13.9387 9.07643 13.6553 7.38477C13.2637 5.0681 11.3303 3.2181 8.99701 2.93477C5.47201 2.50143 2.50534 5.4681 2.93867 8.9931C3.22201 11.3264 5.07201 13.2598 7.38867 13.6514C9.08034 13.9348 10.672 13.4181 11.8387 12.4181L12.0637 12.6514V13.3098L15.6053 16.8514C15.947 17.1931 16.5053 17.1931 16.847 16.8514C17.1887 16.5098 17.1887 15.9514 16.847 15.6098L13.3137 12.0598ZM8.31367 12.0598C6.23867 12.0598 4.56367 10.3848 4.56367 8.30977C4.56367 6.23477 6.23867 4.55977 8.31367 4.55977C10.3887 4.55977 12.0637 6.23477 12.0637 8.30977C12.0637 10.3848 10.3887 12.0598 8.31367 12.0598Z "
/>
</vector>
android:pathData="M13.3137 12.0598H12.6553L12.422 11.8348C13.422 10.6681 13.9387 9.07643 13.6553 7.38477C13.2637 5.0681 11.3303 3.2181 8.99701 2.93477C5.47201 2.50143 2.50534 5.4681 2.93867 8.9931C3.22201 11.3264 5.07201 13.2598 7.38867 13.6514C9.08034 13.9348 10.672 13.4181 11.8387 12.4181L12.0637 12.6514V13.3098L15.6053 16.8514C15.947 17.1931 16.5053 17.1931 16.847 16.8514C17.1887 16.5098 17.1887 15.9514 16.847 15.6098L13.3137 12.0598ZM8.31367 12.0598C6.23867 12.0598 4.56367 10.3848 4.56367 8.30977C4.56367 6.23477 6.23867 4.55977 8.31367 4.55977C10.3887 4.55977 12.0637 6.23477 12.0637 8.30977C12.0637 10.3848 10.3887 12.0598 8.31367 12.0598Z"/>
</vector>

Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@
<string name="client_collateral_success_message">Collateral created successfully. Click Continue to navigate to Client detail profile.</string>
<string name="client_collateral_failure_title">Collateral Creation Failed</string>

<string name="client_profile_select_account_type">Select Account Type</string>
<string name="client_profile_savings_account">Savings Account</string>
<string name="client_profile_loan_account">Loan Account</string>

<string name="client_identifiers_click_on_plus_button_to_add_an_item">Click on “+” Button to add an item.</string>
<string name="client_identifiers_not_available">Not available</string>
<string name="client_identifiers_identities">Identities</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ data class ClientProfileGeneralRoute(
fun NavGraphBuilder.clientProfileGeneralDestination(
onNavigateBack: () -> Unit = {},
upcomingCharges: (Int) -> Unit = {},
loanAccounts: (Int) -> Unit = {},
savingAccounts: (Int) -> Unit = {},
loanAccounts: (Int) -> Unit,
savingAccounts: (Int) -> Unit,
Comment on lines 22 to +26
Copy link
Contributor

Choose a reason for hiding this comment

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

Not an issue as it is gonna change anyways, but if you are making those parameters mandatory then place then above optional parameters.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is not the best practice + it is confusing when used in Navigation function, i almost thought we can't navigate to loanAccounts and savings from here.

Copy link
Contributor

Choose a reason for hiding this comment

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

okay. and i deleted the below comment, I didn't way they were lamba functions.

fixedDepositAccounts: (Int) -> Unit = {},
recurringDepositAccounts: (Int) -> Unit = {},
sharesAccounts: (Int) -> Unit = {},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.clientLoanAccounts

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

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

fun NavGraphBuilder.clientLoanAccountsDestination(
navigateBack: () -> Unit,
navigateToViewAccount: (Int) -> Unit,
navigateToMakeRepayment: (Int) -> Unit,
) {
composable<ClientLoanAccountsRoute> {
ClientLoanAccountsScreenRoute(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be changed as follows as it is a composable func that refers to a screen not a route

Suggested change
ClientLoanAccountsScreenRoute(
ClientLoanAccountsScreen(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was added to distinguish between the two ClientLoanAccountsScreen

navigateBack = navigateBack,
viewAccount = navigateToViewAccount,
makeRepayment = navigateToMakeRepayment,
)
}
}

fun NavController.navigateToClientLoanAccountsRoute(
clientId: Int,
) {
this.navigate(ClientLoanAccountsRoute(clientId = clientId))
}
Loading