Standard BCC in E-Mail

This commit is contained in:
2024-10-01 13:48:52 +02:00
parent 42bfb2d8eb
commit 0f92dbe61c
2 changed files with 22 additions and 8 deletions

View File

@@ -17,15 +17,29 @@ const router = useRouter()
const itemInfo = ref({})
const linkedDocument =ref({})
const currentTenant = ref({})
const setupPage = async () => {
if(route.params) {
if(route.params.id) itemInfo.value = await useSupabaseSelectSingle("createddocuments",route.params.id,"*")
linkedDocument.value = (await supabase.from("documents").select("id").eq("createdDocument", route.params.id).single()).data
const {data,error} = await supabase.from("documents").select("id").eq("createdDocument", route.params.id).order("id",{ascending:true})
linkedDocument.value = data[data.length -1]
}
currentTenant.value = (await supabase.from("tenants").select().eq("id",dataStore.currentTenant).single()).data
console.log(currentTenant.value)
}
setupPage()
const openEmail = () => {
if(["invoices","advanceInvoices"].includes(itemInfo.value.type)){
router.push(`/email/new?loadDocuments=[${linkedDocument.value.id}]&bcc=${encodeURIComponent(currentTenant.value.standardEmailForInvoices)}`)
} else {
router.push(`/email/new?loadDocuments=[${linkedDocument.value.id}]`)
}
}
</script>
<template>
@@ -51,7 +65,7 @@ setupPage()
Übernehmen
</UButton>
<UButton
@click="router.push(`/email/new?loadDocuments=[${linkedDocument.id}]`)"
@click="openEmail"
icon="i-heroicons-envelope"
>
E-Mail