Standard BCC in E-Mail
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user