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/datatables.css") | $raw %]
9 <style> .key { padding : 3px; white-space:nowrap; line-height:230%; }
10 .ui-datepicker { font-size : 150%; }
11 .ui-datepicker th, .ui-datepicker .ui-datepicker-title select { font-size : 80%; }
12 .ui-datepicker td a { padding : .5em; }
13 .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { font-size : 80%; }
14 .key { padding : 3px; white-space:nowrap; line-height:230%; }
15 .normalday { background-color : #EDEDED; color : Black; border : 1px solid #BCBCBC; }
16 .exception { background-color : #b3d4ff; color : Black; border : 1px solid #BCBCBC; }
17 .holiday { background-color : #ffaeae; color : Black; border : 1px solid #BCBCBC; }
18 .repeatableweekly { background-color : #FFFF99; color : Black; border : 1px solid #BCBCBC; }
19 .repeatableyearly { background-color : #FFCC66; color : Black; border : 1px solid #BCBCBC; }
20 td.exception a.ui-state-default { background: #b3d4ff none; color : Black; border : 1px solid #BCBCBC; }
21 td.holiday a.ui-state-default { background: #ffaeae none; color : Black; border : 1px solid #BCBCBC; }
22 td.repeatableweekly a.ui-state-default { background: #FFFF99 none; color : Black; border : 1px solid #BCBCBC; }
23 td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Black; border : 1px solid #BCBCBC; }
24 .information { z-index : 1; background-color : #DCD2F1; width : 300px; display : none; border : 1px solid #000000; color : #000000; font-size : 8pt; font-weight : bold; background-color : #FFD700; cursor : pointer; padding : 2px; }
25 .panel { z-index : 1; display : none; border : 3px solid #CCC; padding : 3px; margin-top: .3em; background-color: #FEFEFE; } fieldset.brief { border : 0; margin-top: 0; }
26 #showHoliday { margin : .5em 0; } h1 select { width: 20em; } fieldset.brief ol { font-size:100%; } fieldset.brief li, fieldset.brief li.radio { padding:0.2em 0; } .help { margin:.3em 0;border:1px solid #EEE;padding:.3em .7em; font-size : 90%; } #holidayweeklyrepeatable, #holidaysyearlyrepeatable, #holidaysunique, #holidayexceptions { font-size : 90%; margin-bottom : 1em;} .calendar td, .calendar th, .calendar .button, .calendar tbody .day { padding : .7em; font-size: 110%; } .calendar { width: auto; border : 0; }
29 <body id="tools_holidays" class="tools">
30 [% INCLUDE 'header.inc' %]
31 [% INCLUDE 'cat-search.inc' %]
33 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% Branches.GetName( branch ) | html %] calendar</div>
35 <div class="main container-fluid">
37 <div class="col-sm-10 col-sm-push-2">
40 <h2>[% Branches.GetName( branch ) | html %] calendar</h2>
43 <div class="col-sm-6">
44 <label for="branch">Define the holidays for:</label>
45 <select id="branch" name="branch">
46 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
49 <!-- ******************************** FLAT PANELS ******************************************* -->
50 <!-- ***** Makes all the flat panel to deal with holidays ***** -->
51 <!-- **************************************************************************************** -->
53 <!-- ********************** Panel for showing already loaded holidays *********************** -->
54 <div class="panel" id="showHoliday">
55 <form action="/cgi-bin/koha/tools/exceptionHolidays.pl" method="post">
56 <input type="hidden" id="showHolidayType" name="showHolidayType" value="" />
57 <fieldset class="brief">
58 <h3>Edit this holiday</h3>
59 <span id="holtype"></span>
62 <strong>Library:</strong> <span id="showBranchNameOutput"></span>
63 <input type="hidden" id="showBranchName" name="showBranchName" />
66 <strong>From date:</strong>
67 <span id="showDaynameOutput"></span>,
69 [% 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 %]
71 <input type="hidden" id="showDayname" name="showDayname" />
72 <input type="hidden" id="showWeekday" name="showWeekday" />
73 <input type="hidden" id="showDay" name="showDay" />
74 <input type="hidden" id="showMonth" name="showMonth" />
75 <input type="hidden" id="showYear" name="showYear" />
77 <li class="dateinsert">
79 <input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange | html %]" class="datepicker"/>
81 <li><label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /></li>
82 <!-- showTitle is necessary for exception radio button to work properly -->
84 <label for="showDescription">Description:</label>
85 <textarea rows="2" cols="40" id="showDescription" name="showDescription"></textarea>
87 <li class="radio"><div id="exceptionPosibility" style="position:static">
88 <input type="radio" name="showOperation" id="showOperationExc" value="exception" /> <label for="showOperationExc">Generate an exception for this repeated holiday.</label>
89 <a href="#" class="helptext">[?]</a>
90 <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>
92 <li class="radio"><input type="radio" name="showOperation" id="showOperationExcRange" value="exceptionrange" />
93 <label for="showOperationExcRange">Generate exceptions on a range of dates.</label>
94 <a href="#" class="helptext">[?]</a>
95 <div class="hint">You can make an exception on a range of dates repeated yearly.</div>
97 <li class="radio"><input type="radio" name="showOperation" id="showOperationDel" value="delete" /> <label for="showOperationDel" id="showOperationDelLabel">Delete this holiday</label>
98 <a href="#" class="helptext">[?]</a>
99 <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>
100 <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>.
101 <a href="#" class="helptext">[?]</a>
102 <div class="hint">This will delete the single holidays rules only. The repeatable holidays and exceptions will not be deleted.</div>
104 <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>.
105 <a href="#" class="helptext">[?]</a>
106 <div class="hint">This will delete the repeated holidays rules only. The repeatable holidays will be deleted but not the exceptions.</div>
108 <li class="radio"><input type="radio" name="showOperation" id="showOperationDelRangeRepeatExcept" value="deleterangerepeatexcept" /> <label for="showOperationDelRangeRepeatExcept" id="showOperationDelLabelRangeRepeatExcept">Delete the exceptions on a range</label>.
109 <a href="#" class="helptext">[?]</a>
110 <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>
112 <li class="radio"><input type="radio" name="showOperation" id="showOperationEdit" value="edit" checked="checked" /> <label for="showOperationEdit">Edit this holiday</label>
113 <a href="#" class="helptext">[?]</a>
114 <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>
116 <fieldset class="action">
117 <input type="submit" name="submit" value="Save" />
118 <a href="#" class="cancel hidePanel showHoliday">Cancel</a>
124 <!-- ***************************** Panel to deal with new holidays ********************** -->
125 <div class="panel" id="newHoliday">
126 <form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
127 <fieldset class="brief">
128 <h3>Add new holiday</h3>
131 <strong>Library:</strong>
132 <span id="newBranchNameOutput"></span>
133 <input type="hidden" id="newBranchName" name="newBranchName" />
136 <strong>From date:</strong>
137 <span id="newDaynameOutput"></span>,
139 [% 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 %]
141 <input type="hidden" id="newDayname" name="showDayname" />
142 <input type="hidden" id="newWeekday" name="newWeekday" />
143 <input type="hidden" id="newDay" name="newDay" />
144 <input type="hidden" id="newMonth" name="newMonth" />
145 <input type="hidden" id="newYear" name="newYear" />
147 <li class="dateinsert">
149 <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange | html %]" class="datepicker" />
151 <li><label for="title">Title: </label><input type="text" name="newTitle" id="title" size="35" /></li>
152 <li><label for="newDescription">Description:</label>
153 <textarea rows="2" cols="40" id="newDescription" name="newDescription"></textarea>
155 <li class="radio"><input type="radio" name="newOperation" id="newOperationOnce" value="holiday" checked="checked" />
156 <label for="newOperationOnce">Holiday only on this day</label>.
157 <a href="#" class="helptext">[?]</a>
158 <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>
160 <li class="radio"><input type="radio" name="newOperation" id="newOperationDay" value="weekday" />
161 <label for="newOperationDay">Holiday repeated every same day of the week</label>.
162 <a href="#" class="helptext">[?]</a>
163 <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>
165 <li class="radio"><input type="radio" name="newOperation" id="newOperationYear" value="repeatable" />
166 <label for="newOperationYear">Holiday repeated yearly on the same date</label>.
167 <a href="#" class="helptext">[?]</a>
168 <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>
170 <li class="radio"><input type="radio" name="newOperation" id="newOperationField" value="holidayrange" />
171 <label for="newOperationField">Holidays on a range</label>.
172 <a href="#" class="helptext">[?]</a>
173 <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>
175 <li class="radio"><input type="radio" name="newOperation" id="newOperationFieldyear" value="holidayrangerepeat" />
176 <label for="newOperationFieldyear">Holidays repeated yearly on a range</label>.
177 <a href="#" class="helptext">[?]</a>
178 <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>
180 <li class="checkbox">
181 <input type="checkbox" name="allBranches" id="allBranches" />
182 <label for="allBranches">Copy to all libraries</label>.
183 <a href="#" class="helptext">[?]</a>
184 <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>
186 <fieldset class="action">
187 <input type="submit" name="submit" value="Save" />
188 <a href="#" class="cancel hidePanel newHoliday">Cancel</a>
194 <!-- *************************************************************************************** -->
195 <!-- ****** END OF FLAT PANELS ****** -->
196 <!-- *************************************************************************************** -->
198 <!-- ************************************************************************************** -->
199 <!-- ****** MAIN SCREEN CODE ****** -->
200 <!-- ************************************************************************************** -->
201 <h3>Calendar information</h3>
202 <div id="jcalendar-container"></div>
204 <div style="margin-top: 2em;">
205 <form action="copy-holidays.pl" method="post">
206 <input type="hidden" name="from_branchcode" value="[% branch | html %]" />
207 <label for="branchcode">Copy holidays to:</label>
208 <select id="branchcode" name="branchcode">
209 <option value=""></option>
210 [% FOREACH l IN Branches.all() %]
211 <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
214 <input type="submit" value="Copy" />
219 <div class="col-sm-6">
223 <li>Search in the calendar the day you want to set as holiday.</li>
224 <li>Click the date to add or edit a holiday.</li>
225 <li>Enter a title and description for the holiday.</li>
226 <li>Specify how the holiday should repeat.</li>
227 <li>Click Save to finish.</li>
231 <span class="key normalday">Working day</span>
232 <span class="key holiday">Unique holiday</span>
233 <span class="key repeatableweekly">Holiday repeating weekly</span>
234 <span class="key repeatableyearly">Holiday repeating yearly</span>
235 <span class="key exception">Holiday exception</span>
238 <div id="holiday-list">
239 <!-- Exceptions First -->
240 <!-- this will probably always have the least amount of data -->
241 [% IF ( EXCEPTION_HOLIDAYS_LOOP ) %]
243 <table id="holidayexceptions">
245 <th class="exception">Date</th>
246 <th class="exception">Title</th>
247 <th class="exception">Description</th>
251 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
253 <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% EXCEPTION_HOLIDAYS_LOO.DATE | uri %]"><span title="[% EXCEPTION_HOLIDAYS_LOO.DATE_SORT | html %]">[% EXCEPTION_HOLIDAYS_LOO.DATE | html %]</span></a></td>
254 <td>[% EXCEPTION_HOLIDAYS_LOO.TITLE | html %]</td>
255 <td>[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
262 [% IF ( WEEK_DAYS_LOOP ) %]
263 <h3>Weekly - Repeatable holidays</h3>
264 <table id="holidayweeklyrepeatable">
267 <th class="repeatableweekly">Day of week</th>
268 <th class="repeatableweekly">Title</th>
269 <th class="repeatableweekly">Description</th>
273 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
275 <td>[% WEEK_DAYS_LOO.KEY | html %]</td>
277 <td>[% WEEK_DAYS_LOO.TITLE | html %]</td>
278 <td>[% WEEK_DAYS_LOO.DESCRIPTION | html %]</td>
285 [% IF ( DAY_MONTH_HOLIDAYS_LOOP ) %]
286 <h3>Yearly - Repeatable holidays</h3>
287 <table id="holidaysyearlyrepeatable">
290 [% IF ( dateformat == "metric" ) %]
291 <th class="repeatableyearly">Day/month</th>
293 <th class="repeatableyearly">Month/day</th>
295 <th class="repeatableyearly">Title</th>
296 <th class="repeatableyearly">Description</th>
300 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
302 <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.DATE | html %]</span></td>
303 <td>[% DAY_MONTH_HOLIDAYS_LOO.TITLE | html %]</td>
304 <td>[% DAY_MONTH_HOLIDAYS_LOO.DESCRIPTION | html %]</td>
311 [% IF ( HOLIDAYS_LOOP ) %]
312 <h3>Unique holidays</h3>
313 <table id="holidaysunique">
316 <th class="holiday">Date</th>
317 <th class="holiday">Title</th>
318 <th class="holiday">Description</th>
322 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
324 <td><a href="/cgi-bin/koha/tools/holidays.pl?branch=[% branch | uri %]&calendardate=[% HOLIDAYS_LOO.DATE | uri %]"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.DATE | html %]</span></a></td>
325 <td>[% HOLIDAYS_LOO.TITLE | html %]</td>
326 <td>[% HOLIDAYS_LOO.DESCRIPTION.replace('\\\r\\\n', '<br />') | html %]</td>
337 </div> <!-- /.col-sm-10.col-sm-push-2 -->
339 <div class="col-sm-2 col-sm-pull-10">
341 [% INCLUDE 'tools-menu.inc' %]
343 </div> <!-- .col-sm-2.col-sm-pull-10 -->
344 </div> <!-- /.row -->
346 [% MACRO jsinclude BLOCK %]
347 [% INCLUDE 'calendar.inc' %]
348 [% INCLUDE 'datatables.inc' %]
349 [% Asset.js("js/tools-menu.js") | $raw %]
351 var weekdays = new Array(_("Sundays"),_("Mondays"),_("Tuesdays"),_("Wednesdays"),_("Thursdays"),_("Fridays"),_("Saturdays"));
353 /* Creates all the structures to deal with all different kinds of holidays */
354 var week_days = new Array();
355 var holidays = new Array();
356 var holidates = new Array();
357 var exception_holidays = new Array();
358 var day_month_holidays = new Array();
359 var hola= "[% code | html %]";
360 [% FOREACH WEEK_DAYS_LOO IN WEEK_DAYS_LOOP %]
361 week_days["[% WEEK_DAYS_LOO.KEY | html %]"] = {title:"[% WEEK_DAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% WEEK_DAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
363 [% FOREACH HOLIDAYS_LOO IN HOLIDAYS_LOOP %]
364 holidates.push("[% HOLIDAYS_LOO.KEY | html %]");
365 holidays["[% HOLIDAYS_LOO.KEY | html %]"] = {title:"[% HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
367 [% FOREACH EXCEPTION_HOLIDAYS_LOO IN EXCEPTION_HOLIDAYS_LOOP %]
368 exception_holidays["[% EXCEPTION_HOLIDAYS_LOO.KEY | html %]"] = {title:"[% EXCEPTION_HOLIDAYS_LOO.TITLE | replace('"','\"') | html %]", description:"[% EXCEPTION_HOLIDAYS_LOO.DESCRIPTION | replace('"','\"') | html %]"};
370 [% FOREACH DAY_MONTH_HOLIDAYS_LOO IN DAY_MONTH_HOLIDAYS_LOOP %]
371 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 %]"};
374 function holidayOperation(formObject, opType) {
375 var op = document.getElementsByName('operation');
376 op[0].value = opType;
380 // This function shows the "Show Holiday" panel //
381 function showHoliday (exceptionPosibility, dayName, day, month, year, weekDay, title, description, holidayType) {
382 $("#newHoliday").slideUp("fast");
383 $("#showHoliday").slideDown("fast");
384 $('#showDaynameOutput').html(dayName);
385 $('#showDayname').val(dayName);
386 $('#showBranchNameOutput').html($("#branch :selected").text());
387 $('#showBranchName').val($("#branch").val());
388 $('#showDayOutput').html(day);
389 $('#showDay').val(day);
390 $('#showMonthOutput').html(month);
391 $('#showMonth').val(month);
392 $('#showYearOutput').html(year);
393 $('#showYear').val(year);
394 $('#showDescription').val(description);
395 $('#showWeekday:first').val(weekDay);
396 $('#showTitle').val(title);
397 $('#showHolidayType').val(holidayType);
399 if (holidayType == 'exception') {
400 $("#showOperationDelLabel").html(_("Delete this exception."));
401 $("#holtype").attr("class","key exception").html(_("Holiday exception"));
402 } else if(holidayType == 'weekday') {
403 $("#showOperationDelLabel").html(_("Delete this holiday."));
404 $("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly"));
405 } else if(holidayType == 'daymonth') {
406 $("#showOperationDelLabel").html(_("Delete this holiday."));
407 $("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly"));
409 $("#showOperationDelLabel").html(_("Delete this holiday."));
410 $("#holtype").attr("class","key holiday").html(_("Unique holiday"));
413 if (exceptionPosibility == 1) {
414 $("#exceptionPosibility").parent().show();
416 $("#exceptionPosibility").parent().hide();
420 // This function shows the "Add Holiday" panel //
421 function newHoliday (dayName, day, month, year, weekDay) {
422 $("#showHoliday").slideUp("fast");
423 $("#newHoliday").slideDown("fast");
424 $("#newDaynameOutput").html(dayName);
425 $("#newDayname").val(dayName);
426 $("#newBranchNameOutput").html($('#branch :selected').text());
427 $("#newBranchName").val($('#branch').val());
428 $("#newDayOutput").html(day);
429 $("#newDay").val(day);
430 $("#newMonthOutput").html(month);
431 $("#newMonth").val(month);
432 $("#newYearOutput").html(year);
433 $("#newYear").val(year);
434 $("#newWeekday:first").val(weekDay);
437 function hidePanel(aPanelName) {
438 $("#"+aPanelName).slideUp("fast");
441 function changeBranch () {
442 var branch = $("#branch option:selected").val();
443 location.href='/cgi-bin/koha/tools/holidays.pl?branch=' + branch + '&calendardate=' + "[% calendardate | html %]";
447 newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes');
450 /* This function gives css clases to each kind of day */
451 function dateStatusHandler(date) {
452 date = new Date(date);
453 var day = date.getDate();
454 var month = date.getMonth() + 1;
455 var year = date.getFullYear();
456 var weekDay = date.getDay();
457 var dayMonth = month + '/' + day;
458 var dateString = year + '/' + month + '/' + day;
459 if (exception_holidays[dateString] != null) {
460 return [true, "exception", _("Exception: %s").format(exception_holidays[dateString].title)];
461 } else if ( week_days[weekDay] != null ){
462 return [true, "repeatableweekly", _("Weekly holiday: %s").format(week_days[weekDay].title)];
463 } else if ( day_month_holidays[dayMonth] != null ) {
464 return [true, "repeatableyearly", _("Yearly holiday: %s").format(day_month_holidays[dayMonth].title)];
465 } else if (holidays[dateString] != null) {
466 return [true, "holiday", _("Single holiday: %s").format(holidays[dateString].title)];
468 return [true, "normalday", _("Normal day")];
472 /* This function is in charge of showing the correct panel considering the kind of holiday */
473 function dateChanged(calendar) {
474 calendar = new Date(calendar);
475 var day = calendar.getDate();
476 var month = calendar.getMonth() + 1;
477 var year = calendar.getFullYear();
478 var weekDay = calendar.getDay();
479 var dayName = weekdays[weekDay];
480 var dayMonth = month + '/' + day;
481 var dateString = year + '/' + month + '/' + day;
482 if (holidays[dateString] != null) {
483 showHoliday(0, dayName, day, month, year, weekDay, holidays[dateString].title, holidays[dateString].description, 'ymd');
484 } else if (exception_holidays[dateString] != null) {
485 showHoliday(0, dayName, day, month, year, weekDay, exception_holidays[dateString].title, exception_holidays[dateString].description, 'exception');
486 } else if (week_days[weekDay] != null) {
487 showHoliday(1, dayName, day, month, year, weekDay, week_days[weekDay].title, week_days[weekDay].description, 'weekday');
488 } else if (day_month_holidays[dayMonth] != null) {
489 showHoliday(1, dayName, day, month, year, weekDay, day_month_holidays[dayMonth].title, day_month_holidays[dayMonth].description, 'daymonth');
491 newHoliday(dayName, day, month, year, weekDay);
495 $(document).ready(function() {
498 $("#branch").change(function(){
501 $("#holidayweeklyrepeatable>tbody>tr").each(function(){
502 var first_td = $(this).find('td').first();
503 first_td.html(weekdays[first_td.html()]);
505 $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, {
509 $("#holidayexceptions,#holidaysyearlyrepeatable,#holidaysunique").dataTable($.extend(true, {}, dataTablesDefaults, {
512 { "sType": "title-string" },null,null
516 $("a.helptext").click(function(){
517 $(this).parent().find(".hint").toggle(); return false;
519 $("#dateofrange").datepicker({
520 beforeShow: function() {
521 var startdate = $("#jcalendar-container").datepicker("getDate");
522 if (startdate !== null) {
523 var sd = new Date(startdate);
524 var ed = new Date($(this).datepicker("getDate"));
526 $(this).datepicker("setDate", startdate);
527 $(this).datepicker("option", "defaultDate", startdate);
532 $("#datecancelrange").datepicker();
533 $("#dateofrange").each(function () { this.value = "" });
534 $("#datecancelrange").each(function () { this.value = "" });
535 $("#jcalendar-container").datepicker({
536 beforeShowDay: function(thedate) {
537 var day = thedate.getDate();
538 var month = thedate.getMonth() + 1;
539 var year = thedate.getFullYear();
540 var dateString = year + '/' + month + '/' + day;
541 return dateStatusHandler(dateString);
543 onSelect: function(dateText, inst) {
544 dateChanged($(this).datepicker("getDate"));
545 var enddate = $("#dateofrange").datepicker("getDate");
546 $("#dateofrange").datepicker("option", "defaultDate", $(this).datepicker("getDate"));
547 if (enddate !== null) {
548 var ed = new Date(enddate);
549 var sd = new Date($(this).datepicker("getDate"));
551 $("#dateofrange").datepicker("setDate", $(this).datepicker("getDate"));
552 $("#dateofrange").datepicker("option", "defaultDate", enddate);
556 defaultDate: new Date("[% keydate | html %]")
558 $(".hidePanel").on("click",function(){
559 if( $(this).hasClass("showHoliday") ){
560 hidePanel("showHoliday");
562 hidePanel("newHoliday");
569 [% INCLUDE 'intranet-bottom.inc' %]