Last active
August 27, 2018 09:36
-
-
Save webknjaz/2c9eb201c2d08431e52afa55eca3edae to your computer and use it in GitHub Desktop.
This script helps to pre-populate empty days in Orange HRM time tracking solution (https://www.orangehrm.com/)
This file contains hidden or 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
/* Usage: | |
* First, fill in any absenses and business trips | |
* After that open DevTools (normally F12), and then REPL (Esc), and copy-paste this there + hit Enter | |
* Script will only fill in empty lines, ignoring what you filled in already, so it won't be corrupted | |
*/ | |
function fill_in_day(tbl_row) { | |
$(tbl_row.querySelector('td>input[id$="_inTime"]')).val('09:00') | |
$(tbl_row.querySelector('td>input[id$="_outTime"]')).val('18:00') | |
$(tbl_row.querySelector('td>input[id$="_breakDuration"]')).val('01:00') | |
$(tbl_row.querySelector('td>label[id$="_totalWork"]')).val('08:00') | |
$(tbl_row.querySelector('td>label[id$="_totalWork"]')).text('08:00') | |
$(tbl_row.querySelector('td>label[id$="_totalWork"] ~ input')).val('08:00') | |
} | |
const workday_rows = [...document.querySelectorAll('tr.activeRow:not(.days_off):not(.leave_date):not(.full_day_holiday)')] | |
workday_rows.map(fill_in_day) | |
document.querySelector('form#editTimesheetForm').submit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment