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

@@ -269,7 +269,6 @@ const downloadSelected = async () => {
<div v-if="!loadingDocs"> <div v-if="!loadingDocs">
<DocumentList <DocumentList
v-if="filteredDocuments.length > 0" v-if="filteredDocuments.length > 0"
:documents="filteredDocuments" :documents="filteredDocuments"

View File

@@ -20,37 +20,46 @@ const emailAccounts = ref([])
const preloadedContent = ref("") const preloadedContent = ref("")
const loadedDocuments = ref([]) const loadedDocuments = ref([])
const loaded = ref(false) const loaded = ref(false)
const noAccountsPresent = ref(false)
const setupPage = async () => { const setupPage = async () => {
emailAccounts.value = await useSupabaseSelect("emailAccounts") emailAccounts.value = await useSupabaseSelect("emailAccounts")
emailData.value.account = emailAccounts.value[0].id
preloadedContent.value = `<p></p><p></p><p></p>${dataStore.activeProfile.emailSignature}` if(emailAccounts.value.length === 0) {
noAccountsPresent.value = true
} else {
emailData.value.account = emailAccounts.value[0].id
//Check Query preloadedContent.value = `<p></p><p></p><p></p>${dataStore.activeProfile.emailSignature}`
if(route.query.to) emailData.value.to = route.query.to
if(route.query.cc) emailData.value.cc = route.query.cc //Check Query
if(route.query.bcc) emailData.value.bcc = route.query.bcc if(route.query.to) emailData.value.to = route.query.to
if(route.query.subject) emailData.value.to = route.query.subject if(route.query.cc) emailData.value.cc = route.query.cc
if(route.query.bcc) emailData.value.bcc = route.query.bcc
if(route.query.subject) emailData.value.to = route.query.subject
if(route.query.loadDocuments) { if(route.query.loadDocuments) {
//console.log(JSON.parse(route.query.loadDocuments)) //console.log(JSON.parse(route.query.loadDocuments))
const {data,error} = await supabase.from("documents").select('*, createdDocument(id,documentNumber,title,contact(email))').in('id',JSON.parse(route.query.loadDocuments)) const {data,error} = await supabase.from("documents").select('*, createdDocument(id,documentNumber,title,contact(email))').in('id',JSON.parse(route.query.loadDocuments))
if(error) console.log(error) if(error) console.log(error)
if(data) loadedDocuments.value = data if(data) loadedDocuments.value = data
//console.log(loadedDocuments.value) //console.log(loadedDocuments.value)
if(loadedDocuments.value.length > 0) { if(loadedDocuments.value.length > 0) {
emailData.value.subject = loadedDocuments.value[0].createdDocument.title emailData.value.subject = loadedDocuments.value[0].createdDocument.title
emailData.value.to = loadedDocuments.value[0].createdDocument.contact ? loadedDocuments.value[0].createdDocument.contact.email : "" emailData.value.to = loadedDocuments.value[0].createdDocument.contact ? loadedDocuments.value[0].createdDocument.contact.email : ""
}
} }
loaded.value = true
} }
loaded.value = true
} }
@@ -142,98 +151,112 @@ const sendEmail = async () => {
</script> </script>
<template> <template>
<UProgress animation="carousel" v-if="!loaded" class="mt-5 w-2/3 mx-auto"/>
<div v-else> <div v-if="noAccountsPresent" class="mx-auto mt-5 flex flex-col justify-center">
<UDashboardNavbar <span class="font-bold text-2xl">Keine E-Mail Konten vorhanden</span>
title="Neue E-Mail" <UButton
@click="router.push(`/settings/emailAccounts`)"
class="mx-auto mt-5"
> >
<template #right> + E-Mail Konto
<UButton </UButton>
@click="sendEmail"
:disabled="!emailData.to || !emailData.subject"
>
Senden
</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<div class="flex-col flex w-full">
<UFormGroup
label="Absender"
>
<USelectMenu
:options="emailAccounts"
option-attribute="emailAddress"
value-attribute="id"
v-model="emailData.account"
/>
</UFormGroup>
<UInput
class="w-full my-1"
placeholder="Empfänger"
variant="ghost"
v-model="emailData.to"
/>
<UInput
class="w-full my-1"
placeholder="Kopie"
variant="ghost"
v-model="emailData.cc"
/>
<UInput
class="w-full my-1"
placeholder="Blindkopie"
variant="ghost"
v-model="emailData.bcc"
/>
<UInput
placeholder="Betreff"
class="w-full my-1"
variant="ghost"
v-model="emailData.subject"
/>
</div>
</UDashboardToolbar>
<UDashboardPanelContent>
<div id="parentAttachments" class="flex flex-col justify-center">
<span class="font-medium mb-2 text-xl">Anhänge</span>
<!-- <UIcon
name="i-heroicons-paper-clip"
class="mx-auto w-10 h-10"
/>
<span class="text-center text-2xl">Anhänge hochladen</span>-->
<input
id="inputAttachments"
type="file"
multiple
@change="renderAttachments"
/>
<ul class="mx-5 mt-3">
<li
class="list-disc"
v-for="file in selectedAttachments"
> Datei - {{file.filename}}</li>
<li
class="list-disc"
v-for="doc in loadedDocuments"
>
<span v-if="doc.createdDocument">Dokument - {{doc.createdDocument.documentNumber}}</span>
</li>
</ul>
</div>
<Tiptap
@updateContent="contentChanged"
:preloadedContent="preloadedContent"
/>
</UDashboardPanelContent>
</div> </div>
<div v-else>
<UProgress animation="carousel" v-if="!loaded" class="mt-5 w-2/3 mx-auto"/>
<div v-else>
<UDashboardNavbar
title="Neue E-Mail"
>
<template #right>
<UButton
@click="sendEmail"
:disabled="!emailData.to || !emailData.subject"
>
Senden
</UButton>
</template>
</UDashboardNavbar>
<UDashboardToolbar>
<div class="flex-col flex w-full">
<UFormGroup
label="Absender"
>
<USelectMenu
:options="emailAccounts"
option-attribute="emailAddress"
value-attribute="id"
v-model="emailData.account"
/>
</UFormGroup>
<UDivider class="my-3"/>
<UInput
class="w-full my-1"
placeholder="Empfänger"
variant="ghost"
v-model="emailData.to"
/>
<UInput
class="w-full my-1"
placeholder="Kopie"
variant="ghost"
v-model="emailData.cc"
/>
<UInput
class="w-full my-1"
placeholder="Blindkopie"
variant="ghost"
v-model="emailData.bcc"
/>
<UInput
placeholder="Betreff"
class="w-full my-1"
variant="ghost"
v-model="emailData.subject"
/>
</div>
</UDashboardToolbar>
<UDashboardPanelContent>
<div id="parentAttachments" class="flex flex-col justify-center">
<span class="font-medium mb-2 text-xl">Anhänge</span>
<!-- <UIcon
name="i-heroicons-paper-clip"
class="mx-auto w-10 h-10"
/>
<span class="text-center text-2xl">Anhänge hochladen</span>-->
<input
id="inputAttachments"
type="file"
multiple
@change="renderAttachments"
/>
<ul class="mx-5 mt-3">
<li
class="list-disc"
v-for="file in selectedAttachments"
> Datei - {{file.filename}}</li>
<li
class="list-disc"
v-for="doc in loadedDocuments"
>
<span v-if="doc.createdDocument">Dokument - {{doc.createdDocument.documentNumber}}</span>
</li>
</ul>
</div>
<Tiptap
@updateContent="contentChanged"
:preloadedContent="preloadedContent"
/>
</UDashboardPanelContent>
</div>
</div>
</template> </template>

View File

@@ -303,7 +303,6 @@ const setState = async (newState) => {
<template #header> <template #header>
Zeiteintrag {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}} Zeiteintrag {{configTimeMode === 'create' ? "erstellen" : "bearbeiten"}}
</template> </template>
{{itemInfo}}
<UFormGroup <UFormGroup
label="Start:" label="Start:"
> >

View File

@@ -53,6 +53,9 @@
<template #project-data="{row}"> <template #project-data="{row}">
{{row.project ? dataStore.getProjectById(row.project).name: ""}} {{row.project ? dataStore.getProjectById(row.project).name: ""}}
</template> </template>
<template #resources-data="{row}">
{{row.resources ? row.resources.map(i => i.title).join(", ") : ""}}
</template>
</UTable> </UTable>
</template> </template>

View File

@@ -57,15 +57,13 @@
> >
<display-open-balances/> <display-open-balances/>
</UDashboardCard> </UDashboardCard>
</UDashboardPanelContent> </UDashboardPanelContent>
</UDashboardPanel> </UDashboardPanel>
</UDashboardPage> </UDashboardPage>
</template> </template>
<script setup> <script setup>
definePageMeta({ definePageMeta({
middleware: "auth" middleware: "auth"
}) })

View File

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

View File

@@ -93,12 +93,12 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
</UCard> </UCard>
</UModal> </UModal>
<UDashboardNavbar title="E-Mail Accounts"> <UDashboardNavbar title="E-Mail Konten">
<template #right> <template #right>
<UButton <UButton
@click="showEmailAddressModal = true" @click="showEmailAddressModal = true"
> >
+ Account + E-Mail Konto
</UButton> </UButton>
</template> </template>
</UDashboardNavbar> </UDashboardNavbar>
@@ -107,7 +107,7 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
:columns="columns" :columns="columns"
class="w-full" class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }" :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Projekte anzuzeigen' }" :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine E-Mail Konten anzuzeigen' }"
> >
<template #profiles-data="{row}"> <template #profiles-data="{row}">
{{row.profiles.map(i => profiles.find(x => x.id === i).fullName).join(", ")}} {{row.profiles.map(i => profiles.find(x => x.id === i).fullName).join(", ")}}