Introduced EntityEdit.vue

Introduced EntityShow.vue

Deprecated following as non standardEntity contracts, customers, vendors, projects, plants, vehicles
This commit is contained in:
2024-12-22 16:59:18 +01:00
parent b465f4a75a
commit 565d531376
28 changed files with 1942 additions and 932 deletions

View File

@@ -7,12 +7,17 @@ import {useNumberRange} from "~/composables/useNumberRange.js";
import projecttype from "~/components/columnRenderings/projecttype.vue"
import customer from "~/components/columnRenderings/customer.vue"
import contact from "~/components/columnRenderings/contact.vue"
import plant from "~/components/columnRenderings/plant.vue"
import vendor from "~/components/columnRenderings/vendor.vue"
import active from "~/components/columnRenderings/active.vue"
import sellingPrice from "~/components/columnRenderings/sellingPrice.vue";
import unit from "~/components/columnRenderings/unit.vue";
import isCompany from "~/components/columnRenderings/isCompany.vue"
import address from "~/components/columnRenderings/address.vue"
import sepa from "~/components/columnRenderings/sepa.vue"
import recurring from "~/components/columnRenderings/recurring.vue"
import description from "~/components/columnRenderings/description.vue"
// @ts-ignore
export const useDataStore = defineStore('data', () => {
@@ -33,37 +38,112 @@ export const useDataStore = defineStore('data', () => {
customers: {
label: "Kunden",
labelSingle: "Kunde",
isStandardEntity: true,
redirect:true,
numberRangeHolder: "customerNumber",
historyItemHolder: "customer",
supabaseSortColumn: "customerNumber",
supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*)",
filters: [],
templateColumns: [
{
key: 'customerNumber',
label: "Kundennummer",
inputIsNumberRange: true,
inputType: "text"
},
{
key: "name",
label: "Name"
label: "Name",
title: true,
inputType: "text"
},
{
key: "isCompany",
label: "Typ"
label: "Typ",
component: isCompany,
inputType: "bool"
},
{
key: "notes",
label: "Notizen"
label: "Notizen",
inputType: "textarea"
},
{
key: "active",
label: "Aktiv",
component: active
component: active,
inputType: "bool"
},
{
key: "infoData.streetNumber",
label: "Straße + Hausnummer",
inputType: "text",
disabledInTable: true
},
{
key: "infoData.special",
label: "Adresszusatz",
inputType: "text",
disabledInTable: true
},
{
key: "infoData.zip",
label: "Postleitzahl",
inputType: "number",
disabledInTable: true
},
{
key: "infoData.city",
label: "Stadt",
inputType: "text",
disabledInTable: true
},
{
key: "infoData.country",
label: "Land",
inputType: "select",
selectDataType: "countrys",
selectOptionAttribute: "name",
selectValueAttribute: "name",
disabledInTable: true
},
{
key: "address",
label: "Adresse",
}
]
component: address
},
{
key: "infoData.tel",
label: "Telefon",
inputType: "text"
},
{
key: "infoData.email",
label: "E-Mail",
inputType: "text"
},
{
key: "infoData.web",
label: "Web",
inputType: "text"
},
{
key: "infoData.ustid",
label: "USt-Id",
inputType: "text"
},
{
key: "profiles",
label: "Berechtigte Benutzer",
inputType: "select",
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
},
],
showTabs: [{label: 'Informationen'},{label: 'Dokumente'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}]
},
contacts: {
label: "Kontakte",
@@ -116,21 +196,103 @@ export const useDataStore = defineStore('data', () => {
contracts: {
label: "Verträge",
labelSingle: "Vertrag",
isStandardEntity: true,
redirect:true,
filters:[],
supabaseSelectWithInformation: "*, customer(*), documents(*)",
templateColumns: [
{
key: "name",
label: "Name"
label: "Name",
title: true,
inputType: "text"
},{
key: "active",
label: "Aktiv",
component: active,
inputType: "bool"
},{
key: "recurring",
label: "Wiederkehrend",
component: recurring,
inputType: "bool"
},{
key: 'customer',
label: "Kunde",
component: customer
component: customer,
inputType: "select",
selectDataType: "customers",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},{
key: 'contact',
label: "Ansprechpartner",
component: contact,
inputType: "select",
selectDataType: "contacts",
selectDataTypeFilter: function (i,item) {
return i.customer === item.customer
},
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
},{
key: 'duration',
label: "mindest Vertragslaufzeit",
inputType: "select",
selectManualOptions: ['12 Monate','24 Monate','36 Monate','48 Monate']
},{
key: 'invoiceDispatch',
label: "Rechnungsversand",
inputType: "select",
selectManualOptions: ['E-Mail','Post']
},{
key: 'paymentType',
label: "Zahlungsart",
inputType: "select",
selectManualOptions: ['Einzug','Überweisung']
},{
key: 'startDate',
label: "Vertragsstart",
inputType: "date",
},{
key: 'endDate',
label: "Vertragsende",
inputType: "date",
},{
key: 'signDate',
label: "Unterschrieben am",
inputType: "date",
},{
key: 'sepaDate',
label: "SEPA Datum",
inputType: "date",
},{
key: 'sepaRef',
label: "Mandatsreferenz",
inputType: "text",
},{
key: 'bankingIban',
label: "IBAN",
inputType: "text",
},{
key: 'bankingOwner',
label: "Inhaber",
inputType: "text",
},{
key: 'bankingName',
label: "Bank",
inputType: "text",
},{
key: 'bankinBIC',
label: "BIC",
inputType: "text",
},{
key: "notes",
label: "Notizen"
label: "Notizen",
inputType: "textarea"
}
]
],
showTabs: [{label: 'Informationen'},{label: 'Dokumente'}]
},
absencerequests: {
label: "Abwesenheitsanträge",
@@ -140,20 +302,43 @@ export const useDataStore = defineStore('data', () => {
plants: {
label: "Objekte",
labelSingle: "Objekt",
isStandardEntity: true,
redirect:true,
historyItemHolder: "plant",
supabaseSelectWithInformation: "*, customer(id,name)",
filters: [],
templateColumns: [
{
key: "name",
label: "Name"
label: "Name",
inputType: "text",
title: true
},
{
key: "customer",
label: "Kunde",
component: customer
}
]
component: customer,
inputType: "select",
selectDataType: "customers",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},{
key: "description",
label: "Beschreibung",
inputType:"editor",
component: description
},
],
showTabs: [
{
label: "Informationen"
},{
label: "Projekte"
},{
label: "Aufgaben"
},{
label: "Dokumente"
}]
},
products: {
label: "Artikel",
@@ -196,9 +381,12 @@ export const useDataStore = defineStore('data', () => {
projects: {
label: "Projekte",
labelSingle: "Projekt",
isStandardEntity: true,
redirect:true,
historyItemHolder: "project",
numberRangeHolder: "projectNumber",
supabaseSelectWithInformation: "*, customer(name), plant(name), projecttype(name, id), tasks(*), documents(*)",
supabaseSortColumn: "projectNumber",
filters: [
{
name: "Abgeschlossen",
@@ -221,80 +409,273 @@ export const useDataStore = defineStore('data', () => {
{
key: "projecttype",
label: "Typ",
component: projecttype
component: projecttype,
inputType: "select",
selectDataType: "projecttypes",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},{
key: "phase",
label: "Phase"
},{
key: "name",
label: "Name"
label: "Name",
title: true,
inputType: "text"
},
{
key: "customer",
label: "Kunde",
component: customer
component: customer,
inputType: "select",
selectDataType: "customers",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},
{
key: "notes",
label: "Notizen",
inputType: "textarea"
},
{
key: "plant",
label: "Objekt",
component: plant
component: plant,
inputType: "select",
selectDataType: "plants",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},
{
key: "profiles",
label: "Benutzer"
}]
label: "Berechtigte Benutzer",
inputType: "select",
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
},],
showTabs: [
{
key: "information",
label: "Informationen"
},
{
key: "phases",
label: "Phasen"
},{
key: "tasks",
label: "Aufgaben"
},{
key: "documents",
label: "Dokumente"
}/*,{
key: "timetracking",
label: "Zeiterfassung"
},{
key: "events",
label: "Termine"
},{
key: "material",
label: "Material"
}*/]
},
vehicles: {
label: "Fahrzeuge",
labelSingle: "Fahrzeug",
isStandardEntity: true,
redirect:true,
historyItemHolder: "vehicle",
supabaseSelectWithInformation: "*, checks(*), documents(*)",
filters:[],
templateColumns:[
{
key: 'active',
label: "Aktiv",
component: active
component: active,
inputType: "bool"
},{
key: 'licensePlate',
label: "Kennzeichen"
label: "Kennzeichen",
inputType: "text",
title: true
},{
key: 'vin',
label: "Identifikationnummer"
label: "Identifikationnummer",
inputType: "text"
},
{
key: "type",
label: "Typ",
inputType: "text"
},
{
key: "driver",
label: "Fahrer",
inputType: "select",
selectDataType: "profiles",
selectOptionAttribute: "fullName"
},
{
key: "tankSize",
label: "Tankvolumen",
unit: "L",
inputType: "number"
},
{
key: "buildYear",
label: "Baujahr",
inputType: "number"
},
{
key: "towingCapacity",
label: "Anhängelast",
unit: "kG",
inputType: "number"
},
{
key: "color",
label: "Farbe",
inputType: "text"
},
{
key: "powerInKW",
label: "Leistung",
unit: "kW",
inputType: "number"
},
{
key: "profiles",
label: "Berechtigte Benutzer",
inputType: "select",
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
},
],
showTabs: [
{
label: 'Informationen',
}, {
label: 'Dokumente',
}, {
label: 'Überprüfungen',
}
]
},
vendors: {
label: "Lieferanten",
labelSingle: "Lieferant",
isStandardEntity: true,
redirect:true,
numberRangeHolder: "vendorNumber",
historyItemHolder: "vendor",
filters: [],
supabaseSortColumn: "vendorNumber",
supabaseSelectWithInformation: "*, contacts(*)",
filters: [{
name: "SEPA nicht erteilt",
"filterFunction": function (row) {
return !row.hasSEPA
}
}],
templateColumns: [
{
key: 'vendorNumber',
label: "Lieferantennummer",
inputType: "text",
inputIsNumberRange: true
},
{
key: "name",
label: "Name"
label: "Name",
title: true,
inputType: "text"
},
{
key: "infoData.streetNumber",
label: "Straße + Hausnummer",
inputType: "text",
disabledInTable: true
},
{
key: "infoData.special",
label: "Adresszusatz",
inputType: "text",
disabledInTable: true
},
{
key: "infoData.zip",
label: "Postleitzahl",
inputType: "number",
disabledInTable: true
},
{
key: "infoData.city",
label: "Stadt",
inputType: "text",
disabledInTable: true
},
{
key: "infoData.country",
label: "Land",
inputType: "select",
selectDataType: "countrys",
selectOptionAttribute: "name",
selectValueAttribute: "name",
disabledInTable: true
},
{
key: "address",
label: "Adresse"
label: "Adresse",
component: address
},
{
key: "infoData.tel",
label: "Telefon",
inputType: "text"
},
{
key: "infoData.email",
label: "E-Mail",
inputType: "text"
},
{
key: "infoData.web",
label: "Web",
inputType: "text"
},
{
key: "infoData.ustid",
label: "USt-Id",
inputType: "text"
},
{
key: "hasSEPA",
label: "SEPA Mandat erteilt",
inputType: "bool",
component: sepa
},
{
key: "notes",
label: "Notizen"
label: "Notizen",
inputType: "textarea"
},
{
key: "profiles",
label: "Berechtigte Benutzer",
inputType: "select",
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
},
],
showTabs: [
{
label: 'Informationen',
}, {
label: 'Dokumente',
}
]
},
@@ -798,8 +1179,8 @@ export const useDataStore = defineStore('data', () => {
name = "Kategorie"
} else if(key === "profile") {
name = "Mitarbeiter"
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
if(prop.data.o) oldVal = profileStore.profiles.find(i => i.id === prop.data.o).fullName
if(prop.data.n) newVal = profileStore.profiles.find(i => i.id === prop.data.n).fullName
} else if(key === "plant") {
name = "Objekt"
if(prop.data.o) oldVal = plants.value.find(i => i.id === prop.data.o).name
@@ -822,8 +1203,8 @@ export const useDataStore = defineStore('data', () => {
name = "Leistung"
} else if(key === "driver") {
name = "Fahrer"
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
if(prop.data.o) oldVal = profileStore.profiles.find(i => i.id === prop.data.o).fullName
if(prop.data.n) newVal = profileStore.profiles.find(i => i.id === prop.data.n).fullName
} else if(key === "projecttype") {
name = "Projekttyp"
@@ -856,7 +1237,7 @@ export const useDataStore = defineStore('data', () => {
let historyItem = {
text: text,
createdBy: activeProfile.value.id,
createdBy: profileStore.activeProfile.id,
oldVal: prop.data.o,
newVal: prop.data.n,
tenant: profileStore.currentTenant
@@ -971,7 +1352,13 @@ export const useDataStore = defineStore('data', () => {
toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`})
if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${supabaseData[0].id}`)
if(dataTypes[dataType].redirect) {
if(dataTypes[dataType].isStandardEntity) {
await router.push(dataTypes[dataType].redirectToList ? `/standardEntity/${dataType}` : `/standardEntity/${dataType}/show/${data.id}`)
} else {
await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${data.id}`)
}
}
return supabaseData
}
}
@@ -1022,9 +1409,15 @@ export const useDataStore = defineStore('data', () => {
toast.add({title: `Fehler beim Speichern`, color: 'rose'})
} else if(supabaseData) {
//await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0]))
if(dataType === 'profiles') await fetchProfiles()
//if(dataType === 'profiles') await fetchProfiles()
toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`})
if(dataTypes[dataType].redirect) await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${data.id}`)
if(dataTypes[dataType].redirect) {
if(dataTypes[dataType].isStandardEntity) {
await router.push(dataTypes[dataType].redirectToList ? `/standardEntity/${dataType}` : `/standardEntity/${dataType}/show/${data.id}`)
} else {
await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${data.id}`)
}
}
return supabaseData
}
}
@@ -1441,19 +1834,19 @@ export const useDataStore = defineStore('data', () => {
})
const getEventTypes = computed(() => {
return ownTenant.value.calendarConfig.eventTypes
return profileStore.ownTenant.calendarConfig.eventTypes
})
const getTimeTypes = computed(() => {
return ownTenant.value.timeConfig.timeTypes
return profileStore.ownTenant.timeConfig.timeTypes
})
const getDocumentTags = computed(() => {
return ownTenant.value.tags.documents
return profileStore.ownTenant.tags.documents
})
const getMeasures = computed(() => {
return ownTenant.value.measures
return profileStore.ownTenant.measures
})
const getResources = computed(() => {
@@ -1511,7 +1904,7 @@ export const useDataStore = defineStore('data', () => {
const getEvents = computed(() => {
return [
...events.value.map(event => {
let eventColor = ownTenant.value.calendarConfig.eventTypes.find(type => type.label === event.type).color
let eventColor = profileStore.ownTenant.calendarConfig.eventTypes.find(type => type.label === event.type).color
let title = ""
if(event.title) {
@@ -1548,7 +1941,7 @@ export const useDataStore = defineStore('data', () => {
console.log(event)
event.resources.forEach(resource => {
console.log(resource)
let eventColor = ownTenant.value.calendarConfig.eventTypes.find(type => type.label === event.type).color
let eventColor = profileStore.ownTenant.calendarConfig.eventTypes.find(type => type.label === event.type).color
let title = ""
if(event.title) {
@@ -1580,7 +1973,7 @@ export const useDataStore = defineStore('data', () => {
/*...events.value.map(event => {
let eventColor = ownTenant.value.calendarConfig.eventTypes.find(type => type.label === event.type).color
let eventColor = profileStore.ownTenant.calendarConfig.eventTypes.find(type => type.label === event.type).color
return {
...event,