add 'returned' button
This commit is contained in:
parent
5edf382bcb
commit
9797a5e137
2 changed files with 14 additions and 4 deletions
|
@ -120,6 +120,10 @@ const store = new Vuex.Store({
|
||||||
const { data } = await axios.put(`/1/${getters.getEventSlug}/item/${item.uid}`, item);
|
const { data } = await axios.put(`/1/${getters.getEventSlug}/item/${item.uid}`, item);
|
||||||
commit('updateItem', data);
|
commit('updateItem', data);
|
||||||
},
|
},
|
||||||
|
async markItemReturned({ commit, getters }, item) {
|
||||||
|
await axios.put(`/1/${getters.getEventSlug}/item/${item.uid}`, {returned: true});
|
||||||
|
commit('removeItem', item);
|
||||||
|
},
|
||||||
async deleteItem({ commit, getters }, item) {
|
async deleteItem({ commit, getters }, item) {
|
||||||
await axios.delete(`/1/${getters.getEventSlug}/item/${item.uid}`, item);
|
await axios.delete(`/1/${getters.getEventSlug}/item/${item.uid}`, item);
|
||||||
commit('removeItem',item);
|
commit('removeItem',item);
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
@itemActivated="openLightboxModalWith($event)"
|
@itemActivated="openLightboxModalWith($event)"
|
||||||
>
|
>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-success" @click.stop="markItemReturned(item)">
|
||||||
|
<font-awesome-icon icon="check"/> returned
|
||||||
|
</button>
|
||||||
<button class="btn btn-secondary" @click.stop="openEditingModalWith(item)" >
|
<button class="btn btn-secondary" @click.stop="openEditingModalWith(item)" >
|
||||||
<font-awesome-icon icon="edit"/>
|
<font-awesome-icon icon="edit"/>
|
||||||
</button>
|
</button>
|
||||||
|
@ -50,6 +53,9 @@
|
||||||
<h6 class="card-subtitle text-secondary">uid: {{ item.uid }} box: {{ item.box }}</h6>
|
<h6 class="card-subtitle text-secondary">uid: {{ item.uid }} box: {{ item.box }}</h6>
|
||||||
<div class="row mx-auto mt-2">
|
<div class="row mx-auto mt-2">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-outline-success" @click.stop="markItemReturned(item)">
|
||||||
|
<font-awesome-icon icon="check"/> returned
|
||||||
|
</button>
|
||||||
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)">
|
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)">
|
||||||
<font-awesome-icon icon="edit"/> edit
|
<font-awesome-icon icon="edit"/> edit
|
||||||
</button>
|
</button>
|
||||||
|
@ -82,7 +88,7 @@ export default {
|
||||||
components: {Lightbox, Table, Cards, Modal, EditItem },
|
components: {Lightbox, Table, Cards, Modal, EditItem },
|
||||||
computed: mapState(['loadedItems', 'layout']),
|
computed: mapState(['loadedItems', 'layout']),
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['deleteItem']),
|
...mapActions(['deleteItem','markItemReturned']),
|
||||||
openLightboxModalWith(item) { // Opens the editing modal with a copy of the selected item.
|
openLightboxModalWith(item) { // Opens the editing modal with a copy of the selected item.
|
||||||
this.lightboxItem = { ...item };
|
this.lightboxItem = { ...item };
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue