brought customer and product search into med feeds
This commit is contained in:
parent
0caeb1d859
commit
5f021f8d5c
2 changed files with 33 additions and 75 deletions
|
@ -52,22 +52,6 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
<!--<v-row>
|
||||
<v-col cols="6">
|
||||
<v-autocomplete
|
||||
label="Product Code"
|
||||
@keyup.enter="searchProducts()"
|
||||
:items="products"
|
||||
item-title="code"
|
||||
item-value="code"
|
||||
v-model="p.code"
|
||||
v-model:search="product_search"
|
||||
append-icon="mdi-magnify"
|
||||
no-data-text="No results (press Enter to search)"
|
||||
cache-items
|
||||
@click:append="searchProducts()"></v-autocomplete>
|
||||
</v-col>
|
||||
</v-row>-->
|
||||
<v-row>
|
||||
<v-col cols="4">
|
||||
<v-btn @click="addProduct()" v-if="contract.products.length < 4">+ Add Product</v-btn>
|
||||
|
|
|
@ -9,18 +9,9 @@
|
|||
<v-container>
|
||||
<v-row>
|
||||
<v-col cols="6">
|
||||
<v-autocomplete label="Customer"
|
||||
:items="customers"
|
||||
v-model="mf.customer"
|
||||
v-model:search="search[1]"
|
||||
item-title="full_title"
|
||||
return-object
|
||||
:loading="searching[1]"
|
||||
append-icon="mdi-magnify"
|
||||
@keyup.enter="searchCustomers()"
|
||||
@click:append="searchCustomers()"
|
||||
no-data-text="No results (press Enter to search)"
|
||||
></v-autocomplete>
|
||||
<v-text-field readonly="true" variant="none" prepend-icon="mdi-magnify" @click:prepend="showCustomerSearch">
|
||||
{{ mf.customer.acc_no }} - {{ mf.customer.name }}
|
||||
</v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<v-autocomplete label="Vet"
|
||||
|
@ -69,25 +60,13 @@
|
|||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col cols="6">
|
||||
<v-autocomplete label="Product"
|
||||
:items="products"
|
||||
item-title="code"
|
||||
v-model="mf.product"
|
||||
return-object
|
||||
v-model:search="search[4]"
|
||||
append-icon="mdi-magnify"
|
||||
:loading="searching[4]"
|
||||
@keyup.enter="searchProducts()"
|
||||
@click:append="searchProducts()"
|
||||
no-data-text="No results (press Enter to search)"
|
||||
></v-autocomplete>
|
||||
<v-col cols="12">
|
||||
<v-text-field readonly="true" variant="none" prepend-icon="mdi-magnify" @click:prepend="showProductSearch">
|
||||
{{ mf.product.code }} - {{ mf.product.name }}
|
||||
</v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<v-card :title="mf.product.name"></v-card>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<v-text-field label="Tonnage" type="number" v-model="mf.tonnage"></v-text-field>
|
||||
<v-text-field label="Tonnage" variant="outlined" type="number" v-model="mf.tonnage"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<label>
|
||||
|
@ -119,16 +98,26 @@
|
|||
@click="close">Close</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
<v-dialog v-model="search[0]">
|
||||
<CustomerSearch @returnCustomer="setCustomer"></CustomerSearch>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="search[1]">
|
||||
<ProductSearch @returnProduct="setProduct"></ProductSearch>
|
||||
</v-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import DatePicker from '@vuepic/vue-datepicker'
|
||||
import axios from 'axios';
|
||||
import CustomerSearch from '@/components/CustomerSearch.vue'
|
||||
import ProductSearch from '@/components/ProductSearch.vue'
|
||||
export default {
|
||||
props:{
|
||||
set_mf: {}
|
||||
},
|
||||
components: {
|
||||
DatePicker
|
||||
DatePicker,
|
||||
CustomerSearch,
|
||||
ProductSearch
|
||||
},
|
||||
watch: {
|
||||
set_mf(newval) {
|
||||
|
@ -141,8 +130,7 @@ export default {
|
|||
vets: [],
|
||||
medications: [],
|
||||
products: [],
|
||||
customers: [],
|
||||
search: {},
|
||||
search: [],
|
||||
searching: {}
|
||||
}
|
||||
},
|
||||
|
@ -171,34 +159,20 @@ export default {
|
|||
console.log(err)
|
||||
})
|
||||
},
|
||||
searchCustomers() {
|
||||
this.searching[1] = true
|
||||
let url = this.$api_url + "/customers/search/" + this.search[1]
|
||||
axios.get(url)
|
||||
.then(resp => {
|
||||
this.customers = resp.data
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
.finally(() => {
|
||||
this.searching[1] = false
|
||||
})
|
||||
showCustomerSearch(){
|
||||
this.search[0] = true
|
||||
},
|
||||
searchProducts() {
|
||||
this.searching[4] = true
|
||||
let url = this.$api_url + "/products/search/" + this.search[4]
|
||||
axios.get(url)
|
||||
.then(resp => {
|
||||
this.products = resp.data
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
.finally(() => {
|
||||
this.searching[4] = false
|
||||
})
|
||||
setCustomer(c){
|
||||
this.mf.customer = c
|
||||
this.search[0] = false
|
||||
},
|
||||
showProductSearch() {
|
||||
this.search[1] = true
|
||||
},
|
||||
setProduct(p) {
|
||||
this.mf.product = p
|
||||
this.search[1] = false
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue