fix: added lead detail section on right sidebar with phone call button and more

now agent can call the customer using that button
This commit is contained in:
Shariq Ansari 2023-08-24 00:31:05 +05:30
parent e31b6cdf72
commit d9bf3388fe
3 changed files with 157 additions and 133 deletions

View File

@ -333,8 +333,7 @@ function handleDisconnectedIncomingCall() {
counterUp.value.stop() counterUp.value.stop()
} }
async function makeOutgoingCall(close) { async function makeOutgoingCall() {
close()
if (device) { if (device) {
log.value = `Attempting to call +917666980887 ...` log.value = `Attempting to call +917666980887 ...`
@ -428,7 +427,7 @@ watch(
{ immediate: true } { immediate: true }
) )
provide('showPhoneCall', showPhoneCall) provide('makeOutgoingCall', makeOutgoingCall)
</script> </script>
<style scoped> <style scoped>

View File

@ -1,18 +1,12 @@
<template> <template>
<div class="max-w-[81.7%] pl-16 p-4 pt-2"> <div class="max-w-[81.7%] pl-16 p-4 pt-2">
<button <button
class="flex gap-2 w-full items-center rounded-lg p-1 bg-gray-100 hover:bg-gray-200" class="flex gap-2 w-full items-center rounded-lg p-2 bg-gray-100 hover:bg-gray-200"
@click="showCommunicationBox = true" @click="showCommunicationBox = true"
v-show="!showCommunicationBox" v-show="!showCommunicationBox"
> >
<UserAvatar class="m-1" :user="getUser().name" size="sm" /> <UserAvatar :user="getUser().name" size="sm" />
<div class="flex-1 text-left text-base text-gray-600">Add a reply...</div> <div class="text-base text-gray-600">Add a reply...</div>
<Tooltip text="Make a call..." class="m-1">
<PhoneIcon
class="bg-gray-900 rounded-full text-white fill-white p-[3px]"
@click.stop="showPhoneCall = true"
/>
</Tooltip>
</button> </button>
<div <div
v-show="showCommunicationBox" v-show="showCommunicationBox"
@ -55,14 +49,12 @@ import EmailEditor from '@/components/EmailEditor.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue' import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { Tooltip, call, Button } from 'frappe-ui' import { Tooltip, call, Button } from 'frappe-ui'
import { ref, watch, computed, defineModel, inject } from 'vue' import { ref, watch, computed, defineModel } from 'vue'
const modelValue = defineModel() const modelValue = defineModel()
const { getUser } = usersStore() const { getUser } = usersStore()
let showPhoneCall = inject('showPhoneCall')
const showCommunicationBox = ref(false) const showCommunicationBox = ref(false)
const newEmail = ref('') const newEmail = ref('')
const newEmailEditor = ref(null) const newEmailEditor = ref(null)

View File

@ -69,11 +69,33 @@
<Activities :title="tab.activityTitle" :activities="tab.content" /> <Activities :title="tab.activityTitle" :activities="tab.content" />
</TabPanel> </TabPanel>
</TabPanels> </TabPanels>
<CommunicationArea v-if="[0, 1].includes(selectedIndex)" v-model="lead" /> <CommunicationArea
v-if="[0, 1].includes(selectedIndex)"
v-model="lead"
/>
</div> </div>
<div class="flex flex-col justify-between border-l w-[360px]">
<div <div
class="flex flex-col justify-between border-l w-[390px] overflow-hidden" class="flex flex-col gap-3 pb-4 p-5 items-center justify-center border-b"
> >
<Avatar
size="3xl"
:label="lead.data.first_name"
:image="lead.data.image"
/>
<div class="font-medium text-2xl">{{ lead.data.lead_name }}</div>
<div class="flex gap-3">
<Button class="rounded-full h-8 w-8" @click="makeCall">
<PhoneIcon class="h-4 w-4" />
</Button>
<Button class="rounded-full h-8 w-8">
<EmailIcon class="h-4 w-4" />
</Button>
<Button icon="message-square" class="rounded-full h-8 w-8" />
<Button icon="more-horizontal" class="rounded-full h-8 w-8" />
</div>
</div>
<div class="flex-1 flex flex-col justify-between overflow-hidden">
<div class="flex flex-col gap-6.5 p-3 overflow-y-auto"> <div class="flex flex-col gap-6.5 p-3 overflow-y-auto">
<div <div
v-for="section in detailSections" v-for="section in detailSections"
@ -106,7 +128,9 @@
:key="field.label" :key="field.label"
class="flex items-center px-3 gap-2 text-base leading-5 first:mt-4.5" class="flex items-center px-3 gap-2 text-base leading-5 first:mt-4.5"
> >
<div class="text-gray-600 w-[106px]">{{ field.label }}</div> <div class="text-gray-600 w-[106px]">
{{ field.label }}
</div>
<div class="flex-1 w-full"> <div class="flex-1 w-full">
<FormControl <FormControl
v-if="field.type === 'select'" v-if="field.type === 'select'"
@ -188,6 +212,7 @@
</Toggler> </Toggler>
</div> </div>
</div> </div>
</div>
<div <div
class="flex items-center gap-1 text-sm px-6 p-3 leading-5 cursor-pointer" class="flex items-center gap-1 text-sm px-6 p-3 leading-5 cursor-pointer"
> >
@ -217,7 +242,7 @@ import Toggler from '@/components/Toggler.vue'
import Activities from '@/components/Activities.vue' import Activities from '@/components/Activities.vue'
import Breadcrumbs from '@/components/Breadcrumbs.vue' import Breadcrumbs from '@/components/Breadcrumbs.vue'
import UserAvatar from '@/components/UserAvatar.vue' import UserAvatar from '@/components/UserAvatar.vue'
import CommunicationArea from '../components/CommunicationArea.vue' import CommunicationArea from '@/components/CommunicationArea.vue'
import { TabGroup, TabList, Tab, TabPanels, TabPanel } from '@headlessui/vue' import { TabGroup, TabList, Tab, TabPanels, TabPanel } from '@headlessui/vue'
import { TransitionPresets, useTransition } from '@vueuse/core' import { TransitionPresets, useTransition } from '@vueuse/core'
import { dateFormat, timeAgo, dateTooltipFormat } from '@/utils' import { dateFormat, timeAgo, dateTooltipFormat } from '@/utils'
@ -230,11 +255,14 @@ import {
FormControl, FormControl,
Dropdown, Dropdown,
Tooltip, Tooltip,
Avatar,
} from 'frappe-ui' } from 'frappe-ui'
import { ref, computed, h } from 'vue' import { ref, computed, h, inject } from 'vue'
const { getUser, users } = usersStore() const { getUser, users } = usersStore()
const makeCall = inject('makeOutgoingCall')
const props = defineProps({ const props = defineProps({
leadId: { leadId: {
type: String, type: String,
@ -406,9 +434,14 @@ const detailSections = computed(() => {
opened: true, opened: true,
fields: [ fields: [
{ {
label: 'Name', label: 'First Name',
type: 'data', type: 'data',
name: 'lead_name', name: 'first_name',
},
{
label: 'Last Name',
type: 'data',
name: 'last_name',
}, },
{ {
label: 'Email', label: 'Email',