Added Phases to Projects

This commit is contained in:
2024-02-15 22:49:09 +01:00
parent 2fc45b3ea0
commit 1a0b7288df
37 changed files with 2342 additions and 1483 deletions

View File

@@ -2,6 +2,7 @@
import HistoryDisplay from "~/components/HistoryDisplay.vue";
import DocumentList from "~/components/DocumentList.vue";
import DocumentUpload from "~/components/DocumentUpload.vue";
import Toolbar from "~/components/Toolbar.vue";
definePageMeta({
middleware: "auth"
@@ -15,7 +16,7 @@ const toast = useToast()
const id = ref(route.params.id ? route.params.id : null )
const editor = useEditor({
content: "<p>I'm running Tiptap with Vue.js. 🎉</p>",
content: "<p>Hier kann deine Projektdokumentation stehen</p>",
extensions: [TiptapStarterKit],
});
@@ -28,6 +29,8 @@ const itemInfo = ref({})
const tabItems = [
{
label: "Informationen"
},{
label: "Logbuch"
},{
label: "Projekte"
},{
@@ -47,6 +50,11 @@ const setupPage = () => {
if(mode.value === "edit") itemInfo.value = currentItem.value
if(mode.value === "create") {
let query = route.query
if(query.customer) itemInfo.value.customer = Number(query.customer)
}
}
@@ -59,156 +67,178 @@ const editItem = async () => {
}
const cancelEditorCreate = () => {
mode.value = "show"
itemInfo.value = {
id: 0,
infoData: {}
if(currentItem.value) {
router.push(`/plants/show/${currentItem.value.id}`)
} else {
router.push(`/plants`)
}
}
setupPage()
</script>
<template>
<UCard v-if="currentItem && mode == 'show'">
<h1
class="mb-3 truncate font-bold text-2xl"
v-if="currentItem "
>Objekt: {{currentItem.name}}</h1>
<div v-if="currentItem && mode == 'show'">
<UTabs :items="tabItems">
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton
v-if="mode == 'show' && currentItem.id"
@click="editItem"
>
Bearbeiten
</UButton>
</Toolbar>
<div class="text-wrap">
<p>Kunde: <nuxt-link :to="`/customers/show/${currentItem.customer}`">{{dataStore.getCustomerById(currentItem.customer).name}}</nuxt-link></p>
</div>
</div>
<div v-else-if="item.label === 'Logbuch'">
<HistoryDisplay
type="plant"
v-if="currentItem"
:element-id="currentItem.id"
/>
</div>
<div v-else-if="item.label === 'Projekte'">
<Toolbar>
<UButton
@click="router.push(`/projects/create?plant=${currentItem.id}`)"
>
+ Projekt
</UButton>
</Toolbar>
<UTable
:rows="dataStore.getProjectsByPlantId(currentItem.id)"
:columns="[{key: 'name', label: 'Name'}]"
@select="(row) => router.push(`/projects/show/${row.id}`)"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Projekte' }"
>
</UTable>
</div>
<div v-else-if="item.label === 'Aufgaben'">
<Toolbar>
<UButton
@click="router.push(`/tasks/create?plant=${currentItem.id}`)"
>
+ Aufgabe
</UButton>
</Toolbar>
<UTable
:rows="dataStore.getTasksByPlantId(currentItem.id)"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Aufgaben' }"
:columns="[{key: 'name', label: 'Name'},{key: 'categore', label: 'Kategorie'}]"
@select="(row) => router.push(`/tasks/show/${row.id}`)"
>
</UTable>
</div>
<div v-else-if="item.label === 'Dokumente'" class="space-y-3">
<Toolbar>
<DocumentUpload
type="plant"
:element-id="currentItem.id"
/>
</Toolbar>
<!-- <UModal
v-model="uploadModalOpen"
>
<UCard class="p-4">
<template #header>
Datei hochladen
</template>
<UFormGroup
label="Datei:"
>
<UInput
type="file"
id="fileUploadInput"
/>
</UFormGroup>
&lt;!&ndash; <UFormGroup
label="Name:"
class="mt-3"
>
<UInput
v-model="fileUploadFormData.name"
/>
</UFormGroup>&ndash;&gt;
<UFormGroup
label="Tags:"
class="mt-3"
>
<USelectMenu
multiple
searchable
searchable-placeholder="Suchen..."
:options="tags"
v-model="fileUploadFormData.tags"
/>
</UFormGroup>
&lt;!&ndash;<UFormGroup
label="Ordner:"
class="mt-3"
>
<USelectMenu
:options="folders"
v-model="fileUploadFormData.folder"
value-attribute="label"
/>
</UFormGroup>&ndash;&gt;
<template #footer>
<UButton
class="mt-3"
@click="uploadFiles"
>Hochladen</UButton>
</template>
</UCard>
</UModal>-->
<DocumentList :documents="dataStore.getDocumentsByPlantId(currentItem.id)"/>
</div>
<div v-if="item.label === 'Dokumentation'">
<Editor/>
</div>
</UCard>
</template>
</UTabs>
</div>
<!-- <UCard v-if="currentItem && mode == 'show'">
<template #header>
{{currentItem.name}}
</template>
<UTabs :items="tabItems">
<template #item="{item}">
<div v-if="item.label === 'Informationen'">
{{currentItem}}
</div>
<div v-else-if="item.label === 'Projekte'">
<InputGroup>
<UButton
@click="router.push(`/projects/create?plant=${currentItem.id}`)"
>
+ Projekt
</UButton>
</InputGroup>
<UTable
:rows="dataStore.getProjectsByPlantId(currentItem.id)"
>
</UTable>
</div>
<div v-else-if="item.label === 'Aufgaben'">
<UTable
:rows="dataStore.getTasksByPlantId(currentItem.id)"
>
</UTable>
</div>
<div v-else-if="item.label === 'Dokumente'" class="space-y-3">
<InputGroup>
<DocumentUpload
type="plant"
:element-id="currentItem.id"
/>
</InputGroup>
<!-- <UModal
v-model="uploadModalOpen"
>
<UCard class="p-4">
<template #header>
Datei hochladen
</template>
<UFormGroup
label="Datei:"
>
<UInput
type="file"
id="fileUploadInput"
/>
</UFormGroup>
&lt;!&ndash; <UFormGroup
label="Name:"
class="mt-3"
>
<UInput
v-model="fileUploadFormData.name"
/>
</UFormGroup>&ndash;&gt;
<UFormGroup
label="Tags:"
class="mt-3"
>
<USelectMenu
multiple
searchable
searchable-placeholder="Suchen..."
:options="tags"
v-model="fileUploadFormData.tags"
/>
</UFormGroup>
&lt;!&ndash;<UFormGroup
label="Ordner:"
class="mt-3"
>
<USelectMenu
:options="folders"
v-model="fileUploadFormData.folder"
value-attribute="label"
/>
</UFormGroup>&ndash;&gt;
<template #footer>
<UButton
class="mt-3"
@click="uploadFiles"
>Hochladen</UButton>
</template>
</UCard>
</UModal>-->
<DocumentList :documents="dataStore.getDocumentsByPlantId(currentItem.id)"/>
</div>
<div v-if="item.label === 'Dokumentation'">
<Editor/>
</div>
</template>
</UTabs>
<template #footer>
<UButton
v-if="mode == 'show' && currentItem.id"
@click="editItem"
>
Bearbeiten
</UButton>
<UButton
color="red"
class="ml-2"
disabled
>
Archivieren
</UButton>
<!-- TODO: Kunde archivieren -->
</template>
</UCard>
</UCard>-->
<UCard v-else-if="mode === 'edit' || mode === 'create'">
<template #header v-if="mode === 'edit'">
{{itemInfo.name}}
@@ -265,11 +295,7 @@ setupPage()
</UCard>
<HistoryDisplay
type="plant"
v-if="currentItem"
:element-id="currentItem.id"
/>
</template>
<style scoped>

View File

@@ -1,15 +1,14 @@
<template>
<div id="main">
<InputGroup>
<UButton @click="router.push(`/plants/create/`)">+ Objekt</UButton>
<UInput
v-model="searchString"
placeholder="Suche..."
/>
</InputGroup>
<Toolbar>
<UButton @click="router.push(`/plants/create/`)">+ Objekt</UButton>
<UInput
v-model="searchString"
placeholder="Suche..."
/>
</Toolbar>
<div class="table">
<UTable
:rows="filteredRows"
:columns="columns"
@@ -20,8 +19,8 @@
{{dataStore.customers.find(customer => customer.id === row.customer) ? dataStore.customers.find(customer => customer.id === row.customer).name : "" }}
</template>
</UTable>
</div>
</template>
<script setup>