Added Checks
Added Documents to Inventoryitems and Checks
This commit is contained in:
@@ -81,42 +81,7 @@ const addHistoryItem = async () => {
|
|||||||
console.log(addHistoryItemData.value)
|
console.log(addHistoryItemData.value)
|
||||||
addHistoryItemData.value.createdBy = dataStore.activeProfile.id
|
addHistoryItemData.value.createdBy = dataStore.activeProfile.id
|
||||||
|
|
||||||
if(type === "customer") {
|
addHistoryItemData.value[type] = elementId
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const {data,error} = await supabase
|
const {data,error} = await supabase
|
||||||
.from("historyitems")
|
.from("historyitems")
|
||||||
|
|||||||
@@ -217,6 +217,11 @@ const links = computed(() => {
|
|||||||
|
|
||||||
]
|
]
|
||||||
},] : [],*/
|
},] : [],*/
|
||||||
|
{
|
||||||
|
label: "Überprüfungen",
|
||||||
|
to: "/checks",
|
||||||
|
icon: "i-heroicons-magnifying-glass"
|
||||||
|
},
|
||||||
... dataStore.ownTenant.features.projects ? [{
|
... dataStore.ownTenant.features.projects ? [{
|
||||||
label: "Projekte",
|
label: "Projekte",
|
||||||
to: "/projects",
|
to: "/projects",
|
||||||
|
|||||||
337
pages/checks/[mode]/[[id]].vue
Normal file
337
pages/checks/[mode]/[[id]].vue
Normal file
@@ -0,0 +1,337 @@
|
|||||||
|
<script setup>
|
||||||
|
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
|
defineShortcuts({
|
||||||
|
'backspace': () => {
|
||||||
|
router.push("/checks")
|
||||||
|
},
|
||||||
|
'arrowleft': () => {
|
||||||
|
if(openTab.value > 0){
|
||||||
|
openTab.value -= 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'arrowright': () => {
|
||||||
|
if(openTab.value < 3) {
|
||||||
|
openTab.value += 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataStore = useDataStore()
|
||||||
|
const route = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
|
const toast = useToast()
|
||||||
|
const id = ref(route.params.id ? route.params.id : null )
|
||||||
|
const openTab = ref(0)
|
||||||
|
|
||||||
|
const vehicles = ref([])
|
||||||
|
const profiles = ref([])
|
||||||
|
const inventoryitems = ref([])
|
||||||
|
|
||||||
|
|
||||||
|
//Working
|
||||||
|
const mode = ref(route.params.mode || "show")
|
||||||
|
const itemInfo = ref({
|
||||||
|
name: "",
|
||||||
|
vehicle: null,
|
||||||
|
inventoryitem: null,
|
||||||
|
profile: null,
|
||||||
|
distance: 1,
|
||||||
|
distanceUnit: "days"
|
||||||
|
})
|
||||||
|
|
||||||
|
//Functions
|
||||||
|
const setupPage = async () => {
|
||||||
|
|
||||||
|
profiles.value = await useSupabaseSelect("profiles")
|
||||||
|
vehicles.value = await useSupabaseSelect("vehicles")
|
||||||
|
inventoryitems.value = await useSupabaseSelect("inventoryitems")
|
||||||
|
|
||||||
|
if(mode.value === "show" ){
|
||||||
|
itemInfo.value = await useSupabaseSelectSingle("checks", route.params.id, "*, checkexecutions(*, executed_by(fullName)), vehicle(*), profile(*), inventoryitem(*)")
|
||||||
|
} else if (mode.value === "edit"){
|
||||||
|
itemInfo.value = await useSupabaseSelectSingle("checks", route.params.id, "*")
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode.value === "create") {
|
||||||
|
let query = route.query
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancelEditorCreate = () => {
|
||||||
|
if(itemInfo.value) {
|
||||||
|
router.push(`/checks/show/${itemInfo.value.id}`)
|
||||||
|
} else {
|
||||||
|
router.push(`/checks/`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setupPage()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UDashboardNavbar>
|
||||||
|
<template #left>
|
||||||
|
<UButton
|
||||||
|
icon="i-heroicons-chevron-left"
|
||||||
|
variant="outline"
|
||||||
|
@click="router.push(`/checks`)"
|
||||||
|
>
|
||||||
|
Überprüfungen
|
||||||
|
</UButton>
|
||||||
|
</template>
|
||||||
|
<template #center>
|
||||||
|
<h1
|
||||||
|
v-if="itemInfo"
|
||||||
|
:class="['text-xl','font-medium']"
|
||||||
|
>{{itemInfo ? `Überprüfung: ${itemInfo.name}` : (mode === 'create' ? 'Überprüfung erstellen' : 'Überprüfung bearbeiten')}}</h1>
|
||||||
|
</template>
|
||||||
|
<template #right>
|
||||||
|
<UButton
|
||||||
|
v-if="mode === 'edit'"
|
||||||
|
@click="dataStore.updateItem('checks',itemInfo)"
|
||||||
|
>
|
||||||
|
Speichern
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
v-else-if="mode === 'create'"
|
||||||
|
@click="dataStore.createNewItem('checks',itemInfo)"
|
||||||
|
>
|
||||||
|
Erstellen
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
@click="cancelEditorCreate"
|
||||||
|
color="red"
|
||||||
|
class="ml-2"
|
||||||
|
v-if="mode === 'edit' || mode === 'create'"
|
||||||
|
>
|
||||||
|
Abbrechen
|
||||||
|
</UButton>
|
||||||
|
<UButton
|
||||||
|
v-if="mode === 'show'"
|
||||||
|
@click="router.push(`/checks/edit/${itemInfo.id}`)"
|
||||||
|
>
|
||||||
|
Bearbeiten
|
||||||
|
</UButton>
|
||||||
|
</template>
|
||||||
|
</UDashboardNavbar>
|
||||||
|
<UDashboardPanelContent>
|
||||||
|
<UTabs
|
||||||
|
v-if="itemInfo.id && mode === 'show'"
|
||||||
|
:items="[{label: 'Informationen'}, {label: 'Dokumente'}, {label: 'Ausführungen'}]"
|
||||||
|
class="p-5"
|
||||||
|
v-model="openTab"
|
||||||
|
>
|
||||||
|
<template #item="{item}">
|
||||||
|
<div v-if="item.label === 'Informationen'" class="flex mt-5">
|
||||||
|
<div class="w-1/2 mr-5">
|
||||||
|
<UCard>
|
||||||
|
<div class="text-wrap">
|
||||||
|
<table class="mb-3 w-full">
|
||||||
|
<tr>
|
||||||
|
<td>Name:</td>
|
||||||
|
<td>{{itemInfo.name}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Rhythmus:</td>
|
||||||
|
<td>
|
||||||
|
{{itemInfo.distance}}
|
||||||
|
<span v-if="itemInfo.distanceUnit === 'dayjs'">Tage</span>
|
||||||
|
<span v-if="itemInfo.distanceUnit === 'years'">Jahre</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="itemInfo.vehicle">
|
||||||
|
<td>Fahrzeug:</td>
|
||||||
|
<td>{{itemInfo.vehicle.licensePlate}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="itemInfo.profile">
|
||||||
|
<td>Person:</td>
|
||||||
|
<td>{{itemInfo.profile.fullName}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="itemInfo.inventoryitem">
|
||||||
|
<td>Inventarartikel:</td>
|
||||||
|
<td>{{itemInfo.inventoryitem.name}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Beschreibung:</td>
|
||||||
|
<td>{{itemInfo.description}}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</UCard>
|
||||||
|
</div>
|
||||||
|
<div class="w-1/2">
|
||||||
|
<UCard class="h-full">
|
||||||
|
<HistoryDisplay
|
||||||
|
type="check"
|
||||||
|
v-if="itemInfo"
|
||||||
|
:element-id="itemInfo.id"
|
||||||
|
:render-headline="true"
|
||||||
|
/>
|
||||||
|
</UCard>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="item.label === 'Dokumente'">
|
||||||
|
<UCard class="mt-5">
|
||||||
|
<Toolbar>
|
||||||
|
<DocumentUpload
|
||||||
|
type="check"
|
||||||
|
:element-id="itemInfo.id"
|
||||||
|
/>
|
||||||
|
</Toolbar>
|
||||||
|
<DocumentList
|
||||||
|
:documents="dataStore.getDocumentsByContractId(itemInfo.id)"
|
||||||
|
/>
|
||||||
|
</UCard>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div v-else-if="item.label === 'Ausführungen'">
|
||||||
|
<UCard class="mt-5">
|
||||||
|
<UTable
|
||||||
|
:rows="itemInfo.checkexecutions"
|
||||||
|
:columns="[{key:'created_at',label:'Ersellt am:'},{key:'executed_at',label:'Ausgeführt am:'},{key:'executed_by',label:'Ausgeführt von:'},{key:'description',label:'Beschreibung:'}]"
|
||||||
|
class="w-full"
|
||||||
|
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||||
|
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Ausführungen anzuzeigen' }"
|
||||||
|
>
|
||||||
|
<template #created_at-data="{row}">
|
||||||
|
{{dayjs(row.created_at).format("DD.MM.YYYY HH:mm")}}
|
||||||
|
</template>
|
||||||
|
<template #executed_at-data="{row}">
|
||||||
|
{{dayjs(row.executed_at).format("DD.MM.YYYY HH:mm")}}
|
||||||
|
</template>
|
||||||
|
<template #executed_by-data="{row}">
|
||||||
|
{{row.executed_by.fullName}}
|
||||||
|
</template>
|
||||||
|
</UTable>
|
||||||
|
</UCard>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</UTabs>
|
||||||
|
<UForm v-else-if="mode === 'edit' || mode === 'create'" class="p-5" >
|
||||||
|
<div class="mx-auto w-4/5">
|
||||||
|
<div class="flex flex-row justify-around">
|
||||||
|
<div class="w-1/2">
|
||||||
|
<UDivider>Allgemeines</UDivider>
|
||||||
|
<UFormGroup
|
||||||
|
label="Name:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.name"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Typ:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.type"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Rhythmus"
|
||||||
|
class="w-full"
|
||||||
|
>
|
||||||
|
<InputGroup class="w-full">
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.distance"
|
||||||
|
type="number"
|
||||||
|
class="flex-auto"
|
||||||
|
></UInput>
|
||||||
|
<USelectMenu
|
||||||
|
:options="[{key: 'days', label: 'Tage'},{key:'years',label:'Jahre'}]"
|
||||||
|
option-attribute="label"
|
||||||
|
value-attribute="key"
|
||||||
|
v-model="itemInfo.distanceUnit"
|
||||||
|
class="w-40"
|
||||||
|
></USelectMenu>
|
||||||
|
</InputGroup>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class=" ml-5 w-1/2">
|
||||||
|
<UDivider>Verknüpftes Element</UDivider>
|
||||||
|
<UFormGroup
|
||||||
|
label="Fahrzeug:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="vehicles"
|
||||||
|
option-attribute="licensePlate"
|
||||||
|
value-attribute="id"
|
||||||
|
v-model="itemInfo.vehicle"
|
||||||
|
:disabled="itemInfo.inventoryitem || itemInfo.profile"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Person:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="profiles"
|
||||||
|
option-attribute="fullName"
|
||||||
|
value-attribute="id"
|
||||||
|
v-model="itemInfo.profile"
|
||||||
|
:disabled="itemInfo.vehicle || itemInfo.inventoryitem"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Inventarartikel:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="inventoryitems"
|
||||||
|
option-attribute="name"
|
||||||
|
value-attribute="id"
|
||||||
|
v-model="itemInfo.inventoryitem"
|
||||||
|
:disabled="itemInfo.vehicle || itemInfo.profile"
|
||||||
|
>
|
||||||
|
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<UFormGroup
|
||||||
|
label="Beschreibung:"
|
||||||
|
>
|
||||||
|
<UTextarea
|
||||||
|
v-model="itemInfo.description"
|
||||||
|
rows="6"
|
||||||
|
maxrows="12"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</UForm>
|
||||||
|
</UDashboardPanelContent>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
td {
|
||||||
|
border-bottom: 1px solid lightgrey;
|
||||||
|
vertical-align: top;
|
||||||
|
padding-bottom: 0.15em;
|
||||||
|
padding-top: 0.15em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
148
pages/checks/index.vue
Normal file
148
pages/checks/index.vue
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<template>
|
||||||
|
<UDashboardNavbar title="Überprüfungen" :badge="filteredRows.length">
|
||||||
|
<template #right>
|
||||||
|
<UInput
|
||||||
|
id="searchinput"
|
||||||
|
v-model="searchString"
|
||||||
|
icon="i-heroicons-funnel"
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder="Suche..."
|
||||||
|
class="hidden lg:block"
|
||||||
|
@keydown.esc="$event.target.blur()"
|
||||||
|
>
|
||||||
|
<template #trailing>
|
||||||
|
<UKbd value="/" />
|
||||||
|
</template>
|
||||||
|
</UInput>
|
||||||
|
|
||||||
|
<UButton @click="router.push(`/checks/create`)">+ Überprüfung</UButton>
|
||||||
|
</template>
|
||||||
|
</UDashboardNavbar>
|
||||||
|
|
||||||
|
<UDashboardToolbar>
|
||||||
|
<template #right>
|
||||||
|
<USelectMenu
|
||||||
|
v-model="selectedColumns"
|
||||||
|
icon="i-heroicons-adjustments-horizontal-solid"
|
||||||
|
:options="templateColumns"
|
||||||
|
multiple
|
||||||
|
class="hidden lg:block"
|
||||||
|
by="key"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
Spalten
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</template>
|
||||||
|
</UDashboardToolbar>
|
||||||
|
|
||||||
|
<UTable
|
||||||
|
:rows="filteredRows"
|
||||||
|
:columns="columns"
|
||||||
|
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 #name-data="{row}">
|
||||||
|
<span v-if="row === filteredRows[selectedItem]" class="text-primary-500 font-bold">{{row.name}}</span>
|
||||||
|
<span v-else>{{row.name}}</span>
|
||||||
|
</template>
|
||||||
|
<template #vehicle-data="{row}">
|
||||||
|
<span v-if="row.vehicle">{{row.vehicle.licensePlate}}</span>
|
||||||
|
</template>
|
||||||
|
<template #profile-data="{row}">
|
||||||
|
<span v-if="row.profile">{{row.profile.fullName}}</span>
|
||||||
|
</template>
|
||||||
|
<template #inventoryitem-data="{row}">
|
||||||
|
<span v-if="row.inventoryitem">{{row.inventoryitem.name}}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</UTable>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
definePageMeta({
|
||||||
|
middleware: "auth"
|
||||||
|
})
|
||||||
|
|
||||||
|
defineShortcuts({
|
||||||
|
'/': () => {
|
||||||
|
//console.log(searchinput)
|
||||||
|
//searchinput.value.focus()
|
||||||
|
document.getElementById("searchinput").focus()
|
||||||
|
},
|
||||||
|
'+': () => {
|
||||||
|
router.push("/checks/create")
|
||||||
|
},
|
||||||
|
'Enter': {
|
||||||
|
usingInput: true,
|
||||||
|
handler: () => {
|
||||||
|
router.push(`/checks/show/${filteredRows.value[selectedItem.value].id}`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'arrowdown': () => {
|
||||||
|
if(selectedItem.value < filteredRows.value.length - 1) {
|
||||||
|
selectedItem.value += 1
|
||||||
|
} else {
|
||||||
|
selectedItem.value = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'arrowup': () => {
|
||||||
|
if(selectedItem.value === 0) {
|
||||||
|
selectedItem.value = filteredRows.value.length - 1
|
||||||
|
} else {
|
||||||
|
selectedItem.value -= 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataStore = useDataStore()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const items = ref([])
|
||||||
|
const selectedItem = ref(0)
|
||||||
|
|
||||||
|
const setupPage = async () => {
|
||||||
|
items.value = await useSupabaseSelect("checks","*, vehicle(licensePlate), profile(fullName), inventoryitem(name)")
|
||||||
|
}
|
||||||
|
|
||||||
|
setupPage()
|
||||||
|
|
||||||
|
const templateColumns = [
|
||||||
|
{
|
||||||
|
key: "name",
|
||||||
|
label: "Name",
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "vehicle",
|
||||||
|
label: "Fahrzeug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "profile",
|
||||||
|
label: "Person"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "inventoryitem",
|
||||||
|
label: "Inventarartikel"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "notes",
|
||||||
|
label: "Notizen"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const selectedColumns = ref(templateColumns)
|
||||||
|
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
|
||||||
|
|
||||||
|
|
||||||
|
const searchString = ref('')
|
||||||
|
const filteredRows = computed(() => {
|
||||||
|
return useSearch(searchString.value, items.value)
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
|
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
|
||||||
|
import DocumentUpload from "~/components/DocumentUpload.vue";
|
||||||
|
import DocumentList from "~/components/DocumentList.vue";
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: "auth"
|
middleware: "auth"
|
||||||
@@ -24,7 +26,7 @@ const itemInfo = ref({
|
|||||||
//Functions
|
//Functions
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
if(mode.value === "show"){
|
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") {
|
} else if(mode.value === "edit") {
|
||||||
itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*")
|
itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*")
|
||||||
}
|
}
|
||||||
@@ -114,8 +116,8 @@ setupPage()
|
|||||||
</template>
|
</template>
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
<UTabs
|
<UTabs
|
||||||
:items="[{label: 'Informationen'}]"
|
:items="[{label: 'Informationen'},{label: 'Dokumente'},{label: 'Überprüfungen'}]"
|
||||||
v-if="itemInfo && mode == 'show'"
|
v-if="itemInfo && mode === 'show'"
|
||||||
class="p-5"
|
class="p-5"
|
||||||
>
|
>
|
||||||
<template #item="{item}">
|
<template #item="{item}">
|
||||||
@@ -195,6 +197,34 @@ setupPage()
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</template>
|
||||||
</UTabs>
|
</UTabs>
|
||||||
<UForm
|
<UForm
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const oldItemInfo = ref({})
|
|||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
|
|
||||||
if(route.params.id) {
|
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))
|
if(itemInfo.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
|
||||||
@@ -133,6 +133,8 @@ const isLight = computed({
|
|||||||
label: 'Vertragsdaten'
|
label: 'Vertragsdaten'
|
||||||
},{
|
},{
|
||||||
label: 'Dokumente'
|
label: 'Dokumente'
|
||||||
|
},{
|
||||||
|
label: 'Überprüfungen'
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
@@ -397,6 +399,22 @@ const isLight = computed({
|
|||||||
|
|
||||||
<DocumentList :documents="dataStore.getDocumentsByProfileId(itemInfo.id)"/>
|
<DocumentList :documents="dataStore.getDocumentsByProfileId(itemInfo.id)"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="item.label === 'Überprüfungen'">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
</UCard>
|
</UCard>
|
||||||
</template>
|
</template>
|
||||||
</UTabs>
|
</UTabs>
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ const tabItems = [{
|
|||||||
label: 'Informationen',
|
label: 'Informationen',
|
||||||
}, {
|
}, {
|
||||||
label: 'Dokumente',
|
label: 'Dokumente',
|
||||||
|
}, {
|
||||||
|
label: 'Überprüfungen',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
const incomingInvoicesColumns = [
|
const incomingInvoicesColumns = [
|
||||||
@@ -73,7 +75,9 @@ const incomingInvoicesColumns = [
|
|||||||
|
|
||||||
//Functions
|
//Functions
|
||||||
const setupPage = async () => {
|
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,"*")
|
itemInfo.value = await useSupabaseSelectSingle("vehicles",route.params.id,"*")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,16 +258,36 @@ setupPage()
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="item.label === 'Dokumente'">
|
<div v-else-if="item.label === 'Dokumente'">
|
||||||
<Toolbar>
|
<UCard class="mt-5">
|
||||||
<DocumentUpload
|
<Toolbar>
|
||||||
type="vehicle"
|
<DocumentUpload
|
||||||
:element-id="itemInfo.id"
|
type="vehicle"
|
||||||
/>
|
:element-id="itemInfo.id"
|
||||||
</Toolbar>
|
/>
|
||||||
|
</Toolbar>
|
||||||
|
|
||||||
<DocumentList
|
<DocumentList
|
||||||
:documents="dataStore.getDocumentsByVehicleId(itemInfo.id)"
|
:documents="dataStore.getDocumentsByVehicleId(itemInfo.id)"
|
||||||
/>
|
/>
|
||||||
|
</UCard>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="item.label === 'Überprüfungen'">
|
||||||
|
<UCard class="mt-5">
|
||||||
|
<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>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -161,6 +161,12 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
labelSingle: "Projekttyp",
|
labelSingle: "Projekttyp",
|
||||||
redirect: true,
|
redirect: true,
|
||||||
historyItemHolder: "projecttype"
|
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)
|
//console.log(supabaseData)
|
||||||
await generateHistoryItems(dataType, supabaseData[0])
|
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) + ')')
|
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"))
|
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) => {
|
const getDocumentsByPlantId = computed(() => (itemId) => {
|
||||||
return documents.value.filter(item => item.plant === itemId && !item.tags.includes("Archiviert"))
|
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"))
|
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) => {
|
const getDocumentsByVehicleId = computed(() => (itemId) => {
|
||||||
return documents.value.filter(item => item.vehicle === itemId && !item.tags.includes("Archiviert"))
|
return documents.value.filter(item => item.vehicle === itemId && !item.tags.includes("Archiviert"))
|
||||||
})
|
})
|
||||||
@@ -1780,8 +1794,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
getContactsByVendorId,
|
getContactsByVendorId,
|
||||||
getDocumentsByProjectId,
|
getDocumentsByProjectId,
|
||||||
getDocumentsByProfileId,
|
getDocumentsByProfileId,
|
||||||
|
getDocumentsByInventoryItemId,
|
||||||
getDocumentsByPlantId,
|
getDocumentsByPlantId,
|
||||||
getDocumentsByContractId,
|
getDocumentsByContractId,
|
||||||
|
getDocumentsByCheckId,
|
||||||
getDocumentsByVehicleId,
|
getDocumentsByVehicleId,
|
||||||
getDocumentsByProductId,
|
getDocumentsByProductId,
|
||||||
getDocumentsByVendorId,
|
getDocumentsByVendorId,
|
||||||
|
|||||||
Reference in New Issue
Block a user