fix: show error if no email,phone or website set

This commit is contained in:
Shariq Ansari 2024-01-18 17:27:52 +05:30
parent 35cc734bce
commit 4ebd56b417
3 changed files with 52 additions and 9 deletions

View File

@ -72,19 +72,35 @@
<Tooltip text="Make a call...">
<Button
class="h-7 w-7"
@click="() => makeCall(deal.data.mobile_no)"
@click="
() =>
deal.data.mobile_no
? makeCall(deal.data.mobile_no)
: errorMessage('No mobile number set')
"
>
<PhoneIcon class="h-4 w-4" />
</Button>
</Tooltip>
<Button class="h-7 w-7">
<EmailIcon class="h-4 w-4" @click="openEmailBox()" />
<EmailIcon
class="h-4 w-4"
@click="
deal.data.email
? openEmailBox()
: errorMessage('No email set')
"
/>
</Button>
<Tooltip v-if="deal.data.website" text="Go to website...">
<Tooltip text="Go to website...">
<Button class="h-7 w-7">
<LinkIcon
class="h-4 w-4"
@click="deal.data.website && openWebsite(deal.data.website)"
@click="
deal.data.website
? openWebsite(deal.data.website)
: errorMessage('No website set')
"
/>
</Button>
</Tooltip>
@ -294,6 +310,7 @@ import {
createToast,
setupAssignees,
setupCustomActions,
errorMessage,
} from '@/utils'
import { globalStore } from '@/stores/global'
import { contactsStore } from '@/stores/contacts'

View File

@ -113,19 +113,35 @@
<Tooltip text="Make a call...">
<Button
class="h-7 w-7"
@click="() => makeCall(lead.data.mobile_no)"
@click="
() =>
lead.data.mobile_no
? makeCall(lead.data.mobile_no)
: errorMessage('No phone number set')
"
>
<PhoneIcon class="h-4 w-4" />
</Button>
</Tooltip>
<Button class="h-7 w-7">
<EmailIcon class="h-4 w-4" @click="openEmailBox()" />
<EmailIcon
class="h-4 w-4"
@click="
lead.data.email
? openEmailBox()
: errorMessage('No email set')
"
/>
</Button>
<Tooltip v-if="lead.data.website" text="Go to website...">
<Tooltip text="Go to website...">
<Button class="h-7 w-7">
<LinkIcon
class="h-4 w-4"
@click="openWebsite(lead.data.website)"
@click="
lead.data.website
? openWebsite(lead.data.website)
: errorMessage('No website set')
"
/>
</Button>
</Tooltip>
@ -257,6 +273,7 @@ import {
createToast,
setupAssignees,
setupCustomActions,
errorMessage,
} from '@/utils'
import { globalStore } from '@/stores/global'
import { contactsStore } from '@/stores/contacts'

View File

@ -129,4 +129,13 @@ export function setupCustomActions(data, obj) {
let script = new Function(data._form_script + '\nreturn setupForm')()
let formScript = script(obj)
data._customActions = formScript?.actions || []
}
}
export function errorMessage(title, message) {
createToast({
title: title || 'Error',
text: message,
icon: 'x',
iconClasses: 'text-red-600',
})
}