fix: reload emails after sending it
This commit is contained in:
parent
424d8feab2
commit
47ded1a7f1
@ -454,8 +454,9 @@
|
||||
</div>
|
||||
<CommunicationArea
|
||||
ref="emailBox"
|
||||
v-if="['Emails', 'Activity'].includes(title) && lead"
|
||||
v-if="['Emails', 'Activity'].includes(title)"
|
||||
v-model="lead"
|
||||
v-model:reload="reload_email"
|
||||
/>
|
||||
<NoteModal v-model="showNoteModal" :note="note" @updateNote="updateNote" />
|
||||
</template>
|
||||
@ -508,6 +509,8 @@ const props = defineProps({
|
||||
const lead = defineModel()
|
||||
const reload = defineModel('reload')
|
||||
|
||||
const reload_email = ref(false)
|
||||
|
||||
const versions = createResource({
|
||||
url: 'crm.fcrm.doctype.crm_lead.api.get_activities',
|
||||
params: { name: lead.value.data.name },
|
||||
@ -739,10 +742,11 @@ async function updateNote(note) {
|
||||
}
|
||||
}
|
||||
|
||||
watch(reload, (value) => {
|
||||
if (value) {
|
||||
watch([reload, reload_email], ([reload_value, reload_email_value]) => {
|
||||
if (reload_value || reload_email_value) {
|
||||
versions.reload()
|
||||
reload.value = false
|
||||
reload_email.value = false
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
},
|
||||
}"
|
||||
:editable="showCommunicationBox"
|
||||
v-model="modelValue.data"
|
||||
v-model="lead.data"
|
||||
placeholder="Add a reply..."
|
||||
/>
|
||||
</div>
|
||||
@ -56,7 +56,8 @@ import { usersStore } from '@/stores/users'
|
||||
import { call } from 'frappe-ui'
|
||||
import { ref, watch, computed, defineModel } from 'vue'
|
||||
|
||||
const modelValue = defineModel()
|
||||
const lead = defineModel()
|
||||
const reload = defineModel('reload')
|
||||
|
||||
const { getUser } = usersStore()
|
||||
|
||||
@ -84,13 +85,13 @@ const onNewEmailChange = (value) => {
|
||||
|
||||
async function sendMail() {
|
||||
await call('frappe.core.doctype.communication.email.make', {
|
||||
recipients: modelValue.value.data.email,
|
||||
recipients: lead.value.data.email,
|
||||
cc: '',
|
||||
bcc: '',
|
||||
subject: 'Email from Agent',
|
||||
content: newEmail.value,
|
||||
doctype: 'CRM Lead',
|
||||
name: modelValue.value.data.name,
|
||||
name: lead.value.data.name,
|
||||
send_email: 1,
|
||||
sender: getUser().name,
|
||||
sender_full_name: getUser()?.full_name || undefined,
|
||||
@ -102,7 +103,7 @@ async function submitComment() {
|
||||
showCommunicationBox.value = false
|
||||
await sendMail()
|
||||
newEmail.value = ''
|
||||
modelValue.value.reload()
|
||||
reload.value = true
|
||||
}
|
||||
|
||||
defineExpose({ show: showCommunicationBox })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user