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