fix: link call note
This commit is contained in:
parent
e95d684bfa
commit
0de13b1247
@ -148,7 +148,9 @@ def add_note_to_call_log(call_sid, note):
|
|||||||
if not twilio: return
|
if not twilio: return
|
||||||
|
|
||||||
call_details = twilio.get_call_info(call_sid)
|
call_details = twilio.get_call_info(call_sid)
|
||||||
frappe.db.set_value("CRM Call Log", call_details.parent_call_sid, "note", note)
|
sid = call_sid if call_details.direction == 'inbound' else call_details.parent_call_sid
|
||||||
|
|
||||||
|
frappe.db.set_value("CRM Call Log", sid, "note", note)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
def get_lead_or_deal_from_number(call):
|
def get_lead_or_deal_from_number(call):
|
||||||
|
|||||||
@ -41,11 +41,11 @@
|
|||||||
class="rounded-full"
|
class="rounded-full"
|
||||||
@click="toggleMute"
|
@click="toggleMute"
|
||||||
/>
|
/>
|
||||||
<Button class="rounded-full">
|
<!-- <Button class="rounded-full">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<DialpadIcon class="cursor-pointer rounded-full" />
|
<DialpadIcon class="cursor-pointer rounded-full" />
|
||||||
</template>
|
</template>
|
||||||
</Button>
|
</Button> -->
|
||||||
<Button class="rounded-full">
|
<Button class="rounded-full">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<NoteIcon
|
<NoteIcon
|
||||||
@ -171,7 +171,12 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<NoteModal v-model="showNoteModal" :note="note" @updateNote="updateNote" />
|
<NoteModal
|
||||||
|
v-model="showNoteModal"
|
||||||
|
:note="note"
|
||||||
|
doctype="CRM Call Log"
|
||||||
|
@after="updateNote"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -213,29 +218,13 @@ const note = ref({
|
|||||||
content: '',
|
content: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
async function updateNote(_note) {
|
async function updateNote(_note, insert_mode = false) {
|
||||||
if (_note.name) {
|
note.value = _note
|
||||||
await call('frappe.client.set_value', {
|
if (insert_mode && _note.name) {
|
||||||
doctype: 'CRM Note',
|
await call('crm.twilio.api.add_note_to_call_log', {
|
||||||
name: _note.name,
|
call_sid: _call.value.parameters.CallSid,
|
||||||
fieldname: _note,
|
note: _note.name,
|
||||||
})
|
})
|
||||||
note.value = _note
|
|
||||||
} else {
|
|
||||||
let d = await call('frappe.client.insert', {
|
|
||||||
doc: {
|
|
||||||
doctype: 'CRM Note',
|
|
||||||
title: _note.title,
|
|
||||||
content: _note.content,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if (d.name) {
|
|
||||||
note.value = d
|
|
||||||
await call('crm.twilio.api.add_note_to_call_log', {
|
|
||||||
call_sid: _call.value.parameters.CallSid,
|
|
||||||
note: d.name,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ async function updateNote() {
|
|||||||
})
|
})
|
||||||
if (d.name) {
|
if (d.name) {
|
||||||
notes.value?.reload()
|
notes.value?.reload()
|
||||||
emit('after', d)
|
emit('after', d, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show.value = false
|
show.value = false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user