diff --git a/stores/data.js b/stores/data.js index 222ab71..0c615e1 100644 --- a/stores/data.js +++ b/stores/data.js @@ -25,6 +25,9 @@ import profile from "~/components/columnRenderings/profile.vue"; import profiles from "~/components/columnRenderings/profiles.vue"; import vehicle from "~/components/columnRenderings/vehicle.vue" import usePlanning from "~/components/columnRenderings/usePlanning.vue" +import sellingPriceComposedMaterial from "~/components/columnRenderings/sellingPriceComposedMaterial.vue" +import sellingPriceComposedWorker from "~/components/columnRenderings/sellingPriceComposedWorker.vue" +import sellingPriceComposedTotal from "~/components/columnRenderings/sellingPriceComposedTotal.vue" import quantity from "~/components/helpRenderings/quantity.vue" import {useZipCheck} from "~/composables/useZipCheck.js"; @@ -230,48 +233,93 @@ export const useDataStore = defineStore('data', () => { contacts: { label: "Kontakte", labelSingle: "Kontakt", + isStandardEntity: true, redirect:true, historyItemHolder: "contact", + supabaseSelectWithInformation: "*, customer(*), vendor(*)", filters: [], templateColumns: [ { key: "fullName", label: "Name", - }, - { - key: "customer", - label: "Kunde", - component: customer - }, - { - key: "vendor", - label: "Lieferant", - component: vendor - }, - { - key: "role", - label: "Rolle", - }, - { - key: "email", - label: "E-Mail", - }, - { - key: "phoneMobile", - label: "Mobil", - }, - { - key: "phoneHome", - label: "Festnetz", + title: true, + },{ + key: "salutation", + label: "Anrede", + inputType: "text", + },{ + key: "firstName", + label: "Vorname", + inputType: "text", + inputChangeFunction: function (row) { + row.fullName = `${row.firstName} ${row.lastName}` + } + },{ + key: "lastName", + label: "Nachname", + inputType: "text", + inputChangeFunction: function (row) { + row.fullName = `${row.firstName} ${row.lastName}` + } }, { key: "active", label: "Aktiv", - component: active + component: active, + inputType: "bool" + }, + { + key: "customer", + label: "Kunde", + component: customer, + inputType: "select", + selectDataType: "customers", + selectOptionAttribute: "name", + selectSearchAttributes: ['name'], + }, + { + key: "vendor", + label: "Lieferant", + component: vendor, + inputType: "select", + selectDataType: "vendors", + selectOptionAttribute: "name", + selectSearchAttributes: ['name'], + }, + { + key: "role", + label: "Rolle", + inputType: "text" + }, + { + key: "email", + label: "E-Mail", + inputType: "text", + }, + { + key: "phoneMobile", + label: "Mobil", + inputType: "text", + }, + { + key: "phoneHome", + label: "Festnetz", + inputType: "text", }, { key: "birtday", label: "Geburtstag", + inputType: "date", + }, + { + key: "notes", + label: "Notizen", + inputType: "textarea", + }, + ], + showTabs:[ + { + label: 'Informationen', } ] }, @@ -574,6 +622,9 @@ export const useDataStore = defineStore('data', () => { selectDataType: "projecttypes", selectOptionAttribute: "name", selectSearchAttributes: ['name'], + inputChangeFunction: function (item,loadedOptions = {}) { + item.phases = loadedOptions.projecttypes.find(i => i.id === item.projecttype).initialPhases + } },{ key: "phase", label: "Phase" @@ -1102,6 +1153,7 @@ export const useDataStore = defineStore('data', () => { isStandardEntity: true, redirect: true, supabaseSelectWithInformation: "*, unit(*)", + historyItemHolder: "service", filters: [], templateColumns: [ { @@ -1144,6 +1196,7 @@ export const useDataStore = defineStore('data', () => { row.sellingPrice = row.sellingPriceComposed.total } }, + component: sellingPriceComposedWorker }, { key: "sellingPriceComposed.material", @@ -1155,14 +1208,23 @@ export const useDataStore = defineStore('data', () => { row.sellingPrice = row.sellingPriceComposed.total } }, + component: sellingPriceComposedMaterial }, { key: "sellingPriceComposed.total", label: "Verkaufspreis Gesamt", inputType: "number", - disabledFunction: function (item) { + /*disabledFunction: function (item) { return item.sellingPriceComposed.worker || item.sellingPriceComposed.material + },*/ + inputChangeFunction: function (row) { + if(row.sellingPriceComposed.worker) { + row.sellingPriceComposed.material = row.sellingPriceComposed.total - row.sellingPriceComposed.worker + } else if(row.sellingPriceComposed.material) { + row.sellingPriceComposed.worker = row.sellingPriceComposed.total - row.sellingPriceComposed.material + } }, + component: sellingPriceComposedTotal }, @@ -1905,7 +1967,7 @@ export const useDataStore = defineStore('data', () => { await generateHistoryItems(dataType, supabaseData[0]) - if(!["statementallocations", "productcategories", "projecttypes", "checks", "profiles"].includes(dataType) ){ + if(!["statementallocations", "productcategories", "projecttypes", "checks", "profiles","services"].includes(dataType) ){ await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')') }