delete box button works, with
\confirmation
This commit is contained in:
parent
affd6f6c86
commit
07213bd421
3 changed files with 14 additions and 6 deletions
|
@ -315,6 +315,10 @@ const store = new Vuex.Store({
|
|||
commit('closeAddBoxModal');
|
||||
});
|
||||
},
|
||||
async deleteBox({commit, dispatch}, box_id) {
|
||||
await axios.delete(`/2/boxes/${box_id}/`);
|
||||
dispatch('loadBoxes');
|
||||
},
|
||||
async updateItem({commit, getters}, item) {
|
||||
const {data} = await axios.put(`/2/${getters.getEventSlug}/item/${item.uid}/`, item);
|
||||
commit('updateItem', data);
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
>
|
||||
<template #actions="{ item }">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-success" @click.stop="markItemReturned(item)" title="returned">
|
||||
<button class="btn btn-success" @click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
|
||||
<font-awesome-icon icon="check"/>
|
||||
</button>
|
||||
<button class="btn btn-secondary" @click.stop="openEditingModalWith(item)" title="edit">
|
||||
<font-awesome-icon icon="edit"/>
|
||||
</button>
|
||||
<button class="btn btn-danger" @click.stop="deleteItem(item)" title="delete">
|
||||
<button class="btn btn-danger" @click.stop="confirm('delete Item?') && deleteItem(item)" title="delete">
|
||||
<font-awesome-icon icon="trash"/>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -13,9 +13,10 @@
|
|||
<template v-slot:actions="{ item }">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-secondary" @click.stop="showBoxContent(item.name)">
|
||||
<!--font-awesome-icon icon="archive"/--> content
|
||||
<font-awesome-icon icon="archive"/>
|
||||
</button>
|
||||
<button class="btn btn-danger" @click.stop="" title="delete">
|
||||
<button class="btn btn-danger" @click.stop="confirm('delete box?') && deleteBox(item.cid)"
|
||||
title="Delete Box">
|
||||
<font-awesome-icon icon="trash"/>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -32,8 +33,11 @@ export default {
|
|||
components: {Table},
|
||||
computed: mapState(['loadedBoxes', 'layout']),
|
||||
methods: {
|
||||
...mapActions(['showBoxContent']),
|
||||
...mapMutations(['openAddBoxModal'])
|
||||
...mapActions(['showBoxContent', 'deleteBox']),
|
||||
...mapMutations(['openAddBoxModal']),
|
||||
confirm(message) {
|
||||
return window.confirm(message);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue