diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift new file mode 100644 index 00000000..ba2f4d97 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift @@ -0,0 +1,37 @@ +import SwiftUI +import BankingUiSwift + + +struct AccountTransactionListItem: View { + + let transaction: AccountTransaction + + + @Inject private var presenter: BankingPresenterSwift + + + var body: some View { + HStack { + VStack(alignment: .leading) { + Text(transaction.bookingText ?? "") + if transaction.showOtherPartyName { + Text(transaction.otherPartyName ?? "") + } + Text(transaction.usage) + } + + Spacer() + + VStack(alignment: .trailing) { + Text(self.presenter.formatAmount(amount: transaction.amount)) + //Text(transaction.valueDate) + } + } + } +} + +struct AccountTransactionListItem_Previews: PreviewProvider { + static var previews: some View { + AccountTransactionListItem(transaction: AccountTransaction(bankAccount: previewBanks[0].accounts[0], otherPartyName: "Marieke Musterfrau", unparsedUsage: "Vielen Dank für Ihre Mühen", amount: CommonBigDecimal(double: 1234.56), valueDate: CommonDate(year: 2020, month: .march, day_: 27), bookingText: "SEPA Überweisung")) + } +} diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift index d995ac87..cd83ab02 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift @@ -14,22 +14,7 @@ struct AccountTransactionsDialog: View { var body: some View { List(transactions.sorted(by: { $0.valueDate.date > $1.valueDate.date } ), id: \.technicalId) { transaction in - HStack { - VStack(alignment: .leading) { - Text(transaction.bookingText ?? "") - if transaction.showOtherPartyName { - Text(transaction.otherPartyName ?? "") - } - Text(transaction.usage) - } - - Spacer() - - VStack(alignment: .trailing) { - Text(self.presenter.formatAmount(amount: transaction.amount)) - //Text(transaction.valueDate) - } - } + AccountTransactionListItem(transaction: transaction) } .showNavigationBarTitle(LocalizedStringKey(title)) .navigationBarHidden(false)