Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions frontend/src/pages/Deal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ watch(error, (err) => {
errorTitle.value = __(
err.exc_type == 'DoesNotExistError'
? 'Document not found'
: 'Error occurred',
: 'Error occurred'
)
errorMessage.value = __(err.messages?.[0] || 'An error occurred')
} else {
Expand Down Expand Up @@ -456,7 +456,7 @@ watch(
document._statuses = s.statuses || []
}
},
{ once: true },
{ once: true }
)

const organizationDocument = ref(null)
Expand All @@ -467,12 +467,12 @@ watch(
if (org && !organizationDocument.value?.doc) {
let { document: _organizationDocument } = useDocument(
'CRM Organization',
org,
org
)
organizationDocument.value = _organizationDocument
}
},
{ immediate: true },
{ immediate: true }
)

const organization = computed(() => organizationDocument.value?.doc || {})
Expand Down Expand Up @@ -637,6 +637,15 @@ function contactOptions(contact) {
},
]

// Add Call option for each linked contact (uses global makeCall)
if (contact.mobile_no) {
options.unshift({
label: __('Call'),
icon: h(PhoneIcon, { class: 'h-4 w-4' }),
onClick: () => makeCall(contact.mobile_no),
})
}

if (!contact.is_primary) {
options.push({
label: __('Set as Primary Contact'),
Expand Down
28 changes: 21 additions & 7 deletions frontend/src/pages/MobileDeal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
document.statuses?.length
? document.statuses
: document._statuses,
triggerStatusChange,
triggerStatusChange
)
"
>
Expand Down Expand Up @@ -318,7 +318,7 @@ import { ref, computed, h, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'

const { brand } = getSettings()
const { $dialog, $socket } = globalStore()
const { $dialog, $socket, makeCall } = globalStore()
const { statusOptions, getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('CRM Deal')
const route = useRoute()
Expand All @@ -337,7 +337,7 @@ const showDeleteLinkedDocModal = ref(false)

const { triggerOnChange, assignees, document, scripts, error } = useDocument(
'CRM Deal',
props.dealId,
props.dealId
)

const doc = computed(() => document.doc || {})
Expand All @@ -347,7 +347,7 @@ watch(error, (err) => {
errorTitle.value = __(
err.exc_type == 'DoesNotExistError'
? 'Document not found'
: 'Error occurred',
: 'Error occurred'
)
errorMessage.value = __(err.messages?.[0] || 'An error occurred')
} else {
Expand Down Expand Up @@ -375,7 +375,7 @@ watch(
document._statuses = s.statuses || []
}
},
{ once: true },
{ once: true }
)

const reload = ref(false)
Expand Down Expand Up @@ -520,7 +520,21 @@ function contactOptions(contact) {
},
]

if (!contact.is_primary) {
// Add Call option for each linked contact (uses global makeCall)
const phone =
typeof contact === 'string'
? dealContacts.data?.find((c) => c.name === contact)?.mobile_no
: contact?.mobile_no

if (phone) {
options.unshift({
label: __('Call'),
icon: h(PhoneIcon, { class: 'h-4 w-4' }),
onClick: () => makeCall(phone),
})
}

if (typeof contact !== 'string' && !contact.is_primary) {
options.push({
label: __('Set as Primary Contact'),
icon: h(SuccessIcon, { class: 'h-4 w-4' }),
Expand Down Expand Up @@ -576,7 +590,7 @@ const dealContacts = createResource({
auto: true,
onSuccess: (data) => {
let contactSection = sections.data?.find(
(section) => section.name == 'contacts_section',
(section) => section.name == 'contacts_section'
)
if (!contactSection) return
contactSection.contacts = data.map((contact) => {
Expand Down