fix: Show audio interface in call log which has recording URL
- Also, remove unneccesary column & section break in call log doctype
diff --git a/erpnext/telephony/doctype/call_log/call_log.js b/erpnext/telephony/doctype/call_log/call_log.js
index 977f86d..e7afa0b 100644
--- a/erpnext/telephony/doctype/call_log/call_log.js
+++ b/erpnext/telephony/doctype/call_log/call_log.js
@@ -2,7 +2,26 @@
// For license information, please see license.txt
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>
+ `);
+ }
+ }
});
diff --git a/erpnext/telephony/doctype/call_log/call_log.json b/erpnext/telephony/doctype/call_log/call_log.json
index 1ecd884..1d6c39e 100644
--- a/erpnext/telephony/doctype/call_log/call_log.json
+++ b/erpnext/telephony/doctype/call_log/call_log.json
@@ -5,6 +5,7 @@
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
+ "call_details_section",
"id",
"from",
"to",
@@ -21,21 +22,10 @@
"section_break_11",
"summary",
"section_break_19",
- "links",
- "column_break_3",
- "section_break_5"
+ "links"
],
"fields": [
{
- "fieldname": "column_break_3",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "section_break_5",
- "fieldtype": "Section Break",
- "label": "Call Details"
- },
- {
"fieldname": "id",
"fieldtype": "Data",
"label": "ID",
@@ -75,6 +65,7 @@
{
"fieldname": "recording_url",
"fieldtype": "Data",
+ "hidden": 1,
"label": "Recording URL"
},
{
@@ -112,13 +103,13 @@
},
{
"fieldname": "summary",
- "fieldtype": "Small Text",
- "label": "Call Summary"
+ "fieldtype": "Small Text"
},
{
"fieldname": "section_break_11",
"fieldtype": "Section Break",
- "hide_border": 1
+ "hide_border": 1,
+ "label": "Call Summary"
},
{
"fieldname": "start_time",
@@ -138,12 +129,17 @@
"label": "Customer",
"options": "Customer",
"read_only": 1
+ },
+ {
+ "fieldname": "call_details_section",
+ "fieldtype": "Section Break",
+ "label": "Call Details"
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2021-01-13 12:28:20.288985",
+ "modified": "2021-02-08 14:23:28.744844",
"modified_by": "Administrator",
"module": "Telephony",
"name": "Call Log",