Skip to content

Commit

Permalink
Allowing for case select with typeahead (#3257)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgliss authored Apr 12, 2023
1 parent 8b590a4 commit 6e7a740
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/dispatch/static/dispatch/src/case/type/CaseTypeSelect.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<template>
<v-select
<v-combobox
v-model="case_type"
:items="items"
:search-input.sync="search"
:menu-props="{ maxHeight: '400' }"
item-text="name"
label="Type"
item-value="id"
:label="label"
placeholder="Start typing to search"
:hint="hint"
return-object
:loading="loading"
no-filter
>
<template v-slot:item="data">
<v-list-item-content>
Expand All @@ -25,7 +31,7 @@
</v-list-item-content>
</v-list-item>
</template>
</v-select>
</v-combobox>
</template>

<script>
Expand All @@ -48,10 +54,16 @@ export default {
type: [Object],
default: null,
},
hint: {
type: String,
default: function () {
return "Case Type to associate"
},
},
label: {
type: String,
default: function () {
return "Type"
return "Case Type"
},
},
},
Expand All @@ -60,6 +72,7 @@ export default {
return {
loading: false,
items: [],
search: null,
more: false,
numItems: 5,
}
Expand All @@ -86,6 +99,7 @@ export default {
this.loading = "error"
let filterOptions = {
q: this.search,
sortBy: ["name"],
descending: [false],
itemsPerPage: this.numItems,
Expand Down Expand Up @@ -125,6 +139,16 @@ export default {
},
},
watch: {
search(val) {
val && val !== this.select && this.fetchData()
},
value(val) {
if (!val) return
this.items.push(val)
},
},
created() {
this.fetchData()
this.$watch(
Expand Down

0 comments on commit 6e7a740

Please sign in to comment.