add UI for backend search
This commit is contained in:
parent
ebb13b2a85
commit
65755feb2f
6 changed files with 273 additions and 14 deletions
|
@ -115,10 +115,10 @@ export default {
|
|||
this.$router.push(link);
|
||||
},
|
||||
isItemView() {
|
||||
return this.getActiveView === 'items' || this.getActiveView === 'item';
|
||||
return this.getActiveView === 'items' || this.getActiveView === 'item' || this.getActiveView === 'item_search';
|
||||
},
|
||||
isTicketView() {
|
||||
return this.getActiveView === 'tickets' || this.getActiveView === 'ticket';
|
||||
return this.getActiveView === 'tickets' || this.getActiveView === 'ticket' || this.getActiveView === 'ticket_search';
|
||||
},
|
||||
setLayout(layout) {
|
||||
if (this.route.query.layout === layout)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<script>
|
||||
|
||||
import {mapActions, mapGetters} from "vuex";
|
||||
import router from "@/router";
|
||||
|
||||
export default {
|
||||
name: 'SearchBox',
|
||||
|
@ -21,21 +22,34 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['getActiveView'])
|
||||
...mapGetters(['getActiveView', 'route']),
|
||||
},
|
||||
watch: {
|
||||
route() {
|
||||
this.search_query = this.route.params.search || '';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['searchEventItems', 'searchEventTickets']),
|
||||
isItemView() {
|
||||
return this.getActiveView === 'items' || this.getActiveView === 'item';
|
||||
return this.getActiveView === 'items' || this.getActiveView === 'item' || this.getActiveView === 'item_search';
|
||||
},
|
||||
isTicketView() {
|
||||
return this.getActiveView === 'tickets' || this.getActiveView === 'ticket';
|
||||
return this.getActiveView === 'tickets' || this.getActiveView === 'ticket' || this.getActiveView === 'ticket_search';
|
||||
},
|
||||
dispatchSearch() {
|
||||
if (this.isItemView()) {
|
||||
this.searchEventItems(this.search_query);
|
||||
router.push({
|
||||
name: "item_search",
|
||||
query: this.route.query,
|
||||
params: {...this.route.params, search: this.search_query}
|
||||
});
|
||||
} else if (this.isTicketView()) {
|
||||
this.searchEventTickets(this.search_query);
|
||||
router.push({
|
||||
name: "ticket_search",
|
||||
query: this.route.query,
|
||||
params: {...this.route.params, search: this.search_query}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue