Merge pull request 'vuetify_set_unit_price_automatically_#37' (#38) from vuetify_set_unit_price_automatically_#37 into main
Reviewed-on: OneTeam/don_confiao#38
This commit is contained in:
commit
78c81549a2
@ -45,6 +45,7 @@
|
||||
<v-select
|
||||
v-model="line.product"
|
||||
:items="products"
|
||||
@update:modelValue="onProductChange(index)"
|
||||
item-title="name"
|
||||
item-value="id"
|
||||
label="Producto"
|
||||
@ -58,7 +59,9 @@
|
||||
label="Precio"
|
||||
type="number"
|
||||
:rules="[rules.required]"
|
||||
prefix="$"
|
||||
required
|
||||
readonly
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col>
|
||||
@ -72,9 +75,12 @@
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
type="number"
|
||||
:value="calculateSubtotal(line)"
|
||||
label="Subtotal"
|
||||
prefix="$"
|
||||
readonly
|
||||
disable
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col>
|
||||
@ -91,6 +97,7 @@
|
||||
<v-text-field
|
||||
:value="calculateTotal"
|
||||
label="Total"
|
||||
prefix="$"
|
||||
readonly
|
||||
></v-text-field>
|
||||
<v-btn @click="submit" color="green">Comprar</v-btn>
|
||||
@ -138,6 +145,11 @@
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onProductChange(index) {
|
||||
const selectedProductId = this.purchase.saleline_set[index].product;
|
||||
const selectedProduct = this.products.find(p => p.id == selectedProductId);
|
||||
this.purchase.saleline_set[index].unit_price = selectedProduct.price;
|
||||
},
|
||||
fetchClients() {
|
||||
fetch('/don_confiao/api/customers/')
|
||||
.then(response => response.json())
|
||||
|
Loading…
Reference in New Issue
Block a user