Files
erpnext/erpnext/public/js/telephony.js
mergify[bot] 7d3d2eb928 ci: add prettier to pre-commit (backport #40206) (#40362)
* ci: add prettier to pre-commit

(cherry picked from commit 2c16036ef3)

* style: format js files

---------

Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2024-03-11 10:47:18 +05:30

41 lines
1006 B
JavaScript

frappe.ui.form.ControlData = class ControlData extends frappe.ui.form.ControlData {
make_input() {
super.make_input();
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.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);
});
}
}
};