Skip to content

Commit 8bfd6c9

Browse files
committed
Update:some changes in the trasectionInfo.
1 parent d03d7f7 commit 8bfd6c9

File tree

2 files changed

+11
-54
lines changed

2 files changed

+11
-54
lines changed

feature/savings-account/src/commonMain/kotlin/org/mifos/mobile/feature/savingsaccount/savingsAccountDetails/SavingsAccountDetailsScreen.kt

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ import androidx.compose.material3.IconButton
3030
import androidx.compose.material3.MaterialTheme
3131
import androidx.compose.material3.Surface
3232
import androidx.compose.material3.Text
33-
import androidx.compose.material3.TextButton
3433
import androidx.compose.runtime.Composable
3534
import androidx.compose.runtime.getValue
3635
import androidx.compose.runtime.remember
3736
import androidx.compose.ui.Alignment
3837
import androidx.compose.ui.Modifier
3938
import androidx.compose.ui.unit.dp
4039
import androidx.lifecycle.compose.collectAsStateWithLifecycle
41-
import androidx.lifecycle.viewmodel.compose.viewModel
4240
import kotlinx.collections.immutable.ImmutableList
4341
import mifos_mobile.feature.savings_account.generated.resources.Res
4442
import mifos_mobile.feature.savings_account.generated.resources.feature_account_action_update
@@ -63,6 +61,7 @@ import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
6361
import org.mifos.mobile.core.designsystem.theme.MifosTypography
6462
import org.mifos.mobile.core.model.enums.ChargeType
6563
import org.mifos.mobile.core.ui.component.MifosActionCard
64+
import org.mifos.mobile.core.ui.component.MifosAlertDialog
6665
import org.mifos.mobile.core.ui.component.MifosErrorComponent
6766
import org.mifos.mobile.core.ui.component.MifosLabelValueCard
6867
import org.mifos.mobile.core.ui.component.MifosPoweredCard
@@ -138,7 +137,7 @@ internal fun SavingsAccountDetailsScreen(
138137

139138
SavingsAccountDialogs(
140139
dialogState = uiState.dialogState,
141-
transactionList = uiState.transactionList,
140+
transectionInfo = uiState.transactionList,
142141
onAction = remember(viewModel) {
143142
{ viewModel.trySendAction(it) }
144143
},
@@ -422,56 +421,10 @@ internal fun SavingsAccountActions(
422421
}
423422
}
424423

425-
@Composable
426-
private fun TransactionInfoDialog(
427-
transactionItems: List<LabelValueItem>,
428-
onDismiss: () -> Unit,
429-
) {
430-
androidx.compose.material3.AlertDialog(
431-
onDismissRequest = onDismiss,
432-
title = {
433-
Text(
434-
text = stringResource(Res.string.feature_transaction_info_title),
435-
style = MaterialTheme.typography.titleLarge,
436-
)
437-
},
438-
text = {
439-
Column(
440-
modifier = Modifier
441-
.fillMaxWidth()
442-
.verticalScroll(rememberScrollState()),
443-
verticalArrangement = Arrangement.spacedBy(DesignToken.spacing.medium),
444-
) {
445-
transactionItems.forEach { item ->
446-
Column(
447-
modifier = Modifier.fillMaxWidth(),
448-
) {
449-
Text(
450-
text = stringResource(item.label),
451-
style = MaterialTheme.typography.bodySmall,
452-
color = MaterialTheme.colorScheme.onSurfaceVariant,
453-
)
454-
Text(
455-
text = item.value,
456-
style = MaterialTheme.typography.bodyLarge,
457-
color = MaterialTheme.colorScheme.onSurface,
458-
)
459-
}
460-
}
461-
}
462-
},
463-
confirmButton = {
464-
TextButton(onClick = onDismiss) {
465-
Text("Close")
466-
}
467-
},
468-
)
469-
}
470-
471424
@Composable
472425
internal fun SavingsAccountDialogs(
473426
dialogState: SavingsAccountDetailsState.DialogState?,
474-
transactionList: List<LabelValueItem>,
427+
transectionInfo: List<LabelValueItem>,
475428
onAction: (SavingsAccountDetailsAction) -> Unit,
476429
) {
477430
when (dialogState) {
@@ -484,9 +437,13 @@ internal fun SavingsAccountDialogs(
484437
}
485438

486439
is SavingsAccountDetailsState.DialogState.TransactionInfo -> {
487-
TransactionInfoDialog(
488-
transactionItems = transactionList,
489-
onDismiss = { onAction(SavingsAccountDetailsAction.DismissDialog) },
440+
MifosAlertDialog(
441+
onDismissRequest = { onAction(SavingsAccountDetailsAction.DismissDialog) },
442+
dialogTitle =stringResource(Res.string.feature_transaction_info_title),
443+
dialogText = transectionInfo.joinToString("\n ") { "${it.label}: ${it.value}" },
444+
confirmationText ="Close",
445+
dismissText = "",
446+
onConfirmation = { onAction(SavingsAccountDetailsAction.DismissDialog) },
490447
)
491448
}
492449

feature/savings-account/src/commonMain/kotlin/org/mifos/mobile/feature/savingsaccount/savingsAccountDetails/SavingsAccountDetailsViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ internal class SavingsAccountDetailsViewModel(
308308
)
309309
} ?: emptyList()
310310

311-
mutableStateFlow.update {
311+
updateState {
312312
it.copy(
313313
isActive = isActive,
314314
isUpdatable = isUpdate,

0 commit comments

Comments
 (0)