Added HistoryDisplay.vue to Projects and Plants

Visual Restructure in Plants
This commit is contained in:
2024-01-12 18:38:26 +01:00
parent 291b0350e8
commit 05130052af
5 changed files with 81 additions and 29 deletions

View File

@@ -23,9 +23,13 @@ const historyItems = computed(() => {
let items = []
if(type === "customer") {
items = dataStore.getHistoryItemsByCustomer(elementId)
items = dataStore.historyItems.filter(i => i.customer === elementId)
} else if(type === "vendor") {
items = dataStore.getHistoryItemsByVendor(elementId)
items = dataStore.historyItems.filter(i => i.vendor === elementId)
} else if(type === "project") {
items = dataStore.historyItems.filter(i => i.project === elementId)
} else if(type === "plant") {
items = dataStore.historyItems.filter(i => i.plant === elementId)
}
return items.reverse()
@@ -41,6 +45,12 @@ const addHistoryItem = async () => {
if(type === "customer") {
addHistoryItemData.value.customer = elementId
} else if(type === "vendor") {
addHistoryItemData.value.vendor = elementId
} else if(type === "project") {
addHistoryItemData.value.project = elementId
} else if(type === "plant") {
addHistoryItemData.value.plant = elementId
}

View File

@@ -1,4 +1,6 @@
<script setup>
import HistoryDisplay from "~/components/HistoryDisplay.vue";
definePageMeta({
middleware: "auth"
})
@@ -14,11 +16,17 @@ let currentItem = null
//Working
const mode = ref(route.params.mode || "show")
const itemInfo = ref({
name: "",
customer: 0,
const itemInfo = ref({})
})
const tabItems = [
{
label: "Informationen"
},{
label: "Projekte"
},{
label: "Aufgaben"
}
]
//Functions
const setupPage = () => {
@@ -88,20 +96,47 @@ setupPage()
</script>
<template>
<UCard v-if="currentItem && mode == 'show'" class="h-full">
<UCard v-if="currentItem && mode == 'show'">
<template #header>
{{currentItem.name}}
</template>
<InputGroup>
<UButton
@click="router.push(`/projects/create?plant=${currentItem.id}`)"
>
+ Projekt
</UButton>
</InputGroup>
<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>
</template>
</UTabs>
{{currentItem}}
<template #footer>
<UButton
@@ -123,7 +158,7 @@ setupPage()
</UCard>
<UCard v-else-if="mode === 'edit' || mode === 'create'" class="h-full">
<UCard v-else-if="mode === 'edit' || mode === 'create'">
<template #header v-if="mode === 'edit'">
{{itemInfo.name}}
</template>
@@ -178,6 +213,12 @@ setupPage()
</template>
</UCard>
<HistoryDisplay
type="plant"
v-if="currentItem"
:element-id="currentItem.id"
/>
</template>
<style scoped>

View File

@@ -1,5 +1,6 @@
<script setup>
import dayjs from "dayjs";
import HistoryDisplay from "~/components/HistoryDisplay.vue";
definePageMeta({
middleware: "auth"
@@ -536,6 +537,12 @@ setupPage()
</template>
</UCard>
<HistoryDisplay
type="project"
v-if="currentItem"
:element-id="currentItem.id"
/>
</template>
<style scoped>

View File

@@ -14,11 +14,7 @@ let currentItem = null
//Working
const mode = ref(route.params.mode || "show")
const itemInfo = ref({
title: "",
customer: 0,
})
const itemInfo = ref({})
const categories = ["Offen", "In Bearbeitung", "Dringed", "Erledigt"]
//Functions

View File

@@ -265,14 +265,12 @@ export const useDataStore = defineStore('data', () => {
return tasks.value.filter(item => item.project === projectId)
})
const getHistoryItemsByCustomer = computed(() => (customerId:string) => {
return historyItems.value.filter(item => item.customer === customerId)
const getTasksByPlantId = computed(() => (plantId:string) => {
return tasks.value.filter(item => item.plant === plantId)
})
const getHistoryItemsByVendor = computed(() => (vendorId:string) => {
return historyItems.value.filter(item => item.vendor === vendorId)
const getProjectsByPlantId = computed(() => (plantId:string) => {
return projects.value.filter(item => item.plant === plantId)
})
const getIncomingInvoicesByVehicleId = computed(() => (vehicleId:string) => {
@@ -519,10 +517,10 @@ export const useDataStore = defineStore('data', () => {
getDocumentsByProjectId,
getTimesByProjectId,
getTasksByProjectId,
getTasksByPlantId,
getProjectsByPlantId,
getMovementsBySpaceId,
getStockByProductId,
getHistoryItemsByCustomer,
getHistoryItemsByVendor,
getIncomingInvoicesByVehicleId,
getEventTypes,
getTimeTypes,