From 5f443aeadcaab3ef4aa16032e28b3fc23ad40cf1 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 22 Jun 2024 14:28:30 +0800 Subject: [PATCH] Export excel file from Laravel Vapor through S3 bucket --- .../CustomerTransactionSectionComponent.vue | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue b/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue index ab2577db..73616dd9 100644 --- a/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue +++ b/resources/assets/vue/components/wallets/elements/CustomerTransactionSectionComponent.vue @@ -14,7 +14,7 @@
@@ -122,7 +122,24 @@ export default { successHandler(response){ this.isLoading = false; this.company = response.payload.data; - } + }, + download(company, paramShowingPreciseAmount) { + let url = this.route('wallet.details-export', company.reference, paramShowingPreciseAmount); + if(window.LARAVEL_VAPOR_ENABLED){ + return fetch(url, { + method: 'GET', + responseType: 'json', + }).then(response => response.json()) + .then(response => { + if (response.src) { + window.location.href = response.src; + } + }); + } + else{ + window.open(url, '_blank'); + } + }, } }