Changed to new Layout System
This commit is contained in:
@@ -82,12 +82,6 @@ const itemInfo = ref({
|
||||
customer: 0,
|
||||
users: [user.value.id]
|
||||
})
|
||||
|
||||
const uploadModalOpen = ref(false)
|
||||
const fileUploadFormData = ref({
|
||||
tags: ["Dokument"],
|
||||
project: null
|
||||
})
|
||||
const tags = dataStore.getDocumentTags
|
||||
|
||||
|
||||
@@ -109,13 +103,6 @@ const setupPage = () => {
|
||||
itemInfo.value.customer = dataStore.getPlantById(itemInfo.value.plant).customer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const editItem = async () => {
|
||||
router.push(`/projects/edit/${currentItem.value.id}`)
|
||||
setupPage()
|
||||
}
|
||||
|
||||
const cancelEditorCreate = () => {
|
||||
@@ -126,32 +113,6 @@ const cancelEditorCreate = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const updateItem = async () => {
|
||||
const {error} = await supabase
|
||||
.from("projects")
|
||||
.update(itemInfo.value)
|
||||
.eq('id',itemInfo.value.id)
|
||||
|
||||
if(error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
|
||||
router.push(`/projects/show/${currentItem.value.id}`)
|
||||
toast.add({title: "Projekt erfolgreich gespeichert"})
|
||||
dataStore.fetchProjects()
|
||||
}
|
||||
|
||||
const uploadFiles = async () => {
|
||||
//uploadInProgress.value = true;
|
||||
|
||||
await dataStore.uploadFiles({...fileUploadFormData.value, project: currentItem.value.id}, document.getElementById("fileUploadInput").files)
|
||||
|
||||
uploadModalOpen.value = false;
|
||||
//uploadInProgress.value = false;
|
||||
}
|
||||
|
||||
|
||||
const projectHours = () => {
|
||||
let hours = 0
|
||||
dataStore.getTimesByProjectId(currentItem.value.id).forEach(item => {
|
||||
@@ -212,21 +173,45 @@ setupPage()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1
|
||||
class="mb-3 truncate font-bold text-2xl"
|
||||
v-if="currentItem "
|
||||
>Projekt: {{currentItem.name}}</h1>
|
||||
<UTabs :items="tabItems" class="w-full" v-if="currentItem && mode == 'show'">
|
||||
<UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Projekt erstellen' : 'Projekt bearbeiten')">
|
||||
<template #right>
|
||||
<UButton
|
||||
v-if="mode === 'edit'"
|
||||
@click="dataStore.updateItem('projects',itemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
<UButton
|
||||
v-else-if="mode === 'create'"
|
||||
@click="dataStore.createNewItem('projects',itemInfo)"
|
||||
>
|
||||
Erstellen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="cancelEditorCreate"
|
||||
color="red"
|
||||
class="ml-2"
|
||||
v-if="mode === 'edit' || mode === 'create'"
|
||||
>
|
||||
Abbrechen
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="mode === 'show'"
|
||||
@click="router.push(`/projects/edit/${currentItem.id}`)"
|
||||
>
|
||||
Bearbeiten
|
||||
</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
<UTabs
|
||||
:items="tabItems"
|
||||
v-if="currentItem && mode == 'show'"
|
||||
class="p-5"
|
||||
>
|
||||
<template #item="{ item }">
|
||||
<UCard class="mt-5">
|
||||
<div v-if="item.key === 'information'">
|
||||
<Toolbar>
|
||||
<UButton
|
||||
@click="editItem"
|
||||
>
|
||||
Bearbeiten
|
||||
</UButton>
|
||||
</Toolbar>
|
||||
|
||||
|
||||
|
||||
<div class="text-wrap">
|
||||
@@ -391,11 +376,7 @@ setupPage()
|
||||
|
||||
</UTabs>
|
||||
|
||||
<UCard v-else-if="mode === 'edit' || mode === 'create'" >
|
||||
<template #header v-if="mode === 'edit'">
|
||||
{{itemInfo.name}}
|
||||
</template>
|
||||
|
||||
<UForm v-else-if="mode === 'edit' || mode === 'create'" class="p-5" >
|
||||
<UFormGroup
|
||||
label="Name:"
|
||||
>
|
||||
@@ -477,32 +458,7 @@ setupPage()
|
||||
v-model="itemInfo.notes"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<template #footer>
|
||||
<UButton
|
||||
v-if="mode == 'edit'"
|
||||
@click="dataStore.updateItem('projects',itemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
<UButton
|
||||
v-else-if="mode == 'create'"
|
||||
@click="dataStore.createNewItem('projects',itemInfo)"
|
||||
>
|
||||
Erstellen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="cancelEditorCreate"
|
||||
color="red"
|
||||
class="ml-2"
|
||||
>
|
||||
Abbrechen
|
||||
</UButton>
|
||||
</template>
|
||||
|
||||
</UCard>
|
||||
|
||||
|
||||
</UForm>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user