Reactivated Phases

This commit is contained in:
2024-08-29 20:43:15 +02:00
parent 60a860d9b5
commit 133fd1d892

View File

@@ -3,7 +3,6 @@ import dayjs from "dayjs";
import HistoryDisplay from "~/components/HistoryDisplay.vue"; import HistoryDisplay from "~/components/HistoryDisplay.vue";
import DocumentUpload from "~/components/DocumentUpload.vue"; import DocumentUpload from "~/components/DocumentUpload.vue";
import DocumentList from "~/components/DocumentList.vue"; import DocumentList from "~/components/DocumentList.vue";
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
@@ -101,6 +100,8 @@ const itemInfo = ref({
}) })
const oldItemInfo = ref({}) const oldItemInfo = ref({})
const tags = dataStore.getDocumentTags const tags = dataStore.getDocumentTags
const phasesTemplates = ref([])
const phasesTemplateSelected = ref(null)
//Functions //Functions
@@ -122,6 +123,13 @@ const setupPage = async() => {
} }
} }
if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value)) if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
phasesTemplates.value = await useSupabaseSelect("phasesTemplates","*","created_at")
if(phasesTemplates.value.length > 0) {
phasesTemplateSelected.value = phasesTemplates.value[0].id
}
} }
setupPage() setupPage()
@@ -167,7 +175,6 @@ const projectHours = () => {
label: 'Abgeschlossen', label: 'Abgeschlossen',
icon: 'i-heroicons-check' icon: 'i-heroicons-check'
}])*/ }])*/
//const phasesTemplateSelected = ref(dataStore.phasesTemplates[0].id)
const changeActivePhase = async (phase) => { const changeActivePhase = async (phase) => {
itemInfo.value = await useSupabaseSelectSingle("projects",route.params.id,'*') itemInfo.value = await useSupabaseSelectSingle("projects",route.params.id,'*')
@@ -187,12 +194,10 @@ const savePhases = () => {
dataStore.updateItem("projects", itemInfo.value) dataStore.updateItem("projects", itemInfo.value)
} }
/*
const loadPhases = async () => { const loadPhases = async () => {
itemInfo.value.phases = dataStore.phasesTemplates.find(i => i.id === phasesTemplateSelected.value).initialPhases itemInfo.value.phases = dataStore.phasesTemplates.find(i => i.id === phasesTemplateSelected.value).initialPhases
await dataStore.updateItem("projects", itemInfo.value) await dataStore.updateItem("projects", {...itemInfo.value, customer: itemInfo.value.customer ? itemInfo.value.customer.id : null, plant: itemInfo.value.plant ? itemInfo.value.plant.id : null})
} }
*/
</script> </script>
@@ -257,7 +262,7 @@ const loadPhases = async () => {
<div class="text-wrap"> <div class="text-wrap">
<p>Kunde: <nuxt-link :to="`/customers/show/${itemInfo.customer.id}`">{{itemInfo.customer.name}}</nuxt-link></p> <p>Kunde: <nuxt-link :to="`/customers/show/${itemInfo.customer.id}`">{{itemInfo.customer.name}}</nuxt-link></p>
<p>Objekt: <nuxt-link :to="`/plants/show/${itemInfo.plant.id}`">{{itemInfo.plant ? itemInfo.plant.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> <p class="">Notizen: {{itemInfo.notes}}</p>
</div> </div>
@@ -283,9 +288,9 @@ const loadPhases = async () => {
label="Vorlage laden" label="Vorlage laden"
v-if="itemInfo.phases.length === 0" v-if="itemInfo.phases.length === 0"
> >
<!-- <InputGroup> <InputGroup>
<USelectMenu <USelectMenu
:options="dataStore.phasesTemplates" :options="phasesTemplates"
option-attribute="name" option-attribute="name"
value-attribute="id" value-attribute="id"
v-model="phasesTemplateSelected" v-model="phasesTemplateSelected"
@@ -298,7 +303,7 @@ const loadPhases = async () => {
> >
Vorlage laden Vorlage laden
</UButton> </UButton>
</InputGroup> TODO: Reactivate--> </InputGroup>
</UFormGroup> </UFormGroup>
@@ -341,7 +346,7 @@ const loadPhases = async () => {
</template> </template>
</UAccordion> </UAccordion>
</div> </div>
<div v-if="item.key === 'tasks'" class="space-y-3"> <!--<div v-if="item.key === 'tasks'" class="space-y-3">
<Toolbar> <Toolbar>
<UButton <UButton
@click="router.push(`/tasks/create?project=${itemInfo.id}`)" @click="router.push(`/tasks/create?project=${itemInfo.id}`)"
@@ -414,12 +419,11 @@ const loadPhases = async () => {
</UTable> </UTable>
<DocumentList :documents="dataStore.getDocumentsByProjectId(itemInfo.id)"/> <DocumentList :documents="dataStore.getDocumentsByProjectId(itemInfo.id)"/>
<!-- &lt;!&ndash;
{{dataStore.getDocumentsByProjectId(itemInfo.id)}} {{dataStore.getDocumentsByProjectId(itemInfo.id)}}
--> &ndash;&gt;
</div> </div>
<div v-else-if="item.key === 'timetracking'" class="space-y-3"> <div v-else-if="item.key === 'timetracking'" class="space-y-3">
Projekt Zeit: {{String(projectHours()).replace(".",",")}} Stunden Projekt Zeit: {{String(projectHours()).replace(".",",")}} Stunden
<UTable <UTable
@@ -471,7 +475,7 @@ const loadPhases = async () => {
<div v-else-if="item.key === 'material'" class="space-y-3"> <div v-else-if="item.key === 'material'" class="space-y-3">
Auf das Projekt gebuchte Artikel: Auf das Projekt gebuchte Artikel:
<!-- <UTable &lt;!&ndash; <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}`)"
@@ -483,9 +487,9 @@ const loadPhases = async () => {
{{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>--> </UTable>&ndash;&gt;
</div> </div>-->
</UCard> </UCard>
</template> </template>