commit
abc4ecc65b
@ -88,6 +88,43 @@ def get_call_log(name):
|
|||||||
"content": note[1]
|
"content": note[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_contact(number):
|
||||||
|
c = frappe.db.get_value("Contact", {"mobile_no": number}, ["full_name", "image"], as_dict=True)
|
||||||
|
if c:
|
||||||
|
return [c.full_name, c.image]
|
||||||
|
return [None, None]
|
||||||
|
|
||||||
|
def get_lead_contact(number):
|
||||||
|
l = frappe.db.get_value("CRM Lead", {"mobile_no": number, "converted": 0}, ["lead_name", "image"], as_dict=True)
|
||||||
|
if l:
|
||||||
|
return [l.lead_name, l.image]
|
||||||
|
return [None, None]
|
||||||
|
|
||||||
|
def get_user(user):
|
||||||
|
u = frappe.db.get_value("User", user, ["full_name", "user_image"], as_dict=True)
|
||||||
|
if u:
|
||||||
|
return [u.full_name, u.user_image]
|
||||||
|
return [None, None]
|
||||||
|
|
||||||
|
if doc.type == "Incoming":
|
||||||
|
doc.caller = {
|
||||||
|
"label": get_contact(doc.get("from"))[0] or get_lead_contact(doc.get("from"))[0] or "Unknown",
|
||||||
|
"image": get_contact(doc.get("from"))[1] or get_lead_contact(doc.get("from"))[1]
|
||||||
|
}
|
||||||
|
doc.receiver = {
|
||||||
|
"label": get_user(doc.get("receiver"))[0],
|
||||||
|
"image": get_user(doc.get("receiver"))[1]
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
doc.caller = {
|
||||||
|
"label": get_user(doc.get("caller"))[0],
|
||||||
|
"image": get_user(doc.get("caller"))[1]
|
||||||
|
}
|
||||||
|
doc.receiver = {
|
||||||
|
"label": get_contact(doc.get("to"))[0] or get_lead_contact(doc.get("to"))[0] or "Unknown",
|
||||||
|
"image": get_contact(doc.get("to"))[1] or get_lead_contact(doc.get("to"))[1]
|
||||||
|
}
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
@ -262,6 +262,6 @@ class TwilioCallDetails:
|
|||||||
'id': self.call_sid,
|
'id': self.call_sid,
|
||||||
'from': from_number,
|
'from': from_number,
|
||||||
'to': to_number,
|
'to': to_number,
|
||||||
'reciever': receiver,
|
'receiver': receiver,
|
||||||
'caller': caller,
|
'caller': caller,
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@
|
|||||||
<div id="value" class="!min-w-[140px]">
|
<div id="value" class="!min-w-[140px]">
|
||||||
<component
|
<component
|
||||||
:is="getValSelect(f)"
|
:is="getValSelect(f)"
|
||||||
:value="f.value"
|
v-model="f.value"
|
||||||
@change="(v) => updateValue(v, f)"
|
@change="(v) => updateValue(v, f)"
|
||||||
placeholder="Value"
|
placeholder="Value"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -157,14 +157,10 @@ import {
|
|||||||
createResource,
|
createResource,
|
||||||
Breadcrumbs,
|
Breadcrumbs,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { usersStore } from '@/stores/users'
|
|
||||||
import { contactsStore } from '@/stores/contacts'
|
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { getUser } = usersStore()
|
|
||||||
const { contacts, getContact, getLeadContact } = contactsStore()
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
callLogId: {
|
callLogId: {
|
||||||
@ -184,31 +180,6 @@ const callLog = createResource({
|
|||||||
},
|
},
|
||||||
transform: (doc) => {
|
transform: (doc) => {
|
||||||
doc.duration = secondsToDuration(doc.duration)
|
doc.duration = secondsToDuration(doc.duration)
|
||||||
if (doc.type === 'Incoming') {
|
|
||||||
doc.caller = {
|
|
||||||
label:
|
|
||||||
getContact(doc.from)?.full_name ||
|
|
||||||
getLeadContact(doc.from)?.full_name ||
|
|
||||||
'Unknown',
|
|
||||||
image: getContact(doc.from)?.image || getLeadContact(doc.from)?.image,
|
|
||||||
}
|
|
||||||
doc.receiver = {
|
|
||||||
label: getUser(doc.receiver).full_name,
|
|
||||||
image: getUser(doc.receiver).user_image,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
doc.caller = {
|
|
||||||
label: getUser(doc.caller).full_name,
|
|
||||||
image: getUser(doc.caller).user_image,
|
|
||||||
}
|
|
||||||
doc.receiver = {
|
|
||||||
label:
|
|
||||||
getContact(doc.to)?.full_name ||
|
|
||||||
getLeadContact(doc.to)?.full_name ||
|
|
||||||
'Unknown',
|
|
||||||
image: getContact(doc.to)?.image || getLeadContact(doc.to)?.image,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return doc
|
return doc
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -232,7 +203,6 @@ function createLead() {
|
|||||||
}).then((d) => {
|
}).then((d) => {
|
||||||
if (d) {
|
if (d) {
|
||||||
callLog.reload()
|
callLog.reload()
|
||||||
contacts.reload()
|
|
||||||
router.push({ name: 'Lead', params: { leadId: d } })
|
router.push({ name: 'Lead', params: { leadId: d } })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user