Merge branch 'dillon/138-fix-generate-summary-invoice-issue' into vapor/production

This commit is contained in:
Dillon Ngo
2026-02-23 03:22:58 +08:00
@@ -64,7 +64,10 @@
<div class="row" v-if="selectedInvoice.length">
<div class="col">
<div v-if="section === 'customerPendingPaymentInvoiceComponent'" class="btn btn-success btn-xl pointer m-t-10 w-100 requestModal" @click="handleMakePaymentClick" data-type="makePayment">Make Payment</div>
<div v-if="['customerPaidInvoiceComponent', 'customerPendingPaymentInvoiceComponent'].includes(section)" class="btn btn-info btn-xl pointer m-t-10 w-100" @click='generateSummaryInvoice'>Generate Summary Invoice</div>
<div v-if="['customerPaidInvoiceComponent', 'customerPendingPaymentInvoiceComponent'].includes(section)" class="btn btn-info btn-xl m-t-10 w-100" :class="{'disabled': isDownloading, 'pointer': !isDownloading}" @click='generateSummaryInvoice'>
Generate Summary Invoice
<span v-if="isDownloading" class="spinner fa fa-spinner fa-spin"></span>
</div>
</div>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="makePayment">
@@ -122,6 +125,7 @@
showPaymentProceedModal: false,
showPaymentOutdatedModal: false,
selectedShippingInvoicesOnlyIds: [],
isDownloading: false,
}
},
computed: {
@@ -142,6 +146,8 @@
},
methods: {
generateSummaryInvoice(){
if (this.isDownloading) return;
this.isDownloading = true;
let url = this.route('invoice.combined_summary', JSON.stringify(this.selectedIds));
if(window.LARAVEL_VAPOR_ENABLED){
this.$store.dispatch('crudRequest', {endpoint: url, method: 'get'})
@@ -149,6 +155,7 @@
{
let success = response.ok;
response.json().then(response => {
this.isDownloading = false;
if(!success){return;}
if (response.src) {
// window.location.href = response.src;
@@ -156,10 +163,13 @@
}
});
}
);
).catch(() => {
this.isDownloading = false;
});
}
else{
window.open(url, '_blank');
this.isDownloading = false;
}
},
makePayment(){