Fixed Invoicing Problem and some other Changes
This commit is contained in:
@@ -12,6 +12,7 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const {type} = props
|
||||
|
||||
defineShortcuts({
|
||||
@@ -40,9 +41,12 @@ const supabase = useSupabaseClient()
|
||||
const dataType = dataStore.dataTypes[type]
|
||||
const openTab = ref(0)
|
||||
|
||||
const item = ref(JSON.parse(props.item))
|
||||
console.log(item.value)
|
||||
|
||||
const oldItem = ref(null)
|
||||
const generateOldItemData = () => {
|
||||
oldItem.value = JSON.parse(JSON.stringify(props.item))
|
||||
oldItem.value = JSON.parse(props.item)
|
||||
}
|
||||
generateOldItemData()
|
||||
|
||||
@@ -50,14 +54,14 @@ generateOldItemData()
|
||||
const setupCreate = () => {
|
||||
dataType.templateColumns.forEach(datapoint => {
|
||||
if(datapoint.key.includes(".")){
|
||||
props.item[datapoint.key.split(".")[0]] = {}
|
||||
!item.value[datapoint.key.split(".")[0]] ? item.value[datapoint.key.split(".")[0]] = {} : null
|
||||
}
|
||||
|
||||
if(datapoint.inputType === "editor") {
|
||||
if(datapoint.key.includes(".")){
|
||||
props.item[datapoint.key.split(".")[0]][datapoint.key.split(".")[1]] = {}
|
||||
item[datapoint.key.split(".")[0]][datapoint.key.split(".")[1]] = {}
|
||||
} else {
|
||||
props.item[datapoint.key] = {}
|
||||
item[datapoint.key] = {}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +76,9 @@ const setupQuery = () => {
|
||||
|
||||
Object.keys(route.query).forEach(key => {
|
||||
if(["customer","contract","plant","contact"].includes(key)){
|
||||
props.item[key] = Number(route.query[key])
|
||||
item[key] = Number(route.query[key])
|
||||
} else {
|
||||
props.item[key] = route.query[key]
|
||||
item[key] = route.query[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -99,7 +103,7 @@ const loadOptions = async () => {
|
||||
loadedOptions.value[option.option] = (await useSupabaseSelect(option.option))
|
||||
|
||||
if(dataType.templateColumns.find(x => x.key === option.key).selectDataTypeFilter){
|
||||
loadedOptions.value[option.option] = loadedOptions.value[option.option].filter(i => dataType.templateColumns.find(x => x.key === option.key).selectDataTypeFilter(i, props.item))
|
||||
loadedOptions.value[option.option] = loadedOptions.value[option.option].filter(i => dataType.templateColumns.find(x => x.key === option.key).selectDataTypeFilter(i, item))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,13 +113,13 @@ loadOptions()
|
||||
|
||||
const contentChanged = (content, datapoint) => {
|
||||
if(datapoint.key.includes(".")){
|
||||
props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].html = content.html
|
||||
props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].text = content.text
|
||||
props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].json = content.json
|
||||
item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].html = content.html
|
||||
item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].text = content.text
|
||||
item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].json = content.json
|
||||
} else {
|
||||
props.item[datapoint.key].html = content.html
|
||||
props.item[datapoint.key].text = content.text
|
||||
props.item[datapoint.key].json = content.json
|
||||
item[datapoint.key].html = content.html
|
||||
item[datapoint.key].text = content.text
|
||||
item[datapoint.key].json = content.json
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,25 +140,25 @@ const contentChanged = (content, datapoint) => {
|
||||
</template>
|
||||
<template #center>
|
||||
<h1
|
||||
v-if="props.item"
|
||||
v-if="item"
|
||||
:class="['text-xl','font-medium']"
|
||||
>{{props.item.id ? `${dataType.labelSingle} bearbeiten` : `${dataType.labelSingle} erstellen` }}</h1>
|
||||
>{{item.id ? `${dataType.labelSingle} bearbeiten` : `${dataType.labelSingle} erstellen` }}</h1>
|
||||
</template>
|
||||
<template #right>
|
||||
<UButton
|
||||
v-if="props.item.id"
|
||||
@click="dataStore.updateItem(type,props.item, oldItem)"
|
||||
v-if="item.id"
|
||||
@click="dataStore.updateItem(type,item, oldItem)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
<UButton
|
||||
v-else
|
||||
@click="dataStore.createNewItem(type,props.item)"
|
||||
@click="dataStore.createNewItem(type,item)"
|
||||
>
|
||||
Erstellen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="router.push(props.item.id ? `/standardEntity/${type}/show/${props.item.id}` : `/standardEntity/${type}`)"
|
||||
@click="router.push(item.id ? `/standardEntity/${type}/show/${item.id}` : `/standardEntity/${type}`)"
|
||||
color="red"
|
||||
class="ml-2"
|
||||
>
|
||||
@@ -185,29 +189,33 @@ const contentChanged = (content, datapoint) => {
|
||||
<component
|
||||
v-if="datapoint.helpComponent"
|
||||
:is="datapoint.helpComponent"
|
||||
:item="props.item"
|
||||
:item="item"
|
||||
/>
|
||||
</template>
|
||||
<div v-if="datapoint.key.includes('.')">
|
||||
<UInput
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-if="['text','number'].includes(datapoint.inputType)"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:type="datapoint.inputType"
|
||||
:placeholder="datapoint.inputIsNumberRange ? 'Leer lassen für automatisch generierte Nummer' : ''"
|
||||
/>
|
||||
>
|
||||
<template #trailing v-if="datapoint.inputTrailing">
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">{{datapoint.inputTrailing}}</span>
|
||||
</template>
|
||||
</UInput>
|
||||
<UToggle
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'bool'"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
<USelectMenu
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'select'"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:option-attribute="datapoint.selectOptionAttribute"
|
||||
:value-attribute="datapoint.selectValueAttribute || 'id'"
|
||||
:options="datapoint.selectManualOptions || loadedOptions[datapoint.selectDataType]"
|
||||
@@ -220,26 +228,26 @@ const contentChanged = (content, datapoint) => {
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UTextarea
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'textarea'"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
rows="4"
|
||||
/>
|
||||
<UPopover :popper="{ placement: 'bottom-start' }" v-else-if="datapoint.inputType === 'date'">
|
||||
<UButton
|
||||
icon="i-heroicons-calendar-days-20-solid"
|
||||
:label="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]] ? dayjs(props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
:label="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]] ? dayjs(item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
variant="outline"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
|
||||
/>
|
||||
|
||||
<template #panel="{ close }">
|
||||
<LazyDatePicker
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
</template>
|
||||
</UPopover>
|
||||
@@ -247,29 +255,33 @@ const contentChanged = (content, datapoint) => {
|
||||
<Tiptap
|
||||
v-else-if="datapoint.inputType === 'editor'"
|
||||
@updateContent="(i) => contentChanged(i,datapoint)"
|
||||
:preloadedContent="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].html"
|
||||
:preloadedContent="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].html"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<UInput
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-if="['text','number'].includes(datapoint.inputType)"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:type="datapoint.inputType"
|
||||
:placeholder="datapoint.inputIsNumberRange ? 'Leer lassen für automatisch generierte Nummer' : ''"
|
||||
/>
|
||||
>
|
||||
<template #trailing v-if="datapoint.inputTrailing">
|
||||
{{datapoint.inputTrailing}}
|
||||
</template>
|
||||
</UInput>
|
||||
<UToggle
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'bool'"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
<USelectMenu
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'select'"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:option-attribute="datapoint.selectOptionAttribute"
|
||||
:value-attribute="datapoint.selectValueAttribute || 'id'"
|
||||
:options="datapoint.selectManualOptions || loadedOptions[datapoint.selectDataType]"
|
||||
@@ -283,32 +295,32 @@ const contentChanged = (content, datapoint) => {
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UTextarea
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'textarea'"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
rows="4"
|
||||
/>
|
||||
<UPopover :popper="{ placement: 'bottom-start' }" v-else-if="datapoint.inputType === 'date'">
|
||||
<UButton
|
||||
icon="i-heroicons-calendar-days-20-solid"
|
||||
:label="props.item[datapoint.key] ? dayjs(props.item[datapoint.key]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
:label="item[datapoint.key] ? dayjs(item[datapoint.key]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
variant="outline"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
|
||||
<template #panel="{ close }">
|
||||
<LazyDatePicker
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
v-model="props.item[datapoint.key]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-model="item[datapoint.key]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
</template>
|
||||
</UPopover>
|
||||
<Tiptap
|
||||
v-else-if="datapoint.inputType === 'editor'"
|
||||
@updateContent="(i) => contentChanged(i,datapoint)"
|
||||
:preloadedContent="props.item[datapoint.key].html"
|
||||
:preloadedContent="item[datapoint.key].html"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
@@ -325,12 +337,12 @@ const contentChanged = (content, datapoint) => {
|
||||
>
|
||||
<UInput
|
||||
v-if="field.type === 'text'"
|
||||
v-model="props.item.ownFields[field.key]"
|
||||
v-model="item.ownFields[field.key]"
|
||||
/>
|
||||
<USelectMenu
|
||||
v-else-if="field.type === 'select'"
|
||||
:options="field.options"
|
||||
v-model="props.item.ownFields[field.key]"
|
||||
v-model="item.ownFields[field.key]"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</div>
|
||||
@@ -346,29 +358,33 @@ const contentChanged = (content, datapoint) => {
|
||||
<component
|
||||
v-if="datapoint.helpComponent"
|
||||
:is="datapoint.helpComponent"
|
||||
:item="props.item"
|
||||
:item="item"
|
||||
/>
|
||||
</template>
|
||||
<div v-if="datapoint.key.includes('.')">
|
||||
<UInput
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-if="['text','number'].includes(datapoint.inputType)"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:type="datapoint.inputType"
|
||||
:placeholder="datapoint.inputIsNumberRange ? 'Leer lassen für automatisch generierte Nummer' : ''"
|
||||
/>
|
||||
>
|
||||
<template #trailing v-if="datapoint.inputTrailing">
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">{{datapoint.inputTrailing}}</span>
|
||||
</template>
|
||||
</UInput>
|
||||
<UToggle
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'bool'"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
<USelectMenu
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'select'"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:option-attribute="datapoint.selectOptionAttribute"
|
||||
:value-attribute="datapoint.selectValueAttribute || 'id'"
|
||||
:options="datapoint.selectManualOptions || loadedOptions[datapoint.selectDataType]"
|
||||
@@ -381,26 +397,26 @@ const contentChanged = (content, datapoint) => {
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UTextarea
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'textarea'"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
rows="4"
|
||||
/>
|
||||
<UPopover :popper="{ placement: 'bottom-start' }" v-else-if="datapoint.inputType === 'date'">
|
||||
<UButton
|
||||
icon="i-heroicons-calendar-days-20-solid"
|
||||
:label="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]] ? dayjs(props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
:label="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]] ? dayjs(item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
variant="outline"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
|
||||
/>
|
||||
|
||||
<template #panel="{ close }">
|
||||
<LazyDatePicker
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-model="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
</template>
|
||||
</UPopover>
|
||||
@@ -408,29 +424,33 @@ const contentChanged = (content, datapoint) => {
|
||||
<Tiptap
|
||||
v-else-if="datapoint.inputType === 'editor'"
|
||||
@updateContent="(i) => contentChanged(i,datapoint)"
|
||||
:preloadedContent="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].html"
|
||||
:preloadedContent="item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].html"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<UInput
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-if="['text','number'].includes(datapoint.inputType)"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:type="datapoint.inputType"
|
||||
:placeholder="datapoint.inputIsNumberRange ? 'Leer lassen für automatisch generierte Nummer' : ''"
|
||||
/>
|
||||
>
|
||||
<template #trailing v-if="datapoint.inputTrailing">
|
||||
{{datapoint.inputTrailing}}
|
||||
</template>
|
||||
</UInput>
|
||||
<UToggle
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'bool'"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
<USelectMenu
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'select'"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
:option-attribute="datapoint.selectOptionAttribute"
|
||||
:value-attribute="datapoint.selectValueAttribute || 'id'"
|
||||
:options="datapoint.selectManualOptions || loadedOptions[datapoint.selectDataType]"
|
||||
@@ -444,32 +464,32 @@ const contentChanged = (content, datapoint) => {
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UTextarea
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-else-if="datapoint.inputType === 'textarea'"
|
||||
v-model="props.item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
v-model="item[datapoint.key]"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
rows="4"
|
||||
/>
|
||||
<UPopover :popper="{ placement: 'bottom-start' }" v-else-if="datapoint.inputType === 'date'">
|
||||
<UButton
|
||||
icon="i-heroicons-calendar-days-20-solid"
|
||||
:label="props.item[datapoint.key] ? dayjs(props.item[datapoint.key]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
:label="item[datapoint.key] ? dayjs(item[datapoint.key]).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||
variant="outline"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
|
||||
<template #panel="{ close }">
|
||||
<LazyDatePicker
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(props.item,loadedOptions) : null"
|
||||
v-model="props.item[datapoint.key]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(props.item) : false"
|
||||
@change="datapoint.inputChangeFunction ? datapoint.inputChangeFunction(item,loadedOptions) : null"
|
||||
v-model="item[datapoint.key]" @close="close"
|
||||
:disabled="datapoint.disabledFunction ? datapoint.disabledFunction(item) : false"
|
||||
/>
|
||||
</template>
|
||||
</UPopover>
|
||||
<Tiptap
|
||||
v-else-if="datapoint.inputType === 'editor'"
|
||||
@updateContent="(i) => contentChanged(i,datapoint)"
|
||||
:preloadedContent="props.item[datapoint.key].html"
|
||||
:preloadedContent="item[datapoint.key].html"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
@@ -486,12 +506,12 @@ const contentChanged = (content, datapoint) => {
|
||||
>
|
||||
<UInput
|
||||
v-if="field.type === 'text'"
|
||||
v-model="props.item.ownFields[field.key]"
|
||||
v-model="item.ownFields[field.key]"
|
||||
/>
|
||||
<USelectMenu
|
||||
v-else-if="field.type === 'select'"
|
||||
:options="field.options"
|
||||
v-model="props.item.ownFields[field.key]"
|
||||
v-model="item.ownFields[field.key]"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</div>
|
||||
|
||||
@@ -151,6 +151,9 @@ const changeActivePhase = async (key) => {
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
<UDashboardPanelContent>
|
||||
|
||||
</UDashboardPanelContent>
|
||||
<UTabs
|
||||
:items="dataType.showTabs"
|
||||
v-if="props.item.id"
|
||||
@@ -158,227 +161,231 @@ const changeActivePhase = async (key) => {
|
||||
v-model="openTab"
|
||||
>
|
||||
<template #item="{item}">
|
||||
<div v-if="item.label === 'Informationen'" class="flex flex-row mt-5">
|
||||
<UCard class="w-1/2 mr-5">
|
||||
<UAlert
|
||||
v-if="item.archived"
|
||||
color="rose"
|
||||
variant="outline"
|
||||
:title="`${dataType.labelSingle} archiviert`"
|
||||
icon="i-heroicons-light-bulb"
|
||||
class="mb-5"
|
||||
/>
|
||||
<div class="text-wrap">
|
||||
<table class="w-full">
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="datapoint in dataType.templateColumns"
|
||||
>
|
||||
<td>{{datapoint.label}}:</td>
|
||||
<td>
|
||||
<component v-if="datapoint.component" :is="datapoint.component" :row="props.item"></component>
|
||||
<div v-else>
|
||||
<span v-if="datapoint.key.includes('.')">{{props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]}}{{datapoint.unit}}</span>
|
||||
<span v-else>{{props.item[datapoint.key]}} {{datapoint.unit}}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</UCard>
|
||||
<UCard class="w-1/2">
|
||||
<HistoryDisplay
|
||||
:type="type.substring(0,type.length-1)"
|
||||
v-if="props.item.id"
|
||||
:element-id="props.item.id"
|
||||
render-headline
|
||||
/>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Dokumente'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<DocumentUpload
|
||||
:type="type.substring(0,type.length-1)"
|
||||
:element-id="item.id"
|
||||
<div class="scroll">
|
||||
<div v-if="item.label === 'Informationen'" class="flex flex-row mt-5">
|
||||
<UCard class="w-1/2 mr-5">
|
||||
<UAlert
|
||||
v-if="item.archived"
|
||||
color="rose"
|
||||
variant="outline"
|
||||
:title="`${dataType.labelSingle} archiviert`"
|
||||
icon="i-heroicons-light-bulb"
|
||||
class="mb-5"
|
||||
/>
|
||||
</Toolbar>
|
||||
<div class="text-wrap">
|
||||
<table class="w-full">
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="datapoint in dataType.templateColumns"
|
||||
>
|
||||
<td>{{datapoint.label}}:</td>
|
||||
<td>
|
||||
<component v-if="datapoint.component" :is="datapoint.component" :row="props.item"></component>
|
||||
<div v-else>
|
||||
<span v-if="datapoint.key.includes('.')">{{props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]}}{{datapoint.unit}}</span>
|
||||
<span v-else>{{props.item[datapoint.key]}} {{datapoint.unit}}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<DocumentList
|
||||
:documents="documents"
|
||||
/>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Projekte'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="router.push(`/standardEntity/projects/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
+ Projekt
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.projects"
|
||||
@select="(row) => router.push(`/standardEntity/projects/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'},{label: 'Phase', key: 'phase'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Projekte' }"
|
||||
</table>
|
||||
</div>
|
||||
|
||||
>
|
||||
<template #phase-data="{row}">
|
||||
{{row.phases ? row.phases.find(i => i.active).label : ""}}
|
||||
</template>
|
||||
</UTable>
|
||||
</UCard>
|
||||
<UCard class="w-1/2">
|
||||
<HistoryDisplay
|
||||
:type="type.substring(0,type.length-1)"
|
||||
v-if="props.item.id"
|
||||
:element-id="props.item.id"
|
||||
render-headline
|
||||
/>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Dokumente'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<DocumentUpload
|
||||
:type="type.substring(0,type.length-1)"
|
||||
:element-id="item.id"
|
||||
/>
|
||||
</Toolbar>
|
||||
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Objekte'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="router.push(`/standardEntity/plants/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
+ Objekt
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="type === 'customers'"
|
||||
@click="router.push(`/standardEntity/plants/create?${type.substring(0,type.length-1)}=${props.item.id}&name=${encodeURIComponent(`${props.item.infoData.street}, ${props.item.infoData.zip} ${props.item.infoData.city}`)}`)"
|
||||
>
|
||||
+ Kundenadresse als Objekt
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.plants"
|
||||
@select="(row) => router.push(`/standardEntity/plants/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Objekte' }"
|
||||
|
||||
>
|
||||
|
||||
</UTable>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Aufgaben'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="router.push(`/standardEntity/tasks/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
+ Aufgabe
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.tasks"
|
||||
@select="(row) => router.push(`/standardEntity/tasks/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Aufgaben' }"
|
||||
/>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Verträge'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="router.push(`/standardEntity/contracts/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
+ Vertrag
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.contracts"
|
||||
@select="(row) => router.push(`/standardEntity/contracts/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'},{label: 'Aktiv', key: 'active'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Verträge' }"
|
||||
|
||||
></UTable>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Überprüfungen'">
|
||||
<UCard class="mt-5">
|
||||
<UTable
|
||||
:rows="props.item.checks"
|
||||
:columns="[{key:'name',label: 'Name'},{key:'rhythm',label: 'Rhythmus'},{key:'description',label: 'Beschreibung'}]"
|
||||
class="w-full"
|
||||
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||
@select="(i) => router.push(`/checks/show/${i.id}`) "
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Überprüfungen anzuzeigen' }"
|
||||
>
|
||||
<template #rhythm-data="{row}">
|
||||
{{row.distance}}
|
||||
<span v-if="row.distanceUnit === 'dayjs'">Tage</span>
|
||||
<span v-if="row.distanceUnit === 'years'">Jahre</span>
|
||||
</template>
|
||||
</UTable>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Phasen'">
|
||||
<UCard class="mt-5">
|
||||
<UAccordion
|
||||
:items="renderedPhases"
|
||||
>
|
||||
<template #default="{item,index,open}">
|
||||
<DocumentList
|
||||
:documents="documents"
|
||||
/>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Projekte'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
variant="ghost"
|
||||
:color="item.active ? 'primary' : 'white'"
|
||||
class="mb-1"
|
||||
:disabled="true"
|
||||
@click="router.push(`/standardEntity/projects/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
<template #leading>
|
||||
<div class="w-6 h-6 flex items-center justify-center -my-1">
|
||||
<UIcon :name="item.icon" class="w-4 h-4 " />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<span class="truncate"> {{item.label}}</span>
|
||||
|
||||
<template #trailing>
|
||||
<UIcon
|
||||
name="i-heroicons-chevron-right-20-solid"
|
||||
class="w-5 h-5 ms-auto transform transition-transform duration-200"
|
||||
:class="[open && 'rotate-90']"
|
||||
/>
|
||||
</template>
|
||||
|
||||
+ Projekt
|
||||
</UButton>
|
||||
</template>
|
||||
<template #item="{item, index}">
|
||||
<UCard class="mx-5">
|
||||
<template #header>
|
||||
<span class="dark:text-white text-black">{{item.label}}</span>
|
||||
</template>
|
||||
<InputGroup>
|
||||
<!-- TODO: Reactive Change Phase -->
|
||||
<UButton
|
||||
v-if="!item.activated_at && index !== 0 "
|
||||
@click="changeActivePhase(item.key)"
|
||||
>
|
||||
Phase aktivieren
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="item.active"
|
||||
v-for="button in item.quickactions"
|
||||
@click="router.push(`${button.link}&customer=${itemInfo.customer.id}&project=${itemInfo.id}`)"
|
||||
>
|
||||
{{button.label}}
|
||||
</UButton>
|
||||
</InputGroup>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.projects"
|
||||
@select="(row) => router.push(`/standardEntity/projects/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'},{label: 'Phase', key: 'phase'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Projekte' }"
|
||||
|
||||
<div>
|
||||
<p v-if="item.activated_at" class="dark:text-white text-black">Aktiviert am: {{dayjs(item.activated_at).format("DD.MM.YY HH:mm")}} Uhr</p>
|
||||
<p v-if="item.activated_by" class="dark:text-white text-black">Aktiviert durch: {{profileStore.getProfileById(item.activated_by).fullName}}</p>
|
||||
<p v-if="item.description" class="dark:text-white text-black">Beschreibung: {{item.description}}</p>
|
||||
</div>
|
||||
</UCard>
|
||||
>
|
||||
<template #phase-data="{row}">
|
||||
{{row.phases ? row.phases.find(i => i.active).label : ""}}
|
||||
</template>
|
||||
</UTable>
|
||||
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Objekte'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="router.push(`/standardEntity/plants/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
+ Objekt
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="type === 'customers'"
|
||||
@click="router.push(`/standardEntity/plants/create?${type.substring(0,type.length-1)}=${props.item.id}&name=${encodeURIComponent(`${props.item.infoData.street}, ${props.item.infoData.zip} ${props.item.infoData.city}`)}`)"
|
||||
>
|
||||
+ Kundenadresse als Objekt
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.plants"
|
||||
@select="(row) => router.push(`/standardEntity/plants/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Objekte' }"
|
||||
|
||||
>
|
||||
|
||||
</UTable>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Aufgaben'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="router.push(`/standardEntity/tasks/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
+ Aufgabe
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.tasks"
|
||||
@select="(row) => router.push(`/standardEntity/tasks/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Aufgaben' }"
|
||||
/>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Verträge'">
|
||||
<UCard class="mt-5">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="router.push(`/standardEntity/contracts/create?${type.substring(0,type.length-1)}=${props.item.id}`)"
|
||||
>
|
||||
+ Vertrag
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
<UTable
|
||||
:rows="props.item.contracts"
|
||||
@select="(row) => router.push(`/standardEntity/contracts/show/${row.id}`)"
|
||||
:columns="[{label: 'Name', key: 'name'},{label: 'Aktiv', key: 'active'}]"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Verträge' }"
|
||||
|
||||
></UTable>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Überprüfungen'">
|
||||
<UCard class="mt-5">
|
||||
<UTable
|
||||
:rows="props.item.checks"
|
||||
:columns="[{key:'name',label: 'Name'},{key:'rhythm',label: 'Rhythmus'},{key:'description',label: 'Beschreibung'}]"
|
||||
class="w-full"
|
||||
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||
@select="(i) => router.push(`/checks/show/${i.id}`) "
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Überprüfungen anzuzeigen' }"
|
||||
>
|
||||
<template #rhythm-data="{row}">
|
||||
{{row.distance}}
|
||||
<span v-if="row.distanceUnit === 'dayjs'">Tage</span>
|
||||
<span v-if="row.distanceUnit === 'years'">Jahre</span>
|
||||
</template>
|
||||
</UTable>
|
||||
</UCard>
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Phasen'">
|
||||
<UCard class="mt-5">
|
||||
<UAccordion
|
||||
:items="renderedPhases"
|
||||
>
|
||||
<template #default="{item,index,open}">
|
||||
<UButton
|
||||
variant="ghost"
|
||||
:color="item.active ? 'primary' : 'white'"
|
||||
class="mb-1"
|
||||
:disabled="true"
|
||||
>
|
||||
<template #leading>
|
||||
<div class="w-6 h-6 flex items-center justify-center -my-1">
|
||||
<UIcon :name="item.icon" class="w-4 h-4 " />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<span class="truncate"> {{item.label}}</span>
|
||||
|
||||
<template #trailing>
|
||||
<UIcon
|
||||
name="i-heroicons-chevron-right-20-solid"
|
||||
class="w-5 h-5 ms-auto transform transition-transform duration-200"
|
||||
:class="[open && 'rotate-90']"
|
||||
/>
|
||||
</template>
|
||||
|
||||
</UButton>
|
||||
</template>
|
||||
<template #item="{item, index}">
|
||||
<UCard class="mx-5">
|
||||
<template #header>
|
||||
<span class="dark:text-white text-black">{{item.label}}</span>
|
||||
</template>
|
||||
<InputGroup>
|
||||
<!-- TODO: Reactive Change Phase -->
|
||||
<UButton
|
||||
v-if="!item.activated_at && index !== 0 "
|
||||
@click="changeActivePhase(item.key)"
|
||||
>
|
||||
Phase aktivieren
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="item.active"
|
||||
v-for="button in item.quickactions"
|
||||
@click="router.push(`${button.link}&customer=${itemInfo.customer.id}&project=${itemInfo.id}`)"
|
||||
>
|
||||
{{button.label}}
|
||||
</UButton>
|
||||
</InputGroup>
|
||||
|
||||
<div>
|
||||
<p v-if="item.activated_at" class="dark:text-white text-black">Aktiviert am: {{dayjs(item.activated_at).format("DD.MM.YY HH:mm")}} Uhr</p>
|
||||
<p v-if="item.activated_by" class="dark:text-white text-black">Aktiviert durch: {{profileStore.getProfileById(item.activated_by).fullName}}</p>
|
||||
<p v-if="item.description" class="dark:text-white text-black">Beschreibung: {{item.description}}</p>
|
||||
</div>
|
||||
</UCard>
|
||||
|
||||
|
||||
</template>
|
||||
</UAccordion>
|
||||
</UCard>
|
||||
</template>
|
||||
</UAccordion>
|
||||
</UCard>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
</UTabs>
|
||||
@@ -392,4 +399,10 @@ td {
|
||||
padding-bottom: 0.15em;
|
||||
padding-top: 0.15em;
|
||||
}
|
||||
|
||||
.scroll {
|
||||
height: 80vh;
|
||||
overflow-y: scroll;
|
||||
padding: 1em;
|
||||
}
|
||||
</style>
|
||||
@@ -63,7 +63,7 @@ const itemInfo = ref({
|
||||
|
||||
|
||||
const letterheads = ref([])
|
||||
const createdDocuments = ref([])
|
||||
const createddocuments = ref([])
|
||||
const projects = ref([])
|
||||
const products = ref([])
|
||||
const productcategories = ref([])
|
||||
@@ -79,14 +79,13 @@ const loaded = ref(false)
|
||||
const setupPage = async () => {
|
||||
|
||||
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
|
||||
createdDocuments.value = (await useSupabaseSelect("createddocuments","*"))
|
||||
createddocuments.value = (await useSupabaseSelect("createddocuments","*"))
|
||||
projects.value = (await useSupabaseSelect("projects","*"))
|
||||
services.value = (await useSupabaseSelect("services","*"))
|
||||
servicecategories.value = (await useSupabaseSelect("servicecategories","*"))
|
||||
products.value = (await useSupabaseSelect("products","*"))
|
||||
productcategories.value = (await useSupabaseSelect("productcategories","*"))
|
||||
customers.value = (await useSupabaseSelect("customers","*","customerNumber"))
|
||||
console.log(customers.value)
|
||||
contacts.value = (await useSupabaseSelect("contacts","*"))
|
||||
texttemplates.value = (await useSupabaseSelect("texttemplates","*"))
|
||||
if(productcategories.value.length > 0) selectedProductcategorie.value = productcategories.value[0].id
|
||||
@@ -175,7 +174,6 @@ const setupPage = async () => {
|
||||
|
||||
if(route.query.project) {
|
||||
itemInfo.value.project = Number(route.query.project)
|
||||
checkForOpenAdvanceInvoices()
|
||||
}
|
||||
if(route.query.contact) itemInfo.value.contact = Number(route.query.contact)
|
||||
if(route.query.customer) {
|
||||
@@ -184,6 +182,8 @@ const setupPage = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
//if(itemInfo.value.project) checkForOpenAdvanceInvoices()
|
||||
|
||||
loaded.value = true
|
||||
|
||||
}
|
||||
@@ -238,6 +238,9 @@ const setCustomerData = () => {
|
||||
itemInfo.value.address.zip = customer.infoData.zip
|
||||
itemInfo.value.address.city = customer.infoData.city
|
||||
itemInfo.value.address.special = customer.infoData.special
|
||||
|
||||
if(customer.customPaymentDays) itemInfo.value.paymentDays = customer.customPaymentDays
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -458,7 +461,7 @@ const documentTotal = computed(() => {
|
||||
let totalGrossAlreadyPaid = 0
|
||||
|
||||
itemInfo.value.usedAdvanceInvoices.forEach(advanceInvoiceId => {
|
||||
let advanceInvoice = openAdvanceInvoices.value.find(i => i.id === advanceInvoiceId)
|
||||
let advanceInvoice = createddocuments.value.find(i => i.id === advanceInvoiceId)
|
||||
|
||||
let priceNet = advanceInvoice.rows.find(i => i.advanceInvoiceData).price
|
||||
|
||||
@@ -474,11 +477,11 @@ const documentTotal = computed(() => {
|
||||
|
||||
|
||||
return {
|
||||
totalNet: renderCurrency(totalNet),
|
||||
total19: renderCurrency(total19),
|
||||
totalGross: renderCurrency(totalGross),
|
||||
totalGrossAlreadyPaid: renderCurrency(totalGrossAlreadyPaid),
|
||||
totalSumToPay: renderCurrency(sumToPay)
|
||||
totalNet: totalNet,
|
||||
total19: total19,
|
||||
totalGross: totalGross,
|
||||
totalGrossAlreadyPaid: totalGrossAlreadyPaid,
|
||||
totalSumToPay: sumToPay
|
||||
|
||||
}
|
||||
|
||||
@@ -532,7 +535,7 @@ const processDieselPosition = () => {
|
||||
|
||||
const getDocumentData = () => {
|
||||
|
||||
let customerData = customers.find(i => i.id === itemInfo.value.customer)
|
||||
let customerData = customers.value.find(i => i.id === itemInfo.value.customer)
|
||||
let contactData = dataStore.getContactById(itemInfo.value.contact)
|
||||
let businessInfo = profileStore.ownTenant.businessInfo
|
||||
|
||||
@@ -549,12 +552,14 @@ const getDocumentData = () => {
|
||||
let unit = dataStore.units.find(i => i.id === row.unit)
|
||||
|
||||
if(!['pagebreak','title'].includes(row.mode)){
|
||||
if(row.agriculture?.description) {
|
||||
if(row.agriculture && row.agriculture.description) {
|
||||
console.log("Row has Agri")
|
||||
row.descriptionText = row.agriculture.description
|
||||
} else if(row.description) {
|
||||
console.log("Row has no Agri")
|
||||
row.descriptionText = row.description
|
||||
} else {
|
||||
delete row.descriptionText
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,6 +596,8 @@ const getDocumentData = () => {
|
||||
}
|
||||
}
|
||||
|
||||
let contactPerson = profileStore.getProfileById(itemInfo.value.contactPerson)
|
||||
|
||||
const returnData = {
|
||||
type: itemInfo.value.type,
|
||||
adressLine: `${businessInfo.name}, ${businessInfo.street}, ${businessInfo.zip} ${businessInfo.city}`,
|
||||
@@ -609,9 +616,9 @@ const getDocumentData = () => {
|
||||
documentDate: dayjs(itemInfo.value.documentDate).format("DD.MM.YYYY"),
|
||||
deliveryDate: dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY"),
|
||||
deliveryDateType: itemInfo.value.deliveryDateType,
|
||||
contactPerson: itemInfo.value.contactPersonName,
|
||||
contactTel: itemInfo.value.contactTel,
|
||||
contactEMail: itemInfo.value.contactEMail,
|
||||
contactPerson: contactPerson.fullName,
|
||||
contactTel: contactPerson.fixedTel || contactPerson.mobileTel,
|
||||
contactEMail: contactPerson.email,
|
||||
project: dataStore.getProjectById(itemInfo.value.project) ? dataStore.getProjectById(itemInfo.value.project).name : null
|
||||
},
|
||||
title: itemInfo.value.title,
|
||||
@@ -619,14 +626,20 @@ const getDocumentData = () => {
|
||||
endText: templateEndText(generateContext(itemInfo.value, contactData)),
|
||||
startText: templateStartText(generateContext(itemInfo.value, contactData)),
|
||||
rows: rows,
|
||||
total: documentTotal.value,
|
||||
total: {
|
||||
totalNet: renderCurrency(documentTotal.value.totalNet),
|
||||
total19: renderCurrency(documentTotal.value.total19),
|
||||
totalGross: renderCurrency(documentTotal.value.totalGross),
|
||||
totalGrossAlreadyPaid: renderCurrency(documentTotal.value.totalGrossAlreadyPaid),
|
||||
totalSumToPay: renderCurrency(documentTotal.value.totalSumToPay)
|
||||
},
|
||||
agriculture: itemInfo.value.agriculture,
|
||||
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices.map(i => {
|
||||
return openAdvanceInvoices.value.find(x => x.id === i)
|
||||
return createddocuments.value.find(x => x.id === i)
|
||||
})
|
||||
}
|
||||
|
||||
//console.log(returnData)
|
||||
console.log(returnData)
|
||||
|
||||
return returnData
|
||||
}
|
||||
@@ -715,7 +728,7 @@ const saveSerialInvoice = async () => {
|
||||
await router.push(`/createDocument/edit/${data[0].id}`)
|
||||
}
|
||||
|
||||
const saveDocument = async (state) => {
|
||||
const saveDocument = async (state,resetup = false) => {
|
||||
|
||||
itemInfo.value.state = state
|
||||
|
||||
@@ -788,21 +801,22 @@ const saveDocument = async (state) => {
|
||||
if(route.params.id) {
|
||||
await dataStore.updateItem("createddocuments", {...createData, id: itemInfo.value.id})
|
||||
} else {
|
||||
const {data} = await dataStore.createNewItem("createddocuments", createData)
|
||||
const data = await dataStore.createNewItem("createddocuments", createData)
|
||||
console.log(data)
|
||||
await router.push(`/createDocument/edit/${data[0].id}`)
|
||||
}
|
||||
|
||||
await setupPage()
|
||||
|
||||
if(resetup) await setupPage()
|
||||
}
|
||||
|
||||
const closeDocument = async () => {
|
||||
|
||||
loaded.value = false
|
||||
|
||||
await saveDocument("Gebucht")
|
||||
|
||||
await generateDocument()
|
||||
|
||||
|
||||
let fileData = {
|
||||
tags: [],
|
||||
project: null
|
||||
@@ -828,14 +842,12 @@ const closeDocument = async () => {
|
||||
|
||||
await dataStore.uploadFiles(fileData, [file], true)
|
||||
|
||||
|
||||
|
||||
await router.push(`/createDocument/show/${itemInfo.value.id}`)
|
||||
|
||||
//console.log(uri)
|
||||
}
|
||||
|
||||
const setRowData = (row) => {
|
||||
console.log(row)
|
||||
if(row.service) {
|
||||
row.unit = services.value.find(i => i.id === row.service).unit
|
||||
row.price = services.value.find(i => i.id === row.service).sellingPriceComposed.total || services.value.find(i => i.id === row.service).sellingPrice
|
||||
@@ -859,7 +871,7 @@ const setRowData = (row) => {
|
||||
<template #right>
|
||||
<UButton
|
||||
icon="i-mdi-content-save"
|
||||
@click="saveDocument('Entwurf')"
|
||||
@click="saveDocument('Entwurf',true)"
|
||||
v-if="itemInfo.type !== 'serialInvoices' "
|
||||
:disabled="!itemInfo.customer"
|
||||
>
|
||||
@@ -882,6 +894,7 @@ const setRowData = (row) => {
|
||||
</UDashboardNavbar>
|
||||
|
||||
<UDashboardPanelContent>
|
||||
{{itemInfo}}
|
||||
<UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded">
|
||||
<template #item="{item}">
|
||||
<div v-if="item.label === 'Editor'">
|
||||
@@ -1028,7 +1041,7 @@ const setRowData = (row) => {
|
||||
class="w-25"
|
||||
v-if="itemInfo.customer"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/customers/show/${itemInfo.customer}`)"
|
||||
@click="router.push(`/standardEntity/customers/show/${itemInfo.customer}`)"
|
||||
>Kunde</UButton>
|
||||
</div>
|
||||
|
||||
@@ -1084,7 +1097,7 @@ const setRowData = (row) => {
|
||||
variant="outline"
|
||||
v-if="itemInfo.contact"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/contacts/show/${itemInfo.contact}`)"
|
||||
@click="router.push(`/standardEntity/contacts/show/${itemInfo.contact}`)"
|
||||
>Kontakt</UButton>
|
||||
</InputGroup>
|
||||
|
||||
@@ -1232,7 +1245,7 @@ const setRowData = (row) => {
|
||||
:search-attributes="['name']"
|
||||
class="w-full"
|
||||
:disabled="!itemInfo.customer"
|
||||
@input="checkForOpenAdvanceInvoices"
|
||||
@change="checkForOpenAdvanceInvoices"
|
||||
>
|
||||
<template #label>
|
||||
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
|
||||
@@ -1252,7 +1265,7 @@ const setRowData = (row) => {
|
||||
variant="outline"
|
||||
v-if="itemInfo.project"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/projects/show/${itemInfo.project}`)"
|
||||
@click="router.push(`/standardEntity/projects/show/${itemInfo.project}`)"
|
||||
>Projekt</UButton>
|
||||
</InputGroup>
|
||||
|
||||
@@ -1341,7 +1354,7 @@ const setRowData = (row) => {
|
||||
<UFormGroup
|
||||
label="Titel:"
|
||||
>
|
||||
<UInput v-model="itemInfo.title"/>
|
||||
<UInput v-model="itemInfo.title" disabled/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Beschreibung:"
|
||||
@@ -1532,7 +1545,7 @@ const setRowData = (row) => {
|
||||
searchable-placeholder="Suche ..."
|
||||
:search-attributes="['name']"
|
||||
v-model="row.service"
|
||||
@input="setRowData(row)"
|
||||
@change="setRowData(row)"
|
||||
>
|
||||
<template #label>
|
||||
<span class="truncate">{{services.find(i => i.id === row.service) ? services.find(i => i.id === row.service).name : "Keine Leistung ausgewählt" }}</span>
|
||||
@@ -1612,7 +1625,6 @@ const setRowData = (row) => {
|
||||
v-model="row.price"
|
||||
type="number"
|
||||
step="0.001"
|
||||
:color="getRowMargin(row) > 0 ? 'primary' : 'rose'"
|
||||
>
|
||||
<template #trailing>
|
||||
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||
@@ -1847,29 +1859,24 @@ const setRowData = (row) => {
|
||||
<table class="w-1/3" v-if="itemInfo.rows.length > 0">
|
||||
<tr>
|
||||
<td class="font-bold">Netto:</td>
|
||||
<td class="text-right">{{documentTotal.totalNet}}</td>
|
||||
<td class="text-right">{{renderCurrency(documentTotal.totalNet)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-bold">zzgl. 19 % USt:</td>
|
||||
<td class="text-right">{{documentTotal.total19}}</td>
|
||||
<td class="text-right">{{renderCurrency(documentTotal.total19)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-bold">Brutto:</td>
|
||||
<td class="text-right">{{documentTotal.totalGross}}</td>
|
||||
<td class="text-right">{{renderCurrency(documentTotal.totalGross)}}</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr v-if="documentTotal.totalGrossAlreadyPaid !== '0,00 €'">
|
||||
<td class="font-bold">Bereits bezahlt:</td>
|
||||
<td class="text-right">{{documentTotal.totalGrossAlreadyPaid}}</td>
|
||||
<td class="text-right">{{renderCurrency(documentTotal.totalGrossAlreadyPaid)}}</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr v-if="documentTotal.totalGrossAlreadyPaid !== '0,00 €'">
|
||||
<td class="font-bold">Offene Summe:</td>
|
||||
<td class="text-right">{{documentTotal.totalSumToPay}}</td>
|
||||
<td class="text-right">{{renderCurrency(documentTotal.totalSumToPay)}}</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
const route = useRoute()
|
||||
const dataStore = useDataStore()
|
||||
const supabase = useSupabaseClient()
|
||||
|
||||
const type = route.params.type
|
||||
|
||||
@@ -19,7 +20,17 @@ const setupPage = async () => {
|
||||
item.value = await useSupabaseSelectSingle(type, route.params.id, dataType.supabaseSelectWithInformation || "*")
|
||||
} else if(mode.value === "edit") {
|
||||
//Load Data for Edit
|
||||
item.value = await useSupabaseSelectSingle(type, route.params.id)
|
||||
const data = JSON.stringify((await supabase.from(type).select().eq("id", route.params.id).single()).data)
|
||||
//await useSupabaseSelectSingle(type, route.params.id)
|
||||
console.log(JSON.parse(data))
|
||||
item.value = data
|
||||
|
||||
console.log(item.value)
|
||||
} else if(mode.value === "create") {
|
||||
//Load Data for Create
|
||||
item.value = JSON.stringify({})
|
||||
|
||||
console.log(item.value)
|
||||
} else if(mode.value === "list") {
|
||||
//Load Data for List
|
||||
items.value = await useSupabaseSelect(type, dataType.supabaseSelectWithInformation || "*", dataType.supabaseSortColumn)
|
||||
|
||||
@@ -130,31 +130,26 @@ export const useDataStore = defineStore('data', () => {
|
||||
label: "Kundennummer",
|
||||
inputIsNumberRange: true,
|
||||
inputType: "text"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
key: "name",
|
||||
label: "Name",
|
||||
title: true,
|
||||
inputType: "text"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
key: "isCompany",
|
||||
label: "Firmenkunde",
|
||||
component: isCompany,
|
||||
inputType: "bool"
|
||||
},
|
||||
{
|
||||
key: "notes",
|
||||
label: "Notizen",
|
||||
inputType: "textarea"
|
||||
},
|
||||
{
|
||||
},{
|
||||
key: "active",
|
||||
label: "Aktiv",
|
||||
component: active,
|
||||
inputType: "bool"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
key: "customPaymentDays",
|
||||
label: "Zahlungsziel in Tagen",
|
||||
inputType: "number"
|
||||
}, {
|
||||
key: "infoData.street",
|
||||
label: "Straße + Hausnummer",
|
||||
inputType: "text",
|
||||
@@ -217,6 +212,11 @@ export const useDataStore = defineStore('data', () => {
|
||||
label: "USt-Id",
|
||||
inputType: "text"
|
||||
},
|
||||
{
|
||||
key: "notes",
|
||||
label: "Notizen",
|
||||
inputType: "textarea"
|
||||
},
|
||||
{
|
||||
key: "profiles",
|
||||
label: "Berechtigte Benutzer",
|
||||
@@ -1189,6 +1189,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
key: "sellingPriceComposed.worker",
|
||||
label: "Verkaufspreis Personal pro Einheit",
|
||||
inputType: "number",
|
||||
inputTrailing: "EUR",
|
||||
inputChangeFunction: function (row) {
|
||||
if(row.sellingPriceComposed.worker) {
|
||||
row.sellingPriceComposed.total = row.sellingPriceComposed.worker + (row.sellingPriceComposed.material || 0)
|
||||
@@ -1201,6 +1202,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
key: "sellingPriceComposed.material",
|
||||
label: "Verkaufspreis Material pro Einheit",
|
||||
inputType: "number",
|
||||
inputTrailing: "EUR",
|
||||
inputChangeFunction: function (row) {
|
||||
if(row.sellingPriceComposed.material) {
|
||||
row.sellingPriceComposed.total = (row.sellingPriceComposed.worker || 0) + row.sellingPriceComposed.material
|
||||
@@ -1211,8 +1213,9 @@ export const useDataStore = defineStore('data', () => {
|
||||
},
|
||||
{
|
||||
key: "sellingPriceComposed.total",
|
||||
label: "Verkaufspreis Gesamt",
|
||||
label: "Verkaufspreis Gesamt pro Einheit",
|
||||
inputType: "number",
|
||||
inputTrailing: "EUR",
|
||||
/*disabledFunction: function (item) {
|
||||
return item.sellingPriceComposed.worker || item.sellingPriceComposed.material
|
||||
},*/
|
||||
@@ -1816,6 +1819,8 @@ export const useDataStore = defineStore('data', () => {
|
||||
name = "Anhängelast"
|
||||
}else if(key === "color") {
|
||||
name = "Farbe"
|
||||
}else if(key === "customPaymentDays") {
|
||||
name = "Zahlungsziel in Tagen"
|
||||
}else if(key === "powerInKW") {
|
||||
name = "Leistung"
|
||||
} else if(key === "driver") {
|
||||
@@ -1979,6 +1984,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${returnData.id}`)
|
||||
}
|
||||
}
|
||||
|
||||
return supabaseData
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user