45 lines
933 B
Vue
45 lines
933 B
Vue
<template>
|
|
<EntityList
|
|
type="projects"
|
|
:items="items"
|
|
></EntityList>
|
|
</template>
|
|
|
|
<script setup>
|
|
import EntityList from "~/components/EntityList.vue";
|
|
|
|
definePageMeta({
|
|
middleware: "auth"
|
|
})
|
|
|
|
const items = ref([])
|
|
|
|
const setupPage = async () => {
|
|
let profiles = (await useSupabaseSelect("profiles"))
|
|
items.value = (await useSupabaseSelect("projects","*, customer (name), plant(name), projecttype(name, id)","projectNumber")).map(project => {
|
|
return {
|
|
...project,
|
|
//profiles: project.profiles.map(x => profiles.find(z => z.id === x).fullName).join(", "),
|
|
phase: getActivePhaseLabel(project)
|
|
}
|
|
})
|
|
}
|
|
|
|
const getActivePhaseLabel = (item) => {
|
|
if(item.phases) {
|
|
if(item.phases.length > 0) {
|
|
|
|
let activePhase = item.phases.find(i => i.active)
|
|
|
|
if(activePhase) {
|
|
return activePhase.label
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
setupPage()
|
|
|
|
</script> |