better search on contract edit

This commit is contained in:
Paul Wilde 2023-03-20 15:48:33 +00:00
parent b6dfa61f04
commit 834ac4201f

View file

@ -108,12 +108,17 @@
<v-progress-linear indeterminate :active="customers_loading">
</v-progress-linear>
<v-list>
<template v-for="c in customers" :key="c.acc_no">
<v-list-item>
<v-btn icon="mdi-arrow-right" title="select" @click="contract.customer = c; search[0] = false" size="small" color="success"></v-btn>
{{ c.acc_no }} - {{ c.name }}
</v-list-item>
</template>
<RecycleScroller class="scroller"
:items="filteredCustomers"
:item-size="50"
v-slot="{ item }"
key-field="acc_no"
>
<v-list-item>
<v-btn icon="mdi-arrow-right" title="select" @click="contract.customer = item; search[0] = false" size="small" color="success"></v-btn>
{{ item.acc_no }} - {{ item.name }}
</v-list-item>
</RecycleScroller>
</v-list>
</v-card-text>
</v-card>
@ -125,18 +130,23 @@
<v-progress-linear indeterminate :active="products_loading">
</v-progress-linear>
<v-list>
<template v-for="p in products" :key="p.code">
<RecycleScroller class="scroller"
:items="products"
:item-size="50"
v-slot="{ item }"
key-field="code"
>
<v-list-item>
<v-btn icon="mdi-arrow-right" title="select" @click="setProduct(p)" size="small" color="success"></v-btn>
{{ p.code }} - {{ p.name }}
<v-btn icon="mdi-arrow-right" title="select" @click="setProduct(item)" size="small" color="success"></v-btn>
{{ item.code }} - {{ item.name }}
</v-list-item>
</template>
</RecycleScroller>
</v-list>
</v-card-text>
</v-card>
</v-dialog>
</template>
<script>
</template>
<script>
import axios from 'axios'
import DatePicker from '@vuepic/vue-datepicker'
import ErrorBanner from '@/components/ErrorBanner.vue'
@ -172,6 +182,17 @@ 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"