Started BankAccountSettingsScreen, but it's not possible to save changes yet
This commit is contained in:
parent
2813224eff
commit
db8d4a7dcd
|
@ -6,9 +6,7 @@ import androidx.compose.runtime.*
|
|||
import kotlinx.coroutines.launch
|
||||
import net.codinux.banking.ui.config.DI
|
||||
import net.codinux.banking.ui.dialogs.*
|
||||
import net.codinux.banking.ui.screens.AccountTransactionDetailsScreen
|
||||
import net.codinux.banking.ui.screens.BankSettingsScreen
|
||||
import net.codinux.banking.ui.screens.ExportScreen
|
||||
import net.codinux.banking.ui.screens.*
|
||||
import net.codinux.banking.ui.state.UiState
|
||||
|
||||
private val formatUtil = DI.formatUtil
|
||||
|
@ -19,6 +17,7 @@ fun StateHandler(uiState: UiState, snackbarHostState: SnackbarHostState) {
|
|||
val showTransferMoneyDialogData by uiState.showTransferMoneyDialogData.collectAsState()
|
||||
val showAccountTransactionDetailsScreenForId by uiState.showAccountTransactionDetailsScreenForId.collectAsState()
|
||||
val showBankSettingsScreenForBank by uiState.showBankSettingsScreenForBank.collectAsState()
|
||||
val showBankAccountSettingsScreenForAccount by uiState.showBankAccountSettingsScreenForAccount.collectAsState()
|
||||
val showExportScreen by uiState.showExportScreen.collectAsState()
|
||||
|
||||
val tanChallengeReceived by uiState.tanChallengeReceived.collectAsState()
|
||||
|
@ -46,6 +45,10 @@ fun StateHandler(uiState: UiState, snackbarHostState: SnackbarHostState) {
|
|||
BankSettingsScreen(bank) { uiState.showBankSettingsScreenForBank.value = null }
|
||||
}
|
||||
|
||||
showBankAccountSettingsScreenForAccount?.let { account ->
|
||||
BankAccountSettingsScreen(account) { uiState.showBankAccountSettingsScreenForAccount.value = null }
|
||||
}
|
||||
|
||||
if (showExportScreen) {
|
||||
ExportScreen { uiState.showExportScreen.value = false }
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ fun UiSettings(modifier: Modifier, textColor: Color = Color.Unspecified) {
|
|||
|
||||
|
||||
Column(modifier) {
|
||||
BooleanOption("Kontostand anzeigen", showBalance, textColor = textColor) { uiSettings.showBalance.value = it }
|
||||
BooleanOption("Kontostand anzeigen", showBalance, textColor = textColor) { uiSettings.showBalance.value = it }
|
||||
|
||||
BooleanOption("Umsätze in alternierenden Farben anzeigen", showTransactionsInAlternatingColors, textColor = textColor) { uiSettings.showTransactionsInAlternatingColors.value = it }
|
||||
BooleanOption("Umsätze in alternierenden Farben anzeigen", showTransactionsInAlternatingColors, textColor = textColor) { uiSettings.showTransactionsInAlternatingColors.value = it }
|
||||
|
||||
BooleanOption("Bank Icons anzeigen", showBankIcons, textColor = textColor) { uiSettings.showBankIcons.value = it }
|
||||
BooleanOption("Bank Icons anzeigen", showBankIcons, textColor = textColor) { uiSettings.showBankIcons.value = it }
|
||||
|
||||
BooleanOption("Umsätze farbig anzeigen", showColoredAmounts, textColor = textColor) { uiSettings.showColoredAmounts.value = it }
|
||||
BooleanOption("Umsätze farbig anzeigen", showColoredAmounts, textColor = textColor) { uiSettings.showColoredAmounts.value = it }
|
||||
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("Umsätze gruppieren", color = textColor)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.codinux.banking.ui.config
|
||||
|
||||
import net.codinux.banking.client.model.BankAccountType
|
||||
import net.codinux.banking.client.model.tan.ActionRequiringTan
|
||||
import net.codinux.banking.ui.model.TransactionsGrouping
|
||||
|
||||
|
@ -30,4 +31,17 @@ object Internationalization {
|
|||
TransactionsGrouping.None -> "Nicht gruppieren"
|
||||
}
|
||||
|
||||
fun translate(accountType: BankAccountType): String = when (accountType) {
|
||||
BankAccountType.CheckingAccount -> "Girokonto"
|
||||
BankAccountType.SavingsAccount -> "Sparkonto"
|
||||
BankAccountType.FixedTermDepositAccount -> "Festgeldkonto"
|
||||
BankAccountType.SecuritiesAccount -> "Wertpapierdepot"
|
||||
BankAccountType.LoanAccount -> "Darlehenskonto"
|
||||
BankAccountType.CreditCardAccount -> "Kreditkartenkonto"
|
||||
BankAccountType.FundDeposit -> "Fondsdepot"
|
||||
BankAccountType.BuildingLoanContract -> "Bausparvertrag"
|
||||
BankAccountType.InsuranceContract -> "Versicherungsvertrag"
|
||||
BankAccountType.Other -> "Sonstige"
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package net.codinux.banking.ui.forms
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.Text
|
||||
|
@ -9,18 +10,26 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import net.codinux.banking.ui.config.Colors
|
||||
|
||||
@Composable
|
||||
fun FormListItem(label: String, isSelectable: Boolean = false, isSelected: Boolean = false, selectedIconContentDescription: String? = null) {
|
||||
fun FormListItem(
|
||||
label: String,
|
||||
isSelectable: Boolean = false,
|
||||
isSelected: Boolean = false,
|
||||
selectedIconContentDescription: String? = null,
|
||||
itemHeight: Dp = 32.dp,
|
||||
onClick: (() -> Unit)? = null
|
||||
) {
|
||||
|
||||
Row(Modifier.fillMaxWidth().height(32.dp).padding(4.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
Row(Modifier.fillMaxWidth().height(itemHeight).clickable { onClick?.invoke() }.padding(4.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
if (isSelectable) {
|
||||
Column(Modifier.size(24.dp).padding(end = 8.dp)) {
|
||||
Column(Modifier.padding(end = 8.dp).size(24.dp)) {
|
||||
if (isSelected) {
|
||||
Icon(Icons.Outlined.Check, selectedIconContentDescription ?: "Item ist ausgewählt")
|
||||
Icon(Icons.Outlined.Check, selectedIconContentDescription ?: "Item ist ausgewählt", tint = Colors.FormListItemTextColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package net.codinux.banking.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import net.codinux.banking.dataaccess.entities.BankAccountEntity
|
||||
import net.codinux.banking.ui.config.Internationalization
|
||||
import net.codinux.banking.ui.extensions.verticalScroll
|
||||
import net.codinux.banking.ui.forms.*
|
||||
|
||||
@Composable
|
||||
fun BankAccountSettingsScreen(account: BankAccountEntity, onClosed: () -> Unit) {
|
||||
|
||||
var enteredAccountName by remember { mutableStateOf(account.displayName) }
|
||||
|
||||
var selectedIncludeInAutomaticAccountsUpdate by remember { mutableStateOf(account.includeInAutomaticAccountsUpdate) }
|
||||
|
||||
var selectedHideAccount by remember { mutableStateOf(account.hideAccount) }
|
||||
|
||||
val hasDataChanged by remember(enteredAccountName) {
|
||||
mutableStateOf(
|
||||
enteredAccountName != account.displayName
|
||||
|| selectedIncludeInAutomaticAccountsUpdate != account.includeInAutomaticAccountsUpdate
|
||||
|| selectedHideAccount != account.hideAccount
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
FullscreenViewBase(account.displayName, onClosed = onClosed) {
|
||||
Column(Modifier.fillMaxSize().verticalScroll().padding(8.dp)) {
|
||||
Column {
|
||||
SectionHeader("Einstellungen", false)
|
||||
|
||||
OutlinedTextField(
|
||||
label = { Text("Name") },
|
||||
value = enteredAccountName,
|
||||
onValueChange = { enteredAccountName = it },
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 8.dp)
|
||||
)
|
||||
|
||||
// BooleanOption("Bei Kontoaktualisierung einbeziehen", selectedIncludeInAutomaticAccountsUpdate) { selectedIncludeInAutomaticAccountsUpdate = it }
|
||||
//
|
||||
// BooleanOption("Konto ausblenden", selectedHideAccount) { selectedHideAccount = it }
|
||||
}
|
||||
|
||||
SelectionContainer {
|
||||
Column {
|
||||
SectionHeader("Kontodaten") // TODO: add a share icon to copy data
|
||||
|
||||
LabelledValue("Kontoinhaber", account.accountHolderName)
|
||||
|
||||
LabelledValue("Kontonummer", account.identifier)
|
||||
|
||||
LabelledValue("Unterkontenmerkmal", account.subAccountNumber)
|
||||
|
||||
LabelledValue("IBAN", account.iban ?: "")
|
||||
|
||||
LabelledValue("Typ", Internationalization.translate(account.type))
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
SectionHeader("Unterstützt")
|
||||
|
||||
Column(Modifier.padding(top = 8.dp)) {
|
||||
FormListItem("Kontostand abrufen", true, account.supportsBalanceRetrieval, "Unterstützt das Abrufen des Kontostandes")
|
||||
FormListItem("Kontoumsätze abrufen", true, account.supportsTransactionRetrieval, "Unterstützt das Abrufen der Kontoumsätze")
|
||||
FormListItem("Überweisen", true, account.supportsMoneyTransfer, "Unterstützt Überweisungen")
|
||||
FormListItem("Echtzeitüberweisung", true, account.supportsInstantTransfer, "Unterstützt Echtzeitüberweisungen")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@ import androidx.compose.runtime.*
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import net.codinux.banking.dataaccess.entities.BankAccessEntity
|
||||
import net.codinux.banking.ui.config.DI
|
||||
import net.codinux.banking.ui.extensions.verticalScroll
|
||||
import net.codinux.banking.ui.forms.*
|
||||
|
||||
|
@ -56,7 +57,9 @@ fun BankSettingsScreen(bank: BankAccessEntity, onClosed: () -> Unit) {
|
|||
|
||||
Column(Modifier.padding(top = 8.dp)) {
|
||||
bank.accounts.sortedBy { it.displayIndex }.forEach { account ->
|
||||
FormListItem(account.displayName)
|
||||
FormListItem(account.displayName, itemHeight = 42.dp) {
|
||||
DI.uiState.showBankAccountSettingsScreenForAccount.value = account
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.codinux.banking.client.model.tan.EnterTanResult
|
|||
import net.codinux.banking.client.model.tan.TanChallenge
|
||||
import net.codinux.banking.dataaccess.entities.HoldingEntity
|
||||
import net.codinux.banking.dataaccess.entities.BankAccessEntity
|
||||
import net.codinux.banking.dataaccess.entities.BankAccountEntity
|
||||
import net.codinux.banking.ui.model.*
|
||||
import net.codinux.banking.ui.model.error.ApplicationError
|
||||
import net.codinux.banking.ui.model.error.BankingClientError
|
||||
|
@ -58,6 +59,8 @@ class UiState : ViewModel() {
|
|||
|
||||
val showBankSettingsScreenForBank = MutableStateFlow<BankAccessEntity?>(null)
|
||||
|
||||
val showBankAccountSettingsScreenForAccount = MutableStateFlow<BankAccountEntity?>(null)
|
||||
|
||||
val showExportScreen = MutableStateFlow(false)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue