fix: show whatsapp tab and action only when whatsapp is enabled
This commit is contained in:
parent
0e5dc23ccf
commit
233011aab3
@ -47,37 +47,7 @@
|
|||||||
<span>{{ __('New WhatsApp Message') }}</span>
|
<span>{{ __('New WhatsApp Message') }}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<Dropdown
|
<Dropdown v-else :options="defaultActions" @click.stop>
|
||||||
v-else
|
|
||||||
:options="[
|
|
||||||
{
|
|
||||||
icon: h(EmailIcon, { class: 'h-4 w-4' }),
|
|
||||||
label: __('New Email'),
|
|
||||||
onClick: () => ($refs.emailBox.show = true),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: h(PhoneIcon, { class: 'h-4 w-4' }),
|
|
||||||
label: __('Make a Call'),
|
|
||||||
onClick: () => makeCall(doc.data.mobile_no),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: h(NoteIcon, { class: 'h-4 w-4' }),
|
|
||||||
label: __('New Note'),
|
|
||||||
onClick: () => showNote(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: h(TaskIcon, { class: 'h-4 w-4' }),
|
|
||||||
label: __('New Task'),
|
|
||||||
onClick: () => showTask(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon: h(WhatsAppIcon, { class: 'h-4 w-4' }),
|
|
||||||
label: __('New WhatsApp Message'),
|
|
||||||
onClick: () => (tabIndex = 5),
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
@click.stop
|
|
||||||
>
|
|
||||||
<template v-slot="{ open }">
|
<template v-slot="{ open }">
|
||||||
<Button variant="solid" class="flex items-center gap-1">
|
<Button variant="solid" class="flex items-center gap-1">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
@ -844,6 +814,7 @@ import {
|
|||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { contactsStore } from '@/stores/contacts'
|
import { contactsStore } from '@/stores/contacts'
|
||||||
|
import { whatsappEnabled } from '@/stores/settings'
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@ -851,7 +822,6 @@ import {
|
|||||||
TextEditor,
|
TextEditor,
|
||||||
Avatar,
|
Avatar,
|
||||||
createResource,
|
createResource,
|
||||||
createListResource,
|
|
||||||
call,
|
call,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { useElementVisibility } from '@vueuse/core'
|
import { useElementVisibility } from '@vueuse/core'
|
||||||
@ -977,6 +947,40 @@ function sendTemplate(template) {
|
|||||||
|
|
||||||
const replyMessage = ref({})
|
const replyMessage = ref({})
|
||||||
|
|
||||||
|
const defaultActions = computed(() => {
|
||||||
|
let actions = [
|
||||||
|
{
|
||||||
|
icon: h(EmailIcon, { class: 'h-4 w-4' }),
|
||||||
|
label: __('New Email'),
|
||||||
|
onClick: () => (emailBox.value.show = true),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: h(PhoneIcon, { class: 'h-4 w-4' }),
|
||||||
|
label: __('Make a Call'),
|
||||||
|
onClick: () => makeCall(doc.value.data.mobile_no),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: h(NoteIcon, { class: 'h-4 w-4' }),
|
||||||
|
label: __('New Note'),
|
||||||
|
onClick: () => showNote(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: h(TaskIcon, { class: 'h-4 w-4' }),
|
||||||
|
label: __('New Task'),
|
||||||
|
onClick: () => showTask(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: h(WhatsAppIcon, { class: 'h-4 w-4' }),
|
||||||
|
label: __('New WhatsApp Message'),
|
||||||
|
onClick: () => (tabIndex.value = 5),
|
||||||
|
condition: () => Boolean(whatsappEnabled.value),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
return actions.filter((action) =>
|
||||||
|
action.condition ? action.condition() : true
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
function get_activities() {
|
function get_activities() {
|
||||||
if (!all_activities.data?.versions) return []
|
if (!all_activities.data?.versions) return []
|
||||||
if (!all_activities.data?.calls.length)
|
if (!all_activities.data?.calls.length)
|
||||||
|
|||||||
@ -320,6 +320,7 @@ import {
|
|||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
import { organizationsStore } from '@/stores/organizations'
|
import { organizationsStore } from '@/stores/organizations'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
|
import { whatsappEnabled } from '@/stores/settings'
|
||||||
import {
|
import {
|
||||||
createResource,
|
createResource,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
@ -435,38 +436,42 @@ const breadcrumbs = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const tabIndex = ref(0)
|
const tabIndex = ref(0)
|
||||||
const tabs = [
|
const tabs = computed(() => {
|
||||||
{
|
let tabOptions = [
|
||||||
name: 'Activity',
|
{
|
||||||
label: __('Activity'),
|
name: 'Activity',
|
||||||
icon: ActivityIcon,
|
label: __('Activity'),
|
||||||
},
|
icon: ActivityIcon,
|
||||||
{
|
},
|
||||||
name: 'Emails',
|
{
|
||||||
label: __('Emails'),
|
name: 'Emails',
|
||||||
icon: EmailIcon,
|
label: __('Emails'),
|
||||||
},
|
icon: EmailIcon,
|
||||||
{
|
},
|
||||||
name: 'Calls',
|
{
|
||||||
label: __('Calls'),
|
name: 'Calls',
|
||||||
icon: PhoneIcon,
|
label: __('Calls'),
|
||||||
},
|
icon: PhoneIcon,
|
||||||
{
|
},
|
||||||
name: 'Tasks',
|
{
|
||||||
label: __('Tasks'),
|
name: 'Tasks',
|
||||||
icon: TaskIcon,
|
label: __('Tasks'),
|
||||||
},
|
icon: TaskIcon,
|
||||||
{
|
},
|
||||||
name: 'Notes',
|
{
|
||||||
label: __('Notes'),
|
name: 'Notes',
|
||||||
icon: NoteIcon,
|
label: __('Notes'),
|
||||||
},
|
icon: NoteIcon,
|
||||||
{
|
},
|
||||||
name: 'WhatsApp',
|
{
|
||||||
label: __('WhatsApp'),
|
name: 'WhatsApp',
|
||||||
icon: WhatsAppIcon,
|
label: __('WhatsApp'),
|
||||||
},
|
icon: WhatsAppIcon,
|
||||||
]
|
condition: () => Boolean(whatsappEnabled.value),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||||
|
})
|
||||||
|
|
||||||
const detailSections = computed(() => {
|
const detailSections = computed(() => {
|
||||||
let data = deal.data
|
let data = deal.data
|
||||||
|
|||||||
@ -287,6 +287,7 @@ import { globalStore } from '@/stores/global'
|
|||||||
import { contactsStore } from '@/stores/contacts'
|
import { contactsStore } from '@/stores/contacts'
|
||||||
import { organizationsStore } from '@/stores/organizations'
|
import { organizationsStore } from '@/stores/organizations'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
|
import { whatsappEnabled } from '@/stores/settings'
|
||||||
import {
|
import {
|
||||||
createResource,
|
createResource,
|
||||||
FileUploader,
|
FileUploader,
|
||||||
@ -399,38 +400,43 @@ const breadcrumbs = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const tabIndex = ref(0)
|
const tabIndex = ref(0)
|
||||||
const tabs = [
|
|
||||||
{
|
const tabs = computed(() => {
|
||||||
name: 'Activity',
|
let tabOptions = [
|
||||||
label: __('Activity'),
|
{
|
||||||
icon: ActivityIcon,
|
name: 'Activity',
|
||||||
},
|
label: __('Activity'),
|
||||||
{
|
icon: ActivityIcon,
|
||||||
name: 'Emails',
|
},
|
||||||
label: __('Emails'),
|
{
|
||||||
icon: EmailIcon,
|
name: 'Emails',
|
||||||
},
|
label: __('Emails'),
|
||||||
{
|
icon: EmailIcon,
|
||||||
name: 'Calls',
|
},
|
||||||
label: __('Calls'),
|
{
|
||||||
icon: PhoneIcon,
|
name: 'Calls',
|
||||||
},
|
label: __('Calls'),
|
||||||
{
|
icon: PhoneIcon,
|
||||||
name: 'Tasks',
|
},
|
||||||
label: __('Tasks'),
|
{
|
||||||
icon: TaskIcon,
|
name: 'Tasks',
|
||||||
},
|
label: __('Tasks'),
|
||||||
{
|
icon: TaskIcon,
|
||||||
name: 'Notes',
|
},
|
||||||
label: __('Notes'),
|
{
|
||||||
icon: NoteIcon,
|
name: 'Notes',
|
||||||
},
|
label: __('Notes'),
|
||||||
{
|
icon: NoteIcon,
|
||||||
name: 'WhatsApp',
|
},
|
||||||
label: __('WhatsApp'),
|
{
|
||||||
icon: WhatsAppIcon,
|
name: 'WhatsApp',
|
||||||
},
|
label: __('WhatsApp'),
|
||||||
]
|
icon: WhatsAppIcon,
|
||||||
|
condition: () => Boolean(whatsappEnabled.value),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||||
|
})
|
||||||
|
|
||||||
function validateFile(file) {
|
function validateFile(file) {
|
||||||
let extn = file.name.split('.').pop().toLowerCase()
|
let extn = file.name.split('.').pop().toLowerCase()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user