Apartado del CSV y arreglo de bugs
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="columns">
|
||||
<b-field class="column" label="Fecha inicio">
|
||||
<b-datepicker
|
||||
v-model="inicio"
|
||||
:min-date="minDate1"
|
||||
:max-date="maxDate"
|
||||
icon="calendar-today"
|
||||
rounded
|
||||
>
|
||||
</b-datepicker>
|
||||
</b-field>
|
||||
|
||||
<b-field class="column" label="Fecha fin">
|
||||
<b-datepicker
|
||||
v-model="fin"
|
||||
:min-date="minDate2"
|
||||
:max-date="maxDate"
|
||||
icon="calendar-today"
|
||||
rounded
|
||||
>
|
||||
</b-datepicker>
|
||||
</b-field>
|
||||
</div>
|
||||
|
||||
<div class="has-text-centered">
|
||||
<b-button type="is-link" @click="pedirReporte()">Descargar</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import fileDownload from 'js-file-download'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
updateIsLoading: { type: Function, require: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
minDate1: new Date('2022-01-01'),
|
||||
minDate2: new Date(),
|
||||
maxDate: new Date(),
|
||||
|
||||
inicio: new Date(),
|
||||
fin: new Date(),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pedirReporte() {
|
||||
console.log(this.inicio)
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/admin/reporte?inicio=${this.inicio}&fin=${this.fin}&tipo='csv'`
|
||||
)
|
||||
.then((res) => {
|
||||
fileDownload(res.data, `reporte.csv`)
|
||||
this.updateIsLoading(false)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
this.updateIsLoading(false)
|
||||
// this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -156,7 +156,7 @@ export default {
|
||||
methods: {
|
||||
inscribir() {
|
||||
let formData = new FormData()
|
||||
if (this.monto < 20 && this.inscripcionesUsuario.length > 0)
|
||||
if (this.monto && this.monto < 20 && this.inscripcionesUsuario.length > 0)
|
||||
this.error = true
|
||||
if (!this.error) {
|
||||
formData.append('idUsuario', this.datosUsuario.idUsuario)
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<!-- <section class="box">
|
||||
<p class="subtitle is-3">Asignar fechas de inscripción</p>
|
||||
|
||||
<FechasInscripcion />
|
||||
</section> -->
|
||||
<b-tabs v-model="activeTab">
|
||||
<b-tab-item label="Tabla de tickets">
|
||||
<TableTickets />
|
||||
@@ -13,6 +8,10 @@
|
||||
<b-tab-item label="Reportes">
|
||||
<Reporte :updateIsLoading="updateIsLoading" />
|
||||
</b-tab-item>
|
||||
|
||||
<b-tab-item label="Generar CSV">
|
||||
<GenerarCSV :updateIsLoading="updateIsLoading" />
|
||||
</b-tab-item>
|
||||
</b-tabs>
|
||||
</div>
|
||||
</template>
|
||||
@@ -20,12 +19,14 @@
|
||||
<script>
|
||||
import TableTickets from '~/components/admin/tableTickets.vue'
|
||||
import Reporte from '~/components/admin/reporte.vue'
|
||||
import GenerarCSV from '~/components/admin/CSV.vue'
|
||||
import FechasInscripcion from '~/components/admin/fechasInscripcion.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TableTickets,
|
||||
Reporte,
|
||||
GenerarCSV,
|
||||
FechasInscripcion,
|
||||
},
|
||||
data() {
|
||||
|
||||
Reference in New Issue
Block a user