fix: make call from deal doesn't work if contact is updated
This commit is contained in:
parent
7b8a15d224
commit
080c07b22b
@ -60,7 +60,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<div class="flex items-center gap-2 text-base text-gray-700">
|
<div class="flex items-center gap-2 text-base text-gray-700">
|
||||||
<div v-if="contact.data.email_id" class="flex items-center gap-1.5">
|
<div
|
||||||
|
v-if="contact.data.email_id"
|
||||||
|
class="flex items-center gap-1.5"
|
||||||
|
>
|
||||||
<EmailIcon class="h-4 w-4" />
|
<EmailIcon class="h-4 w-4" />
|
||||||
<span class="">{{ contact.data.email_id }}</span>
|
<span class="">{{ contact.data.email_id }}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -93,7 +96,8 @@
|
|||||||
size="xs"
|
size="xs"
|
||||||
:label="contact.data.company_name"
|
:label="contact.data.company_name"
|
||||||
:image="
|
:image="
|
||||||
getOrganization(contact.data.company_name)?.organization_logo
|
getOrganization(contact.data.company_name)
|
||||||
|
?.organization_logo
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<span class="">{{ contact.data.company_name }}</span>
|
<span class="">{{ contact.data.company_name }}</span>
|
||||||
@ -106,7 +110,9 @@
|
|||||||
</span>
|
</span>
|
||||||
<Button
|
<Button
|
||||||
v-if="
|
v-if="
|
||||||
contact.data.email_id || contact.data.mobile_no || contact.data.company_name
|
contact.data.email_id ||
|
||||||
|
contact.data.mobile_no ||
|
||||||
|
contact.data.company_name
|
||||||
"
|
"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
label="More"
|
label="More"
|
||||||
|
|||||||
@ -70,15 +70,7 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
<div class="flex gap-1.5">
|
<div class="flex gap-1.5">
|
||||||
<Tooltip text="Make a call...">
|
<Tooltip text="Make a call...">
|
||||||
<Button
|
<Button class="h-7 w-7" @click="triggerCall">
|
||||||
class="h-7 w-7"
|
|
||||||
@click="
|
|
||||||
() =>
|
|
||||||
deal.data.mobile_no
|
|
||||||
? makeCall(deal.data.mobile_no)
|
|
||||||
: errorMessage('No mobile number set')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<PhoneIcon class="h-4 w-4" />
|
<PhoneIcon class="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@ -563,6 +555,18 @@ async function setPrimaryContact(contact) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function triggerCall() {
|
||||||
|
let primaryContact = deal.data.contacts.find((c) => c.is_primary)
|
||||||
|
let contact = primaryContact
|
||||||
|
? getContactByName(primaryContact.contact)
|
||||||
|
: deal.data.contacts[0]
|
||||||
|
? getContactByName(deal.data.contacts[0].contact)
|
||||||
|
: null
|
||||||
|
primaryContact
|
||||||
|
? makeCall(contact.mobile_no)
|
||||||
|
: errorMessage('No primary contact set')
|
||||||
|
}
|
||||||
|
|
||||||
function updateField(name, value, callback) {
|
function updateField(name, value, callback) {
|
||||||
updateDeal(name, value, () => {
|
updateDeal(name, value, () => {
|
||||||
deal.data[name] = value
|
deal.data[name] = value
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { createResource } from 'frappe-ui'
|
import { createResource } from 'frappe-ui'
|
||||||
import { reactive, computed } from 'vue'
|
import { reactive } from 'vue'
|
||||||
|
|
||||||
export const organizationsStore = defineStore('crm-organizations', () => {
|
export const organizationsStore = defineStore('crm-organizations', () => {
|
||||||
let organizationsByName = reactive({})
|
let organizationsByName = reactive({})
|
||||||
@ -27,19 +27,8 @@ export const organizationsStore = defineStore('crm-organizations', () => {
|
|||||||
return organizationsByName[name]
|
return organizationsByName[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrganizationOptions() {
|
|
||||||
return [
|
|
||||||
{ label: '---', value: '' },
|
|
||||||
...organizations.data?.map((org) => ({
|
|
||||||
label: org.name,
|
|
||||||
value: org.name,
|
|
||||||
})),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
organizations,
|
organizations,
|
||||||
getOrganizationOptions,
|
|
||||||
getOrganization,
|
getOrganization,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user