/*
@license
dhtmlxScheduler v.5.1.6 Stardard

This software is covered by GPL license. You also can obtain Commercial or Enterprise license to use it in non-GPL project - please contact sales@dhtmlx.com. Usage without proper license is prohibited.

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