Fix: Home background color and bring payment and history (#1929)

This commit is contained in:
Rajan Maurya 2025-09-10 14:50:41 +05:30 committed by GitHub
parent e3061d29cd
commit 63ca5b5f41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 188 additions and 21 deletions

View File

@ -30,6 +30,7 @@ import org.mifospay.feature.faq.navigation.navigateToFAQ
import org.mifospay.feature.finance.FinanceScreenContents
import org.mifospay.feature.finance.navigation.FINANCE_ROUTE
import org.mifospay.feature.finance.navigation.financeScreen
import org.mifospay.feature.history.HistoryScreen
import org.mifospay.feature.history.navigation.historyNavigation
import org.mifospay.feature.history.navigation.navigateToHistory
import org.mifospay.feature.history.navigation.navigateToSpecificTransaction
@ -65,6 +66,7 @@ import org.mifospay.feature.request.money.navigation.navigateToShowQrScreen
import org.mifospay.feature.request.money.navigation.showQrScreen
import org.mifospay.feature.savedcards.createOrUpdate.addEditCardScreen
import org.mifospay.feature.savedcards.details.cardDetailRoute
import org.mifospay.feature.send.money.SendMoneyScreen
import org.mifospay.feature.send.money.navigation.SEND_MONEY_BASE_ROUTE
import org.mifospay.feature.send.money.navigation.navigateToSendMoneyScreen
import org.mifospay.feature.send.money.navigation.sendMoneyScreen
@ -87,25 +89,25 @@ internal fun MifosNavHost(
val navController = appState.navController
val paymentsTabContents = listOf(
// TabContent(PaymentsScreenContents.SEND.name) {
// SendMoneyScreen(
// onBackClick = navController::navigateUp,
// navigateToTransferScreen = navController::navigateToTransferScreen,
// navigateToScanQrScreen = navController::navigateToScanQr,
// showTopBar = false,
// )
// },
TabContent(PaymentsScreenContents.SEND.name) {
SendMoneyScreen(
onBackClick = navController::navigateUp,
navigateToTransferScreen = navController::navigateToTransferScreen,
navigateToScanQrScreen = navController::navigateToScanQr,
showTopBar = false,
)
},
TabContent(PaymentsScreenContents.REQUEST.name) {
RequestScreen(
showQr = navController::navigateToShowQrScreen,
)
},
// TabContent(PaymentsScreenContents.HISTORY.name) {
// HistoryScreen(
// viewTransferDetail = navController::navigateToTransactionDetail,
// showTopBar = false,
// )
// },
TabContent(PaymentsScreenContents.HISTORY.name) {
HistoryScreen(
viewTransferDetail = navController::navigateToTransactionDetail,
showTopBar = false,
)
},
// TabContent(PaymentsScreenContents.SI.name) {
// StandingInstructionsScreen(
// onAddEditSI = navController::navigateToSIAddEdit,

View File

@ -47,6 +47,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
@ -105,6 +106,10 @@ import org.mifospay.core.designsystem.component.scrollbar.rememberDraggableScrol
import org.mifospay.core.designsystem.component.scrollbar.scrollbarState
import org.mifospay.core.designsystem.icon.MifosIcons
import org.mifospay.core.model.account.Account
import org.mifospay.core.model.savingsaccount.Currency
import org.mifospay.core.model.savingsaccount.Status
import org.mifospay.core.model.savingsaccount.Transaction
import org.mifospay.core.model.savingsaccount.TransactionType
import org.mifospay.core.ui.ErrorScreenContent
import org.mifospay.core.ui.MifosProgressIndicator
import org.mifospay.core.ui.MifosSmallChip
@ -193,7 +198,6 @@ fun HomeScreenContent(
MifosScaffold(
modifier = modifier,
snackbarHostState = snackbarHostState,
containerColor = KptTheme.colorScheme.background,
) {
PullToRefreshBox(
isRefreshing = isRefreshing,
@ -250,7 +254,7 @@ private fun HomeScreenContent(
modifier = modifier
.fillMaxSize(),
state = state,
contentPadding = PaddingValues(KptTheme.spacing.md),
contentPadding = PaddingValues(),
) {
item {
AccountList(
@ -267,7 +271,10 @@ private fun HomeScreenContent(
item {
PayRequestScreen(
modifier = Modifier.padding(vertical = KptTheme.spacing.md),
modifier = Modifier.padding(
vertical = KptTheme.spacing.md,
horizontal = KptTheme.spacing.md,
),
onRequest = {
onAction(HomeAction.RequestClicked)
},
@ -283,7 +290,10 @@ private fun HomeScreenContent(
item {
TransactionHistoryCard(
modifier = Modifier.padding(vertical = KptTheme.spacing.md),
modifier = Modifier.padding(
vertical = KptTheme.spacing.md,
horizontal = KptTheme.spacing.md,
),
transactions = viewState.transactions,
onClickViewAll = {
onAction(HomeAction.OnClickSeeAllTransactions)
@ -326,6 +336,7 @@ private fun AccountList(
state = pagerState,
pageSpacing = KptTheme.spacing.xs,
modifier = modifier,
contentPadding = PaddingValues(start = KptTheme.spacing.md, end = KptTheme.spacing.md),
) {
AccountCard(
account = accounts[it],
@ -555,7 +566,7 @@ private fun MifosSendMoneyFreeCard(
modifier: Modifier = Modifier,
) {
Card(
modifier = modifier,
modifier = modifier.padding(horizontal = KptTheme.spacing.md),
colors = CardDefaults.cardColors(
containerColor = KptTheme.colorScheme.surface,
),
@ -643,3 +654,157 @@ private fun HomeScreenDialog(
null -> Unit
}
}
@Preview
@Composable
private fun HomeScreenContentPreview() {
val accounts = listOf(
Account(
name = "Account 1",
number = "123456789",
balance = 1000.0,
id = 1L,
currency = Currency(
code = "USD",
name = "US Dollar",
decimalPlaces = 2,
displaySymbol = "$",
nameCode = "USD",
displayLabel = "US Dollar ($)",
),
status = Status(
id = 300,
code = "status.active",
value = "Active",
submittedAndPendingApproval = false,
approved = false,
rejected = false,
withdrawnByApplicant = false,
active = true,
closed = false,
prematureClosed = false,
transferInProgress = false,
transferOnHold = false,
matured = false,
),
),
Account(
name = "Account 1",
number = "123456789",
balance = 1000.0,
id = 1L,
currency = Currency(
code = "USD",
name = "US Dollar",
decimalPlaces = 2,
displaySymbol = "$",
nameCode = "USD",
displayLabel = "US Dollar ($)",
),
status = Status(
id = 300,
code = "status.active",
value = "Active",
submittedAndPendingApproval = false,
approved = false,
rejected = false,
withdrawnByApplicant = false,
active = true,
closed = false,
prematureClosed = false,
transferInProgress = false,
transferOnHold = false,
matured = false,
),
),
)
val transactions = listOf(
Transaction(
accountId = 1L,
amount = 100.0,
date = "2023-01-01",
currency = Currency(
code = "USD",
name = "US Dollar",
decimalPlaces = 2,
displaySymbol = "$",
nameCode = "USD",
displayLabel = "US Dollar ($)",
),
transactionType = TransactionType.CREDIT,
transactionId = 101L,
accountNo = "123456789",
transferId = null,
originalTransactionId = 101L,
paymentDetailId = null,
),
Transaction(
accountId = 2L,
amount = 100.0,
date = "2023-01-01",
currency = Currency(
code = "USD",
name = "US Dollar",
decimalPlaces = 2,
displaySymbol = "$",
nameCode = "USD",
displayLabel = "US Dollar ($)",
),
transactionType = TransactionType.DEBIT,
transactionId = 101L,
accountNo = "123456789",
transferId = null,
originalTransactionId = 101L,
paymentDetailId = null,
),
Transaction(
accountId = 3L,
amount = 100.0,
date = "2023-01-01",
currency = Currency(
code = "USD",
name = "US Dollar",
decimalPlaces = 2,
displaySymbol = "$",
nameCode = "USD",
displayLabel = "US Dollar ($)",
),
transactionType = TransactionType.CREDIT,
transactionId = 101L,
accountNo = "123456789",
transferId = null,
originalTransactionId = 101L,
paymentDetailId = null,
),
Transaction(
accountId = 4L,
amount = 100.0,
date = "2023-01-01",
currency = Currency(
code = "USD",
name = "US Dollar",
decimalPlaces = 2,
displaySymbol = "$",
nameCode = "USD",
displayLabel = "US Dollar ($)",
),
transactionType = TransactionType.DEBIT,
transactionId = 101L,
accountNo = "123456789",
transferId = null,
originalTransactionId = 101L,
paymentDetailId = null,
),
)
val viewState = ViewState.Content(
accounts = accounts,
transactions = transactions,
)
MaterialTheme {
HomeScreenContent(
viewState = viewState,
defaultAccountId = 1L,
onAction = {},
)
}
}

View File

@ -61,9 +61,9 @@ private fun PaymentScreenContent(
// https://venus.mifos.community/fineract-provider/api/v1/datatables/invoice/2
//
enum class PaymentsScreenContents {
// SEND,
SEND,
REQUEST,
// HISTORY,
HISTORY,
// SI,
// INVOICES,
}