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>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</v-table>
|
</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-row>
|
||||||
<v-col cols="4">
|
<v-col cols="4">
|
||||||
<v-btn @click="addProduct()" v-if="contract.products.length < 4">+ Add Product</v-btn>
|
<v-btn @click="addProduct()" v-if="contract.products.length < 4">+ Add Product</v-btn>
|
||||||
|
|
|
@ -9,18 +9,9 @@
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<v-autocomplete label="Customer"
|
<v-text-field readonly="true" variant="none" prepend-icon="mdi-magnify" @click:prepend="showCustomerSearch">
|
||||||
:items="customers"
|
{{ mf.customer.acc_no }} - {{ mf.customer.name }}
|
||||||
v-model="mf.customer"
|
</v-text-field>
|
||||||
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-col>
|
</v-col>
|
||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<v-autocomplete label="Vet"
|
<v-autocomplete label="Vet"
|
||||||
|
@ -69,25 +60,13 @@
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="6">
|
<v-col cols="12">
|
||||||
<v-autocomplete label="Product"
|
<v-text-field readonly="true" variant="none" prepend-icon="mdi-magnify" @click:prepend="showProductSearch">
|
||||||
:items="products"
|
{{ mf.product.code }} - {{ mf.product.name }}
|
||||||
item-title="code"
|
</v-text-field>
|
||||||
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>
|
</v-col>
|
||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<v-card :title="mf.product.name"></v-card>
|
<v-text-field label="Tonnage" variant="outlined" type="number" v-model="mf.tonnage"></v-text-field>
|
||||||
</v-col>
|
|
||||||
<v-col cols="6">
|
|
||||||
<v-text-field label="Tonnage" type="number" v-model="mf.tonnage"></v-text-field>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="6">
|
<v-col cols="6">
|
||||||
<label>
|
<label>
|
||||||
|
@ -119,16 +98,26 @@
|
||||||
@click="close">Close</v-btn>
|
@click="close">Close</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</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>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import DatePicker from '@vuepic/vue-datepicker'
|
import DatePicker from '@vuepic/vue-datepicker'
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import CustomerSearch from '@/components/CustomerSearch.vue'
|
||||||
|
import ProductSearch from '@/components/ProductSearch.vue'
|
||||||
export default {
|
export default {
|
||||||
props:{
|
props:{
|
||||||
set_mf: {}
|
set_mf: {}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
DatePicker
|
DatePicker,
|
||||||
|
CustomerSearch,
|
||||||
|
ProductSearch
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
set_mf(newval) {
|
set_mf(newval) {
|
||||||
|
@ -141,8 +130,7 @@ export default {
|
||||||
vets: [],
|
vets: [],
|
||||||
medications: [],
|
medications: [],
|
||||||
products: [],
|
products: [],
|
||||||
customers: [],
|
search: [],
|
||||||
search: {},
|
|
||||||
searching: {}
|
searching: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -171,34 +159,20 @@ export default {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
searchCustomers() {
|
showCustomerSearch(){
|
||||||
this.searching[1] = true
|
this.search[0] = 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
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
searchProducts() {
|
setCustomer(c){
|
||||||
this.searching[4] = true
|
this.mf.customer = c
|
||||||
let url = this.$api_url + "/products/search/" + this.search[4]
|
this.search[0] = false
|
||||||
axios.get(url)
|
|
||||||
.then(resp => {
|
|
||||||
this.products = resp.data
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err)
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
this.searching[4] = false
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
showProductSearch() {
|
||||||
|
this.search[1] = true
|
||||||
|
},
|
||||||
|
setProduct(p) {
|
||||||
|
this.mf.product = p
|
||||||
|
this.search[1] = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue