add dropdown selection to change state of tickets

This commit is contained in:
j3d1 2023-12-28 21:08:26 +01:00
parent 515648ffa8
commit 626c9f23fe
7 changed files with 166 additions and 13 deletions

View file

@ -76,6 +76,7 @@ const store = new Vuex.Store({
password: null,
userPermissions: [],
token: null,
state_options: [],
token_expiry: null,
local_loaded: false,
},
@ -111,6 +112,9 @@ const store = new Vuex.Store({
replaceEvents(state, events) {
state.events = events;
},
replaceTicketStates(state, states) {
state.state_options = states;
},
changeView(state, {view, slug}) {
router.push({path: `/${slug}/${view}`});
},
@ -258,6 +262,10 @@ const store = new Vuex.Store({
const {data} = await axios.get('/2/events/');
commit('replaceEvents', data);
},
async fetchTicketStates({commit}) {
const {data} = await axios.get('/2/tickets/states/');
commit('replaceTicketStates', data);
},
changeEvent({dispatch, getters, commit}, eventName) {
router.push({path: `/${eventName.slug}/${getters.getActiveView}/`});
dispatch('loadEventItems');
@ -319,7 +327,12 @@ const store = new Vuex.Store({
await dispatch('loadTickets');
},
async postManualTicket({commit, dispatch}, {sender, message, title,}) {
const {data} = await axios.post(`/2/tickets/manual/`, {name: title, sender, body: message, recipient: 'mail@c3lf.de'});
const {data} = await axios.post(`/2/tickets/manual/`, {
name: title,
sender,
body: message,
recipient: 'mail@c3lf.de'
});
await dispatch('loadTickets');
},
async loadUsers({commit}) {
@ -330,6 +343,14 @@ const store = new Vuex.Store({
const {data} = await axios.get('/2/groups/');
commit('replaceGroups', data);
},
async updateTicket({commit}, ticket) {
const {data} = await axios.put(`/2/tickets/${ticket.id}/`, ticket);
commit('updateTicket', data);
},
async updateTicketPartial({commit}, {id, ...ticket}) {
const {data} = await axios.patch(`/2/tickets/${id}/`, ticket);
commit('updateTicket', data);
}
}
});