diff --git a/components/EntityEdit.vue b/components/EntityEdit.vue
index 49f4342..e94fd53 100644
--- a/components/EntityEdit.vue
+++ b/components/EntityEdit.vue
@@ -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) => {
{{props.item.id ? `${dataType.labelSingle} bearbeiten` : `${dataType.labelSingle} erstellen` }}
+ >{{item.id ? `${dataType.labelSingle} bearbeiten` : `${dataType.labelSingle} erstellen` }}
Speichern
Erstellen
@@ -185,29 +189,33 @@ const contentChanged = (content, datapoint) => {
+ >
+
+ {{datapoint.inputTrailing}}
+
+
{
@@ -247,29 +255,33 @@ const contentChanged = (content, datapoint) => {
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"
/>
+ >
+
+ {{datapoint.inputTrailing}}
+
+
{
contentChanged(i,datapoint)"
- :preloadedContent="props.item[datapoint.key].html"
+ :preloadedContent="item[datapoint.key].html"
/>
{
>
@@ -346,29 +358,33 @@ const contentChanged = (content, datapoint) => {
+ >
+
+ {{datapoint.inputTrailing}}
+
+
{
@@ -408,29 +424,33 @@ const contentChanged = (content, datapoint) => {
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"
/>
+ >
+
+ {{datapoint.inputTrailing}}
+
+
{
contentChanged(i,datapoint)"
- :preloadedContent="props.item[datapoint.key].html"
+ :preloadedContent="item[datapoint.key].html"
/>
{
>
diff --git a/components/EntityShow.vue b/components/EntityShow.vue
index 5d7d55c..a93ea5c 100644
--- a/components/EntityShow.vue
+++ b/components/EntityShow.vue
@@ -151,6 +151,9 @@ const changeActivePhase = async (key) => {
+
+
+
{
v-model="openTab"
>
-
-
-
-
-
-
-
- | {{datapoint.label}}: |
-
-
-
- {{props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]}}{{datapoint.unit}}
- {{props.item[datapoint.key]}} {{datapoint.unit}}
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+ | {{datapoint.label}}: |
+
+
+
+ {{props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]}}{{datapoint.unit}}
+ {{props.item[datapoint.key]}} {{datapoint.unit}}
+
+ |
+
+
-
-
-
-
-
-
-
- + Projekt
-
-
- 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' }"
+
+
- >
-
- {{row.phases ? row.phases.find(i => i.active).label : ""}}
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- + Objekt
-
-
- + Kundenadresse als Objekt
-
-
- 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' }"
-
- >
-
-
-
-
-
-
-
-
- + Aufgabe
-
-
- 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' }"
- />
-
-
-
-
-
-
- + Vertrag
-
-
- 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' }"
-
- >
-
-
-
-
- router.push(`/checks/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Überprüfungen anzuzeigen' }"
- >
-
- {{row.distance}}
- Tage
- Jahre
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
- {{item.label}}
-
-
-
-
-
+ + Projekt
-
-
-
-
- {{item.label}}
-
-
-
-
- Phase aktivieren
-
-
- {{button.label}}
-
-
+
+ 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' }"
-
-
Aktiviert am: {{dayjs(item.activated_at).format("DD.MM.YY HH:mm")}} Uhr
-
Aktiviert durch: {{profileStore.getProfileById(item.activated_by).fullName}}
-
Beschreibung: {{item.description}}
-
-
+ >
+
+ {{row.phases ? row.phases.find(i => i.active).label : ""}}
+
+
+
+
+
+
+
+
+
+ + Objekt
+
+
+ + Kundenadresse als Objekt
+
+
+ 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' }"
+
+ >
+
+
+
+
+
+
+
+
+ + Aufgabe
+
+
+ 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' }"
+ />
+
+
+
+
+
+
+ + Vertrag
+
+
+ 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' }"
+
+ >
+
+
+
+
+ router.push(`/checks/show/${i.id}`) "
+ :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Überprüfungen anzuzeigen' }"
+ >
+
+ {{row.distance}}
+ Tage
+ Jahre
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.label}}
+
+
+
+
+
+
+
+
+
+
+ {{item.label}}
+
+
+
+
+ Phase aktivieren
+
+
+ {{button.label}}
+
+
+
+
+
Aktiviert am: {{dayjs(item.activated_at).format("DD.MM.YY HH:mm")}} Uhr
+
Aktiviert durch: {{profileStore.getProfileById(item.activated_by).fullName}}
+
Beschreibung: {{item.description}}
+
+
-
-
-
+
+
+
+
+
+
@@ -392,4 +399,10 @@ td {
padding-bottom: 0.15em;
padding-top: 0.15em;
}
+
+.scroll {
+ height: 80vh;
+ overflow-y: scroll;
+ padding: 1em;
+}
\ No newline at end of file
diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue
index 1a5cd39..5795fe5 100644
--- a/pages/createDocument/edit/[[id]].vue
+++ b/pages/createDocument/edit/[[id]].vue
@@ -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) => {
@@ -882,6 +894,7 @@ const setRowData = (row) => {
+ {{itemInfo}}
@@ -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
@@ -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
@@ -1232,7 +1245,7 @@ const setRowData = (row) => {
:search-attributes="['name']"
class="w-full"
:disabled="!itemInfo.customer"
- @input="checkForOpenAdvanceInvoices"
+ @change="checkForOpenAdvanceInvoices"
>
{{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
@@ -1341,7 +1354,7 @@ const setRowData = (row) => {
-
+
{
searchable-placeholder="Suche ..."
:search-attributes="['name']"
v-model="row.service"
- @input="setRowData(row)"
+ @change="setRowData(row)"
>
{{services.find(i => i.id === row.service) ? services.find(i => i.id === row.service).name : "Keine Leistung ausgewählt" }}
@@ -1612,7 +1625,6 @@ const setRowData = (row) => {
v-model="row.price"
type="number"
step="0.001"
- :color="getRowMargin(row) > 0 ? 'primary' : 'rose'"
>
EUR
@@ -1847,29 +1859,24 @@ const setRowData = (row) => {
| Netto: |
- {{documentTotal.totalNet}} |
+ {{renderCurrency(documentTotal.totalNet)}} |
| zzgl. 19 % USt: |
- {{documentTotal.total19}} |
+ {{renderCurrency(documentTotal.total19)}} |
| Brutto: |
- {{documentTotal.totalGross}} |
+ {{renderCurrency(documentTotal.totalGross)}} |
-
-
| Bereits bezahlt: |
- {{documentTotal.totalGrossAlreadyPaid}} |
+ {{renderCurrency(documentTotal.totalGrossAlreadyPaid)}} |
-
-
| Offene Summe: |
- {{documentTotal.totalSumToPay}} |
+ {{renderCurrency(documentTotal.totalSumToPay)}} |
-
diff --git a/pages/standardEntity/[type]/[[mode]]/[[id]].vue b/pages/standardEntity/[type]/[[mode]]/[[id]].vue
index ee8828b..cb3af67 100644
--- a/pages/standardEntity/[type]/[[mode]]/[[id]].vue
+++ b/pages/standardEntity/[type]/[[mode]]/[[id]].vue
@@ -1,6 +1,7 @@