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>
|
||||
</Button>
|
||||
</div>
|
||||
<Dropdown
|
||||
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
|
||||
>
|
||||
<Dropdown v-else :options="defaultActions" @click.stop>
|
||||
<template v-slot="{ open }">
|
||||
<Button variant="solid" class="flex items-center gap-1">
|
||||
<template #prefix>
|
||||
@ -844,6 +814,7 @@ import {
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { contactsStore } from '@/stores/contacts'
|
||||
import { whatsappEnabled } from '@/stores/settings'
|
||||
import {
|
||||
Button,
|
||||
Tooltip,
|
||||
@ -851,7 +822,6 @@ import {
|
||||
TextEditor,
|
||||
Avatar,
|
||||
createResource,
|
||||
createListResource,
|
||||
call,
|
||||
} from 'frappe-ui'
|
||||
import { useElementVisibility } from '@vueuse/core'
|
||||
@ -977,6 +947,40 @@ function sendTemplate(template) {
|
||||
|
||||
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() {
|
||||
if (!all_activities.data?.versions) return []
|
||||
if (!all_activities.data?.calls.length)
|
||||
|
||||
@ -320,6 +320,7 @@ import {
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { organizationsStore } from '@/stores/organizations'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
import { whatsappEnabled } from '@/stores/settings'
|
||||
import {
|
||||
createResource,
|
||||
Dropdown,
|
||||
@ -435,38 +436,42 @@ const breadcrumbs = computed(() => {
|
||||
})
|
||||
|
||||
const tabIndex = ref(0)
|
||||
const tabs = [
|
||||
{
|
||||
name: 'Activity',
|
||||
label: __('Activity'),
|
||||
icon: ActivityIcon,
|
||||
},
|
||||
{
|
||||
name: 'Emails',
|
||||
label: __('Emails'),
|
||||
icon: EmailIcon,
|
||||
},
|
||||
{
|
||||
name: 'Calls',
|
||||
label: __('Calls'),
|
||||
icon: PhoneIcon,
|
||||
},
|
||||
{
|
||||
name: 'Tasks',
|
||||
label: __('Tasks'),
|
||||
icon: TaskIcon,
|
||||
},
|
||||
{
|
||||
name: 'Notes',
|
||||
label: __('Notes'),
|
||||
icon: NoteIcon,
|
||||
},
|
||||
{
|
||||
name: 'WhatsApp',
|
||||
label: __('WhatsApp'),
|
||||
icon: WhatsAppIcon,
|
||||
},
|
||||
]
|
||||
const tabs = computed(() => {
|
||||
let tabOptions = [
|
||||
{
|
||||
name: 'Activity',
|
||||
label: __('Activity'),
|
||||
icon: ActivityIcon,
|
||||
},
|
||||
{
|
||||
name: 'Emails',
|
||||
label: __('Emails'),
|
||||
icon: EmailIcon,
|
||||
},
|
||||
{
|
||||
name: 'Calls',
|
||||
label: __('Calls'),
|
||||
icon: PhoneIcon,
|
||||
},
|
||||
{
|
||||
name: 'Tasks',
|
||||
label: __('Tasks'),
|
||||
icon: TaskIcon,
|
||||
},
|
||||
{
|
||||
name: 'Notes',
|
||||
label: __('Notes'),
|
||||
icon: NoteIcon,
|
||||
},
|
||||
{
|
||||
name: 'WhatsApp',
|
||||
label: __('WhatsApp'),
|
||||
icon: WhatsAppIcon,
|
||||
condition: () => Boolean(whatsappEnabled.value),
|
||||
},
|
||||
]
|
||||
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||
})
|
||||
|
||||
const detailSections = computed(() => {
|
||||
let data = deal.data
|
||||
|
||||
@ -287,6 +287,7 @@ import { globalStore } from '@/stores/global'
|
||||
import { contactsStore } from '@/stores/contacts'
|
||||
import { organizationsStore } from '@/stores/organizations'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
import { whatsappEnabled } from '@/stores/settings'
|
||||
import {
|
||||
createResource,
|
||||
FileUploader,
|
||||
@ -399,38 +400,43 @@ const breadcrumbs = computed(() => {
|
||||
})
|
||||
|
||||
const tabIndex = ref(0)
|
||||
const tabs = [
|
||||
{
|
||||
name: 'Activity',
|
||||
label: __('Activity'),
|
||||
icon: ActivityIcon,
|
||||
},
|
||||
{
|
||||
name: 'Emails',
|
||||
label: __('Emails'),
|
||||
icon: EmailIcon,
|
||||
},
|
||||
{
|
||||
name: 'Calls',
|
||||
label: __('Calls'),
|
||||
icon: PhoneIcon,
|
||||
},
|
||||
{
|
||||
name: 'Tasks',
|
||||
label: __('Tasks'),
|
||||
icon: TaskIcon,
|
||||
},
|
||||
{
|
||||
name: 'Notes',
|
||||
label: __('Notes'),
|
||||
icon: NoteIcon,
|
||||
},
|
||||
{
|
||||
name: 'WhatsApp',
|
||||
label: __('WhatsApp'),
|
||||
icon: WhatsAppIcon,
|
||||
},
|
||||
]
|
||||
|
||||
const tabs = computed(() => {
|
||||
let tabOptions = [
|
||||
{
|
||||
name: 'Activity',
|
||||
label: __('Activity'),
|
||||
icon: ActivityIcon,
|
||||
},
|
||||
{
|
||||
name: 'Emails',
|
||||
label: __('Emails'),
|
||||
icon: EmailIcon,
|
||||
},
|
||||
{
|
||||
name: 'Calls',
|
||||
label: __('Calls'),
|
||||
icon: PhoneIcon,
|
||||
},
|
||||
{
|
||||
name: 'Tasks',
|
||||
label: __('Tasks'),
|
||||
icon: TaskIcon,
|
||||
},
|
||||
{
|
||||
name: 'Notes',
|
||||
label: __('Notes'),
|
||||
icon: NoteIcon,
|
||||
},
|
||||
{
|
||||
name: 'WhatsApp',
|
||||
label: __('WhatsApp'),
|
||||
icon: WhatsAppIcon,
|
||||
condition: () => Boolean(whatsappEnabled.value),
|
||||
}
|
||||
]
|
||||
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||
})
|
||||
|
||||
function validateFile(file) {
|
||||
let extn = file.name.split('.').pop().toLowerCase()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user