Added E-Mail loading from Customer
This commit is contained in:
@@ -6,7 +6,7 @@ let draftInvoicesSum = ref(0)
|
|||||||
let draftInvoicesCount = ref(0)
|
let draftInvoicesCount = ref(0)
|
||||||
let unallocatedStatements = ref(0)
|
let unallocatedStatements = ref(0)
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices")
|
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices").filter(i => !i.archived)
|
||||||
|
|
||||||
let draftDocuments = documents.filter(i => i.state === "Entwurf")
|
let draftDocuments = documents.filter(i => i.state === "Entwurf")
|
||||||
let finalizedDocuments = documents.filter(i => i.state === "Gebucht")
|
let finalizedDocuments = documents.filter(i => i.state === "Gebucht")
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ export const useFiles = () => {
|
|||||||
} else {
|
} else {
|
||||||
data = (await supabase
|
data = (await supabase
|
||||||
.from("files")
|
.from("files")
|
||||||
.select('*, incominginvoice(*), project(*), vendor(*), customer(*), contract(*), plant(*), createddocument(*), vehicle(*), product(*), profile(*), check(*), inventoryitem(*)')
|
.select('*, incominginvoice(*), project(*), vendor(*), customer(*), contract(*), plant(*), createddocument(*, customer(*)), vehicle(*), product(*), profile(*), check(*), inventoryitem(*)')
|
||||||
.in("id",documentIds)
|
.in("id",documentIds)
|
||||||
.not("path","is",null)
|
.not("path","is",null)
|
||||||
.not("archived","is",true)
|
.not("archived","is",true)
|
||||||
|
|||||||
@@ -51,9 +51,17 @@ const setupPage = async () => {
|
|||||||
//console.log(loadedDocuments.value)
|
//console.log(loadedDocuments.value)
|
||||||
|
|
||||||
if(loadedDocuments.value.length > 0) {
|
if(loadedDocuments.value.length > 0) {
|
||||||
|
console.log(loadedDocuments.value[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 : ""
|
|
||||||
|
|
||||||
|
if(loadedDocuments.value[0].createddocument.contact && loadedDocuments.value[0].createddocument.contact.email) {
|
||||||
|
console.log("Contact")
|
||||||
|
emailData.value.to = loadedDocuments.value[0].createddocument.contact.email
|
||||||
|
} else if(loadedDocuments.value[0].createddocument.customer && loadedDocuments.value[0].createddocument.customer.infoData.email) {
|
||||||
|
|
||||||
|
|
||||||
|
emailData.value.to = loadedDocuments.value[0].createddocument.customer.infoData.email
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user