5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Tools › [% Branches.GetName( branch ) | html %] calendar</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/calendar.css") | $raw %]
10 <body id="tools_holidays" class="tools">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
14 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23 <a href="#" aria-current="page">
24 [% Branches.GetName( branch ) | html %] calendar
30 <div class="main container-fluid">
32 <div class="col-sm-10 col-sm-push-2">
35 <h2>[% Branches.GetName( branch ) | html %] calendar</h2>
38 <div class="col-sm-6">
39 <label for="branch">Define the holidays for:</label>
40 <select id="branch" name="branch">
41 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
44 <!-- ******************************** FLAT PANELS ******************************************* -->
45 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
46 <!-- **************************************************************************************** -->
48 <!-- ********************** Panel for showing already loaded holidays *********************** -->
49 <div class="panel" id="showHoliday">
50 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
51 <input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
52 <fieldset class="brief">
53 <h3>Edit this holiday</h3>
54 <span id="holtype"></span>
57 <strong>Library:</strong> <span id="showBranchNameOutput"></span>
58 <input type="hidden" id="showBranchName" name="showBranchName" />
61 <strong>From date:</strong>
62 <span id="showDaynameOutput"></span>,
64 [% IF ( dateformat == "us" ) %]<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "metric") %]<span id="showDayOutput"></span>/<span id="showMonthOutput"></span>/<span id="showYearOutput"></span>[% ELSIF ( dateformat == "dmydot") %]<span id="showDayOutput"></span>.<span id="showMonthOutput"></span>.<span id="showYearOutput"></span>[% ELSE %]<span id="showYearOutput"></span>/<span id="showMonthOutput"></span>/<span id="showDayOutput"></span>[% END %]
66 <input type="hidden" id="showDayname" name="showDayname" />
67 <input type="hidden" id="showWeekday" name="showWeekday" />
68 <input type="hidden" id="showDay" name="showDay" />
69 <input type="hidden" id="showMonth" name="showMonth" />
70 <input type="hidden" id="showYear" name="showYear" />
72 <li class="dateinsert">
73 <strong>To date: </strong>
74 <input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange | html %]" class="datepicker"/>
76 <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
77 <!-- showTitle is necessary for exception radio button to work properly -->
79 <label for="showDescription">Description:</label>
80 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
82 <li class="radio"><div class="exceptionPossibility" style="position:static">
83 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception for this repeated holiday.</label>
84 <a href="#" class="helptext">[?]</a>
85 <div class="hint">You can make an exception for this holiday rule. This means that you will be able to say that for a repeatable holiday there is one day which is going to be an exception.</div>
87 <li class="radio"><div class="exceptionPossibility" style="position:static">
88 <input type="radio" name="showOperation" id="showOperationExcRange" value="exceptionrange" />
89 <label for="showOperationExcRange">Generate exceptions on a range of dates.</label>
90 <a href="#" class="helptext">[?]</a>
91 <div class="hint">You can make an exception on a range of dates repeated yearly.</div>
93 <li class="radio"><input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
94 <a href="#" class="helptext">[?]</a>
95 <div class="hint">This will delete this holiday rule. If it is a repeatable holiday, this option checks for possible exceptions. If an exception exists, this option will remove the exception and set the date to a regular holiday.</div></li>
96 <li class="radio"><input type="radio" name="showOperation" id="showOperationDelRange" value="deleterange" /> <label for="showOperationDelRange" id="showOperationDelLabelRange">Delete the single holidays on a range</label>.
97 <a href="#" class="helptext">[?]</a>
98 <div class="hint">This will delete the single holidays rules only. The repeatable holidays and exceptions will not be deleted.</div>
100 <li class="radio"><input type="radio" name="showOperation" id="showOperationDelRangeRepeat" value="deleterangerepeat" /> <label for="showOperationDelRangeRepeat" id="showOperationDelLabelRangeRepeat">Delete the repeated holidays on a range</label>.
101 <a href="#" class="helptext">[?]</a>
102 <div class="hint">This will delete the repeated holidays rules only. The repeatable holidays will be deleted but not the exceptions.</div>
104 <li class="radio"><input type="radio" name="showOperation" id="showOperationDelRangeRepeatExcept" value="deleterangerepeatexcept" /> <label for="showOperationDelRangeRepeatExcept" id="showOperationDelLabelRangeRepeatExcept">Delete the exceptions on a range</label>.
105 <a href="#" class="helptext">[?]</a>
106 <div class="hint">This will delete the exceptions inside a given range. Be careful about your scope range; if it is oversized you could slow down Koha.</div>
108 <li class="radio"><input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
109 <a href="#" class="helptext">[?]</a>
110 <div class="hint">This will save changes to the holiday's title and description. If the information for a repeatable holiday is modified, it affects all of the dates on which the holiday is repeated.</div></li>
111 <li class="checkbox">
112 <input type="checkbox" name="allBranches" id="allBranches" />
113 <label for="allBranches">Copy changes to all libraries</label>.
114 <a href="#" class="helptext">[?]</a>
115 <div class="hint">If checked, changes for this holiday will be copied to all libraries. If the holiday doesn't exists for a library, no change is made.</div>
118 <fieldset class="action">
119 <input type="submit" name="submit" value="Save" />
120 <a href="#" class="cancel hidePanel showHoliday">Cancel</a>
126 <!-- ***************************** Panel to deal with new holidays ********************** -->
127 <div class="panel" id="newHoliday">
128 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
129 <fieldset class="brief">
130 <h3>Add new holiday</h3>
133 <strong>Library:</strong>
134 <span id="newBranchNameOutput"></span>
135 <input type="hidden" id="newBranchName" name="newBranchName" />
138 <strong>From date:</strong>
139 <span id="newDaynameOutput"></span>,
141 [% IF ( dateformat == "us" ) %]<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "metric" ) %]<span id="newDayOutput"></span>/<span id="newMonthOutput"></span>/<span id="newYearOutput"></span>[% ELSIF ( dateformat == "dmydot" ) %]<span id="newDayOutput"></span>.<span id="newMonthOutput"></span>.<span id="newYearOutput"></span>[% ELSE %]<span id="newYearOutput"></span>/<span id="newMonthOutput"></span>/<span id="newDayOutput"></span>[% END %]
143 <input type="hidden" id="newDayname" name="showDayname" />
144 <input type="hidden" id="newWeekday" name="newWeekday" />
145 <input type="hidden" id="newDay" name="newDay" />
146 <input type="hidden" id="newMonth" name="newMonth" />
147 <input type="hidden" id="newYear" name="newYear" />
149 <li class="dateinsert">
150 <strong>To date: </strong>
151 <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange | html %]" class="datepicker" />
153 <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
154 <li><label for="newDescription">Description:</label>
155 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
157 <li class="radio"><input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
158 <label for="newOperationOnce">Holiday only on this day</label>.
159 <a href="#" class="helptext">[?]</a>
160 <div class="hint">Make a single holiday. For example, selecting August 1, 2012 will make it a holiday, but will not affect August 1 in other years.</div>
162 <li class="radio"><input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
163 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
164 <a href="#" class="helptext">[?]</a>
165 <div class="hint">Make this weekday a holiday, every week. For example, if your library is closed on Saturdays, use this option to make every Saturday a holiday.</div>
167 <li class="radio"><input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
168 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
169 <a href="#" class="helptext">[?]</a>
170 <div class="hint">This will take this day and month as a reference to make it a holiday. Through this option, you can repeat this rule for every year. For example, selecting August 1 will make August 1 a holiday every year.</div>
172 <li class="radio"><input type="radio" name="newOperation" id="newOperationField" value="holidayrange" />
173 <label for="newOperationField">Holidays on a range</label>.
174 <a href="#" class="helptext">[?]</a>
175 <div class="hint">Make a single holiday on a range. For example, selecting August 1, 2012 and August 10, 2012 will make all days between August 1 and 10 a holiday, but will not affect August 1-10 in other years.</div>
177 <li class="radio"><input type="radio" name="newOperation" id="newOperationFieldyear" value="holidayrangerepeat" />
178 <label for="newOperationFieldyear">Holidays repeated yearly on a range</label>.
179 <a href="#" class="helptext">[?]</a>
180 <div class="hint">Make a single holiday on a range repeated yearly. For example, selecting August 1, 2012 and August 10, 2012 will make all days between August 1 and 10 a holiday, and will affect August 1-10 in other years.</div>
182 <li class="checkbox">
183 <input type="checkbox" name="allBranches" id="allBranches" />
184 <label for="allBranches">Copy to all libraries</label>.
185 <a href="#" class="helptext">[?]</a>
186 <div class="hint">If checked, this holiday will be copied to all libraries. If the holiday already exists for a library, no change is made.</div>
188 <fieldset class="action">
189 <input type="submit" name="submit" value="Save" />
190 <a href="#" class="cancel hidePanel newHoliday">Cancel</a>
196 <!-- *************************************************************************************** -->
197 <!-- ****** END OF FLAT PANELS ****** -->
198 <!-- *************************************************************************************** -->
200 <!-- ************************************************************************************** -->
201 <!-- ****** MAIN SCREEN CODE ****** -->
202 <!-- ************************************************************************************** -->
203 <h3>Calendar information</h3>
204 <div id="jcalendar-container"></div>
206 <div style="margin-top: 2em;">
207 <form action="copy-holidays.pl" method="post">
208 <input type="hidden" name="from_branchcode" value="[% branch | html %]" />
209 <label for="branchcode">Copy holidays to:</label>
210 <select id="branchcode" name="branchcode">
211 <option value=""></option>
212 [% FOREACH l IN Branches.all() %]
213 <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
216 <input type="submit" value="Copy" />
221 <div class="col-sm-6">
225 <li>Search in the calendar the day you want to set as holiday.</li>
226 <li>Click the date to add or edit a holiday.</li>
227 <li>Enter a title and description for the holiday.</li>
228 <li>Specify how the holiday should repeat.</li>
229 <li>Click Save to finish.</li>
233 <span class="key normalday">Working day</span>
234 <span class="key holiday">Unique holiday</span>
235 <span class="key repeatableweekly">Holiday repeating weekly</span>
236 <span class="key repeatableyearly">Holiday repeating yearly</span>
237 <span class="key exception">Holiday exception</span>
240 <div id="holiday-list">
241 <!-- Exceptions First -->
242 <!-- this will probably always have the least amount of data -->
243 [% IF ( EXCEPTION_HOLIDAYS_LOOP ) %]
245 <label class="controls">
246 <input type="checkbox" name="show_past" id="show_past_holidayexceptions" class="show_past" />
249 <table id="holidayexceptions">
251 <th class="exception">Date</th>
252 <th class="exception">Title</th>
253 <th class="exception">Description</th>
257 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
258 <tr data-date="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]">
259 <td data-order="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]">
260 <a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE | uri %]">
261 [% EXCEPTION_HOLIDAYS_LOO.DATE | html %]
264 <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE | html %]</td>
265 <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
272 [% IF ( WEEK_DAYS_LOOP ) %]
273 <h3>Weekly - Repeatable holidays</h3>
274 <table id="holidayweeklyrepeatable">
277 <th class="repeatableweekly">Day of week</th>
278 <th class="repeatableweekly">Title</th>
279 <th class="repeatableweekly">Description</th>
283 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
285 <td>[% WEEK_DAYS_LOO.KEY | html %]</td>
287 <td>[% WEEK_DAYS_LOO.TITLE | html %]</td>
288 <td>[% WEEK_DAYS_LOO.DESCRIPTION | html %]</td>
295 [% IF ( DAY_MONTH_HOLIDAYS_LOOP ) %]
296 <h3>Yearly - Repeatable holidays</h3>
297 <table id="holidaysyearlyrepeatable">
300 [% IF ( dateformat == "metric" ) %]
301 <th class="repeatableyearly">Day/month</th>
303 <th class="repeatableyearly">Month/day</th>
305 <th class="repeatableyearly">Title</th>
306 <th class="repeatableyearly">Description</th>
310 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
312 <td data-order="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">
313 [% DAY_MONTH_HOLIDAYS_LOO.DATE | html %]
315 <td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE | html %]</td>
316 <td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
323 [% IF ( HOLIDAYS_LOOP ) %]
324 <h3>Unique holidays</h3>
325 <label class="controls">
326 <input type="checkbox" name="show_past" id="show_past_holidaysunique" class="show_past" />
329 <table id="holidaysunique">
332 <th class="holiday">Date</th>
333 <th class="holiday">Title</th>
334 <th class="holiday">Description</th>
338 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
339 <tr data-date="[% HOLIDAYS_LOO.DATE_SORT | html %]">
340 <td data-order="[% HOLIDAYS_LOO.DATE_SORT | html %]">
341 <a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% HOLIDAYS_LOO.DATE | uri %]">
342 [% HOLIDAYS_LOO.DATE | html %]
345 <td>[% HOLIDAYS_LOO.TITLE | html %]</td>
346 <td>[% HOLIDAYS_LOO.DESCRIPTION.replace('\\\r\\\n', '<br />') | html %]</td>
357 </div> <!-- /.col-sm-10.col-sm-push-2 -->
359 <div class="col-sm-2 col-sm-pull-10">
361 [% INCLUDE 'tools-menu.inc' %]
363 </div> <!-- .col-sm-2.col-sm-pull-10 -->
364 </div> <!-- /.row -->
366 [% MACRO jsinclude BLOCK %]
367 [% INCLUDE 'calendar.inc' %]
368 [% INCLUDE 'datatables.inc' %]
369 [% Asset.js("js/tools-menu.js") | $raw %]
371 var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays"));
373 /* Creates all the structures to deal with all different kinds of holidays */
374 var week_days = new Array();
375 var holidays = new Array();
376 var holidates = new Array();
377 var exception_holidays = new Array();
378 var day_month_holidays = new Array();
379 var hola= "[% code | html %]";
380 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
381 week_days["[% WEEK_DAYS_LOO.KEY | html %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
383 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
384 holidates.push("[% HOLIDAYS_LOO.KEY | html %]");
385 holidays["[% HOLIDAYS_LOO.KEY | html %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
387 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
388 exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY | html %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
390 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
391 day_month_holidays["[% DAY_MONTH_HOLIDAYS_LOO.KEY | html %]"] = {title:"[% DAY_MONTH_HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
394 function holidayOperation(formObject, opType) {
395 var op = document.getElementsByName('operation');
396 op[0].value = opType;
400 // This function shows the "Show Holiday" panel //
401 function showHoliday (exceptionPossibility, dayName, day, month, year, weekDay, title, description, holidayType) {
402 $("#newHoliday").slideUp("fast");
403 $("#showHoliday").slideDown("fast");
404 $('#showDaynameOutput').html(dayName);
405 $('#showDayname').val(dayName);
406 $('#showBranchNameOutput').html($("#branch :selected").text());
407 $('#showBranchName').val($("#branch").val());
408 $('#showDayOutput').html(day);
409 $('#showDay').val(day);
410 $('#showMonthOutput').html(month);
411 $('#showMonth').val(month);
412 $('#showYearOutput').html(year);
413 $('#showYear').val(year);
414 $('#showDescription').val(description);
415 $('#showWeekday:first').val(weekDay);
416 $('#showTitle').val(title);
417 $('#showHolidayType').val(holidayType);
419 if (holidayType == 'exception') {
420 $("#showOperationDelLabel").html(_("Delete this exception."));
421 $("#holtype").attr("class","key exception").html(_("Holiday exception"));
422 } else if(holidayType == 'weekday') {
423 $("#showOperationDelLabel").html(_("Delete this holiday."));
424 $("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly"));
425 } else if(holidayType == 'daymonth') {
426 $("#showOperationDelLabel").html(_("Delete this holiday."));
427 $("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly"));
429 $("#showOperationDelLabel").html(_("Delete this holiday."));
430 $("#holtype").attr("class","key holiday").html(_("Unique holiday"));
433 if (exceptionPossibility == 1) {
434 $(".exceptionPossibility").parent().show();
436 $(".exceptionPossibility").parent().hide();
440 // This function shows the "Add Holiday" panel //
441 function newHoliday (dayName, day, month, year, weekDay) {
442 $("#showHoliday").slideUp("fast");
443 $("#newHoliday").slideDown("fast");
444 $("#newDaynameOutput").html(dayName);
445 $("#newDayname").val(dayName);
446 $("#newBranchNameOutput").html($('#branch :selected').text());
447 $("#newBranchName").val($('#branch').val());
448 $("#newDayOutput").html(day);
449 $("#newDay").val(day);
450 $("#newMonthOutput").html(month);
451 $("#newMonth").val(month);
452 $("#newYearOutput").html(year);
453 $("#newYear").val(year);
454 $("#newWeekday:first").val(weekDay);
457 function hidePanel(aPanelName) {
458 $("#"+aPanelName).slideUp("fast");
461 function changeBranch () {
462 var branch = $("#branch option:selected").val();
463 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate | html %]";
467 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
470 /* This function gives css clases to each kind of day */
471 function dateStatusHandler(date) {
472 date = new Date(date);
473 var day = date.getDate();
474 var month = date.getMonth() + 1;
475 var year = date.getFullYear();
476 var weekDay = date.getDay();
477 var dayMonth = month + '/' + day;
478 var dateString = year + '/' + month + '/' + day;
479 if (exception_holidays[dateString] != null) {
480 return [true, "exception", _("Exception: %s").format(exception_holidays[dateString].title)];
481 } else if ( week_days[weekDay] != null ){
482 return [true, "repeatableweekly", _("Weekly holiday: %s").format(week_days[weekDay].title)];
483 } else if ( day_month_holidays[dayMonth] != null ) {
484 return [true, "repeatableyearly", _("Yearly holiday: %s").format(day_month_holidays[dayMonth].title)];
485 } else if (holidays[dateString] != null) {
486 return [true, "holiday", _("Single holiday: %s").format(holidays[dateString].title)];
488 return [true, "normalday", _("Normal day")];
492 /* This function is in charge of showing the correct panel considering the kind of holiday */
493 function dateChanged(calendar) {
494 calendar = new Date(calendar);
495 var day = calendar.getDate();
496 var month = calendar.getMonth() + 1;
497 var year = calendar.getFullYear();
498 var weekDay = calendar.getDay();
499 var dayName = weekdays[weekDay];
500 var dayMonth = month + '/' + day;
501 var dateString = year + '/' + month + '/' + day;
502 if (holidays[dateString] != null) {
503 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd');
504 } else if (exception_holidays[dateString] != null) {
505 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
506 } else if (week_days[weekDay] != null) {
507 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday');
508 } else if (day_month_holidays[dayMonth] != null) {
509 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
511 newHoliday(dayName, day, month, year, weekDay);
515 /* Custom table search configuration: If a table row
516 has an "expired" class, hide it UNLESS the
517 show_expired checkbox is checked */
518 $.fn.dataTable.ext.search.push(
519 function( settings, searchData, index, rowData, counter ) {
520 var table = settings.nTable.id;
521 var row = $(settings.aoData[index].nTr);
522 if( row.hasClass("date_past") && !$("#show_past_" + table ).prop("checked") ){
530 // Create current date variable
531 var date = new Date();
532 var datestring = date.toISOString().substring(0, 10);
534 $(document).ready(function() {
537 $("#branch").change(function(){
540 $("#holidayweeklyrepeatable>tbody>tr").each(function(){
541 var first_td = $(this).find('td').first();
542 first_td.html(weekdays[first_td.html()]);
544 $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, {
548 var tables = $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").DataTable($.extend(true, {}, dataTablesDefaults, {
551 "createdRow": function( row, data, dataIndex ) {
552 var holiday = $(row).data("date");
553 if( holiday < datestring ){
554 $(row).addClass("date_past");
559 $(".show_past").on("change", function(){
563 $("a.helptext").click(function(){
564 $(this).parent().find(".hint").toggle(); return false;
566 $("#dateofrange").datepicker({
567 beforeShow: function() {
568 var startdate = $("#jcalendar-container").datepicker("getDate");
569 if (startdate !== null) {
570 var sd = new Date(startdate);
571 var ed = new Date($(this).datepicker("getDate"));
573 $(this).datepicker("setDate", startdate);
574 $(this).datepicker("option", "defaultDate", startdate);
579 $("#datecancelrange").datepicker();
580 $("#dateofrange").each(function () { this.value = "" });
581 $("#datecancelrange").each(function () { this.value = "" });
582 $("#jcalendar-container").datepicker({
583 beforeShowDay: function(thedate) {
584 var day = thedate.getDate();
585 var month = thedate.getMonth() + 1;
586 var year = thedate.getFullYear();
587 var dateString = year + '/' + month + '/' + day;
588 return dateStatusHandler(dateString);
590 onSelect: function(dateText, inst) {
591 dateChanged($(this).datepicker("getDate"));
592 var enddate = $("#dateofrange").datepicker("getDate");
593 $("#dateofrange").datepicker("option", "defaultDate", $(this).datepicker("getDate"));
594 $("#dateofrange").datepicker( "option", "minDate", $(this).datepicker("getDate")); //ensure end date can't be before start date
595 if (enddate !== null) {
596 var ed = new Date(enddate);
597 var sd = new Date($(this).datepicker("getDate"));
599 $("#dateofrange").datepicker("setDate", $(this).datepicker("getDate"));
600 $("#dateofrange").datepicker("option", "defaultDate", enddate);
604 defaultDate: new Date("[% keydate | html %]")
606 $(".hidePanel").on("click",function(){
607 if( $(this).hasClass("showHoliday") ){
608 hidePanel("showHoliday");
610 hidePanel("newHoliday");
617 [% INCLUDE 'intranet-bottom.inc' %]