Laravel Vapor - debug leadsData.xls cannot be exported, with new component to trigger download

This commit is contained in:
Dillon Ngo
2024-09-02 23:00:28 +08:00
parent dab70489b9
commit 87bc029187
2 changed files with 44 additions and 2 deletions
@@ -0,0 +1,41 @@
<template>
<span>
<a class="m-b-15" @click.prevent="handleClick">
<button class="btn btn-success btn-xs">
{{ displayText }}
</button>
</a>
</span>
</template>
<script>
export default {
props: {
url: {
type: String,
required: true,
},
displayText: {
type: String,
default: "Export Data", // Default text, can be overridden via prop
},
},
methods: {
handleClick(){
if(window.LARAVEL_VAPOR_ENABLED){
this.submit(this.url, 'get', this.section, false, false);
}
else{
window.open(this.url, '_blank');
}
},
successHandler(response) {
if(window.LARAVEL_VAPOR_ENABLED){
if (response.src) {
window.location.href = response.src;
}
}
},
},
};
</script>
@@ -264,9 +264,10 @@
<div class="row no-margin">
<div class="col bg-white padding-25">
<div class="row tabsContainer tabContent hide m-l-0 m-r-0 hide" tab-name="customer-leads" v-if="$store.getters.isAdmin">
<a :href="route('leads.export')" class="m-b-15" target="_blank">
<!-- <a :href="route('leads.export')" class="m-b-15" target="_blank">
<button class="btn btn-success btn-xs">Export Leads Data</button>
</a>
</a> -->
<open-link-in-new-tab-component :url="route('leads.export')" :displayText="'Export Leads Data'"></open-link-in-new-tab-component>
<list-component key="2" section="leadCustomerListSection" :endpoint="route('api.company.list')" :options="{'business_type': 2, with_bookings:true, without_confirmed_payments: true, does_not_have_segments: [5]}">
<template slot="list" slot-scope="{data}">
<company-component :data="data"></company-component>