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) {
if(option.option === "countrys") {
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 {
loadedOptions.value[option.option] = (await useSupabaseSelect(option.option))
@@ -87,6 +89,8 @@ const loadOptions = async () => {
}
}
}
console.log(loadedOptions.value)
}
loadOptions()
@@ -174,7 +178,11 @@ const contentChanged = (content, datapoint) => {
:searchable="datapoint.selectSearchAttributes"
:search-attributes="datapoint.selectSearchAttributes"
:multiple="datapoint.selectMultiple"
/>
>
<template #empty>
Keine Optionen verfügbar
</template>
</USelectMenu>
<UTextarea
v-else-if="datapoint.inputType === 'textarea'"
v-model="props.item[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]]"
@@ -218,7 +226,11 @@ const contentChanged = (content, datapoint) => {
:search-attributes="datapoint.selectSearchAttributes"
:multiple="datapoint.selectMultiple"
searchable-placeholder="Suche..."
/>
>
<template #empty>
Keine Optionen verfügbar
</template>
</USelectMenu>
<UTextarea
v-else-if="datapoint.inputType === 'textarea'"
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 selectedFilters = ref(dataType.filters.filter(i => i.default).map(i => i.name) || [])
console.log(selectableFilters)
console.log(selectedFilters)
const filteredRows = computed(() => {
@@ -132,6 +130,7 @@ const filteredRows = computed(() => {
class="hidden lg:block"
by="key"
:color="selectedColumns.length !== dataType.templateColumns.filter(i => !i.disabledInTable).length ? 'primary' : 'white'"
:ui-menu="{ width: 'min-w-max' }"
>
<template #label>
Spalten
@@ -144,6 +143,7 @@ const filteredRows = computed(() => {
v-model="selectedFilters"
:options="selectableFilters"
:color="selectedFilters.length > 0 ? 'primary' : 'white'"
:ui-menu="{ width: 'min-w-max' }"
>
<template #label>
Filter
@@ -159,6 +159,11 @@ const filteredRows = computed(() => {
@select="(i) => router.push(`/standardEntity/${type}/show/${i.id}`) "
: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}">
<span
v-if="row.id === filteredRows[selectedItem].id"

View File

@@ -18,11 +18,11 @@ const links = computed(() => {
icon: "i-heroicons-rectangle-stack",
defaultOpen: false,
children: [
{
... role.checkRight("tasks") ? [{
label: "Aufgaben",
to: "/tasks",
to: "/standardEntity/tasks",
icon: "i-heroicons-rectangle-stack"
},
}] : [],
... profileStore.ownTenant.features.planningBoard ? [{
label: "Plantafel",
to: "/calendar/timeline",
@@ -183,22 +183,22 @@ const links = computed(() => {
children: [
... role.checkRight("products") ? [{
label: "Artikel",
to: "/products",
to: "/standardEntity/products",
icon: "i-heroicons-puzzle-piece"
}] : [],
... role.checkRight("productcategories") ? [{
label: "Artikelkategorien",
to: "/productcategories",
to: "/standardEntity/productcategories",
icon: "i-heroicons-puzzle-piece"
}] : [],
... role.checkRight("services") ? [{
label: "Leistungen",
to: "/services",
to: "/standardEntity/services",
icon: "i-heroicons-puzzle-piece"
}] : [],
... role.checkRight("servicecategories") ? [{
label: "Leistungskategorien",
to: "/servicecategories",
to: "/standardEntity/servicecategories",
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",
parent: "roles"
},
tasks: {
label: "Aufgaben",
showToAllUsers: false
},
"tasks-viewAll": {
label: "Alle Aufgaben einsehen",
parent: "tasks"
},
"tasks-create": {
label: "Aufgaben erstellen",
parent: "tasks"
},
"inventory": {
label: "Lager",
},

View File

@@ -104,35 +104,7 @@ const templateColumns = [
/*{
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 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 recurring from "~/components/columnRenderings/recurring.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
export const useDataStore = defineStore('data', () => {
@@ -32,8 +37,74 @@ export const useDataStore = defineStore('data', () => {
tasks: {
label: "Aufgaben",
labelSingle: "Aufgabe",
isStandardEntity: 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: {
label: "Kunden",
@@ -140,7 +211,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
selectMultiple: true,
component: profiles
},
],
showTabs: [{label: 'Informationen'},{label: 'Dokumente'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}]
@@ -343,38 +415,64 @@ export const useDataStore = defineStore('data', () => {
products: {
label: "Artikel",
labelSingle: "Artikel",
isStandardEntity: true,
redirect:true,
supabaseSelectWithInformation: "*, unit(name)",
filters: [],
templateColumns: [
{
key: "name",
label:"Name"
},
{
key: "description",
label: "Beschreibung"
label:"Name",
title: true,
inputType: "text"
},
{
key: "manufacturer",
label: "Hersteller"
label: "Hersteller",
inputType: "text"
},
{
key: "unit",
label: "Einheit",
component: unit
component: unit,
inputType: "select",
selectDataType: "units",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},
{
key: "purchasePrice",
label: "Einkaufspreis",
component: purchasePrice,
inputType: "number"
},{
key: "sellingPrice",
label: "Verkaufpreispreis",
component: sellingPrice
component: sellingPrice,
inputType: "number"
},
{
/*{
key: "tags",
label: "Tags"
},
},*/
{
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",
filters: [
{
name: "Abgeschlossen",
name: "Nur Offene Projekte",
default: true,
"filterFunction": function (row) {
if(row.phases && row.phases.length > 0) {
@@ -453,7 +551,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
selectMultiple: true,
component: profiles
},],
showTabs: [
{
@@ -551,7 +650,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
selectMultiple: true,
component: profiles
},
],
showTabs: [
@@ -668,7 +768,8 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "profiles",
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
selectMultiple: true
selectMultiple: true,
component: profiles
},
],
showTabs: [
@@ -712,22 +813,50 @@ export const useDataStore = defineStore('data', () => {
services: {
label: "Leistungen",
labelSingle: "Leistung",
isStandardEntity: true,
redirect: true,
supabaseSelectWithInformation: "*, unit(*)",
filters: [],
templateColumns: [
{
key: "name",
label: "Name"
label: "Name",
title: true,
inputType: "text"
},
{
key: "unit",
label: "Einheit",
component: unit
component: unit,
inputType: "select",
selectDataType: "units",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
},
{
key: "sellingPrice",
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: {
label: "Artikelkategorien",
labelSingle: "Artikelkategorie",
isStandardEntity: true,
redirect: true,
supabaseSelectWithInformation: "*",
filters: [],
templateColumns: [
{
key: "name",
label: "Name",
title: true,
inputType: "text"
},
{
key: "description",
label: "Beschreibung",
inputType: "textarea"
}
],
showTabs: [
{
label: 'Informationen',
}
]
},
servicecategories: {
label: "Leistungskategorie",
labelSingle: "Leistungskategorien",
label: "Leistungskategorien",
labelSingle: "Leistungskategorie",
isStandardEntity: true,
redirect: true,
supabaseSelectWithInformation: "*",
filters: [],
templateColumns: [
{
key: "name",
label: "Name",
title: true,
inputType: "text"
},
{
key: "description",
label: "Beschreibung",
inputType: "textarea"
}
],
showTabs: [
{
label: 'Informationen',
}
]
},
@@ -1273,7 +1422,7 @@ export const useDataStore = defineStore('data', () => {
} else {
let historyItem = {
text: `${dataTypes[dataType].labelSingle} erstellt`,
createdBy: activeProfile.value.id,
createdBy: profileStore.activeProfile.id,
tenant: profileStore.currentTenant
}