fix: updated activities & communicationArea component to handle lead/deal activities
This commit is contained in:
parent
de4aa2ae86
commit
a685724d3d
@ -6,7 +6,7 @@
|
|||||||
<Button
|
<Button
|
||||||
v-if="title == 'Calls'"
|
v-if="title == 'Calls'"
|
||||||
variant="solid"
|
variant="solid"
|
||||||
@click="makeCall(lead.data.mobile_no)"
|
@click="makeCall(doc.data.mobile_no)"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<PhoneIcon class="h-4 w-4" />
|
<PhoneIcon class="h-4 w-4" />
|
||||||
@ -561,7 +561,7 @@
|
|||||||
v-if="title == 'Calls'"
|
v-if="title == 'Calls'"
|
||||||
variant="solid"
|
variant="solid"
|
||||||
label="Make a call"
|
label="Make a call"
|
||||||
@click="makeCall(lead.data.mobile_no)"
|
@click="makeCall(doc.data.mobile_no)"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
v-else-if="title == 'Notes'"
|
v-else-if="title == 'Notes'"
|
||||||
@ -585,20 +585,20 @@
|
|||||||
<CommunicationArea
|
<CommunicationArea
|
||||||
ref="emailBox"
|
ref="emailBox"
|
||||||
v-if="['Emails', 'Activity'].includes(title)"
|
v-if="['Emails', 'Activity'].includes(title)"
|
||||||
v-model="lead"
|
v-model="doc"
|
||||||
v-model:reload="reload_email"
|
v-model:reload="reload_email"
|
||||||
/>
|
/>
|
||||||
<NoteModal
|
<NoteModal
|
||||||
v-model="showNoteModal"
|
v-model="showNoteModal"
|
||||||
v-model:reloadNotes="notes"
|
v-model:reloadNotes="notes"
|
||||||
:note="note"
|
:note="note"
|
||||||
:lead="lead.data?.name"
|
:lead="doc.data?.name"
|
||||||
/>
|
/>
|
||||||
<TaskModal
|
<TaskModal
|
||||||
v-model="showTaskModal"
|
v-model="showTaskModal"
|
||||||
v-model:reloadTasks="tasks"
|
v-model:reloadTasks="tasks"
|
||||||
:task="task"
|
:task="task"
|
||||||
:lead="lead.data?.name"
|
:lead="doc.data?.name"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -654,22 +654,22 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const lead = defineModel()
|
const doc = defineModel()
|
||||||
const reload = defineModel('reload')
|
const reload = defineModel('reload')
|
||||||
|
|
||||||
const reload_email = ref(false)
|
const reload_email = ref(false)
|
||||||
|
|
||||||
const versions = createResource({
|
const versions = createResource({
|
||||||
url: 'crm.fcrm.doctype.crm_lead.api.get_activities',
|
url: 'crm.api.activities.get_activities',
|
||||||
params: { name: lead.value.data.name },
|
params: { name: doc.value.data.name },
|
||||||
cache: ['activity', lead.value.data.name],
|
cache: ['activity', doc.value.data.name],
|
||||||
auto: true,
|
auto: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const calls = createListResource({
|
const calls = createListResource({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
doctype: 'CRM Call Log',
|
doctype: 'CRM Call Log',
|
||||||
cache: ['Call Logs', lead.value.data.name],
|
cache: ['Call Logs', doc.value.data.name],
|
||||||
fields: [
|
fields: [
|
||||||
'name',
|
'name',
|
||||||
'caller',
|
'caller',
|
||||||
@ -685,7 +685,7 @@ const calls = createListResource({
|
|||||||
'creation',
|
'creation',
|
||||||
'note',
|
'note',
|
||||||
],
|
],
|
||||||
filters: { lead: lead.value.data.name },
|
filters: { lead: doc.value.data.name },
|
||||||
orderBy: 'creation desc',
|
orderBy: 'creation desc',
|
||||||
pageLength: 999,
|
pageLength: 999,
|
||||||
auto: true,
|
auto: true,
|
||||||
@ -722,9 +722,9 @@ const calls = createListResource({
|
|||||||
const notes = createListResource({
|
const notes = createListResource({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
doctype: 'CRM Note',
|
doctype: 'CRM Note',
|
||||||
cache: ['Notes', lead.value.data.name],
|
cache: ['Notes', doc.value.data.name],
|
||||||
fields: ['name', 'title', 'content', 'owner', 'modified'],
|
fields: ['name', 'title', 'content', 'owner', 'modified'],
|
||||||
filters: { lead: lead.value.data.name },
|
filters: { lead: doc.value.data.name },
|
||||||
orderBy: 'modified desc',
|
orderBy: 'modified desc',
|
||||||
pageLength: 999,
|
pageLength: 999,
|
||||||
auto: true,
|
auto: true,
|
||||||
@ -733,7 +733,7 @@ const notes = createListResource({
|
|||||||
const tasks = createListResource({
|
const tasks = createListResource({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
doctype: 'CRM Task',
|
doctype: 'CRM Task',
|
||||||
cache: ['Tasks', lead.value.data.name],
|
cache: ['Tasks', doc.value.data.name],
|
||||||
fields: [
|
fields: [
|
||||||
'name',
|
'name',
|
||||||
'title',
|
'title',
|
||||||
@ -745,7 +745,7 @@ const tasks = createListResource({
|
|||||||
'status',
|
'status',
|
||||||
'modified',
|
'modified',
|
||||||
],
|
],
|
||||||
filters: { lead: lead.value.data.name },
|
filters: { lead: doc.value.data.name },
|
||||||
orderBy: 'modified desc',
|
orderBy: 'modified desc',
|
||||||
pageLength: 999,
|
pageLength: 999,
|
||||||
auto: true,
|
auto: true,
|
||||||
@ -805,10 +805,6 @@ function update_activities_details(activity) {
|
|||||||
|
|
||||||
if (activity.activity_type == 'creation') {
|
if (activity.activity_type == 'creation') {
|
||||||
activity.type = activity.data
|
activity.type = activity.data
|
||||||
} else if (activity.activity_type == 'deal') {
|
|
||||||
activity.type = 'converted the lead to this deal'
|
|
||||||
activity.data.field_label = ''
|
|
||||||
activity.data.value = ''
|
|
||||||
} else if (activity.activity_type == 'added') {
|
} else if (activity.activity_type == 'added') {
|
||||||
activity.type = 'added'
|
activity.type = 'added'
|
||||||
activity.value = 'as'
|
activity.value = 'as'
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
:editable="showCommunicationBox"
|
:editable="showCommunicationBox"
|
||||||
v-model="lead.data"
|
v-model="doc.data"
|
||||||
placeholder="Add a reply..."
|
placeholder="Add a reply..."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -56,7 +56,7 @@ import { usersStore } from '@/stores/users'
|
|||||||
import { call } from 'frappe-ui'
|
import { call } from 'frappe-ui'
|
||||||
import { ref, watch, computed, defineModel } from 'vue'
|
import { ref, watch, computed, defineModel } from 'vue'
|
||||||
|
|
||||||
const lead = defineModel()
|
const doc = defineModel()
|
||||||
const reload = defineModel('reload')
|
const reload = defineModel('reload')
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
@ -84,14 +84,19 @@ const onNewEmailChange = (value) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function sendMail() {
|
async function sendMail() {
|
||||||
|
let doctype = 'CRM Lead'
|
||||||
|
if (doc.value.data.lead) {
|
||||||
|
doctype = 'CRM Deal'
|
||||||
|
}
|
||||||
|
|
||||||
await call('frappe.core.doctype.communication.email.make', {
|
await call('frappe.core.doctype.communication.email.make', {
|
||||||
recipients: lead.value.data.email,
|
recipients: doc.value.data.email,
|
||||||
cc: '',
|
cc: '',
|
||||||
bcc: '',
|
bcc: '',
|
||||||
subject: 'Email from Agent',
|
subject: 'Email from Agent',
|
||||||
content: newEmail.value,
|
content: newEmail.value,
|
||||||
doctype: 'CRM Lead',
|
doctype: doctype,
|
||||||
name: lead.value.data.name,
|
name: doc.value.data.name,
|
||||||
send_email: 1,
|
send_email: 1,
|
||||||
sender: getUser().name,
|
sender: getUser().name,
|
||||||
sender_full_name: getUser()?.full_name || undefined,
|
sender_full_name: getUser()?.full_name || undefined,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user