DataType Changes

This commit is contained in:
2024-12-30 09:31:28 +01:00
parent 9884a08e83
commit da3dc1e663

View File

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