From 9797a5e1376d372d1cfc754c5ef7c3ca2177088d Mon Sep 17 00:00:00 2001 From: jedi Date: Sat, 28 Dec 2019 04:28:04 +0100 Subject: [PATCH] add 'returned' button --- src/store/index.js | 4 ++++ src/views/Items.vue | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 648bf7d..4cc3a71 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -120,6 +120,10 @@ const store = new Vuex.Store({ const { data } = await axios.put(`/1/${getters.getEventSlug}/item/${item.uid}`, item); 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) { await axios.delete(`/1/${getters.getEventSlug}/item/${item.uid}`, item); commit('removeItem',item); diff --git a/src/views/Items.vue b/src/views/Items.vue index 180d548..055cc35 100644 --- a/src/views/Items.vue +++ b/src/views/Items.vue @@ -23,6 +23,9 @@ @itemActivated="openLightboxModalWith($event)" >
+ @@ -50,9 +53,12 @@
uid: {{ item.uid }} box: {{ item.box }}
- + + @@ -82,7 +88,7 @@ export default { components: {Lightbox, Table, Cards, Modal, EditItem }, computed: mapState(['loadedItems', 'layout']), methods: { - ...mapActions(['deleteItem']), + ...mapActions(['deleteItem','markItemReturned']), openLightboxModalWith(item) { // Opens the editing modal with a copy of the selected item. this.lightboxItem = { ...item }; },