Changed some in EntityShowSubCreatedDocuments.vue

This commit is contained in:
2025-06-26 11:36:54 +02:00
parent 583ca15dcc
commit e98e1dc634

View File

@@ -68,27 +68,27 @@ setup()
const templateColumns = [ const templateColumns = [
{ {
key: "reference", key: "reference",
label: "Referenz", label: "Referenz"
sortable: true
}, },
{ {
key: 'type', key: 'type',
label: "Typ", label: "Typ"
sortable: true
},{ },{
key: 'state', key: 'state',
label: "Status", label: "Status"
sortable: true },{
key: 'paid',
label: "Bezahlt"
}, },
{ {
key: "date", key: "date",
label: "Datum", label: "Datum"
sortable: true
}, },
{ {
key: "dueDate", key: "dueDate",
label: "Fällig", label: "Fällig"
sortable: true
} }
] ]
const selectedColumns = ref(tempStore.columns["createddocuments"] ? tempStore.columns["createddocuments"] : templateColumns) const selectedColumns = ref(tempStore.columns["createddocuments"] ? tempStore.columns["createddocuments"] : templateColumns)
@@ -119,7 +119,14 @@ const getAvailableQueryStringData = (keys) => {
} }
const invoiceDeliveryNotes = () => { const invoiceDeliveryNotes = () => {
router.push(`/createDocument/edit?type=invoices&linkedDocuments=[${props.item.createddocuments.filter(i => i.type === "deliveryNotes").map(i => i.id)}]`) router.push(`/createDocument/edit?type=invoices&loadMode=deliveryNotes&linkedDocuments=[${props.item.createddocuments.filter(i => i.type === "deliveryNotes").map(i => i.id)}]`)
}
const showFinalInvoiceConfig = ref(false)
const referenceDocument = ref(null)
const advanceInvoicesToAdd = ref([])
const invoiceAdvanceInvoices = () => {
router.push(`/createDocument/edit?type=invoices&loadMode=finalInvoice&linkedDocuments=[${[referenceDocument.value, ... advanceInvoicesToAdd.value]}]`)
} }
const selectItem = (item) => { const selectItem = (item) => {
@@ -166,6 +173,59 @@ const selectItem = (item) => {
> >
+ Abschlagsrechnung + Abschlagsrechnung
</UButton> </UButton>
<UButton
@click="showFinalInvoiceConfig = true"
v-if="props.topLevelType === 'projects'"
:disabled="!props.item.createddocuments.filter(i => !i.archived && i.type === 'advanceInvoices').length > 0"
>
+ Schlussrechnung
</UButton>
<UModal
prevent-close
v-model="showFinalInvoiceConfig"
>
<UCard>
<template #header>
<div class="flex items-center justify-between">
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
Schlussrechnung konfigurieren
</h3>
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="isOpen = false" />
</div>
</template>
<UFormGroup
label="Rechnungsvorlage"
>
<USelectMenu
:options="props.item.createddocuments.filter(i => ['confirmationOrders','quotes'].includes(i.type))"
value-attribute="id"
option-attribute="documentNumber"
v-model="referenceDocument"
/>
</UFormGroup>
<UFormGroup
label="Abschlagsrechnungen"
>
<USelectMenu
:options="props.item.createddocuments.filter(i => ['advanceInvoices'].includes(i.type))"
multiple
value-attribute="id"
option-attribute="documentNumber"
v-model="advanceInvoicesToAdd"
/>
</UFormGroup>
<template #footer>
<UButton
@click="invoiceAdvanceInvoices"
>
Weiter
</UButton>
</template>
</UCard>
</UModal>
<UButton <UButton
@click="router.push(`/createDocument/edit/?${getAvailableQueryStringData({type: 'invoices'})}`)" @click="router.push(`/createDocument/edit/?${getAvailableQueryStringData({type: 'invoices'})}`)"
> >
@@ -219,6 +279,12 @@ const selectItem = (item) => {
{{row.state}} {{row.state}}
</span> </span>
</template> </template>
<template #paid-data="{row}">
<div v-if="(row.type === 'invoices' ||row.type === 'advanceInvoices') && row.state === 'Gebucht'">
<span v-if="useSum().getIsPaid(row)" class="text-primary-500">Bezahlt</span>
<span v-else class="text-rose-600">Offen</span>
</div>
</template>
<template #reference-data="{row}"> <template #reference-data="{row}">
<span v-if="row === props.item.createddocuments[selectedItem]" class="text-primary-500 font-bold">{{row.documentNumber}}</span> <span v-if="row === props.item.createddocuments[selectedItem]" class="text-primary-500 font-bold">{{row.documentNumber}}</span>
<span v-else>{{row.documentNumber}}</span> <span v-else>{{row.documentNumber}}</span>