brotherton-erpnext/erpnext/public/js/telephony.js
Shariq Ansari 261c42186f
fix: updating phone icon setup logic for readonly fields (#24787)
* fix: updating phone icon setup logic for readonly fields

* fix: sider fix
2021-03-09 20:28:00 +05:30

34 lines
927 B
JavaScript

frappe.ui.form.ControlData = frappe.ui.form.ControlData.extend( {
make_input() {
this._super();
if (this.df.options == 'Phone') {
this.setup_phone();
}
if (this.frm && this.frm.fields_dict) {
Object.values(this.frm.fields_dict).forEach(function(field) {
if (field.df.read_only === 1 && field.df.options === 'Phone'
&& field.disp_area.style[0] != 'display' && !field.has_icon) {
field.setup_phone();
field.has_icon = true;
}
});
}
},
setup_phone() {
if (frappe.phone_call.handler) {
let control = this.df.read_only ? '.control-value' : '.control-input';
this.$wrapper.find(control)
.append(`
<span class="phone-btn">
<a class="btn-open no-decoration" title="${__('Make a call')}">
${frappe.utils.icon('call')}
</span>
`)
.find('.phone-btn')
.click(() => {
frappe.phone_call.handler(this.get_value(), this.frm);
});
}
}
});