diff --git a/frontend/src/router.js b/frontend/src/router.js index 79de8c5..6459e53 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -3,10 +3,11 @@ import Dashboard from '@/views/Dashboard.vue'; import Login from '@/views/Login.vue'; import Register from '@/views/Register.vue'; import store from '@/store'; -import Friends from "@/views/Friends.vue"; +import Friends from '@/views/Friends.vue'; import Inventory from '@/views/Inventory.vue'; -import InventoryDetail from "@/views/InventoryDetail.vue"; -import InventoryEdit from "./views/InventoryEdit.vue"; +import InventoryDetail from '@/views/InventoryDetail.vue'; +import InventoryNew from '@/views/InventoryNew.vue'; +import InventoryEdit from '@/views/InventoryEdit.vue'; const routes = [ @@ -14,6 +15,7 @@ const routes = [ {path: '/inventory', component: Inventory, meta: {requiresAuth: true}}, {path: '/inventory/:id', component: InventoryDetail, meta: {requiresAuth: true}, props: true}, {path: '/inventory/:id/edit', component: InventoryEdit, meta: {requiresAuth: true}, props: true}, + {path: '/inventory/new', component: InventoryNew, meta: {requiresAuth: true}}, {path: '/friends', component: Friends, meta: {requiresAuth: true}}, {path: '/login', component: Login, meta: {requiresAuth: false}}, {path: '/register', component: Register, meta: {requiresAuth: false}}, diff --git a/frontend/src/store.js b/frontend/src/store.js index 6d87356..0cadaff 100644 --- a/frontend/src/store.js +++ b/frontend/src/store.js @@ -160,6 +160,13 @@ export default createStore({ commit('setInventoryItems', {url: '/', items}) return items }, + async createInventoryItem({state, dispatch, getters}, item) { + const servers = await dispatch('getHomeServers') + const data = {availability_policy: 'private', ...item} + const reply = await servers.post(getters.signAuth, '/api/inventory_items/', data) + state.last_load.files = 0 + return reply + }, async updateInventoryItem({state, dispatch, getters}, item) { const servers = await dispatch('getHomeServers') const data = {availability_policy: 'friends', ...item} diff --git a/frontend/src/views/Inventory.vue b/frontend/src/views/Inventory.vue index 1a60922..8687fa6 100644 --- a/frontend/src/views/Inventory.vue +++ b/frontend/src/views/Inventory.vue @@ -7,8 +7,14 @@
{{ user }}'s Inventory
+ +
- +
@@ -22,7 +28,9 @@ - +
Name {{ item.name }} {{ item.availability_policy }} + {{ item.availability_policy }} + {{ item.owned_quantity }} @@ -35,6 +43,36 @@
+
+
+
+
+ +
+
{{ item.name }}
+
+ {{ item.availability_policy }} + {{ item.owned_quantity }} +
+
+ +
+
+
+
+
+
+
@@ -54,6 +92,11 @@ import BaseLayout from "@/components/BaseLayout.vue"; export default { name: "Inventory", + data() { + return { + layout: "grid", + } + }, components: { BaseLayout, ...BIcons diff --git a/frontend/src/views/InventoryNew.vue b/frontend/src/views/InventoryNew.vue new file mode 100644 index 0000000..9612642 --- /dev/null +++ b/frontend/src/views/InventoryNew.vue @@ -0,0 +1,98 @@ + + + + + \ No newline at end of file