Deprecated following as non standardEntity tasks, products, productcategories, services, servicecategories

This commit is contained in:
2024-12-22 22:13:34 +01:00
parent 61110da453
commit 1ba3d9c3e9
20 changed files with 287 additions and 63 deletions

View File

@@ -79,6 +79,8 @@ const loadOptions = async () => {
for await(const option of optionsToLoad) { for await(const option of optionsToLoad) {
if(option.option === "countrys") { if(option.option === "countrys") {
loadedOptions.value[option.option] = (await supabase.from("countrys").select()).data loadedOptions.value[option.option] = (await supabase.from("countrys").select()).data
} else if(option.option === "units") {
loadedOptions.value[option.option] = (await supabase.from("units").select()).data
} else { } else {
loadedOptions.value[option.option] = (await useSupabaseSelect(option.option)) loadedOptions.value[option.option] = (await useSupabaseSelect(option.option))
@@ -87,6 +89,8 @@ const loadOptions = async () => {
} }
} }
} }
console.log(loadedOptions.value)
} }
loadOptions() loadOptions()
@@ -174,7 +178,11 @@ const contentChanged = (content, datapoint) => {
:searchable="datapoint.selectSearchAttributes" :searchable="datapoint.selectSearchAttributes"
:search-attributes="datapoint.selectSearchAttributes" :search-attributes="datapoint.selectSearchAttributes"
:multiple="datapoint.selectMultiple" :multiple="datapoint.selectMultiple"
/> >
<template #empty>
Keine Optionen verfügbar
</template>
</USelectMenu>
<UTextarea <UTextarea
v-else-if="datapoint.inputType === 'textarea'" v-else-if="datapoint.inputType === 'textarea'"
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]" v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
@@ -218,7 +226,11 @@ const contentChanged = (content, datapoint) => {
:search-attributes="datapoint.selectSearchAttributes" :search-attributes="datapoint.selectSearchAttributes"
:multiple="datapoint.selectMultiple" :multiple="datapoint.selectMultiple"
searchable-placeholder="Suche..." searchable-placeholder="Suche..."
/> >
<template #empty>
Keine Optionen verfügbar
</template>
</USelectMenu>
<UTextarea <UTextarea
v-else-if="datapoint.inputType === 'textarea'" v-else-if="datapoint.inputType === 'textarea'"
v-model="props.item[datapoint.key]" v-model="props.item[datapoint.key]"

View File

@@ -62,8 +62,6 @@ const searchString = ref('')
const selectableFilters = ref(dataType.filters.map(i => i.name)) const selectableFilters = ref(dataType.filters.map(i => i.name))
const selectedFilters = ref(dataType.filters.filter(i => i.default).map(i => i.name) || []) const selectedFilters = ref(dataType.filters.filter(i => i.default).map(i => i.name) || [])
console.log(selectableFilters)
console.log(selectedFilters)
const filteredRows = computed(() => { const filteredRows = computed(() => {
@@ -132,6 +130,7 @@ const filteredRows = computed(() => {
class="hidden lg:block" class="hidden lg:block"
by="key" by="key"
:color="selectedColumns.length !== dataType.templateColumns.filter(i => !i.disabledInTable).length ? 'primary' : 'white'" :color="selectedColumns.length !== dataType.templateColumns.filter(i => !i.disabledInTable).length ? 'primary' : 'white'"
:ui-menu="{ width: 'min-w-max' }"
> >
<template #label> <template #label>
Spalten Spalten
@@ -144,6 +143,7 @@ const filteredRows = computed(() => {
v-model="selectedFilters" v-model="selectedFilters"
:options="selectableFilters" :options="selectableFilters"
:color="selectedFilters.length > 0 ? 'primary' : 'white'" :color="selectedFilters.length > 0 ? 'primary' : 'white'"
:ui-menu="{ width: 'min-w-max' }"
> >
<template #label> <template #label>
Filter Filter
@@ -159,6 +159,11 @@ const filteredRows = computed(() => {
@select="(i) => router.push(`/standardEntity/${type}/show/${i.id}`) " @select="(i) => router.push(`/standardEntity/${type}/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: `Keine ${dataType.label} anzuzeigen` }" :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: `Keine ${dataType.label} anzuzeigen` }"
> >
<template
v-for="column in dataType.templateColumns.filter(i => !i.disabledInTable)"
v-slot:[`${column.key}-header`]="{row}">
<span class="text-nowrap">{{column.label}}</span>
</template>
<template #name-data="{row}"> <template #name-data="{row}">
<span <span
v-if="row.id === filteredRows[selectedItem].id" v-if="row.id === filteredRows[selectedItem].id"

View File

@@ -18,11 +18,11 @@ const links = computed(() => {
icon: "i-heroicons-rectangle-stack", icon: "i-heroicons-rectangle-stack",
defaultOpen: false, defaultOpen: false,
children: [ children: [
{ ... role.checkRight("tasks") ? [{
label: "Aufgaben", label: "Aufgaben",
to: "/tasks", to: "/standardEntity/tasks",
icon: "i-heroicons-rectangle-stack" icon: "i-heroicons-rectangle-stack"
}, }] : [],
... profileStore.ownTenant.features.planningBoard ? [{ ... profileStore.ownTenant.features.planningBoard ? [{
label: "Plantafel", label: "Plantafel",
to: "/calendar/timeline", to: "/calendar/timeline",
@@ -183,22 +183,22 @@ const links = computed(() => {
children: [ children: [
... role.checkRight("products") ? [{ ... role.checkRight("products") ? [{
label: "Artikel", label: "Artikel",
to: "/products", to: "/standardEntity/products",
icon: "i-heroicons-puzzle-piece" icon: "i-heroicons-puzzle-piece"
}] : [], }] : [],
... role.checkRight("productcategories") ? [{ ... role.checkRight("productcategories") ? [{
label: "Artikelkategorien", label: "Artikelkategorien",
to: "/productcategories", to: "/standardEntity/productcategories",
icon: "i-heroicons-puzzle-piece" icon: "i-heroicons-puzzle-piece"
}] : [], }] : [],
... role.checkRight("services") ? [{ ... role.checkRight("services") ? [{
label: "Leistungen", label: "Leistungen",
to: "/services", to: "/standardEntity/services",
icon: "i-heroicons-puzzle-piece" icon: "i-heroicons-puzzle-piece"
}] : [], }] : [],
... role.checkRight("servicecategories") ? [{ ... role.checkRight("servicecategories") ? [{
label: "Leistungskategorien", label: "Leistungskategorien",
to: "/servicecategories", to: "/standardEntity/servicecategories",
icon: "i-heroicons-puzzle-piece" icon: "i-heroicons-puzzle-piece"
}] : [], }] : [],
] ]

View File

@@ -0,0 +1,15 @@
<script setup>
import dayjs from "dayjs";
const props = defineProps({
row: {
type: Object,
required: true,
default: {}
}
})
</script>
<template>
<span v-if="props.row.created_at">{{dayjs(props.row.created_at).format("DD.MM.YYYY HH:mm")}}</span>
</template>

View File

@@ -0,0 +1,15 @@
<script setup>
const props = defineProps({
row: {
type: Object,
required: true,
default: {}
}
})
const profileStore = useProfileStore()
</script>
<template>
<span>{{props.row.profile ? profileStore.getProfileById(props.row.profile).fullName : ''}}</span>
</template>

View File

@@ -0,0 +1,18 @@
<script setup>
const props = defineProps({
row: {
type: Object,
required: true,
default: {}
}
})
const profileStore = useProfileStore()
const profiles = computed(() => props.row.profiles.map(id => profileStore.getProfileById(id).fullName).join(', '))
</script>
<template>
<span>{{props.row.profiles ? profiles : ''}}</span>
</template>

View File

@@ -0,0 +1,13 @@
<script setup>
const props = defineProps({
row: {
type: Object,
required: true,
default: {}
}
})
</script>
<template>
<span>{{props.row.project ? props.row.project.name : ''}}</span>
</template>

View File

@@ -0,0 +1,13 @@
<script setup>
const props = defineProps({
row: {
type: Object,
required: true,
default: {}
}
})
</script>
<template>
<span>{{props.row.purchasePrice ? useCurrency(props.row.purchasePrice) : ''}}</span>
</template>

View File

@@ -172,6 +172,18 @@ export const useRole = () => {
label: "Rollen erstellen", label: "Rollen erstellen",
parent: "roles" parent: "roles"
}, },
tasks: {
label: "Aufgaben",
showToAllUsers: false
},
"tasks-viewAll": {
label: "Alle Aufgaben einsehen",
parent: "tasks"
},
"tasks-create": {
label: "Aufgaben erstellen",
parent: "tasks"
},
"inventory": { "inventory": {
label: "Lager", label: "Lager",
}, },

View File

@@ -104,35 +104,7 @@ const templateColumns = [
/*{ /*{
key:"finish" key:"finish"
},*/{ },*/
key: "created_at",
label: "Erstellt am:",
sortable: true
},{
key: "name",
label: "Name:",
sortable: true
},{
key: "categorie",
label: "Kategorie:",
sortable: true
},{
key: "description",
label: "Beschreibung:",
sortable: true
},{
key: "user",
label: "Benutzer:",
sortable: true
},{
key: "project",
label: "Projekt:",
sortable: true
},{
key: "plant",
label: "Objekt:",
sortable: true
}
] ]
const selectedColumns = ref(templateColumns) const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column))) const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))

View File

@@ -18,6 +18,11 @@ import address from "~/components/columnRenderings/address.vue"
import sepa from "~/components/columnRenderings/sepa.vue" import sepa from "~/components/columnRenderings/sepa.vue"
import recurring from "~/components/columnRenderings/recurring.vue" import recurring from "~/components/columnRenderings/recurring.vue"
import description from "~/components/columnRenderings/description.vue" import description from "~/components/columnRenderings/description.vue"
import purchasePrice from "~/components/columnRenderings/purchasePrice.vue";
import project from "~/components/columnRenderings/project.vue";
import created_at from "~/components/columnRenderings/created_at.vue";
import profile from "~/components/columnRenderings/profile.vue";
import profiles from "~/components/columnRenderings/profiles.vue";
// @ts-ignore // @ts-ignore
export const useDataStore = defineStore('data', () => { export const useDataStore = defineStore('data', () => {
@@ -32,8 +37,74 @@ export const useDataStore = defineStore('data', () => {
tasks: { tasks: {
label: "Aufgaben", label: "Aufgaben",
labelSingle: "Aufgabe", labelSingle: "Aufgabe",
isStandardEntity: true,
redirect: true, redirect: true,
historyItemHolder: "task" historyItemHolder: "task",
supabaseSelectWithInformation: "*, plant(*), project(*), customer(*)",
filters: [
{
name: "Nur Offene Aufgaben",
default: true,
"filterFunction": function (row) {
if(row.categorie !== "Erledigt") {
return true
} else {
return false
}
}
}
],
templateColumns: [
{
key: "created_at",
label: "Erstellt am",
component: created_at,
},{
key: "name",
label: "Name",
title: true,
inputType: "text"
},{
key: "categorie",
label: "Kategorie"
},{
key: "profile",
label: "Benutzer",
component: profile,
inputType: "select",
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
},{
key: "project",
label: "Projekt",
component: project,
inputType: "select",
selectDataType: "projects",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},{
key: "customer",
label: "Kunde",
component: customer,
inputType: "select",
selectDataType: "customers",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},{
key: "plant",
label: "Objekt",
component: plant,
inputType: "select",
selectDataType: "plants",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},{
key: "description",
label: "Beschreibung"
},
],
showTabs: [{label: 'Informationen'}]
}, },
customers: { customers: {
label: "Kunden", label: "Kunden",
@@ -140,7 +211,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles", selectDataType: "profiles",
selectOptionAttribute: "fullName", selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'], selectSearchAttributes: ['fullName'],
selectMultiple: true selectMultiple: true,
component: profiles
}, },
], ],
showTabs: [{label: 'Informationen'},{label: 'Dokumente'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}] showTabs: [{label: 'Informationen'},{label: 'Dokumente'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}]
@@ -343,38 +415,64 @@ export const useDataStore = defineStore('data', () => {
products: { products: {
label: "Artikel", label: "Artikel",
labelSingle: "Artikel", labelSingle: "Artikel",
isStandardEntity: true,
redirect:true, redirect:true,
supabaseSelectWithInformation: "*, unit(name)",
filters: [], filters: [],
templateColumns: [ templateColumns: [
{ {
key: "name", key: "name",
label:"Name" label:"Name",
}, title: true,
{ inputType: "text"
key: "description",
label: "Beschreibung"
}, },
{ {
key: "manufacturer", key: "manufacturer",
label: "Hersteller" label: "Hersteller",
inputType: "text"
}, },
{ {
key: "unit", key: "unit",
label: "Einheit", label: "Einheit",
component: unit component: unit,
inputType: "select",
selectDataType: "units",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
}, },
{ {
key: "purchasePrice",
label: "Einkaufspreis",
component: purchasePrice,
inputType: "number"
},{
key: "sellingPrice", key: "sellingPrice",
label: "Verkaufpreispreis", label: "Verkaufpreispreis",
component: sellingPrice component: sellingPrice,
inputType: "number"
}, },
{ /*{
key: "tags", key: "tags",
label: "Tags" label: "Tags"
}, },*/
{ {
key: "productcategories", key: "productcategories",
label: "Artikelkategorien" label: "Artikelkategorien",
inputType: "select",
selectDataType: "productcategories",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
selectMultiple: true
},
{
key: "description",
label: "Beschreibung",
inputType:"textarea"
},
],
showTabs: [
{
label: "Informationen"
} }
] ]
}, },
@@ -389,7 +487,7 @@ export const useDataStore = defineStore('data', () => {
supabaseSortColumn: "projectNumber", supabaseSortColumn: "projectNumber",
filters: [ filters: [
{ {
name: "Abgeschlossen", name: "Nur Offene Projekte",
default: true, default: true,
"filterFunction": function (row) { "filterFunction": function (row) {
if(row.phases && row.phases.length > 0) { if(row.phases && row.phases.length > 0) {
@@ -453,7 +551,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles", selectDataType: "profiles",
selectOptionAttribute: "fullName", selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'], selectSearchAttributes: ['fullName'],
selectMultiple: true selectMultiple: true,
component: profiles
},], },],
showTabs: [ showTabs: [
{ {
@@ -551,7 +650,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles", selectDataType: "profiles",
selectOptionAttribute: "fullName", selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'], selectSearchAttributes: ['fullName'],
selectMultiple: true selectMultiple: true,
component: profiles
}, },
], ],
showTabs: [ showTabs: [
@@ -668,7 +768,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles", selectDataType: "profiles",
selectOptionAttribute: "fullName", selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'], selectSearchAttributes: ['fullName'],
selectMultiple: true selectMultiple: true,
component: profiles
}, },
], ],
showTabs: [ showTabs: [
@@ -712,22 +813,50 @@ export const useDataStore = defineStore('data', () => {
services: { services: {
label: "Leistungen", label: "Leistungen",
labelSingle: "Leistung", labelSingle: "Leistung",
isStandardEntity: true,
redirect: true, redirect: true,
supabaseSelectWithInformation: "*, unit(*)",
filters: [], filters: [],
templateColumns: [ templateColumns: [
{ {
key: "name", key: "name",
label: "Name" label: "Name",
title: true,
inputType: "text"
}, },
{ {
key: "unit", key: "unit",
label: "Einheit", label: "Einheit",
component: unit component: unit,
inputType: "select",
selectDataType: "units",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
}, },
{ {
key: "sellingPrice", key: "sellingPrice",
label: "Verkaufspreis", label: "Verkaufspreis",
component: sellingPrice component: sellingPrice,
inputType: "number",
},
{
key: "servicecategories",
label: "Leistungskategorien",
inputType: "select",
selectDataType: "servicecategories",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
selectMultiple: true
},
{
key: "description",
label: "Beschreibung",
inputType:"textarea"
},
],
showTabs: [
{
label: 'Informationen',
} }
] ]
}, },
@@ -765,32 +894,52 @@ export const useDataStore = defineStore('data', () => {
productcategories: { productcategories: {
label: "Artikelkategorien", label: "Artikelkategorien",
labelSingle: "Artikelkategorie", labelSingle: "Artikelkategorie",
isStandardEntity: true,
redirect: true, redirect: true,
supabaseSelectWithInformation: "*",
filters: [], filters: [],
templateColumns: [ templateColumns: [
{ {
key: "name", key: "name",
label: "Name", label: "Name",
title: true,
inputType: "text"
}, },
{ {
key: "description", key: "description",
label: "Beschreibung", label: "Beschreibung",
inputType: "textarea"
}
],
showTabs: [
{
label: 'Informationen',
} }
] ]
}, },
servicecategories: { servicecategories: {
label: "Leistungskategorie", label: "Leistungskategorien",
labelSingle: "Leistungskategorien", labelSingle: "Leistungskategorie",
isStandardEntity: true,
redirect: true, redirect: true,
supabaseSelectWithInformation: "*",
filters: [], filters: [],
templateColumns: [ templateColumns: [
{ {
key: "name", key: "name",
label: "Name", label: "Name",
title: true,
inputType: "text"
}, },
{ {
key: "description", key: "description",
label: "Beschreibung", label: "Beschreibung",
inputType: "textarea"
}
],
showTabs: [
{
label: 'Informationen',
} }
] ]
}, },
@@ -1273,7 +1422,7 @@ export const useDataStore = defineStore('data', () => {
} else { } else {
let historyItem = { let historyItem = {
text: `${dataTypes[dataType].labelSingle} erstellt`, text: `${dataTypes[dataType].labelSingle} erstellt`,
createdBy: activeProfile.value.id, createdBy: profileStore.activeProfile.id,
tenant: profileStore.currentTenant tenant: profileStore.currentTenant
} }