Changes
This commit is contained in:
@@ -61,6 +61,7 @@ const itemInfo = ref({
|
||||
|
||||
const letterheads = ref([])
|
||||
const createdDocuments = ref([])
|
||||
const projects = ref([])
|
||||
const products = ref([])
|
||||
const productcategories = ref([])
|
||||
const selectedProductcategorie = ref(null)
|
||||
@@ -72,6 +73,7 @@ const setupPage = async () => {
|
||||
|
||||
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
|
||||
createdDocuments.value = (await useSupabaseSelect("createddocuments","*"))
|
||||
projects.value = (await useSupabaseSelect("projects","*"))
|
||||
services.value = (await useSupabaseSelect("services","*"))
|
||||
servicecategories.value = (await useSupabaseSelect("servicecategories","*"))
|
||||
products.value = (await useSupabaseSelect("products","*"))
|
||||
@@ -304,6 +306,7 @@ const findDocumentErrors = computed(() => {
|
||||
let errors = []
|
||||
|
||||
if(itemInfo.value.customer === null) errors.push({message: "Es ist kein Kunde ausgewählt", type: "breaking"})
|
||||
if(itemInfo.value.contact === null) errors.push({message: "Es ist kein Kontakt ausgewählt", type: "info"})
|
||||
if(itemInfo.value.letterhead === null) errors.push({message: "Es ist kein Briefpapier ausgewählt", type: "breaking"})
|
||||
if(itemInfo.value.address.street === null) errors.push({message: "Es ist keine Straße im Adressat angegeben", type: "breaking"})
|
||||
if(itemInfo.value.address.zip === null) errors.push({message: "Es ist keine Postleitzahl im Adressat angegeben", type: "breaking"})
|
||||
@@ -311,12 +314,19 @@ const findDocumentErrors = computed(() => {
|
||||
|
||||
if(itemInfo.value.project === null) errors.push({message: "Es ist kein Projekt ausgewählt", type: "info"})
|
||||
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.mode === "normal" && !row.product) errors.push({message: `In Position ${row.pos} ist kein Artikel ausgewählt`, type: "breaking"})
|
||||
if(row.mode === "service" && !row.service) errors.push({message: `In Position ${row.pos} ist keine Leistung ausgewählt`, type: "breaking"})
|
||||
if(row.mode === "title" && !row.text) errors.push({message: `In Position ${row.pos} ist kein Titel hinterlegt`, type: "breaking"})
|
||||
if(row.mode === "text" && !row.text) errors.push({message: `In einer Freitext Position ist kein Titel hinterlegt`, type: "breaking"})
|
||||
})
|
||||
if(itemInfo.value.rows.length === 0) {
|
||||
errors.push({message: "Es sind keine Positionen angegeben", type: "breaking"})
|
||||
} else {
|
||||
itemInfo.value.rows.forEach(row => {
|
||||
if(row.mode === "normal" && !row.product) errors.push({message: `In Position ${row.pos} ist kein Artikel ausgewählt`, type: "breaking"})
|
||||
if(row.mode === "service" && !row.service) errors.push({message: `In Position ${row.pos} ist keine Leistung ausgewählt`, type: "breaking"})
|
||||
if(row.mode === "title" && !row.text) errors.push({message: `In Position ${row.pos} ist kein Titel hinterlegt`, type: "breaking"})
|
||||
if(row.mode === "text" && !row.text) errors.push({message: `In einer Freitext Position ist kein Titel hinterlegt`, type: "breaking"})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(itemInfo.value.type === "serialInvoices") {
|
||||
if(!itemInfo.value.serialConfig.intervall) errors.push({message: `Kein Intervall für die Ausführung festgelegt`, type: "breaking"})
|
||||
@@ -326,7 +336,7 @@ const findDocumentErrors = computed(() => {
|
||||
}
|
||||
|
||||
|
||||
return errors
|
||||
return errors.sort((a,b) => (a.type === "breaking") ? -1 : 1)
|
||||
})
|
||||
|
||||
const tabItems = computed(() => {
|
||||
@@ -975,7 +985,7 @@ setupPage()
|
||||
>
|
||||
<InputGroup>
|
||||
<USelectMenu
|
||||
:options="dataStore.projects"
|
||||
:options="projects.filter(i => i.customer === itemInfo.customer)"
|
||||
v-model="itemInfo.project"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
@@ -983,6 +993,7 @@ setupPage()
|
||||
searchable-placeholder="Suche..."
|
||||
:search-attributes="['name']"
|
||||
class="w-full"
|
||||
:disabled="!itemInfo.customer"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
|
||||
@@ -1159,7 +1170,7 @@ setupPage()
|
||||
class="my-3"
|
||||
/>
|
||||
|
||||
<table class="w-full">
|
||||
<table class="w-full" v-if="itemInfo.rows.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
@@ -1491,6 +1502,13 @@ setupPage()
|
||||
</template>
|
||||
</draggable>
|
||||
</table>
|
||||
<UAlert
|
||||
v-else
|
||||
title="Keine Positionen hinzugefügt"
|
||||
color="rose"
|
||||
variant="outline"
|
||||
icon="i-heroicons-light-bulb"
|
||||
></UAlert>
|
||||
|
||||
<InputGroup>
|
||||
<UButton
|
||||
|
||||
Reference in New Issue
Block a user