Fixed Ansprechpartner Loading

This commit is contained in:
2025-10-09 17:02:19 +02:00
parent 7bf29ffe32
commit 0a9731be37

View File

@@ -38,7 +38,7 @@ const itemInfo = ref({
paymentDays: auth.activeTenantData.standardPaymentDays, paymentDays: auth.activeTenantData.standardPaymentDays,
payment_type: "transfer", payment_type: "transfer",
customSurchargePercentage: 0, customSurchargePercentage: 0,
createdBy: auth.user.id, created_by: auth.user.id,
title: null, title: null,
description: null, description: null,
startText: null, startText: null,
@@ -110,6 +110,7 @@ const setupPage = async () => {
if (route.params.id) { if (route.params.id) {
console.log(route.params) console.log(route.params)
itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id)
await setContactPersonData()
checkCompatibilityWithInputPrice() checkCompatibilityWithInputPrice()
} }
@@ -131,9 +132,6 @@ const setupPage = async () => {
setDocumentTypeConfig(false) setDocumentTypeConfig(false)
} }
setContactPersonData()
if (route.query.linkedDocuments) { if (route.query.linkedDocuments) {
console.log(route.query.loadMode) console.log(route.query.loadMode)
@@ -487,12 +485,12 @@ const setCustomerData = async (customerId, loadOnlyAdress = false) => {
const setContactPersonData = async () => { const setContactPersonData = async () => {
//console.log(itemInfo.value.contactPerson) //TODO: BACKEND CHANGE Set Profile //console.log(itemInfo.value.contactPerson) //TODO: BACKEND CHANGE Set Profile
let profile = (await useNuxtApp().$api(`/api/user/${itemInfo.value.created_by}`, { let profile = (await useNuxtApp().$api(`/api/user/${itemInfo.value.created_by}`, {
method: "GET" method: "GET"
})).profile })).profile
itemInfo.value.contactPersonName = auth.profile.full_name itemInfo.value.contactPersonName = profile.full_name
itemInfo.value.contactTel = profile.mobileTel || profile.fixedTel || "" itemInfo.value.contactTel = profile.mobile_tel || profile.fixed_tel || ""
itemInfo.value.contactEMail = profile.email itemInfo.value.contactEMail = profile.email
} }
@@ -633,7 +631,7 @@ const findDocumentErrors = computed(() => {
if (itemInfo.value.customer === null) errors.push({message: "Es ist kein Kunde ausgewählt", type: "breaking"}) 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.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.letterhead === null) errors.push({message: "Es ist kein Briefpapier ausgewählt", type: "breaking"})
if (itemInfo.value.created_by === null || !itemInfo.value.created_by) errors.push({message: "Es ist kein Ansprechpartner ausgewählt", type: "breaking"}) if (itemInfo.value.created_by === null || !itemInfo.value.created_by) errors.push({message: "Es ist kein Ansprechpartner im Unternehmen ausgewählt", type: "breaking"})
if (itemInfo.value.address.street === null) errors.push({ if (itemInfo.value.address.street === null) errors.push({
message: "Es ist keine Straße im Adressat angegeben", message: "Es ist keine Straße im Adressat angegeben",
type: "breaking" type: "breaking"
@@ -2008,7 +2006,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</UFormGroup> </UFormGroup>
</InputGroup> </InputGroup>
<UFormGroup <UFormGroup
label="Ansprechpartner:" label="Ansprechpartner im Unternehmen:"
> >
<USelectMenu <USelectMenu
:options="tenantUsers" :options="tenantUsers"