zhuangxujie 01bc837fd4
Some checks failed
Server (Postgres) / Build & reinstall (setup) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (1) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (2) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (3) (push) Has been cancelled
Server (Postgres) / Python Unit Tests (4) (push) Has been cancelled
Server (Mariadb) / Build & reinstall (setup) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (1) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (2) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (3) (push) Has been cancelled
Server (Mariadb) / Python Unit Tests (4) (push) Has been cancelled
Server (Mariadb) / Coverage Wrap Up (push) Has been cancelled
Lock threads / lock (push) Has been cancelled
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Has been cancelled
Regenerate POT file (translatable strings) / Regenerate POT file (version-16-hotfix) (push) Has been cancelled
Sync translations to hotfix branches / Trigger sync → version-16-hotfix (push) Has been cancelled
Create weekly release pull requests / Release (15) (push) Has been cancelled
Create weekly release pull requests / Release (16) (push) Has been cancelled
first commit
2026-07-23 16:31:28 +08:00

41 lines
1007 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("phone")}
</span>
`
)
.find(".phone-btn")
.click(() => {
frappe.phone_call.handler(this.get_value(), this.frm);
});
}
}
};