Only showing account selection box if there are any SEPA accounts

This commit is contained in:
dankito 2024-10-04 01:26:10 +02:00
parent c89220bc0c
commit 5d00bbf77e
1 changed files with 25 additions and 23 deletions

View File

@ -101,32 +101,34 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) {
} }
Select( if (accountsWithIban.size > 1) {
"Für Konto", Select(
accountsWithIban, "Für Konto",
selectedAccount, accountsWithIban,
{ account -> selectedAccount,
selectedAccount = account { account ->
selectedAccount = account
if (account != null) { if (account != null) {
iban = account.iban ?: "" iban = account.iban ?: ""
bic = banks.firstOrNull { it.id == selectedAccount?.bankId }?.bic ?: "" bic = banks.firstOrNull { it.id == selectedAccount?.bankId }?.bic ?: ""
receiverName = account.accountHolderName receiverName = account.accountHolderName
amountFocus.requestFocus() amountFocus.requestFocus()
} }
}, },
{ account -> account?.displayName ?: "" }, { account -> account?.displayName ?: "" },
leadingIcon = bankOfSelectedAccount?.let { { BankIcon(bankOfSelectedAccount) } }, leadingIcon = bankOfSelectedAccount?.let { { BankIcon(bankOfSelectedAccount) } },
dropDownItemContent = { account -> dropDownItemContent = { account ->
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
BankIcon(banks.firstOrNull { it.id == account?.bankId }, Modifier.padding(end = 6.dp)) BankIcon(banks.firstOrNull { it.id == account?.bankId }, Modifier.padding(end = 6.dp))
Text(account?.displayName ?: "") Text(account?.displayName ?: "")
} }
}, },
modifier = Modifier.fillMaxWidth().padding(top = 16.dp, bottom = 8.dp) modifier = Modifier.fillMaxWidth().padding(top = 16.dp, bottom = 8.dp)
) )
}
OutlinedTextField( OutlinedTextField(
label = { Text("Empfänger*in") }, label = { Text("Empfänger*in") },