diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccessEntity.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccessEntity.kt index fcad5a6..a74af83 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccessEntity.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/entities/BankAccessEntity.kt @@ -55,4 +55,14 @@ class BankAccessEntity( bank.iconUrl, bank.wrongCredentialsEntered, ) + + override val accountsSorted: List + get() = accounts.sortedBy { it.displayIndex } + + override val tanMethodsSorted: List + get() = tanMethods.sortedBy { it.identifier } + + override val tanMediaSorted: List + get() = tanMedia.sortedBy { it.status } + } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/composables/BanksList.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/composables/BanksList.kt index 4cb5a44..aed18b3 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/composables/BanksList.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/composables/BanksList.kt @@ -44,7 +44,7 @@ fun BanksList( accountSelected?.invoke(bank, null) } - bank.accounts.sortedBy { it.displayIndex }.forEach { account -> + bank.accountsSorted.forEach { account -> NavigationMenuItem(itemModifier, account.displayName, textColor, iconSize, IconTextSpacing, itemHorizontalPadding, bankAccount = account) { accountSelected?.invoke(bank, account) } diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt index 73bbb86..60a4a6c 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/TransferMoneyDialog.kt @@ -40,7 +40,7 @@ fun TransferMoneyDialog( ) { val banks = uiState.banks.value val accountsToBank = banks.sortedBy { it.displayIndex } - .flatMap { bank -> bank.accounts.sortedBy { it.displayIndex }.map { it to bank } }.toMap() + .flatMap { bank -> bank.accountsSorted.map { it to bank } }.toMap() val accountsSupportingTransferringMoney = banks.flatMap { it.accounts } .filter { it.supportsMoneyTransfer } diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/BankSettingsScreen.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/BankSettingsScreen.kt index fee28b1..d2b0a6c 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/BankSettingsScreen.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/BankSettingsScreen.kt @@ -56,7 +56,7 @@ fun BankSettingsScreen(bank: BankAccessEntity, onClosed: () -> Unit) { SectionHeader("Konten") Column(Modifier.padding(top = 8.dp)) { - bank.accounts.sortedBy { it.displayIndex }.forEach { account -> + bank.accountsSorted.forEach { account -> FormListItem(account.displayName, itemHeight = 42.dp) { DI.uiState.showBankAccountSettingsScreenForAccount.value = account } @@ -80,7 +80,7 @@ fun BankSettingsScreen(bank: BankAccessEntity, onClosed: () -> Unit) { SectionHeader("TAN Verfahren") Column(Modifier.padding(top = 8.dp)) { - bank.tanMethods.sortedBy { it.identifier }.forEach { tanMethod -> + bank.tanMethodsSorted.forEach { tanMethod -> SelectableFormListItem(tanMethod.displayName, tanMethod == bank.selectedTanMethod, "TAN Verfahren ist ausgewähltes TAN Verfahren") } } @@ -91,7 +91,7 @@ fun BankSettingsScreen(bank: BankAccessEntity, onClosed: () -> Unit) { SectionHeader("TAN Medien") Column(Modifier.padding(top = 8.dp)) { - bank.tanMedia.sortedBy { it.status }.forEach { tanMedium -> + bank.tanMediaSorted.forEach { tanMedium -> SelectableFormListItem(tanMedium.displayName, tanMedium == bank.selectedTanMedium, "TAN Medium ist ausgewähltes TAN Medium") } }