2020-12-01 07:34:53 +00:00
|
|
|
frappe.ui.form.ControlData = frappe.ui.form.ControlData.extend( {
|
|
|
|
make_input() {
|
2021-03-09 14:58:00 +00:00
|
|
|
this._super();
|
2020-12-01 07:34:53 +00:00
|
|
|
if (this.df.options == 'Phone') {
|
|
|
|
this.setup_phone();
|
|
|
|
}
|
2021-03-09 14:58:00 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-12-01 07:34:53 +00:00
|
|
|
},
|
|
|
|
setup_phone() {
|
|
|
|
if (frappe.phone_call.handler) {
|
2021-02-22 13:58:01 +00:00
|
|
|
let control = this.df.read_only ? '.control-value' : '.control-input';
|
|
|
|
this.$wrapper.find(control)
|
2020-12-01 07:34:53 +00:00
|
|
|
.append(`
|
|
|
|
<span class="phone-btn">
|
|
|
|
<a class="btn-open no-decoration" title="${__('Make a call')}">
|
2020-12-22 07:02:13 +00:00
|
|
|
${frappe.utils.icon('call')}
|
2020-12-01 07:34:53 +00:00
|
|
|
</span>
|
|
|
|
`)
|
|
|
|
.find('.phone-btn')
|
|
|
|
.click(() => {
|
|
|
|
frappe.phone_call.handler(this.get_value(), this.frm);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2020-12-15 15:53:17 +00:00
|
|
|
});
|