diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index 12259c8..65b0ca4 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -38,7 +38,7 @@ const itemInfo = ref({ paymentDays: auth.activeTenantData.standardPaymentDays, payment_type: "transfer", customSurchargePercentage: 0, - createdBy: auth.user.id, + created_by: auth.user.id, title: null, description: null, startText: null, @@ -110,6 +110,7 @@ const setupPage = async () => { if (route.params.id) { console.log(route.params) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id) + await setContactPersonData() checkCompatibilityWithInputPrice() } @@ -131,9 +132,6 @@ const setupPage = async () => { setDocumentTypeConfig(false) } - - setContactPersonData() - if (route.query.linkedDocuments) { console.log(route.query.loadMode) @@ -487,12 +485,12 @@ const setCustomerData = async (customerId, loadOnlyAdress = false) => { const setContactPersonData = async () => { //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" })).profile - itemInfo.value.contactPersonName = auth.profile.full_name - itemInfo.value.contactTel = profile.mobileTel || profile.fixedTel || "" + itemInfo.value.contactPersonName = profile.full_name + itemInfo.value.contactTel = profile.mobile_tel || profile.fixed_tel || "" 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.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.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({ message: "Es ist keine Straße im Adressat angegeben", type: "breaking" @@ -2008,7 +2006,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {