fix: create call logs list page and added in sidebar
This commit is contained in:
parent
b13fa6a503
commit
8d562f3887
@ -37,6 +37,7 @@ import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
|||||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||||
import NoteIcon from '@/components/Icons/NoteIcon.vue'
|
import NoteIcon from '@/components/Icons/NoteIcon.vue'
|
||||||
import DashboardIcon from '@/components/Icons/DashboardIcon.vue'
|
import DashboardIcon from '@/components/Icons/DashboardIcon.vue'
|
||||||
|
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
||||||
import NavLinks from '@/components/NavLinks.vue'
|
import NavLinks from '@/components/NavLinks.vue'
|
||||||
|
|
||||||
const navigations = [
|
const navigations = [
|
||||||
@ -60,6 +61,11 @@ const navigations = [
|
|||||||
icon: NoteIcon,
|
icon: NoteIcon,
|
||||||
route: { name: 'Notes' },
|
route: { name: 'Notes' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Call Logs',
|
||||||
|
icon: PhoneIcon,
|
||||||
|
route: { name: 'Call Logs' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
icon: DashboardIcon,
|
icon: DashboardIcon,
|
||||||
|
|||||||
@ -250,18 +250,18 @@ function addDeviceListeners() {
|
|||||||
|
|
||||||
device.on('disconnect', (conn) => {
|
device.on('disconnect', (conn) => {
|
||||||
log.value = 'Call ended disconnect.'
|
log.value = 'Call ended disconnect.'
|
||||||
update_call_log(conn)
|
// update_call_log(conn)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_call_log(conn, status = 'Completed') {
|
// function update_call_log(conn, status = 'Completed') {
|
||||||
console.log('connection', conn)
|
// console.log('connection', conn)
|
||||||
if (!conn.parameters.CallSid) return
|
// if (!conn.parameters.CallSid) return
|
||||||
call('crm.twilio.api.update_call_log', {
|
// call('crm.twilio.api.update_call_log', {
|
||||||
call_sid: conn.parameters.CallSid,
|
// call_sid: conn.parameters.CallSid,
|
||||||
status: status,
|
// status: status,
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
function toggleMute() {
|
function toggleMute() {
|
||||||
if (_call.value.isMuted()) {
|
if (_call.value.isMuted()) {
|
||||||
@ -370,7 +370,7 @@ async function makeOutgoingCall(number) {
|
|||||||
callStatus.value = ''
|
callStatus.value = ''
|
||||||
muted.value = false
|
muted.value = false
|
||||||
counterUp.value.stop()
|
counterUp.value.stop()
|
||||||
update_call_log(conn)
|
// update_call_log(conn)
|
||||||
})
|
})
|
||||||
_call.value.on('cancel', () => {
|
_call.value.on('cancel', () => {
|
||||||
log.value = `Call ended from makeOutgoing call cancel.`
|
log.value = `Call ended from makeOutgoing call cancel.`
|
||||||
|
|||||||
124
frontend/src/pages/CallLogs.vue
Normal file
124
frontend/src/pages/CallLogs.vue
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<template>
|
||||||
|
<LayoutHeader>
|
||||||
|
<template #left-header>
|
||||||
|
<Breadcrumbs :items="[{ label: list.title }]" />
|
||||||
|
</template>
|
||||||
|
</LayoutHeader>
|
||||||
|
<div class="flex justify-between items-center px-5 pb-2.5 border-b">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<Button label="Sort">
|
||||||
|
<template #prefix><SortIcon class="h-4" /></template>
|
||||||
|
</Button>
|
||||||
|
<Button label="Filter">
|
||||||
|
<template #prefix><FilterIcon class="h-4" /></template>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<Button icon="more-horizontal" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ListView :list="list" :columns="columns" :rows="rows" row-key="name" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import ListView from '@/components/ListView.vue'
|
||||||
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
|
import Breadcrumbs from '@/components/Breadcrumbs.vue'
|
||||||
|
import SortIcon from '@/components/Icons/SortIcon.vue'
|
||||||
|
import FilterIcon from '@/components/Icons/FilterIcon.vue'
|
||||||
|
import { Button, createListResource } from 'frappe-ui'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
const list = {
|
||||||
|
title: 'Call Logs',
|
||||||
|
plural_label: 'Call Logs',
|
||||||
|
singular_label: 'Call Log',
|
||||||
|
}
|
||||||
|
|
||||||
|
const callLogs = createListResource({
|
||||||
|
type: 'list',
|
||||||
|
doctype: 'CRM Call Log',
|
||||||
|
fields: [
|
||||||
|
'from',
|
||||||
|
'to',
|
||||||
|
'duration',
|
||||||
|
'start_time',
|
||||||
|
'end_time',
|
||||||
|
'status',
|
||||||
|
'type',
|
||||||
|
'recording_url',
|
||||||
|
'modified',
|
||||||
|
],
|
||||||
|
orderBy: 'modified desc',
|
||||||
|
cache: 'Call Logs',
|
||||||
|
pageLength: 999,
|
||||||
|
auto: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
label: 'From',
|
||||||
|
key: 'from',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'To',
|
||||||
|
key: 'to',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Duration',
|
||||||
|
key: 'duration',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-20',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Type',
|
||||||
|
key: 'type',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Status',
|
||||||
|
key: 'status',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Start Time',
|
||||||
|
key: 'start_time',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'End Time',
|
||||||
|
key: 'end_time',
|
||||||
|
type: 'data',
|
||||||
|
size: 'w-32',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Last modified',
|
||||||
|
key: 'modified',
|
||||||
|
type: 'pretty_date',
|
||||||
|
size: 'w-28',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const rows = computed(() => {
|
||||||
|
return callLogs.data?.map((callLog) => {
|
||||||
|
return {
|
||||||
|
name: callLog.name,
|
||||||
|
from: callLog.from,
|
||||||
|
to: callLog.to,
|
||||||
|
duration: callLog.duration,
|
||||||
|
type: callLog.type,
|
||||||
|
status: callLog.status,
|
||||||
|
start_time: callLog.start_time,
|
||||||
|
end_time: callLog.end_time,
|
||||||
|
modified: callLog.modified,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@ -39,6 +39,11 @@ const routes = [
|
|||||||
name: 'Contacts',
|
name: 'Contacts',
|
||||||
component: () => import('@/pages/Contacts.vue'),
|
component: () => import('@/pages/Contacts.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/call-logs',
|
||||||
|
name: 'Call Logs',
|
||||||
|
component: () => import('@/pages/CallLogs.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/dashboard',
|
path: '/dashboard',
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user