Skip to content

Commit c83b95f

Browse files
feat: Client Profile Details UI (#2463)
1 parent 9cbb943 commit c83b95f

35 files changed

Lines changed: 1263 additions & 7 deletions

File tree

core/database/src/commonMain/kotlin/com/mifos/room/entities/client/ClientEntity.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ data class ClientEntity(
7272

7373
val activationDate: List<Int?> = emptyList(),
7474

75-
val dobDate: List<Int?> = emptyList(),
75+
val dateOfBirth: List<Int?> = emptyList(),
7676

7777
val groups: List<GroupEntity>? = emptyList(),
7878

@@ -103,4 +103,8 @@ data class ClientEntity(
103103
val imagePresent: Boolean = false,
104104

105105
val externalId: String? = null,
106+
107+
val emailAddress: String? = null,
108+
109+
val legalForm: ClientStatusEntity? = null,
106110
) : Parcelable

core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosButton.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ import androidx.compose.material3.OutlinedButton
2929
import androidx.compose.material3.Text
3030
import androidx.compose.material3.TextButton
3131
import androidx.compose.runtime.Composable
32+
import androidx.compose.ui.Alignment
3233
import androidx.compose.ui.Modifier
3334
import androidx.compose.ui.graphics.Shape
3435
import androidx.compose.ui.unit.dp
36+
import com.mifos.core.designsystem.theme.AppColors
3537
import com.mifos.core.designsystem.theme.DesignToken
3638
import com.mifos.core.designsystem.theme.MifosTheme
3739
import org.jetbrains.compose.ui.tooling.preview.Preview
@@ -164,9 +166,11 @@ fun MifosTextButton(
164166
modifier = modifier,
165167
enabled = enabled,
166168
colors = ButtonDefaults.textButtonColors(
167-
contentColor = MaterialTheme.colorScheme.onBackground,
169+
contentColor = AppColors.customWhite,
170+
containerColor = MaterialTheme.colorScheme.primary,
168171
),
169172
content = content,
173+
shape = DesignToken.shapes.medium,
170174
)
171175
}
172176

@@ -212,7 +216,10 @@ private fun MifosButtonContent(
212216
modifier: Modifier = Modifier,
213217
leadingIcon: @Composable (() -> Unit)? = null,
214218
) {
215-
Row(modifier) {
219+
Row(
220+
modifier = modifier,
221+
verticalAlignment = Alignment.CenterVertically,
222+
) {
216223
if (leadingIcon != null) {
217224
Box(Modifier.sizeIn(maxHeight = ButtonDefaults.IconSize)) {
218225
leadingIcon()

core/network/src/commonMain/kotlin/com/mifos/core/network/mappers/clients/ClientMapper.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ object ClientMapper : AbstractMapper<GetClientsPageItemsResponse, ClientEntity>(
3535
value = entity.status.value,
3636
),
3737
externalId = entity.externalId,
38+
emailAddress = entity.emailAddress,
39+
legalForm = ClientStatusEntity(
40+
id = entity.legalForm?.id?.toInt() ?: -1,
41+
code = entity.legalForm?.code,
42+
value = entity.legalForm?.value,
43+
),
44+
dateOfBirth = entity.dateOfBirth ?: emptyList(),
3845
)
3946
}
4047

@@ -53,6 +60,13 @@ object ClientMapper : AbstractMapper<GetClientsPageItemsResponse, ClientEntity>(
5360
value = domainModel.status?.value,
5461
),
5562
externalId = domainModel.externalId,
63+
emailAddress = domainModel.emailAddress,
64+
legalForm = GetClientStatus(
65+
id = domainModel.legalForm?.id?.toLong(),
66+
code = domainModel.legalForm?.code,
67+
value = domainModel.legalForm?.value,
68+
),
69+
dateOfBirth = domainModel.dateOfBirth,
5670
)
5771
}
5872
}

core/network/src/commonMain/kotlin/com/mifos/core/network/model/GetClientsPageItemsResponse.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ data class GetClientsPageItemsResponse(
4848

4949
val externalId: String? = null,
5050

51+
val legalForm: GetClientStatus? = null,
52+
53+
val dateOfBirth: List<Int?> = emptyList(),
54+
5155
)

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ import com.mifos.core.designsystem.theme.AppColors
6666
import com.mifos.core.designsystem.theme.DesignToken
6767
import com.mifos.core.designsystem.theme.MifosTheme
6868
import com.mifos.core.designsystem.theme.MifosTypography
69+
import org.jetbrains.compose.resources.StringResource
6970
import org.jetbrains.compose.resources.stringResource
7071
import org.jetbrains.compose.ui.tooling.preview.Preview
7172

7273
@Composable
7374
fun MifosListingComponentOutline(
7475
modifier: Modifier = Modifier,
76+
color: Color = MaterialTheme.colorScheme.secondaryContainer,
7577
content: @Composable () -> Unit,
7678
) {
7779
Box(
@@ -81,7 +83,7 @@ fun MifosListingComponentOutline(
8183
.border(
8284
width = 1.dp,
8385
shape = DesignToken.shapes.medium,
84-
color = MaterialTheme.colorScheme.secondaryContainer,
86+
color = color,
8587
)
8688
.padding(DesignToken.padding.large),
8789
) {
@@ -123,9 +125,12 @@ fun MifosListingRowItem(
123125

124126
@Composable
125127
fun MifosDefaultListingComponent(
128+
color: Color = MaterialTheme.colorScheme.primary.copy(alpha = 0.5f),
126129
data: Map<String, String>,
127130
) {
128-
MifosListingComponentOutline {
131+
MifosListingComponentOutline(
132+
color = color,
133+
) {
129134
Column(
130135
modifier = Modifier.fillMaxWidth(),
131136
verticalArrangement = Arrangement.spacedBy(DesignToken.padding.extraExtraSmall),
@@ -140,6 +145,28 @@ fun MifosDefaultListingComponent(
140145
}
141146
}
142147

148+
@Composable
149+
fun MifosDefaultListingComponentFromStringResources(
150+
color: Color = MaterialTheme.colorScheme.primary.copy(alpha = 0.5f),
151+
data: Map<StringResource, String>,
152+
) {
153+
MifosListingComponentOutline(
154+
color = color,
155+
) {
156+
Column(
157+
modifier = Modifier.fillMaxWidth(),
158+
verticalArrangement = Arrangement.spacedBy(DesignToken.padding.extraExtraSmall),
159+
) {
160+
data.forEach { (key, value) ->
161+
MifosListingRowItem(
162+
key = stringResource(key),
163+
value = value,
164+
)
165+
}
166+
}
167+
}
168+
}
169+
143170
@Composable
144171
fun MifosClientFeeListingComponent(
145172
name: String,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fun MifosRowCard(
114114
modifier = Modifier
115115
.size(DesignToken.sizes.iconExtraLarge)
116116
.background(
117-
color = Color.LightGray.copy(alpha = 0.15f),
117+
color = Color.LightGray.copy(alpha = 0.1f),
118118
shape = CircleShape,
119119
)
120120
.padding(DesignToken.padding.small),
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.core.ui.util
11+
12+
fun List<Int?>?.toDateString(): String {
13+
if (this == null) return ""
14+
return if (this.size >= 3) {
15+
val year = this[0]
16+
val month = this[1].toString().padStart(2, '0')
17+
val day = this[2].toString().padStart(2, '0')
18+
"$day-$month-$year"
19+
} else {
20+
""
21+
}
22+
}

feature/client/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ kotlin {
2323
implementation(projects.core.domain)
2424
implementation(projects.core.datastore)
2525
implementation(projects.core.designsystem)
26+
implementation(projects.core.ui)
2627
implementation(projects.feature.dataTable)
2728

2829
implementation(compose.ui)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2025 Mifos Initiative
4+
5+
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
6+
If a copy of the MPL was not distributed with this file,
7+
You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+
See https://github.com/openMF/android-client/blob/master/LICENSE.md
10+
-->
11+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
12+
android:width="20dp"
13+
android:height="20dp"
14+
android:viewportWidth="20"
15+
android:viewportHeight="20">
16+
<path
17+
android:pathData="M15.833,10H15V3.333H5V10H4.167C2.783,10 1.667,11.117 1.667,12.5V16.667H18.333V12.5C18.333,11.117 17.217,10 15.833,10ZM13.333,10H6.667V5H13.333V10ZM15,14.167C14.542,14.167 14.167,13.792 14.167,13.333C14.167,12.875 14.542,12.5 15,12.5C15.458,12.5 15.833,12.875 15.833,13.333C15.833,13.792 15.458,14.167 15,14.167Z"
18+
android:strokeAlpha="0.2"
19+
android:fillColor="#191C20"
20+
android:fillAlpha="0.2"/>
21+
</vector>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2025 Mifos Initiative
4+
5+
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
6+
If a copy of the MPL was not distributed with this file,
7+
You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+
See https://github.com/openMF/android-client/blob/master/LICENSE.md
10+
-->
11+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
12+
android:width="20dp"
13+
android:height="20dp"
14+
android:viewportWidth="20"
15+
android:viewportHeight="20">
16+
<path
17+
android:pathData="M9.171,4.341V13.649L5.104,9.582C4.779,9.257 4.246,9.257 3.921,9.582C3.596,9.907 3.596,10.432 3.921,10.757L9.412,16.249C9.737,16.574 10.262,16.574 10.587,16.249L16.079,10.757C16.404,10.432 16.404,9.907 16.079,9.582C15.754,9.257 15.229,9.257 14.904,9.582L10.837,13.649V4.341C10.837,3.882 10.462,3.507 10.004,3.507C9.546,3.507 9.171,3.882 9.171,4.341Z"
18+
android:fillColor="#BAC8DB"/>
19+
</vector>

0 commit comments

Comments
 (0)