Added Automatic HistoryItems to more DataTypes

This commit is contained in:
2024-04-08 21:04:32 +02:00
parent ca62d492ba
commit 0f7555907b
7 changed files with 205 additions and 60 deletions

View File

@@ -14,6 +14,7 @@ let currentItem = ref(null)
//Working
const mode = ref(route.params.mode || "show")
const itemInfo = ref({})
const oldItemInfo = ref({})
const categories = ["Offen", "In Bearbeitung", "Dringed", "Erledigt"]
//Functions
@@ -30,6 +31,8 @@ const setupPage = () => {
if(query.plant) itemInfo.value.plant = Number(query.plant)
}
if(currentItem.value) oldItemInfo.value = JSON.parse(JSON.stringify(currentItem.value))
}
@@ -54,7 +57,7 @@ setupPage()
<template #right>
<UButton
v-if="mode === 'edit'"
@click="dataStore.updateItem('tasks',itemInfo)"
@click="dataStore.updateItem('tasks',itemInfo,oldItemInfo)"
>
Speichern
</UButton>
@@ -93,11 +96,17 @@ setupPage()
<div class="truncate">
<p>Kategorie: {{currentItem.categorie}}</p>
<p v-if="currentItem.project">Projekt: <nuxt-link :to="`/projects/show/${currentItem.project}`">{{dataStore.getProjectById(currentItem.project).name}}</nuxt-link></p>
<p>Beschreibung: {{currentItem.description}}</p>
<p>Beschreibung: <br><pre v-html="currentItem.description"></pre></p>
</div>
</div>
<!-- TODO: Logbuch Tasks -->
<div v-else-if="item.label === 'Logbuch'">
<HistoryDisplay
type="task"
v-if="currentItem"
:element-id="currentItem.id"
/>
</div>
</UCard>
</template>
</UTabs>
@@ -124,7 +133,7 @@ setupPage()
label="Benutzer:"
>
<USelectMenu
v-model="itemInfo.user"
v-model="itemInfo.profile"
:options="dataStore.profiles"
option-attribute="fullName"
value-attribute="id"
@@ -133,7 +142,7 @@ setupPage()
:search-attributes="['fullName']"
>
<template #label>
{{dataStore.getProfileById(itemInfo.user) ? dataStore.getProfileById(itemInfo.user).fullName : "Kein Benutzer ausgewählt"}}
{{dataStore.getProfileById(itemInfo.profile) ? dataStore.getProfileById(itemInfo.profile).fullName : "Kein Benutzer ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>