Feat: Cargar ultimo cliente creado
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
| @@ -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()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user