Fix for missing Phases
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 23s
Build and Push Docker Images / build-frontend (push) Successful in 59s

This commit is contained in:
2026-03-25 15:19:33 +01:00
parent c29494dc0d
commit 01b4d0f973
2 changed files with 59 additions and 2 deletions

View File

@@ -240,9 +240,42 @@ const loadOptions = async () => {
}
}
loadOptions()
normalizeLoadedSelectValues()
const initialProjecttype = props.type === "projects" ? item.value.projecttype : null
const lastAppliedProjecttype = ref(null)
const syncProjectPhasesForProjecttype = () => {
if (props.type !== "projects") return
if (!item.value?.projecttype) return
if (!Array.isArray(loadedOptions.value.projecttypes) || !loadedOptions.value.projecttypes.length) return
const projecttypeColumn = dataType.templateColumns.find((column) => column.key === "projecttype")
if (!projecttypeColumn?.inputChangeFunction) return
const shouldSyncOnCreate = props.mode === "create" && lastAppliedProjecttype.value !== item.value.projecttype
const shouldSyncOnEdit = props.mode === "edit"
&& item.value.projecttype !== initialProjecttype
&& lastAppliedProjecttype.value !== item.value.projecttype
if (!shouldSyncOnCreate && !shouldSyncOnEdit) return
projecttypeColumn.inputChangeFunction(item.value, loadedOptions.value)
lastAppliedProjecttype.value = item.value.projecttype
}
loadOptions().then(() => {
syncProjectPhasesForProjecttype()
})
watch(
() => [item.value?.projecttype, loadedOptions.value.projecttypes?.length || 0],
() => {
syncProjectPhasesForProjecttype()
},
{ immediate: true }
)
const contentChanged = (content, datapoint) => {
if (datapoint.key.includes(".")) {
item.value[datapoint.key.split('.')[0]][datapoint.key.split('.')[1]].html = content.html
@@ -274,6 +307,9 @@ const getSelectSearchInput = (datapoint) => {
const triggerInputChange = (datapoint) => {
if (datapoint.inputChangeFunction) {
datapoint.inputChangeFunction(item.value, loadedOptions.value)
if (datapoint.key === "projecttype") {
lastAppliedProjecttype.value = item.value.projecttype
}
}
}

View File

@@ -1443,7 +1443,28 @@ export const useDataStore = defineStore('data', () => {
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
inputChangeFunction: function (item,loadedOptions = {}) {
item.phases = loadedOptions.projecttypes.find(i => i.id === item.projecttype).initialPhases
const selectedProjectType = loadedOptions.projecttypes?.find(i => i.id === item.projecttype)
if (!selectedProjectType || !Array.isArray(selectedProjectType.initialPhases)) {
item.phases = []
item.active_phase = null
return
}
const phases = selectedProjectType.initialPhases.map((phase, index) => ({
key: phase?.key || crypto.randomUUID(),
icon: phase?.icon || '',
label: phase?.label || '',
optional: Boolean(phase?.optional),
description: phase?.description || '',
quickactions: Array.isArray(phase?.quickactions) ? phase.quickactions.map((quickaction) => ({
...quickaction
})) : [],
active: index === 0
}))
item.phases = phases
item.active_phase = phases.find(i => i.active)?.label || null
},
sortable: true
},{