1
0
forked from test/crm

chore: better code

This commit is contained in:
Shariq Ansari 2024-04-24 16:34:06 +05:30
parent 87acb33cb1
commit 47714d68ce
4 changed files with 10 additions and 11 deletions

View File

@ -958,7 +958,7 @@ const defaultActions = computed(() => {
icon: h(PhoneIcon, { class: 'h-4 w-4' }),
label: __('Make a Call'),
onClick: () => makeCall(doc.value.data.mobile_no),
condition: () => Boolean(callEnabled.value),
condition: () => callEnabled.value,
},
{
icon: h(NoteIcon, { class: 'h-4 w-4' }),
@ -974,7 +974,7 @@ const defaultActions = computed(() => {
icon: h(WhatsAppIcon, { class: 'h-4 w-4' }),
label: __('New WhatsApp Message'),
onClick: () => (tabIndex.value = 5),
condition: () => Boolean(whatsappEnabled.value),
condition: () => whatsappEnabled.value,
},
]
return actions.filter((action) =>

View File

@ -452,7 +452,7 @@ const tabs = computed(() => {
name: 'Calls',
label: __('Calls'),
icon: PhoneIcon,
condition: () => Boolean(callEnabled.value),
condition: () => callEnabled.value,
},
{
name: 'Tasks',
@ -468,7 +468,7 @@ const tabs = computed(() => {
name: 'WhatsApp',
label: __('WhatsApp'),
icon: WhatsAppIcon,
condition: () => Boolean(whatsappEnabled.value),
condition: () => whatsappEnabled.value,
},
]
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))

View File

@ -417,7 +417,7 @@ const tabs = computed(() => {
name: 'Calls',
label: __('Calls'),
icon: PhoneIcon,
condition: () => Boolean(callEnabled.value),
condition: () => callEnabled.value,
},
{
name: 'Tasks',
@ -433,8 +433,8 @@ const tabs = computed(() => {
name: 'WhatsApp',
label: __('WhatsApp'),
icon: WhatsAppIcon,
condition: () => Boolean(whatsappEnabled.value),
}
condition: () => whatsappEnabled.value,
},
]
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
})

View File

@ -7,16 +7,15 @@ createResource({
cache: 'Is Whatsapp Enabled',
auto: true,
onSuccess: (data) => {
whatsappEnabled.value = data
whatsappEnabled.value = Boolean(data)
},
})
export const callEnabled = ref(false)
createResource({
url: 'crm.integrations.twilio.api.is_enabled',
cache: 'Is Twilio Enabled',
auto: true,
onSuccess: (data) => {
callEnabled.value = data
callEnabled.value = Boolean(data)
},
})
})