Feat: Cargar ultimo cliente creado

This commit is contained in:
sinergia 2024-11-02 10:54:14 -05:00
parent 2ea8cc7fd8
commit eeb9821675
2 changed files with 7 additions and 3 deletions

View File

@ -82,7 +82,7 @@
if (response.ok) {
const data = await response.json();
console.log('Cliente Guardado:', data);
this.$emit('customerCreated');
this.$emit('customerCreated', data);
this.closeModal();
} else {
console.error('Error al Crear el Cliente:', response.statusText);

View File

@ -16,7 +16,7 @@
class="mr-4"
></v-autocomplete>
<v-btn color="primary" @click="openModal">Agregar Cliente</v-btn>
<CreateCustomerModal ref="customerModal" @customerCreated="fetchClients"/>
<CreateCustomerModal ref="customerModal" @customerCreated="handleNewCustomer"/>
</v-col>
<v-col
lg="2"
@ -131,7 +131,7 @@
product_search: '',
purchase: {
date: this.getCurrentDate(),
client: null,
customer: null,
notes: '',
saleline_set: [{product:'', unit_price: 0, quantity: 0}],
},
@ -207,6 +207,10 @@
console.error(error);
});
},
handleNewCustomer(newCustomer){
this.clients.push(newCustomer);
this.purchase.customer = newCustomer.id;
},
fetchProducts() {
fetch('/don_confiao/api/products/')
.then(response => response.json())