Merge pull request 'view(Purchase): add autocomplete customer on purchase #43.' (#50) from activate_customer_search_in_purchase into main
Reviewed-on: OneTeam/don_confiao#50
This commit is contained in:
		@@ -3,16 +3,18 @@
 | 
				
			|||||||
      <v-form ref="form" v-model="valid">
 | 
					      <v-form ref="form" v-model="valid">
 | 
				
			||||||
        <v-row>
 | 
					        <v-row>
 | 
				
			||||||
          <v-col>
 | 
					          <v-col>
 | 
				
			||||||
          <v-select
 | 
					            <v-autocomplete
 | 
				
			||||||
            v-model="purchase.customer"
 | 
					              v-model="purchase.customer"
 | 
				
			||||||
            :items="clients"
 | 
					              :items="filteredClients"
 | 
				
			||||||
            item-title="name"
 | 
					              :search="client_search"
 | 
				
			||||||
            item-value="id"
 | 
					              no-data-text="No se hallaron clientes"
 | 
				
			||||||
            label="Cliente"
 | 
					              item-title="name"
 | 
				
			||||||
            :rules="[rules.required]"
 | 
					              item-value="id"
 | 
				
			||||||
            required
 | 
					              label="Cliente"
 | 
				
			||||||
            class="mr-4"
 | 
					              :rules="[rules.required]"
 | 
				
			||||||
            ></v-select>
 | 
					              required
 | 
				
			||||||
 | 
					              class="mr-4"
 | 
				
			||||||
 | 
					            ></v-autocomplete>
 | 
				
			||||||
          </v-col>
 | 
					          </v-col>
 | 
				
			||||||
          <v-col
 | 
					          <v-col
 | 
				
			||||||
            lg="2"
 | 
					            lg="2"
 | 
				
			||||||
@@ -109,6 +111,7 @@
 | 
				
			|||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
      return {
 | 
					      return {
 | 
				
			||||||
        valid: false,
 | 
					        valid: false,
 | 
				
			||||||
 | 
					        client_search: '',
 | 
				
			||||||
        purchase: {
 | 
					        purchase: {
 | 
				
			||||||
          date: this.getCurrentDate(),
 | 
					          date: this.getCurrentDate(),
 | 
				
			||||||
          client: null,
 | 
					          client: null,
 | 
				
			||||||
@@ -141,6 +144,15 @@
 | 
				
			|||||||
          return total + this.calculateSubtotal(saleline);
 | 
					          return total + this.calculateSubtotal(saleline);
 | 
				
			||||||
        }, 0);
 | 
					        }, 0);
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					      filteredClients() {
 | 
				
			||||||
 | 
					        return this.clients.filter(client => {
 | 
				
			||||||
 | 
					          if (this.client_search === '') {
 | 
				
			||||||
 | 
					            return [];
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            return client.name.toLowerCase().includes(this.client_search.toLowerCase());
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
      getCurrentDate() {
 | 
					      getCurrentDate() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user