Added Plant to createddocuments

Added Timespan to createddocuments
Changed Info to Array
Removed some Datastore remains
This commit is contained in:
2025-02-02 18:11:48 +01:00
parent 6676d6314b
commit 85c7a18b1a

View File

@@ -66,6 +66,7 @@ console.log(profileStore.ownTenant)
const letterheads = ref([])
const createddocuments = ref([])
const projects = ref([])
const plants = ref([])
const products = ref([])
const productcategories = ref([])
const selectedProductcategorie = ref(null)
@@ -83,6 +84,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","*"))
plants.value = (await useSupabaseSelect("plants","*"))
services.value = (await useSupabaseSelect("services","*"))
servicecategories.value = (await useSupabaseSelect("servicecategories","*"))
products.value = (await useSupabaseSelect("products","*"))
@@ -670,18 +672,54 @@ const getDocumentData = () => {
city: itemInfo.value.address.city || customerData.infoData.city,
zip: itemInfo.value.address.zip || customerData.infoData.zip
},
info: {
/*info: {
customerNumber: customerData.customerNumber,
documentNumber: itemInfo.value.documentNumber,
documentNumberTitle: itemInfo.value.documentNumberTitle,
documentDate: dayjs(itemInfo.value.documentDate).format("DD.MM.YYYY"),
deliveryDate: dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY"),
deliveryDateEnd: itemInfo.value.deliveryDateEnd ? dayjs(itemInfo.value.deliveryDateEnd).format("DD.MM.YYYY") : null,
deliveryDateType: itemInfo.value.deliveryDateType,
contactPerson: contactPerson.fullName,
contactTel: contactPerson.fixedTel || contactPerson.mobileTel,
contactEMail: contactPerson.email,
project: dataStore.getProjectById(itemInfo.value.project) ? dataStore.getProjectById(itemInfo.value.project).name : null
},
project: projects.value.find(i => i.id === itemInfo.value.project) ? projects.value.find(i => i.id === itemInfo.value.project).name : null,
plant: plants.value.find(i => i.id === itemInfo.value.plant) ? plants.value.find(i => i.id === itemInfo.value.plants).name : null,
},*/
info: [
{
label: itemInfo.value.documentNumberTitle,
content: itemInfo.value.documentNumber || "XXXX",
},{
label: "Kundennummer",
content: customerData.customerNumber,
},{
label: "Belegdatum",
content: dayjs(itemInfo.value.documentDate).format("DD.MM.YYYY"),
},{
label: itemInfo.value.deliveryDateType,
content: ['Lieferzeitraum','Leistungszeitraum'].includes(itemInfo.value.deliveryDateType) ? dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY") : `${dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY")} - ${dayjs(itemInfo.value.deliveryDateEnd).format("DD.MM.YYYY")}`,
},{
label: "Ansprechpartner",
content: contactPerson.fullName,
},
... contactPerson.fixedTel || contactPerson.mobileTel ? [{
label: "Telefon",
content: contactPerson.fixedTel || contactPerson.mobileTel,
}] : [],
... contactPerson.email ? [{
label: "E-Mail",
content: contactPerson.email,
}]: [],
... itemInfo.value.plant ? [{
label: "Objekt",
content: plants.value.find(i => i.id === itemInfo.value.plant).name,
}] : [],
... itemInfo.value.project ? [{
label: "Projekt",
content: projects.value.find(i => i.id === itemInfo.value.project).name
}]: []
],
title: itemInfo.value.title,
description: itemInfo.value.description,
endText: templateEndText(generateContext(itemInfo.value, contactData)),
@@ -847,6 +885,7 @@ const saveDocument = async (state,resetup = false) => {
documentNumber: itemInfo.value.documentNumber,
documentDate: itemInfo.value.documentDate,
deliveryDate: itemInfo.value.deliveryDate,
deliveryDateEnd: itemInfo.value.deliveryDateEnd,
paymentDays: itemInfo.value.paymentDays,
deliveryDateType: itemInfo.value.deliveryDateType,
info: {},
@@ -1242,10 +1281,62 @@ const setRowData = (row) => {
/>
</UFormGroup>
<InputGroup class="w-full">
<UFormGroup
class="w-80 mr-1"
label="Lieferdatumsart:"
v-if="itemInfo.type !== 'serialInvoices'"
>
<USelectMenu
:options="['Lieferdatum','Lieferzeitraum','Leistungsdatum','Leistungszeitraum','Kein Lieferdatum anzeigen']"
v-model="itemInfo.deliveryDateType"
/>
</UFormGroup>
<UFormGroup
:label="`${itemInfo.deliveryDateType}${['Lieferzeitraum', 'Leistungszeitraum'].includes(itemInfo.deliveryDateType) ? ' Start' : ''}:`"
v-if="itemInfo.type !== 'serialInvoices'"
class="mr-1"
>
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.deliveryDate ? dayjs(itemInfo.deliveryDate).format('DD.MM.YYYY') : 'Datum auswählen'"
variant="outline"
class="mx-auto"
/>
<template #panel="{ close }">
<LazyDatePicker v-model="itemInfo.deliveryDate" @close="close" />
</template>
</UPopover>
</UFormGroup>
<UFormGroup
:label="itemInfo.deliveryDateType + ' Ende:'"
v-if="itemInfo.type !== 'serialInvoices' && ['Lieferzeitraum','Leistungszeitraum'].includes(itemInfo.deliveryDateType)"
>
<UPopover
:popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.deliveryDateEnd ? dayjs(itemInfo.deliveryDateEnd).format('DD.MM.YYYY') : 'Datum auswählen'"
variant="outline"
class="mx-auto"
/>
<template #panel="{ close }">
<LazyDatePicker v-model="itemInfo.deliveryDateEnd" @close="close" />
</template>
</UPopover>
</UFormGroup>
</InputGroup>
<InputGroup class="w-full">
<UFormGroup
label="Datum:"
label="Belegdatum:"
class="mr-1"
v-if="itemInfo.type !== 'serialInvoices'"
>
<UPopover :popper="{ placement: 'bottom-start' }">
@@ -1260,44 +1351,12 @@ const setRowData = (row) => {
</template>
</UPopover>
</UFormGroup>
<UFormGroup
class="mt-3 w-80"
label="Lieferdatumsart:"
v-if="itemInfo.type !== 'serialInvoices'"
>
<USelectMenu
:options="['Lieferdatum'/*,'Lieferzeitraum'*/,'Leistungsdatum'/*,'Leistungszeitraum'*/,'Kein Lieferdatum anzeigen']"
v-model="itemInfo.deliveryDateType"
class="mb-2"
/>
</UFormGroup>
<UFormGroup
:label="itemInfo.deliveryDateType"
v-if="itemInfo.type !== 'serialInvoices'"
>
<UPopover :popper="{ placement: 'bottom-start' }">
<UButton
icon="i-heroicons-calendar-days-20-solid"
:label="itemInfo.deliveryDate ? dayjs(itemInfo.deliveryDate).format('DD.MM.YYYY') : 'Datum auswählen'"
variant="outline"
/>
<template #panel="{ close }">
<LazyDatePicker v-model="itemInfo.deliveryDate" @close="close" />
</template>
</UPopover>
</UFormGroup>
<UFormGroup
class="w-full"
label="Zahlungsziel in Tagen:"
>
<template #label>
<span class="truncate">
Zahlungsziel in Tagen:
</span>
</template>
<UInput
type="number"
v-model="itemInfo.paymentDays"
@@ -1329,12 +1388,51 @@ const setRowData = (row) => {
v-model="itemInfo.contactEMail"
/>
</UFormGroup>
<UFormGroup
label="Objekt:"
>
<InputGroup>
<USelectMenu
:options="plants.filter(i => i.customer === itemInfo.customer)"
v-model="itemInfo.plant"
value-attribute="id"
option-attribute="name"
searchable
searchable-placeholder="Suche..."
:search-attributes="['name']"
class="w-full"
:disabled="!itemInfo.customer"
@change="checkForOpenAdvanceInvoices"
>
<template #label>
{{plants.find(i => i.id === itemInfo.plant) ? plants.find(i => i.id === itemInfo.plant).name : "Kein Objekt ausgewählt"}}
</template>
<template #option="{option: plant}">
{{plant.name}}
</template>
</USelectMenu>
<UButton
variant="outline"
color="rose"
v-if="itemInfo.plant"
icon="i-heroicons-x-mark"
@click="itemInfo.plant = null"
/>
<UButton
variant="outline"
v-if="itemInfo.plant"
icon="i-heroicons-arrow-right-end-on-rectangle"
@click="router.push(`/standardEntity/plants/show/${itemInfo.plant}`)"
>Objekt</UButton>
</InputGroup>
</UFormGroup>
<UFormGroup
label="Projekt:"
>
<InputGroup>
<USelectMenu
:options="projects.filter(i => i.customer === itemInfo.customer)"
:options="projects.filter(i => i.customer === itemInfo.customer && (itemInfo.plant ? itemInfo.plant === i.plant : true))"
v-model="itemInfo.project"
value-attribute="id"
option-attribute="name"