fix(Purchase): validation of form.
This commit is contained in:
parent
2d86aba3e5
commit
f1b8cbdce1
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-form ref="form" v-model="valid">
|
||||
<v-form ref="purchase" v-model="valid" >
|
||||
<v-row>
|
||||
<v-col>
|
||||
<v-autocomplete
|
||||
@ -123,6 +123,8 @@
|
||||
item-title="text"
|
||||
item-value="value"
|
||||
label="Pago en"
|
||||
:rules="[rules.required]"
|
||||
required
|
||||
></v-select>
|
||||
<v-btn @click="openCasherModal" v-if="purchase.payment_method === 'CASH'">Calcular Devuelta</v-btn>
|
||||
<CasherModal :total_purchase="calculateTotal" ref="casherModal"</CasherModal>
|
||||
@ -276,9 +278,10 @@
|
||||
return line.unit_price * line.quantity;
|
||||
},
|
||||
async submit() {
|
||||
if (this.$refs.form.validate()) {
|
||||
const hasInvalidQuantity = this.purchase.saleline_set.some(line => line.quantity <= 0);
|
||||
if (hasInvalidQuantity) {
|
||||
this.$refs.purchase.validate();
|
||||
if (this.valid) {
|
||||
const hasInvalidQuantity = this.purchase.saleline_set.some(line => line.quantity <= 0);
|
||||
if (hasInvalidQuantity) {
|
||||
this.errorMessage = 'La cantidad de cada línea de compra debe ser mayor que cero.';
|
||||
|
||||
console.log(this.errorMessage);
|
||||
|
Loading…
Reference in New Issue
Block a user