Merge branch 'marco' of https://repositorio.acatlan.unam.mx/CIDWA/servicio_social_front into dev
This commit is contained in:
@@ -47,6 +47,82 @@
|
||||
disabled
|
||||
>Descargar archivo</b-button
|
||||
>
|
||||
|
||||
<p class="is-size-2 mb-5">Descargar reportes</p>
|
||||
|
||||
<p class="is-size-3">Seleccione una fecha de inicio:</p>
|
||||
<b-datepicker
|
||||
v-model="selectedInicio"
|
||||
class="my-5"
|
||||
placeholder="Seleccione una fecha de inicio"
|
||||
:min-date="minDate"
|
||||
icon="calendar-today"
|
||||
trap-focus
|
||||
>
|
||||
</b-datepicker>
|
||||
<p class="is-size-3">Seleccione una fecha de fin:</p>
|
||||
<b-datepicker
|
||||
class="my-5"
|
||||
v-model="selectedFin"
|
||||
:max-date="maxDate"
|
||||
placeholder="Seleccione una fecha de fin"
|
||||
icon="calendar-today"
|
||||
trap-focus
|
||||
>
|
||||
</b-datepicker>
|
||||
|
||||
<b-button
|
||||
class="is-info mb-5"
|
||||
v-if="selectedInicio && selectedFin"
|
||||
@click="crearReporte()"
|
||||
>Crear reporte</b-button
|
||||
>
|
||||
<b-button class="is-info mb-5" v-else disabled>Crear reporte</b-button>
|
||||
<a :href="link2" target="_blank">
|
||||
<b-button
|
||||
class="is-info mb-5"
|
||||
v-if="selectedInicio && selectedFin && reporteListo"
|
||||
>Descargar reporte</b-button
|
||||
>
|
||||
</a>
|
||||
<b-button
|
||||
class="is-info"
|
||||
v-if="!(selectedInicio && selectedFin && reporteListo)"
|
||||
disabled
|
||||
>Descargar reporte</b-button
|
||||
>
|
||||
<p class="is-size-2 mb-5">Gustavo Baz Prada</p>
|
||||
<p class="is-size-3">Seleccione un año:</p>
|
||||
<b-select
|
||||
class="my-5 is-medium"
|
||||
v-model="selectedYearGustavoBaz"
|
||||
expanded
|
||||
placeholder="Seleccione un año: "
|
||||
>
|
||||
<option v-for="year in years" v-bind:key="year" :value="year">
|
||||
{{ year }}
|
||||
</option>
|
||||
</b-select>
|
||||
<b-button
|
||||
class="is-info mb-5"
|
||||
v-if="selectedYearGustavoBaz"
|
||||
@click="crearGustavoBaz()"
|
||||
>Crear Gustavo Baz</b-button
|
||||
>
|
||||
<b-button class="is-info mb-5" v-else disabled>Crear Gustavo Baz</b-button>
|
||||
<a :href="link3" target="_blank">
|
||||
<b-button
|
||||
class="is-info mb-5"
|
||||
v-if="selectedYearGustavoBaz && gustavoListo"
|
||||
>Descargar</b-button
|
||||
>
|
||||
</a>
|
||||
<b-button
|
||||
class="is-info"
|
||||
v-if="!(selectedYearGustavoBaz && gustavoListo)"
|
||||
disabled
|
||||
>Descargar</b-button
|
||||
>
|
||||
<b-loading
|
||||
:is-full-page="true"
|
||||
v-model="isLoading"
|
||||
@@ -66,9 +142,18 @@ export default {
|
||||
return {
|
||||
years: [],
|
||||
selectedYear: null,
|
||||
selectedYearGustavoBaz: null,
|
||||
selectedCuestionario: null,
|
||||
selectedInicio: null,
|
||||
selectedFin: null,
|
||||
botonDos: false,
|
||||
reporteListo: false,
|
||||
gustavoListo: false,
|
||||
minDate: new Date("January 1, 2020"),
|
||||
maxDate: new Date(),
|
||||
link: "",
|
||||
link2: "",
|
||||
link3: "",
|
||||
isLoading: false,
|
||||
token: {
|
||||
headers: {
|
||||
@@ -101,6 +186,42 @@ export default {
|
||||
this.isLoading = false;
|
||||
});
|
||||
},
|
||||
crearReporte() {
|
||||
this.isLoading = true;
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/servicio/reporte?inicio=${this.selectedInicio}&fin=${this.selectedFin}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.link2 = `${process.env.api}/reporte.csv`;
|
||||
this.reporteListo = true;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error(err.response.data.message);
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
},
|
||||
crearGustavoBaz() {
|
||||
this.isLoading = true;
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/servicio/gustavo_bas_prada?year=${this.selectedYearGustavoBaz}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.link3 = `${process.env.api}/${this.selectedYearGustavoBaz}_gustavo_baz_prada.csv`;
|
||||
this.gustavoListo = true;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error(err.response.data.message);
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
},
|
||||
error(msj) {
|
||||
let salir = false;
|
||||
switch (msj) {
|
||||
@@ -154,7 +275,7 @@ export default {
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
margin-bottom: 4%;
|
||||
margin-bottom: 10%;
|
||||
margin-top: 2%;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user