fix: removed contact store from CallLog.vue
This commit is contained in:
parent
81d5644286
commit
e7a6385b7d
@ -88,6 +88,43 @@ def get_call_log(name):
|
||||
"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
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
@ -157,14 +157,10 @@ import {
|
||||
createResource,
|
||||
Breadcrumbs,
|
||||
} from 'frappe-ui'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { contactsStore } from '@/stores/contacts'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const { getUser } = usersStore()
|
||||
const { contacts, getContact, getLeadContact } = contactsStore()
|
||||
|
||||
const props = defineProps({
|
||||
callLogId: {
|
||||
@ -184,31 +180,6 @@ const callLog = createResource({
|
||||
},
|
||||
transform: (doc) => {
|
||||
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
|
||||
},
|
||||
})
|
||||
@ -232,7 +203,6 @@ function createLead() {
|
||||
}).then((d) => {
|
||||
if (d) {
|
||||
callLog.reload()
|
||||
contacts.reload()
|
||||
router.push({ name: 'Lead', params: { leadId: d } })
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user