From 78afc7a1b23a5eb3d614c2949f9efb6c2bda2fa2 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Wed, 18 Jan 2023 15:23:56 -0900 Subject: [PATCH] update item view to use tab-like pages --- frontend/pages/item/[id]/index.vue | 147 ++++++++++++------ frontend/pages/item/[id]/{ => index}/edit.vue | 45 ++---- frontend/pages/item/[id]/index/log.vue | 22 +-- 3 files changed, 122 insertions(+), 92 deletions(-) rename frontend/pages/item/[id]/{ => index}/edit.vue (95%) diff --git a/frontend/pages/item/[id]/index.vue b/frontend/pages/item/[id]/index.vue index 4bcef2c..66018ea 100644 --- a/frontend/pages/item/[id]/index.vue +++ b/frontend/pages/item/[id]/index.vue @@ -30,6 +30,15 @@ refresh(); }); + const lastRoute = ref(route.fullPath); + watchEffect(() => { + if (lastRoute.value.endsWith("edit")) { + refresh(); + } + + lastRoute.value = route.fullPath; + }); + type FilteredAttachments = { attachments: ItemAttachment[]; warranty: ItemAttachment[]; @@ -325,6 +334,36 @@ onClickOutside(refDialogBody, () => { closeDialog(); }); + + function getQRCodeUrl(): string { + const currentURL = window.location.href; + + return `/api/v1/qrcode?data=${encodeURIComponent(currentURL)}&access_token=${api.items.attachmentToken}`; + } + + const currentPath = computed(() => { + return route.path; + }); + + const tabs = computed(() => { + return [ + { + id: "details", + name: "Details", + to: `/item/${itemId.value}`, + }, + { + id: "log", + name: "Log", + to: `/item/${itemId.value}/log`, + }, + { + id: "edit", + name: "Edit", + to: `/item/${itemId.value}/edit`, + }, + ]; + });