From ff5d20421ee79cc2c9cab0413d9b6e67cbe6e463 Mon Sep 17 00:00:00 2001 From: flfeders Date: Sun, 1 Dec 2024 23:10:34 +0100 Subject: [PATCH] Added Checks Added Documents to Inventoryitems and Checks --- components/HistoryDisplay.vue | 37 +-- components/MainNav.vue | 5 + pages/checks/[mode]/[[id]].vue | 337 +++++++++++++++++++++++++ pages/checks/index.vue | 148 +++++++++++ pages/inventoryitems/[mode]/[[id]].vue | 36 ++- pages/profiles/show/[id].vue | 20 +- pages/vehicles/[mode]/[[id]].vue | 44 +++- stores/data.js | 18 +- 8 files changed, 594 insertions(+), 51 deletions(-) create mode 100644 pages/checks/[mode]/[[id]].vue create mode 100644 pages/checks/index.vue diff --git a/components/HistoryDisplay.vue b/components/HistoryDisplay.vue index bb28564..774b1b3 100644 --- a/components/HistoryDisplay.vue +++ b/components/HistoryDisplay.vue @@ -81,42 +81,7 @@ const addHistoryItem = async () => { console.log(addHistoryItemData.value) addHistoryItemData.value.createdBy = dataStore.activeProfile.id - if(type === "customer") { - addHistoryItemData.value.customer = elementId - } else if(type === "vendor") { - addHistoryItemData.value.vendor = elementId - } else if(type === "project") { - addHistoryItemData.value.project = elementId - } else if(type === "plant") { - addHistoryItemData.value.plant = elementId - } else if(type === "incomingInvoice") { - addHistoryItemData.value.incomingInvoice = elementId - } else if(type === "document") { - addHistoryItemData.value.document = elementId - } else if(type === "contact") { - addHistoryItemData.value.contact = elementId - } else if(type === "contract") { - addHistoryItemData.value.contract = elementId - } else if(type === "inventoryitem") { - addHistoryItemData.value.inventoryitem = elementId - } else if(type === "product") { - addHistoryItemData.value.product = elementId - } else if(type === "profile") { - addHistoryItemData.value.profile = elementId - } else if(type === "absencerequest") { - addHistoryItemData.value.absenceRequest = elementId - } else if(type === "event") { - addHistoryItemData.value.event = elementId - } else if(type === "task") { - addHistoryItemData.value.event = elementId - } else if(type === "vehicle") { - addHistoryItemData.value.vehicle = elementId - } else if(type === "space") { - addHistoryItemData.value.space = elementId - } else if(type === "trackingtrip") { - addHistoryItemData.value.trackingtrip = elementId - } - + addHistoryItemData.value[type] = elementId const {data,error} = await supabase .from("historyitems") diff --git a/components/MainNav.vue b/components/MainNav.vue index 123c708..4f01874 100644 --- a/components/MainNav.vue +++ b/components/MainNav.vue @@ -217,6 +217,11 @@ const links = computed(() => { ] },] : [],*/ + { + label: "Überprüfungen", + to: "/checks", + icon: "i-heroicons-magnifying-glass" + }, ... dataStore.ownTenant.features.projects ? [{ label: "Projekte", to: "/projects", diff --git a/pages/checks/[mode]/[[id]].vue b/pages/checks/[mode]/[[id]].vue new file mode 100644 index 0000000..1092351 --- /dev/null +++ b/pages/checks/[mode]/[[id]].vue @@ -0,0 +1,337 @@ + + + + + \ No newline at end of file diff --git a/pages/checks/index.vue b/pages/checks/index.vue new file mode 100644 index 0000000..1697843 --- /dev/null +++ b/pages/checks/index.vue @@ -0,0 +1,148 @@ + + + + + \ No newline at end of file diff --git a/pages/inventoryitems/[mode]/[[id]].vue b/pages/inventoryitems/[mode]/[[id]].vue index 890ad60..f484dcb 100644 --- a/pages/inventoryitems/[mode]/[[id]].vue +++ b/pages/inventoryitems/[mode]/[[id]].vue @@ -2,6 +2,8 @@ import HistoryDisplay from "~/components/HistoryDisplay.vue"; import dayjs from "dayjs"; import {useSupabaseSelectSingle} from "~/composables/useSupabase.js"; +import DocumentUpload from "~/components/DocumentUpload.vue"; +import DocumentList from "~/components/DocumentList.vue"; definePageMeta({ middleware: "auth" @@ -24,7 +26,7 @@ const itemInfo = ref({ //Functions const setupPage = async () => { if(mode.value === "show"){ - itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*, vendor(*)") + itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*, vendor(*), checks(*)") } else if(mode.value === "edit") { itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*") } @@ -114,8 +116,8 @@ setupPage() { if(route.params.id) { - itemInfo.value = await useSupabaseSelectSingle("profiles",route.params.id,"*, documents(*)") + itemInfo.value = await useSupabaseSelectSingle("profiles",route.params.id,"*, documents(*), checks(*)") } if(itemInfo.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value)) @@ -133,6 +133,8 @@ const isLight = computed({ label: 'Vertragsdaten' },{ label: 'Dokumente' + },{ + label: 'Überprüfungen' } ]" > @@ -397,6 +399,22 @@ const isLight = computed({ +
+ + + +
diff --git a/pages/vehicles/[mode]/[[id]].vue b/pages/vehicles/[mode]/[[id]].vue index 4643420..508a917 100644 --- a/pages/vehicles/[mode]/[[id]].vue +++ b/pages/vehicles/[mode]/[[id]].vue @@ -45,6 +45,8 @@ const tabItems = [{ label: 'Informationen', }, { label: 'Dokumente', +}, { + label: 'Überprüfungen', }] const incomingInvoicesColumns = [ @@ -73,7 +75,9 @@ const incomingInvoicesColumns = [ //Functions const setupPage = async () => { - if(mode.value === "show" || mode.value === "edit"){ + if(mode.value === "show"){ + itemInfo.value = await useSupabaseSelectSingle("vehicles",route.params.id,"*, checks(*)") + } else if(mode.value === "edit"){ itemInfo.value = await useSupabaseSelectSingle("vehicles",route.params.id,"*") } @@ -254,16 +258,36 @@ setupPage()
- - - + + + + - + + +
+
+ + + + +
diff --git a/stores/data.js b/stores/data.js index a1f6966..89b847e 100644 --- a/stores/data.js +++ b/stores/data.js @@ -161,6 +161,12 @@ export const useDataStore = defineStore('data', () => { labelSingle: "Projekttyp", redirect: true, historyItemHolder: "projecttype" + }, + checks: { + label: "Überprüfungen", + labelSingle: "Überprüfung", + redirect: true, + historyItemHolder: "check" } } @@ -868,7 +874,7 @@ export const useDataStore = defineStore('data', () => { //console.log(supabaseData) await generateHistoryItems(dataType, supabaseData[0]) - if(!["statementallocations", "productcategories", "projecttypes"].includes(dataType) ){ + if(!["statementallocations", "productcategories", "projecttypes", "checks"].includes(dataType) ){ await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')') } @@ -1235,6 +1241,10 @@ export const useDataStore = defineStore('data', () => { return documents.value.filter(item => item.profile === profileId && !item.tags.includes("Archiviert")) }) + const getDocumentsByInventoryItemId = computed(() => (itemId) => { + return documents.value.filter(item => item.inventoryitem === itemId && !item.tags.includes("Archiviert")) + }) + const getDocumentsByPlantId = computed(() => (itemId) => { return documents.value.filter(item => item.plant === itemId && !item.tags.includes("Archiviert")) }) @@ -1243,6 +1253,10 @@ export const useDataStore = defineStore('data', () => { return documents.value.filter(item => item.contract === itemId && !item.tags.includes("Archiviert")) }) + const getDocumentsByCheckId = computed(() => (itemId) => { + return documents.value.filter(item => item.check === itemId && !item.tags.includes("Archiviert")) + }) + const getDocumentsByVehicleId = computed(() => (itemId) => { return documents.value.filter(item => item.vehicle === itemId && !item.tags.includes("Archiviert")) }) @@ -1780,8 +1794,10 @@ export const useDataStore = defineStore('data', () => { getContactsByVendorId, getDocumentsByProjectId, getDocumentsByProfileId, + getDocumentsByInventoryItemId, getDocumentsByPlantId, getDocumentsByContractId, + getDocumentsByCheckId, getDocumentsByVehicleId, getDocumentsByProductId, getDocumentsByVendorId,