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) => { const changeActivePhase = async (key) => {
console.log(key)
let item = await useSupabaseSelectSingle("projects",itemInfo.value.id,'*') let item = await useSupabaseSelectSingle("projects",itemInfo.value.id,'*')
console.log(key)
let phaseLabel = ""
item.phases = item.phases.map(p => { item.phases = item.phases.map(p => {
if(p.active) p.active = false if(p.active) p.active = false
@@ -169,15 +172,23 @@ const changeActivePhase = async (key) => {
p.active = true p.active = true
p.activated_at = dayjs().format() p.activated_at = dayjs().format()
p.activated_by = dataStore.activeProfile.id p.activated_by = dataStore.activeProfile.id
phaseLabel = p.label
} }
return p return p
}) })
console.log(item.phases) 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() setupPage()
} }
@@ -260,10 +271,10 @@ const renderedPhases = computed(() => {
</UButton> </UButton>
</template> </template>
</UDashboardNavbar> </UDashboardNavbar>
<UDashboardPanelContent>
<UTabs <UTabs
:items="tabItems" :items="tabItems"
v-if="itemInfo.id && mode == 'show'" v-if="itemInfo.id && mode == 'show'"
class="p-5"
v-model="openTab" v-model="openTab"
> >
<template #item="{ item }"> <template #item="{ item }">
@@ -505,7 +516,7 @@ const renderedPhases = computed(() => {
</UTabs> </UTabs>
<UForm v-else-if="mode === 'edit' || mode === 'create'" class="p-5" > <UForm v-else-if="mode === 'edit' || mode === 'create'" >
<UFormGroup <UFormGroup
label="Name:" label="Name:"
> >
@@ -635,6 +646,8 @@ const renderedPhases = computed(() => {
/> />
</UFormGroup> </UFormGroup>
</UForm> </UForm>
</UDashboardPanelContent>
</template> </template>