Some Changes

This commit is contained in:
2024-11-20 21:10:20 +01:00
parent fbf1f78d64
commit 818bfd5b1c

View File

@@ -159,9 +159,12 @@ const createProject = async () => {
}
const changeActivePhase = async (key) => {
console.log(key)
let item = await useSupabaseSelectSingle("projects",itemInfo.value.id,'*')
console.log(key)
let phaseLabel = ""
item.phases = item.phases.map(p => {
if(p.active) p.active = false
@@ -169,15 +172,23 @@ const changeActivePhase = async (key) => {
p.active = true
p.activated_at = dayjs().format()
p.activated_by = dataStore.activeProfile.id
phaseLabel = p.label
}
return p
})
console.log(item.phases)
await dataStore.updateItem("projects", item)
await supabase.from("projects").update({phases: item.phases}).eq("id",item.id)
const {error} = await supabase.from("historyitems").insert({
createdBy: dataStore.activeProfile.id,
tenant: dataStore.currentTenant,
text: `Aktive Phase zu "${phaseLabel}" gewechselt`,
project: item.id
})
console.log(error)
setupPage()
}
@@ -260,10 +271,10 @@ const renderedPhases = computed(() => {
</UButton>
</template>
</UDashboardNavbar>
<UDashboardPanelContent>
<UTabs
:items="tabItems"
v-if="itemInfo.id && mode == 'show'"
class="p-5"
v-model="openTab"
>
<template #item="{ item }">
@@ -505,7 +516,7 @@ const renderedPhases = computed(() => {
</UTabs>
<UForm v-else-if="mode === 'edit' || mode === 'create'" class="p-5" >
<UForm v-else-if="mode === 'edit' || mode === 'create'" >
<UFormGroup
label="Name:"
>
@@ -635,6 +646,8 @@ const renderedPhases = computed(() => {
/>
</UFormGroup>
</UForm>
</UDashboardPanelContent>
</template>