Many Changes
This commit is contained in:
@@ -5,7 +5,7 @@ const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
const router = useRouter()
|
||||
const props = defineProps({
|
||||
document: {
|
||||
documentData: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
@@ -13,9 +13,10 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
required: false,
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const {document, openShowModal:openShowModalProp } = props;
|
||||
let {documentData, openShowModal:openShowModalProp } = props;
|
||||
const tags = dataStore.getDocumentTags
|
||||
const openShowModal = ref(false)
|
||||
|
||||
@@ -27,7 +28,7 @@ const openDocument = async () => {
|
||||
|
||||
const updateDocument = async () => {
|
||||
|
||||
const {url, ...objData} = document
|
||||
const {url, ...objData} = documentData
|
||||
delete objData.url
|
||||
|
||||
const {data,error} = await supabase
|
||||
@@ -50,7 +51,7 @@ const createVendorInvoice = async () => {
|
||||
const {data:vendorInvoiceData,error:vendorInvoiceError} = await supabase
|
||||
.from("incomingInvoices")
|
||||
.insert([{
|
||||
document: document.id,
|
||||
document: documentData.id,
|
||||
}])
|
||||
.select()
|
||||
if(vendorInvoiceError) {
|
||||
@@ -62,7 +63,7 @@ const createVendorInvoice = async () => {
|
||||
.update({
|
||||
vendorInvoice: vendorInvoiceData[0].id
|
||||
})
|
||||
.eq('id',document.id)
|
||||
.eq('id',documentData.id)
|
||||
.select()
|
||||
|
||||
if(documentError) {
|
||||
@@ -84,16 +85,18 @@ const createVendorInvoice = async () => {
|
||||
|
||||
|
||||
const archiveDocument = () => {
|
||||
document.tags = ["Archiviert"]
|
||||
documentData.tags = ["Archiviert"]
|
||||
updateDocument()
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="documentListItem">
|
||||
<object
|
||||
:data="document.url"
|
||||
:data="documentData.url"
|
||||
class="previewEmbed"
|
||||
type="application/pdf"
|
||||
/>
|
||||
@@ -104,22 +107,21 @@ const archiveDocument = () => {
|
||||
<UIcon name="i-heroicons-eye-solid" />
|
||||
</UButton>
|
||||
<UToggle
|
||||
v-model="document.selected"
|
||||
v-model="documentData.selected"
|
||||
class="ml-2"
|
||||
/>
|
||||
<br>
|
||||
<UBadge
|
||||
v-if="document.vendorInvoice"
|
||||
>{{dataStore.incomingInvoices.find(item => item.id === document.vendorInvoice) ? dataStore.incomingInvoices.find(item => item.id === document.vendorInvoice).reference : ''}}</UBadge>
|
||||
v-if="documentData.vendorInvoice"
|
||||
>{{dataStore.incomingInvoices.find(item => item.id === documentData.vendorInvoice) ? dataStore.incomingInvoices.find(item => item.id === documentData.vendorInvoice).reference : ''}}</UBadge>
|
||||
<UBadge
|
||||
v-if="document.inDatev"
|
||||
v-if="documentData.inDatev"
|
||||
>DATEV</UBadge>
|
||||
{{documentData}}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Slideovers -->
|
||||
|
||||
<USlideover
|
||||
v-model="openShowModal"
|
||||
fullscreen
|
||||
@@ -128,7 +130,7 @@ const archiveDocument = () => {
|
||||
<template #header>
|
||||
<div class="flex items-center gap-2">
|
||||
<UBadge
|
||||
v-for="tag in document.tags"
|
||||
v-for="tag in documentData.tags"
|
||||
>
|
||||
{{tag}}
|
||||
</UBadge>
|
||||
@@ -138,12 +140,13 @@ const archiveDocument = () => {
|
||||
<UContainer class="h-full" :ui="{padding: 'px-1 sm:px-1 lg:px-1'}">
|
||||
<object
|
||||
class="h-full w-full"
|
||||
:data="document.url"
|
||||
:data="documentData.url"
|
||||
type="application/pdf"
|
||||
/>
|
||||
</UContainer>
|
||||
|
||||
<template #footer>
|
||||
|
||||
<UButtonGroup>
|
||||
<UButton
|
||||
@click="archiveDocument"
|
||||
@@ -151,7 +154,7 @@ const archiveDocument = () => {
|
||||
Archivieren
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="document.tags.includes('Eingangsrechnung')"
|
||||
v-if="documentData.tags.includes('Eingangsrechnung')"
|
||||
@click="createVendorInvoice"
|
||||
>
|
||||
Eingangsrechnung erstellen
|
||||
@@ -164,12 +167,12 @@ const archiveDocument = () => {
|
||||
>
|
||||
<USelectMenu
|
||||
:options="tags"
|
||||
v-model="document.tags"
|
||||
v-model="documentData.tags"
|
||||
@close="updateDocument"
|
||||
multiple
|
||||
>
|
||||
<template #label>
|
||||
{{document.tags.length}} ausgewählt
|
||||
{{documentData.tags.length}} ausgewählt
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
@@ -181,13 +184,13 @@ const archiveDocument = () => {
|
||||
:options="dataStore.projects"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
v-model="document.project"
|
||||
v-model="documentData.project"
|
||||
@change="updateDocument"
|
||||
searchable
|
||||
:search-attributes="['name']"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.projects.find(item => item.id === document.project) ? dataStore.projects.find(item => item.id === document.project).name : "Kein Projekt ausgewählt" }}
|
||||
{{dataStore.projects.find(item => item.id === documentData.project) ? dataStore.projects.find(item => item.id === documentData.project).name : "Kein Projekt ausgewählt" }}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
@@ -199,13 +202,13 @@ const archiveDocument = () => {
|
||||
:options="dataStore.customers"
|
||||
option-attribute="name"
|
||||
value-attribute="id"
|
||||
v-model="document.customer"
|
||||
v-model="documentData.customer"
|
||||
@change="updateDocument"
|
||||
searchable
|
||||
:search-attributes="['name']"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.customers.find(item => item.id === document.customer) ? dataStore.customers.find(item => item.id === document.customer).name : "Kein Kunde ausgewählt" }}
|
||||
{{dataStore.customers.find(item => item.id === documentData.customer) ? dataStore.customers.find(item => item.id === documentData.customer).name : "Kein Kunde ausgewählt" }}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
|
||||
Reference in New Issue
Block a user