-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UX): Show warnings for skipping/overwriting attendance in request
(cherry picked from commit e112cf8)
- Loading branch information
1 parent
6e232f9
commit f165abc
Showing
4 changed files
with
101 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors | ||
// For license information, please see license.txt | ||
cur_frm.add_fetch('employee', 'company', 'company'); | ||
frappe.ui.form.on("Attendance Request", { | ||
refresh(frm) { | ||
frm.trigger("show_attendance_warnings"); | ||
}, | ||
|
||
frappe.ui.form.on('Attendance Request', { | ||
half_day: function(frm) { | ||
if(frm.doc.half_day == 1){ | ||
frm.set_df_property('half_day_date', 'reqd', true); | ||
} | ||
else{ | ||
frm.set_df_property('half_day_date', 'reqd', false); | ||
show_attendance_warnings(frm) { | ||
if (!frm.is_new() && frm.doc.docstatus === 0) { | ||
frm.dashboard.clear_headline(); | ||
|
||
frm.call("get_attendance_warnings").then((r) => { | ||
frm.dashboard.reset(); | ||
frm.dashboard.add_section( | ||
frappe.render_template("attendance_warnings", { | ||
warnings: r.message || [], | ||
}), | ||
__("Attendance Warnings") | ||
); | ||
frm.dashboard.show(); | ||
}) | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
hrms/hr/doctype/attendance_request/attendance_warnings.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div class="form-message yellow"> | ||
<div>{{__("Attendance for the following dates will be skipped/overwritten on submission")}}</div> | ||
</div> | ||
<table class="table table-bordered table-hover"> | ||
<thead> | ||
<tr> | ||
<th style="width: 20%">{{ __("Date") }}</th> | ||
<th style="width: 20%">{{ __("Action on Submission") }}</th> | ||
<th style="width: 20%">{{ __("Reason") }}</th> | ||
<th style="width: 20%">{{ __("Existing Record") }}</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
{% for(var i=0; i < warnings.length; i++) { %} | ||
<tr> | ||
<td class="small">{{ frappe.datetime.str_to_user(warnings[i].date) }}</td> | ||
<td class="small"> {{ __(warnings[i].action) }} </td> | ||
<td class="small"> {{ __(warnings[i].reason) }} </td> | ||
<td class="small"> {{ warnings[i].record }} </td> | ||
</tr> | ||
{% } %} | ||
</tbody> | ||
</table> |