Skip to content

Commit 2ad303b

Browse files
committed
feat(feature:send-money): implement transaction history section
1 parent a792092 commit 2ad303b

File tree

1 file changed

+167
-0
lines changed

1 file changed

+167
-0
lines changed

feature/send-money/src/commonMain/kotlin/org/mifospay/feature/send/money/SendMoneyOptionsScreen.kt

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import mobile_wallet.feature.send_money.generated.resources.feature_send_money_s
5252
import mobile_wallet.feature.send_money.generated.resources.feature_send_money_send
5353
import org.jetbrains.compose.resources.stringResource
5454
import org.koin.compose.viewmodel.koinViewModel
55+
import org.mifospay.core.common.CurrencyFormatter
5556
import org.mifospay.core.designsystem.component.MifosGradientBackground
5657
import org.mifospay.core.designsystem.component.MifosScaffold
5758
import org.mifospay.core.designsystem.component.MifosTopBar
@@ -146,6 +147,14 @@ fun SendMoneyOptionsScreen(
146147
MerchantsSection()
147148

148149
Spacer(modifier = Modifier.height(KptTheme.spacing.md))
150+
151+
TransactionHistorySection(
152+
onSeeAllClick = {
153+
// TODO: Navigate to full transaction history
154+
},
155+
)
156+
157+
Spacer(modifier = Modifier.height(KptTheme.spacing.md))
149158
}
150159
}
151160
}
@@ -411,6 +420,164 @@ private fun MerchantsSection(
411420
}
412421
}
413422

423+
@Composable
424+
private fun TransactionHistorySection(
425+
onSeeAllClick: () -> Unit,
426+
modifier: Modifier = Modifier,
427+
) {
428+
val dummyTransactions = listOf(
429+
TransactionItem(
430+
payeeName = "Rahul Sharma",
431+
amount = 2500.0,
432+
date = "15 August",
433+
profileImageUrl = null,
434+
),
435+
TransactionItem(
436+
payeeName = "Priya Patel",
437+
amount = 1800.0,
438+
date = "14 August",
439+
profileImageUrl = null,
440+
),
441+
TransactionItem(
442+
payeeName = "Amit Kumar",
443+
amount = 3200.0,
444+
date = "13 August",
445+
profileImageUrl = null,
446+
),
447+
TransactionItem(
448+
payeeName = "Neha Singh",
449+
amount = 950.0,
450+
date = "12 August",
451+
profileImageUrl = null,
452+
),
453+
TransactionItem(
454+
payeeName = "Vikram Mehta",
455+
amount = 4100.0,
456+
date = "11 August",
457+
profileImageUrl = null,
458+
),
459+
)
460+
461+
Column(
462+
modifier = modifier.fillMaxWidth(),
463+
verticalArrangement = Arrangement.spacedBy(KptTheme.spacing.md),
464+
) {
465+
Row(
466+
modifier = Modifier.fillMaxWidth(),
467+
horizontalArrangement = Arrangement.SpaceBetween,
468+
verticalAlignment = Alignment.CenterVertically,
469+
) {
470+
Text(
471+
text = "UPI Transaction History",
472+
style = KptTheme.typography.titleMedium,
473+
fontWeight = FontWeight.SemiBold,
474+
color = KptTheme.colorScheme.onSurface,
475+
)
476+
477+
Row(
478+
modifier = Modifier.clickable { onSeeAllClick() },
479+
verticalAlignment = Alignment.CenterVertically,
480+
horizontalArrangement = Arrangement.spacedBy(KptTheme.spacing.xs),
481+
) {
482+
Text(
483+
text = "See All",
484+
style = KptTheme.typography.bodyMedium,
485+
fontWeight = FontWeight.Medium,
486+
color = KptTheme.colorScheme.primary,
487+
)
488+
Icon(
489+
imageVector = MifosIcons.ChevronRight,
490+
contentDescription = "See All",
491+
modifier = Modifier.size(16.dp),
492+
tint = KptTheme.colorScheme.primary,
493+
)
494+
}
495+
}
496+
497+
Column(
498+
verticalArrangement = Arrangement.spacedBy(KptTheme.spacing.md),
499+
) {
500+
dummyTransactions.forEach { transaction ->
501+
TransactionItemRow(transaction = transaction)
502+
}
503+
}
504+
}
505+
}
506+
507+
@Composable
508+
private fun TransactionItemRow(
509+
transaction: TransactionItem,
510+
modifier: Modifier = Modifier,
511+
) {
512+
Row(
513+
modifier = modifier.fillMaxWidth(),
514+
verticalAlignment = Alignment.CenterVertically,
515+
horizontalArrangement = Arrangement.spacedBy(KptTheme.spacing.md),
516+
) {
517+
Box(
518+
modifier = Modifier
519+
.size(40.dp)
520+
.background(
521+
color = KptTheme.colorScheme.primaryContainer,
522+
shape = CircleShape,
523+
),
524+
contentAlignment = Alignment.Center,
525+
) {
526+
if (transaction.profileImageUrl != null) {
527+
Text(
528+
text = transaction.payeeName.take(1).uppercase(),
529+
style = KptTheme.typography.bodyMedium,
530+
fontWeight = FontWeight.Bold,
531+
color = KptTheme.colorScheme.onPrimaryContainer,
532+
)
533+
} else {
534+
Text(
535+
text = transaction.payeeName.take(1).uppercase(),
536+
style = KptTheme.typography.bodyMedium,
537+
fontWeight = FontWeight.Bold,
538+
color = KptTheme.colorScheme.onPrimaryContainer,
539+
)
540+
}
541+
}
542+
543+
Column(
544+
modifier = Modifier.weight(1f),
545+
verticalArrangement = Arrangement.spacedBy(KptTheme.spacing.xs),
546+
) {
547+
Text(
548+
text = transaction.payeeName.uppercase(),
549+
style = KptTheme.typography.bodyMedium,
550+
fontWeight = FontWeight.SemiBold,
551+
color = KptTheme.colorScheme.onSurface,
552+
)
553+
Text(
554+
text = transaction.date,
555+
style = KptTheme.typography.bodySmall,
556+
fontWeight = FontWeight.Normal,
557+
color = KptTheme.colorScheme.onSurfaceVariant,
558+
)
559+
}
560+
561+
Text(
562+
text = CurrencyFormatter.format(
563+
balance = transaction.amount,
564+
currencyCode = "INR",
565+
maximumFractionDigits = 2,
566+
),
567+
style = KptTheme.typography.bodyMedium,
568+
fontWeight = FontWeight.SemiBold,
569+
color = KptTheme.colorScheme.onSurface,
570+
)
571+
}
572+
}
573+
574+
data class TransactionItem(
575+
val payeeName: String,
576+
val amount: Double,
577+
val date: String,
578+
val profileImageUrl: String?,
579+
)
580+
414581
@Composable
415582
private fun PersonItem(
416583
name: String,

0 commit comments

Comments
 (0)