Compare commits
2 commits
763fd3f646
...
8b4e07d66e
Author | SHA1 | Date | |
---|---|---|---|
8b4e07d66e | |||
420387cdb7 |
1 changed files with 8 additions and 4 deletions
12
public/js/productos.js
vendored
12
public/js/productos.js
vendored
|
@ -144,7 +144,7 @@ Vue.component('producto-container', {
|
|||
</button>
|
||||
</p>
|
||||
<p class="control">
|
||||
<input id="cantidad" class="input" type="number" :value=cant style="text-align: center">
|
||||
<input id="cantidad" class="input" type="number" v-model.number="cant" style="text-align: center">
|
||||
</p>
|
||||
<p class="control">
|
||||
<button class="button" @click="cant++">
|
||||
|
@ -159,7 +159,7 @@ Vue.component('producto-container', {
|
|||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<!-- Habría que ver si cambiar el botón cuando al cantidad es 0 -->
|
||||
<button class="button is-success" @click="agregarProducto">Agregar a la chismosa</button>
|
||||
<button class="button is-success" :disabled="cant <= 0" @click="agregarProducto">Agregar a la chismosa</button>
|
||||
<button class="button" @click.capture="cerrar">Cancelar</button>
|
||||
</footer>
|
||||
</div>
|
||||
|
@ -186,8 +186,12 @@ Vue.component('producto-container', {
|
|||
Event.$emit("migas-pop");
|
||||
},
|
||||
agregarProducto() {
|
||||
Event.$emit("sync-subpedido", this.cant, this.producto.id);
|
||||
this.cerrar();
|
||||
if (this.cant < 0) alert("No se puede agregar cantidades negativas")
|
||||
else if (!Number.isInteger(this.cant)) alert("Las cantidades deben ser números enteros")
|
||||
else {
|
||||
Event.$emit("sync-subpedido", this.cant, this.producto.id);
|
||||
this.cerrar();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
Loading…
Add table
Reference in a new issue