add UI for backend search
All checks were successful
/ test (push) Successful in 2m25s
/ deploy (push) Successful in 3m19s

This commit is contained in:
j3d1 2025-01-09 14:48:05 +01:00
parent ebb13b2a85
commit 65755feb2f
6 changed files with 273 additions and 14 deletions

View file

@ -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)

View file

@ -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}
});
}
}
}