@@ -154,7 +141,8 @@
import ModalDialog from './Widgets/ModalDialog'
import TransactionLog from './Widgets/TransactionLog'
import PaymentLog from './Widgets/PaymentLog'
- import { downloadFile, paymentCheckout } from '../js/utils'
+ import ReceiptList from './Widgets/ReceiptList'
+ import { paymentCheckout } from '../js/utils'
import { library } from '@fortawesome/fontawesome-svg-core'
@@ -170,7 +158,8 @@
components: {
ModalDialog,
TransactionLog,
- PaymentLog
+ PaymentLog,
+ ReceiptList
},
data() {
return {
@@ -182,6 +171,7 @@
receipts: [],
loadTransactions: false,
loadPayments: false,
+ loadReceipts: true,
showPendingPayments: false,
wallet: {},
walletId: null,
@@ -242,6 +232,7 @@
this.$refs.tabs.clickHandler('history', () => { this.loadTransactions = true })
this.$refs.tabs.clickHandler('payments', () => { this.loadPayments = true })
+ this.$refs.tabs.clickHandler('receipts', () => { this.loadReceipts = true })
},
methods: {
loadMandate() {
@@ -375,10 +366,6 @@
this.$refs.paymentDialog.show()
},
- receiptDownload() {
- const receipt = $('#receipt-id').val()
- downloadFile('/api/v4/wallets/' + this.walletId + '/receipts/' + receipt)
- }
}
}
diff --git a/src/resources/vue/Widgets/ReceiptList.vue b/src/resources/vue/Widgets/ReceiptList.vue
new file mode 100644
--- /dev/null
+++ b/src/resources/vue/Widgets/ReceiptList.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+ {{ $t('form.date') }} |
+ {{ $t('form.amount') }} |
+ |
+
+
+
+
+ {{ receipt.period }} |
+ {{ amount(receipt) }} |
+
+ {{ $t('btn.download') }}
+ |
+
+
+
+
+
+
+
+
+
+
diff --git a/src/tests/Browser/WalletTest.php b/src/tests/Browser/WalletTest.php
--- a/src/tests/Browser/WalletTest.php
+++ b/src/tests/Browser/WalletTest.php
@@ -112,9 +112,7 @@
->assertSeeIn('@nav #tab-receipts', 'Receipts')
->with('@receipts-tab', function (Browser $browser) {
$browser->waitUntilMissing('.app-loader')
- ->assertSeeIn('p', 'There are no receipts for payments')
- ->assertDontSeeIn('p', 'Here you can download')
- ->assertMissing('select')
+ ->assertSeeIn('td', 'There are no receipts for payments')
->assertMissing('button');
});
});
@@ -162,16 +160,14 @@
->assertSeeIn('@nav #tab-receipts', 'Receipts')
->with('@receipts-tab', function (Browser $browser) use ($receipts) {
$browser->waitUntilMissing('.app-loader')
- ->assertDontSeeIn('p', 'There are no receipts for payments')
- ->assertSeeIn('p', 'Here you can download')
- ->assertSeeIn('button', 'Download')
- ->assertElementsCount('select > option', 2)
- ->assertSeeIn('select > option:nth-child(1)', $receipts[1])
- ->assertSeeIn('select > option:nth-child(2)', $receipts[0]);
+ ->assertElementsCount('table tbody tr', 2)
+ ->assertMissing('.more-loader button', 'Load more')
+ ->assertSeeIn('table tbody tr:nth-child(1) td.datetime', $receipts[1])
+ ->assertSeeIn('table tbody tr:nth-child(2) td.datetime', $receipts[0]);
// Download a receipt file
- $browser->select('select', $receipts[0])
- ->click('button')
+ $browser->click('table tbody tr:nth-child(2) td.selection button')
+ ->waitUntilMissing('.app-loader')
->pause(2000);
$files = glob(__DIR__ . '/downloads/*.pdf');
diff --git a/src/tests/Feature/Controller/WalletsTest.php b/src/tests/Feature/Controller/WalletsTest.php
--- a/src/tests/Feature/Controller/WalletsTest.php
+++ b/src/tests/Feature/Controller/WalletsTest.php
@@ -193,7 +193,7 @@
$this->assertCount(5, $json);
$this->assertSame('success', $json['status']);
- $this->assertSame([$date->format('Y-m')], $json['list']);
+ $this->assertSame(['period' => $date->format('Y-m'), 'amount' => '1111', 'currency' => 'CHF'], $json['list'][0]);
$this->assertSame(1, $json['page']);
$this->assertSame(1, $json['count']);
$this->assertSame(false, $json['hasMore']);