diff --git a/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj b/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj index 4c3cb019..593fcf89 100644 --- a/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj +++ b/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 36BCF88524C098C8005BEC29 /* BankAccountListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36BCF88424C098C8005BEC29 /* BankAccountListItem.swift */; }; 36BCF88724C0A310005BEC29 /* PreviewData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36BCF88624C0A310005BEC29 /* PreviewData.swift */; }; 36BCF88924C0A7D7005BEC29 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36BCF88824C0A7D7005BEC29 /* Message.swift */; }; + 36BCF88B24C0BD2D005BEC29 /* AccountTransactionsDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36BCF88A24C0BD2D005BEC29 /* AccountTransactionsDialog.swift */; }; 36E7BA1424B3D05C00757859 /* ViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E7BA1324B3D05C00757859 /* ViewExtensions.swift */; }; 36FC929C24B39A05002B12E9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36FC929B24B39A05002B12E9 /* AppDelegate.swift */; }; 36FC929E24B39A05002B12E9 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36FC929D24B39A05002B12E9 /* SceneDelegate.swift */; }; @@ -101,6 +102,7 @@ 36BCF88424C098C8005BEC29 /* BankAccountListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankAccountListItem.swift; sourceTree = ""; }; 36BCF88624C0A310005BEC29 /* PreviewData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewData.swift; sourceTree = ""; }; 36BCF88824C0A7D7005BEC29 /* Message.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = ""; }; + 36BCF88A24C0BD2D005BEC29 /* AccountTransactionsDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTransactionsDialog.swift; sourceTree = ""; }; 36E7BA1324B3D05C00757859 /* ViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = ""; }; 36E7BA1824B9E70C00757859 /* xcode-frameworks */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "xcode-frameworks"; path = "../../tools/BankFinder/build/xcode-frameworks"; sourceTree = ""; }; 36FC929824B39A05002B12E9 /* BankingiOSApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankingiOSApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -278,6 +280,7 @@ 36FC92EE24B3BB81002B12E9 /* AddAccountDialog.swift */, 36BCF88224C098BB005BEC29 /* BankListItem.swift */, 36BCF88424C098C8005BEC29 /* BankAccountListItem.swift */, + 36BCF88A24C0BD2D005BEC29 /* AccountTransactionsDialog.swift */, ); path = views; sourceTree = ""; @@ -450,6 +453,7 @@ 36BCF88124BFAB4A005BEC29 /* DependendTestEntity.swift in Sources */, 36BCF86324BA5097005BEC29 /* SwiftUiRouter.swift in Sources */, 36FC929C24B39A05002B12E9 /* AppDelegate.swift in Sources */, + 36BCF88B24C0BD2D005BEC29 /* AccountTransactionsDialog.swift in Sources */, 36BCF87B24BFA87E005BEC29 /* Extensions.swift in Sources */, 36BCF87624BF114F005BEC29 /* UrlSessionWebClient.swift in Sources */, 36FC92A324B39A05002B12E9 /* ContentView.swift in Sources */, diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift new file mode 100644 index 00000000..73780ab2 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionsDialog.swift @@ -0,0 +1,45 @@ +import SwiftUI +import BankingUiSwift + + +struct AccountTransactionsDialog: View { + + var title: String + + var transactions: [BUCAccountTransaction] + + + @Inject private var presenter: BankingPresenterSwift + + + var body: some View { + List(transactions, id: \.id) { 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) + } + } + } + .navigationBarTitle(Text(title), displayMode: NavigationBarItem.TitleDisplayMode.inline) + } +} + + +struct AccountTransactionsDialog_Previews: PreviewProvider { + static var previews: some View { + AccountTransactionsDialog(title: previewBanks[0].displayName, transactions: [ + BUCAccountTransaction(bankAccount: previewBanks[0].accounts[0], amount: CommonBigDecimal(double: 1234.56), currency: "€", unparsedUsage: "Usage", bookingDate: CommonDate(year: 2020, month: 5, day: 7), otherPartyName: "Marieke Musterfrau", otherPartyBankCode: nil, otherPartyAccountId: nil, bookingText: "SEPA Ueberweisung", valueDate: CommonDate(year: 2020, month: 5, day: 7)) + ]) + } +} \ No newline at end of file diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift index c819431e..26aead9a 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankAccountListItem.swift @@ -8,10 +8,12 @@ struct BankAccountListItem : View { var body: some View { - HStack { - Text(account.displayName) - Spacer() - }.frame(height: 35) + NavigationLink(destination: AccountTransactionsDialog(title: account.displayName, transactions: account.bookedTransactions)) { + HStack { + Text(account.displayName) + Spacer() + }.frame(height: 35) + } } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift index 803b0c81..55443c28 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankListItem.swift @@ -8,16 +8,18 @@ struct BankListItem : View { var body: some View { - VStack(alignment: .leading) { - HStack { - Text(bank.displayName) - Spacer() - }.frame(height: 35) - - List(bank.accounts, id: \.id) { account in - return BankAccountListItem(account: account) - } - }.frame(minHeight: 70) + NavigationLink(destination: AccountTransactionsDialog(title: bank.displayName, transactions: bank.accounts.flatMap { $0.bookedTransactions })) { + VStack(alignment: .leading) { + HStack { + Text(bank.displayName) + Spacer() + }.frame(height: 35) + + List(bank.accounts, id: \.id) { account in + return BankAccountListItem(account: account) + } + }.frame(minHeight: 70) + } } }