69 lines
1.6 KiB
Vue
69 lines
1.6 KiB
Vue
<template>
|
|
<div>
|
|
<h4 class="is-size-4 mb-2">Gustavo Baz Prada</h4>
|
|
|
|
<b-field label="Año:">
|
|
<b-select v-model="selectedYearGustavoBaz" expanded>
|
|
<option value="" disabled>Seleccione un año:</option>
|
|
|
|
<option v-for="(y, i) in years" :key="i" :value="y">
|
|
{{ y }}
|
|
</option>
|
|
</b-select>
|
|
</b-field>
|
|
|
|
<b-field class="pb-5 pt-3">
|
|
<b-button
|
|
type="is-info"
|
|
@click="descargar()"
|
|
:disabled="!selectedYearGustavoBaz"
|
|
>
|
|
Descargar Excel
|
|
</b-button>
|
|
</b-field>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import fileDownload from 'js-file-download'
|
|
|
|
export default {
|
|
props: {
|
|
years: { type: Array, required: true },
|
|
admin: { type: Object, required: true },
|
|
imprimirError: { type: Function, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
selectedYearGustavoBaz: '',
|
|
}
|
|
},
|
|
methods: {
|
|
descargar() {
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.get(
|
|
`${process.env.api}/servicio/gustavo_baz_prada?year=${this.selectedYearGustavoBaz}`,
|
|
this.admin.token
|
|
)
|
|
.then((res) => {
|
|
fileDownload(
|
|
res.data,
|
|
`${this.selectedYearGustavoBaz}_gustavo_baz_prada.csv`
|
|
)
|
|
this.selectedYearGustavoBaz = ''
|
|
this.updateIsLoading(false)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.imprimirError(err.response.data)
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped></style>
|