Deshabilita botones de eportar pedido barrial e imprimir planillas cuando no hay subpedidos aprobados

This commit is contained in:
nat 2022-11-08 15:55:49 -03:00
parent 85f0a5a06b
commit f67232f55c
1 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="container is-max-widescreen is-max-desktop animate__animated" :class="animation" v-show="!init"> <div class="container is-max-widescreen is-max-desktop animate__animated" :class="animation" v-show="!init">
<div class="buttons is-right"> <div class="buttons is-right">
<a class="button is-success" :href="'/admin/exportar-pedido-a-csv/'+gdc"> <a class="button is-success" :href="hayAprobados ? '/admin/exportar-pedido-a-csv/'+gdc : '#'" :disabled="!hayAprobados">
<span> <span>
Exportar pedido barrial Exportar pedido barrial
</span> </span>
@ -9,7 +9,7 @@
<i class="fas fa-download"></i> <i class="fas fa-download"></i>
</span> </span>
</a> </a>
<a class="button is-info" :href="'/admin/exportar-planillas-a-pdf/'+gdc"> <a class="button is-info" :href="hayAprobados ? '/admin/exportar-planillas-a-pdf/'+gdc : '#'" :disabled="!hayAprobados">
<span> <span>
Imprimir Planillas Imprimir Planillas
</span> </span>
@ -56,6 +56,11 @@ export default {
subpedidos: [] subpedidos: []
} }
}, },
computed: {
hayAprobados: function() {
return this.subpedidos.filter(sp => sp.aprobado).length > 0
}
},
beforeCreate() { beforeCreate() {
axios.get("/admin/obtener_sesion").then(response => { axios.get("/admin/obtener_sesion").then(response => {
this.gdc = response.data.gdc; this.gdc = response.data.gdc;