This commit is contained in:
2024-10-08 13:08:13 +02:00
parent 856628bce6
commit 16932ad71c
7 changed files with 161 additions and 116 deletions

View File

@@ -99,9 +99,16 @@ const tags = dataStore.getDocumentTags
const phasesTemplates = ref([])
const phasesTemplateSelected = ref(null)
const plants = ref([])
const contracts = ref([])
//Functions
const setupPage = async() => {
plants.value = await useSupabaseSelect("plants")
contracts.value = await useSupabaseSelect("contracts")
if(mode.value === "show" ){
itemInfo.value = await useSupabaseSelectSingle("projects",route.params.id,"*, customer(*), plant(*)")
} else if (mode.value === "edit") {
@@ -562,14 +569,30 @@ const loadPhases = async () => {
>
<USelectMenu
v-model="itemInfo.plant"
:options="dataStore.plants"
:options="plants"
option-attribute="name"
value-attribute="id"
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.getPlantById(itemInfo.plant) ? dataStore.getPlantById(itemInfo.plant).name : "Objekt auswählen"}}
{{plants.find(i => i.id === itemInfo.plant) ? plants.find(i => i.id === itemInfo.plant).name : "Objekt auswählen"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Vertrag:"
>
<USelectMenu
v-model="itemInfo.contract"
:options="contracts"
option-attribute="name"
value-attribute="id"
searchable
:search-attributes="['name']"
>
<template #label>
{{contracts.find(i => i.id === itemInfo.contract) ? contracts.find(i => i.id === itemInfo.contract).name : "Vertrag auswählen"}}
</template>
</USelectMenu>
</UFormGroup>