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>
|
||||
</Tooltip>
|
||||
<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" />
|
||||
<span class="">{{ contact.data.email_id }}</span>
|
||||
</div>
|
||||
@ -93,7 +96,8 @@
|
||||
size="xs"
|
||||
:label="contact.data.company_name"
|
||||
:image="
|
||||
getOrganization(contact.data.company_name)?.organization_logo
|
||||
getOrganization(contact.data.company_name)
|
||||
?.organization_logo
|
||||
"
|
||||
/>
|
||||
<span class="">{{ contact.data.company_name }}</span>
|
||||
@ -106,7 +110,9 @@
|
||||
</span>
|
||||
<Button
|
||||
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"
|
||||
label="More"
|
||||
|
||||
@ -70,15 +70,7 @@
|
||||
</Tooltip>
|
||||
<div class="flex gap-1.5">
|
||||
<Tooltip text="Make a call...">
|
||||
<Button
|
||||
class="h-7 w-7"
|
||||
@click="
|
||||
() =>
|
||||
deal.data.mobile_no
|
||||
? makeCall(deal.data.mobile_no)
|
||||
: errorMessage('No mobile number set')
|
||||
"
|
||||
>
|
||||
<Button class="h-7 w-7" @click="triggerCall">
|
||||
<PhoneIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
</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) {
|
||||
updateDeal(name, value, () => {
|
||||
deal.data[name] = value
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { createResource } from 'frappe-ui'
|
||||
import { reactive, computed } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
|
||||
export const organizationsStore = defineStore('crm-organizations', () => {
|
||||
let organizationsByName = reactive({})
|
||||
@ -27,19 +27,8 @@ export const organizationsStore = defineStore('crm-organizations', () => {
|
||||
return organizationsByName[name]
|
||||
}
|
||||
|
||||
function getOrganizationOptions() {
|
||||
return [
|
||||
{ label: '---', value: '' },
|
||||
...organizations.data?.map((org) => ({
|
||||
label: org.name,
|
||||
value: org.name,
|
||||
})),
|
||||
]
|
||||
}
|
||||
|
||||
return {
|
||||
organizations,
|
||||
getOrganizationOptions,
|
||||
getOrganization,
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user