Added Errors to IncomingInvoices

Added Vorbereitet to IncomingInvoices
This commit is contained in:
2025-06-30 13:45:06 +02:00
parent 93d0f97a56
commit ff6ee91075
4 changed files with 85 additions and 9 deletions

View File

@@ -125,14 +125,43 @@ const totalCalculated = computed(() => {
})
const updateIncomingInvoice = async () => {
const updateIncomingInvoice = async (setBooked = false) => {
let item = itemInfo.value
delete item.files
if(item.state === "Vorbereitet" && !setBooked) {
item.state = "Entwurf"
} else if(item.state === "Vorbereitet" && setBooked) {
item.state = "Gebucht"
}
const data = await dataStore.updateItem('incominginvoices',item)
}
const findIncomingInvoiceErrors = computed(() => {
let errors = []
if(itemInfo.value.vendor === null) errors.push({message: "Es ist kein Lieferant ausgewählt", type: "breaking"})
if(itemInfo.value.reference === null) errors.push({message: "Es ist keine Referenz angegeben", type: "breaking"})
if(itemInfo.value.date === null) errors.push({message: "Es ist kein Datum ausgewählt", type: "breaking"})
if(itemInfo.value.dueDate === null) errors.push({message: "Es ist kein Fälligkeitsdatum ausgewählt", type: "breaking"})
if(itemInfo.value.paymentType === null) errors.push({message: "Es ist keine Zahlart ausgewählt", type: "breaking"})
if(itemInfo.value.description === null) errors.push({message: "Es ist keine Beschreibung angegeben", type: "info"})
itemInfo.value.accounts.forEach(account => {
if(account.account === null) errors.push({message: "Es ist keine Kategorie ausgewählt", type: "breaking"})
if(account.amountNet === null) errors.push({message: "Es ist kein Nettobetrag angegeben", type: "breaking"})
if(account.taxType === null) errors.push({message: "Es ist kein Steuertyp ausgewählt", type: "breaking"})
if(account.costCentre === null) errors.push({message: "Es ist keine Kostenstelle ausgewählt", type: "info"})
})
return errors.sort((a,b) => (a.type === "breaking") ? -1 : 1)
})
</script>
@@ -144,6 +173,12 @@ const updateIncomingInvoice = async () => {
>
Speichern
</UButton>
<UButton
@click="updateIncomingInvoice(true)"
:disabled="findIncomingInvoiceErrors.filter(i => i.type === 'breaking').length > 0"
>
Speichern & Buchen
</UButton>
</template>
</UDashboardNavbar>
<UDashboardPanelContent>
@@ -158,7 +193,22 @@ const updateIncomingInvoice = async () => {
/>
<div class="w-3/5 mx-5">
<UAlert
class="mb-5"
title="Vorhandene Probleme und Informationen:"
:color="findIncomingInvoiceErrors.filter(i => i.type === 'breaking').length > 0 ? 'rose' : 'white'"
variant="outline"
v-if="findIncomingInvoiceErrors.length > 0"
>
<template #description>
<ul class="list-disc ml-5">
<li v-for="error in findIncomingInvoiceErrors" :class="[...error.type === 'breaking' ? ['text-rose-600'] : ['dark:text-white','text-black']]">
{{error.message}}
</li>
</ul>
</template>
</UAlert>
<div class=" scrollContainer">
<InputGroup class="mb-3">
@@ -470,7 +520,7 @@ const updateIncomingInvoice = async () => {
overflow-y: scroll;
padding-left: 1em;
padding-right: 1em;
height: 75vh;
height: 70vh;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}