Changes in Document Creation

This commit is contained in:
2024-03-17 12:14:11 +01:00
parent aef8cce755
commit 73d3c6311a
2 changed files with 39 additions and 17 deletions

View File

@@ -70,16 +70,7 @@ const setupPage = () => {
if(route.query) {
if(route.query.type) itemInfo.value.type = route.query.type
if(itemInfo.value.type === "invoices") {
itemInfo.value.documentNumberTitle = "Rechnungsnummer"
itemInfo.value.title = `Rechnung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if(itemInfo.value.type === "quotes") {
itemInfo.value.documentNumberTitle = "Angebotsnummer"
itemInfo.value.title = `Angebot-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if(itemInfo.value.type === "deliveryNotes") {
itemInfo.value.documentNumberTitle = "Lieferscheinnummer"
itemInfo.value.title = `Lieferschein-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
}
setDocumentTypeConfig()
itemInfo.value.startText = dataStore.getTextTemplatesByDocumentType(itemInfo.value.type).find(i => i.default && i.pos === "startText").text
itemInfo.value.endText = dataStore.getTextTemplatesByDocumentType(itemInfo.value.type).find(i => i.default && i.pos === "endText").text
@@ -93,6 +84,26 @@ const setupPage = () => {
}
}
const setDocumentTypeConfig = () => {
if(itemInfo.value.type === "invoices") {
itemInfo.value.documentNumberTitle = "Rechnungsnummer"
itemInfo.value.title = `Rechnung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if(itemInfo.value.type === "quotes") {
itemInfo.value.documentNumberTitle = "Angebotsnummer"
itemInfo.value.title = `Angebot-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if(itemInfo.value.type === "deliveryNotes") {
itemInfo.value.documentNumberTitle = "Lieferscheinnummer"
itemInfo.value.title = `Lieferschein-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
} else if(itemInfo.value.type === "confirmationOrder") {
itemInfo.value.documentNumberTitle = "Auftragsbestätigungsnr."
itemInfo.value.title = `Auftragsbestätigung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
}
itemInfo.value.startText = dataStore.texttemplates.find(i => i.documentType === itemInfo.value.type && i.default && i.pos === "startText").text
itemInfo.value.endText = dataStore.texttemplates.find(i => i.documentType === itemInfo.value.type && i.default && i.pos === "endText").text
}
const setCustomerData = () => {
let customer = dataStore.getCustomerById(itemInfo.value.customer)
itemInfo.value.contact = null
@@ -105,9 +116,12 @@ const setCustomerData = () => {
}
const setContactPersonData = () => {
if(!itemInfo.value.contactPerson) itemInfo.value.contactPerson = user.value.id
let profile = dataStore.activeProfile
console.log(profile)
if(!itemInfo.value.contactPerson) itemInfo.value.contactPerson = profile.id
let profile = dataStore.getProfileById(itemInfo.value.contactPerson)
itemInfo.value.contactPersonName = profile.fullName
itemInfo.value.contactTel = profile.mobileTel || profile.fixedTel || ""
@@ -453,6 +467,7 @@ setupPage()
v-model="itemInfo.type"
value-attribute="type"
option-attribute="label"
@change="setDocumentTypeConfig"
>
<template #label>
{{dataStore.documentTypesForCreation[itemInfo.type].labelSingle}}
@@ -477,8 +492,9 @@ setupPage()
<UButton
:color="itemInfo.customer ? 'primary' : 'rose'"
variant="outline"
class="flex-1 justify-between">
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
class="w-full">
<span class="truncate">{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}</span>
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
</UButton>
@@ -497,6 +513,7 @@ setupPage()
</UFormGroup>
<UFormGroup
label="Ansprechpartner:"
v-if="itemInfo.customer ? dataStore.getCustomerById(itemInfo.customer).isCompany : false "
>
<InputGroup>
<USelectMenu
@@ -510,12 +527,13 @@ setupPage()
class="flex-auto"
>
<UButton
color="none"
:color="itemInfo.contact ? 'primary' : 'none'"
variant="outline"
class="flex-1 justify-between"
class="w-full"
:disabled="!itemInfo.customer"
>
{{dataStore.getContactById(itemInfo.contact) ? dataStore.getContactById(itemInfo.contact).fullName : "Kein Kontakt ausgewählt"}}
<span class="truncate">{{dataStore.getContactById(itemInfo.contact) ? dataStore.getContactById(itemInfo.contact).fullName : "Kein Kontakt ausgewählt"}}</span>
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
</UButton>