Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: miscellaneous desk UI fixes #1955

Merged
merged 7 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
data: data,
dynamicRowHeight: true,
inlineFilters: true,
layout: "fixed",
layout: "fluid",
cellHeight: 35,
noDataMessage: __("No Data"),
disableReorderColumn: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"column_break_kecn",
"shift",
"marked_attendance_section",
"marked_attendance_html"
"marked_attendance_html",
"column_break_khjs"
],
"fields": [
{
Expand Down Expand Up @@ -124,12 +125,16 @@
"fieldtype": "Link",
"label": "Shift",
"options": "Shift Type"
},
{
"fieldname": "column_break_khjs",
"fieldtype": "Column Break"
}
],
"hide_toolbar": 1,
"issingle": 1,
"links": [],
"modified": "2024-03-27 13:09:37.447557",
"modified": "2024-07-08 20:02:36.408240",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Attendance Tool",
Expand Down
98 changes: 51 additions & 47 deletions hrms/hr/doctype/interview/interview.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,64 @@ frappe.ui.form.on("Interview", {
]);
},

add_custom_buttons: function (frm) {
if (frm.doc.docstatus != 2 && !frm.doc.__islocal) {
if (frm.doc.status === "Pending") {
frm.add_custom_button(
__("Reschedule Interview"),
function () {
frm.events.show_reschedule_dialog(frm);
frm.refresh();
},
__("Actions"),
);
}
add_custom_buttons: async function (frm) {
if (frm.doc.docstatus === 2 || frm.doc.__islocal) return;

const allow_feedback_submission = frm.doc.interview_details.some(
(interviewer) => interviewer.interviewer === frappe.session.user,
if (frm.doc.status === "Pending") {
frm.add_custom_button(
__("Reschedule Interview"),
function () {
frm.events.show_reschedule_dialog(frm);
frm.refresh();
},
__("Actions"),
);
}

frappe.db.get_value(
"Interview Feedback",
{
interviewer: frappe.session.user,
interview: frm.doc.name,
docstatus: 1,
},
"name",
(r) => {
if (Object.keys(r).length === 0) {
const button = frm.add_custom_button(__("Submit Feedback"), function () {
frappe.call({
method: "hrms.hr.doctype.interview.interview.get_expected_skill_set",
args: {
interview_round: frm.doc.interview_round,
},
callback: function (r) {
frm.events.show_feedback_dialog(frm, r.message);
frm.refresh();
},
});
});
const has_submitted_feedback = await frappe.db.get_value(
"Interview Feedback",
{
interviewer: frappe.session.user,
interview: frm.doc.name,
docstatus: ("!=", 2),
},
"name",
)?.message?.name;

if (allow_feedback_submission) {
button.addClass("btn-primary");
} else {
button
.prop("disabled", true)
.attr("title", __("Only interviewers can submit feedback"))
.tooltip({ delay: { show: 600, hide: 100 }, trigger: "hover" });
}
}
},
);
if (has_submitted_feedback) return;

const allow_feedback_submission = frm.doc.interview_details.some(
(interviewer) => interviewer.interviewer === frappe.session.user,
);

if (allow_feedback_submission) {
frm.page.set_primary_action(__("Submit Feedback"), () => {
frm.trigger("submit_feedback");
});
} else {
const button = frm.add_custom_button(__("Submit Feedback"), () => {
frm.trigger("submit_feedback");
});
button
.prop("disabled", true)
.attr("title", __("Only interviewers can submit feedback"))
.tooltip({ delay: { show: 600, hide: 100 }, trigger: "hover" });
}
},

submit_feedback: function (frm) {
frappe.call({
method: "hrms.hr.doctype.interview.interview.get_expected_skill_set",
args: {
interview_round: frm.doc.interview_round,
},
callback: function (r) {
frm.events.show_feedback_dialog(frm, r.message);
frm.refresh();
},
});
},

show_reschedule_dialog: function (frm) {
let d = new frappe.ui.Dialog({
title: "Reschedule Interview",
Expand Down
4 changes: 3 additions & 1 deletion hrms/hr/doctype/job_offer/job_offer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
"reqd": 1
},
{
"fetch_from": "job_applicant.designation",
"fetch_if_empty": 1,
"fieldname": "designation",
"fieldtype": "Link",
"in_list_view": 1,
Expand Down Expand Up @@ -167,7 +169,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2024-03-27 13:09:57.574961",
"modified": "2024-07-08 15:53:30.761581",
"modified_by": "Administrator",
"module": "HR",
"name": "Job Offer",
Expand Down
26 changes: 6 additions & 20 deletions hrms/hr/doctype/leave_control_panel/leave_control_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,30 +185,12 @@ frappe.ui.form.on("Leave Control Panel", {
if (is_checked)
selected_employees.push(frm.employees_datatable.datamanager.data[idx].employee);
});
frm.call({
method: "allocate_leave",
doc: frm.doc,
args: {
employees: selected_employees,
},
freeze: true,
freeze_message: __("Allocating Leave"),
}).then((r) => {
// don't refresh on complete failure
if (r.message.failed && !r.message.success) return;
frm.refresh();
});

hrms.validate_mandatory_fields(frm, selected_employees);
frm.events.show_confirm_dialog(frm, selected_employees);
},

show_confirm_dialog(frm, selected_employees) {
frappe.confirm(
__("Allocate Leave to {0} employee(s)?", [selected_employees.length]),
() => {
frm.events.bulk_allocate_leave(frm, selected_employees);
},
__("Allocate leaves to {0} employee(s)?", [selected_employees.length]),
() => frm.events.bulk_allocate_leave(frm, selected_employees),
);
},

Expand All @@ -221,6 +203,10 @@ frappe.ui.form.on("Leave Control Panel", {
},
freeze: true,
freeze_message: __("Allocating Leave"),
}).then((r) => {
// don't refresh on complete failure
if (r.message.failed && !r.message.success) return;
frm.refresh();
});
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ frappe.ui.form.on("Bulk Salary Structure Assignment", {
__(d),
function () {
const dialog = new frappe.ui.Dialog({
title: __("Set {0} for Selected Employees", [__(d)]),
title: __("Set {0} for selected employees", [__(d)]),
fields: [
{
label: __(d),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@
"label": "Employees HTML"
},
{
"fetch_from": "salary_structure.company",
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "Company",
"read_only": 1,
"reqd": 1
},
{
Expand Down Expand Up @@ -145,7 +147,7 @@
"hide_toolbar": 1,
"issingle": 1,
"links": [],
"modified": "2024-03-27 13:06:42.973162",
"modified": "2024-07-09 19:33:40.135057",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Bulk Salary Structure Assignment",
Expand Down
8 changes: 6 additions & 2 deletions hrms/payroll/doctype/payroll_entry/payroll_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1421,13 +1421,17 @@ def show_payroll_submission_status(submitted, unsubmitted, payroll_entry):
frappe.msgprint(
_("Salary Slips submitted for period from {0} to {1}").format(
payroll_entry.start_date, payroll_entry.end_date
)
),
title=_("Success"),
indicator="green",
)
elif unsubmitted:
frappe.msgprint(
_("Could not submit some Salary Slips: {}").format(
", ".join(get_link_to_form("Salary Slip", entry) for entry in unsubmitted)
)
),
title=_("Failure"),
indicator="red",
)


Expand Down
6 changes: 5 additions & 1 deletion hrms/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,11 @@ def get_payment_days(self, include_holidays_in_total_working_days):
if self.relieving_date:
employee_status = frappe.db.get_value("Employee", self.employee, "status")
if self.relieving_date < getdate(self.start_date) and employee_status != "Left":
frappe.throw(_("Employee relieved on {0} must be set as 'Left'").format(self.relieving_date))
frappe.throw(
_("Employee {0} relieved on {1} must be set as 'Left'").format(
get_link_to_form("Employee", self.employee), formatdate(self.relieving_date)
)
)

payment_days = date_diff(self.actual_end_date, self.actual_start_date) + 1

Expand Down
Loading