/*
@license
dhtmlxScheduler v.4.4.9 Professional Evaluation

This software is covered by DHTMLX Evaluation License. Contact sales@dhtmlx.com to get Commercial or Enterprise license. Usage without proper license is prohibited.

(c) Dinamenta, UAB.
*/
Scheduler.plugin(function(e){!function(){e._grid={sort_rules:{"int":function(e,t,i){return 1*i(e)<1*i(t)?1:-1},str:function(e,t,i){return i(e)<i(t)?1:-1},date:function(e,t,i){return new Date(i(e))<new Date(i(t))?1:-1}},_getObjName:function(e){return"grid_"+e},_getViewName:function(e){return e.replace(/^grid_/,"")}}}(),e.createGridView=function(t){function i(e){return!(void 0!==e&&(1*e!=e||0>e))}var a=t.name||"grid",r=e._grid._getObjName(a);e.config[a+"_start"]=t.from||new Date(0),e.config[a+"_end"]=t.to||new Date(9999,1,1),
e[r]=t,e[r].defPadding=8,e[r].columns=e[r].fields,e[r].unit=t.unit||"month",e[r].step=t.step||1,delete e[r].fields;for(var n=e[r].columns,s=0;s<n.length;s++)i(n[s].width)&&(n[s].initialWidth=n[s].width),i(n[s].paddingLeft)||delete n[s].paddingLeft,i(n[s].paddingRight)||delete n[s].paddingRight;e[r].select=void 0===t.select?!0:t.select,void 0===e.locale.labels[a+"_tab"]&&(e.locale.labels[a+"_tab"]=e[r].label||e.locale.labels.grid_tab),e[r]._selected_divs=[],e.date[a+"_start"]=function(i){return e.date[t.unit+"_start"]?e.date[t.unit+"_start"](i):i;
},e.date["add_"+a]=function(t,i){return e.date.add(t,i*e[r].step,e[r].unit)},e.templates[a+"_date"]=function(t,i){return e.templates.day_date(t)+" - "+e.templates.day_date(i)},e.templates[a+"_full_date"]=function(t,i,r){return e.isOneDayEvent(r)?this[a+"_single_date"](t):e.templates.day_date(t)+" &ndash; "+e.templates.day_date(i)},e.templates[a+"_single_date"]=function(t){return e.templates.day_date(t)+" "+this.event_date(t)},e.templates[a+"_field"]=function(e,t){return t[e]},e.attachEvent("onTemplatesReady",function(){
e.attachEvent("onDblClick",function(t,i){return this._mode==a?(e._click.buttons.details(t),!1):!0}),e.attachEvent("onClick",function(t,i){return this._mode==a&&e[r].select?(e._grid.unselectEvent("",a),e._grid.selectEvent(t,a,i),!1):!0});var t=e.render_data;e.render_data=function(i){return this._mode!=a?t.apply(this,arguments):void e._grid._fill_grid_tab(r)};var i=e.render_view_data;e.render_view_data=function(){var t=e._els.dhx_cal_data[0].lastChild;return this._mode==a&&t&&(e._grid._gridScrollTop=t.scrollTop),
i.apply(this,arguments)}}),e[a+"_view"]=function(t){if(e._grid._sort_marker=null,delete e._gridView,e._grid._gridScrollTop=0,e._rendered=[],e[r]._selected_divs=[],t){var i=null,n=null,s=e[r];s.paging?(i=e.date[a+"_start"](new Date(e._date)),n=e.date["add_"+a](i,1)):(i=e.config[a+"_start"],n=e.config[a+"_end"]),e._min_date=i,e._max_date=n,e._grid.set_full_view(r);var d="";+i>+new Date(0)&&+n<+new Date(9999,1,1)&&(d=e.templates[a+"_date"](i,n)),e._els.dhx_cal_date[0].innerHTML=d,e._gridView=r}}},e.dblclick_dhx_grid_area=function(){
!this.config.readonly&&this.config.dblclick_create&&this.addEventNow()},e._click.dhx_cal_header&&(e._old_header_click=e._click.dhx_cal_header),e._click.dhx_cal_header=function(t){if(e._gridView){var i=t||window.event,a=e._grid._get_target_column(i,e._gridView);e._grid._toggle_sort_state(e._gridView,a.id),e.clear_view(),e._grid._fill_grid_tab(e._gridView)}else if(e._old_header_click)return e._old_header_click.apply(this,arguments)},e._grid.selectEvent=function(t,i,a){if(e.callEvent("onBeforeRowSelect",[t,a])){
var r=e._grid._getObjName(i);e.for_rendered(t,function(t){t.className+=" dhx_grid_event_selected",e[r]._selected_divs.push(t)}),e._select_id=t}},e._grid._unselectDiv=function(e){e.className=e.className.replace(/ dhx_grid_event_selected/,"")},e._grid.unselectEvent=function(t,i){var a=e._grid._getObjName(i);if(a&&e[a]._selected_divs)if(t){for(var r=0;r<e[a]._selected_divs.length;r++)if(e[a]._selected_divs[r].getAttribute("event_id")==t){e._grid._unselectDiv(e[a]._selected_divs[r]),e[a]._selected_divs.slice(r,1);
break}}else{for(var r=0;r<e[a]._selected_divs.length;r++)e._grid._unselectDiv(e[a]._selected_divs[r]);e[a]._selected_divs=[]}},e._grid._get_target_column=function(t,i){var a=t.originalTarget||t.srcElement,r=e._getClassName(a);"dhx_grid_view_sort"==r&&(a=a.parentNode);for(var n=0,s=0;s<a.parentNode.childNodes.length;s++)if(a.parentNode.childNodes[s]==a){n=s;break}return e[i].columns[n]},e._grid._get_sort_state=function(t){var i=e[t];return i.sort},e._grid._toggle_sort_state=function(t,i){var a=this._get_sort_state(t),r=e[t];
a&&a.column==i?a.direction="asc"==a.direction?"desc":"asc":r.sort={column:i,direction:"desc"}},e._grid._get_sort_value_for_column=function(e){var t=null;if(e.template){var i=e.template;t=function(e){return i(e.start_date,e.end_date,e)}}else{var a=e.id;"date"==a&&(a="start_date"),t=function(e){return e[a]}}return t},e._grid.draw_sort_marker=function(t,i){if(e._grid._sort_marker&&(e._grid._sort_marker.className=e._grid._sort_marker.className.replace(/( )?dhx_grid_sort_(asc|desc)/,""),e._grid._sort_marker.removeChild(e._grid._sort_marker.lastChild)),
i){var a=e._grid._get_column_node(t,i.column);a.className+=" dhx_grid_sort_"+i.direction,e._grid._sort_marker=a;var r="<div class='dhx_grid_view_sort' style='left:"+(+a.style.width.replace("px","")-15+a.offsetLeft)+"px'>&nbsp;</div>";a.innerHTML+=r}},e._grid.sort_grid=function(t){t=t||{direction:"desc",value:function(e){return e.start_date},rule:e._grid.sort_rules.date};var i=e.get_visible_events();return i.sort(function(e,i){return t.rule(e,i,t.value)}),"asc"==t.direction&&(i=i.reverse()),i},e._grid.set_full_view=function(t){
if(t){var i=(e.locale.labels,e._grid._print_grid_header(t));e._els.dhx_cal_header[0].innerHTML=i,e._table_view=!0,e.set_sizes()}},e._grid._calcPadding=function(t,i){return(void 0!==t.paddingLeft?1*t.paddingLeft:e[i].defPadding)+(void 0!==t.paddingRight?1*t.paddingRight:e[i].defPadding)},e._grid._getStyles=function(e,t){for(var i=[],a="",r=0;t[r];r++)switch(a=t[r]+":",t[r]){case"text-align":e.align&&i.push(a+e.align);break;case"vertical-align":e.valign&&i.push(a+e.valign);break;case"padding-left":
void 0!==e.paddingLeft&&i.push(a+(e.paddingLeft||"0")+"px");break;case"padding-right":void 0!==e.paddingRight&&i.push(a+(e.paddingRight||"0")+"px")}return i},e._grid._get_column_node=function(t,i){for(var a=-1,r=0;r<t.length;r++)if(t[r].id==i){a=r;break}return 0>a?null:e._obj.querySelectorAll(".dhx_grid_line > div")[a]},e._grid._get_sort_rule=function(t){var i,a=e[t],r=this._get_sort_state(t);if(r){for(var n,s=0;s<a.columns.length;s++)if(a.columns[s].id==r.column){n=a.columns[s];break}if(n){var d=e._grid._get_sort_value_for_column(n),o=n.sort;
"function"!=typeof o&&(o=e._grid.sort_rules[o]||e._grid.sort_rules.str),i={direction:r.direction,rule:o,value:d}}}return i},e._grid._fill_grid_tab=function(t){var i=e[t],a=this._get_sort_state(t),r=this._get_sort_rule(t);r&&e._grid.draw_sort_marker(i.columns,a);for(var n=(e._date,e._grid.sort_grid(r)),s=e[t].columns,d="<div>",o=-2,l=0;l<s.length;l++){var _=e._grid._calcPadding(s[l],t);o+=s[l].width+_,l<s.length-1&&(d+="<div class='dhx_grid_v_border' style='left:"+o+"px'></div>")}d+="</div>";var h=e._waiAria.gridAttrString();
d+="<div class='dhx_grid_area'><table "+h+">";for(var l=0;l<n.length;l++)d+=e._grid._print_event_row(n[l],t);d+="</table></div>",e._els.dhx_cal_data[0].innerHTML=d,e._els.dhx_cal_data[0].lastChild.scrollTop=e._grid._gridScrollTop||0;var c=e._els.dhx_cal_data[0].getElementsByTagName("tr");e._rendered=[];for(var l=0;l<c.length;l++)e._rendered[l]=c[l]},e._grid._getCellContent=function(t,i){var a,r=e.getState().mode;return a=i.template?i.template(t.start_date,t.end_date,t):"date"==i.id?e.templates[r+"_full_date"](t.start_date,t.end_date,t):"start_date"==i.id||"end_date"==i.id?e.templates[r+"_single_date"](t[i.id]):e.templates[r+"_field"](i.id,t);
},e._grid._print_event_row=function(t,i){var a=[];t.color&&a.push("background:"+t.color),t.textColor&&a.push("color:"+t.textColor),t._text_style&&a.push(t._text_style),e[i].rowHeight&&a.push("height:"+e[i].rowHeight+"px");var r="";a.length&&(r="style='"+a.join(";")+"'");for(var n=e[i].columns,s=e.templates.event_class(t.start_date,t.end_date,t),d=e._waiAria.gridRowAttrString(t),o="<tr "+d+" class='dhx_grid_event"+(s?" "+s:"")+"' event_id='"+t.id+"' "+r+">",l=(e._grid._getViewName(i),["text-align","vertical-align","padding-left","padding-right"]),_=0;_<n.length;_++){
var h=e._grid._getCellContent(t,n[_]),c=e._waiAria.gridCellAttrString(t,n[_],h),u=e._grid._getStyles(n[_],l),g=n[_].css?' class="'+n[_].css+'"':"";o+="<td "+c+" style='width:"+n[_].width+"px;"+u.join(";")+"' "+g+">"+h+"</td>"}return o+="<td class='dhx_grid_dummy'></td></tr>"},e._grid._print_grid_header=function(t){for(var i="<div class='dhx_grid_line'>",a=e[t].columns,r=[],n=a.length,s=e._obj.clientWidth-2*a.length-20,d=0;d<a.length;d++){var o=1*a[d].initialWidth;isNaN(o)||""===a[d].initialWidth||null===a[d].initialWidth||"boolean"==typeof a[d].initialWidth?r[d]=null:(n--,
s-=o,r[d]=o)}for(var l=Math.floor(s/n),_=["text-align","padding-left","padding-right"],h=0;h<a.length;h++){var c=r[h]?r[h]:l;a[h].width=c-e._grid._calcPadding(a[h],t);var u=e._grid._getStyles(a[h],_);i+="<div style='width:"+(a[h].width-1)+"px;"+u.join(";")+"'>"+(void 0===a[h].label?a[h].id:a[h].label)+"</div>"}return i+="</div>"}});