diff --git a/src/components/CustomerSearch.vue b/src/components/CustomerSearch.vue
new file mode 100644
index 0000000..3a8b2fb
--- /dev/null
+++ b/src/components/CustomerSearch.vue
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+ {{ item.acc_no }} - {{ item.name }}
+
+
+
+
+
+
+
diff --git a/src/views/contracts/ContractEdit.vue b/src/views/contracts/ContractEdit.vue
index c2543a7..1cf405e 100644
--- a/src/views/contracts/ContractEdit.vue
+++ b/src/views/contracts/ContractEdit.vue
@@ -102,26 +102,7 @@
-
-
-
-
-
-
-
-
-
- {{ item.acc_no }} - {{ item.name }}
-
-
-
-
-
+
@@ -134,6 +115,7 @@ import ErrorBanner from '@/components/ErrorBanner.vue'
import methods from '@/CommonMethods.vue'
import Product from '@/types/ProductType.vue'
import ProductSearch from '@/components/ProductSearch.vue'
+import CustomerSearch from '@/components/CustomerSearch.vue'
export default {
props: {
setcontract: {}
@@ -141,7 +123,8 @@ export default {
components: {
DatePicker,
ErrorBanner,
- ProductSearch
+ ProductSearch,
+ CustomerSearch
},
watch: {
setcontract(newval) {
@@ -165,17 +148,6 @@ export default {
}
},
computed: {
- filteredCustomers(){
- if (this.customer_search == null){
- return []
- }
- let query = this.customer_search.toLowerCase()
- let clist = this.customers.filter(q =>
- q.name.toLowerCase().includes(query) ||
- q.acc_no.includes(query)
- )
- return clist
- },
title() {
if ( this.contract.isNew ) {
return "New Contract"
@@ -229,20 +201,6 @@ export default {
this.saving = false
})
},
- async searchCustomers() {
- this.customers_loading = true
- let url = this.$api_url + "/customers/search/" + this.customer_search
- axios.get(url)
- .then(resp => {
- this.customers = resp.data
- })
- .catch(err => {
- console.log(err)
- })
- .finally(() => {
- this.customers_loading = false
- })
- },
productCodeName(p) {
return p.code + ' - ' + p.name
},
@@ -251,6 +209,10 @@ export default {
p.price = q.price
this.contract.products[this.searchProdIndex] = p
this.search[1] = false
+ },
+ setCustomer(c){
+ this.contract.customer = c
+ this.search[0] = false
}
}
}