Ability to download the statement

This commit is contained in:
Benjamin Beganović 2021-09-21 14:30:51 +02:00
parent 289c4952a0
commit 42daa83a9c
2 changed files with 10 additions and 1 deletions

View File

@ -80,6 +80,15 @@ class Statement {
handle() { handle() {
this.bindEventListeners(); this.bindEventListeners();
document
.querySelector('#pdf-download')
.addEventListener('click', () => {
let url = new URL(this.composedUrl);
url.searchParams.append('download', 1);
window.location.href = url.href;
})
} }
} }

View File

@ -31,7 +31,7 @@
<span class="ml-2">{{ ctrans('texts.show_aging') }}</span> <span class="ml-2">{{ ctrans('texts.show_aging') }}</span>
</label> <!-- End show aging checkbox --> </label> <!-- End show aging checkbox -->
</div> </div>
<button class="button button-primary bg-primary mt-4 md:mt-0">{{ ctrans('texts.download') }}</button> <button id="pdf-download" class="button button-primary bg-primary mt-4 md:mt-0">{{ ctrans('texts.download') }}</button>
</div> </div>
@include('portal.ninja2020.components.pdf-viewer', ['url' => route('client.statement.raw')]) @include('portal.ninja2020.components.pdf-viewer', ['url' => route('client.statement.raw')])