Added Checks

Added Documents to Inventoryitems and Checks
This commit is contained in:
2024-12-01 23:10:34 +01:00
parent 8e68858489
commit ff5d20421e
8 changed files with 594 additions and 51 deletions

View File

@@ -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()
</template>
</UDashboardNavbar>
<UTabs
:items="[{label: 'Informationen'}]"
v-if="itemInfo && mode == 'show'"
:items="[{label: 'Informationen'},{label: 'Dokumente'},{label: 'Überprüfungen'}]"
v-if="itemInfo && mode === 'show'"
class="p-5"
>
<template #item="{item}">
@@ -195,6 +197,34 @@ setupPage()
</div>
</div>
<div v-else-if="item.label === 'Dokumente'">
<UCard>
<DocumentUpload
type="inventoryitem"
:element-id="itemInfo.id"
/>
<DocumentList :documents="dataStore.getDocumentsByProfileId(itemInfo.id)"/>
</UCard>
</div>
<div v-else-if="item.label === 'Überprüfungen'">
<UCard>
<UTable
:rows="itemInfo.checks"
:columns="[{key:'name',label: 'Name'},{key:'rhythm',label: 'Rhythmus'},{key:'description',label: 'Beschreibung'}]"
class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/checks/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Überprüfungen anzuzeigen' }"
>
<template #rhythm-data="{row}">
{{row.distance}}
<span v-if="row.distanceUnit === 'dayjs'">Tage</span>
<span v-if="row.distanceUnit === 'years'">Jahre</span>
</template>
</UTable>
</UCard>
</div>
</template>
</UTabs>
<UForm