Skip to content

Commit c33cd5c

Browse files
krishna-254mergify[bot]
authored andcommitted
refactor(employee): remove anniversary indicator logic from employee form
(cherry picked from commit 1f19175)
1 parent eadf78d commit c33cd5c

1 file changed

Lines changed: 0 additions & 57 deletions

File tree

erpnext/setup/doctype/employee/employee.js

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ frappe.ui.form.on("Employee", {
4646
refresh: function (frm) {
4747
frm.fields_dict.date_of_birth.datepicker.update({ maxDate: new Date() });
4848

49-
frm.trigger("add_anniversary_indicator");
50-
5149
if (!frm.is_new() && !frm.doc.user_id) {
5250
frm.add_custom_button(__("Create User"), () => {
5351
const dialog = new frappe.ui.Dialog({
@@ -97,61 +95,6 @@ frappe.ui.form.on("Employee", {
9795
}
9896
},
9997

100-
date_of_birth: function (frm) {
101-
frm.trigger("add_anniversary_indicator");
102-
},
103-
104-
date_of_joining: function (frm) {
105-
frm.trigger("add_anniversary_indicator");
106-
},
107-
108-
add_anniversary_indicator: function (frm) {
109-
if (!frm.sidebar || !frm.sidebar.sidebar) return;
110-
111-
let $sidebar = frm.sidebar.sidebar;
112-
let $indicator_section = $sidebar.find(".anniversary-indicator-section");
113-
114-
if (!$indicator_section.length) {
115-
$indicator_section = $(`
116-
<div class="sidebar-section anniversary-indicator-section border-bottom">
117-
<div class="anniversary-content"></div>
118-
</div>
119-
`).insertAfter($sidebar.find(".sidebar-meta-details"));
120-
}
121-
122-
let content = "";
123-
let today = moment().startOf("day");
124-
125-
if (frm.doc.date_of_birth) {
126-
let dob = moment(frm.doc.date_of_birth);
127-
if (dob.date() === today.date() && dob.month() === today.month()) {
128-
content += `<div class="mb-1"><span class="indicator green"></span> ${__(
129-
"Today is their Birthday!"
130-
)}</div>`;
131-
}
132-
}
133-
134-
if (frm.doc.date_of_joining) {
135-
let doj = moment(frm.doc.date_of_joining);
136-
if (doj.date() === today.date() && doj.month() === today.month()) {
137-
let years = today.year() - doj.year();
138-
if (years > 0) {
139-
content += `<div class="mb-1"><span class="indicator green"></span> ${__(
140-
"Today is their {0} Year Work Anniversary!",
141-
[years]
142-
)}</div>`;
143-
}
144-
}
145-
}
146-
147-
if (content) {
148-
$indicator_section.find(".anniversary-content").html(content);
149-
$indicator_section.show();
150-
} else {
151-
$indicator_section.hide();
152-
}
153-
},
154-
15598
prefered_contact_email: function (frm) {
15699
frm.events.update_contact(frm);
157100
},

0 commit comments

Comments
 (0)