Changes in Tags and Updating

This commit is contained in:
2024-07-21 22:34:10 +02:00
parent 510ce73ecd
commit dc480f38b6
2 changed files with 18 additions and 11 deletions

View File

@@ -31,10 +31,12 @@ const openDocument = async () => {
} }
const updateDocument = async () => { const updateDocument = async () => {
console.log("Update")
const {url, ...objData} = documentData const {url, ...objData} = documentData
delete objData.url delete objData.url
const {data,error} = await supabase const {data,error} = await supabase
.from("documents") .from("documents")
.update(objData) .update(objData)
@@ -46,7 +48,7 @@ const updateDocument = async () => {
} else { } else {
toast.add({title: "Dokument aktualisiert"}) toast.add({title: "Dokument aktualisiert"})
dataStore.fetchDocuments() dataStore.fetchDocuments()
openShowModal.value = false //openShowModal.value = false
} }
} }
@@ -178,13 +180,17 @@ const updateDocumentAssignment = async () => {
> >
<UCard class="flex flex-col flex-1" :ui="{ body: { base: 'flex-1' }, ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }"> <UCard class="flex flex-col flex-1" :ui="{ body: { base: 'flex-1' }, ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
<template #header> <template #header>
<div class="flex items-center gap-2"> <div class="flex flex-row justify-between">
<UBadge <div class="flex items-center gap-2">
v-for="tag in documentData.tags" <UBadge
> v-for="tag in documentData.tags"
{{tag}} >
</UBadge> {{tag}}
</UBadge>
</div>
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="openShowModal = false" />
</div> </div>
</template> </template>
<UContainer class="h-full" :ui="{padding: 'px-1 sm:px-1 lg:px-1'}"> <UContainer class="h-full" :ui="{padding: 'px-1 sm:px-1 lg:px-1'}">
@@ -210,12 +216,12 @@ const updateDocumentAssignment = async () => {
> >
Archivieren Archivieren
</UButton> </UButton>
<UButton <!-- <UButton
v-if="documentData.tags.includes('Eingangsrechnung')" v-if="documentData.tags.includes('Eingangsrechnung')"
@click="createVendorInvoice" @click="createVendorInvoice"
> >
Eingangsrechnung erstellen Eingangsrechnung erstellen
</UButton> </UButton>-->
</UButtonGroup> </UButtonGroup>
<br> <br>
<a <a
@@ -229,7 +235,7 @@ const updateDocumentAssignment = async () => {
<USelectMenu <USelectMenu
:options="tags" :options="tags"
v-model="documentData.tags" v-model="documentData.tags"
@close="updateDocument" @change="updateDocument"
multiple multiple
> >
<template #label> <template #label>

View File

@@ -28,7 +28,8 @@ const selectedTags = ref("Eingang")
const documents = ref([]) const documents = ref([])
const setupPage = async () => { const setupPage = async () => {
documents.value = await useSupabaseSelectDocuments("*, project(id,name), customer(id,name), contract(id,name), vendor(id,name), plant(id,name), vehicle(id,licensePlate), product(id,name), profile(id,fullName) ") //documents.value = await useSupabaseSelectDocuments("*, project(id,name), customer(id,name), contract(id,name), vendor(id,name), plant(id,name), vehicle(id,licensePlate), product(id,name), profile(id,fullName) ")
documents.value = await useSupabaseSelectDocuments("*")
} }