Restructuring in Project Page

Added Project Number
This commit is contained in:
2024-08-29 22:31:34 +02:00
parent 133fd1d892
commit 26f8d8f710
3 changed files with 115 additions and 88 deletions

View File

@@ -39,10 +39,6 @@ const tabItems = [
key: "information", key: "information",
label: "Informationen" label: "Informationen"
}, },
{
key: "historyDisplay",
label: "Logbuch"
},
{ {
key: "phases", key: "phases",
label: "Phasen" label: "Phasen"
@@ -255,35 +251,42 @@ const loadPhases = async () => {
v-model="openTab" v-model="openTab"
> >
<template #item="{ item }"> <template #item="{ item }">
<UCard class="mt-5"> <div v-if="item.key === 'information'" class="flex flex-row">
<div v-if="item.key === 'information'"> <div class="w-1/2 mr-3">
<UCard class="mt-5">
<div class="text-wrap">
<p>Kunde: <nuxt-link :to="`/customers/show/${itemInfo.customer.id}`">{{itemInfo.customer.name}}</nuxt-link></p>
<p>Objekt: <nuxt-link v-if="itemInfo.plant" :to="`/plants/show/${itemInfo.plant.id}`">{{itemInfo.plant ? itemInfo.plant.name : ""}}</nuxt-link><span v-else>-</span></p>
<p class="">Notizen: {{itemInfo.notes}}</p>
</div>
</UCard>
<UCard class="mt-3">
<h1 class="font-bold text-lg mb-3">Beteiligte Benutzer:</h1>
<UAlert
v-for="projectUser in itemInfo.users"
:avatar="{ alt: dataStore.getProfileById(projectUser).fullName }"
:title="dataStore.getProfileById(projectUser).fullName"
class="mb-3"
/>
</UCard>
<div class="text-wrap">
<p>Kunde: <nuxt-link :to="`/customers/show/${itemInfo.customer.id}`">{{itemInfo.customer.name}}</nuxt-link></p>
<p>Objekt: <nuxt-link v-if="itemInfo.plant" :to="`/plants/show/${itemInfo.plant.id}`">{{itemInfo.plant ? itemInfo.plant.name : ""}}</nuxt-link><span v-else>-</span></p>
<p class="">Notizen: {{itemInfo.notes}}</p>
</div>
<UDivider class="my-3"/>
<h1 class="font-bold text-lg my-3">Beteiligte Benutzer:</h1>
<UAlert
v-for="projectUser in itemInfo.users"
:avatar="{ alt: dataStore.getProfileById(projectUser).fullName }"
:title="dataStore.getProfileById(projectUser).fullName"
class="mb-3"
/>
</div> </div>
<div v-else-if="item.key === 'historyDisplay'"> <div class="w-1/2">
<HistoryDisplay <UCard class="mt-5">
type="project" <HistoryDisplay
v-if="itemInfo" type="project"
:element-id="itemInfo.id" v-if="itemInfo"
/> :element-id="itemInfo.id"
render-headline
/>
</UCard>
</div> </div>
<div v-if="item.key === 'phases'" class="space-y-3">
</div>
<div v-if="item.key === 'phases'" class="space-y-3">
<UCard class="mt-5">
<UFormGroup <UFormGroup
label="Vorlage laden" label="Vorlage laden"
v-if="itemInfo.phases.length === 0" v-if="itemInfo.phases.length === 0"
@@ -312,9 +315,9 @@ const loadPhases = async () => {
> >
<template #default="{item,index,open}"> <template #default="{item,index,open}">
<UButton <UButton
variant="ghost" variant="ghost"
:color="item.active ? 'primary' : 'white'" :color="item.active ? 'primary' : 'white'"
class="mb-1" class="mb-1"
> >
<template #leading> <template #leading>
<div class="w-6 h-6 flex items-center justify-center -my-1"> <div class="w-6 h-6 flex items-center justify-center -my-1">
@@ -345,8 +348,10 @@ const loadPhases = async () => {
</InputGroup> </InputGroup>
</template> </template>
</UAccordion> </UAccordion>
</div> </UCard>
<!--<div v-if="item.key === 'tasks'" class="space-y-3"> </div>
<div v-if="item.key === 'tasks'" class="space-y-3">
<UCard class="mt-5">
<Toolbar> <Toolbar>
<UButton <UButton
@click="router.push(`/tasks/create?project=${itemInfo.id}`)" @click="router.push(`/tasks/create?project=${itemInfo.id}`)"
@@ -366,29 +371,28 @@ const loadPhases = async () => {
{{dataStore.profiles.find(i => i.id === row.user) ? dataStore.profiles.find(i => i.id === row.user).fullName : ""}} {{dataStore.profiles.find(i => i.id === row.user) ? dataStore.profiles.find(i => i.id === row.user).fullName : ""}}
</template> </template>
</UTable> </UTable>
</UCard>
</div>
<div v-else-if="item.key === 'documents'" class="space-y-3">
</div>
<div v-else-if="item.key === 'documents'" class="space-y-3">
<UCard class="mt-5">
<Toolbar> <Toolbar>
<DocumentUpload <DocumentUpload
type="project" type="project"
:element-id="itemInfo.id" :element-id="itemInfo.id"
/> />
<UButton <UButton
@click="router.push(`/createDocument/edit?project=${itemInfo.id}&type=quotes&customer=${itemInfo.customer.id}`)" @click="router.push(`/createDocument/edit?project=${itemInfo.id}&customer=${itemInfo.customer.id}`)"
> >
+ Angebot + Dokument
</UButton>
<UButton
@click="router.push(`/createDocument/edit?project=${itemInfo.id}&type=invoices&customer=${itemInfo.customer.id}`)"
>
+ Rechnung
</UButton> </UButton>
</Toolbar> </Toolbar>
<UTable <UTable
:rows="dataStore.getCreatedDocumentsByProject(itemInfo.id)" :rows="dataStore.getCreatedDocumentsByProject(itemInfo.id)"
:columns="[ :columns="[
{ {
label: 'Typ', label: 'Typ',
key: 'type' key: 'type'
@@ -404,8 +408,8 @@ const loadPhases = async () => {
} }
]" ]"
@select="(row) => row.state === 'Entwurf' ? router.push(`/createDocument/edit/${row.id}`) : router.push(`/createDocument/show/${row.id}`)" @select="(row) => row.state === 'Entwurf' ? router.push(`/createDocument/edit/${row.id}`) : router.push(`/createDocument/show/${row.id}`)"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen erstellten Dokumente' }" :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen erstellten Dokumente' }"
> >
<template #type-data="{row}"> <template #type-data="{row}">
@@ -419,12 +423,14 @@ const loadPhases = async () => {
</UTable> </UTable>
<DocumentList :documents="dataStore.getDocumentsByProjectId(itemInfo.id)"/> <DocumentList :documents="dataStore.getDocumentsByProjectId(itemInfo.id)"/>
&lt;!&ndash; </UCard>
{{dataStore.getDocumentsByProjectId(itemInfo.id)}}
&ndash;&gt;
</div>
<div v-else-if="item.key === 'timetracking'" class="space-y-3">
</div>
<div v-else-if="item.key === 'timetracking'" class="space-y-3">
<UCard class="mt-5">
Projekt Zeit: {{String(projectHours()).replace(".",",")}} Stunden Projekt Zeit: {{String(projectHours()).replace(".",",")}} Stunden
<UTable <UTable
:rows="dataStore.getTimesByProjectId(itemInfo.id)" :rows="dataStore.getTimesByProjectId(itemInfo.id)"
@@ -445,52 +451,57 @@ const loadPhases = async () => {
</template> </template>
</UTable> </UTable>
</div> </UCard>
<div v-else-if="item.key === 'events'" class="space-y-3">
</div>
<div v-else-if="item.key === 'events'" class="space-y-3">
<UCard class="mt-5">
<Toolbar> <Toolbar>
<UButton <UButton
@click="router.push(`/events/edit`)" @click="router.push(`/events/edit`)"
> >
+ Termin + Termin
</UButton> </UButton>
</Toolbar> </Toolbar>
<UTable <UTable
:rows="dataStore.getEventsByProjectId(itemInfo.id)" :rows="dataStore.getEventsByProjectId(itemInfo.id)"
@select="(i) => router.push(`/events/show/${i.id}`)" @select="(i) => router.push(`/events/show/${i.id}`)"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Termine anzuzeigen' }" :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Termine anzuzeigen' }"
:columns="[{key:'title',label:'Titel'},{key:'start',label:'Start'},{key:'end',label:'Ende'},{key:'type',label:'Typ'},{key:'resources',label:'Resourcen'}]" :columns="[{key:'title',label:'Titel'},{key:'start',label:'Start'},{key:'end',label:'Ende'},{key:'type',label:'Typ'},{key:'resources',label:'Resourcen'}]"
> >
<template #start-data="{row}"> <template #start-data="{row}">
{{dayjs(row.start).format("DD.MM.YY HH:mm")}} {{dayjs(row.start).format("DD.MM.YY HH:mm")}}
</template> </template>
<template #end-data="{row}"> <template #end-data="{row}">
{{dayjs(row.end).format("DD.MM.YY HH:mm")}} {{dayjs(row.end).format("DD.MM.YY HH:mm")}}
</template> </template>
<template #resources-data="{row}"> <template #resources-data="{row}">
{{row.resources.map(i => i.title).join(", ")}} {{row.resources.map(i => i.title).join(", ")}}
</template> </template>
</UTable> </UTable>
</UCard>
</div> </div>
<div v-else-if="item.key === 'material'" class="space-y-3"> <div v-else-if="item.key === 'material'" class="space-y-3">
<UCard class="mt-5">
Auf das Projekt gebuchte Artikel: Auf das Projekt gebuchte Artikel:
&lt;!&ndash; <UTable <!-- <UTable
:rows="dataStore.getStocksByProjectId(itemInfo.id)" :rows="dataStore.getStocksByProjectId(itemInfo.id)"
:columns="[{key:'productId',label:'Artikel'},{key:'stock',label:'Anzahl'}]" :columns="[{key:'productId',label:'Artikel'},{key:'stock',label:'Anzahl'}]"
@select="(i) => router.push(`/products/show/${i.productId}`)" @select="(i) => router.push(`/products/show/${i.productId}`)"
> >
<template #productId-data="{row}"> <template #productId-data="{row}">
{{dataStore.getProductById(row.productId).name}} {{dataStore.getProductById(row.productId).name}}
</template> </template>
<template #stock-data="{row}"> <template #stock-data="{row}">
{{dataStore.getProductById(row.productId)}} {{dataStore.getProductById(row.productId)}}
{{row.stock}} {{dataStore.units.find(i => i.id === dataStore.getProductById(row.productId).unit).short}} {{row.stock}} {{dataStore.units.find(i => i.id === dataStore.getProductById(row.productId).unit).short}}
</template> </template>
</UTable>&ndash;&gt; </UTable>-->
</UCard>
</div>
</div>-->
</UCard>
</template> </template>
@@ -505,6 +516,15 @@ const loadPhases = async () => {
/> />
</UFormGroup> </UFormGroup>
<UFormGroup
label="Projektnummer:"
>
<UInput
v-model="itemInfo.projectNumber"
placeholder="Leer lassen für automatisch generierte Nummer"
/>
</UFormGroup>
<UFormGroup <UFormGroup
label="Kundennummer:" label="Kundennummer:"
> >

View File

@@ -119,12 +119,16 @@ const items = ref([])
const selectedItem = ref(0) const selectedItem = ref(0)
const setupPage = async () => { const setupPage = async () => {
items.value = await useSupabaseSelect("projects","*, customer (name), plant(name)") items.value = await useSupabaseSelect("projects","*, customer (name), plant(name)","projectNumber")
} }
setupPage() setupPage()
const templateColumns = [ const templateColumns = [
{
key: "projectNumber",
label: "Projektnummer"
},
{ {
key: "phase", key: "phase",
label: "Phase" label: "Phase"

View File

@@ -29,6 +29,9 @@ const resources = {
}, },
inventoryitems: { inventoryitems: {
label: "Inventarartikel" label: "Inventarartikel"
},
projects: {
label: "Projekte"
} }
} }