From 7c0d9703b89cd323c395cb603460f0f93bb0732d Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 18 Jan 2024 17:54:57 +0530 Subject: [PATCH] fix: add subject to email box --- frontend/src/components/CommunicationArea.vue | 14 +++++++++++++- frontend/src/components/EmailEditor.vue | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/CommunicationArea.vue b/frontend/src/components/CommunicationArea.vue index cb7f12c9..bed61237 100644 --- a/frontend/src/components/CommunicationArea.vue +++ b/frontend/src/components/CommunicationArea.vue @@ -55,6 +55,7 @@ v-model="doc.data" v-model:attachments="attachments" :doctype="doctype" + :subject="subject" placeholder="Add a reply..." /> @@ -87,6 +88,16 @@ const newEmailEditor = ref(null) const sendEmailRef = ref(null) const attachments = ref([]) +const subject = computed(() => { + let prefix = '' + if (doc.value.data?.lead_name) { + prefix = doc.value.data.lead_name + } else if (doc.value.data?.organization) { + prefix = doc.value.data.organization + } + return `${prefix} (#${doc.value.data.name})` +}) + watch( () => showCommunicationBox.value, (value) => { @@ -106,6 +117,7 @@ const onNewEmailChange = (value) => { async function sendMail() { let recipients = newEmailEditor.value.toEmails + let subject = newEmailEditor.value.subject let cc = newEmailEditor.value.ccEmails let bcc = newEmailEditor.value.bccEmails await call('frappe.core.doctype.communication.email.make', { @@ -113,7 +125,7 @@ async function sendMail() { attachments: attachments.value.map((x) => x.name), cc: cc.join(', '), bcc: bcc.join(', '), - subject: 'Email from Agent', + subject: subject, content: newEmail.value, doctype: props.doctype, name: doc.value.data.name, diff --git a/frontend/src/components/EmailEditor.vue b/frontend/src/components/EmailEditor.vue index b0292dd3..b117172e 100644 --- a/frontend/src/components/EmailEditor.vue +++ b/frontend/src/components/EmailEditor.vue @@ -9,6 +9,13 @@ :editable="editable" >