Added Errors to IncomingInvoices
Added Vorbereitet to IncomingInvoices
This commit is contained in:
@@ -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 */
|
||||
}
|
||||
|
||||
@@ -93,7 +93,10 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
|
||||
|
||||
const searchString = ref('')
|
||||
const filteredRows = computed(() => {
|
||||
return useSearch(searchString.value, items.value)
|
||||
let filteredItems = useSearch(searchString.value, items.value)
|
||||
|
||||
return [...filteredItems.filter(i => i.state === "Vorbereitet"), ...filteredItems.filter(i => i.state !== "Vorbereitet")]
|
||||
|
||||
|
||||
})
|
||||
|
||||
@@ -115,6 +118,16 @@ const isPaid = (item) => {
|
||||
return Math.abs(amountPaid) === Math.abs(Number(getInvoiceSum(item)))
|
||||
}
|
||||
|
||||
const selectIncomingInvoice = (invoice) => {
|
||||
if(invoice.state === "Vorbereitet") {
|
||||
router.push(`/incomingInvoices/edit/${invoice.id}`)
|
||||
} else {
|
||||
router.push(`/incomingInvoices/show/${invoice.id}`)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@@ -162,13 +175,18 @@ const isPaid = (item) => {
|
||||
:columns="columns"
|
||||
class="w-full"
|
||||
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||
@select="(i) => router.push(`/incomingInvoices/show/${i.id}`) "
|
||||
@select="(i) => selectIncomingInvoice(i) "
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Belege anzuzeigen' }"
|
||||
>
|
||||
<template #reference-data="{row}">
|
||||
<span v-if="row === filteredRows[selectedItem]" class="text-primary-500 font-bold">{{row.reference}}</span>
|
||||
<span v-else>{{row.reference}}</span>
|
||||
</template>
|
||||
<template #state-data="{row}">
|
||||
<span v-if="row.state === 'Vorbereitet'" class="text-cyan-500">{{row.state}}</span>
|
||||
<span v-else-if="row.state === 'Entwurf'" class="text-red-500">{{row.state}}</span>
|
||||
<span v-else-if="row.state === 'Gebucht'" class="text-primary-500">{{row.state}}</span>
|
||||
</template>
|
||||
<template #date-data="{row}">
|
||||
{{dayjs(row.date).format("DD.MM.YYYY")}}
|
||||
</template>
|
||||
|
||||
@@ -71,6 +71,15 @@ setupPage()
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar :title="'Eingangsbeleg anzeigen'">
|
||||
<template #left>
|
||||
<UButton
|
||||
to="/incominginvoices"
|
||||
icon="i-heroicons-chevron-left"
|
||||
variant="outline"
|
||||
>
|
||||
Übersicht
|
||||
</UButton>
|
||||
</template>
|
||||
<template #right>
|
||||
<UButton
|
||||
@click="router.push(`/incomingInvoices/edit/${itemInfo.id}`)"
|
||||
|
||||
Reference in New Issue
Block a user