fix: Show audio interface in call log which has recording URL

- Also, remove unneccesary column & section break in call log doctype
This commit is contained in:
Suraj Shetty
2021-02-08 18:45:55 +05:30
parent 723e6dd73f
commit ba26020a82
2 changed files with 34 additions and 19 deletions

View File

@@ -2,7 +2,26 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Call Log', { frappe.ui.form.on('Call Log', {
// refresh: function(frm) { refresh: function(frm) {
frm.events.setup_recording_audio_control(frm);
// } const incoming_call = frm.doc.type == 'Incoming';
frm.add_custom_button(incoming_call ? __('Callback'): __('Call Again'), () => {
const number = incoming_call ? frm.doc.from : frm.doc.to;
frappe.phone_call.handler(number, frm);
});
},
setup_recording_audio_control(frm) {
const recording_wrapper = frm.get_field('recording_html').$wrapper;
if (!frm.doc.recording_url || frm.doc.recording_url == 'null') {
recording_wrapper.empty();
} else {
recording_wrapper.addClass('input-max-width');
recording_wrapper.html(`
<audio
controls
src="${frm.doc.recording_url}">
</audio>
`);
}
}
}); });

View File

@@ -5,6 +5,7 @@
"doctype": "DocType", "doctype": "DocType",
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"call_details_section",
"id", "id",
"from", "from",
"to", "to",
@@ -21,20 +22,9 @@
"section_break_11", "section_break_11",
"summary", "summary",
"section_break_19", "section_break_19",
"links", "links"
"column_break_3",
"section_break_5"
], ],
"fields": [ "fields": [
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"label": "Call Details"
},
{ {
"fieldname": "id", "fieldname": "id",
"fieldtype": "Data", "fieldtype": "Data",
@@ -75,6 +65,7 @@
{ {
"fieldname": "recording_url", "fieldname": "recording_url",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1,
"label": "Recording URL" "label": "Recording URL"
}, },
{ {
@@ -112,13 +103,13 @@
}, },
{ {
"fieldname": "summary", "fieldname": "summary",
"fieldtype": "Small Text", "fieldtype": "Small Text"
"label": "Call Summary"
}, },
{ {
"fieldname": "section_break_11", "fieldname": "section_break_11",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hide_border": 1 "hide_border": 1,
"label": "Call Summary"
}, },
{ {
"fieldname": "start_time", "fieldname": "start_time",
@@ -138,12 +129,17 @@
"label": "Customer", "label": "Customer",
"options": "Customer", "options": "Customer",
"read_only": 1 "read_only": 1
},
{
"fieldname": "call_details_section",
"fieldtype": "Section Break",
"label": "Call Details"
} }
], ],
"in_create": 1, "in_create": 1,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2021-01-13 12:28:20.288985", "modified": "2021-02-08 14:23:28.744844",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Telephony", "module": "Telephony",
"name": "Call Log", "name": "Call Log",