-
-
-
-
-
-
diff --git a/web/src/router.js b/web/src/router.js
index bad2970..eb059c8 100644
--- a/web/src/router.js
+++ b/web/src/router.js
@@ -1,10 +1,11 @@
import {createRouter, createWebHistory} from 'vue-router'
import store from '@/store';
-import Items from './views/Items';
-import Boxes from './views/Boxes';
-import Files from './views/Files';
-import HowTo from './views/HowTo';
+import Item from "@/views/Item.vue";
+import Items from '@/views/Items';
+import Boxes from '@/views/Boxes';
+import Files from '@/views/Files';
+import HowTo from '@/views/HowTo';
import Login from '@/views/Login.vue';
import Register from '@/views/Register.vue';
import Dashboard from "@/views/admin/Dashboard.vue";
@@ -27,7 +28,7 @@ const routes = [
{requiresAuth: true, requiresPermission: 'view_item'}
},
{
- path: '/:event/item/:uid/', name: 'item', component: Items, meta:
+ path: '/:event/item/:id/', name: 'item', component: Item, meta:
{requiresAuth: true, requiresPermission: 'view_item'}
},
{
diff --git a/web/src/store.js b/web/src/store.js
index 60dba61..2f5a60d 100644
--- a/web/src/store.js
+++ b/web/src/store.js
@@ -34,6 +34,7 @@ const store = createStore({
expiry: null,
},
+ lightboxHash: null,
thumbnailCache: {},
fetchedData: {
events: 0,
@@ -145,38 +146,34 @@ const store = createStore({
setItems(state, {slug, items}) {
state.loadedItems[slug] = items;
state.loadedItems = {...state.loadedItems};
- console.log(state.loadedItems)
},
replaceItems(state, items) {
const groups = Object.groupBy(items, i => i.event ? i.event : 'none')
for (const [key, value] of Object.entries(groups)) state.loadedItems[key] = value;
state.loadedItems = {...state.loadedItems};
- console.log(state.loadedItems)
},
updateItem(state, updatedItem) {
- const item = state.loadedItems[updatedItem.event?updatedItem.event:'none'].filter(
- ({uid}) => uid === updatedItem.uid)[0];
+ const item = state.loadedItems[updatedItem.event ? updatedItem.event : 'none'].filter(
+ ({id}) => id === updatedItem.id)[0];
Object.assign(item, updatedItem);
},
removeItem(state, item) {
- state.loadedItems[item.event?item.event:'none'] = state.loadedItems[item.event].filter(it => it !== item);
+ state.loadedItems[item.event ? item.event : 'none'] = state.loadedItems[item.event].filter(it => it !== item);
},
appendItem(state, item) {
- state.loadedItems[item.event?item.event:'none'].push(item);
+ state.loadedItems[item.event ? item.event : 'none'].push(item);
},
setTickets(state, {slug, tickets}) {
state.loadedTickets[slug] = tickets;
state.loadedTickets = {...state.loadedTickets};
- console.log(state.loadedTickets)
},
replaceTickets(state, tickets) {
const groups = Object.groupBy(tickets, t => t.event ? t.event : 'none')
for (const [key, value] of Object.entries(groups)) state.loadedTickets[key] = value;
state.loadedTickets = {...state.loadedTickets};
- console.log(state.loadedTickets)
},
updateTicket(state, updatedTicket) {
- const ticket = state.loadedTickets[updatedTicket.event?updatedTicket.event:'none'].filter(
+ const ticket = state.loadedTickets[updatedTicket.event ? updatedTicket.event : 'none'].filter(
({id}) => id === updatedTicket.id)[0];
Object.assign(ticket, updatedTicket);
state.loadedTickets = {...state.loadedTickets};
@@ -189,6 +186,9 @@ const store = createStore({
state.groups = groups;
state.fetchedData = {...state.fetchedData, groups: Date.now()};
},
+ openLightboxModalWith(state, hash) {
+ state.lightboxHash = hash;
+ },
openAddBoxModal(state) {
state.showAddBoxModal = true;
},
@@ -336,14 +336,13 @@ const store = createStore({
const {data, success} = await getters.session.delete(`/2/events/${event_id}/`);
if (success) {
await dispatch('loadEvents')
- commit('replaceEvents', [...state.events.filter(e => e.eid !== event_id)])
+ commit('replaceEvents', [...state.events.filter(e => e.id !== event_id)])
}
},
async updateEvent({commit, dispatch, state}, {id, partial_event}){
- console.log(id, partial_event);
const {data, success} = await http.patch(`/2/events/${id}/`, partial_event, state.user.token);
if (success) {
- commit('replaceEvents', [...state.events.filter(e => e.eid !== id), data])
+ commit('replaceEvents', [...state.events.filter(e => e.id !== id), data])
}
},
async fetchTicketStates({commit, state, getters}) {
@@ -354,7 +353,6 @@ const store = createStore({
},
async changeEvent({dispatch, getters, commit}, eventName) {
await router.push({path: `/${eventName.slug}/${getters.getActiveView}/`});
- //dispatch('loadEventItems');
},
async changeView({getters}, link) {
await router.push({path: `/${getters.getEventSlug}/${link.path}/`});
@@ -405,16 +403,16 @@ const store = createStore({
async updateItem({commit, getters, state}, item) {
const {
data, success
- } = await getters.session.put(`/2/${getters.getEventSlug}/item/${item.uid}/`, item);
+ } = await getters.session.put(`/2/${getters.getEventSlug}/item/${item.id}/`, item);
commit('updateItem', data);
},
async markItemReturned({commit, getters, state}, item) {
- await getters.session.patch(`/2/${getters.getEventSlug}/item/${item.uid}/`, {returned: true},
+ await getters.session.patch(`/2/${getters.getEventSlug}/item/${item.id}/`, {returned: true},
state.user.token);
commit('removeItem', item);
},
async deleteItem({commit, getters, state}, item) {
- await getters.session.delete(`/2/${getters.getEventSlug}/item/${item.uid}/`, item);
+ await getters.session.delete(`/2/${getters.getEventSlug}/item/${item.id}/`, item);
commit('removeItem', item);
},
async postItem({commit, getters, state}, item) {
diff --git a/web/src/views/Item.vue b/web/src/views/Item.vue
new file mode 100644
index 0000000..91cbb61
--- /dev/null
+++ b/web/src/views/Item.vue
@@ -0,0 +1,181 @@
+
+
+
+
+
+
+
+
+
+
id: {{ item.id }} box: {{ item.box }}
+ {{ item.description }}
+
+
+
+
+
+
+
+
+
+
Related
+
+
+
+
+ Ticket #{{ issue.id }} - {{ issue.name }}
+
+
state: {{ issue.state }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/src/views/Items.vue b/web/src/views/Items.vue
index 2f9e5ed..21b11d1 100644
--- a/web/src/views/Items.vue
+++ b/web/src/views/Items.vue
@@ -1,26 +1,13 @@
-
-
-
-
-
-
-
-
-
-
@@ -43,11 +30,11 @@
openLightboxModalWith(item.file)"
>
{{ item.description }}
-
uid: {{ item.uid }} box: {{ item.box }}
+
id: {{ item.id }} box: {{ item.box }}
-
@@ -84,10 +71,10 @@ import Table from '@/components/Table';
import Cards from '@/components/Cards';
import Modal from '@/components/Modal';
import EditItem from '@/components/EditItem';
-import {mapActions, mapGetters, mapState} from 'vuex';
-import Lightbox from '../components/Lightbox';
+import {mapActions, mapGetters, mapMutations} from 'vuex';
import AuthenticatedImage from "@/components/AuthenticatedImage.vue";
import AsyncLoader from "@/components/AsyncLoader.vue";
+import router from "@/router";
export default {
name: 'Items',
@@ -95,28 +82,15 @@ export default {
lightboxHash: null,
editingItem: null,
}),
- components: {AsyncLoader, AuthenticatedImage, Lightbox, Table, Cards, Modal, EditItem},
+ components: {AsyncLoader, AuthenticatedImage, Table, Cards, Modal, EditItem},
computed: {
- ...mapState([]),
...mapGetters(['getEventItems', 'isItemsLoaded', 'layout']),
},
methods: {
...mapActions(['deleteItem', 'markItemReturned', 'loadEventItems', 'updateItem', 'scheduleAfterInit']),
- openLightboxModalWith(item) {
- this.lightboxHash = item.file;
- },
- closeLightboxModal() { // Closes the editing modal and discards the edited copy of the item.
- this.lightboxHash = null;
- },
- openEditingModalWith(item) { // Opens the editing modal with a copy of the selected item.
- this.editingItem = item;
- },
- closeEditingModal() {
- this.editingItem = null;
- },
- saveEditingItem() { // Saves the edited copy of the item.
- this.updateItem(this.editingItem);
- this.closeEditingModal();
+ ...mapMutations(['openLightboxModalWith']),
+ showItemDetail(item) {
+ router.push({name: 'item', params: {id: item.id}});
},
confirm(message) {
return window.confirm(message);
diff --git a/web/src/views/Ticket.vue b/web/src/views/Ticket.vue
index d08fb2e..dd0b413 100644
--- a/web/src/views/Ticket.vue
+++ b/web/src/views/Ticket.vue
@@ -1,5 +1,5 @@
-
+
@@ -7,7 +7,42 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -58,25 +96,53 @@
+
+
+
+
Related
+
+
+
+
+
id: {{ item.id }} box: {{
+ item.box
+ }}
+
+ {{ item.description }}
+
+
+
+
+
+