Added Contract to Createddocuments
This commit is contained in:
@@ -74,6 +74,7 @@ const servicecategories = ref([])
|
||||
const selectedServicecategorie = ref(null)
|
||||
const customers = ref([])
|
||||
const contacts = ref([])
|
||||
const contracts = ref([])
|
||||
const texttemplates = ref([])
|
||||
const units = ref([])
|
||||
const tenantUsers = ref([])
|
||||
@@ -89,6 +90,7 @@ const setupData = async () => {
|
||||
productcategories.value = await useEntities("productcategories").select("*")
|
||||
customers.value = await useEntities("customers").select("*", "customerNumber")
|
||||
contacts.value = await useEntities("contacts").select("*")
|
||||
contracts.value = await useEntities("contracts").select("*")
|
||||
texttemplates.value = await useEntities("texttemplates").select("*")
|
||||
units.value = await useEntities("units").selectSpecial("*")
|
||||
tenantUsers.value = (await useNuxtApp().$api(`/api/tenant/users`, {
|
||||
@@ -1158,6 +1160,10 @@ const getDocumentData = async () => {
|
||||
...itemInfo.value.project ? [{
|
||||
label: "Projekt",
|
||||
content: projects.value.find(i => i.id === itemInfo.value.project).name
|
||||
}] : [],
|
||||
...itemInfo.value.contract ? [{
|
||||
label: "Vertrag",
|
||||
content: contracts.value.find(i => i.id === itemInfo.value.contract).contractNumber
|
||||
}] : []
|
||||
],
|
||||
title: itemInfo.value.title,
|
||||
@@ -1259,6 +1265,7 @@ const saveSerialInvoice = async () => {
|
||||
state: 'Erstellt',
|
||||
customer: itemInfo.value.customer,
|
||||
contact: itemInfo.value.contact,
|
||||
contract: itemInfo.value.contract,
|
||||
address: itemInfo.value.address,
|
||||
project: itemInfo.value.project,
|
||||
paymentDays: itemInfo.value.paymentDays,
|
||||
@@ -1342,6 +1349,7 @@ const saveDocument = async (state, resetup = false) => {
|
||||
state: itemInfo.value.state || "Entwurf",
|
||||
customer: itemInfo.value.customer,
|
||||
contact: itemInfo.value.contact,
|
||||
contract: itemInfo.value.contract,
|
||||
address: itemInfo.value.address,
|
||||
project: itemInfo.value.project,
|
||||
plant: itemInfo.value.plant,
|
||||
@@ -2097,6 +2105,45 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Vertrag:"
|
||||
>
|
||||
<InputGroup>
|
||||
<USelectMenu
|
||||
:options="contracts.filter(i => i.customer === itemInfo.customer && (itemInfo.plant ? itemInfo.plant === i.plant : true))"
|
||||
v-model="itemInfo.contract"
|
||||
value-attribute="id"
|
||||
option-attribute="name"
|
||||
searchable
|
||||
searchable-placeholder="Suche..."
|
||||
:search-attributes="['contractNumber','name']"
|
||||
class="w-full"
|
||||
:disabled="!itemInfo.customer"
|
||||
>
|
||||
<template #label>
|
||||
{{ itemInfo.contract ? contracts.find(i => i.id === itemInfo.contract).name : "Kein Vertrag ausgewählt" }}
|
||||
</template>
|
||||
<template #option="{option: contract}">
|
||||
{{ customers.find(i => i.id === contract.customer) ? customers.find(i => i.id === contract.customer).name : "" }}
|
||||
- {{ contract.contractNumber }} - {{ contract.name }}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
variant="outline"
|
||||
color="rose"
|
||||
v-if="itemInfo.project"
|
||||
icon="i-heroicons-x-mark"
|
||||
@click="itemInfo.project = null"
|
||||
/>
|
||||
<EntityModalButtons
|
||||
type="projects"
|
||||
:id="itemInfo.project"
|
||||
:create-query="{customer: itemInfo.customer, plant: itemInfo.plant}"
|
||||
@return-data="(data) => itemInfo.project = data.id"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
|
||||
</div>
|
||||
</InputGroup>
|
||||
|
||||
Reference in New Issue
Block a user