js-pkg
Version:
Npm package of Syncfusion.JavaScript.
10 lines • 715 kB
JavaScript
/*!
* filename: ej.schedule.min.js
* version : 15.3.0.33
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
(function(n){typeof define=="function"&&define.amd?define(["./../common/ej.globalize.min","jsrender","./../common/ej.core.min","./../common/ej.data.min","./../common/ej.touch.min","./../common/ej.draggable.min","./../common/ej.scroller.min","./ej.button.min","./ej.checkbox.min","./ej.autocomplete.min","./ej.datepicker.min","./ej.dialog.min","./ej.dropdownlist.min","./ej.togglebutton.min","./ej.radiobutton.min","./ej.timepicker.min","./ej.editor.min","./ej.navigationdrawer.min","./ej.recurrenceeditor.min","./ej.tooltip.min"],n):n()})(function(){(function(n,t){t.scheduleFeatures=t.scheduleFeatures||{};var i=function(){return"{{if multiRes == true}}<td class = 'e-horizontalheader'><div class='e-horizontalresheader'>{{:label}}<\/div><\/td>{{else}}{{/if}}<td class='e-horizontaldaterender'><div class='e-horizontaltimecells {{:heightclass}}'><div class='e-headerdays' style='position:absolute;'><table class ='e-table {{:tablelayout}}'style='width:100%;border-collapse:separate;table-layout:fixed;'><tbody>{{if view !== 'month'}}<tr style='width:100%;'> <td>{{if view === 'day'}}<table style='width:100%;'>{{else}}<table class='e-table'>{{/if}}<tbody><tr> {{for cols ~headercellWidth = headercellWidth}}<td class='e-headercells {{:cellToday}} e-horizontalheadertddate'><div class='{{:currentDateClass}} e-horizontalheaderdiv'>{{:currentDay}}<\/div><\/td>{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr><tr style='width:100%;position:absolute;'> <td><table class ='e-table e-horizontaltabletimecell' style='border-collapse:collapse;'><tbody><tr> {{for timeTdCount ~columnvalue =column }}{{for ~name=time ~dayend=timecellclass ~index=#getIndex() }}<td class='e-horizontaltimetd {{:~dayend}}'><div style='width:{{:timeCellWidth}}'><span class ='e-horizontaltimespan'>{{:~name.slice(0,2)}}<\/span><div class ='e-horizontaltimespandiv'>{{:~name.slice(3,5)}}<\/div><\/div><\/td>{{for ~columnvalue[~index] ~width = timeCellWidth}}<td class='e-horizontalalternatetd'><div style='width:{{:~width}}'><\/div><\/td>{{/for}}{{/for}}{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr>{{/if}}{{if view == 'month'}}<tr>{{for cols}}<td class='e-headercells e-horizontmonthheaderdatetd {{:cellToday}}'><div title='{{:title}}' class='e-dateheadercell e-horizontmonthdatealign'>{{:currentDate}}<\/div><\/td>{{/for}}<\/tr><tr>{{for cols}}<td class ='e-horizontmonthheaderdaytd' style='width:{{:cellWidth}}'><div class='e-dateheadercell e-horizontmonthdatealign' title='{{:daynameTitle}}'>{{:currentDay}}<\/div><\/td>{{/for}}<\/tr>{{/if}}<\/tbody><\/table><\/div><\/div><\/td>"},r=function(){return"{{if multiRes == true}}<td class = 'e-horizontalheader'><div class='e-horizontalresheader'>{{:label}}<\/div><\/td>{{else}}{{/if}}<td class='e-horizontaldaterender'><div class='e-horizontaltimecells {{:heightclass}}'><div class='e-headerdays' style='position:absolute;'><table class ='e-table' style='width:100%;border-collapse:separate;table-layout:fixed;'><tbody>{{if view !== 'month'}}<tr style='width:100%;'> <td>{{if view === 'day'}}<table style='width:100%;'>{{else}}<table class='e-table'>{{/if}}<tbody><tr> {{for cols ~headercellWidth = headercellWidth}}<td class='e-headercells {{:cellToday}} e-horizontalheadertddate'><div class='{{:currentDateClass}} e-horizontalheaderdiv'>{{:currentDay}}<\/div><\/td>{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr><tr style='width:100%;position:absolute;'> <td><table class='e-table e-horizontaltabletimecell' style='border-collapse:collapse;'><tbody><tr> {{for timeTdCount ~userTemplateId = userTemplateId ~template=template ~columnvalue =column}}{{for ~name=time ~names=times ~dayend=timecellclass ~index=#getIndex() }}<td class='e-horizontaltimetd {{:~dayend}}'><div style='width:{{:timeCellWidth}}'><span class ='e-horizontaltimespan'>{{:~name}}<\/span><div class ='e-horizontaltimespandiv'><\/div><\/div><\/td>{{for ~columnvalue[~index] ~width = timeCellWidth ~names=~names}}<td class='e-horizontalalternatetd' style='vertical-align:middle !important;'><div style='width:{{:~width}};' > {{if ~template ==true || ~userTemplateId==true }}{{:~names[#getIndex()]}}{{else}}<\/div>{{/if}}<\/td>{{/for}}{{/for}}{{/for}} <\/tr><\/tbody><\/table><\/td> <\/tr>{{/if}}{{if view == 'month'}}<tr>{{for cols}}<td class='e-headercells e-horizontmonthheaderdatetd {{:cellToday}}'><div class='e-dateheadercell e-horizontmonthdatealign'>{{:currentDate}}<\/div><\/td>{{/for}}<\/tr><tr>{{for cols}}<td class ='e-horizontmonthheaderdaytd'><div class='e-dateheadercell e-horizontmonthdatealign' style='width:{{:cellWidth}}'>{{:currentDay}}<\/div><\/td>{{/for}}<\/tr>{{/if}}<\/tbody><\/table><\/div><\/div><\/td>"},u=function(){return"<div class ='e-horizontresdiv'><div class='e-horires' style='height:100%'><table class='e-table e-resourceheadertable' style='width:100%;table-layout:fixed;'><tbody>{{for trs}}<tr class='e-horizontresheaderdiv'>{{for ~resname=name ~marginleft=marginleft }}{{if classname == 'e-parentnode'}}<td class='{{:classname}} resemptytd' style='width:25px;height:{{:cellHeight}}'><\/td>{{else}}<td class='resemptytd' style='width:25px;height:{{:cellHeight}}'><\/td>{{/if}}<td class='{{:classname}}' style='vertical-align:middle;height:{{:cellHeight}};'>{{if classname == 'e-parentnode'}}<div id={{:idnum}} class='{{:classname}}category e-resourceicon e-resourcecollapse' style='width:20px;vertical-align:middle;float:left;margin-left:{{:~marginleft}};margin-top:2px;'><\/div>{{/if}}<div class='e-resourceheadertext' style='text-align:left;margin-left:{{:~marginleft}};' title='{{if userResTemplId == true}}{{:name}}{{else}}{{:~resname}}{{/if}}'>{{if userResTemplId == true}}{{:userResHeader}}{{else}}{{:~resname}}{{/if}}<\/div><\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table><\/div><\/div>"},f=function(){return"<table class='e-table e-workcellstab'><tbody>{{for cellrows ~cols=cols ~hourdiff=hourdiff ~view=view ~classname=classname ~columnvalue=column ~userTemp=userTemplate ~userHtml=userHtml}}{{if classname == 'e-parentnode'}} <tr class='e-resourceheadertr' style='width:100%'>{{for ~cols ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}<td class='e-resourceheadercells e-workcells e-parentworkcell e-dayend' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{else}}<td class='e-resourceheadercells e-workcells e-parentworkcell' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{/if}}{{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}<\/td>{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}<td class='e-resourceheadercells e-workcells e-parentworkcell e-alternateworkcell' style='width:{{:~width}};height:{{:cellHeight}}'>{{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}<\/td>{{/for}}{{/if}}{{/for}}<\/tr>{{else}}<tr style='width:100%'>{{for ~cols ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}<td class='e-workcells e-childworkcell e-dayend' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{else}}<td class='e-workcells e-childworkcell' style='width:{{:cellWidth}};height:{{:cellHeight}}'>{{/if}}{{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}<\/td>{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}<td class='e-workcells e-childworkcell e-alternateworkcell' style='width:{{:~width}};height:{{:cellHeight}}'>{{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}<\/td>{{/for}}{{/if}}{{/for}}<\/tr>{{/if}}{{/for}}<\/tbody><\/table>"};t.scheduleFeatures.horizontal={_renderHorizontalTemplates:function(){this.horizontalHeader=n.templates(i());this.cellTemplate=n.templates(f());this.horizontalResHeader=n.templates(u());this.userTimeCellHoriTemplate=n.templates(r())},_horizontalViewNavigation:function(t){var u,i,r,f;if(t.type=="click"){if(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7){if(this.element.find(".e-headercells").children().removeClass("e-activeview"),u=t.currentTarget.cellIndex,i=new Date(this._dateRender[u]),this.model.minDate<=i&&this.model.maxDate>=i)this.model.timeScale.enable&&n(t.currentTarget).children().addClass("e-activeview"),this.currentDate(i);else return!1;this._businessHourScroller()}else if(this.currentView()=="month"||this._isCustomMonthView()){if(u=t.currentTarget.cellIndex,this.model.views.indexOf("day")==-1)return!1;if(i=new Date(this.monthDays[u]),this.model.minDate<=i&&this.model.maxDate>=i)this.currentDate(i);else return!1;this._navView=!0;this._viewChange(t,this.currentView(),"day")}}else if(t.type=="dblclick"&&(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7)){if(r=n(t.target),f=r.hasClass("e-headercells")?r:r.parent().hasClass("e-headercells")?r.parent():r.parent().parent(),this.model.views.indexOf("day")==-1||!f.hasClass("e-headercells"))return!1;if(i=new Date(this._dateRender[f.index()]),this.model.minDate<=i&&this.model.maxDate>=i)this.currentDate(i);else return!1;this._navView=!0;this._viewChange(t,this.currentView(),"day")}},_renderHorizontalHeaderDays:function(i){var u,s,h,f,c,e,o,r;if(this.element.find(".e-headercells").addClass("e-dateheaderselect"),this.currentView()==="month"||this._isCustomMonthView())for(o=this.monthDays,r=0;r<o.length;r++)new Date(new Date(o[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight");else{if(this.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),t.isNullOrUndefined(this.model.dateHeaderTemplateId))for(this.element.find(".e-headercells").children().removeClass("e-activeview"),r=0;r<this._dateRender.length;r++)u=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(this._dateRender[r]).getDay()].split("")[0]:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?i.calendar.days.names[new Date(this._dateRender[r]).getDay()]:this._dayShortNames[new Date(this._dateRender[r]).getDay()]:this._dayShortNames[new Date(this._dateRender[r]).getDay()],s=this.model.timeScale.enable?this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?u+parseInt(t.format(new Date(this._dateRender[r]),"dd",this.model.locale)):this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?u+" "+t.format(new Date(this._dateRender[r]),"dd MMMM yyyy",this.model.locale):u+" "+t.format(new Date(this._dateRender[r]),"dd MMM yy",this.model.locale):u+" "+new Date(this._dateRender[r]).getDate():this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?u+parseInt(t.format(new Date(this._dateRender[r]),"dd",this.model.locale)):this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?t.format(new Date(this._dateRender[r]),"dd MMMM yyyy",this.model.locale):t.format(new Date(this._dateRender[r]),"dd MMM yy",this.model.locale):("0"+new Date(this._dateRender[r]).getDate()).slice(-2),n(this.element.find(".e-headercells")[r]).find("div")[0].innerHTML=s,new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight"),new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date(this.currentDate().setHours(0,0,0,0)).getTime()&&n(this.element.find(".e-headercells")[r]).children().addClass("e-activeview");else for(h=this._getUserDateheaderTemplate(),r=0;r<this._dateRender.length;r++)n(this.element.find(".e-headercells")[r]).find("div")[0].innerHTML=h[r].currentDay,new Date(new Date(this._dateRender[r]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&n(this.element.find("td.e-headercells")[r]).addClass("e-currentdayhighlight");f=new Date(this.currentDate());this.model.orientation=="horizontal"&&this.currentView()!="month"&&this.model.timeScale.enable&&(new Date(this.currentDate()).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&(this.element.find(".e-headercells").children().removeClass("e-activeview"),this.element.find(".e-currentdayhighlight").children().addClass("e-activeview")),c=this.element.find(".e-headercells").children(".e-activeview").parent().index(),this.element.find(".e-headercells").children().removeClass("e-activeview"),e=this.currentView()==="day"?0:this.currentView()==="workweek"?f.getDay()-1:this.currentView()==="week"?f.getDay():c,this.currentView()!="day"&&n(this.element.find(".e-headercells")[e]).children().addClass("e-activeview"),new Date(new Date(this.currentDate()).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?n(this.element.find("td.e-horizontalheadertddate")[e]).addClass("e-headerToday"):"")}},_horizontalScroll:function(i,r){var e,u,f;if(!t.isNullOrUndefined(i.scrollLeft)&&(r.currentView()=="day"||r.currentView()=="week"||r.currentView()=="workweek"||r.currentView()==="customview"&&r._renderDays<=7)){if(e=n(r.element.find(".e-headercells").find(".e-activeview").parent()).index(),u=0,r.model.enableRTL?(f=t.browserInfo().name=="mozilla"?Math.abs(i.scrollLeft):i.scrollData.scrollable-i.scrollLeft,r.element.find(".e-horizontaltimecells").find("table tr").eq(2).css("left",f-1+"px"),u=Math.floor(Math.abs(f)/(r.element.find(".e-workcells").width()+1)/((r.model.endHour-r.model.startHour)*r.model.timeScale.minorSlotCount))):(r.element.find(".e-horizontaltimecells").find("table tr").eq(2).css("left",-i.scrollLeft+"px"),u=Math.floor(Math.abs(i.scrollLeft)/r.element.find(".e-workcells").width()/((r.model.endHour-r.model.startHour)*r.model.timeScale.minorSlotCount*(60/r.model.timeScale.majorSlot)))),i.scrollData.scrollable-i.scrollLeft==0)return;r.currentView()!="day"&&e!==u&&r.element.find(".e-headercells").children().removeClass("e-activeview");r.currentView()!="day"&&n(r.element.find(".e-headercells")[u]).children().addClass("e-activeview");r.model.timeScale.enable||r.element.find(".e-headercells").children().removeClass("e-activeview")}},_getHorizontalheaderCellCount:function(n){var f=[],r,u,e,i;if(this._isCustomMonthView(),!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&(this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"||this.currentView()=="customview"&&this._oneWeek))f=this._getUserDateheaderTemplate();else for(i=0;i<this._dateRender.length;i++)r=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(this._dateRender[i]).getDay()].split("")[0]:this.currentView()==="month"||this.currentView()==="day"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?n.calendar.days.names[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],u=new Date(new Date(this._dateRender[i]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday e-currentdayhighlight":"",e=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:r,currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?{currentDay:t.format(new Date(this._dateRender[i]),this._pattern.D,this.model.locale),currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:{currentDay:r+" "+t.format(new Date(this._dateRender[i]),"dd MMM yy",this.model.locale),currentDateClass:"",cellToday:u,cellWidth:this.model.cellWidth}:{currentDay:this._mediaQuery?r+parseInt(t.format(new Date(this._dateRender[i]),"dd",this.model.locale)):r+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:u,cellWidth:this.model.cellWidth},f.push(e);return f},_getHoriStartEndTime:function(i){var c=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId),v,l,f,y,p,w,h,u,r,o;c&&(v=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),l=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()));var e=[],s=this.model.cellWidth?this._safariBrowser?parseInt(this.model.cellWidth)-1+"px":this.model.cellWidth:this._safariBrowser?"29px":"30px",b=this.currentView()=="week"?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()=="day"?1:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:this.model.workWeek.length;for(f=0;f<b;f++)if(c){var h=new Date((new Date).setHours(0,0,0,0)),r=0,a=[];for(u=this.model.startHour;u<this.model.endHour;){for(y=this.model.timeScale.majorSlot+r,p=r;r<y;)w=r,r=r*6e4,c?w==p?o=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?l.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}):v.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}):t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||a.push(l.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,r))}).trim()):this._timeMode=="12"?(o=(u===this.model.startHour||u===12)&&i.AM&&i.PM&&r==0?t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh:mm tt",this.model.locale),e.push({time:o,id:u+"_"+r,timecellclass:u==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):e.push({time:(u<=9?"0"+u:u)+" 00",timecellclass:u%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)==this.model.startHour&&f!=0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),r=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?r/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount:r/6e4+this.model.timeScale.majorSlot;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:r>=60?u+1:u;r=r>=60?0:r;c&&(r==this.model.timeScale.majorSlot||r==0)&&(e.push({time:o.trim(),times:a,id:u+"_"+r,timecellclass:u-1==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),a=[])}}else for(h=new Date((new Date).setHours(0,0,0,0)),u=this.model.startHour;u<this.model.endHour;){for(r=0;r<60;)r=r*6e4,this._timeMode=="12"?(o=(u===this.model.startHour||u===12)&&i.AM&&i.PM&&r==0?t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(u,0,0,r)),"hh:mm tt",this.model.locale),e.push({time:o,id:u+"_"+r,timecellclass:u==this.model.startHour&&f!=0&&r==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):e.push({time:(u<=9?"0"+u:u)+" 00",timecellclass:u%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)==this.model.startHour&&f!=0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),r=r/6e4+this.model.timeScale.majorSlot;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:u+1}return e},_getHorizontalDayAppointments:function(n,i,r,u){for(var e=[],f=0;f<n.length;f++)e=!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?new t.DataManager(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,n[f][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]])):this.res1,e.length!=0&&(new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(n[f][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()<=new Date(new Date(n[f][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?n[f][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]==this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.id]:!0&&new Date(new Date(n[f][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(n[f][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime())&&this._renderApp(n[f],r,u)},_horiGroupCollection:function(){if(this._tempResource.length!=0){var n=this._resourceSort(),i=this.res1,r=n.filter(function(n){return i.indexOf(n)===-1});return t.isNullOrUndefined(this.model.group)&&(this.res1=["0"]),r}},_renderHorizontalApp:function(i,r,u,f,e,o,s,h){var rt=this.element.find(".e-workcellstab tr"),v,y,w=0,g,lt,et,ot,st,nt,b,k,ct,c,d,it,a,kt;if(i<=r&&(lt=new Date(i).getHours()<s?new Date(i).getHours()+-new Date(i).getHours()+-new Date(i).getMinutes():new Date(i).getHours()+-s,et=new Date(r).getHours()>h?new Date(r).getHours()+(-new Date(r).getHours()+(h-s))+-new Date(r).getMinutes():new Date(r).getHours()+-s,et=new Date(r).getHours()==h?new Date(et).getMinutes()+-new Date(r).getMinutes():et,v=this.element.find(".e-appointment").length>0?this.element.find(".e-appointment").outerHeight(!0):this._getElementHeight("e-appointment"),ot=0,this.model.startHour<=new Date(i).getHours()&&this.model.endHour>=new Date(i).getHours())){var l=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._grouping.length>1?this._findResourceIndex(this._horiHeaderCollection,this._tempResource[this._tempResource.length-2].resourceSettings.id,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()],null,null)+1:0,p=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],null,null)+1:this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:1,at=this.model.appointmentTemplateId?!0:!1,ut=at?this._getUserAppointmentTemplate(u):"";if(v=this.model.appointmentTemplateId?n(ut).css("height")=="100%"?this.model.showOverflowButton?e-15:this.initialCellHeight:n(ut).css("height")=="0px"?v:n(ut).height():v,ot=t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&!t.isNullOrUndefined(this.model.group)?this._getOverlapCount(u,f,this._dateRender,u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getOverlapCount(u,f,this._dateRender,null),this._renderedAllDay.push(n.extend(!0,{},u)),w=ot*v+w,u[this._appointmentSettings.allDay])st=new Date(new Date(new Date(r).setHours(0,0,0,0)).getTime())-new Date(new Date(new Date(i).setHours(0,0,0,0)).getTime()),nt=Math.round(st/864e5)+1,nt>this._dateRender.length&&(nt=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay()),b=(h-s)*60*nt,k=(this.model.endHour-this.model.startHour)*(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*f,y=b/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+b/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1,g="0";else if(new Date(new Date(new Date(u[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime())<new Date(new Date(new Date(u[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime())){var vt=new Date(r)<new Date(new Date(r).setHours(this.model.endHour,0,0))&&new Date(r)<new Date(new Date(r).setHours(this.model.startHour,0,0))?this.model.endHour*30:new Date(r).getHours()*60+new Date(r).getMinutes(),yt=new Date(i)>new Date(new Date(r).setHours(this.model.startHour,0,0))?this.model.startHour*60:new Date(i).getHours()*60+new Date(i).getMinutes(),ht=1,pt,ft,wt,bt,st;if(pt=this._dateRender.indexOf(new Date(r).setHours(0,0,0,0)),ft=this._dateRender.indexOf(new Date(i).setHours(0,0,0,0)),pt==-1)while(ht<7)if(new Date(this._dateRender[this._dateRender.length-ht]).getTime()<new Date(r).setHours(0,0,0,0)){wt=this._dateRender.length-ht;vt=this.model.endHour*60;break}else ht++;else wt=pt;ft==-1?(bt=f,yt=this.model.startHour*60):bt=ft;st=wt-bt;b=st*(h-s)*60-yt+vt;k=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+(ft==-1?0:lt*o)*(60/this.model.timeScale.majorSlot));y=b/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+b/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1;nt>this._dateRender.length&&(nt=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay(),b=nt*(h-s)*60,y=b/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(b/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3));g=ft==-1?0:parseFloat(new Date(i).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*o/this.model.timeScale.majorSlot}else{if(g=parseFloat(new Date(i).getMinutes()+new Date(i).getMilliseconds()/60)*this.cellwidth*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,this.model.endHour-this.model.startHour==24)ct=new Date(r).getHours()*60+new Date(r).getMinutes()-(new Date(i).getHours()*60+new Date(i).getMinutes());else var vt=new Date(r).getHours()*60+new Date(r).getMinutes()>this.model.endHour*60?this.model.endHour*60:new Date(r).getHours()*60+new Date(r).getMinutes(),yt=new Date(i).getHours()*60+new Date(i).getMinutes()<this.model.startHour*60?this.model.startHour*60:new Date(i).getHours()*60+new Date(i).getMinutes(),ct=vt-yt;ct+=1;y=ct/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(ct/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2)+1;k=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+lt*o*(60/this.model.timeScale.majorSlot))}if(y=y<1?this.cellwidth:y,c=this._appointmentColor(u),this.model.allowInline&&!t.isNullOrUndefined(u.inline))w=this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&!t.isNullOrUndefined(this.model.group)?0:w,this._inlineTemplate(u,g,w,y,v,c,!1),a=rt.eq(p+l-1).children().eq(k),a.prepend(n("<div class='e-inlinewrapper'><\/div>").append(this._inlineText));else if(e=t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0?e:rt.eq(p+l-1).children().eq(k).height()+1,d=this._indicationApp(u),w+v+7<e){var dt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.startTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.startTime]),"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.endTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.endTime]),"HH:mm",this.model.locale),ni=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,tt=n(this.appTemplate.render({id:u.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!c.appointColor.applyFilter?!0:!1,subject:u[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:g+"px",top:w,appHeight:this.model.appointmentTemplateId?v:"",appWidth:y+"px",userAppTemplId:at,userTemplate:ut,appClass:"e-appointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?u[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(u):u[this._appointmentSettings.priority],uid:u.Guid,recurrence:u[this._appointmentSettings.recurrence],recurrenceEdit:ni,leftInd:d.leftIndication,rightInd:d.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),a=rt.eq(p+l-1).children().eq(k);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,tt);a.find("div.e-appointwrapper").length>0?a.find("div.e-appointwrapper").append(tt):a.prepend(n("<div class='e-appointwrapper'><\/div>").append(tt))}else if(this.model.showOverflowButton)it=k+Math.round(new Date(i).getMinutes()/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)),n("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(p+l-1)+"_"+it).length==0&&(a=rt.eq(p+l-1).children().eq(it),kt='<div id="'+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(p+l-1)+"_"+it+'" class="e-icon e-arrowhead-down e-appsoverflow" data-cellinfo="'+this._dateRender[f]+'"><\/div>',a.find("div.e-appointwrapper").length>0?a.find("div.e-appointwrapper").append(kt):a.prepend(n("<div class='e-appointwrapper'><\/div>").append(kt)),w=e-this.element.find(".e-appsoverflow").height(),this.element.find("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(p+l-1)+"_"+it).css(this.model.enableRTL?"right":"left",this.cellwidth-25+"px").css("top",w+"px")),n("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(p+l-1)+"_"+it).attr("data-appcount",ot+1);else{this.element.find(".e-workcellstab tr").eq(p+l-1).children().css("height",e+v-1+"px");this.element.find(".e-resourceheadertable tr").eq(p+l-1).find(".e-childnode").css("height",e+v-1+"px");var dt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.startTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.startTime]),"HH:mm",this.model.locale),gt=this._timeMode=="12"?t.format(new Date(u[this._appointmentSettings.endTime]),this._pattern.t,this.model.locale):t.format(new Date(u[this._appointmentSettings.endTime]),"HH:mm",this.model.locale),ni=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,tt=n(this.appTemplate.render({id:u.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,subject:u[this._appointmentSettings.subject],startTime:dt,endTime:gt,left:g+"px",top:w,appHeight:this.model.appointmentTemplateId?v:"",appWidth:y+"px",userAppTemplId:at,userTemplate:ut,appClass:"e-appointment",appointData:c.appointColor.appointData,appointCustomcss:c.appointColor.appointCustomcss,appointtextcolor:c.appointColor.appointtextcolor,value:c.value,multiDiv:c.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?u[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(u):u[this._appointmentSettings.priority],uid:u.Guid,recurrence:u[this._appointmentSettings.recurrence],recurrenceEdit:ni,leftInd:d.leftIndication,rightInd:d.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),a=rt.eq(p+l-1).children().eq(k);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,tt);a.find("div.e-appointwrapper").length>0?a.find("div.e-appointwrapper").append(tt):a.prepend(n("<div class='e-appointwrapper'><\/div>").append(tt));this._overflowFlag=!0}t.isNullOrUndefined(d)||(d.leftIndication&&(this.model.enableRTL?this.element.find(".e-appointment").filter("div[data-guid="+u.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find(".e-appointment").filter("div[data-guid="+u.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),d.rightIndication&&(this.model.enableRTL?this.element.find(".e-appointment").filter("div[data-guid="+u.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find(".e-appointment").filter("div[data-guid="+u.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")));!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&t.isNullOrUndefined(u.inline)&&this._renderAppointmentCategory(this._horiHeaderCollection,l,k,u,y,g)}},_renderAppointmentCategory:function(i,r,u,f,e,o){var h,y,c=0,p,k,l=[],w,b=this.element.find(".e-resourceheadercells").height(),v,s,a;if(!t.isNullOrUndefined(this.model.group)&&this._grouping.length>0){h=this._getResourceColor(f);y=h.appointData==""?"e-categorycolor":"";r-=1;e=this.currentView()=="month"||this._isCustomMonthView()?e:e+2;do if(s=this.element.find(".e-resourceheadertr").eq(r).find("td.e-workcells").eq(u),a=this.model.enableRTL?"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;right:"+o+"px;'><\/div>":"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;left:"+o+"px;'><\/div>",s.find("div.e-appointwrapper").length>0?s.find("div.e-appointwrapper").append(a):s.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)),this._tempResource.length>2){for(v=this._tempResource.length-2;v>=0;v--)if(c=this._tempResource[v].resourceSettings.dataSource.indexOf(i[r]),c!=-1){if(c=v,p=this._tempResource[v].resourceSettings.groupId,t.isNullOrUndefined(p))return;break}k=c==0?c:c-1;l=new t.DataManager(i).executeLocal((new t.Query).where(this._tempResource[k].resourceSettings.id,t.FilterOperators.equal,i[r][p]));w=this._tempResource[0].resourceSettings.dataSource.indexOf(l[0]);w==0?(l=[],this._tempResource.length>2&&(s=this.element.find(".e-resourceheadertr").eq(w).find("td.e-workcells").eq(u),a=this.model.enableRTL?"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+b+"px;background:"+h.appointData+";width:"+e+"px;right:"+o+"px;'><\/div>":"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+this.element.find(".e-resourceheadercells").height()+"px;background:"+h.appointData+";width:"+e+"px;left:"+o+"px;'><\/div>",s.find("div.e-appointwrapper").length>0?s.find("div.e-appointwrapper").append(a):s.prepend(n("<div class='e-appointwrapper'><\/div>").append(a)))):l.length!=0?r=i.indexOf(l[0]):""}while(l.length!=0)}},_getHorizontalOverlapCount:function(n,i,r,u,f){for(var o=[],e=0,s=n.length;e<s;e++)t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?new Date(new Date(n[e][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[e][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&(new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])>=new Date(n[e][this._appointmentSettings.startTime])||new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])&&new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.startTime])>=new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])<new Date(n[e][this._appointmentSettings.endTime]))&&(f!=null?f==n[e][this._tempResource[this._tempResource.length-1].field]:f==null)&&o.push(n[e]):new Date(new Date(n[e][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[e][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(i[r]).setHours(0,0,0,0)).getTime()&&(new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])>=new Date(n[e][this._appointmentSettings.startTime])||new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])&&new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.startTime])>=new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.startTime])<new Date(n[e][this._appointmentSettings.endTime])||new Date(u[this._appointmentSettings.endTime])>new Date(n[e][this._appointmentSettings.startTime])&&new Date(u[this._appointmentSettings.endTime])<new Date(n[e][this._appointmentSettings.endTime]))&&o.push(n[e]);return o},_renderHorizontalHeaderBar:function(){var y=this._isCustomMonthView(),u=this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",p=u=="day"?1:u=="week"?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:this.model.workWeek.length,c,l,w,e,o,s,h,f,i,b,v,k;if(this._strTime=this._getStartEndTime(),c=this._columnTimeScale(this._strTime),this.datesColumn=this._getHeaderAllDayCellsCount(),u==="month"||this._isCustomMonthView()){for(this.datesColumn=[],this.monthDays=[],this.totdays=[],i=0;i<this._dateRender.length;i++)this.currentView()==="month"||this._isCustomMonthView()&&this._oneWeek?new Date(this.currentDate()).getMonth()===new Date(this._dateRender[i]).getMonth()&&this.totdays.push(this._dateRender[i]):this.totdays.push(new Date(this._dateRender[i]));if(l=this.totdays.length,!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&(this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"||this.currentView()=="customview"&&this._oneWeek))for(w=this._getUserDateheaderTemplate(),i=0;i<l;i++)e={currentDate:w[i].currentDay,currentDateClass:"",currentDay:this.currentView()=="day"?this._dayFullNames[new Date(this.totdays[i]).getDay()]:this._dayShortNames[new Date(this.totdays[i]).getDay()].toString(),cellWidth:this.model.cellWidth?this.model.cellWidth:"100%",cellHeight:this.model.cellHeight,cellToday:new Date(this.totdays[i]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()?"e-currentdayhighlight":""},this.datesColumn.push(e),this.monthDays.push(this.totdays[i]);else for(i=0;i<l;i++)s=new Date(this.totdays[i]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()?"e-currentdayhighlight":"",o=y&&new Date(this.totdays[i]).getDate()==1?t.format(new Date(this.totdays[i]),"MMM",this.model.locale)+" "+new Date(this.totdays[i]).getDate():t.format(new Date(this.totdays[i]),"dd",this.model.locale),e=this.model.timeScale.enable?{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this._dayFullNames[new Date(this.totdays[i]).getDay()].toString().slice(0,1),cellWidth:!this.model.cellWidth&&this.currentView()!="month"&&!this._isCustomMonthView()?"30px":this.model.cellWidth,cellHeight:this.model.cellHeight,cellToday:s}:this.currentView()=="day"||this.currentView()=="week"||this.currentView()=="workweek"?{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this.currentView()=="day"?this._dayFullNames[new Date(this.totdays[i]).getDay()]:this._dayShortNames[new Date(this.totdays[i]).getDay()].toString(),cellWidth:this.model.cellWidth?this.model.cellWidth:"100%",cellHeight:this.model.cellHeight,cellToday:s}:{daynameTitle:t.format(new Date(this.totdays[i]),"dddd",this.model.locale),title:new Date(this.totdays[i]).toDateString(),currentDate:o,currentDateClass:"",currentDay:this._dayFullNames[new Date(this.totdays[i]).getDay()].toString().slice(0,1),cellWidth:this.model.cellWidth,cellHeight:this.model.cellHeight,cellToday:s},this.datesColumn.push(e),this.monthDays.push(this.totdays[i])}if(h=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,f=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,h||f){var d=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),g=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),nt=[],r=0;for(i=this.model.startHour;i<this.model.endHour;){for(var a=[],tt=this.model.timeScale.majorSlot+r,it=r;r<tt;)b=r,r=r*6e4,this._timeMode=="12"&&(b!=it||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?a.push(d.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,r))}).trim()):a.push(g.render(object={date:new Date(new Date(this._dateRender[0]).setHours(i,0,0,r))}).trim())),r=r/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;i=this.model.timeScale.majorSlot>60?i+this.model.timeScale.majorSlot/60:r>=60?i+1:i;r=r>=60?0:r;nt.push(a)}f=!0}v=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&this._tempResource[0].resourceSettings.dataSource.length!=0?!0:!1;k=h||f?this.userTimeCellHoriTemplate.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:v,view:u,timeTdCount:this._strTime,colspan:u=="month"?1:this._strTime.length/p*2,heightclass:u=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",width:this.model.width,headercellWidth:u=="day"?"100%":"55px",column:c,userTemplateId:h,template:f}):this.horizontalHeader.render({tablelayout:y?"e-fixedlayout":"",cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:v,view:u,timeTdCount:this._strTime,colspan:u=="month"?1:this._strTime.length/p*2,heightclass:u=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",width:this.model.width,headercellWidth:u=="day"?"100%":"55px",column:c});this.aTR.append(k)},_renderHorizontalContent:function(n,i,r,u,f,e){var y=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId),s,o,l=[],p=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,v=this._strTime,h,a,c;l=this._columnValue;this._tempResource.length==0||t.isNullOrUndefined(this.model.group)||this._tempResource[0].resourceSettings.dataSource.length==0?(o="",s=[{classname:"e-childnode"}]):(o=this._renderHorizontalResources(),s=this._horiResources);h=t.isNullOrUndefined(this.model.workCellsTemplateId)?!1:!0;h&&(a=this._getUserWorkCellsTemplate());c=this.cellTemplate.render({cellrows:s,hourdiff:Math.ceil((this.model.endHour-this.model.startHour)*(60/this.model.timeScale.majorSlot)),view:this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",cols:this.model.timeScale.enable?this.currentView()=="month"||this._isCustomMonthView()?this.datesColumn:v:this.datesColumn,column:l,userTemplate:h,userHtml:a});o==""?this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(c))))))))):this.wTR.append(t.buildTag("td.e-horizontalrestd",{},{},{width:"15%",height:"100%"}).append(o)).append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(c)))))))))},_columnTimeScale:function(n){var u,i;this._columnValue=[];var f=[],r=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,e=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate),o=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate)?!0:!1,s=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)?!1:!0;if(e)for(i=0;i<n.length;i++)this._columnValue.push(i);else for(i=0;i<n.length;i++){for(u=0;u<this.model.timeScale.minorSlotCount-1;u++)if(r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,r>(this.model.endHour-this.model.startHour)*60){if(f.push(u),u==this.model.timeScale.minorSlotCount-2){r=0;break}}else f.push(u);this._columnValue.push(f);r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;f=[]}return this._columnValue},_getResourceHeadTemplate:function(t){var i=n.templates(n(this.model.resourceHeaderTemplateId).html());return i.render(t)},_renderHorizontalResources:function(){var i,u,f,r,e,c,o;this._resCollect=[];this._horizontalResRender=[];this._horiResources=[];var s=this.currentView(),l=s=="day"?1:s=="week"||s=="month"||this._isCustomMonthView()?7:this.model.workWeek.length,h=this.model.resourceHeaderTemplateId?!0:!1;if(t.isNullOrUndefined(this.model.group))for(o=0;o<this._tempResource.length;o++)this._horizontalResRender.push(this._tempResource[o].resourceSettings.dataSource),this._resCollect.push(this._tempResource[o].resourceSettings.dataSource);else if(this._grouping.length===1){for(u=0;u<this._grouping.length;u++)i=this._findResourceIndex(this._tempResource,"name",this._grouping[u],null,null);for(u=0;u<this._resourceInfo[i].dataSource.length;u++)this._horiResources.push({cellHeight:this.model.cellHeight,name:this._resourceInfo[i].dataSource[u][this._resourceInfo[i].text],idnum:this._resourceInfo[i].dataSource[u][this._resourceInfo[i].id],classname:"e-childnode",marginleft:"10px",width:"10px",backgroundcolor:"",border:"1px solid #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(this._resourceInfo[i].dataSource[u],{classname:"e-childnode"})),userResTemplId:h}),this._resCollect.push(this._resourceInfo[i].dataSource[u]);this._horizontalResRender.push(this._resCollect)}else{for(f=this._resourceSort(),r=0;r<f.length;r++){for(e=0;e<this.render_Resources.length;e++)if(c=this.render_Resources[e].indexOf(f[r]),c!=-1){i=e;break}i==this.render_Resources.length-1?(this._horiResources.push({cellHeight:this.model.cellHeight,name:f[r][this._tempResource[i].resourceSettings.text],classname:"e-childnode",marginleft:(this._mediaQuery?i*11:i*21)+"px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(f[r],{classname:"e-childnode"})),userResTemplId:h}),this._resCollect.push(f[r])):(this._horiResources.push({cellHeight:this.model.cellHeight,name:f[r][this._tempResource[i].resourceSettings.text],idnum:f[r][this._tempResource[i].resourceSettings.id]+"_"+f[r][this._tempResource[i].resourceSettings.groupId],classname:"e-parentnode",marginleft:i*10+"px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(f[r],{classname:"e-parentnode"})),userResTemplId:h}),this._resCollect.push(f[r]))}this._horizontalResRender.push(this._resCollect)}return this.horizontalResHeader.render({trs:this._horiResources})},_horizontalResIcon:function(){for(var r,s,e=this.element.find(".e-parentnodecategory"),o,u,h,i,f=0;f<e.length;f++){for(o=e[f].id.split("_")[0],r=0;r<this._tempResource.length;r++)if(u=new t.DataManager(this._tempResource[r].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[r].resourceSettings.id,t.FilterOperators.equal,o)),u.length!=0){u=r;break}for(i=u+1,i=i==this._tempResource.length?i-1:i,s=0;s<this._tempResource.length;s++){h=new t.DataManager(this._resourceSort()).executeLocal((new t.Query).where(this._tempResource[i].resourceSettings.groupId,t.FilterOperators.equal,o));h.length==0&&n(e[f]).removeClass("e-resourceicon e-resourcecollapse");break}}},_renderHorizontalCurrentTime:function(){var i,r,t;if(this.currentView()==="month"||this._isCustomMonthView())for(i=this.monthDays,r=this.element.find(".e-headerdays").find("table").find("td"),t=0;t<i.length;t++)new Date(new Date(i[t]).setHours(0,