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>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
<p class="control">
|
<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>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<button class="button" @click="cant++">
|
<button class="button" @click="cant++">
|
||||||
|
@ -159,7 +159,7 @@ Vue.component('producto-container', {
|
||||||
</section>
|
</section>
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<!-- Habría que ver si cambiar el botón cuando al cantidad es 0 -->
|
<!-- 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>
|
<button class="button" @click.capture="cerrar">Cancelar</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
@ -186,8 +186,12 @@ Vue.component('producto-container', {
|
||||||
Event.$emit("migas-pop");
|
Event.$emit("migas-pop");
|
||||||
},
|
},
|
||||||
agregarProducto() {
|
agregarProducto() {
|
||||||
Event.$emit("sync-subpedido", this.cant, this.producto.id);
|
if (this.cant < 0) alert("No se puede agregar cantidades negativas")
|
||||||
this.cerrar();
|
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() {
|
mounted() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue