/*

@license
dhtmlxScheduler v.5.3.12 Standard

To use dhtmlxScheduler in non-GPL projects (and get Pro version of the product), please obtain Commercial/Enterprise or Ultimate license on our site https://dhtmlx.com/docs/products/dhtmlxScheduler/#licensing or contact us at sales@dhtmlx.com

(c) XB Software Ltd.

*/
Scheduler.plugin(function(e){e.config.year_x=4,e.config.year_y=3,e.xy.year_top=0,e.templates.year_date=function(t){return e.date.date_to_str(e.locale.labels.year_tab+" %Y")(t)},e.templates.year_month=e.date.date_to_str("%F"),e.templates.year_scale_date=e.date.date_to_str("%D"),e.templates.year_tooltip=function(e,t,a){return a.text},function(){var t=function(){return"year"==e._mode};e.dblclick_dhx_month_head=function(a){if(t()){var n=a.target||a.srcElement,i=e._getClassName(n.parentNode)
;if(-1!=i.indexOf("dhx_before")||-1!=i.indexOf("dhx_after"))return!1;for(var r=n;r&&(!r.hasAttribute||!r.hasAttribute("date"));)r=r.parentNode;if(r){var o=this._helpers.parseDate(r.getAttribute("date"));o.setDate(parseInt(n.innerHTML,10));var _=this.date.add(o,1,"day");!this.config.readonly&&this.config.dblclick_create&&this.addEventNow(o.valueOf(),_.valueOf(),a)}}};var a=e.changeEventId;e.changeEventId=function(){a.apply(this,arguments),t()&&this.year_view(!0)}
;var n=e.render_data,i=e.date.date_to_str("%Y/%m/%d"),r=e.date.str_to_date("%Y/%m/%d");e.render_data=function(e){if(!t())return n.apply(this,arguments);for(var a=0;a<e.length;a++)this._year_render_event(e[a])};var o=e.clear_view;e.clear_view=function(){if(!t())return o.apply(this,arguments);var a=e._year_marked_cells,n=null;for(var i in a)a.hasOwnProperty(i)&&(n=a[i],n.className="dhx_month_head",n.removeAttribute("date"));e._year_marked_cells={}},e._hideToolTip=function(){
this._tooltip&&(this._tooltip.style.display="none",this._tooltip.date=new Date(9999,1,1))},e._showToolTip=function(t,a,n,i){if(this._tooltip){if(this._tooltip.date.valueOf()==t.valueOf())return;this._tooltip.innerHTML=""}else{var r=this._tooltip=document.createElement("div");r.className="dhx_year_tooltip",this.config.rtl&&(r.className+=" dhx_tooltip_rtl"),document.body.appendChild(r),r.onclick=e._click.dhx_cal_data}for(var o=this.getEvents(t,this.date.add(t,1,"day")),_="",d=0;d<o.length;d++){
var s=o[d];if(this.filter_event(s.id,s)){var l=s.color?"background:"+s.color+";":"",c=s.textColor?"color:"+s.textColor+";":"";_+="<div class='dhx_tooltip_line' style='"+l+c+"' event_id='"+o[d].id+"'>",_+="<div class='dhx_tooltip_date' style='"+l+c+"'>"+(o[d]._timed?this.templates.event_date(o[d].start_date):"")+"</div>",_+="<div class='dhx_event_icon icon_details'>&nbsp;</div>",_+=this.templates.year_tooltip(o[d].start_date,o[d].end_date,o[d])+"</div>"}}this._tooltip.style.display="",
this._tooltip.style.top="0px",document.body.offsetWidth-a.left-this._tooltip.offsetWidth<0?this._tooltip.style.left=a.left-this._tooltip.offsetWidth+"px":this._tooltip.style.left=a.left+i.offsetWidth+"px",this._tooltip.date=t,this._tooltip.innerHTML=_,document.body.offsetHeight-a.top-this._tooltip.offsetHeight<0?this._tooltip.style.top=a.top-this._tooltip.offsetHeight+i.offsetHeight+"px":this._tooltip.style.top=a.top+"px"},e._year_view_tooltip_handler=function(a){if(t()){
var a=a||event,n=a.target||a.srcElement;"a"==n.tagName.toLowerCase()&&(n=n.parentNode),-1!=e._getClassName(n).indexOf("dhx_year_event")?e._showToolTip(r(n.getAttribute("date")),e.$domHelpers.getOffset(n),a,n):e._hideToolTip()}},e._init_year_tooltip=function(){e._detachDomEvent(e._els.dhx_cal_data[0],"mouseover",e._year_view_tooltip_handler),e.event(e._els.dhx_cal_data[0],"mouseover",e._year_view_tooltip_handler)},e._get_year_cell=function(e){
var t=e.getMonth()+12*(e.getFullYear()-this._min_date.getFullYear())-this.week_starts._month,a=this._els.dhx_cal_data[0].childNodes[t],n=this.week_starts[t]+e.getDate()-1;return a.querySelectorAll(".dhx_year_body tr")[Math.floor(n/7)].querySelectorAll("td")[n%7].querySelector(".dhx_month_head")},e._year_marked_cells={},e._mark_year_date=function(t,a){var n=i(t),r=this._get_year_cell(t);if(r){var o=this.templates.event_class(a.start_date,a.end_date,a)
;e._year_marked_cells[n]||(r.className="dhx_month_head dhx_year_event",r.setAttribute("date",n),e._year_marked_cells[n]=r),r.className+=o?" "+o:""}},e._unmark_year_date=function(e){var t=this._get_year_cell(e);t&&(t.className="dhx_month_head")},e._year_render_event=function(e){var t=e.start_date;for(t=t.valueOf()<this._min_date.valueOf()?this._min_date:this.date.date_part(new Date(t));t<e.end_date;)if(this._mark_year_date(t,e),t=this.date.add(t,1,"day"),
t.valueOf()>=this._max_date.valueOf())return},e.year_view=function(t){var a;if(t&&(a=e.xy.scale_height,e.xy.scale_height=-1),e._els.dhx_cal_header[0].style.display=t?"none":"",e.set_sizes(),t&&(e.xy.scale_height=a),e._table_view=t,!this._load_mode||!this._load())if(t){if(e._init_year_tooltip(),e._reset_year_scale(),e._load_mode&&e._load())return void(e._render_wait=!0);e.render_view_data()}else e._hideToolTip()},e._reset_year_scale=function(){this._cols=[],this._colsS={}
;var t=[],a=this._els.dhx_cal_data[0],n=this.config;a.scrollTop=0,a.innerHTML="";var i=Math.floor(parseInt(a.style.width)/n.year_x),r=Math.floor((parseInt(a.style.height)-e.xy.year_top)/n.year_y);r<190&&(r=190,i=Math.floor((parseInt(a.style.width)-e.xy.scroll_width)/n.year_x));var o=i-11,_=0,d=document.createElement("div"),s=this.date.week_start(e._currentDate());this._process_ignores(s,7,"day",1)
;for(var l=7-(this._ignores_detected||0),c=0,h=0;h<7;h++)this._ignores&&this._ignores[h]||(this._cols[h]=Math.floor(o/(l-c)),this._render_x_header(h,_,s,d),o-=this._cols[h],_+=this._cols[h],c++),s=this.date.add(s,1,"day");d.lastChild.className+=" dhx_scale_bar_last";for(var h=0;h<d.childNodes.length;h++)this._waiAria.yearHeadCell(d.childNodes[h]);for(var u=this.date[this._mode+"_start"](this.date.copy(this._date)),v=u,g=null,h=0;h<n.year_y;h++)for(var f=0;f<n.year_x;f++){
g=document.createElement("div"),g.className="dhx_year_box",g.style.cssText="position:absolute;",g.setAttribute("date",this._helpers.formatDate(u)),g.innerHTML="<div class='dhx_year_month'></div><div class='dhx_year_grid'><div class='dhx_year_week'>"+d.innerHTML+"</div><div class='dhx_year_body'></div></div>";var p=g.querySelector(".dhx_year_month"),m=g.querySelector(".dhx_year_grid"),y=g.querySelector(".dhx_year_week"),x=g.querySelector(".dhx_year_body"),b=e.uid();this._waiAria.yearHeader(p,b),
this._waiAria.yearGrid(m,b),p.innerHTML=this.templates.year_month(u);for(var w=this.date.week_start(u),k=(this._reset_month_scale(x,u,w,6),x.querySelectorAll("td")),D=0;D<k.length;D++)this._waiAria.yearDayCell(k[D]);a.appendChild(g),y.style.height=y.childNodes[0].offsetHeight+"px";var E=Math.round((r-190)/2);g.style.marginTop=E+"px",this.set_xy(g,i-10,r-E-10,i*f+5,r*h+5+e.xy.year_top),t[h*n.year_x+f]=(u.getDay()-(this.config.start_on_monday?1:0)+7)%7,u=this.date.add(u,1,"month")}
var S=this._getNavDateElement();S&&(S.innerHTML=this.templates[this._mode+"_date"](v,u,this._mode)),this.week_starts=t,t._month=v.getMonth(),this._min_date=v,this._max_date=u};var _=e.getActionData;e.getActionData=function(a){if(!t())return _.apply(e,arguments);var n=a?a.target:event.srcElement,i=e._get_year_month_date(n),r=e._get_year_month_cell(n),o=e._get_year_day_indexes(r);return o&&i?(i=e.date.add(i,o.week,"week"),i=e.date.add(i,o.day,"day")):i=null,{date:i,section:null}},
e._get_year_day_indexes=function(t){var a=e._get_year_el_node(t,this._locate_year_month_table);if(!a)return null;for(var n=0,i=0,n=0,r=a.rows.length;n<r;n++){for(var o=a.rows[n].getElementsByTagName("td"),i=0,_=o.length;i<_&&o[i]!=t;i++);if(i<_)break}return n<r?{day:i,week:n}:null},e._get_year_month_date=function(t){var t=e._get_year_el_node(t,e._locate_year_month_root);if(!t)return null;var a=t.getAttribute("date");return a?e.date.week_start(e.date.month_start(r(a))):null},
e._locate_year_month_day=function(t){return-1!=e._getClassName(t).indexOf("dhx_year_event")&&t.hasAttribute&&t.hasAttribute("date")};var d=e._locate_event;e._locate_event=function(t){var a=d.apply(e,arguments);if(!a){var n=e._get_year_el_node(t,e._locate_year_month_day);if(!n||!n.hasAttribute("date"))return null;var i=r(n.getAttribute("date")),o=e.getEvents(i,e.date.add(i,1,"day"));if(!o.length)return null;a=o[0].id}return a},e._locate_year_month_cell=function(e){
return"td"==e.nodeName.toLowerCase()},e._locate_year_month_table=function(e){return"table"==e.nodeName.toLowerCase()},e._locate_year_month_root=function(e){return e.hasAttribute&&e.hasAttribute("date")},e._get_year_month_cell=function(e){return this._get_year_el_node(e,this._locate_year_month_cell)},e._get_year_month_table=function(e){return this._get_year_el_node(e,this._locate_year_month_table)},e._get_year_month_root=function(e){
return this._get_year_el_node(this._get_year_month_table(e),this._locate_year_month_root)},e._get_year_el_node=function(e,t){for(;e&&!t(e);)e=e.parentNode;return e}}()});
//# sourceMappingURL=https://www.contaduria.gov.co/documents/20127/126637/dhtmlxscheduler_year_view.js.map/9efbe223-ff05-bdb7-e8ba-8788a4ce3a0e