@@ -30,15 +30,13 @@ import androidx.compose.material3.IconButton
3030import androidx.compose.material3.MaterialTheme
3131import androidx.compose.material3.Surface
3232import androidx.compose.material3.Text
33- import androidx.compose.material3.TextButton
3433import androidx.compose.runtime.Composable
3534import androidx.compose.runtime.getValue
3635import androidx.compose.runtime.remember
3736import androidx.compose.ui.Alignment
3837import androidx.compose.ui.Modifier
3938import androidx.compose.ui.unit.dp
4039import androidx.lifecycle.compose.collectAsStateWithLifecycle
41- import androidx.lifecycle.viewmodel.compose.viewModel
4240import kotlinx.collections.immutable.ImmutableList
4341import mifos_mobile.feature.savings_account.generated.resources.Res
4442import mifos_mobile.feature.savings_account.generated.resources.feature_account_action_update
@@ -63,6 +61,7 @@ import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
6361import org.mifos.mobile.core.designsystem.theme.MifosTypography
6462import org.mifos.mobile.core.model.enums.ChargeType
6563import org.mifos.mobile.core.ui.component.MifosActionCard
64+ import org.mifos.mobile.core.ui.component.MifosAlertDialog
6665import org.mifos.mobile.core.ui.component.MifosErrorComponent
6766import org.mifos.mobile.core.ui.component.MifosLabelValueCard
6867import 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
472425internal 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
0 commit comments