fix: using name of contact/agent on call logs list
This commit is contained in:
parent
dd35b615d5
commit
448bedd8b0
@ -11,17 +11,18 @@
|
|||||||
"id",
|
"id",
|
||||||
"from",
|
"from",
|
||||||
"status",
|
"status",
|
||||||
"call_received_by",
|
"duration",
|
||||||
"medium",
|
"medium",
|
||||||
"start_time",
|
"start_time",
|
||||||
"note",
|
|
||||||
"column_break_ufnp",
|
|
||||||
"type",
|
|
||||||
"to",
|
|
||||||
"lead",
|
"lead",
|
||||||
"duration",
|
"column_break_ufnp",
|
||||||
|
"to",
|
||||||
|
"type",
|
||||||
|
"receiver",
|
||||||
|
"caller",
|
||||||
"recording_url",
|
"recording_url",
|
||||||
"end_time"
|
"end_time",
|
||||||
|
"note"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -43,13 +44,6 @@
|
|||||||
"options": "Ringing\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled",
|
"options": "Ringing\nIn Progress\nCompleted\nFailed\nBusy\nNo Answer\nQueued\nCanceled",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"depends_on": "to",
|
|
||||||
"fieldname": "call_received_by",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"label": "Call Received By",
|
|
||||||
"options": "User"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "start_time",
|
"fieldname": "start_time",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
@ -106,11 +100,25 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Note",
|
"label": "Note",
|
||||||
"options": "CRM Note"
|
"options": "CRM Note"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval:doc.type == 'Incoming'",
|
||||||
|
"fieldname": "receiver",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Call Received By",
|
||||||
|
"options": "User"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval:doc.type == 'Outgoing'",
|
||||||
|
"fieldname": "caller",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Caller",
|
||||||
|
"options": "User"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-08-28 11:42:33.487807",
|
"modified": "2023-08-30 15:39:46.613734",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "CRM Call Log",
|
"name": "CRM Call Log",
|
||||||
|
|||||||
@ -220,10 +220,17 @@ class TwilioCallDetails:
|
|||||||
return ' '.join(twilio_status.split('-')).title()
|
return ' '.join(twilio_status.split('-')).title()
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
|
"""Convert call details into dict.
|
||||||
|
"""
|
||||||
|
direction = self.get_direction()
|
||||||
|
caller = frappe.session.user if direction == 'Outgoing' else ''
|
||||||
|
receiver = frappe.session.user if direction == 'Incoming' else ''
|
||||||
return {
|
return {
|
||||||
'type': self.get_direction(),
|
'type': direction,
|
||||||
'status': self.call_status,
|
'status': self.call_status,
|
||||||
'id': self.call_sid,
|
'id': self.call_sid,
|
||||||
'from': self.get_from_number(),
|
'from': self.get_from_number(),
|
||||||
'to': self.get_to_number()
|
'to': self.get_to_number(),
|
||||||
|
'reciever': receiver,
|
||||||
|
'caller': caller,
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
<Tooltip
|
<Tooltip
|
||||||
:text="tooltipText"
|
:text="tooltipText"
|
||||||
class="flex items-center space-x-2.5"
|
class="flex items-center space-x-2.5"
|
||||||
|
:class="align == 'text-right' ? 'justify-end' : ''"
|
||||||
>
|
>
|
||||||
<slot name="prefix"></slot>
|
<slot name="prefix"></slot>
|
||||||
<slot>
|
<slot>
|
||||||
@ -21,6 +22,10 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'text',
|
default: 'text',
|
||||||
},
|
},
|
||||||
|
align: {
|
||||||
|
type: String,
|
||||||
|
default: 'left',
|
||||||
|
},
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number, Object],
|
type: [String, Number, Object],
|
||||||
default: '',
|
default: '',
|
||||||
|
|||||||
@ -44,6 +44,7 @@
|
|||||||
<ListRowItem
|
<ListRowItem
|
||||||
:value="getValue(row[column.key]).label"
|
:value="getValue(row[column.key]).label"
|
||||||
:type="column.type"
|
:type="column.type"
|
||||||
|
:align="column.align"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<div v-if="column.type === 'indicator'">
|
<div v-if="column.type === 'indicator'">
|
||||||
|
|||||||
@ -27,9 +27,14 @@ import Breadcrumbs from '@/components/Breadcrumbs.vue'
|
|||||||
import SortIcon from '@/components/Icons/SortIcon.vue'
|
import SortIcon from '@/components/Icons/SortIcon.vue'
|
||||||
import FilterIcon from '@/components/Icons/FilterIcon.vue'
|
import FilterIcon from '@/components/Icons/FilterIcon.vue'
|
||||||
import { secondsToDuration } from '@/utils'
|
import { secondsToDuration } from '@/utils'
|
||||||
|
import { usersStore } from '@/stores/users'
|
||||||
|
import { contactsStore } from '@/stores/contacts'
|
||||||
import { Button, createListResource } from 'frappe-ui'
|
import { Button, createListResource } from 'frappe-ui'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
const { getUser } = usersStore()
|
||||||
|
const { getContact } = contactsStore()
|
||||||
|
|
||||||
const list = {
|
const list = {
|
||||||
title: 'Call Logs',
|
title: 'Call Logs',
|
||||||
plural_label: 'Call Logs',
|
plural_label: 'Call Logs',
|
||||||
@ -41,6 +46,8 @@ const callLogs = createListResource({
|
|||||||
doctype: 'CRM Call Log',
|
doctype: 'CRM Call Log',
|
||||||
fields: [
|
fields: [
|
||||||
'name',
|
'name',
|
||||||
|
'caller',
|
||||||
|
'receiver',
|
||||||
'from',
|
'from',
|
||||||
'to',
|
'to',
|
||||||
'duration',
|
'duration',
|
||||||
@ -60,22 +67,16 @@ const callLogs = createListResource({
|
|||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
label: 'From',
|
label: 'From',
|
||||||
key: 'from',
|
key: 'caller',
|
||||||
type: 'data',
|
type: 'avatar',
|
||||||
size: 'w-32',
|
size: 'w-32',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'To',
|
label: 'To',
|
||||||
key: 'to',
|
key: 'receiver',
|
||||||
type: 'data',
|
type: 'avatar',
|
||||||
size: 'w-32',
|
size: 'w-32',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'Duration',
|
|
||||||
key: 'duration',
|
|
||||||
type: 'icon',
|
|
||||||
size: 'w-20',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
key: 'type',
|
key: 'type',
|
||||||
@ -88,6 +89,25 @@ const columns = [
|
|||||||
type: 'badge',
|
type: 'badge',
|
||||||
size: 'w-32',
|
size: 'w-32',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Duration',
|
||||||
|
key: 'duration',
|
||||||
|
type: 'icon',
|
||||||
|
size: 'w-20',
|
||||||
|
align: 'text-right'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'From (number)',
|
||||||
|
key: 'from',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'To (number)',
|
||||||
|
key: 'to',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Created on',
|
label: 'Created on',
|
||||||
key: 'creation',
|
key: 'creation',
|
||||||
@ -98,8 +118,33 @@ const columns = [
|
|||||||
|
|
||||||
const rows = computed(() => {
|
const rows = computed(() => {
|
||||||
return callLogs.data?.map((callLog) => {
|
return callLogs.data?.map((callLog) => {
|
||||||
|
let caller = callLog.caller
|
||||||
|
let receiver = callLog.receiver
|
||||||
|
|
||||||
|
if (callLog.type === 'Incoming') {
|
||||||
|
caller = {
|
||||||
|
label: getContact(callLog.from)?.full_name || 'Unknown',
|
||||||
|
image: getContact(callLog.from)?.image,
|
||||||
|
}
|
||||||
|
receiver = {
|
||||||
|
label: getUser(receiver).full_name,
|
||||||
|
image: getUser(receiver).user_image,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
caller = {
|
||||||
|
label: getUser(caller).full_name,
|
||||||
|
image: getUser(caller).user_image,
|
||||||
|
}
|
||||||
|
receiver = {
|
||||||
|
label: getContact(callLog.to)?.full_name || 'Unknown',
|
||||||
|
image: getContact(callLog.from)?.image,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: callLog.name,
|
name: callLog.name,
|
||||||
|
caller: caller,
|
||||||
|
receiver: receiver,
|
||||||
from: callLog.from,
|
from: callLog.from,
|
||||||
to: callLog.to,
|
to: callLog.to,
|
||||||
duration: {
|
duration: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user