Changes in Document Creation
This commit is contained in:
@@ -70,16 +70,7 @@ const setupPage = () => {
|
|||||||
if(route.query) {
|
if(route.query) {
|
||||||
if(route.query.type) itemInfo.value.type = route.query.type
|
if(route.query.type) itemInfo.value.type = route.query.type
|
||||||
|
|
||||||
if(itemInfo.value.type === "invoices") {
|
setDocumentTypeConfig()
|
||||||
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"}`
|
|
||||||
}
|
|
||||||
|
|
||||||
itemInfo.value.startText = dataStore.getTextTemplatesByDocumentType(itemInfo.value.type).find(i => i.default && i.pos === "startText").text
|
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
|
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 = () => {
|
const setCustomerData = () => {
|
||||||
let customer = dataStore.getCustomerById(itemInfo.value.customer)
|
let customer = dataStore.getCustomerById(itemInfo.value.customer)
|
||||||
itemInfo.value.contact = null
|
itemInfo.value.contact = null
|
||||||
@@ -105,9 +116,12 @@ const setCustomerData = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setContactPersonData = () => {
|
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.contactPersonName = profile.fullName
|
||||||
itemInfo.value.contactTel = profile.mobileTel || profile.fixedTel || ""
|
itemInfo.value.contactTel = profile.mobileTel || profile.fixedTel || ""
|
||||||
@@ -453,6 +467,7 @@ setupPage()
|
|||||||
v-model="itemInfo.type"
|
v-model="itemInfo.type"
|
||||||
value-attribute="type"
|
value-attribute="type"
|
||||||
option-attribute="label"
|
option-attribute="label"
|
||||||
|
@change="setDocumentTypeConfig"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
{{dataStore.documentTypesForCreation[itemInfo.type].labelSingle}}
|
{{dataStore.documentTypesForCreation[itemInfo.type].labelSingle}}
|
||||||
@@ -477,8 +492,9 @@ setupPage()
|
|||||||
<UButton
|
<UButton
|
||||||
:color="itemInfo.customer ? 'primary' : 'rose'"
|
:color="itemInfo.customer ? 'primary' : 'rose'"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
class="flex-1 justify-between">
|
class="w-full">
|
||||||
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
<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']" />
|
<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>
|
</UButton>
|
||||||
@@ -497,6 +513,7 @@ setupPage()
|
|||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Ansprechpartner:"
|
label="Ansprechpartner:"
|
||||||
|
v-if="itemInfo.customer ? dataStore.getCustomerById(itemInfo.customer).isCompany : false "
|
||||||
>
|
>
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
@@ -510,12 +527,13 @@ setupPage()
|
|||||||
class="flex-auto"
|
class="flex-auto"
|
||||||
>
|
>
|
||||||
<UButton
|
<UButton
|
||||||
color="none"
|
:color="itemInfo.contact ? 'primary' : 'none'"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
class="flex-1 justify-between"
|
class="w-full"
|
||||||
:disabled="!itemInfo.customer"
|
: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']" />
|
<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>
|
</UButton>
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
deliveryNotes: {
|
deliveryNotes: {
|
||||||
label: "Lieferscheine",
|
label: "Lieferscheine",
|
||||||
labelSingle: "Lieferschein"
|
labelSingle: "Lieferschein"
|
||||||
|
},
|
||||||
|
confirmationOrders: {
|
||||||
|
label: "Auftragsbestätigungen",
|
||||||
|
labelSingle: "Auftragsbestätigung"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user