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
|
||||
|
||||
@@ -8,8 +8,8 @@ const toast = useToast()
|
||||
|
||||
const emailData = ref({
|
||||
to:"",
|
||||
cc:"",
|
||||
bcc: "",
|
||||
cc:null,
|
||||
bcc: null,
|
||||
subject: "",
|
||||
html: "",
|
||||
text: "",
|
||||
@@ -28,8 +28,8 @@ const setupPage = async () => {
|
||||
|
||||
//Check Query
|
||||
if(route.query.to) emailData.value.to = route.query.to
|
||||
if(route.query.cc) emailData.value.to = route.query.cc
|
||||
if(route.query.bcc) emailData.value.to = route.query.bcc
|
||||
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
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ const setupPage = async () => {
|
||||
|
||||
if(loadedDocuments.value.length > 0) {
|
||||
emailData.value.subject = loadedDocuments.value[0].createdDocument.title
|
||||
emailData.value.to = loadedDocuments.value[0].createdDocument.contact.email
|
||||
emailData.value.to = loadedDocuments.value[0].createdDocument.contact ? loadedDocuments.value[0].createdDocument.contact.email : ""
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user