Cambiada logica de deshabilitacion de botones de - y de confirmar para que dependa de la cantidad pedida en el barrio
This commit is contained in:
parent
deea20904b
commit
ca4dd862d0
1 changed files with 15 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="is-justify-content-center">
|
<div class="is-justify-content-center">
|
||||||
<div class="field has-addons is-justify-content-center contador">
|
<div class="field has-addons is-justify-content-center contador">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button class="button is-small" :disabled="cantidadControl < 1" v-if="!aprobado" @click.capture="decrementar();">
|
<button class="button is-small" :disabled="!puedeDecrementar" v-if="!aprobado" @click.capture="decrementar();">
|
||||||
<i class="fa fa-solid fa-minus"></i>
|
<i class="fa fa-solid fa-minus"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<i class="fa fa-solid fa-plus"></i>
|
<i class="fa fa-solid fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button :disabled="!hayCambios || cantidadControl < 0" v-if="!aprobado" class="button is-small is-success ml-1" @click="confirmar()">
|
<button :disabled="!puedeConfirmar" v-if="!aprobado" class="button is-small is-success ml-1" @click="confirmar()">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i class="fas fa-check"></i>
|
<i class="fas fa-check"></i>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -82,8 +82,13 @@ export default {
|
||||||
this.actualizar();
|
this.actualizar();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState('login', ["rol"]),
|
||||||
...mapState('pedido', ["aprobado"]),
|
...mapState('pedido', ["aprobado"]),
|
||||||
...mapGetters('pedido', ["enChismosa", "cantidad", "notas"]),
|
...mapGetters('pedido', ["enChismosa", "cantidad", "notas"]),
|
||||||
|
...mapGetters('admin', ["cantidadBarrial"]),
|
||||||
|
cantidadTotal() {
|
||||||
|
return this.cantidadBarrial(this.producto_id);
|
||||||
|
},
|
||||||
cantidadEnChismosa() {
|
cantidadEnChismosa() {
|
||||||
return this.cantidad(this.producto_id);
|
return this.cantidad(this.producto_id);
|
||||||
},
|
},
|
||||||
|
|
@ -99,6 +104,14 @@ export default {
|
||||||
faltaNotas() {
|
faltaNotas() {
|
||||||
return this.requiere_notas && this.cantidadControl > 0 && !this.notasControl;
|
return this.requiere_notas && this.cantidadControl > 0 && !this.notasControl;
|
||||||
},
|
},
|
||||||
|
puedeDecrementar() {
|
||||||
|
const min = this.rol === "admin_barrio" ? -1*this.cantidadTotal : 0;
|
||||||
|
return this.cantidadControl > min;
|
||||||
|
},
|
||||||
|
puedeConfirmar() {
|
||||||
|
const min = this.rol === "admin_barrio" ? -1*this.cantidadTotal : 0;
|
||||||
|
return this.hayCambios && this.cantidadControl >= min;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('pedido', ["modificarChismosa"]),
|
...mapActions('pedido', ["modificarChismosa"]),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue