1/*! 2* filename: ej.schedule.min.js 3* version : 20.3.0.47 4* Copyright Syncfusion Inc. 2001 - 2022. All rights reserved. 5* Use of this code is subject to the terms of our license. 6* A copy of the current license can be obtained at any time by e-mailing 7* [email protected]. Any infringement will be prosecuted under 8* applicable laws. 9*/ 10(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.menu.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}}'>
10<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"{{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}}"},e=function(){return"{{for cellrows ~cols=cols ~hourdiff=hourdiff ~view=view ~classname=classname ~columnvalue=column ~userTemp=userTemplate ~userHtml=userHtml}}{{if classname == 'e-parentnode'}} <tr class='e-resourceheadertr' >{{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 >{{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}}"},o=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(o());this.horizontalResHeader=n.templates(u());this.addResourceTemplate=n.templates(f());this.addResourceCellsTemplate=n.templates(e());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.scrollData)&&(r._horizontalScrollValue=i.scrollData.scrollable,r._horizontalScrollValue=i.scrollData.scrollable,!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-horizontalt
10imecells").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),y,a,f,p,w,b,h,r,u,o,l;c&&(y=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),a=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",k=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<k;f++)if(c){var h=new Date((new Date).setHours(0,0,0,0)),u=0,v=[];for(r=this.model.startHour;r<this.model.endHour;){for(p=this.model.timeScale.majorSlot+u,w=u;u<p;)b=u,u=u*6e4,c?b==w?o=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?a.render(object={date:new Date(new Date(this._dateRender[0]).setHours(r,0,0,u))}):y.render(object={date:new Date(new Date(this._dateRender[0]).setHours(r,0,0,u))}):t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||v.push(a.render(object={date:new Date(new Date(this._dateRender[0]).setHours(r,0,0,u))}).trim()):this._timeMode=="12"?(o=(r===this.model.startHour||r===12)&&i.AM&&i.PM&&u==0?t.format(new Date(new Date(h).setHours(r,0,0,u)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(r,0,0,u)),"hh:mm tt",this.model.locale),e.push({time:o,id:r+"_"+u,timecellclass:r==this.model.startHour&&f!=0&&u==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):e.push({time:(r<=9?"0"+r:r)+" 00",timecellclass:r%((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}),u=u/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;r=this.model.timeScale.majorSlot>60?r+this.model.timeScale.majorSlot/60:u>=60?r+1:r;u=u>=60?u%60:u;c&&(e.push({time:o.trim(),times:v,id:r+"_"+u,timecellclass:r-1==this.model.startHour&&f!=0&&u==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s}),v=[])}}else for(h=new Date((new Date).setHours(0,0,0,0)),r=this.model.startHour;r<this.model.endHour;){for(u=t.isNullOrUndefined(u)?0:u%60;u<60;)u=u*6e4,this._timeMode=="12"?(o=(r===this.model.startHour||r===12)&&i.AM&&i.PM&&u==0?t.format(new Date(new Date(h).setHours(r,0,0,u)),"hh tt",this.model.locale):t.format(new Date(new Date(h).setHours(r,0,0,u)),"hh:mm tt",this.model.locale),e.push({time:o,id:r+"_"+u,timecellclass:r==this.model.startHour&&f!=0&&u==0?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:s})):(l=u/6e4,e.push({time:(Math.floor(r)<=9?"0"+Math.floor(r):Math.floor(r))+"."+(l==0?l+"0":l)+" 00",timecellclass:r%((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})),u=u/6e4+this.model.timeScale.majorSlot;r=this.model.timeScale.majorSlot>60?parseFloat((r+this.model.timeScale.majorSlot/60).toFixed(2)):r+1;r=Math.ceil((r<1?r:r%Math.floor(r))*100)>=98?r+.02:r}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 tt=this.element.find(".e-workcellstab tr"),p,w,b=0,k,yt,ht,ct,lt,it,d,a,wt,ui,vt,ot,st,ti,ut,v,g,ft,y,ii,ri;if(i<=r&&(yt=new Date(i).getHours()<s?new Date(i).getHours()+-new Date(i).getHours()+-new Date(i).getMinutes():new Date(i).getHours()+-s,ht=new Date(r).getHours()>h?new Date(r).getHours()+(-new Date(r).getHours()+(h-s))+-new Date(r).getMinutes():new Date(r).getHours()+-s,ht=new Date(r).getHours()==h?new Date(ht).getMinutes()+-new Date(r).getMinutes():ht,p=this.element.find(".e-appointment").length>0?this.element.find(".e-appointment").outerHeight(!0):this._getElementHeight("e-appointment"),ct=0,this.model.startHour<=new Date(i).getHours()&&this.model.endHour>
10new Date(i).getHours())){var c=!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,l=!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,pt=this.model.appointmentTemplateId?!0:!1,et=pt?this._getUserAppointmentTemplate(u):"";if(p=this.model.appointmentTemplateId?n(et).css("height")=="100%"?this.model.showOverflowButton?e-15:this.initialCellHeight:n(et).css("height")=="0px"?p:n(et).height():p,ct=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)),b=ct*p+b,wt=this.element.find(".e-workcellstab tr:first-child").children().length/this._dateRender.length,ui=Math.floor(wt*f+(new Date(i).getHours()*60+new Date(i).getMinutes()-this.model.startHour*60)/Math.floor(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)),u[this._appointmentSettings.allDay])lt=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()),it=Math.round(lt/864e5)+1,it>this._dateRender.length&&(it=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay()),d=(h-s)*60*it,a=(this.model.endHour-this.model.startHour)*(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*f,w=d/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+d/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1,k="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 bt=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(),kt=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(),at=1,dt,rt,gt,ni,lt;if(dt=this._dateRender.indexOf(new Date(r).setHours(0,0,0,0)),rt=this._dateRender.indexOf(new Date(i).setHours(0,0,0,0)),dt==-1)while(at<7)if(new Date(this._dateRender[this._dateRender.length-at]).getTime()<new Date(r).setHours(0,0,0,0)){gt=this._dateRender.length-at;bt=this.model.endHour*60;break}else at++;else gt=dt;rt==-1?(ni=f,kt=this.model.startHour*60):ni=rt;lt=gt-ni;d=lt*(h-s)*60-kt+bt;a=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+(rt==-1?0:yt*o)*(60/this.model.timeScale.majorSlot));ut=this.getSlotByElement(tt.eq(l+c-1).children().eq(a));w=d/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+d/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1;it>this._dateRender.length&&(it=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay(),d=it*(h-s)*60,w=d/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(d/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3));k=rt==-1?0:(i.getHours()*60+i.getMinutes()-(ut.startTime.getHours()*60+ut.startTime.getMinutes()))*(this.cellwidth/Math.floor(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))}else{if(vt=Math.ceil((new Date(i).getMinutes()+new Date(i).getMilliseconds()/60)/Math.round(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))-1,k=Math.ceil(this._deviceRatio())-1>0?Math.round(vt/2)==0?-1:Math.round(vt/2):vt,this.model.endHour-this.model.startHour==24)ot=new Date(r).getHours()*60+new Date(r).getMinutes()-(new Date(i).getHours()*60+new Date(i).getMinutes());else var bt=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(),kt=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(),ot=bt-kt;st=Math.round(ot*(this.cellwidth/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))/this.cellwidth);st=st==0?1:st;w=ot<=0?0:ot/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.cellwidth+(ot/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1);w=w-(Math.ceil(this._deviceRatio())-1>0?Math.sqrt(st-1):0);a=Math.floor((this.model.endHour-this.model.startHour)*o*(60/this.model.timeScale.majorSlot)*f+(rt==-1?0:yt*o)*(60/this.model.timeScale.majorSlot));a=a+(this.model.timeScale.majorSlot%this.model.timeScale.minorSlotCount!=0?Math.floor(ui/wt):0);ti=tt.eq(l+c-1).children().eq(a);
10t.isNullOrUndefined(ti[0])||(ut=this.getSlotByElement(ti),k=k+(i.getHours()*60+i.getMinutes()-(ut.startTime.getHours()*60+ut.startTime.getMinutes()))*(this.cellwidth/Math.floor(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)))}if(v=this._appointmentColor(u),this.model.allowInline&&!t.isNullOrUndefined(u.inline))b=this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&!t.isNullOrUndefined(this.model.group)?0:b,this._inlineTemplate(u,k,b,w,p,v,!1),y=tt.eq(l+c-1).children().eq(a),y.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:tt.eq(l+c-1).children()[a].offsetHeight+1,g=this._indicationApp(u),b+p+7<e){var fi=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),ei=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),oi=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,nt=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&&!v.appointColor.applyFilter?!0:!1,subject:u[this._appointmentSettings.subject],startTime:fi,endTime:ei,left:k+"px",top:b,appHeight:this.model.appointmentTemplateId?p:"",appWidth:w+"px",userAppTemplId:pt,userTemplate:et,appClass:"e-appointment",appointData:v.appointColor.appointData,appointCustomcss:v.appointColor.appointCustomcss,appointtextcolor:v.appointColor.appointtextcolor,value:v.value,multiDiv:v.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:oi,leftInd:g.leftIndication,rightInd:g.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),y=tt.eq(l+c-1).children().eq(a),si=t.format(u[this._appointmentSettings.startTime],this._pattern.f,this.model.locale)+"to "+t.format(u[this._appointmentSettings.endTime],this._pattern.f,this.model.locale);nt.find(".e-apptime").attr("aria-label",si);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,nt);y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(nt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(nt))}else if(this.model.showOverflowButton)ft=a+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)+"_"+(l+c-1)+"_"+ft).length==0&&(y=tt.eq(l+c-1).children().eq(ft),ii='<div id="'+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(l+c-1)+"_"+ft+'" class="e-icon e-arrowhead-down e-appsoverflow" data-cellinfo="'+this._dateRender[f]+'"><\/div>',y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(ii):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(ii)),b=e-this.element.find(".e-appsoverflow")[0].offsetHeight,this.element.find("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(l+c-1)+"_"+ft).css(this.model.enableRTL?"right":"left",this.cellwidth-25+"px").css("top",b+"px")),n("#"+this._id+"_"+t.format(new Date(u[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(l+c-1)+"_"+ft).attr("data-appcount",ct+1);else{ri=this.element.find(".e-workcellstab tr").eq(l+c-1).children()[0].offsetHeight-1;this.element.find(".e-workcellstab tr").eq(l+c-1).children().css("height",ri+p+"px");this.element.find(".e-resourceheadertable tr").eq(l+c-1).find(".e-childnode").css("height",ri+p+"px");var fi=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),ei=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),oi=t.isNullOrUndefined(u[this._appointmentSettings.recurrenceRule])?!1:u[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,nt=n(this.appTemplate.render({id:u.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,subject:u[this._appointmentSettings.subject],startTime:fi,endTime:ei,left:k+"px",top:b,appHeight:this.model.appointmentTemplateId?p:"",appWidth:w+"px",userAppTemplId:pt,userTemplate:et,appClass:"e-appointment",appointData:v.appoint
10Color.appointData,appointCustomcss:v.appointColor.appointCustomcss,appointtextcolor:v.appointColor.appointtextcolor,value:v.value,multiDiv:v.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:oi,leftInd:g.leftIndication,rightInd:g.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":u[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),y=tt.eq(l+c-1).children().eq(a),si=t.format(u[this._appointmentSettings.startTime],this._pattern.f,this.model.locale)+"to "+t.format(u[this._appointmentSettings.endTime],this._pattern.f,this.model.locale);nt.find(".e-apptime").attr("aria-label",si);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",u,nt);y.find("div.e-appointwrapper").length>0?y.find("div.e-appointwrapper").append(nt):y.prepend(n("<div class='e-appointwrapper'><\/div>").append(nt));this._overflowFlag=!0}t.isNullOrUndefined(g)||(g.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")),g.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,c,a,u,w,k)}},_renderAppointmentCategory:function(i,r,u,f,e,o){var h,y,c=0,w,k,l=[],b,p,v,s,a;if(this.element.find(".e-categorybar").filter("div[id=categorybar_"+f.Guid+"]").remove(),p=this.element.find(".e-resourceheadercells")[0].offsetHeight,!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:"+p+"px;background:"+h.appointData+";width:"+e+"px;right:"+o+"px;'><\/div>":"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+p+"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,w=this._tempResource[v].resourceSettings.groupId,t.isNullOrUndefined(w))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][w]));b=this._tempResource[0].resourceSettings.dataSource.indexOf(l[0]);b==0?(l=[],this._tempResource.length>2&&(s=this.element.find(".e-resourceheadertr").eq(b).find("td.e-workcells").eq(u),a=this.model.enableRTL?"<div class='e-categorybar "+y+"' id='categorybar_"+f.Guid+"' style='position:absolute;height:"+p+"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")[0].offsetHeight+"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;
10)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){f.push(u);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;
10u<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}
10for(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,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()&&n(r[t]).addClass("e-monthcurrenttime");else this.element.find("td.e-headerToday").length>0&&(this.element.find(".e-horizontaltabletimecell").parent().append('<div id="'+this._id+'_HighlightCurrentTimeline" class="e-highlightcurrenttimeline" style="height: 92%; width: 2px; position: absolute; background-color: red; "><\/div>'),n("#"+this._id+"_HighlightCurrentTimeline").css("top",this.element.find(".e-headerdays tr")[1].offsetTop))},_horizontalTimePosition:function(t,i){if(t.element.find("td.e-headerToday").length>0){var r=t.element.find("td.e-headerToday")[0].cellIndex,u=(t.model.endHour-t.model.startHour)*60/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount*r+(i.getHours()-t.model.startHour)*60/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount,f=parseFloat(i.getMinutes())*t.element.find(".e-workcells")[1].offsetWidth*t.model.timeScale.minorSlotCount/t.model.timeScale.majorSlot;n("#"+t._id+"_HighlightCurrentTimeline").css("left",u*t.element.find(".e-workcells")[1].offsetWidth+f)}},_horizontalBusinessHighlight:function(i,r,u,f,e){var v=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._horiResources.length:1,y,c,h,a,o,l,s;if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable)for(y=Math.ceil((this.model.endHour-this.model.startHour)*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)),o=0;o<v;o++)for(c=0;c<i.length;c++)for(s=0;s<this.model.workWeek.length;s++)this._dayNamesArray.indexOf(this.model.workWeek[s])==new Date(i[c]).getDay()&&(h=c*y+Math.ceil(r*f+(this.model.endHour-this.model.startHour)*f*0),h==0?(h==0&&n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[h]).addClass("e-businesshighlightworkcells"),n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[h]).nextAll(".e-workcells").slice(0,u*f-r*f-1).addClass("e-businesshighlightworkcells")):n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[h-1]).nextAll(".e-workcells").slice(0,u*f-r*f).addClass("e-businesshighlightworkcells"));else for(a=this.monthDays,e=this.element.find(".e-workcells"),e.removeClass("e-monthcellhighlight"),o=0;o<v;o++)for(l=0;l<a.length;l++)for(s=0;s<this.model.workWeek.length;s++)this._dayNamesArray.indexOf(this.model.workWeek[s])==new Date(a[l]).getDay()&&n(n(this.element.find(".e-workcellstab tr")[o]).find(".e-workcells")[l]).addClass("e-monthcellhighlight")},_onResourceClick:function(i){var s,e,l,y,h,a,o,v,u=[],c=[],f,r;for(e=n(i.currentTarget),e.hasClass("e-resourceicon e-resourcecollapse")?(e.removeClass("e-resourceicon e-resourcecollapse").addClass("e-resourceicon e-resourceexpand"),l=!0):(e.removeClass("e-resourceicon e-resourceexpand").addClass("e-resourceicon e-resourcecollapse"),y=!0),this.model.cellHeight||(this.element.find(".e-workcellstab").css("height","100%"),this.element.find(".e-resourceheadertable").css("height","100%")),s=n(i.currentTarget).closest("td.e-parentnode").parent().index(),v=this._getResourceCollection(),r=0;r<v.length;r++)if(h=new t.DataManager(this._tempResource[r].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[r].resourceSettings.id,t.FilterOperators.equal,i.currentTarget.id.split("_")[0])),h.length!=0){a=h[0].count;break}for(f=0;f<a;f++)u.push(this.element.find(".e-resourceheadertable tr")[s+f+1]),c.push(this.element.find(".e-workcellstab tr")[s+f+1]);for(r=0;r<u.length;r++)l?(o=n(u[r]).children().hasClass("e-parentnode"),o&&n(u[r]).find(".e-parentnodecategory").removeClass("e-resourceicon e-resourcecollapse").addClass("e-resourceicon e-resourceexpand"),n(u[r]).is(":visible")&&(n(u[r]).toggle(),n(c[r]).toggle())):(o=n(u[r]).children().hasClass("e-parentnode"),o&&n(u[r]).find(".e-parentnodecategory").removeClass("e-resourceicon e-resourceexpand").addClass("e-resourceicon e-resourcecollapse"),n(u[r]).is(":hidden")&&(n(u[r]).toggle(),n(c[r]).toggle()));this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height());this._horizontalRender();this.model.cellHeight&&this._reRenderScroller();this._mediaQuery&&this.refreshScroller();this._horizontalResIcon();this.element.find("div.e-prevapp,div.e-nextapp").remove();this.element.find(".e-categorybar").height(this.element.find(".e-parentworkcell").height()-3);this._businessHourScroller();this._renderAppointmentAll()}}})(jQuery,Syncfusion),function(n,t){t.scheduleFeatures=t.scheduleFeatures||{};var i=function(){return"{{for resourceName}}{{for ~cols=colspan}}<td class='e-resourcecells' colspan='{{:~cols}}'> {{for ~resource=resourceNam}}<div class='e-resourceheadertext' align='center' title='{{if userResTemplId == true}}{{:resourceNam}}{{else}}{{:~resource}}{{/if}}'>{{if userResTemplId == true}}{{:userResHeader}}{{else}}{{:~resource}}{{/if}}<\/div>{{/for}} <\/td>{{/for}}{{/for}}"};t.scheduleFeatures.resources={_getMultipleResourceCellsCount:function(i){var l,a,i,e,o,f,v,y,b,s,r,h,p,c,w,u;if(this._grouping.length===1){if(l=this._findResourceIndex(this._tempResource,"name",this._grouping[0],null,null),a=this._resourceInfo[l].dataSource.length,this._resWorkWeek)for(i=0,e=this._resourceInfo[l].dataSource,u=0;u<e.length;u++)i=t.isNullOrUndefined(e[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?i+this.model.workWeek.length:i+e[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;else if(this._resCustomView)for(i=0,e=this._resourceInfo[l].dataSource,u=0;u<e.length;u++)o=e[u][this._tempResource[this._tempResource.length-1].resourceSettings.renderDates],t.isNullOrUndefined(o)||(i+=n.type(o[0])=="object"?this._getMultipleCustomDatesCount(o):o.length)}else{for(f=this._getResourceCollection(),r=0;r<f.length;r++)if(h=[],r==0)for(p=0;p<f[r].dataSource.length;p++)h.push({resourceNam:f[r].dataSource[p][f[r].text]});else for(r>1&&(f[r-1].dataSource=[],f[r-1].dataSource=this.res),this.res=[],v=t.group(f[r].dataSource,f[r].groupId),y=t.group(f[r-1].dataSource,f[r-1].id),this._resourceManager1=v instanceof t.DataManager?v:t.DataManager(v),c=0;c<y.length;c++)for(w=0;w<y[c].items.length;w++)if(b=(new t.Query).where("key",t.FilterOperators.equal,y[c].items[w][f[r-1].id]),s=this._resourceManager1.executeLocal(b),s.length>0)for(u=0;
10u<s[0].items.length;u++)h.push({resourceNam:s[0].items[u][f[r].text]}),this.res.push(s[0].items[u]);a=h.length;this.res1=h.length}return i=this._resWorkWeek||this._resCustomView?i:i*a,{resCount:a,count:i}},_initResourceData:function(n,t){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){n.dataSource=r.result;i._resourceInfo.push(n);t==i.model.resources.length-1&&(i._renderInitSchedule(),i._bindAppointmentsData("Load"))})},_showMultipleResourceDetails:function(n){var o,e,s,u,r,f,i,h;if(this._tempResource.length>0){for(u=this._resCollection,i=0;i<u.length;i++)this._appointmentAddWindow.find(".owner_"+i).ejAutocomplete("clearText");for(r=0;r<this.render_Resources.length-1;r++)o=this.render_Resources[r+1]instanceof t.DataManager?this.render_Resources[r+1]:t.DataManager(this.render_Resources[r+1]),this._currentAction==t.Schedule.Actions.EditSeries?(f=n[this._appointmentSettings.resourceFields.toString().split(",")[r].trim()],f=(f+",").split(","),e=(new t.Query).where(u[r+1].groupId.toString(),t.FilterOperators.equal,f[r])):e=(new t.Query).where(u[r+1].groupId,t.FilterOperators.equal,n[this._appointmentSettings.resourceFields.toString().split(",")[r].trim()]),s=o.executeLocal(e),this._appointmentAddWindow.find(".owner_"+(r+1)).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+(r+1)).ejAutocomplete("option","dataSource",s);if(this._groupEditing)for(i=0;i<u.length;i++)h=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n[this._appointmentSettings.id])),this._appointmentAddWindow.find(".owner_"+i).data("ejAutocomplete").selectValueByKey(h[0][this._appointmentSettings.resourceFields.toString().split(",")[i].trim()]);else for(i=0;i<u.length;i++)this._appointmentAddWindow.find(".owner_"+i).data("ejAutocomplete").selectValueByKey(n[this._appointmentSettings.resourceFields.toString().split(",")[i].trim()])}},_renderAppWindowResources:function(n){for(var i=this.render_Resources,r=this.model.enableRTL?"margin-right:30px;margin-top:-18px":"",u=this.model.enableRTL?"float:none":"float:left",t=0;t<i.length;t++)n.find(".owner_"+t).ejAutocomplete({enableRTL:this.model.enableRTL,showPopupButton:!0,width:"100%",delaySuggestionTimeout:10,cssClass:this.model.cssClass,multiSelectMode:this._tempResource[t].allowMultiple?"visualmode":"none",emptyResultText:this._getLocalizedLabels("EmptyResultText"),dataSource:i[t],fields:{text:this._resCollection[t].text,key:this._resCollection[t].id}
10,change:this._onResourceChange,template:"<div class='e-resourcediv' style='height:15px; margin-right:5px; margin-top:3px; float:left;width:15px;"+u+"; background-color: ${"+this._resCollection[t].color+"}'><\/div><div style= "+r+">${"+this._resCollection[t].text+"}<\/div>"})},_resourceSelection:function(n,i,r,u,f,e){var h=e._appointmentAddWindow.find(".owner_"+u).data("ejAutocomplete"),c=h.value().split(","),s,o;for(e._appointmentAddWindow.find(".owner_"+u).ejAutocomplete("clearText"),e._appointmentAddWindow.find(".owner_"+u).ejAutocomplete("option","dataSource",r),s=0;s<c.length-1;s++)for(o=0;o<i.length;o++)if(i[o].text==c[s]){e._appointmentAddWindow.find(".owner_"+u).data("ejAutocomplete").selectValueByKey(i[o][n[u].id]);break}(h.value()==""||t.isNullOrUndefined(h.value()))&&e._appointmentAddWindow.find(".owner_"+u).data("ejAutocomplete").selectValueByKey(i[0][n[u].id]);f=i[0][n[u].id]},_onResourceChange:function(i){var d,w,a,b,v,y,h,s;if(!t.isNullOrUndefined(i.value)&&i.value!=""){var g=this.element.closest(".e-scheduledialog")[0].getAttribute("id").replace("AppointmentAddEditWindow",""),f=n("#"+g).data("ejSchedule"),p=parseInt(this._id.toString().split("_").slice(-1)[0]),nt=f._appointmentAddWindow.find(".owner_"+p).ejAutocomplete("option","multiSelectMode"),o=this.getSelectedItems(),u=f._resCollection;if(p<f.render_Resources.length-1&&o.length>0){var r=p+1,k=f.render_Resources[r-1]instanceof t.DataManager?f.render_Resources[r-1]:t.DataManager(f.render_Resources[r-1]),tt=f.render_Resources[r]instanceof t.DataManager?f.render_Resources[r]:t.DataManager(f.render_Resources[r]),l,e,c=[];if(nt=="none"){if(t.isNullOrUndefined(i.value)||(d=(new t.Query).where(u[r-1].text,t.FilterOperators.equal,i.value),w=k.executeLocal(d)),a=!i.value||t.isNullOrUndefined(i.value)||w.length<=0?o[0][u[r-1].id]:w[0][u[r-1].id],!t.isNullOrUndefined(a))for(b=r;b<u.length;b++){for(e=new t.DataManager(u[r].dataSource).executeLocal((new t.Query).where(u[r].groupId,t.FilterOperators.equal,a)),e.length!=0&&(a=e[0][u[r-1].id]),c=[],s=0;s<e.length;s++)c.push(e[s]);e.length!=0?f._resourceSelection(u,e,c,r,o,f):(f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),f._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",c));r++}}else{for(v=t.Predicate(u[r-1].id,t.FilterOperators.equal,o[0][u[r-1].id]),o=i.value.split(","),h=1;h<o.length;h++)v=v.or(u[r-1].text,t.FilterOperators.equal,o[h]);if(l=(new t.Query).where(v),resApp=k.executeLocal(l),resApp.length>0){for(y=t.Predicate(u[r].groupId,t.FilterOperators.equal,resApp[0][u[r-1].id]),h=1;h<resApp.length;h++)y=y.or(u[r].groupId,t.FilterOperators.equal,resApp[h][u[r-1].id]);for(l=(new t.Query).where(y),e=tt.executeLocal(l),c=[],s=0;s<e.length;s++)c.push(e[s]);f._resourceSelection(u,e,c,r,o,f)}}}}},addResource:function(i,r,u){var u,f,ct,kt,dt,nt,tt,at,gt,ft,rt,yt,w,it,pt,k,y,et,ot,st,ri,wt,ui,ut,b,bt,c,l,ht,s,d,e;if(this._tempResource.length==0&&t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources))if(t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources))t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources)&&n.merge(this._tempResource,this.model.resources);else for(e=0;e<this.model.group.resources.length;e++)u=this._findResourceIndex(this.model.resources,"name",this.model.group.resources[e],null,null),this._tempResource.push(n.extend(!0,[],this.model.resources[u]));if(this._tempResource.length>0&&(f=this._findResourceIndex(this._tempResource,"name",r,null,null),!t.isNullOrUndefined(f))){this._tempResource[f].resourceSettings.dataSource=this.model.resources[f].resourceSettings.dataSource;var g=this._tempResource[f].resourceSettings.dataSource,oi=this._findResourceIndex(g,this.model.resources[0].resourceSettings.id,i[this.model.resources[f].resourceSettings.id],null,null),s,p=0,o=[],si=f,li=this.dateRender;if(t.isNullOrUndefined(oi)){if(t.isNullOrUndefined(u))g.push(i);else{if(this._tempResource.length>1){if(u!=0){for(e=0;e<g.length;e++)if(f!=0&&g[e][this.model.resources[f].resourceSettings.groupId]==i[this.model.resources[f].resourceSettings.groupId]&&(p+=1),p==u){p=e+1;break}f>0&&p!=u&&e==g.length&&(p=e);f==0&&p!=u&&(p=u)}}else p=u;g.splice(p,0,i)}if(this.model.resources[this._tempResource.length-1].resourceSettings.dataSource.length==1)this.refresh();else{if(f!=this._tempResource.length-1){if(ht=(new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,i[this.model.resources[f].resourceSettings.id]),s=new t.DataManager(this.model.resources[this._tempResource.length-1].resourceSettings.dataSource).executeLocal(ht),o.push(i),!t.isNullOrUndefined(s))for(i.count=s.length,e=0;e<s.length;e++)t.isNullOrUndefined(this._findResourceIndex(this._tempResource[f+1].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,s[e][this.model.resources[f].resourceSettings.id],null,null))&&(this._tempResource[f+1].resourceSettings.dataSource.pu
10sh(s[e]),t.isNullOrUndefined(o[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])&&this.res1.splice(this._findResourceIndex(this._tempResource[f+1].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,s[e][this.model.resources[f].resourceSettings.id],null,null),0,s[e])),o.push(s[e])}else ct=t.isNullOrUndefined(this.model.resources[f].resourceSettings.groupId)?null:this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,i[this.model.resources[f].resourceSettings.groupId],null,null),!t.isNullOrUndefined(ct)&&this._tempResource.length>1&&t.isNullOrUndefined(this._tempResource[0].resourceSettings.dataSource[ct].count)?(o.push(this._tempResource[0].resourceSettings.dataSource[ct]),f=0,u=0,s=[],s.push(i),t.isNullOrUndefined(o[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])&&this.res1.splice(this._findResourceIndex(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,i[this.model.resources[f].resourceSettings.id],null,null),0,i),o.push(i)):(t.isNullOrUndefined(i[this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])&&this.res1.splice(this._findResourceIndex(this._tempResource[f].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,i[this.model.resources[f].resourceSettings.id],null,null),0,i),o.push(i));if(kt=this._tempResource.length>1?f!=this._tempResource.length-1?s.length>0:!t.isNullOrUndefined(this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,i[this.model.resources[f].resourceSettings.groupId],null,null)):!0,kt)if(dt=this.res1,nt=this._resourceSort(),this._resCollect=nt,tt=t.isNullOrUndefined(this.model.workCellsTemplateId)?!1:!0,tt&&(ut=this._getUserWorkCellsTemplate()),at=t.isNullOrUndefined(this.model.allDayCellsTemplateId)?!1:!0,at&&(gt=this._getUserAllDayCellsTemplate()),ft=this.model.resourceHeaderTemplateId?!0:!1,this.currentView()=="agenda")this._renderAgendaContent();else{if(this.model.orientation==="horizontal"&&this._customOrientation==="horizontal"){if(this._grouping.length>0)for(this._tempResource.length>1&&f!=this._tempResource.length-1&&(n(n(this.element.find(".e-resourceheadertable tr").eq(this._findResourceIndex(this._resCollect,this.model.resources[f].resourceSettings.id,o[0][this.model.resources[f].resourceSettings.id],null,null)))).remove(),n(n(this.element.find(".e-workcellstab tr").eq(this._findResourceIndex(this._resCollect,this.model.resources[f].resourceSettings.id,o[0][this.model.resources[f].resourceSettings.id],null,null)))).remove()),e=0;e<o.length;e++)rt=[],u=this._findResourceIndex(nt,this.model.resources[f].resourceSettings.id,o[e][this.model.resources[f].resourceSettings.id],this.model.resources[f].resourceSettings.groupId,o[e][this.model.resources[f].resourceSettings.groupId]),t.isNullOrUndefined(s)||e!=0?rt.push({name:o[e][this.model.resources[f].resourceSettings.text],classname:"e-childnode",marginleft:(this._tempResource.length>1?2:1)*10+"px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(nt[u],{classname:"e-childnode"})),userResTemplId:ft}):rt.push({name:o[e][this.model.resources[f].resourceSettings.text],classname:"e-parentnode",idnum:i.id+"_"+i.groupId,marginleft:"0px",width:"20px",backgroundcolor:"",border:"1px dotted #bbbcbb",bordertop:"",userResHeader:this._getResourceHeadTemplate(n.extend(nt[u],{classname:"e-parentnode"})),userResTemplId:ft}),it=this.addResourceTemplate.render({trs:rt}),t.isNullOrUndefined(this._horiResources)||this._horiResources.push(rt),b=this.addResourceCellsTemplate.render({cellrows:rt,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:this._strTime:this.datesColumn,column:this._columnValue,userTemplate:tt,userHtml:ut}),u==0?(n(n(this.element.find(".e-resourceheadertable tr").eq(u))).before(it),n(n(this.element.find(".e-workcellstab tr").eq(u))).before(b)):(n(n(this.element.find(".e-resourceheadertable tr").eq(u-1))).after(it),n(n(this.element.find(".e-workcellstab tr").eq(u-1))).after(b)),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderContentAreaTemplate")}else{var vt,ni=0,a=this.element.find(".e-headrealldaytable tr").length,hi=this._getWorkCellsCount(),ti=this.currentView=="month"?50:56;if(!t.isNullOrUndefined(o[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek]))for(e=0;e<o.length;e++)yt=this._findResourceIndex(this.res,this.model.resources[f].resourceSettings.groupId,o[e][this.model.resources[f].resourceSettings.groupId],null,null),t.isNullOrUndefined(yt)?this.res1.push(o[e]):this.res1.splice(yt+u,0,o[e]);if((f!=this._tempResource.length-1||this._tempResource.length==1||this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,i[this.model.resources[f].resourceSettings.groupId],null,null)==0)&&u==0)for(e=1;e<=a;e++)this.element.find(".e-headrealldaytable tr:nth-child("+e+")").find("td").eq(0).removeAttr("style");for(a=this.currentView()!="month"&&!this._isCustomMonthView()&&!this.model.timeScale.enable?a:a-1,e=f!=this._tempResource.length-1?1:0;e<o.length;e++){var ii=[],v=0,vt=this._getResourceColumnCount(o[e]);if(this._grouping.length>0){if(t.isNullOrUndefined(this.model.dateHeaderTemplateId)||this.currentView()=="month"||this._isCustomMonthView()?w=this._getResourceColumns(o[e],f,vt):(this._value=[],w=this._getUserDateheaderTemplate()),it=this.headTemplate.render({cols:w,view:this.currentView(),colspan:1}),ii.push({resourceNam:o[e][this._tempResource[f].resourceSettings.text],colspan:w.length,userResHeader:this._getResourceHeadTemplate(n.extend(o[e],{classname:this._tempResource.length-1==f?"e-childnode":"e-parentnode"})),userResTemplId:!1}),pt=this.resourceHeadTemplate.render({cols:w,resourceName:ii,leftWidth:ti}),this._tempResource.length>1){if(f!=this._tempResource.length-1)if(k=this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this._tempResource[0].resourceSettings.id,o[0][this.model.resources[f].resourceSettings.id],this._tempResource[0].resourceSettings.groupId,o[0][this.model.resources[f].resourceSettings.groupId]),s.length==1&&f!=si)for(y=0,et=0;et<k;et++)y=y+(t.isNullOrUndefined(this._tempResource[0].resourceSettings.dataSource[et].count)?0:this._tempResource[0].resourceSettings.dataSource[et].count);else y=this._findResourceIndex(this.res1,"id",o[e].id,"groupId",o[e].groupId);else{for(ot=0,y=0,k=this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,o[0][this.model.resources[f].resourceSettings.groupId],null,null),c=0;u==0?c<k:c<=k;c++)st=t.isNullOrUndefined(this._tempResource[0].resourceSettings.dataSource[c].count)?0:this._tempResource[0].resourceSettings.dataSource[c].count,y=u!=0&&c!=k||t.isNullOrUndefined(u)?y+st:y+(u>st?st:u==0?u+st:u),ot=ot+(!t.isNullOrUndefined(this._tempResource[0].resourceSettings.dataSource[c].count)&&c!=k?1:0);ri=this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(ot).prop("colSpan");this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(ot).attr("colspan",ri+w.length)}for(l=0;l<y;l++)v+=this.element.find(".e-headrealldaytable tr:nth-child("+(a-1)+")").find("td").eq(l).prop("colSpan");u=y}else for(u=this._findResourceIndex(nt,this.model.resources[f].resourceSettings.id,o[e][this.model.resources[f].resourceSettings.id],this.model.resources[f].resourceSettings.groupId,o[e][this.model.resources[f].resourceSettings.groupId]),c=0;c<u;c++)v+=this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(c).prop("colSpan");for(u==0&&v==0?(this.element.find(".e-headrealldaytable tr:nth-child("+a+")").find("td").eq(v).before(it),this.element.find(".e-headrealldaytable tr:nth-child("+(a-1)+")").find("td").eq(u).before(pt)):(this.element.find(".e-headrealldaytable tr:nth-child("+a+")").find("td").eq(v-1).after(it),this.element.find(".e-headrealldaytable tr:nth-child("+(a-1)+")").find("td").eq(u-1).after(pt)),this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable&&this.model.showAllDayRow&&(wt=this.alldayTemp.render({cols:w,colspan:1,userTemp:at,userHtml:gt}),v==0?this.element.find(".e-headrealldaytable tr:nth-child("+(a+1)+")").find("td").eq(v).before(wt):this.element.find(".e-headrealldaytable tr:nth-child("+(a+1)+")").find("td").eq(v-1).after(wt),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderHeaderAllDayTemplate")),l=1;l<=hi.length;l++)this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?(tt&&(ui=new Array(o[e]),ut=this._getWorkCellsTemplate(ui,vt)),b=this.addResWorkcellTemp.render({cols1:this._value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:tt,userHtml:ut,value:l,wIndex:0})):b=this.addResMonthcellTemp.render({cols1:this._value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:tt,userHtml:ut,tenable:this.model.timeScale.enable,cview:this.currentView()!=="month"&&!this._isCustomMonthView()}),u==0&&this.element.find(".e-workcellstab tr:nth-child("+l+")").find("td").eq(0).removeAttr("style"),v==0?this.element.find(".e-workcellstab tr:nth-child("+l+")").find("td").eq(v).before(b):this.element.find(".e-workcellstab tr:nth-child("+l+")").find("td").eq(v-1).after(b),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderContentAreaTemplate");ni+=w.length;t.isNullOrUndefined(this._findResourceIndex(this.res1,this._tempResource[f].resourceSettings.id,o[e][this._tempResource[f].resourceSettings.id],this._tempResource[f].resourceSettings.groupId,o[e][this._tempResource[f].resourceSettings.groupId]))||n.merge(this.dateRender,vt)}}this._tempResource.length>1&&this._grouping.length>0&&f!=this._tempResource.length-1&&(u=this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[f].resourceSettings.id,o[0][this.model.resources[f].resourceSettings.id],this.model.resources[f].resourceSettings.groupId,o[0][this.model.resources[f].resourceSettings.groupId]),bt=this.resourceHeadTemplate.render({cols:w,resourceName:{resourceNam:o[0][this.model.resources[f].resourceSettings.text],colspan:ni,userResHeader:this._getResourceHeadTemplate(n.extend(o[0],{classname:this._tempResource.length-1==f?"e-childnode":"e-parentnode"})),userResTemplId:ft},leftWidth:ti}),u=this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").length>u?u:this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").length,u==0?this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(u).before(bt):this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(u-1).after(bt));this._getRenderDates()}if(this._tempResource.length>1){var fi=[],ci=[],lt=[],ei=[],h=this._getResourceCollection();
10for(fi=n.merge(fi,h),c=0,l=0;l<h[h.length-2].dataSource.length;l++)for(ht=(new t.Query).where(h[h.length-1].groupId,t.FilterOperators.equal,h[h.length-2].dataSource[l][h[h.length-2].id]),s=new t.DataManager(h[h.length-1].dataSource).executeLocal(ht),s.length>0&&(h[0].dataSource[l].count=s.length),d=0;d<s.length;)ci.push({resourceNam:s[d][h[h.length-1].text],userResHeader:this._getResourceHeadTemplate(n.extend(s[d],{classname:"e-childnode"})),userResTemplId:ft}),lt[c]=s[d],ei.push(s[d]),c++,d++;for(this._valueCollection=lt,this._tempResource[this._tempResource.length-1].dataSource=lt,h[h.length-1].dataSource=lt,e=0;e<h.length;e++)this.render_Resources[e]=h[e].dataSource,this._resCollection[e].dataSource=h[e].dataSource}this.model.timeScale.enable&&this._borderAddRemove();this.res1=this._tempResource.length>1?ei:dt;this.render_resource=this.res1;this._highlightBusinessHours();this.model.orientation==="vertical"&&this._customOrientation==="vertical"?this.refreshScroller():this._horizontalRender();this._renderAppointmentAll()}}}}},_getWorkCellsTemplate:function(t,i){var f,u=[],e=[],o,s,h=this.model.timeScale.minorSlotCount,r;for(o=n.templates(n(this.model.workCellsTemplateId).html()),u=[],r=0;r<i.length;r++)f=new Date(new Date(i[r]).setHours(this.model.startHour,0,0)),s=o.render({date:f,view:this.currentView(),resource:t[0],timescale:this.model.timeScale.enable}),u.push(s.trim());return e.push(u),e},_getResourceColumnCount:function(i){var r=[],h=this,f=i[this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],e,o,u,s;if(this.currentView()==="workweek")if(t.isNullOrUndefined(f))u=n.extend(!0,[],this._renderDates),s=this._getWeekDays(),u=u.filter(function(n){return s.indexOf(new Date(n).getDay())!=-1}),n.merge(r,u);else for(f=this._resourceDaysReorder(f),e=0;e<f.length;e++)o=this._getDayNameIndex(f[e].capitalizeFirstString()),o==-1&&(o=this._getDayNameIndex(f[e])),r.push(this._renderDates[o]);else this.currentView()==="day"?r.push(new Date(this.currentDate().getFullYear(),this.currentDate().getMonth(),this.currentDate().getDate()).getTime()):this.model.showWeekend?r=this._renderDates:(u=n.extend(!0,[],this._renderDates),s=this._getWeekDays(),u=u.filter(function(n){return s.indexOf(new Date(n).getDay())!=-1}),n.merge(r,u)),r=this.currentView()=="month"?this._dateRender:r;return r},_getResourceColumns:function(n,i,r){var o=[],s,u;for(this._value=[],s=this.currentView()=="month"?this._getColumnCount().length:r.length,u=0;u<s;u++){var f=this.currentView()==="month"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(r[u]).getDay()]:this._dayShortNames[new Date(r[u]).getDay()]:this._dayShortNames[new Date(r[u]).getDay()],e=new Date(new Date(this._dateRender[u]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()?"e-headerToday":"",h=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:f,currentDateClass:"",cellToday:""}:this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?{currentDay:t.format(new Date(r[u]),this._pattern.D,this.model.locale),currentDateClass:"",cellToday:e}:{currentDay:f+" "+new Date(r[u]).getDate(),currentDateClass:"",cellToday:e}:{currentDay:f+" "+new Date(r[u]).getDate(),currentDateClass:new Date(r[u]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:e};o.push(h);this._value.push(u)}return o},removeResource:function(i,r){var d,tt,it,p,l,rt,g,h,s,w,a,nt,v,e,ut,b;if(this._tempResource.length>0){var o,s=0,h,y=0,c=[],f=[],k=this._tempResource.length==1&&this.model.orientation==="horizontal"&&this._customOrientation==="horizontal"?n.extend(!0,[],this._resCollect):n.extend(!0,[],this.res1),u=this._findResourceIndex(this._tempResource,"name",r,null,null);if(!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(this._findResourceIndex(this._tempResource[u].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,i,null,null))){if(d=this._resourceSort(),(this.model.orientation==="vertical"&&this._customOrientation==="vertical"||this.currentView()=="agenda")&&(this._resCollect=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource,this._tempResource.length==1&&(this._tempResource[u].resourceSettings.dataSource=this.model.resources[u].resourceSettings.dataSource)),u!=this._tempResource.length-1){if(tt=(new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,i),c=new t.DataManager(this.model.resources[this._tempResource.length-1].resourceSettings.dataSource).executeLocal(tt),f.push(this._tempResource[u].resourceSettings.dataSource[this._findResourceIndex(this._tempResource[u].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,i,null,null)]),!t.isNullOrUndefined(c))for(e=0;e<c.length;e++)t.isNullOrUndefined(f[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])&&this.res1.splice(this._findResourceIndex(this._tempResource[u+1].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,c[e][this.model.resources[u].resourceSettings.id],null,null),1),this._tempResource[u+1].resourceSettings.dataSource.splice(this._findResourceIndex(this._tempResource[u+1].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,c[e][this.model.resources[u].resourceSettings.id],null,null),1),f.pu
10sh(c[e])}else f.push(this._tempResource[u].resourceSettings.dataSource[this._findResourceIndex(this._tempResource[u].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,i,null,null)]),t.isNullOrUndefined(f[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])&&this.res1.splice(this._findResourceIndex(this.res1,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.id],null,null),1),(this.model.orientation==="vertical"&&this._customOrientation==="vertical"||this.currentView()=="agenda")&&this._tempResource[u].resourceSettings.dataSource.splice(this._findResourceIndex(this.res1,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.id],null,null),1);if(it=this._tempResource.length>1?u!=this._tempResource.length-1?c.length>0:!0:!0,it){if(this.currentView()=="agenda")this._renderAgendaContent();else if(this.model.orientation==="vertical"&&this._customOrientation==="vertical"){for(l=this.element.find(".e-headrealldaytable > tbody > tr").length,l=this.currentView()!="month"&&!this._isCustomMonthView()&&!this.model.timeScale.enable?l:l-1,rt=this._getWorkCellsCount(),e=0;e<f.length;e++)if(!t.isNullOrUndefined(c)&&e==0&&c.length>0||this._tempResource.length>1&&u==this._tempResource.length-1&&(g=this._findResourceIndex(this.model.resources[this._tempResource.length-1].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,f[e][this.model.resources[u].resourceSettings.id],null,null),t.isNullOrUndefined(g)||this.model.resources[this._tempResource.length-1].resourceSettings.dataSource.splice(g,1)),this._grouping.length>0){if(this._tempResource.length>1)if(h=this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.groupId],null,null),u!=this._tempResource.length-1){if(e!=0){for(s=0,a=0;a<h;a++)s=s+(t.isNullOrUndefined(this._tempResource[0].resourceSettings.dataSource[a].count)?0:this._tempResource[0].resourceSettings.dataSource[a].count);p=this.element.find(".e-headrealldaytable tr:nth-child("+(l-1)+")").find("td").eq(s).prop("colSpan")}}else{for(this._tempResource[0].resourceSettings.dataSource[h].count=this._tempResource[0].resourceSettings.dataSource[h].count-1,s=this._findResourceIndex(k,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.id],null,null),p=this.element.find(".e-headrealldaytable tr:nth-child("+(l-1)+")").find("td").eq(s).prop("colSpan"),w=0,v=0;v<h;v++)t.isNullOrUndefined(this._tempResource[0].resourceSettings.dataSource[v].count)||(w+=1);this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(w).prop("colSpan",this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(w).prop("colSpan")-p)}else s=this._findResourceIndex(k,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.id],null,null),p=this.element.find(".e-headrealldaytable tr:nth-child("+(l-1)+")").find("td").eq(s).prop("colSpan");if(s!=0)for(y=0,a=0;a<s;a++)y+=this.element.find(".e-headrealldaytable tr:nth-child("+(l-1)+")").find("td").eq(a).prop("colSpan");if(!t.isNullOrUndefined(p)){for(nt=0;nt<p;nt++)for(this.dateRender.splice(y,1),this.element.find(".e-headrealldaytable tr:nth-child("+l+")").find("td").eq(y).remove(),this.element.find(".e-headrealldaytable tr:nth-child("+(l+1)+")").find("td").eq(y).remove(),v=1;v<=rt.length;v++)this.element.find(".e-workcellstab tr:nth-child("+v+")").find("td").eq(y).remove();this.element.find(".e-headrealldaytable tr:nth-child("+(l-1)+")").find("td").eq(s).remove()}}this._tempResource.length>1&&(u!=this._tempResource.length-1?(o=this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.id],this.model.resources[u].resourceSettings.groupId,f[0][this.model.resources[u].resourceSettings.groupId]),this.model.resources[u].resourceSettings.dataSource.splice(this._findResourceIndex(this.model.resources[u].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.id],null,null),1)):this._tempResource[0].resourceSettings.dataSource[h].count==0&&(o=this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.groupId],null,null),delete this._tempResource[0].resourceSettings.dataSource[o].count),!t.isNullOrUndefined(o)&&this._grouping.length>0&&(o=this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").length>o?o:this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").length-1,this.element.find(".e-headrealldaytable tr:nth-child(1)").find("td").eq(o).remove()))}else{for(e=0;e<f.length;e++)!t.isNullOrUndefined(c)&&e==0&&c.length>0?(o=this._findResourceIndex(d,this.model.resources[u].resourceSettings.id,f[e][this.model.resources[u].resourceSettings.id],this.model.resources[u].resourceSettings.groupId,f[e][this.model.resources[u].resourceSettings.groupId]),this.model.resources[u].resourceSettings.dataSource.splice(this._findResourceIndex(this._tempResource[u].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,f[0][this.model.resources[u].resourceSettings.id],null,null),1)):(ut=this._tempResource.length>1?this._resCollect:k,o=this._findResourceIndex(ut,this.model.resources[u].resourceSettings.id,f[e][this.model.resources[u].resourceSettings.id],"classname","e-childnode"),s=this._findResourceIndex(this.model.resources[this._tempResource.length-1].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,f[e][this.model.resources[u].resourceSettings.id],null,null),t.isNullOrUndefined(s)||u!=this._tempResource.length-1||this.model.resources[this._tempResource.length-1].resourceSettings.dataSource.splice(s,1)),t.isNullOrUndefined(this._findResourceIndex(this._resCollect,this.model.resources[u].resourceSettings.id,f[e][this.model.resources[u].resourceSettings.id],this.model.resources[u].resourceSettings.groupId,f[e][this.model.resources[u].resourceSettings.groupId]))||this._resCollect.splice(o,1),this._grouping.length>0&&(this._horiResources.splice(o,1),this._tempResource.length>1&&u==this._tempResource.length-1&&(h=this._findResourceIndex(this._tempResource[0].resourceSettings.dataSource,this.model.resources[u].resourceSettings.id,d[o][this.model.resources[1].resourceSettings.groupId]),this._tempResource[0].resourceSettings.dataSource[h].count=this._tempResource[0].resourceSettings.dataSource[h].count-1,this._tempResource[0].resourceSettings.dataSource[h].count==0&&(n(n(this.element.find(".e-resourceheadertable tr").eq(o-1))).find(".e-parentnodecategory, .e-resourceicon, .e-resourcecollapse").removeClass("e-resourceicon, e-resourcecollapse"),delete this._tempResource[0].resourceSettings.dataSource[h].count)),n(n(this.element.find(".e-resourceheadertable tr").eq(o))).remove(),n(n(this.element.find(".e-workcellstab tr").eq(o))).find(".e-appointwrapper").remove(),n(n(this.element.find(".e-workcellstab tr").eq(o))).remove());for(this._resourceInfo=[],b=0;b<=this.model.resources.length-1;b++)this._resourceInfo.push(this.model.resources[b].resourceSettings)}this._getRenderDates();this.model.timeScale.enable&&this._borderAddRemove();this.model.orientation==="vertical"&&this._customOrientation==="vertical"?this._grouping.length&&this.refreshScroller():this._horizontalRender();this._resourceSort()}}(this._resCollect.length==0||this.res1==0)&&this.refresh()}},_getResourceCollection:function(){var i=[],f,n,r,u;if(this._tempResource.length!=0){if(t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0)for(n=0;n<this._tempResource.length;n++)i.push({index:n});else{for(n=0;n<this._grouping.length;n++)f=this._findResourceIndex(this._tempResource,"name",this._grouping[n],null,null),i.push({index:f,name:this._tempResource[n].name});i=i.sort(function(n,t){var i=n.index,r=t.index;return i<r?-1:i>r?1:0})}for(r=[],u=0;u<i.length;u++)r.push(this._resourceInfo[i[u].index]);return this._resCollection=r,r}},_resourceSort:function(){var i,r,c,l,v,y=[],n=[],p=[],o,a,s,f,u,e,h;if(this._tempResource.length>1){for(o=0;o<this._tempResource.length;o++)for(a=0;a<this._tempResource[o].resourceSettings.dataSource.length;a++)y.push(this._tempResource[o].resourceSettings.dataSource[a]);for(r=1,s=0;s<this._tempResource.length;s++){for(f=0,u=this._tempResource[s].resourceSettings.dataSource;f<u.length;f++)if(c=n.indexOf(u[f]),c==-1?n.push(u[f]):"",i=new t.DataManager(y).executeLocal((new t.Query).where(this._tempResource[r].resourceSettings.groupId,t.FilterOperators.equal,u[f][this._tempResource[s].resourceSettings.id])),i=i.filter(function(n){return u.indexOf(n)===-1}),l=n.indexOf(u[f]),i.length!=0)for(e=0;e<i.length;e++)v=l+e+1,c=n.indexOf(i[e]),c==-1?n.splice(v,0,i[e]):"";r++;r=r==this._tempResource.length?r-1:r}for(h=0;h<n.length;h++)l=this.res1.indexOf(n[h]),l!=-1&&p.push(n[h]);this.res1=p}else n=this.res1;return n},_renderMultipleResourceHeaderTemplate:function(i,r){var tt,k,p,it,rt,nt,h,u,e,et,ot,c,y,b,o,l,s,a;this.res1=[];this.render_Resources=[];this.level_Resources=[];var w=this.currentView(),f=this._getResourceCollection(),st=this.model.showWeekend?7:this.model.workWeek.length,v=w=="day"?1:w=="week"||w=="month"?st:this.model.workWeek.length;if(v=w=="customview"&&this._dateRender.length>=7?st:w=="customview"&&this._dateRender.length<7?this._dateRender.length:v,t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0){for(a=0;a<this._tempResource.length;a++)this.render_Resources.push(this._tempResource[a].resourceSettings.dataSource);this.res1=[0]}else if(tt=this.model.resourceHeaderTemplateId?!0:!1,k=[],this._grouping.length===1){for(u=0;
10u<this._grouping.length;u++)p=this._findResourceIndex(this._tempResource,"name",this._grouping[u],null,null);for(u=0;u<this._resourceInfo[p].dataSource.length;u++)this._resWorkWeek&&(o=t.isNullOrUndefined(this._resourceInfo[p].dataSource[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?v:this._resourceInfo[p].dataSource[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length),this._resCustomView&&(s=this._resourceInfo[p].dataSource[u][this._tempResource[this._tempResource.length-1].resourceSettings.renderDates],o=t.isNullOrUndefined(s)?v:t.isNullOrUndefined(s)||n.type(s[0])!="object"?s.length:this._getMultipleCustomDatesCount(s)),this.currentView()!="agenda"&&k.push({resourceNam:this._resourceInfo[p].dataSource[u][this._resourceInfo[p].text],colspan:this._resWorkWeek||this._resCustomView?o:v,userResHeader:this._getResourceHeadTemplate(n.extend(this._resourceInfo[p].dataSource[u],{classname:"e-childnode"})),userResTemplId:tt}),this.res1.push(this._resourceInfo[p].dataSource[u]),this.level_Resources.push(this.res1[u]);this._valueCollection=this.res1;this.render_Resources.push(this.res1);this.model.orientation==="vertical"&&this._customOrientation==="vertical"&&this.currentView()!="agenda"&&i!==null&&r!=null&&(it=w=="month"?50:56,rt=this.resourceHeadTemplate.render({cols:r,resourceName:k,leftWidth:it}),i.append(t.buildTag("tr.e-headerbar").append(rt)))}else{var ht=[],at=[],ut=[],g=0,ct=[],ft=[],vt=[],lt=[];if(this.resourceValue=0,nt=0,ht=n.merge(ht,f),this._tempResource.length){for(a=0,e=0;e<f[f.length-2].dataSource.length;e++)for(var b=(new t.Query).where(f[f.length-1].groupId,t.FilterOperators.equal,f[f.length-2].dataSource[e][f[f.length-2].id]),c=new t.DataManager(f[f.length-1].dataSource).executeLocal(b),d=0;d<c.length;)at.push({resourceNam:c[d][f[f.length-1].text],colspan:1*v,userResHeader:this._getResourceHeadTemplate(n.extend(c[d],{classname:"e-childnode"})),userResTemplId:tt}),ut[a]=c[d],this.res1.push(c[d]),a++,d++;this._valueCollection=ut;f[f.length-1].dataSource=ut;h=n.extend(!0,[],f)}for(u=this._tempResource.length-1;u>=0;u--){for(vt.push(u),e=0;e<f[u].dataSource.length;e++){if(et=u!=0?this._findResourceIndex(f[u-1].dataSource,f[u-1].id,f[u].dataSource[e][f[u].groupId],null,null):0,ot=u!=this._tempResource.length-1?this._findResourceIndex(f[u+1].dataSource,f[u+1].groupId,f[u].dataSource[e][f[u].id],null,null):this._tempResource.length-1,t.isNullOrUndefined(et)&&t.isNullOrUndefined(ot)?f[u].dataSource[e]=0:"",!t.isNullOrUndefined(et)&&!t.isNullOrUndefined(ot)&&f[u].dataSource[e]!==0){if(ft.push(f[u].dataSource[e]),this.resourceValue=ft.length,u<=this._tempResource.length-2){if(b=(new t.Query).where(f[u+1].groupId,t.FilterOperators.equal,f[u].dataSource[e][f[u].id]),c=new t.DataManager(f[u+1].dataSource).executeLocal(b),u<=this._tempResource.length-3){for(a=0;a<c.length;a++)g=g+(t.isNullOrUndefined(c[a].count)?0:c[a].count);nt=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?g:g+c.length;f[u].dataSource[e].count=nt;g=0}u==this._tempResource.length-2&&(f[u].dataSource[e].count=c.length,nt=c.length);this.resourceValue=nt;c.length=0}if(this._resWorkWeek){if(y=0,u!=this._tempResource.length-1)for(b=(new t.Query).where(h[u+1].groupId,t.FilterOperators.equal,h[u].dataSource[e][h[u].id]),o=new t.DataManager(h[u+1].dataSource).executeLocal(b),l=0;l<o.length;l++)y+=t.isNullOrUndefined(o[l][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?t.isNullOrUndefined(o[l].colspan)?v:o[l].colspan:o[l][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;else y+=t.isNullOrUndefined(h[u].dataSource[e][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?v:h[u].dataSource[e][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;h[u].dataSource[e].colspan=y;this.resourceValue=y}if(this._resCustomView){if(y=0,u!=this._tempResource.length-1)for(b=(new t.Query).where(h[u+1].groupId,t.FilterOperators.equal,h[u].dataSource[e][h[u].id]),o=new t.DataManager(h[u+1].dataSource).executeLocal(b),l=0;l<o.length;l++)s=o[l][this._tempResource[this._tempResource.length-1].resourceSettings.renderDates],y+=t.isNullOrUndefined(s)?t.isNullOrUndefined(o[l].colspan)?v:o[l].colspan:n.type(s[0])=="object"?this._getMultipleCustomDatesCount(s):s.length;else s=this._tempResource[this._tempResource.length-1].resourceSettings.renderDates,y+=t.isNullOrUndefined(h[u].dataSource[e][s])?v:this._getCustomDatesCount(e,s);h[u].dataSource[e].colspan=y;this.resourceValue=y}this.currentView()!="agenda"&&k.push({resourceNam:f[u].dataSource[e][f[u].text],colspan:this._resWorkWeek||this._resCustomView?this.resourceValue:this.resourceValue*v,userResHeader:this._getResourceHeadTemplate(n.extend(f[u].dataSource[e],{classname:this._tempResource.length-1==u?"e-childnode":"e-parentnode"})),userResTemplId:tt});this.level_Resources.push(f[u].dataSource[e]);ft.length=0}this.model.orientation==="vertical"&&this._customOrientation==="vertical"&&this.currentView()!="agenda"&&i!==null&&r!=null&&(it=w=="month"?50:56,rt=this.resourceHeadTemplate.render({cols:r,resourceName:k,leftWidth:it}),lt[u]=t.buildTag("tr.e-headerbar").append(rt)[0])}ct[u]=f[u].dataSource;k.length=0}this.render_Resources=ct;this.model.orientation==="vertical"&&this._customOrientation==="vertical"&&this.currentView()!="agenda"?i.append(lt):""}return i},_getMultipleResourceAlldayApp:function(n,i,r,u){this.allDayCount=[];new Date(new Date(n[i]).setHours(0,0,0,0)).getTime()==new Date(new Date(u[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]==this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.id]&&(u[this._appointmentSettings.allDay]===!0||(new Date(u[this._appointmentSettings.endTime])-new Date(u[this._appointmentSettings.startTime]))/36e5>=24||this._findAllDayApp(u))&&(!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()]==this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.groupId]:!0)?(this._setAllDayPos(u,i,r),this.allDayCount.push(u)):this._resWorkWeek&&new Date(n[i-1]).getDay()==0&&new Date(new Date(n[i]).setHours(0,0,0,0)).getTime()>
10new Date(new Date(u[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(new Date(u[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()).getDay()!=0&&new Date(new Date(n[i]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&u[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]==this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.id]&&u[this._appointmentSettings.allDay]===!0&&(this._setAllDayPos(u,i,r),this.allDayCount.push(u))},_getResourceColor:function(n){var i=this._resCollection,f,r="",u="",e;if(t.isNullOrUndefined(this.model.group))f=this._findResourceIndex(this.render_Resources[this.render_Resources.length-1],i[i.length-1].id,n[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()],null,null),t.isNullOrUndefined(f)||(r=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].color])?r:this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].color],u=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].appointmentClass])?u:this.render_Resources[this.render_Resources.length-1][f][i[i.length-1].appointmentClass]);else{for(e=0;e<this.render_Resources.length;e++)if(f=this._findResourceIndex(this.render_Resources[e],i[e].id,n[this._appointmentSettings.resourceFields.split(",")[e].trim()],null,null),!t.isNullOrUndefined(f)&&(r=r==""||t.isNullOrUndefined(r)?this.render_Resources[e][f][i[e].color]:r,u=u==""||t.isNullOrUndefined(u)?this.render_Resources[e][f][i[e].appointmentClass]:u,!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(u)))break;r=!t.isNullOrUndefined(r)&&r!=""?r:"";u=!t.isNullOrUndefined(u)&&u!=""?u:""}return{appointData:r,appointCustomcss:u,applyFilter:!1}},_getResourceValue:function(n){var u,i,r;return t.scheduleFeatures.resources&&this._tempResource.length!=0&&(i=this._getResourceDetails(n),r=t.Predicate(this._tempResource[i.length-1].resourceSettings.id,t.FilterOperators.equal,i[0].id),r=this._grouping.length>1?r.and(this._tempResource[i.length-1].resourceSettings.groupId,t.FilterOperators.equal,i[1].id):r,u=t.DataManager(this._resCollection[i.length-1].dataSource).executeLocal((new t.Query).where(r))[0]),u},_getResourceDetails:function(n,i){var s,e,u,c,o,h,a,v,l,r,f;if(this._tempResource.length!=0&&this._tempResource.length>0){if(s=this.currentView()=="day"?1:this.model.showWeekend&&(this.currentView()=="week"||this.currentView()=="month")?7:this.model.workWeek.length,s=this.model.showWeekend&&this.currentView()=="customview"&&this._dateRender.length>=7?7:this.currentView()=="customview"&&this._dateRender.length<7?this._dateRender.length:s,i=this.currentView()==="month"||this.currentView()=="customview"?n.index():!t.isNullOrUndefined(this._cellIndex)&&t.isNullOrUndefined(this._multiple)?this._cellIndex:n.index(),n.hasClass("e-detailedapp")?"":this.index=i,i=n.hasClass("e-detailedapp")?this.index:i,this._resWorkWeek){for(e=0,u=0;u<this._valueCollection.length;u++)if(e+=t.isNullOrUndefined(this._valueCollection[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this._valueCollection[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,e>n.index()){i=u;break}}else if(this._resCustomView){for(e=0,u=0;u<this._valueCollection.length;u++)if(c=this._tempResource[this._tempResource.length-1].resourceSettings.renderDates,t.isNullOrUndefined(this._valueCollection[u][c])||(e+=this._getCustomDatesCount(u,c)),e>n.index()){i=u;break}}else i=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?parseInt(i/s):t.isNullOrUndefined(this._workCellIndex)?n.parent().index():this._workCellIndex;for(o=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?this._valueCollection:this._resCollect,i=!t.isNullOrUndefined(o)&&i>o.length?n.closest(".e-workcells").hasClass("e-workcells")?n.parent().index():n.closest(".e-workcells").parent().index():i,i=i>0?i:0,this._resourceCollection=[],r=this._resCollection,f=r.length-1;f>=0;f--)f==r.length-1?t.isNullOrUndefined(this.model.group)?(this._resourceCollection.push({id:r[r.length-1].dataSource[i][r[r.length-1].id]}),h=r[r.length-1].dataSource[i][r[r.length-1].groupId]):(this._resourceCollection.push({id:o[i][r[f].id]}),h=o[i][r[f].groupId]):(a=r[f].dataSource instanceof t.DataManager?r[f].dataSource:t.DataManager(r[f].dataSource),v=(new t.Query).where(r[f].id,t.FilterOperators.equal,h),l=a.executeLocal(v),this._resourceCollection.push({id:l[0][r[f].id]}),h=l[0][r[f].groupId]);return this._resourceCollection}},_getResourceFields:function(n){if(!t.isNullOrUndefined(this.model.group)||this._tempResource.length>1)for(var i=0,r=this._resourceCollection.length-1;i<this._resourceCollection.length;i++,r--)n[this._appointmentSettings.resourceFields.split(",")[i].trim()]=this._resourceCollection[r].id;else n[this._appointmentSettings.resourceFields.split(",")[0].trim()]=this._resourceCollection[0].id;return n},_getDragDropResourceData:function(n,i,r){var b=r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()],p,h,c,o,u,v,f,e,w,y,l,k,s,a;if(n._appointmentSettings.resourceFields.split(",").length>1&&(p=r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]),!t.isNullOrUndefined(i)){if(h=n.currentView()=="day"?1:n.model.showWeekend&&(n.currentView()=="week"||n.currentView()=="month")?7:n.model.workWeek.length,h=n.model.showWeekend&&n.currentView()=="customview"&&n._dateRender.length>=7?7:n.currentView()=="customview"&&n._dateRender.length<7?n._dateRender.length:h,c=n.model.enableRTL?n.res1.length-Math.floor(i/h)-1:Math.floor(i/h),n._resWorkWeek)for(o=0,u=0;u<n.res1.length;u++)if(o+=t.isNullOrUndefined(n.res1[u][n.model.resources[n.model.resources.length-1].resourceSettings.workWeek])?n.model.workWeek.length:n.res1[u][n.model.resources[n.model.resources.length-1].resourceSettings.workWeek].length,o>i){c=u;break}if(n._resCustomView)for(o=0,u=0;u<n.res1.length;u++)if(v=n.model.resources[n.model.resources.length-1].resourceSettings.renderDates,t.isNullOrUndefined(n.res1[u][v])||(o+=n._getCustomDatesCount(u,v)),o>i){c=u;break}if(f=n.model.orientation=="vertical"&&n._customOrientation=="vertical"?n.res1[c]:n._resCollect[i],this._groupEditing||this._groupEdit){if(e=(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]+",").split(","),n._appointmentSettings.resourceFields.split(",").length>1&&(w=(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]+",").split(",")),y=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),y[0]=this.tempResApp,l=y[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]].toString(),k=this._findResourceIndex(n.res1,"id",l,null,null),e.length-1<2&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]=f[n.model.resources[n.model.resources.length-1].resourceSettings.id].toString()+",",n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]=f[n.model.resources[n.model.resources.length-1].resourceSettings.groupId].toString()+",")),e.length-1>=2&&l!=f[n.model.resources[n.model.resources.length-1].resourceSettings.id].toString())for(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]="",n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]=""),s=0;s<e.length-1;s++)if(e[s]==l){for(a=0;a<e.length-1;a++)if(e[a]==f[n.model.resources[n.model.resources.length-1].resourceSettings.id].toString())return r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]=b,n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]=p),r[n._appointmentSettings.startTime]=this.tempResApp[n._appointmentSettings.startTime],r[n._appointmentSettings.endTime]=this.tempResApp[n._appointmentSettings.endTime],this._reverse=!0,r;r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]+=f[n.model.resources[n.model.resources.length-1].resourceSettings.id].toString()+",";n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]+=f[n.model.resources[n.model.resources.length-2].resourceSettings.groupId].toString()+",")}else r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]+=e[s]+",",n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]+=w[s]+",")}else r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]=f[n.model.resources[n.model.resources.length-1].resourceSettings.id]+",",n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]=f[n.model.resources[n.model.resources.length-1].resourceSettings.groupId]+",");r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()].lastIndexOf(",")==r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()].length-1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()]=r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-1].trim()].slice(",",-1),n._appointmentSettings.resourceFields.split(",").length>1&&(r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()]=r[n._appointmentSettings.resourceFields.split(",")[n._appointmentSettings.resourceFields.split(",").length-2].trim()].slice(",",-1)))}return r},_renderResourceData:function(n,i){var f,u,r,e,s,o;if((n.hasClass("e-workcells")||n.hasClass("e-alldaycells")||n.hasClass("e-monthcells"))&&
10!n.hasClass("e-resourceheadercells")&&this._getResourceDetails(n),f=[],u=[],this._tempResource.length)for(r=this._resourceCollection.length-1;r>=0;r--)e=r==this._resourceCollection.length-1?this._grouping.length>1?this._findResourceIndex(this._resCollection[r].dataSource,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id,this._resCollection[r].groupId,this._resourceCollection[this._resourceCollection.length-r].id):this._findResourceIndex(this._resCollection[r].dataSource,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id,null,null):this._findResourceIndex(this._resCollection[r].dataSource,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id,null,null),f.push(this._resCollection[r].dataSource[e]),r!=0?(s=(new t.Query).where(t.Predicate(this._resCollection[r].groupId,t.FilterOperators.equal,this._resCollection[r].dataSource[e][this._resCollection[r].groupId])),o=new t.DataManager(this._resCollection[r].dataSource).executeLocal(s),i=this._findResourceIndex(o,this._resCollection[r].id,this._resourceCollection[this._resourceCollection.length-1-r].id,null,null),u=o,this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",u),this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(u[i][this._resCollection[r].id])):(this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+r).ejAutocomplete("option","dataSource",this._resCollection[r].dataSource),this._appointmentAddWindow.find(".owner_"+r).data("ejAutocomplete").selectValueByKey(f[this._resourceCollection.length-1-r][this._resCollection[r].id]))},_bindResourcesData:function(){var i,n;if(this._tempResource.length!=0){for(this._resourceInfo=[],i=!1,n=0;n<this._tempResource.length;n++)t.isNullOrUndefined(this._tempResource[n].resourceSettings)||(!t.isNullOrUndefined(this._tempResource[n].resourceSettings.query)&&this._tempResource[n].resourceSettings.query instanceof t.Query||(this._tempResource[n].resourceSettings.query=t.Query()),this._tempResource[n].resourceSettings.dataSource instanceof t.DataManager?this._initResourceData(this._tempResource[n].resourceSettings,n):(this._resourceInfo.push(this._tempResource[n].resourceSettings),i=!0));i&&this._renderInitSchedule()}},_renderResourceElements:function(n){for(var t=0;t<this._tempResource.length;t++)n+="<tr><td class='e-leftfields e-textlabel'>"+this._tempResource[t].title+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"_ownerfield_"+t+"' class='owner_"+t+"' type='text' value=''/><div id='ownerlist'><\/div><\/td><\/tr>";return n},_renderResourcesTemplate:function(){this.resourceHeadTemplate=n.templates(i())}}}(jQuery,Syncfusion),function(n,t,i){t.scheduleFeatures=t.scheduleFeatures||{};var r=function(){return"<table class='e-table e-workcellstab' style='width:100%;height:100%;'><tbody>{{for cellrows ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml ~tenable=tenable ~cview=cview}}<tr>{{for ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}<td class='e-monthcells' style='width:{{:~cwidth}};height:{{:~cheight}};'><div class='e-monthheader' {{if ~tenable == false && ~cview == true}}style='display:none'{{/if}}><\/div>{{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}<\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},u=function(){return"<div class='{{:appClass}} {{:appointCustomcss}}' id='Appointment_{{:id}}' data-guid= '{{:uid}}' data-resource='{{:resId}}' role='presentation' style='{{if rtl == true}}right{{else}}left{{/if}}: {{:left}}; {{if ignoreColorFilter == true}}filter:none;{{/if}} width: {{:appWidth}}; background: {{:appointData}}; color:{{:appointtextcolor}}; height:{{:appHeight}}px; top: {{:top}}px;' >{{if appResize == true}}{{if appClass == 'e-appointment'}}{{if orientation == 'vertical'}}<div class='e-tophandle'><\/div><div class='e-bottomhandle'><\/div>{{else}}<div class='e-lefthandle'><\/div><div class='e-righthandle'><\/div>{{/if}}{{else}}{{if currentview != 'day'}}<div class='e-lefthandle'><\/div><div class='e-righthandle'><\/div>{{/if}}{{/if}}{{/if}}<span class='e-icon e-schedulemouseclose'/><\/span>{{if (priority!=undefined && priority!='') && ((priorityTemplate!=undefined && priorityTemplate!=''))}}{{if enablePriority==null}}<div class='e-priority e-{{:priorityTemplate}}'><\/div>{{else}}<div class='e-priority'>{{:priorityTemplate}}<\/div>{{/if}}{{/if}}{{if userAppTemplId == false}}{{if leftInd ==true}}<span class='e-icon e-arrow-sans-left e-leftind'><\/span>{{/if}}{{if rightInd ==true}}<span class='e-icon e-arrow-sans-right e-rightind'><\/span>{{/if}}{{if bottomInd ==true}}<span class='e-icon e-arrow-sans-down e-bottomind'><\/span>{{/if}}{{if topInd ==true}}<span class='e-icon e-arrow-sans-up e-topind'><\/span>{{/if}}<div class='e-appointinnertext'><div class='e-apptext {{if (priority!=undefined && priority!='')}}e-priorwidth{{/if}}'>{{if recurrence == true}}{{if recurrenceEdit == true}}<span class='e-icon e-recureditapp'><\/span>{{else}}<span class='e-icon e-recurapp'><\/span>{{/if}}{{/if}}{{:subject}} <\/div><div class='e-apptime {{if (priority!=undefined && priority!='')}}e-priorwidth{{/if}}'> {{:startTime}} - {{:endTime}}<\/div>{{if value == true}}<div class='e-multipleCategory'>{{:multiDiv}}<\/div>{{/if}}<\/div>{{else}}{{if recurrence == true}}{{if recurrenceEdit == true}}<span class='e-icon e-recureditapp'><\/span>{{else}}<span class='e-icon e-recurapp'><\/span>{{/if}}{{/if}}{{:userTemplate}}{{/if}}<\/div>"},f=function(){return"<div class='{{:appClass}}' id='Appointment_{{:id}}' role='presentation' style='position:absolute; {{if rtl == true}}right{{else}}left{{/if}}: {{:left}}; width: {{:appWidth}}; background: {{:appointData}}; color:{{:appointtextcolor}}; {{if appHeight}}height:{{:appHeight}}px;{{/if}} top: {{:top}}px;' ><div class='e-appointinnertext'><input class='e-inlinetext' type='text' style='background:transparent; border: 0px solid; '/>{{:subject}}"},e=function(){return"<div class='e-blocktimewrapper'><div class='e-blocktimeappointment {{:blockClass}} {{:customStyle}}' id='BlockTime_{{:id}}' role='presentation' style='width: {{:appWidth}}; height: {{:appHeight}}px; left: {{:left}}px; top: {{:top}}px;'>{{if userTempId == false}}{{:subject}}{{else}}{{:userTemplate}}{{/if}}<\/div><\/div>"},o=function(){return"{{for renderData }}<div style='background:{{:value}};height:11px;width:6px;float:left'><\/div>{{/for}}"},s=function(){return"{{for cols ~view=view ~colspan=colspan}}{{if cellToday == 'e-headerToday'}}<td class='e-headercells e-currentdayhighlight' colspan='{{:~colspan}}'>{{else}}<td class='e-headercells' colspan='{{:~colspan}}'>{{/if}}<div class='e-dateheadercell' title='{{:currentDay}}' aria-label='{{:currentDay}}'> <span class='e-headerdaydisplay'>{{:currentDay}}<\/span><\/div><\/td>{{/for}}"},h=function(){return"<table class='e-table e-leftindenttable' style='height:100%'><tbody> {{for trs ~tdClass=tdClass ~divClass=divClass}} <tr>{{for ~tdClass=tdClass ~divClass=divClass}} <td class='{{:~tdClass}} {{if ~tdClass == 'e-leftindent' }}e-alldaycellsheight{{else}}e-headercellsheight{{/if}}'> <div class='{{:~divClass}}'><\/div><\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},c=function(){return"{{for cols ~colspan=colspan ~userTemp=userTemp ~allDayHtml=userHtml}}
10<td class='e-alldaycells e-alldaycellsheight' colspan='{{:~colspan}}'>{{if ~userTemp==true}}{{:~allDayHtml[#getIndex()]}}{{/if}}<\/td>{{/for}}"},l=function(){return"<table class='e-table e-workcellstab' style='width:100%;height:100%;'><tbody >{{for cellrows ~timesc=timeScale ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml}}<tr>{{for ~index=#index ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}{{if ((~index+1) % ~timesc) == 0 }}<td class='e-workcells' style='width:{{:~cwidth}};height:{{:~cheight}};'>{{else}}<td class='e-workcells e-alternatecells' style='width:{{:~cwidth}};height:{{:~cheight}};'>{{/if}}{{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}<\/td>{{/for}}<\/tr>{{/for}}<\/tbody><\/table>"},a=function(){return"{{for cols1 ~index=#index ~timesc=timeScale ~userTemp=userTemplate ~userHtml=userHtml ~cwidth=cwidth ~cheight=cheight ~value=#getIndex() ~index=value ~wIndex=wIndex}}{{if ((~index) % ~timesc) == 0 }}<td class='e-workcells' style='width:{{:~cwidth}};height:{{:~cheight}};'>{{else}}<td class='e-workcells e-alternatecells' style='width:{{:~cwidth}};height:{{:~cheight}};'>{{/if}}{{if ~userTemp == true}}{{:~userHtml[~wIndex][#getIndex()]}}{{/if}}<\/td>{{/for}}"},v=function(){return"{{for cols1 ~cwidth=cwidth ~cheight=cheight ~userTemp=userTemplate ~userHtml=userHtml ~tenable=tenable ~cview=cview ~value=#getIndex()}}<td class='e-monthcells' style='width:{{:~cwidth}};height:{{:~cheight}};'><div class='e-monthheader' {{if ~tenable == false && ~cview == true}}style='display:none'{{/if}}><\/div>{{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}<\/td>{{/for}}"},y=function(){return"<div class='e-scrolltimecells' style='width:auto;height:100%;'><table class='e-table e-timecelltable' style='width:100%;height:100%;'><tbody>{{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template}}<tr>{{for ~name=time ~id=id ~view=~view1 ~index=#index }}{{if ~view == 0}}{{if ~userTemplateId==true}}<td class='e-timecells'>{{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}<div class='e-timecelldivs' style='height: 20px'>{{:~timeValue1[~index][#getIndex()]}}<\/div>{{else}}<div class='e-timecelldivs' style='height: 21px'>{{:~timeValue1[~index][#getIndex()]}}<\/div>{{/if}}{{/for}}<\/td>{{else}}<td class='e-timecells'><div class='e-timecelldivs'>{{if ~template==true}}{{:~name}}{{else}}{{:~name.slice(0,2)}}{{/if}}<\/div><\/td>{{/if}}<td class='e-timecells' rowspan='1'>{{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}{{if ~timesc==1}}{{:~name.slice(3,5)}}{{/if}}{{else}} {{if (#getIndex())== 0}}<div id='{{:~id}}' class='e-ampmdisplay e-ampmstyle e-idAmpmstyle'> {{if ~template ==true || ~userTemplateId==true }}{{else}}{{:~name.slice(3,6)}}{{/if}}<\/div>{{else}}<div class='e-ampmdisplay e-ampmstyle'><\/div>{{/if}} {{/if}}{{/for}}<\/td>{{else}}<td class='e-timecells'><div class='e-timecelldivs'><\/div><\/td>{{/if}}{{/for}}<\/tr>{{/for}}<\/tbody><\/table><\/div>"},p=function(){return"<div class='e-scrolltimecells'><table class='e-table' style='width:70px'><tbody>{{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template ~cheight = cheight}}<tr height='21px'>{{if ~timesc == 1}}<th class='e-timecells' rowspan='1'>{{else}}<th class='' rowspan='1'>{{/if}}{{:~timeValue1[#getIndex()][0]}}<\/th><\/tr>{{for ~cols1 ~name=time ~id=id ~view=~view1 ~index=#index ~timeSc=~timesc}}{{if (#getIndex()+2)% ~timeSc ==0}}<tr height='21px'><th class='e-timecells' style='text-align:left' rowspan='1'>{{:~timeValue1[~index][#getIndex()+1]}}<\/th><\/tr> {{else}}<tr height='21px'>{{if ~timesc == 1}}<th class='e-timecells' rowspan='1'>{{else}}<th class='' rowspan='1'>{{/if}}{{:~timeValue1[~index][#getIndex()+1]}}<\/th><\/tr>{{/if}}{{/for}}{{/for}}<\/tbody><\/table><\/div>"},w=function(){return"<tr>{{for cols}}<td class='e-headercells {{:className}} {{if (#index==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'><b>{{:headertext}}<\/b><\/div><\/td>{{/for}}<\/tr>"},b=function(){return"<table class='e-table e-agendacellstab' style='width:100%'><tbody >{{for cols}}<tr>{{if resGroup}}{{for resGroup}}<td class='e-agendacells {{:resId}} e-resourcecolumn {{if (#index==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{:text}}<\/div><\/td>{{/for}}{{/if}}
10{{if resChild}}<td rowspan={{:resRowSpan}} class='e-agendacells e-resourcecolumn {{if (resGroup.length==0)}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{if userResourceId == false}}{{:resName}}{{else}}{{:userResourceHtml}}{{/if}}<\/div><\/td>{{/if}}{{if dayChild}}<td rowspan={{:dayRowSpan}} class='e-agendacells e-datecolumn {{if (resGroup.length != 0) }}{{else (resName =='')}}e-firstcolumn{{/if}}'><div class='e-textwrapper'>{{if userDateId == false}}{{:date}}{{else}}{{:userDateHtml}}{{/if}}<\/div><\/td>{{/if}}<td class='e-agendacells e-timecolumn {{if dayBorderBottom==false}}e-alternatecells{{/if}}'><div class='e-textwrapper'>{{if userTimeId == false}}{{:time}}{{else}}{{:userTimeHtml}}{{/if}}<\/div><\/td><td class='e-agendacells e-eventcolumn {{if dayBorderBottom==false}}e-alternatecells{{/if}}'><div class='e-textwrapper'><div id='Appointment_{{:id}}' data-guid= '{{:uid}}' class='e-agendaappointment'>{{if userAppTemplId == false}}<span class='e-agendacolordiv' style='background:{{:background}}; {{if ignoreColorFilter == true}}filter:none;{{/if}}'/>{{:event}}{{else}}{{:userTemplate}}{{/if}}{{if readOnly == false}}<div class='e-agendahover'><span class='e-icon e-edit_05 e-editapp' title={{:edittext}}/>{{if allowDelete == true}}<span class='e-icon e-close e-deleteapp' title={{:deletetext}}/><\/div>{{/if}}{{/if}}<\/div><\/div><\/td><\/tr>{{/for}}<\/tbody><\/table>"};t.widget("ejSchedule","ej.Schedule",{_rootCSS:"e-schedule",element:null,validTags:["div"],model:null,_requiresID:!0,defaults:{timeZoneCollection:{dataSource:[{text:"UTC -12:00",id:"1",value:"UTC -12:00"},{text:"UTC -11:00",id:"2",value:"UTC -11:00"},{text:"UTC -10:00",id:"3",value:"UTC -10:00"},{text:"UTC -09:00",id:"4",value:"UTC -09:00"},{text:"UTC -08:00",id:"5",value:"UTC -08:00"},{text:"UTC -07:00",id:"6",value:"UTC -07:00"},{text:"UTC -06:00",id:"7",value:"UTC -06:00"},{text:"UTC -05:00",id:"8",value:"UTC -05:00"},{text:"UTC -04:30",id:"9",value:"UTC -04:30"},{text:"UTC -04:00",id:"10",value:"UTC -04:00"},{text:"UTC -03:30",id:"11",value:"UTC -03:30"},{text:"UTC -03:00",id:"12",value:"UTC -03:00"},{text:"UTC -02:00",id:"13",value:"UTC -02:00"},{text:"UTC -01:00",id:"14",value:"UTC -01:00"},{text:"UTC +00:00",id:"15",value:"UTC +00:00"},{text:"UTC +01:00",id:"16",value:"UTC +01:00"},{text:"UTC +02:00",id:"17",value:"UTC +02:00"},{text:"UTC +03:00",id:"18",value:"UTC +03:00"},{text:"UTC +03:30",id:"19",value:"UTC +03:30"},{text:"UTC +04:00",id:"20",value:"UTC +04:00"},{text:"UTC +04:30",id:"21",value:"UTC +04:30"},{text:"UTC +05:00",id:"22",value:"UTC +05:00"},{text:"UTC +05:30",id:"23",value:"UTC +05:30"},{text:"UTC +05:45",id:"24",value:"UTC +05:45"},{text:"UTC +06:00",id:"25",value:"UTC +06:00"},{text:"UTC +06:30",id:"26",value:"UTC +06:30"},{text:"UTC +07:00",id:"27",value:"UTC +07:00"},{text:"UTC +08:00",id:"28",value:"UTC +08:00"},{text:"UTC +09:00",id:"29",value:"UTC +09:00"},{text:"UTC +09:30",id:"30",value:"UTC +09:30"},{text:"UTC +10:00",id:"31",value:"UTC +10:00"},{text:"UTC +11:00",id:"32",value:"UTC +11:00"},{text:"UTC +12:00",id:"33",value:"UTC +12:00"},{text:"UTC +13:00",id:"34",value:"UTC +13:00"}],text:"text",id:"id",value:"value"},views:["Day","Week","WorkWeek","Month","Agenda"],viewsName:null,agendaViewSettings:{daysInAgenda:7,dateColumnTemplateId:null,timeColumnTemplateId:null},currentView:"week",timeMode:null,firstDayOfWeek:null,workWeek:["Monday","Tuesday","Wednesday","Thursday","Friday"],dateFormat:"",isDST:!1,timeZone:null,timeScale:{enable:!0,minorSlotCount:2,majorSlot:60,minorSlotTemplateId:null,majorSlotTemplateId:null},startHour:0,endHour:24,highlightBusinessHours:!0,enableLoadOnDemand:!1,enablePersistence:!1,showQuickWindow:!0,showRecurrenceAlert:!0,showLocationField:!1,showTimeZoneFields:!0,businessStartHour:9,businessEndHour:18,workHours:{highlight:!0,start:9,end:18},width:"100%",height:"1120px",cellHeight:"",cellWidth:"",currentDate:new Date,minDate:new Date(1900,1,1),maxDate:new Date(2099,12,31),cssClass:"",locale:"en-US",enableResize:!1,readOnly:!1,enableRTL:!1,enableAppointmentNavigation:null,showAppointmentNavigator:!0,appointmentTemplateId:null,allDayCellsTemplateId:null,dateHeaderTemplateId:null,workCellsTemplateId:null,resourceHeaderTemplateId:null,allowDragDrop:null,allowDragAndDrop:!0,enableAppointmentResize:!0,showCurrentTimeIndicator:!0,showAllDayRow:!0,showHeaderBar:!0,isResponsive:!0,showWeekend:!0,enableRecurrenceValidation:!0,appointmentDragArea:"",showOverflowButton:!0,allowInline:!1,allowDelete:!0,reminderSettings:{enable:!1,alertBefore:5},contextMenuSettings:{enable:!1,menuItems:{appointment:[{id:"open",text:"Open Appointment"},{id:"delete",text:"Delete Appointment"}],cells:[{id:"new",text:"New Appointment"},{id:"recurrence",text:"New Recurring Appointment"},{id:"today",text:"Today"},{id:"gotodate",text:"Go to date"},{id:"settings",text:"Settings"},{id:"view",text:"View",parentId:"settings"},{id:"timemode",text:"TimeMode",parentId:"settings"},{id:"view_Day",text:"Day",parentId:"view"},{id:"view_Week",text:"Week",parentId:"view"},{id:"view_Workweek",text:"Workweek",parentId:"view"},{id:"view_Month",text:"Month",parentId:"view"},{id:"view_Agenda",text:"Agenda",parentId:"view"},{id:"timemode_Hour12",text:"12 Hours",parentId:"timemode"},{id:"timemode_Hour24",text:"24 Hours",parentId:"timemode"},{id:"workhours",text:"Work Hours",parentId:"settings"}]}},group:null,resources:null,allowKeyboardNavigation:!0,blockoutSettings:{enable:!1,templateId:null,dataSource:[],query:null,tableName:null,id:"Id",subject:"Subject",startTime:"StartTime",endTime:"EndTime",isBlockAppointment:"IsBlockAppointment",isAllDay:null,customStyle:null,resourceId:null,groupId:null},appointmentSettings:{applyTimeOffset:!0,editFutureEventsOnly:!1,dataSource:[],query:null,tableName:null,id:null,
10subject:null,description:null,startTime:null,endTime:null,recurrence:null,recurrenceRule:null,allDay:null,resourceFields:null,categorize:null,recurrenceId:null,recurrenceExDate:null,location:null,priority:null,startTimeZone:null,endTimeZone:null},renderDates:null,orientation:"vertical",categorizeSettings:{title:null,enable:!1,allowMultiple:!1,dataSource:[{text:"Blue Category",id:1,color:"#43b496",fontColor:"#ffffff"},{text:"Green Category",id:2,color:"#7f993e",fontColor:"#ffffff"},{text:"Orange Category",id:3,color:"#cc8638",fontColor:"#ffffff"},{text:"Purple Category",id:4,color:"#ab54a0",fontColor:"#ffffff"},{text:"Red Category",id:5,color:"#dd654e",fontColor:"#ffffff"},{text:"Yellow Category",id:6,color:"#d0af2b",fontColor:"#ffffff"}],text:"text",id:"id",color:"color",fontColor:"fontColor"},prioritySettings:{title:null,enable:!1,template:null,dataSource:[{text:"None",value:"none"},{text:"High",value:"high"},{text:"Medium",value:"medium"},{text:"Low",value:"low"}],text:"text",value:"value"},showTimeScale:!0,tooltipSettings:{enable:!1,templateId:null},showDeleteConfirmationDialog:!0,showNextPrevMonth:!0,cellClick:null,cellHover:null,appointmentClick:null,appointmentHover:null,cellDoubleClick:null,appointmentWindowOpen:null,appointmentSaved:null,appointmentEdited:null,appointmentDeleted:null,beforeAppointmentCreate:null,beforeAppointmentChange:null,beforeAppointmentRemove:null,appointmentCreated:null,appointmentChanged:null,appointmentRemoved:null,keyDown:null,navigation:null,dragStart:null,drag:null,dragStop:null,resizeStart:null,resize:null,resizeStop:null,menuItemClick:null,beforeContextMenuOpen:null,reminder:null,actionBegin:null,actionComplete:null,overflowButtonClick:null,overflowButtonHover:null,create:null,load:null,destroy:null,queryCellInfo:null},dataTypes:{views:"array",viewsName:"array",workWeek:"array",timeZoneCollection:{dataSource:"data",query:"data"},renderDates:"data",enablePersistence:"boolean",showTimeScale:"boolean",resources:"array",allowInline:"boolean",allowDelete:"boolean",group:{resources:"array"},appointmentSettings:{dataSource:"data",query:"data",subject:"parent",description:"parent",startTime:"parent",endTime:"parent",recurrence:"parent",recurrenceRule:"parent",allDay:"parent",resourceFields:"parent",categorize:"parent",location:"parent",priority:"parent",startTimeZone:"parent",endTimeZone:"parent"},categorizeSettings:{dataSource:"data",query:"data"},prioritySettings:{dataSource:"data",query:"data"},contextMenuSettings:{menuItems:{appointment:"array",cells:"array"}},blockoutSettings:{dataSource:"data",query:"data"}},_ignoreOnPersist:["appointmentSettings.query","appointmentSettings.dataSource","timeZoneCollection.dataSource","allowKeyboardNavigation","showQuickWindow","cssClass","locale","enableResize","showHeaderBar","readOnly","enableRTL","enableAppointmentNavigation","showAppointmentNavigator","appointmentTemplateId","resourceHeaderTemplateId","allowDragDrop","allowDragAndDrop","enableAppointmentResize","showCurrentTimeIndicator","reminderSettings.enable","contextMenuSettings.enable","group","categorizeSettings.enable","categorizeSettings.dataSource","cellClick","overflowButtonClick ","overflowButtonHover","keyDown","appointmentClick","cellDoubleClick","appointmentWindowOpen","appointmentSaved","appointmentEdited","appointmentDeleted","beforeAppointmentCreate","beforeAppointmentChange","beforeAppointmentRemove","appointmentCreated","appiontmentChanged","appointmentRemoved","navigation","dragStart","dragStop","resizeStart","resize","resizeStop","menuItemClick","beforeContextMenuOpen","reminder","prioritySettings.dataSource","prioritySettings.enable","agendaViewSettings.daysInAgenda","agendaViewSettings.dateColumnTemplateId","agendaViewSettings.timeColumnTemplateId","blockoutSettings.dataSource","width"],_ignoreFromAppointmentOnExport:["dataSource","query","tableName","resourceFields"],_ignoreFromModelOnExport:["timezoneCollection","timeZoneCollection","contextMenuSettings","prioritySettings"],_resources:function(){this.element.empty();this._bindResourcesData();t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()},observables:["appointmentSettings.dataSource","currentView","currentDate"],_tags:[{tag:"timeZoneCollection",attr:[],singular:"timeZoneCollection"},{tag:"appointmentSettings.dataSource",attr:[],singular:"dataSource"},{tag:"resources",attr:["allowMultiple","field","title","name","resourceSettings"]},{tag:"contextMenuSettings.menuItems.appointment",attr:["id","text","parentId"]},{tag:"contextMenuSettings.menuItems.cells",attr:["id","text","parentId"]},{tag:"categorizeSettings.dataSource",attr:["text","id","color","fontColor"]},{tag:"timeZoneCollection.dataSource",attr:["text","id","value"]},{tag:"prioritySettings.dataSource",attr:["text","value"]}],currentView:t.util.valueFunction("currentView"),currentDate:t.util.valueFunction("currentDate"),dataSource:t.util.valueFunction("appointmentSettings.dataSource"),_init:function(){n.isEmptyObject(this.model.group)&&(this.model.group=null);this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale);this._diffDays=null;this.model.locale!="en-US"&&this._recurrenceLocal();t.isNullOrUndefined(this.model.workHours.start)&&(this.model.workHours.start=this.model.businessStartHour);t.isNullOrUndefined(this.model.workHours.end)&&(this.model.workHours.end=this.model.businessEndHour);t.isNullOrUndefined(this.model.workHours.highlight)&&(this.model.workHours.highlight=this.model.highlightBusinessHours);t.isNullOrUndefined(this.model.timeZoneCollection)&&(this.model.timeZoneCollection=this.model.timezoneCollection);t.isNullOrUndefined(this.model.timeScale.enable)&&(this.model.timeScale.enable=this.model.showTimeScale);this.model.showAppointmentNavigator=t.isNullOrUndefined(this.model.enableAppointmentNavigation)?this.model.showAppointmentNavigator:this.model.enableAppointmentNavigation;this.model.allowDragAndDrop=t.isNullOrUndefined(this.model.allowDragDrop)?this.model.allowDragAndDrop:this.model.allowDragDrop;t.isNullOrUndefined(this.model.beforeAppointmentCreate)&&(this.model.beforeAppointmentCreate=this.model.appointmentSaved);t.isNullOrUndefined(this.model.beforeAppointmentChange)&&(this.model.beforeAppointmentChange=this.model.appointmentEdited);t.isNullOrUndefined(this.model.beforeAppointmentRemove)&&(this.model.beforeAppointmentRemove=this.model.appointmentDeleted);this._processAppointmentSettings();this._currentDateFormat(this.model.dateFormat);this._trigger("load");this.element.addClass("e-schedule");this.model.cssClass!=null&&this.element.addClass(this.model.cssClass);this._initPrivateProperties();t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._resourceSegregate();this.model.categorizeSettings.enable&&this.model.categorizeSettings.dataSource instanceof t.DataManager&&this._bindCategorizeData();this.model.prioritySettings.enable&&this.model.prioritySettings.dataSource instanceof t.DataManager&&this._bindPriorityData();t.scheduleFeatures.resources&&this._tempResource.length!=0?this._bindResourcesData():this._renderInitSchedule();this._wireEvents();t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null);this._bindAppointmentsData("Load");this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments());this.model.reminderSettings.enable&&(this._checkReminders(),this._reminderInterval=window.setInterval(n.proxy(this._checkReminders,this),6e4))},_processAppointmentSettings:function(){var u,i,r,f;!t.isNullOrUndefined(this.model.appointmentSettings.query)&&this.model.appointmentSettings.query instanceof t.Query||(this.model.appointmentSettings.query=t.Query());this._appointmentSettings={};u="";this._applyTimeOffset=this.model.appointmentSettings.applyTimeOffset;this._recurrenceFutureActions=this.model.appointmentSettings.editFutureEventsOnly;for(i in this.model.appointmentSettings)if(i!="applyTimeOffset"&&i!="editFutureEventsOnly"&&i!=="tableName"&&i!=="query"&&i!=="dataSource"&&(this._appointmentSettings[i]=n.type(this.model.appointmentSettings[i])=="string"||t.isNullOrUndefined(this.model.appointmentSettings[i])?this.model.appointmentSettings[i]:this.model.appointmentSettings[i].field,i!=="resourceFields"&&i!=="c
10ategorize"&&i!=="priority"&&t.isNullOrUndefined(this._appointmentSettings[i])&&(this._appointmentSettings[i]=i.charAt(0).toUpperCase()+i.slice(1)),i=="resourceFields"&&t.isNullOrUndefined(this._appointmentSettings.resourceFields)&&!t.isNullOrUndefined(this.model.resources)))for(r=0,f=this.model.resources.length;r<f;r++)u=this.model.resources[r].field.charAt(0).toUpperCase()+this.model.resources[r].field.slice(1),this._appointmentSettings[i]+=(r!==0?",":"")+u},_setModel:function(i){var u=!1,r,e,o,s,h,f,c,l,a,v;t.isNullOrUndefined(this._quickAppDetailsWindow)||this._quickAppDetailsWindow.ejDialog("close");for(r in i)switch(r){case"views":this.model.views=i[r];this.model.views=this.model.views.length==0?this.currentView().toString().toLowerCase().split(","):this.model.views.toString().toLowerCase().split(",");this.hTR.find("table.e-viewstable").remove();this.hTR.find("div.e-viewsdiv").append(this._renderViewNavigation(i[r].toString().toLowerCase().split(",")));this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview").attr("tabIndex",0).focus();t.isNullOrUndefined(this._scheduleDrawer)||(this._scheduleDrawer.ejNavigationDrawer("destroy"),n(this._scheduleDrawer).remove(),this._scheduleDrawer=null,(this._mediaQuery||this.element.width()<600)&&!n("#"+this._id+"navDrawer").hasClass("e-scheduledrawer")&&this._renderNavigationDrawer());this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())==-1&&(this._navView=!0,this.model.views.length==0?(this.model.views=this.currentView().toString().toLowerCase().split(","),u=!0):this._viewChange(null,null,this.model.views[0].toLowerCase()));break;case"currentView":this.model.views.toString().toLowerCase().split(",").indexOf(t.util.getVal(i[r]).toLowerCase())!=-1?(this._navView=!0,this._viewChange(null,null,t.util.getVal(i[r]).toLowerCase())):(this._navView=!1,this.currentView(this.element.find(".e-activeview")[0].className.split("e-")[2].split(" ")[0]));break;case"currentDate":if(n.type(i[r])=="string"?this._currentDateFormat(this.model.dateFormat):n.type(i[r])=="function"&&n.type(t.util.getVal(i[r]))=="string"&&this.currentDate(t.parseDate(this.currentDate(),this._datepattern())),this._keyPressed)return this._keyPressed=!1,!1;this._setCurrentDate=!0;this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate);this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate);this._navigateClick(null,"DateNavigation");break;case"minDate":case"maxDate":this._currentDateFormat(this.model.dateFormat);u=!0;break;case"timeMode":e=t.preferredCulture(this.model.locale);this.model.timeMode=this._timeMode=i[r]=="Hour12"?"12":i[r]=="Hour24"?"24":e.calendar.AM==null&&e.calendar.PM==null?"24":i[r];this._pattern.t=this._timeMode=="12"?"h:mm tt":"HH:mm";this._updateTimeMode();this.element.find(".e-scrolltimecells").height(this.element.find(".e-workcellstab").height());break;case"timeZone":this._setmodelvalue=!0;this.model.timeZone=i[r];this.element.find("div.e-categorybar").remove();this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this._bindAppointmentsData("Load");this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments());break;case"showTimeScale":case"timeScale":r=="showTimeScale"&&(this.model.timeScale.enable=i[r]);r=="timeScale"&&n.extend(this.model.timeScale,i[r]);this.currentView()!=="agenda"&&(u=!0);break;case"timezoneCollection":case"timeZoneCollection":n.extend(this.model.timeZoneCollection,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._appointmentAddWindow.find(".startutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource});this._appointmentAddWindow.find(".endutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource});break;case"showTimeZoneFields":this.model.showTimeZoneFields=i[r];t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.showTimeZoneFields?(this._appointmentAddWindow.find("#"+this._id+"_appStartTime").children().length<4&&(this._mediaQuery?(o="<td width='31%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>",s="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"):(o="<td width='28%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>",s="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),this._appointmentAddWindow.find("#"+this._id+"_appStartTime").append(o),this._appointmentAddWindow.find("#"+this._id+"_appEndTime").append(s),this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._startUtc,this),cssClass:this.model.cssClass}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._endUtc,this),cssClass:this.model.cssClass})),this._timeZoneCollection(null)):(this._appointmentAddWindow.find("#"+this._id+"_appStartTime").children().last(
10).remove(),this._appointmentAddWindow.find("#"+this._id+"_appEndTime").children().last().remove());break;case"startHour":this.model.startHour=i[r];this.model.startHour<0&&(this.model.startHour=0);this.currentView()!=="agenda"&&this._setNewStartEndHours();break;case"endHour":this.model.endHour=i[r];this.model.endHour>24&&(this.model.endHour=24);this.currentView()!=="agenda"&&this._setNewStartEndHours();break;case"highlightBusinessHours":case"businessStartHour":case"businessEndHour":case"workHours":r=="highlightBusinessHours"&&(this.model.workHours.highlight=i[r]);r=="businessStartHour"&&(this.model.workHours.start=i[r]);r=="businessEndHour"&&(this.model.workHours.end=i[r]);r=="workHours"&&n.extend(this.model.workHours,i[r]);this.currentView()!=="agenda"&&(this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells,.e-monthcells").removeClass("e-businesshighlightworkcells").removeClass("e-monthcellhighlight"),this._businessHourScroller(),this._renderUpDownIconPosition());break;case"showAllDayRow":this.model.showAllDayRow=i[r];this.model.timeScale.enable||(this.model.showAllDayRow=!1);this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.timeScale.enable&&this.currentView()!="agenda"&&this.currentView()!="month"&&!this._isCustomMonthView()&&(this.aTR.empty(),this._renderHeaderAllDayTemplate(),this._borderAddRemove(),this._headerbarWidth(),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this._renderHoriVerticalScroll(),this.model.showAllDayRow&&this._reRenderAllDayAppointments(),this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.cellWidth&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-headercells").width()),this._reRenderScroller());break;case"isResponsive":this.model.isResponsive=i[r];this._onScheduleResize();break;case"isDST":this.model.isDST=i[r];t.isNullOrUndefined(this.model.timeZone)&&(h=new Date,this._timeValue=this._true==!1?-(h.getTimezoneOffset()-this._stdTimezoneOffset()):h.getTimezoneOffset()-this._stdTimezoneOffset(),this._true=this.model.isDST?!1:!0,this._dayLight=!0,this.element.find("div.e-categorybar").remove(),this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-appsoverflow").remove(),t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null),this._bindAppointmentsData("Load"));break;case"enableRecurrenceValidation":this.model.enableRecurrenceValidation=i[r];this.model.enableRecurrenceValidation&&t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._dataProcessing(this._currentAppointmentData);this._renderAppointmentAll();break;case"height":this.model.height=i[r];this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();u=!0;break;case"width":this.model.width=i[r];this._clientWidth=this.model.width;this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();u=!0;break;case"cssClass":this.element.removeClass(this.model.cssClass).addClass(i[r]);break;case"locale":this.model.locale=i[r];this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale);this.model.locale!="en-US"&&this._recurrenceLocal();this._culture=t.preferredCulture(this.model.locale);this._dayShortNames=this._culture.calendar.days.namesAbbr;this._dayFullNames=this._culture.calendar.days.names;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this.model.contextMenuSettings.enable&&(n("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0);u=!0;break;case"dateFormat":t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._appointmentAddWindow.find(".startenddate").ejDatePicker({dateFormat:i[r]});this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({dateFormat:i[r]});this._appointmentAddWindow.find(".e-until").ejDatePicker({dateFormat:i[r]});this._currentDateFormat(i[r]);break;case"enableResize":this.model.enableResize=i[r];this.model.enableResize&&(t.isTouchDevice()?this._on(n(window),"orientationchange",n.proxy(this._onScheduleResize,this)):this._on(n(window),"resize",n.proxy(this._onScheduleResize,this)));break;case"readOnly":this.model.readOnly=i[r];this._renderAppointmentAll();break;case"allowDelete":this.model.allowDelete=i[r];break;case"showCurrentTimeIndicator":this.model.showCurrentTimeIndicator=i[r];this.currentView()!=="agenda"&&(this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.showCurrentTimeIndicator||(this.currentView()!=="month"&&!this._isCustomMonthView()?this.element.find(".e-highlightcurrenttimeline").remove():n(this.element.find(".e-monthcells")).removeClass("e-monthcurrenttime")));break;case"enableRTL":i[r]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");this.model.enableRTL=i[r];u=!0;this.model.contextMenuSettings.enable&&(n("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0);this._quickAppointWindow=null;break;case"appointmentTemplateId":this.model.appointmentTemplateId=i[r];this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this.element.find("div.e-categorybar").remove();t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"allDayCellsTemplateId":this.model.allDayCellsTemplateId=i[r];u=!0;break;case"dateHeaderTemplateId":this.model.dateHeaderTemplateId=i[r];u=!0;break;case"workCellsTemplateId":this.model.workCellsTemplateId=i[r];u=!0;break;case"showWeekend":this.model.showWeekend=i[r];u=!0;break;
10case"allowInine":this.model.allowInline=i[r];break;case"allowKeyboardNavigation":this.model.allowKeyboardNavigation=i[r];this.model.allowKeyboardNavigation?(this._on(this.element,"keydown",n.proxy(this._onKeyDown,this)),this._on(n(document),"keydown",n.proxy(this._documentOnKeyDown,this))):(this._off(this.element,"keydown"),this._off(n(document),"keydown"));break;case"renderDates":n.extend(this.model.renderDates,i[r]);this._navView=!0;this._viewChange(null,null,"customview");break;case"appointmentSettings":n.isEmptyObject(i[r])||(n.extend(this.model.appointmentSettings,i[r]),this._processAppointmentSettings(),this._quickAppointWindow=null,this._quickAppDetailsWindow=null,this._recurEditWindow=null,n("#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper").remove(),this.element.find("div.e-categorybar").remove(),this.element.find(".e-upicon, .e-downicon").children().css({visibility:"hidden"}),this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-appsoverflow,table.e-agendacellstab").remove(),t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null),this._setmodelvalue=!0,this._bindAppointmentsData("Load"));break;case"contextMenuSettings":n.extend(this.model.contextMenuSettings,i[r]);this.model.contextMenuSettings.enable&&(t.isNullOrUndefined(this._contextMenu)||this.model.categorizeSettings.enable)&&this._showContextMenu(this.model.contextMenuSettings.enable);break;case"reminderSettings":i[r].enable?this._checkReminders()&&(this._reminderInterval=window.setInterval(n.proxy(this._checkReminders,this),6e4)):window.clearInterval(this._reminderInterval);break;case"showAppointmentNavigator":case"enableAppointmentNavigation":this.model.showAppointmentNavigator=this.model.enableAppointmentNavigation=i[r];this.model.showAppointmentNavigator?(this._nextPrevAppointment(this.model.showAppointmentNavigator),this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon(),t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()):(this.element.find(".e-prevapp,.e-nextapp").remove(),this.element.find(".e-upicon,.e-downicon").remove());break;case"enableLoadOnDemand":this.model.enableLoadOnDemand=i[r];this.element.find("div.e-categorybar").remove();this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove();this._bindAppointmentsData("Load");break;case"resources":t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(t.copyObject(this.model.resources,i[r]),this.model.resources=i[r],this.model.resources.length==0?(this.model.resources=null,this.model.group=null,u=!0):u=!0);break;case"categorizeSettings":n.extend(this.model.categorizeSettings,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)?(this._renderTemplates(),this._renderAppointmentWindow()):t.isNullOrUndefined(this.model.categorizeSettings)||(this.model.categorizeSettings.enable?(this._appointmentAddWindow.find(".e-categorizevalue").length==1&&this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove(),f="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Categorize")+":<\/td><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' class='e-categorizevalue' type='text' name='"+this._appointmentSettings.categorize+"' value=''/><\/td><\/tr>",this._appointmentAddWindow.find("."+this._id+"summary").after(f),this._renderTemplates(),this._renderCategoryItems(this._appointmentAddWindow)):this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove());this._showContextMenu(this.model.contextMenuSettings.enable);t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"group":t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(n.extend(this.model.group,i[r]),n.isEmptyObject(this.model.group)&&(this.model.group=null),u=!0);break;case"cellWidth":this.model.cellWidth=i[r];this.currentView()!=="agenda"&&(u=!0);break;case"cellHeight":this.model.cellHeight=i[r];this.currentView()!=="agenda"&&(u=!0);break;case"orientation":this.model.orientation=i[r];
10t.scheduleFeatures.resources&&this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this._on(this.element,"click",".e-parentnodecategory",n.proxy(this._onResourceClick,this));u=!0;break;case"resourceHeaderTemplateId":this.model.resourceHeaderTemplateId=i[r];t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&(this.currentView()!="agenda"?this.model.orientation=="horizontal"||this._customOrientation=="horizontal"?(c=n(this.wTR.find("td")[0]),c.find("div.e-horizontresdiv").remove(),l=this._renderHorizontalResources(),c.html(l)):(this.aTR.empty(),this._renderHeaderAllDayTemplate(),this._borderAddRemove(),this._headerbarWidth(),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.model.showAllDayRow&&this._reRenderAllDayAppointments()):this._renderAgendaContent());break;case"showLocationField":this.model.showLocationField=i[r];t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.showLocationField?(f="<tr id='"+this._id+"showLocation' class='"+this._id+"showLocation'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>",this._appointmentAddWindow.find("."+this._id+"subjecttr").after(f)):this._appointmentAddWindow.find("."+this._id+"showLocation").remove();break;case"prioritySettings":n.extend(this.model.prioritySettings,i[r]);t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this.model.prioritySettings.enable?(this._appointmentAddWindow.find("."+this._id+"priorityshow").length==1&&(this._appointmentAddWindow.find("."+this._id+"priorityshow").remove(),this._appointmentAddWindow.find("."+this._id+"prioritylistshow").remove()),f="<td colspan='1' class='e-textlabel "+this._id+"priorityshow'>"+this._getLocalizedLabels("Priority")+":<\/td><td colspan='1' class='"+this._id+"prioritylistshow'><input id='"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value='' /><div id='prioritylist'><\/div><\/td>",this._appointmentAddWindow.find("."+this._id+"parrow").prepend(f),this._renderPriorityItems(this._appointmentAddWindow),this._renderTemplates()):(this._appointmentAddWindow.find("."+this._id+"priorityshow").remove(),this._appointmentAddWindow.find("."+this._id+"prioritylistshow").remove());t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll();break;case"showQuickWindow":this.model.showQuickWindow=i[r];t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow();!t.isNullOrUndefined(this._quickAppointWindow)&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this._quickWindow=this.model.showQuickWindow;break;case"allowDragAndDrop":case"allowDragDrop":if(this.model.allowDragAndDrop=this.model.allowDragDrop=i[r],this.currentView()=="agenda")return!1;this.model.allowDragAndDrop?this._dragdropAppointments():this._unWireDragDrop();break;case"enableAppointmentResize":if(this.model.enableAppointmentResize=i[r],this.currentView()=="agenda")return!1;this._renderAppointmentAll();break;case"showHeaderBar":this.model.showHeaderBar=i[r];this.model.showHeaderBar?(this.element.find(".e-scheduleheader").show(),this._reRenderHeaderBar()):(this.element.find(".e-scheduleheader").empty(),this.element.find(".e-scheduleheader").hide());this.refreshScroller();break;case"tooltipSettings":n.extend(this.model.tooltipSettings,i[r]);a=this.model.tooltipSettings.enable?".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendacells.e-eventcolumn,.e-appup,.e-appdown,.e-appsoverflow":".e-appup,.e-appdown,.e-appsoverflow";v=this.element.data("ejTooltip");v.setModel({target:a});break;case"showOverflowButton":this.model.showOverflowButton=i[r];u=!0;break;case"appointmentDragArea":this.model.appointmentDragArea=i[r];u=!0;break;case"firstDayOfWeek":this.model.firstDayOfWeek=this._firstdayofweek=i[r];this._firstdayofweek&&(u=!0);break;case"workWeek":this.model.workWeek=i[r];(this.model.workWeek==null||this.model.workWeek.length>=0)&&(u=!0);break;case"agendaViewSettings":n.extend(this.model.agendaViewSettings,i[r]);this.currentView()=="agenda"&&(this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue()),this._renderAgendaContent());break;case"showNextPrevMonth":this.model.showNextPrevMonth=i[r];this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.currentView()=="month"&&(this._renderMonthTimeCells(),this._highlightBusinessHours(),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll());break;case"blockoutSettings":n.isEmptyObject(i[r])||(n.extend(this.model.blockoutSettings,i[r]),this.model.blockoutSettings.enable?this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments():this.element.find(".e-blocktimewrapper").remove())}u&&(this.element.empty(),t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("destroy"),this._scheduleDrawer=null,this._quickAppointWindow=null,this._quickAppDetailsWindow=null,this._alertWindow=null,this._appointmentAddWindow=null,this._recurrenceEditor=null,n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper").remove(),t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._resourceSegregate(),this._setmodelvalue=!0,this._tempResource.length==0&&this._grouping.length==0?this._renderInitSchedule():this._bindResourcesData(),this._businessHourScroller(),t.isNullOrUndefined(this.dataSource())||this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll(),this.model.blockoutSettings.enable&&this._renderBlockAppointments())},_touchSchedule:function(t){var u,h,e,r;if(n(t.target).is(".e-appointment,.e-alldayappointment,.e-monthappointment")||n(t.target).parents().is(".e-appointment,.e-alldayappointment,.e-monthappointment")||this.model.orientation=="horizontal"||this._customOrientation=="horizontal")return!1;var s=this.model.enableRTL?t.type=="swipeleft"?"swiperight":"swipeleft"
10:t.type,c=this.model.enableRTL?"margin-right":"margin-left",f,a=parseInt(this.element.find(".e-draggableworkarea").css(c)),o=Math.round(this.element.find(".e-draggableworkarea").width()/this.res1.length),l=this.element.find(".e-workleftindent").length>0?this.element.find(".e-workleftindent").outerWidth():0,i=Math.round(Math.abs((this.element.find(".e-draggableworkarea").offset().left-l-1)/o));if(this.currentView()=="month"||this._isCustomMonthView()){for(u=0,h=s=="swipeleft"?(i+1)*7:(i-1)*7,e=0;e<h;e++)u+=this.element.find(".e-draggableworkarea tr").eq(0).children().eq(e).outerWidth();u+=3}switch(s){case"swipeleft":if(this._mediaQuery&&this.currentView()!="agenda"&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"){if(i+1!=this.res1.length)return r=this.currentView()=="month"||this._isCustomMonthView()?-u:-((i+1)*o),this.element.find(".e-headrealldaytable").css("left","0px"),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").animate(this.model.enableRTL?{"margin-right":r}:{"margin-left":r},500),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").css(this.model.enableRTL?{"margin-left":0}:{"margin-right":0}),i+1==this.res1.length-1&&this._showScrollTd(),!1;this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css({marginLeft:"0px",marginRight:"0px"})}f={currentTarget:this.element.find(".e-navigatenext")};this._navigateClick(f,"Next");break;case"swiperight":if(this._mediaQuery&&this.currentView()!="agenda"&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"){if(i!=0)return r=this.currentView()=="month"||this._isCustomMonthView()?-u:-((i-1)*o),this.element.find(".e-headrealldaytable").css("left","0px"),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").animate(this.model.enableRTL?{"margin-right":r}:{"margin-left":r},500),this.element.find(".e-headeralldaydiv,.e-draggableworkarea").css(this.model.enableRTL?{"margin-left":0}:{"margin-right":0}),i+1==this.res1.length-1&&this._showScrollTd(),!1;this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css({marginLeft:"0px",marginRight:"0px"})}f={currentTarget:this.element.find(".e-navigateprevious")};this._navigateClick(f,"Previous")}},_iOSVersion:function(){if(/iP(hone|od|ad)/.test(navigator.platform)){var n=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3]||0,10)][0]}},_initPrivateProperties:function(){this._navSelected=this._navDrawer=this._alldayLevel=this._reminderClose=this._navView=this._editKey=this._cellClick=this._recurChecked=this._setCurrentDate=this._leftResizing=this._rightResizing=this._topResizing=this._bottomResizing=this._allDayDrag=this._dateNavigation=this._isQuickDialogOpened=this._ignoreModifyOccurrences=!1;this._gotoDate=this._bindapp=this._showBlockAlert=this._seriesAlert=this._editclick=this._isCustomAlert=!0;this._tempStart=this._tempEnd=this._currentAction="";this._currentRowIndex=this._currentColIndex=0;this._appId=this._parentId=1;this._recurrenceEditor=null;this._groupAutoDrag=!1;this._recurEditWindow=null;this._groupEdit=!1;this._leftStartTime=!1;this._deleteRecurrence="";this._groupEditing=!1;this._reverse=!1;this._iOSVer=this._iOSVersion();this._retainScrollerPosition={};this._currentAppointmentData=[];this._currentViewAppointments=[];this._processed=[];this._renderedApp=[];this._renderedAllDay=[];this._dateRender=[];this._grouping=[];this._tempResource=[];this._intialRenderedDates=[];this.res1=[0];this._appMainId=null;this._scheduleDrawer=null;this._quickAppointWindow=null;this._quickAppDetailsWindow=null;this._inlineText=null;this._alertWindow=null;this._appointmentAddWindow=null;this._dayNamesArray=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];this._dayNames=["SU","MO","TU","WE","TH","FR","SA"];this._culture=t.preferredCulture(this.model.locale);this._dayShortNames=this._culture.calendar.days.namesAbbr;this._dayFullNames=this._culture.calendar.days.names;this._monthNames=this._culture.calendar.months.names;this._pattern=this._culture.calendar.patterns;this._browserInfo=t.browserInfo();this._safariBrowser=this._browserInfo.name=="webkit"&&!t.isTouchDevice();this._focused=null;this._expandCollapseState=[];this._horizontalScrollValue=null;Array.prototype.map=Array.prototype.map||function(n,t){var e,u,i,r,f,o,s;if(this==null)throw new TypeError("this is null or not defined");if(r=Object(this),f=r.length>>>0,typeof n!="function")throw new TypeError(n+" is not a function");for(arguments.length>1&&(e=t),u=new Array(f),i=0;i<f;)i in r&&(o=r[i],s=n.call(e,o,i,r),u[i]=s),i++;return u};String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.capitalizeFirstString=String.prototype.capitalizeFirstString||function(){return this.charAt(0).toUpperCase()+this.slice(1)};Date.prototype.parseISO8601=function(n){var i=new Date(n),r=!t.isNullOrUndefined(this._iOSVer)||this._iOSVer<14?t.browserInfo().name=="webkit"||t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0":t.browserInfo().name=="webkit"&&!t.isTouchDevice()||t.browserInfo().name=="msie"&&t.browserInfo().version=="9.0";return i=new Date(i.getTime()+i.getTimezoneOffset()*6e4),typeof n=="string"?n.indexOf("Date")!=-1?new Date(parseInt(n.match(/\d+/).toString())):n.indexOf("T")!=-1?r?new Date(i):new Date(n):new Date(n.replace(/-/g,"/")):new Date(n)};Date.prototype._currentMonthDates=function(){return{start:new Date(this.getFullYear(),this.getMonth(),1),end:new Date(this.getFullYear(),this.getMonth()+1,0)}};Date.prototype._currentWeekDates=function(n){var i=this.getDay()-n,t=new Date(this.getFullYear(),this.getMonth(),this.getDate()+(i<0?i+7:i)*-1),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+6);return{start:new Date(t),end:new Date(r)}};Date.prototype._isDST=function(){return this.getTimezoneOffset()<Math.max(new Date(this.getFullYear(),0,1).getTimezoneOffset(),new Date(this.getFullYear(),6,1).getTimezoneOffset())}},_destroy:function(){this.element.off();this._destorySubControls(n("#"+this._id+"_AddEditForm"));t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find("#"+this._id+"recurrenceEditor").ejRecurrenceEditor("destroy");this.element.find("#"+this._id+"_navigator").ejDatePicker("destroy");window.clearInterval(this._intervalID);t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("destroy");n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"gotoWindow_wrapper").remove();this.element.empty().removeClass("e-schedule e-scheduleouter")},_destorySubControls:function(t){for(var i,u=t.find(".e-timepicker,.e-datepicker,.e-dropdownlist,.e-autocomplete"),r=0;r<u.length;r++)i=n(u[r]),i.hasClass("e-timepicker")?i.ejTimePicker("destroy"):i.hasClass("e-datepicker")?i.ejDatePicker("destroy"):i.hasClass("e-dropdownlist")?i.ejDropDownList("destroy"):i.hasClass("e-autocomplete")&&i.ejAutocomplete("destroy")},_closeRecurence:function(i){var u,r,f,e,o;if(t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._appointmentAddWindow.find(".e-recuruntil").ejRadioButton("option","checked")&&i.model.text!=this._getLocalizedLabels("Cancel")&&this._appointmentAddWindow.find(".recurstartdate").ejDatePicker("option","value")>this._appointmentAddWindow.find(".e-until").ejDatePicker("option","value"))return this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("WrongPattern")),this._alertWindow.ejDialog("open"),!1;u=!0;i.model.text==this._getLocalizedLabels("Cancel")?this._appointmentAddWindow.find(".e-recurFinalRule").html()==""&&this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox({checked:!1}
10):(r=this._appointmentAddWindow.find(".e-recurEditor").data("ejRecurrenceEditor"),this._rRuleStr=r.closeRecurPublic(),f=r.element.find(".recurstartdate").ejDatePicker("option","value"),e=r.recurrenceDateGenerator(r._recRule,f),r._rRule.freq!="MONTHLY"||t.isNullOrUndefined(r._rRule.monthDay)||(o=e.filter(function(n){return new Date(n).getDate()==r._rRule.monthDay}),(!t.isNullOrUndefined(r._rRule.count)&&o.length!=e.length||t.isNullOrUndefined(r._rRule.count)&&[29,30,31].indexOf(r._rRule.monthDay)!=-1)&&(u=!1,this._alertWindow.find(".e-alertbtn").find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertbutton").css({margin:"0px 20px 15px 10px"})),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("RecurrenceDateValidation")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.addClass("e-recurAlert"),this._alertWindow.ejDialog("open"))),new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value")).setHours(0,0,0,0)!=new Date(f).getTime()&&this._recurDateChange(f),u&&(this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(this._rRuleStr),this._appointmentAddWindow.find(".e-recuredit").css("display","inline")));u&&(this._appointmentAddWindow.find(".e-recurEditor").toggle(),this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).toggle().animate({"margin-left":10},300),this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","block"),this._appointmentAddWindow.find(".done").focus())},_wireEvents:function(){this._on((this.element,n(window)),"mousedown",n.proxy(this._onScheduleMouseDown,this));this._on(this.element,"click","div.e-navigateprevious,div.e-navigatenext",n.proxy(this._navigateClick,this));this._on(n(window),"resize",n.proxy(this._onScheduleResize,this));this._on(this.element,"click",".e-commonviewbutton",n.proxy(this._viewChange,this));this._on(this.element,"click",".e-datedisplay",n.proxy(this._viewCalendar,this));this._on(this.element,"click","div.e-appsoverflow",n.proxy(this._appOverflowClick,this));this._on(this.element,"click",".e-prevapp.enable,.e-nextapp.enable",n.proxy(this._nextPrev,this));this._on(this.element,"dblclick",".e-headercells",n.proxy(this._navigateView,this));this._on(this.element,"click",".e-headercells,.e-timecells,td.e-monthcells div.e-monthheader",n.proxy(this._navigateView,this));this._on(this.element,"mouseover","td.e-alldaycells,td.e-workcells:not('.e-resourceheadercells'),td.e-monthcells:not('.e-othermonths'),td.e-agendacells",n.proxy(this._onCellMouseOver,this));this._on(this.element,"mouseout","td.e-alldaycells,td.e-workcells:not('.e-resourceheadercells'),td.e-monthcells:not('.e-othermonths'),td.e-agendacells",n.proxy(this._onCellMouseOver,this));this._on(this.element,"click",".e-workcells,.e-alldaycells,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells",n.proxy(this._cellSelection,this));this._mediaQuery||t.isTouchDevice()||(this._on(n(window),t.eventType.mouseUp,n.proxy(this._mouseUp,this)),this._on(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells:not('.e-othermonths'),td.e-alldaycells",n.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells:not('.e-othermonths'),td.e-alldaycells",n.proxy(this._shiftSelection,this)));this._on(this.element,t.isMobile()?"click":t.isTouchDevice()&&(n.isFunction(n.fn.tap)||n.isFunction(n.fn.doubletap))?"doubletap":"dblclick",".e-workcells:not('.e-resourceheadercells'),.e-alldaycells,.e-inline,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells.e-eventcolumn,.e-agendacells.e-timecolumn",n.proxy(this._appointmentWindow,this));(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));t.isTouchDevice()&&n.isFunction(n.fn.doubletap)&&this._on(this.element,"doubletap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));t.isTouchDevice()&&n.isFunction(n.fn.tap)&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._cellSelection,this));this._on(this.element,"mouseover",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",n.proxy(this._onAppointMouseOver,this));this._on(this.element,"mouseout",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",n.proxy(this._onAppointMouseOver,this));this._on(this.element,"click",".e-appup,.e-appdown",n.proxy(this._renderAppPosition,this));(this._mediaQuery||this.element.width()<600)&&this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this));this.model.allowKeyboardNavigation&&(this._on(this.element,"keydown",n.proxy(this._onKeyDown,this)),this._on(n(this.element),"keydown",n.proxy(this._documentOnKeyDown,this)));(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this._on(this.element,"click",".e-parentnodecategory",n.proxy(this._onRes
10ourceClick,this));(this._mediaQuery||t.isTouchDevice())&&this._on(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab",n.proxy(this._touchSchedule,this));this.model.enableResize&&(t.isTouchDevice()?this._on(n(window),"orientationchange",n.proxy(this._onScheduleResize,this)):this._on(n(window),"resize",n.proxy(this._onScheduleResize,this)));this._on(this.element,"click",".e-schedulemouseclose,.e-deleteapp",n.proxy(this._deleteAppoint,this));this._on(this.element,"click",".e-editapp",n.proxy(this._appointmentWindow,this))},_drawerOpen:function(){this._scheduleDrawer.ejNavigationDrawer("open")},_mouseUp:function(){n(this.element.find("div.e-draggableworkarea tr")).off(t.eventType.mouseMove)},_mouseButtonClick:function(i){var s,f,o;if(!i.altKey&&!i.shiftKey&&!i.ctrlKey&&i.which!=3&&(i.which==1||i.type=="touchstart")&&!n(i.target).hasClass("e-resourceheadercells")&&!n(i.target).hasClass("e-othermonths")){var u=i.target||document.activeElement||i.srcElement,e=this.element.find("div.e-draggableworkarea tr"),r=this;if(n(u).hasClass("e-alldaycells")&&(e=this.element.find(".e-alldaycells").parent()),n(u).hasClass("e-selectedAppointment")&&this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),this._currentRowIndex=n(u).parent()[0].rowIndex,this._currentColIndex=n(u)[0].cellIndex,s=(r.model.orientation=="horizontal"||r._customOrientation=="horizontal")&&r.currentView()=="month"?r.monthDays:r.model.orientation=="vertical"&&r._customOrientation=="vertical"?r.dateRender:r._dateRender,f=n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7,(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(f=r.currentView()!=="month"?Math.floor(f/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):f),o=new Date(s[f]),o>=this.model.minDate&&o<=this.model.maxDate&&(n(u).hasClass("e-workcells")||n(u).hasClass("e-monthcells")||n(u).hasClass("e-alldaycells"))){e.on(t.eventType.mouseMove,function(i){var f,e;!t.isNullOrUndefined(r._quickAppointWindow)&&r.model.showQuickWindow&&(r._quickAppointWindow.ejDialog("close"),r._quickAppDetailsWindow.ejDialog("close"));i.preventDefault();f=i.target;i.type=="touchmove"&&(e=i.originalEvent.changedTouches[0],f=document.elementFromPoint(e.pageX,e.pageY));n(f).hasClass("e-selectedCell")&&r.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");r._mouseSelection(i,r,u,f);r._moveScrollContent(u,r)});e.on(t.eventType.mouseUp,function(){e.off(t.eventType.mouseMove)});this.element.find("e.workcells,e.alldaycells,.e-monthcells").removeClass("e-mousehover");this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment")}}},_mouseSelection:function(i,r,u,f){var it=r.element.find(".e-draggableworkarea")[0].getBoundingClientRect(),rt,y,w,ut,ft,b,d,st,tt,p,e,c,l;r.model.orientation=="vertical"&&r._customOrientation=="vertical"&&(it.top+this.element.find(".e-workcells").height()>i.pageY?r.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:r.element.find(".e-draggableworkarea").scrollTop()-r.element.find(".e-workcells").height()}):it.bottom<i.pageY+this.element.find(".e-workcells").height()&&r.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:r.element.find(".e-draggableworkarea").scrollTop()+r.element.find(".e-workcells").height()}));var h=r.element.find("div.e-draggableworkarea tr"),v=n(u).parent().index(),s=n(u).index(),nt=h.length-1,c,l,e,a=n(f).parent().index(),o=n(f).index(),k=r.element.find(".e-alldaycells").parent(),g=r.model.showAllDayRow;if(this._resWorkWeek)for(y=0,w=0;w<this.res1.length;w++)if(rt=t.isNullOrUndefined(this.res1[w][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this.res1[w][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,o<=y+(rt-1)){b=y+rt;break}else y+=this.res1[w][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length;else if(this._resCustomView)for(y=0,w=0;w<this.res1.length;
10w++)if(ut=this._tempResource[this._tempResource.length-1].resourceSettings.renderDates,ft=this._getCustomDatesCount(w,ut),o<=y+(ft-1)){b=y+ft;break}else y+=this._getCustomDatesCount(w,ut);else var et=r.model.orientation=="horizontal"||r._customOrientation=="horizontal"?h[0].cells.length:r.currentView()=="month"||r._isCustomMonthView()?h[0].cells.length/r.res1.length:r._dateRender.length,ot=Math.floor(n(f).index()/et),b=et*(ot+1),y=et*ot;if(this.model.allowInline&&this.element.find(".e-inlinetext").length>0&&this.element.find(".e-inlinetext").val()!=""?this._saveAppointment():this._inlineRemove()&&this._refreshDayAppointments(this._app),n(f).hasClass("e-workcells"))if(r.model.orientation=="vertical"&&r._customOrientation=="vertical")if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(s==o)if(a>v)for(e=parseInt(v);e<=a;e++)n(h[e].cells[s]).addClass("e-selectedCell");else if(a<v)for(e=parseInt(v);e>=a;e--)n(h[e].cells[s]).addClass("e-selectedCell");else n(h[a].cells[o]).addClass("e-selectedCell");else if(o>s){for(p=o-s,c=parseInt(v);c<=nt;c++)n(h[c].cells[s]).addClass("e-selectedCell");if(g&&n(k[0].cells[[s]]).addClass("e-selectedCell"),g&&n(k[0].cells[[o]]).addClass("e-selectedCell"),p>1)for(e=1;e<=p-1;e++){for(d=0;d<=nt;d++)n(h[d].cells[o-e]).addClass("e-selectedCell");g&&n(k[0].cells[[o-e]]).addClass("e-selectedCell")}for(l=0;l<=a;l++)n(h[l].cells[o]).addClass("e-selectedCell")}else if(o<s){for(p=s-o,c=parseInt(v);c>=0;c--)n(h[c].cells[s]).addClass("e-selectedCell");if(g&&n(k[0].cells[[s]]).addClass("e-selectedCell"),g&&n(k[0].cells[[o]]).addClass("e-selectedCell"),p>1)for(e=1;e<=p-1;e++){for(d=0;d<=nt;d++)n(h[d].cells[[o+e]]).addClass("e-selectedCell");g&&n(k[0].cells[[o+e]]).addClass("e-selectedCell")}for(l=parseInt(a);l<=nt;l++)n(h[l].cells[o]).addClass("e-selectedCell")}r._currentRowIndex=a;r._currentColIndex=o;n(h[a].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(v==a&&s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(o>s){for(l=s;l<=o;l++)n(h[a].cells[l]).addClass("e-selectedCell").attr("tabIndex",0).focus();st=r.element.find(".e-selectedCell").length;tt=r.element.find(".e-selectedCell")[st-1].offsetLeft+r.element.find(".e-workcells").width();tt>=r.element.find(".e-draggableworkarea").scrollLeft()+it.width-1&&r.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:r.element.find(".e-draggableworkarea").scrollLeft()+r.element.find(".e-workcells").width()})}else if(o<=s){for(l=s;l>=o;l--)n(h[a].cells[l]).addClass("e-selectedCell").attr("tabIndex",0).focus();tt=r.element.find(".e-selectedCell")[0].offsetLeft;tt<=r.element.find(".e-draggableworkarea").scrollLeft()&&r.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:r.element.find(".e-draggableworkarea").scrollLeft()-r.element.find(".e-workcells").width()})}}else return!1;else if(n(f).hasClass("e-alldaycells"))if(s>
10=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(o<s)for(e=s;e>=o;e--)n(k[0].cells[e]).addClass("e-selectedCell");else if(o>s)for(e=s;e<=o;e++)n(k[0].cells[e]).addClass("e-selectedCell");r._currentRowIndex=0;r._currentColIndex=o;n(k[0].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1;else if(n(f).hasClass("e-monthcells")){if(n(f).hasClass("e-othermonths"))return!1;if(s>=parseInt(y)&&s<=parseInt(b)-1&&o!="undefined"){if(a==v)if(o<s)for(e=s;e>=o;e--)n(h[a].cells[e]).addClass("e-selectedCell");else if(o>s)for(e=s;e<=o;e++)n(h[a].cells[e]).addClass("e-selectedCell");else o==s&&n(h[a].cells[o]).addClass("e-selectedCell");else if(a>v){for(p=a-v,c=s;c<b;c++)n(h[v].cells[c]).addClass("e-selectedCell");if(p>1)for(e=1;e<=p-1;e++)for(c=y;c<b;c++)n(h[v+e].cells[c]).addClass("e-selectedCell");for(l=y;l<=o;l++)n(h[a].cells[l]).addClass("e-selectedCell")}else if(a<v){for(p=v-a,c=s;c>=y;c--)n(h[v].cells[c]).addClass("e-selectedCell");if(p>1)for(e=1;e<=p-1;e++)for(c=y;c<b;c++)n(h[v-e].cells[c]).addClass("e-selectedCell");for(l=b-1;l>=o;l--)n(h[a].cells[l]).addClass("e-selectedCell")}r._currentRowIndex=a;r._currentColIndex=o;n(h[a].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else return!1}},_shiftSelection:function(i){var f,r,u;if(i.shiftKey==!0&&i.which==1&&!n(i.target).hasClass("e-resourceheadercells")){var e=this._focused,o=this,s=i.target;!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this.element.find("e.workcells,e.alldaycells,.e-monthcells").removeClass("e-mousehover");this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");f=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.dateRender:this._dateRender;r=n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7;(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(r=this.currentView()!=="month"?Math.floor(r/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):r);u=new Date(f[r]);u>=this.model.minDate&&u<=this.model.maxDate&&this._mouseSelection(i,o,e,s)}},_moveScrollContent:function(t,i){var r,f,u;i.model.orientation==="horizontal"||i._customOrientation==="horizontal"?(r=i.element.find(".e-draggableworkarea").scrollLeft(),r=i.model.enableRTL?i._browserInfo.name=="mozilla"?r>0?r:r*-1:i._browserInfo.name=="chrome"||i._browserInfo.name=="webkit"?i.element.find(".e-workcells")[0].offsetLeft+i.element.find(".e-workcells").width()-i.element.find(".e-draggableworkarea").scrollLeft()-i.element.find(".e-draggableworkarea").width():Math.abs(r):-r,i.currentView()!="month"?n(i.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",r+"px"):i.element.find(".e-headerdays").css("left",r+"px"),i.currentView()==="day"||i.currentView()==="month"||i.currentView()=="customview"&&i._dateRender.length>7||!i.model.timeScale.enable||(f=n(i.element.find(".e-headercells").find(".e-activeview").parent()).index(),u=Math.floor(Math.abs(r)/i.element.find(".e-workcells").outerWidth()/((i.model.endHour-i.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),f!==u&&i.element.find(".e-headercells").children().removeClass("e-activeview"),n(i.element.find(".e-headercells")[u]).children().addClass("e-activeview"))):n(t).hasClass("e-monthcells")||i.element.find(".e-scrolltimecells").css("top",-i.element.find(".e-draggableworkarea").scrollTop()+"px")},_onScheduleMouseDown:function(i){var r=n(i.target),u=r.hasClass("e-appointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment");r.hasClass("e-workcells")||r.hasClass("e-inlinetext")||r.hasClass("e-commonviewbutton")||u.hasClass("e-appointment")||u.hasClass("e-alldayappointment")||u.hasClass("e-monthappointment")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||r.parents(".e-scheduledialog").hasClass("e-scheduledialog")||(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),!this.model.allowInline||t.isNullOrUndefined(this._inlineText)||r.hasClass("e-inlineedit")||this.currentView()=="agenda"||(this.element.find(".e-inlinetext").length>0&&this.element.find(".e-inlinetext").val()==""?(t.isNullOrUndefined(this._inlineDate)||this._refreshDayAppointments(this._app),this._inlineRemove()):this._saveAppointment()),this.element.find(".e-workcells").removeClass("e-mousehover"),r.closest("#"+this._id).length>0&&this._scrollerPosition())},_onCellMouseOver:function(i){var r,e,u,f,o;
10if(n(i.target).closest(".e-appointment,.e-blocktimeappointment,.e-alldayappointment,.e-monthappointment,.e-inline").length>0||n(i.target).parents(".e-inline").length>0)return!1;if(this.currentView()=="agenda"){if(this._mediaQuery==!0)return!1;r=n(i.currentTarget);i.type==="mouseover"?(this.element.find(".e-mousehover").removeClass("e-mousehover"),r.hasClass("e-agendacells")&&(r.parent().find(".e-timecolumn,.e-eventcolumn").addClass("e-mousehover"),r.parent().find(".e-editapp").parent().show())):i.type==="mouseout"&&r.hasClass("e-agendacells")&&(r.parent().find(".e-timecolumn,.e-eventcolumn").removeClass("e-mousehover"),r.parent().find(".e-editapp").parent().hide())}else if(r=n(i.currentTarget),u=t.isNullOrUndefined(this.model.workCellsTemplateId)?n(i.target).hasClass("e-workcells")?n(i.target).index():n(i.target).hasClass("e-alldaycells")?n(i.target).index():7-((parseInt(n(i.target).index()/7)+1)*7-n(i.target).index())+n(i.target).parent().index()*7:n(i.target).parent().hasClass("e-workcells")?n(i.target).parent().index():n(i.target).parent().hasClass("e-alldaycells")?n(i.target).parent().index():7-((parseInt(n(i.target).parent().index()/7)+1)*7-n(i.target).parent().index())+n(i.target).parent().parent().index()*7,(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(u=this.currentView()!=="month"?Math.floor(u/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):u),e=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.dateRender:this._dateRender,f=new Date(e[u]),this._slotByElement(n(i.target),"cellHover"),this.currentView()=="month"&&n(i.target).hasClass("e-monthheader")&&(u=7-((parseInt(n(i.target).parent().index()/7)+1)*7-n(i.target).parent().index())+n(i.target).parent().parent().index()*7,f=new Date(e[u]),this.cellHoverStartTime=new Date(new Date(f).setHours(0,0,0)),this.cellHoverEndTime=new Date(new Date(f).setHours(23,59,59))),o={cellIndex:u,startTime:new Date(this.cellHoverStartTime),endTime:new Date(this.cellHoverEndTime),target:i,resources:!t.isNullOrUndefined(this.model.cellHover)&&this._tempResource.length!=0?this._getResourceValue(r,u):null},f>=this.model.minDate&&f<=this.model.maxDate)if(i.type==="mouseover"){if(this._trigger("cellHover",o))return!1;this.element.find(".e-mousehover").removeClass("e-mousehover");(r.hasClass("e-workcells")||r.hasClass("e-monthcells"))&&!r.hasClass("e-resourceheadercells")&&r.addClass("e-mousehover")}else i.type==="mouseout"&&(r.hasClass("e-workcells")||r.hasClass("e-monthcells"))&&r.removeClass("e-mousehover");else return!1},_getAppDetails:function(i){var r=t.isNullOrUndefined(i.target)?n(i):n(i.target),s=r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment"),f,u,e,o;return(this.currentView()=="agenda"&&r.hasClass("e-eventcolumn")&&(s=r.find(".e-agendaappointment")),f=s.attr("data-guid"),t.isNullOrUndefined(f))?!1:(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,f)),u[0][this._appointmentSettings.recurrence]?(e=n.extend(!0,[],u),e[0][this._appointmentSettings.endTime]=e[e.length-1][this._appointmentSettings.endTime],o=u[0][this._appointmentSettings.recurrence]&&u[0][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")==1?this._getAppointmentByParentId(f):e[0]):o=this._groupEditing?t.isNullOrUndefined(u[0].commonGuid)?new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[0][this._appointmentSettings.id]))[0]:new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("commonGuid",t.FilterOperators.equal,u[0].commonGuid))[0]:new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,f))[0],o)},_onAppointMouseOver:function(i){var o,u,r,f,e;if(!this.model.readOnly){if(!t.isNullOrUndefined(this.model.appointmentHover)&&i.type=="mouseover"&&(o={appointment:this._getAppDetails(i)},this._trigger("appointmentHover",o)))return!1;if(this.currentView()=="agenda"){if(this._mediaQuery==!0)return!1;u=n(i.currentTarget);i.type==="mouseover"?(this.element.find(".e-mousehover").removeClass("e-mousehover"),u.hasClass("e-agendaappointment")&&(u.addClass("e-mousehover"),u.find(".e-editapp").parent().show())):i.type==="mouseout"&&u.hasClass("e-agendaappointment")&&(u.removeClass("e-mousehover"),u.find(".e-editapp").parent().hide())}else r=n(i.target).hasClass("e-appointment,e-alldayappointment,e-monthappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment"),r.hasClass("e-appointment")&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"?i.type==="mouseover"&&r.find(".e-inlineedit").length<=0?(this.model.enableAppointmentResize&&(r.find(".e-bottomhandle,.e-tophandle").addClass("e-icon e-nsexpand"),r.f
10ind(".e-bottomhandle").addClass("e-appointresizer-bottom"),r.find(".e-tophandle").addClass("e-appointresizer-top")),this.model.allowDelete&&r.find(".e-schedulemouseclose").css("display","block")):i.type==="mouseout"&&(this.model.enableAppointmentResize&&r.find(".e-bottomhandle,.e-tophandle").removeClass("e-icon e-nsexpand"),r.find(".e-schedulemouseclose").css("display","none")):((r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment"))&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"||this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(i.type==="mouseover"&&r.find(".e-inlineedit").length<=0?(this._getAppDetails(i)[this._appointmentSettings.startTime]>=new Date(this._dateRender[0])||(r.find(".e-lefthandle").removeClass("e-icon e-ewexpand"),r.find(".e-lefthandle").removeClass("e-appointresizer-left"),r.find(".e-lefthandle").removeClass("e-columncursor"),r.find(".e-appointment").removeClass(".e-lefthandle"),r.find(".e-righthandle").addClass("e-icon e-ewexpand"),r.f
10ind(".e-righthandle").addClass("e-appointresizer-right")),f=new Date(this._dateRender[this._dateRender.length-1]),this._getAppDetails(i)[this._appointmentSettings.endTime]<=new Date(f.setDate(f.getDate()+1))?this.model.enableAppointmentResize&&(r.find(".e-lefthandle,.e-righthandle").addClass("e-icon e-ewexpand"),r.find(".e-lefthandle").addClass("e-appointresizer-left"),r.find(".e-righthandle").addClass("e-appointresizer-right")):(r.find(".e-righthandle").removeClass("e-icon e-ewexpand"),r.find(".e-righthandle").removeClass("e-appointresizer-right"),r.find(".e-righthandle").removeClass("e-columncursor"),r.find(".e-appointment").removeClass(".e-righthandle"),r.find(".e-lefthandle").addClass("e-icon e-ewexpand"),r.find(".e-lefthandle").addClass("e-appointresizer-left")),e=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,r.attr("data-guid"))),e.length!=0&&(this._customOrientation=="horizontal"||this.model.orientation=="horizontal")&&this.currentView()!="month"&&e[0].AllDay&&this.model.endHour-this.model.startHour!=24&&(r.find(".e-lefthandle,.e-righthandle").removeClass("e-icon e-ewexpand"),r.f
10ind(".e-lefthandle").removeClass("e-appointresizer-left"),r.find(".e-righthandle").removeClass("e-appointresizer-right"),r.find(".e-righthandle, .e-lefthandle").removeClass("e-columncursor")),this.model.allowDelete&&r.find(".e-schedulemouseclose").css("display","block")):i.type==="mouseout"&&(this.model.enableAppointmentResize&&r.find(".e-lefthandle,.e-righthandle").removeClass("e-icon e-ewexpand"),r.find(".e-schedulemouseclose").css("display","none")))}},_quickWindowPosition:function(t,i,r,u){var a=u.find(".e-tableAppoint"),f=n("#"+u.prop("id")+"_wrapper").width(),e=this.element.offset().left,o=this.element.offset().left+this.element.width(),s=this.element.offset().top,p=this.element.offset().top+this.element.height(),l=r.width()/2,v="rotate(0deg)",h=!0,c="40%",y;return t>e&&t+f>o&&i>s?(t=o-f-5,c=r.offset().left-t+l):t<e&&t+f<o&&i>s?(t=e+5,c=r.offset().left-t+l):i<s&&(h=!1,v="rotate(180deg)",t<e?(t=e+5,c=r.offset().left-t+l):t+f>o&&(t=o-f-5,c=r.offset().left-t+l),y=u.prop("id")==this._id+"AppDetailsWindow"?r.height():this.model.orientation=="horizontal"||this._customOrientation=="horizontal"?r.height()/2:r.height()-4,i=r.offset().top+10+y,(i<s||i>p-n("#"+u.prop("id")+"_wrapper").height())&&(i=s+4,h=!0,v="rotate(0deg)")),h?a.removeClass("e-tablePosition"):a.addClass("e-tablePosition"),u.find(".e-quickarrow").css("transform",v).css("top",h?a.outerHeight()+1:0).css("left",c),h?u.addClass("e-quickwinarrowbottom").removeClass("e-quickwinarrowtop"):u.addClass("e-quickwinarrowtop").removeClass("e-quickwinarrowbottom"),{X:t,Y:i}},_getSetScrollPosition:function(n){var i={},r;return t.isNullOrUndefined(n)?(r=this.element.find("#"+this._id+"_scroller").data("ejScroller"),i.ScheduleScrollTop=r.scrollTop(),i.ScheduleScrollLeft=r.scrollLeft()):(this._retainScrollerPosition.ScheduleScrollTop=n.ScheduleScrollTop,this._retainScrollerPosition.ScheduleScrollLeft=n.ScheduleScrollLeft),i},retainCurrentScrollPosition:function(){var n=this.element.find("#"+this._id+"_scroller").ejScroller("instance");n.isVScroll()&&this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:this._retainScrollerPosition.ScheduleScrollTop});n.isHScroll()&&this.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:this._retainScrollerPosition.ScheduleScrollLeft});this._retainScrollerPosition={}},_scrollerPosition:function(){var t,i,n;this.model.enableRTL||this.currentView()!="agenda"&&this.model.timeScale.enable&&(this.element.find(".e-vscroll").length>0||this.element.find(".e-hscroll").length>0)&&(t=this.element.find("#"+this._id+"_scroller").ejScroller("instance"),this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(t.isVScroll()&&(n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:n})),t.isHScroll()&&(n=this.element.find(".e-draggableworkarea").offset().left-this.element.find(".e-workcellstab").offset().left,this.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:Math.abs(n)}))):this._grouping.length>0&&(t.isVScroll()&&this.element.find(".e-resourceheadertable").offset().top!=this.element.find(".e-workcellstab").offset().top&&(n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this._isQuickDialogOpened=!0,this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:n})),t.isHScroll()&&(i=this.currentView()=="month"||this._isCustomMonthView()?this.element.find(".e-headerdays").offset().left:this.element.find(".e-horizontaltabletimecell").closest("tr").offset().left,this.element.find(".e-workcellstab").offset().left!=i&&(n=this.element.find(".e-draggableworkarea").offset().left-this.element.find(".e-workcellstab").offset().left,this._isQuickDialogOpened=!0,this.element.find("#"+this._id+"_scroller").ejScroller({scrollLeft:Math.abs(n)})))))},_cellSelection:function(i){var d,g,r,a,nt,tt,v,h,y,u,e,it,s,b,k,ft,et,ot,st,c,f;if(i.shiftKey||n(i.target).parents().hasClass("e-inline")||n(i.target).hasClass("e-inlineedit")||(this.model.allowInline&&(this.element.find(".e-inlineedit").length>0&&(this._saveAppointment(),i.target=this.element.find("div[data-guid="+n(i.target).closest(".e-appointment,.e-monthappointment,.e-alldayappointment").attr("data-guid")+"]")),this.element.find(".e-inlinetext").length>0&&this.element.find(".e-inlinetext").val()!=""&&this._saveAppointment(),this.element.find(".e-inlinewrapper").remove(),this.element.find(".e-inline").remove(),d=n(i.target).closest(".e-appointment,.e-monthappointment,.e-alldayappointment"),g=d.find(".e-apptext").text()==" "?!1:!0),t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide"),this.element.find("e.workcells,e.alldaycells,.e-monthcells,.e-agendacells").removeClass("e-mousehover"),this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),r=t.isNullOrUndefined(i.target)?n(i):n(i.target),a=r.closest(".e-blocktimeappointment"),r.hasClass("e-blocktimeappointment")&&r.hasClass(".e-blockenable")||a.length>0&&r.closest(".e-blockenable").length>0))return!1;if(a.length>0&&(i.target.closest(".e-blocktimeappointment").style.pointerEvents="none",r=n(document.elementFromPoint(i.pageX,i.pageY)),i.target.closest(".e-blocktimeappointment").style.pointerEvents=""),this.model.allowInline&&(r.hasClass("e-apptext")||r.hasClass("e-agendaappointment")||!g)&&this._inlineEdit(r),this.currentView()=="agenda"||r.hasClass("e-schedulemouseclose")||t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(r=r.closest(".e-appointment,.e-monthappointment,.e-alldayappointment").length>0?r.closest(".e-appointment,.e-monthappointment,.e-alldayappointment"):r.hasClass("e-apptime")||r.hasClass("e-apptext")||r.hasClass("e-appointinnertext")||r.hasClass("e-schedulemouseclose")||r.hasClass("e-monthheader")?n(i.target):r.closest(".e-workcells, .e-alldaycells, .e-monthcells")),r.hasClass("e-appointwrapper")||r.hasClass("e-textwrapper")&&(r=n(r).parent()),t.isNullOrUndefined(i.type)||i.type!="beforeOpen"?this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell"):(nt=this.element.find("td.e-selectedCell"),nt.length>0&&!r.hasClass("e-selectedCell")&&this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell")),this.model.showQuickWindow&&t.isNullOrUndefined(this._quickAppointWindow)&&this._renderQuickWindow(),this.currentView()!="agenda"){if((r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells"))&&
10!r.hasClass("e-resourceheadercells")){if((this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"),this._slotByElement(r,"cellClick"),this.model.minDate>this.curDate||this.model.maxDate<this.curDate)||(tt=this._dayFullNames[new Date(this.curDate).getDay()]+", "+t.format(new Date(this.curDate),"M",this.model.locale)+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale),v={cellIndex:this._cellIndex,startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,target:i,resources:(this.model.cellClick!=null||!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("cellClick")!=-1)&&this._tempResource.length!=0?this._getResourceValue(r):null,quickString:tt},this._trigger("cellClick",v)))return!1;if(this._mediaQuery||r.addClass("e-selectedCell").attr("tabIndex",0).focus(),this._scrollerPosition(),this.model.allowInline&&(this.element.find(".e-inlineedit").length>0&&this._saveAppointment(),this.model.orientation!="vertical"||this._customOrientation!="vertical"||t.isNullOrUndefined(this._inlineDate)||this.currentView()=="month"||this._isCustomMonthView()||this._refreshDayAppointments(this._app),t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(r,this._cellIndex),this._inlineAppointment(r)),this.model.showQuickWindow&&!this.model.allowInline){this._quickAppointWindow.find("#"+this._id+"_quickAppwindow").css("display","block");this._quickAppointWindow.find(".e-quickstartend").html(v.quickString);h=n(i).hasClass("e-workcells")||n(i).hasClass("e-alldaycells")||n(i).hasClass("e-monthcells")?n(i):n(i.target);i.type!="beforeOpen"&&!this.model.readOnly?this._quickAppointWindow.ejDialog("open"):"";this._quickAppointWindow.find(".subject").val("");var ht=h.offset().left-(this._quickAppointWindow.width()-h.width())/2+10,ct=h.offset().top-this._quickAppointWindow.outerHeight()+4,c=this._quickWindowPosition(ht,ct,h,this._quickAppointWindow);this._quickAppointWindow.ejDialog({position:{X:c.X,Y:c.Y}});t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(r,this._cellIndex)}this._focused=n(":focus");this.model.showQuickWindow&&this._quickAppointWindow.find(".subject").focus();this._cellClick=!0;t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("CreateAppointmentTitle")})}else if((!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-appsoverflow")&&!r.hasClass("e-monthheader")&&!r.hasClass("e-categorybar")&&!this.model.allowInline||this.model.allowInline&&!r.hasClass("e-apptext")&&!r.hasClass("e-apptime"))&&!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-appsoverflow")&&!r.hasClass("e-monthheader")&&!r.hasClass("e-categorybar")){if(this._cellClick=!1,t.isNullOrUndefined(this._quickAppDetailsWindow)||this._quickAppDetailsWindow.find("#"+this._id+"_quickAppDetailswindow").css("display","block"),!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&this._quickAppointWindow.ejDialog("close"),f=r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")?r:r.closest(".e-appointment,.e-alldayappointment,.e-monthappointment"),this._appUid=f.attr("data-guid"),r.hasClass("e-schedulemouseclose"))return!1;for(this._processed=this._sortAppById(this._processed),y=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),e=0;e<y.length;e++){u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,y[e].Guid));break}if(t.isNullOrUndefined(u))return;for(e=0;e<u.length;e++)it=this.element.find("div[data-guid="+u[e].Guid+"]"),it.addClass("e-selectedAppointment");this._mediaQuery&&(this._mAppId=this._appUid);var rt=this._sortAppById(u),l=rt[0][this._appointmentSettings.recurrence]?rt[0]:this._getAppointmentByParentId(this._appUid),p=(new Date).getTime()-l[this._appointmentSettings.startTime].getTime(),w=6e4,lt=60*w,at=24*lt,ut=Math.abs(new Date-l[this._appointmentSettings.startTime]),o=Math.floor(ut/36e5);o=o<=9?"0"+o:o;s=new Date(ut).getUTCMinutes();s=s<=9?"0"+s:s;var vt=Math.ceil(p/w-1)<0&&o<24?this._getLocalizedLabels("EventBeginsin")+" "+o+" "+this._getLocalizedLabels("Hours")+" "+s+" "+this._getLocalizedLabels("Minutes"):Math.ceil(p/w-1)<0&&o>=24?this._getLocalizedLabels("EventBeginsin")+" "+Math.abs(Math.ceil(p/at))+" "+this._getLocalizedLabels("Days"):this._getLocalizedLabels("Overdue"),yt=u.length>1?this._recurrenceAppSort(u):u,pt={appointment:yt[0],events:i};if(t.isNullOrUndefined(i.events)&&this._trigger("appointmentClick",pt))return this.element.find(".e-selectedAppointment").css({border:"none"}),!1;this.model.showQuickWindow&&(this._quickAppDetailsWindow&&this._quickAppDetailsWindow.find(".e-quicksubject").html(l[this._appointmentSettings.subject]).attr("title",l[this._appointmentSettings.subject]),b=this._timeMode=="12"?t.format(u[0][this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(u[0][this._appointmentSettings.startTime],"HH:mm",this.model.locale),k=this._timeMode=="12"?t.format(u[u.length-1][this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(u[u.length-1][this._appointmentSettings.endTime],"HH:mm",this.model.locale),this._quickAppDetailsWindow.find(".e-rightfields").html(vt),ft=Math.ceil((u[0][this._appointmentSettings.endTime]-u[0][this._appointmentSettings.startTime])/36e5)/24,et=u.length>1||(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"&&ft>1||u[0][this._appointmentSettings.startTime].getDay()!=u[u.length-1][this._appointmentSettings.endTime].getDay()?this._dayFullNames[u[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(u[0][this._appointmentSettings.startTime],"M",this.model.locale)+" - "+b+" to "+this._dayFullNames[u[u.length-1][this._appointmentSettings.endTime].getDay()]+", "+t.format(u[u.length-1][this._appointmentSettings.endTime],"M",this.model.locale)+" - "+k:this._dayFullNames[u[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(u[0][this._appointmentSettings.startTime],"M",this.model.locale)+", "+b+" - "+k,this._quickAppDetailsWindow.find(".e-quickstartendtime").html(et),l[this._appointmentSettings.recurrence]?this._quickAppDetailsWindow.find(".e-editseries,.e-editfutureonly").removeClass("e-disable"):this._quickAppDetailsWindow.find(".e-editseries,.e-editfutureonly").addClass("e-disable"),i.type!="beforeOpen"?this._quickAppDetailsWindow.ejDialog("open"):"",this.model.readOnly?this._quickAppDetailsWindow.find(".e-scheduledelete").addClass("e-disable"):this._quickAppDetailsWindow.find(".e-scheduledelete").removeClass("e-disable"),this.model.allowDelete||this._quickAppDetailsWindow.find(".e-scheduledelete").addClass("e-disable"),ot=n(f).width()>this.element.width()?n(f).offset().left>this.element.offset().left?n(f).offset().left:this.element.find(".e-draggableworkarea").scrollLeft()>n(f).width()?this.element.offset().left:this.element.width()/2-4:n(f).offset().left-((this._quickAppDetailsWindow.width()-n(f).width())/2-4),st=n(f).offset().top-this._quickAppDetailsWindow.outerHeight()+4,c=this._quickWindowPosition(ot,st,f,this._quickAppDetailsWindow),this._quickAppDetailsWindow.ejDialog({position:{X:c.X,Y:c.Y}}),this._quickAppDetailsWindow.focus());t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("Editevent")})}n(r).hasClass("e-monthcells")||this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px")}else{if((this._cellIndex=0,this.cur_StartTime=new Date(new Date(this.currentDate()).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(this.currentDate()).setHours(23,59,59)),n(r).parentsUntil(".e-agendacellstab tbody").find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus(),f=r.hasClass("e-agendaappointment")?r:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),this._appUid=f.attr("data-guid"),this._mediaQuery&&(this._mAppId=this._appUid),r.hasClass("e-editapp")||r.hasClass("e-deleteapp"))||(f=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._trigger("appointmentClick",{appointment:f[0],events:i})))return!1;this._cellClick=!1}},_inlineAppointment:function(){var u={},h=[],a=this._processed.length>0?Math.max.apply(Math,this._processed.map(function(n){return n.AppTaskId}))+1:1,c,i,r,l,s;if(this._inline=!0,this._inlineDate=new Date(this.cur_StartTime),u[this._appointmentSettings.startTime]=new Date(this._inlineDate),u[this._appointmentSettings.endTime]=this.cur_EndTime,u[this._appointmentSettings.id]=u.inline=this._maxId=a,c=(u[this._appointmentSettings.endTime]-u[this._appointmentSettings.startTime])/36e5>=24,(!t.isNullOrUndefined(this.model.group)||this._tempResource.length!=0&&t.scheduleFeatures.resources)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&(u=this._getResourceFields(u)),h=this._app=u,this._appointmentProcessing(h),i=this._processed.filter(function(n){return n.ParentId==h.ParentId}),i.length>0)for(r=0,l=i.length;r<l;r++){var v=this._findAllDayApp(i[r]),f=i[r][this._appointmentSettings.startTime],e=this.currentView()=="day"&&new Date(new Date(this._dateRender[0]).setHours(0,0,0,0)).getTime()==new Date(new Date(i[r][this.model.appointmentSettings.startTime]).setHours(0,0,0)).getTime()?0:(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this.monthDays):this.currentView()=="day"?-1:n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this._dateRender),o=this._tempResource.length>0&&this._grouping.length>0&&t.scheduleFeatures.resources?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]]):0;this._resWorkWeek&&(s=new Date(i[r][this._appointmentSettings.startTime]).setHours(0,0,0,0),day=this._resourceWorkWee
10k(o,s));this._resCustomView&&(s=new Date(i[r][this._appointmentSettings.startTime]).setHours(0,0,0,0),day=this._resourceCustomView(o,s));e=this._resWorkWeek||this._resCustomView?day:e;(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()!=="month"?this._refreshDayAppointments(i[r]):this.model.timeScale.enable&&this.currentView()!=="month"&&!this._isCustomMonthView()?this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&e>=0&&(i[r][this._appointmentSettings.allDay]||Math.round((i[r][this._appointmentSettings.endTime].getTime()-i[r][this._appointmentSettings.startTime].getTime())/36e5)>=24||v)?this._setAllDayPos(i[r],e,o):this._renderApp(i[r],e,o):this._renderAppointmentMonth(i[r],e,o,0);delete i[r].Index}!c&&u[this._appointmentSettings.endTime].getDate()!=u[this._appointmentSettings.startTime].getDate()?this.element.find(".e-inlinetext")[1].focus():this.element.find(".e-inlinetext")[0].focus();new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:i},"inline");new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:i},"inline")},_inlineEdit:function(i){this._cellClick=!1;t.isNullOrUndefined(this._quickAppDetailsWindow)||this._quickAppDetailsWindow.ejDialog("close");this._inline=!0;var r=this.currentView()!="agenda"?i.closest(".e-appointment,.e-monthappointment,.e-alldayappointment"):i;this.currentView()!="agenda"&&i.children("span")&&i.children("span").css("display","none");i.css("display","none");this._appUid=r.attr("data-guid");this._subject=this.currentView()!="agenda"?r.find(".e-apptext").text():r.text();this._inlineText=t.buildTag("input .e-inlineedit","",{},{type:"text",value:n.trim(this._subject),onfocus:"this.value = this.value;"});this.currentView()!="agenda"?r.prepend(this._inlineText):r.before(this._inlineText);this._inlineText.css({background:"transparent",border:"0px solid transparent"});this.element.find(".e-inlineedit").focus()},_inlineRemove:function(){this._inline=!1;this.element.find(".e-inlinewrapper").remove();this.element.find(".e-inline").remove();this._inlineText=null;this.element.find(".e-inlineedit")&&(this.currentView()=="agenda"?this._renderAgendaContent():(this.element.find(".e-inlineedit").remove(),this.element.find(".e-icon.e-recurapp").css("display","block"),this.element.find(".e-apptext").css("display","block")))},_inlineTemplate:function(t,i,r,u,f,e,o){this._inlineText=n(this.inlineTemplate.render({id:t[this._appointmentSettings.id],rtl:this.model.enableRTL,subject:" ",left:o?i:i+"px",top:r,appWidth:o?u:u+"px",appHeight:f,appClass:"e-inline",appointData:e.appointColor.appointData,appointtextcolor:e.appointColor.appointtextcolor}))},_getDateByElement:function(n,t){var i=this.model.showWeekend?7:this.model.workWeek.length,u,r;this._cellIndex=this.model.timeScale.enable?n.hasClass("e-workcells")?n.index():n.hasClass("e-alldaycells")?n.index():this._isCustomMonthView()&&this._oneWeek?n.index():i-((parseInt(n.index()/i)+1)*i-n.index())+n.parent().index()*i:this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7&&!this._resCustomView?i-((parseInt(n.index()/i)+1)*i-n.index())+n.parent().index()*i:n.index();(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(u=this.element.find(".e-workcellstab tr:first-child").children().length/this._dateRender.length,this._cellIndex=this.currentView()!=="month"&&!this._isCustomMonthView()&&u<this._cellIndex?this._cellIndex-this._cellIndex%u:this._cellIndex,this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):this._cellIndex:n.index(),t!="cellHover"&&(this._workCellIndex=n.hasClass("e-workcells")?n.parent().index():n.closest(".e-workcells").parent().index()));r=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"&&this._customOrientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this._resWorkWeek?this._dateRender:this.dateRender:this._dateRender;r=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:r;this._cellIndex=this._cellIndex==r.length?this._cellIndex-1:this._cellIndex;this.curDate=new Date(r[this._cellIndex])},_slotByElement:function(n,i){this._getDateByElement(n,i);var r=this.curDate;n.hasClass("e-workcells")&&this.model.timeScale.enable&&this.currentView()!=="month"&&!this._isCustomMonthView()?(this._calcCurrentTime(r,n,i),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1}
10)):i=="cellHover"?(this.cellHoverStartTime=new Date(new Date(r).setHours(0,0,0)),this.cellHoverEndTime=new Date(new Date(r).setHours(23,59,59))):(this.cur_StartTime=new Date(new Date(r).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(r).setHours(23,59,59)),n.hasClass("e-alldaycells")&&(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0})))},_calcCurrentTime:function(n,t,i){var r,u=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,s,e;if(this.model.orientation=="vertical"&&this._customOrientation=="vertical")r=this.model.startHour*60+t.parent().index()*u,r=r*6e4;else{var f=this.element.find(".e-workcellstab tr:first-child").children().length/this._dateRender.length,h=Math.floor(t.index()/f),o=Math.abs(f-t.index());o=o%f;s=u*o+this.model.startHour*60;r=this.model.startHour*60+t.index()*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*this._cellIndex*(60/this.model.timeScale.majorSlot)*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount);r=f==0?r:this.model.startHour*60+t.index()*u-(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*this._cellIndex*(60/this.model.timeScale.majorSlot)*u;r=h!=0&&f!=0?s*6e4:r*6e4}this._timeScaleMin=u;this._timeScaleMin=this._timeScaleMin*6e4;i=="cellHover"?(this.cellHoverStartTime=new Date(n).setMilliseconds(r),e=parseInt(new Date(this.cellHoverStartTime).getHours())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getHours()&&parseInt(new Date(this.cellHoverStartTime).getMinutes())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getMinutes()?r+(this._timeScaleMin-1):new Date(this.cellHoverStartTime).getMilliseconds()+this._timeScaleMin,this.cellHoverEndTime=new Date(new Date(this.cellHoverStartTime).setMilliseconds(e)),this.cellHoverEndTime=new Date(this.cellHoverStartTime).setHours(0,0,0,0)<new Date(this.cellHoverEndTime).setHours(0,0,0,0)?new Date(new Date(this.cellHoverStartTime).setHours(23,59,59)):this.cellHoverEndTime):(this.cur_StartTime=new Date(n).setMilliseconds(r),e=parseInt(new Date(this.cur_StartTime).getHours())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getHours()&&parseInt(new Date(this.cur_StartTime).getMinutes())==new Date(new Date(n).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getMinutes()?r+(this._timeScaleMin-1):new Date(this.cur_StartTime).getMilliseconds()+this._timeScaleMin,this.cur_EndTime=new Date(new Date(this.cur_StartTime).setMilliseconds(e)),this.cur_EndTime=new Date(this.cur_StartTime).setHours(0,0,0,0)<new Date(this.cur_EndTime).setHours(0,0,0,0)?new Date(new Date(this.cur_StartTime).setHours(23,59,59)):this.cur_EndTime)},_checkReminders:function(){var i,n;for(this._todayAppointments=[],i=0;i<this._processed.length;i++)new Date(new Date(this._processed[i][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()>=new Date((new Date).setHours(0,0,0,0)).getTime()&&this._todayAppointments.push(this._processed[i]);n=this;jQuery.each(this._todayAppointments,function(i,r){var u,f,e,o;t.isNullOrUndefined(n.model)||t.isNullOrUndefined(n.model.reminderSettings)||(u=n.model.reminderSettings.alertBefore,f=r[n._appointmentSettings.startTime],u!=-1&&u!=null&&(e=(new Date).getTime(),o=(e-new Date(f).getTime())/6e4,Math.round(o)==u*-1&&n._trigger("reminder",{reminderAppointment:r})))})},_showContextMenu:function(i){var e=!1,o=!1,s=this.model.contextMenuSettings.menuItems.cells,f,h,c,l,r,u,a;if(i){if(this._contextMenu=t.buildTag("ul#"+this._id+"contextMenu"),this.element.append(this._contextMenu),this._contextMenu.ejMenu({fields:{id:"id",text:"text",parentId:"parentId"},menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+this._id,width:"auto",open:function(){this.element.width("auto")},click:n.proxy(this._onMenuSelect,this),beforeOpen:n.proxy(this._beforeopen,this)}),this.model.categorizeSettings.enable&&this.model.contextMenuSettings.menuItems.appointment){for(f=this.model.contextMenuSettings.menuItems.appointment,h=this.model.categorizeSettings.dataSource.length,r=0;r<f.length;r++)if(f[r].id=="categorize"){c=r;o=!0;break}if(o)for(l=new t.DataManager(this.model.contextMenuSettings.menuItems.appointment).executeLocal((new t.Query).where("parentId",t.FilterOperators.equal,"categorize")),new t.DataManager(this.model.contextMenuSettings.menuItems.appointment).saveChanges({added:[],changed:[],deleted:l},"parentId"),r=0;r<h;r++)u=this.model.categorizeSettings,this.model.contextMenuSettings.menuItems.appointment.push({text:u.dataSource[r][u.text],id:"categorize_"+u.dataSource[r][u.id],fontColor:u.dataSource[r][u.fontColor],color:u.dataSource[r][u.color],parentId:this.model.contextMenuSettings.menuItems.appointment[c].id.toString()})}if(this._gotoDate&&this.model.contextMenuSettings.enable){for(a in s)if(s[a].id=="gotodate"){e=!0;break}e&&(this._renderGotoWindow(),this._gotoDate=!1)}}},_beforeopen:function(i){var f,v,y,p,a,e,u,w,h;if(this.model.contextMenuSettings.enable){n(document).off(t.eventType.mouseMove);var r=n(i.target).closest(".e-alldayappointment,.e-appointment,.e-monthappointment,.e-workcells,.e-monthcells,.e-alldaycells"),c,o=null,s,l=n(r).parents(".e-draggableworkarea tr").length>0&&n(r).parentsUntil(".e-draggableworkarea tr").is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn")||n(r).is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn");if(r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||t.isNullOrUndefined(this.model.appointmentTemplateId)||(r=n(i.target).offsetParent()),n(i.target).hasClass("e-appsoverflow"))return!1;if(i.cancel=r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointment")||r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-appointinnertext")||r.hasClass("e-monthcells")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||l?!1:!0,i.cancel==!0)return h=this._contextMenu.data("ejMenu"),h.hide(),!1;if(this.currentView()=="agenda"&&l&&(i=n(r).hasClass("e-agendaappointment")?i:n(r).parents(".e-draggableworkarea tr").find(".e-agendaappointment")),this._cellSelection(i),(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells"))&&(s={currentDate:this.curDate,cellIndex:this._cellIndex,events:i,resources:!t.
10isNullOrUndefined(this.model.beforeContextMenuOpen)&&this._tempResource.length!=0?this._getResourceValue(r,this._cellIndex):null}),(r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||r.hasClass("e-appointment"))&&(o=this._getAppDetails(i),s={appointment:o,events:i}),this.currentView()=="agenda"&&(o=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],s={appointment:o,events:i}),this._baseTarget=r,this._trigger("beforeContextMenuOpen",s))return!1;if(f=this._contextMenu.data("ejMenu"),c=r.hasClass("e-alldayappointment")||r.hasClass("e-monthappointment")||r.hasClass("e-appointment")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptime")||r.hasClass("e-apptext")||l?!1:!0,c?f.option("fields.dataSource",this.model.contextMenuSettings.menuItems.cells):f.option("fields.dataSource",this.model.contextMenuSettings.menuItems.appointment),this.model.readOnly?(f.disableItemByID("new"),f.disableItemByID("recurrence"),f.disableItemByID("delete"),f.disableItemByID("categorize")):(f.enableItemByID("new"),f.enableItemByID("recurrence"),this.model.allowDelete?f.enableItemByID("delete"):f.disableItemByID("delete"),f.enableItemByID("categorize")),v=this.element.find("td.e-selectedCell"),v.length>1&&this.currentView()!="agenda"&&this._multipleCellAppointCreation(i),this._target=i,this.model.showQuickWindow&&!t.isNullOrUndefined(this._quickAppointWindow)&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),this.model.categorizeSettings.enable&&c==!1){if(y=this._contextMenu.find("li#categorize").find("li").children(),y.find("div").length==0)for(u=0;u<this.model.categorizeSettings.dataSource.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+this.model.categorizeSettings.dataSource[u][this.model.categorizeSettings.id]).children().append('<div><div style="border: 1px solid black;height: 12px;margin-left: 2px;margin-top: 2px;width: 12px;background-color:'+this.model.categorizeSettings.dataSource[u][this.model.categorizeSettings.color]+'"><\/div><\/div>');for(u=1;u<=this.model.categorizeSettings.dataSource.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+u).children().find("div:first-child.e-categorizeMenuSelected")&&this._contextMenu.find("li#categorize").find("li#categorize_"+u).children().find("div:first-child").removeClass("e-categorizeMenuSelected");if(p=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),a=t.DataManager(this._processed).executeLocal(p),a[0][this._appointmentSettings.categorize])if(e=a[0][this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(e[0].length>0)for(u=0;u<e.length;u++)this._contextMenu.find("li#categorize").find("li#categorize_"+e[u]).children().find("div:first-child").addClass("e-categorizeMenuSelected")}else e[0].length>0&&(w=e.length-1,this._contextMenu.find("li#categorize").find("li#categorize_"+e[w]).children().find("div:first-child").addClass("e-categorizeMenuSelected"))}else this._contextMenu.find("li#categorize")&&this._contextMenu.find("li#categorize").css("display","none")}else return h=this._contextMenu.data("ejMenu"),h.hide(),!1},_onMenuSelect:function(i){var o=i.events.ID.split("_"),r="",l=this._baseTarget,s,d,p,e,h,u,g,f,nt,tt,c,a,k,y,v;if(n(l).is(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment")||l.parents(".e-appointment").hasClass("e-appointment")||l.parents(".e-monthappointment").hasClass("e-monthappointment")||l.parents(".e-alldayappointment").hasClass("e-alldayappointment")||this.currentView()=="agenda"&&this.element.find(".e-selectedCell").parent().find(".e-agendaappointment")?(s=t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),r=s[0][this._appointmentSettings.recurrence]&&s[0][this._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1?s[0]:this._getAppointmentByParentId(this._appUid)):r={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,resourceInfo:this._getResourceDetails(l)},t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("menuItemClick")==-1||(i={ID:i.ID,type:i.type,text:i.text,parentId:i.parentId,parentText:i.parentText}),this._trigger("menuItemClick",{events:i,targetInfo:r}))return!1;d=r[this._appointmentSettings.categorize];switch(o[0]){case"new":this._appointmentWindow(this._target);break;
10case"recurrence":this._appointmentWindow(this._target);this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0});this._repeat(i={isChecked:!0,isInteraction:!0});break;case"open":this._appointmentWindow(this._target);break;case"today":this._navigateClick(this.currentDate(new Date),"DateNavigation");break;case"view":t.isNullOrUndefined(o[1])||(p=o[1].toLowerCase(),this._navView=!0,this.currentView()!=p&&this._viewChange(null,this.currentView(),p));break;case"timemode":t.isNullOrUndefined(o[1])||(this.model.timeMode=this._timeMode=o[1]=="Hour12"?"12":"24",this._updateTimeMode(),this.element.find(".e-scrolltimecells").height(this.element.find(".e-workcellstab").height()));break;case"businesshours":case"workhours":this.model.workHours.highlight=this.model.workHours.highlight?!1:!0;this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells")&&this.element.find(".e-monthcells").removeClass("e-monthcellhighlight");break;case"gotodate":this._gotoWindow.ejDialog("open");break;case"delete":this._deleteAppoint();break;case"print":this._printAppointment(this._appUid);break;case"categorize":if(t.isNullOrUndefined(o[1]))this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment").removeClass("e-selectedAppointment");else if(this.model.categorizeSettings.enable){if(e=o[1],h="",r[this._appointmentSettings.categorize])if(u=r[this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(u[0].length>0){for(f=0;f<u.length;f++)if(u[f]==e){g=!0;break}if(g==!0)for(f=0;f<u.length;f++)u[u.length-1]!=e?u[f]!=e&&(h+=u.length-1!=f?u[f]+",":u[f]):u[f]!=e&&(h+=u.length-2!=f?u[f]+",":u[f]);else h=r[this._appointmentSettings.categorize]+","+e}}else h=u[u.length-1]==e?"":e.toString();else h=e.toString();if(r[this._appointmentSettings.categorize]=h,!t.isNullOrUndefined(o[1])&&(nt=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,s[0][this._appointmentSettings.id])),tt=s[0][this._appointmentSettings.recurrence]?{appointment:r,recurrenceCollection:{occurrences:s[0],parentData:nt[0]}}:{appointment:r},this._trigger("beforeAppointmentChange",tt)))return r[this._appointmentSettings.categorize]=d,!1;var w=this,it=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",b=this._dataManager.update(it,r,this.model.appointmentSettings.query._fromTable);for(new t.DataManager(this._currentAppointmentData).update("AppTaskId",r),c=this._processed.filter(function(n){return n[w._appointmentSettings.id]==r[w._appointmentSettings.id]}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:c},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:c},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:c},"Guid"),a=0,v=c.length;a<v;a++)this._appointmentRemove(c[a]);for(this._appointmentProcessing(r),this._currentViewAppointments=this.getCurrentViewAppointments(),k=this._currentViewAppointments.filter(function(n){return n.ParentId==r.ParentId}),y=0,v=k.length;y<v;y++)this._refreshDayAppointments(k[y]);this._trigger("appointmentChanged",{appointment:r});!t.isNullOrUndefined(b)&&n.isFunction(b.promise)&&this.dataSource()instanceof t.DataManager&&b.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&w._processUrlBinding(i)});break}}},_updateTimeMode:function(){var e=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,o=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,i=this._timeSlot
10Count(e,o),s,a,h,c,u,f;if(t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".startendtime").ejTimePicker({timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"}),this.model.orientation!="horizontal"&&this._customOrientation!="horizontal"||this.currentView()==="month"||this._isCustomMonthView()||this.currentView()==="agenda")this.currentView()==="month"||this._isCustomMonthView()||this.currentView()==="agenda"||(h=this.currentView()=="month"?1:0,(e||o)&&this.currentView()!=="month"&&!this._isCustomMonthView()?(i.columnCount.pop(),c=this.userTimeCellTemplate.render({timerows:i.strTime,cols1:i.columnCount,viewclass:h,timeScale:this.model.timeScale.minorSlotCount,cheight:this.model.cellHeight,userTemplateId:e,timeValue1:i.timeValue1,template:o})):c=this.timeCellTemplate.render({timerows:i.strTime,cols1:i.columnCount,viewclass:h,timeScale:this.model.timeScale.minorSlotCount,userTemplateId:e,template:o}),this.$TimeCellTD.children().remove(),this.$TimeCellTD.append(c),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px"),this._timeMode!="24"&&(u=this.element.find(".e-draggableworkarea").scrollTop()/(this.element.find(".e-workcells").height()*this.model.timeScale.minorSlotCount),u=Math.round(u)<u?Math.round(u)+1:Math.round(u),f=t.preferredCulture(this.model.locale).calendar,f.AM&&f.PM&&this.element.find(".e-idAmpmstyle").each(function(t,i){t==u&&n(i).text().trim()=="00"?parseInt(n(i)[0].id)<12?n(i).text(f.AM[0]):n(i).text(f.PM[0]):(n(i).text()==f.AM[0]&&t>0||n(i).text()==f.PM[0]&&parseInt(n(i)[0].id)>12)&&n(i).text("00")})),this.element.find(".e-headercells").addClass("e-dateheaderselect"),this._highlightCurrentTime(this.model.showCurrentTimeIndicator));else{var v=this.element.find(".e-horizontaltimecells").find("table tr").eq(2).css("left"),r=this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",l=r=="day"?1:r=="week"?7:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:5;this.datesColumn=this._getHeaderAllDayCellsCount();s=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)?!0:!1;a=e||o?this.userTimeCellHoriTemplate.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),heightclass:r=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",multiRes:s,view:r,timeTdCount:i.strTime,colspan:r=="month"?1:i.strTime.length/l*2,height:r=="month"?62:59,width:this.model.width,headercellWidth:r=="day"?"100%":"55px",column:i.columnCount,userTemplateId:e,template:o}):this.horizontalHeader.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),heightclass:r=="month"?"e-horizontalmonthtimecellsht":"e-horizontaltimecellsht",multiRes:s,view:r,timeTdCount:i.strTime,colspan:r=="month"?1:i.strTime.length/l*2,height:r=="month"?62:59,width:this.model.width,headercellWidth:r=="day"?"100%":"55px",column:i.columnCount});this.aTR.children().remove();this.aTR.append(a);this._borderAddRemove();this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");this.element.find(".e-headercells").addClass("e-dateheaderselect");this.element.find(".e-horizontaltimecells").find("table tr").eq(2).css("left",parseInt(v)+"px");this._businessHourScroller()}t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll()},_gotoOk:function(t){var u,f,i,r;if(n(t.currentTarget).hasClass("e-gotoOk")){if(u=this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker("option","value"),f=this._gotoWindow.find("#"+this._id+"show").ejDropDownList("option","itemValue"),data={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:t},this._trigger("actionBegin",{data:data,requestType:"dateNavigate"}))return!1;if(i=this.currentDate(),r=this.currentView(),this.currentDate(new Date(u)),this.currentView(f.toLowerCase()),data={previousDate:i,currentDate:this.currentDate(),previousView:r,currentView:this.currentView(),target:t,requestType:"dateNavigate"},this._trigger("navigation",data))return this.currentDate(new Date(i)),this.currentView(r),this._navView=!1,!1;this._renderCurrentView("ViewChange");this._trigger("actionComplete",{data:data,requestType:"dateNavigate"})}this._gotoCancel()},_gotoCancel:function(){this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker({value:this.currentDate()});this._gotoWindow.find("#"+this._id+"show").ejDropDownList({value:this.currentView()});this._gotoWindow.ejDialog("close")},_renderGoto:function(){var n,t;for(this._gotoWindow.find("#"+this._id+"gotodate").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate}),n=[],t=0;t<this.model.views.length;t++)switch(this.model.views[t]){case"day":n.push({text:this._getLocalizedLabels("Day"),value:"day"});break;case"week":n.push({text:this._getLocalizedLabels("Week"),value:"week"});break;case"workweek":n.push({text:this._getLocalizedLabels("WorkWeek"),value:"workweek"});break;case"month":n.push({text:this._getLocalizedLabels("Month"),value:"month"});break;case"customview":n.push({text:this._getLocalizedLabels("CustomView"),value:"customview"});break;case"agenda":n.push({text:this._getLocalizedLabels("Agenda"),value:"agenda"})}this._gotoWindow.find("#"+this._id+"show").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:n,width:"100%",selectedItemIndex:0,cssClass:this.model.cssClass});this._gotoWindow.find(".e-gotobutton").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"60px",cssClass:"e-flat"+this.model.cssClass})},_renderGotoWindow:function(){n("#"+this._id+"gotoWindow_wrapper")&&n("#"+this._id+"gotoWindow_wrapper").remove();this._gotoWindow=t.buildTag("div.e-gotodialog#"+this._id+"gotoWindow");var i="<div><table width='100%' cellpadding='5'><tbody><tr><td>"+this._getLocalizedLabels("Date")+":<\/td><td><input id='"+this._id+"gotodate' type='text' value='' /><\/td><\/tr><tr><td>"+this._getLocalizedLabels("Showin")+":<\/td><td><input type='text' id='"+this._id+"show' /><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-floatright'><table><tr><td><div><button id='"+this._id+"gotook' type='button' class='e-gotobutton e-gotoOk'>"+this._getLocalizedLabels("Done")+"<\/button>
10<\/div><\/td><td><div><button id='"+this._id+"gotocancel' type='button' class='e-gotobutton e-gotoCancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>";this._on(this._gotoWindow,"click",".e-gotobutton",n.proxy(this._gotoOk,this));this._gotoWindow.append(i);this.element.append(this._gotoWindow);this._renderGoto();this._gotoWindow.ejDialog({width:300,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("Gotodate"),enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._gotoCancel,this)});n("#"+this._id+"gotoWindow_wrapper").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_highlightCurrentTime:function(i){var e,f,o,u;if(t.preferredCulture(this.model.locale),i&&this.model.timeScale.enable&&!this._resWorkWeek&&!this._resCustomView){if(e=!1,f=0,this.currentView()!=="agenda")for(u=0;u<this._dateRender.length;u++)if(new Date(new Date(this._dateRender[u]).setHours(0,0,0,0)).getTime()===new Date((new Date).setHours(0,0,0,0)).getTime()){e=!0;f=u;break}if(o=this.element.find(".e-workcellstab tr").first().find("td"),this.currentView()==="month"||this._isCustomMonthView())if(e)if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"){var s=this.model.showWeekend?7:this.model.workWeek.length,h=Math.floor(f/s),c=Math.abs(f-h*s);for(this.model.group||(this.res1=["0"]),u=0;u<this.res1.length;u++)n(n(this.element.find(".e-workcellstab tr")[h]).children()[Math.floor(c)]).hasClass("e-othermonths")||n(n(this.element.find(".e-workcellstab tr")[h]).children()[Math.floor(c)]).addClass("e-currentdayhighlight"),c+=s}else this._renderHorizontalCurrentTime();else this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.element.find(".e-monthcells").removeClass("e-currentdayhighlight"):this.element.find(".e-workcells").removeClass("e-currentdayhighlight");else if(e){var r=this,l=this.currentView()==="week"?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._dateRender.length:1,a=this.model.cellWidth?parseInt(this.model.cellWidth):this.element.find(".e-draggableworkarea")[0].offsetWidth/(l*this.res1.length);if((new Date).getHours()>=r.model.startHour&&(new Date).getHours()<=r.model.endHour)if(r.model.orientation=="vertical")for(r.element.find(".e-highlightcurrenttimeline").remove(),u=0;u<this.res1.length;u++)this.element.find(".e-draggableworkarea").append('<div id="'+this._id+u+'_HighlightCurrentTimeline" class="e-highlightcurrenttimeline"><\/div>'),t.isNullOrUndefined(o[f])||n("#"+this._id+u+"_HighlightCurrentTimeline").append('<div class="e-currenttime"><\/div>').append(t.buildTag("div.e-icon e-circle_01 e-timeidicatorcircle e-lefttimeindicator")).append(t.buildTag("div.e-icon e-circle_01 e-timeidicatorcircle e-righttimeindicator")).css("width",a+"px").css("left",o[f+l*u].offsetLeft+"px").find(".e-righttimeindicator").css("margin-left",a-3+"px");else this._renderHorizontalCurrentTime();function v(){var f,s,h,i;if(r.currentView()!="agenda"&&r.currentView()!="month"&&!r._isCustomMonthView()){var e=r.element.find(".e-workcellstab tr").first().find("td"),o=r.currentView()==="week"?r.model.showWeekend?7:r.model.workWeek.length:r.currentView()==="workweek"?r.model.workWeek.length:r.currentView()=="customview"?r._dateRender.length:1,u=new Date;if(u.setMinutes(u.getMinutes()),f=r._dateRender.indexOf(new Date(u).setHours(0,0,0,0)),u.getHours()>=r.model.startHour&&u.getHours()<=r.model.endHour)if(r.model.orientation=="vertical"){for(r.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),s=((u.getHours()-r.model.startHour)*60+u.getMinutes())*r.element.find(".e-workcells")[0].offsetHeight*r.model.timeScale.minorSlotCount/r.model.timeScale.majorSlot,i=0;i<r.res1.length;i++)r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").css("top",s-1),t.isNullOrUndefined(e[f])||r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").css("left",e[f+o*i].offsetLeft),n(r.element.find(".e-dateheader").children()[f+o*i]).addClass("e-currentdayhighlight");for(h=r._timeMode=="12"?t.format(new Date,"hh:mm tt",r.model.locale):t.format(new Date,"HH:mm",r.model.locale),i=0;i<r.res1.length;i++)r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").find(".e-currenttime").html(h),r._timeMode=="12"&&r.element.find("#"+r._id+i+"_HighlightCurrentTimeline").find(".e-currenttime").addClass("e-timewidth")}else r._horizontalTimePosition(r,u)}}v();t.isNullOrUndefined(this._intervalID)&&(this._intervalID=window.setInterval(v,6e4))}else window.clearInterval(this._intervalID),this._intervalID=null,this.element.find(".e-highlightcurrenttimeline").remove()}},_filter:function(){for(var r=[],i=n.extend(!0,[],this._processed),t=0;t<i.length;t++)new Date(i[t][this._appointmentSettings.endTime])>=this.model.minDate&&new Date(i[t][this._appointmentSettings.endTime])<=this.model.maxDate&&r.push(i[t]);return r},_getPreviousNextAppointment:function(){var i=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal"||!this.model.showNextPrevMonth)&&this.currentView()=="month"?this.monthDays:this._dateRender,u=[],f=[],t=this._filter(),n,r;if(this.currentView()!="workweek")for(n=0;n<t.length;n++)new Date(t[n][this._appointmentSettings.startTime])<new Date(i[0])&&new Date(t[n][this._appointmentSettings.endTime])<new Date(i[0])?u.push(t[n]):new Date(t[n][this._appointmentSettings.startTime])>new Date(i[i.length-1])&&new Date(t[n][this._appointmentSettings.endTime])>new Date(i[i.length-1])&&f.push(t[n]);else for(n=0;n<t.length;n++)for(r=0;r<i.length;r++)new Date(t[n][this._appointmentSettings.startTime]).getDay()==new Date(i[r]).getDay()&&(new Date(t[n][this._appointmentSettings.startTime])<new Date(i[0])&&new Date(t[n][this._appointmentSettings.endTime])<new Date(i[0])?u.push(t[n]):new Date(t[n][this._appointmentSettings.startTime])>new Date(i[i.length-1])&&new Date(t[n][this._appointmentSettings.endTime])>new Date(i[i.length-1])&&f.push(t[n]));return{previous:u,next:f}},_nextPrevAppointment:function(n){var r,i;if(n&&!(this._browserInfo.name==="msie"&&this._browserInfo.version<9)){var u=this.element.find("#"+this._id+"_scroller"),o=u.ejScroller("instance").isVScroll()?this.element.find("#"+this._id+"_scroller").find(".e-vscroll").outerWidth():0,f=t.buildTag("div.e-prevapp enable",this._getLocalizedLabels("PreviousAppointment"),{},{}),e=t.buildTag("div.e-nextapp enable",this._getLocalizedLabels("NextAppointment"),{},{});u.append(f).append(e);r=u.height()/2-75;i=this.element.find(".e-scrolltimecells").parent().outerWidth();i=t.isNullOrUndefined(i)?0:i;this.model.enableRTL?(f.css({top:r+40+"px",transform:"rotate(-90deg)",right:i-61+"px"}),e.css({top:r+40+"px",transform:"rotate(90deg)",right:this.element.find(".e-workareadiv").width()-61-o-30+"px"})):(f.css({top:r+40+"px",transform:"rotate(90deg)",left:i-61+"px"}),e.css({top:r+40+"px",transform:"rotate(-90deg)",left:this.element.find(".e-workareadiv").width()-61-o-30+"px"}))}},_nextPrev:function(i){var u=this,r=this._getPreviousNextAppointment();n(i.currentTarget).hasClass("e-prevapp")?t.isNullOrUndefined(r)||(r.previous.sort(function(n,t){return new Date(t[u._appointmentSettings.startTime])-new Date(n[u._appointmentSettings.startTime])}),this.currentView()=="customview"&&(this._daterend=r.previous[0][this._appointmentSettings.startTime]),this._keyPressed=!0,this._navigateClick(this.currentDate(new Date(new Date(r.previous[0][this._appointmentSettings.startTime]).setHours(0,0,0,0))),"Previous")):n(i.currentTarget).hasClass("e-nextapp")&&(t.isNullOrUndefined(r)||(r.next.sort(function(n,t){return new Date(n[u._appointmentSettings.startTime])-new Date(t[u._appointmentSettings.startTime])}),this.currentView()=="customview"&&(this._daterend=r.next[0][this._appointmentSettings.startTime]),this._keyPressed=!0,this._navigateClick(this.currentDate(new Date(new Date(r.next[0][this._appointmentSettings.startTime]).setHours(0,0,0,0))),"Next")))}
10,_nextPrevButton:function(){if(this.getCurrentViewAppointments().length!=0)this.element.find(".e-prevapp,.e-nextapp").css("display","none");else{this.currentView()=="agenda"&&this._refreshAppNavigation();var i=this._getPreviousNextAppointment();this.element.find(".e-prevapp,.e-nextapp").css("display","block");i.previous.length==0?this.element.find(".e-prevapp").removeClass("enable").addClass("e-nextprevappdisable"):this.element.find(".e-prevapp").addClass("enable").removeClass("e-nextprevappdisable");i.next.length==0?this.element.find(".e-nextapp").removeClass("enable").addClass("e-nextprevappdisable"):this.element.find(".e-nextapp").addClass("enable").removeClass("e-nextprevappdisable")}(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"&&this.element.find(".e-prevapp,.e-nextapp").hide()},_navigateView:function(i){var o,u,s,f,l=this.currentView(),r=n(i.target),e,h,c;if(this.currentView()=="agenda")return!1;if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"){if(e=this.model.showWeekend?7:this.model.workWeek.length,this.currentView()==="month"||this._isCustomMonthView()){if(r.hasClass("e-monthheader")){if(this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1)return!1;if(f=r.parent().index(),s=f>e-1?f%e:f,u=new Date(this._dateRender[r.parent().parent().index()*e+s]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(u);else return!1;o="day"}else if(r.hasClass("e-timecells")||r.hasClass("e-timecelldivs")){if(r=r.hasClass("e-timecells")?r:r.parent(),this.model.views.toString().toLowerCase().split(",").indexOf("week")==-1)return!1;if(u=new Date(this._dateRender[r.parent().index()*e]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(u);else return!1;o="week"}}else if(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7){if(h=r.hasClass("e-headercells")?r:r.parent().hasClass("e-headercells")?r.parent():r.closest(".e-headercells"),this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1||!h.hasClass("e-headercells"))return!1;if(f=h.index(),c=this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()==="customview"?this._dateRender.length:e,s=f>c-1?f%c:f,u=new Date(this._dateRender[s]),this.model.minDate<=u&&this.model.maxDate>=u)this.currentDate(new Date(u));else return!1;o="day"}this._navView=!0;l=="day"||t.isNullOrUndefined(o)||(this._viewChange(i,l,o),this._businessHourScroller())}else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&this._horizontalViewNavigation(i)},_appOverflowClick:function(i){var u,r;if(this.model.views.toString().toLowerCase().split(",").indexOf("day")!==-1){if(this._trigger("overflowButtonClick",{event:i,Datas:this._overflowApp}))return!1;t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(u=this.model.showWeekend?7:this.model.workWeek.length,r=n(i.target).closest(".e-monthcells,.e-workcells").parent().index()*u+n(i.target).closest(".e-monthcells,.e-workcells").index()%u,this.currentDate(new Date(this._dateRender[r]))):(r=parseInt(n(i.target).attr("id").split("_")[n(i.target).attr("id").split("_").length-1]),this.currentDate(this.currentView()=="month"||this._isCustomMonthView()?new Date(this.monthDays[r]):new Date(parseInt(n(i.target).attr("data-cellinfo")))));this._navView=!0;this._viewChange(i,this.currentView(),"day")}else return!1},_viewCalendar:function(){var u,r,i,f;(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"||(u=this.element.find("#"+this._id+"_navigator").data("ejDatePicker"),u&&(u.show(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}),r=this.element.offset(),this.model.enableRTL?(i=r.left+this.element.width()-280,i<0&&(i=0)):(i=r.left+55,f=n(document).scrollLeft()+n(window).width(),f-i<n("#e-"+this._id+"_navigator").width()&&(i=f-n("#e-"+this._id+"_navigator").width())),n("#e-"+this._id+"_navigator").css({top:r.top+47+"px",left:i+"px"})),this.element.find(".e-workcells").removeClass("e-selectedCell").removeClass("e-mousehover"),this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment").removeClass("e-selectedAppointment"))},_viewChange:function(i,r,u){this._viewchange=!0;this._renderedApp=[];u=t.isNullOrUndefined(u)?i.currentTarget.className.split("e-")[2].split(" ")[0]:u;(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&u!=="customview"&&(this.element.find(".e-datecommondiv").hasClass("e-datecursor")&&this.element.find(".e-datecommondiv").removeClass("e-datecursor"),this.element.find(".e-navigateprevious,.e-navigatenext").is(":visible")||this.element.find(".e-navigateprevious,.e-navigatenext").show(),this.element.find(".e-prevapp,.e-nextapp").is(":visible")||this.element.find(".e-prevapp,.e-nextapp").show());var e=!0,f;if(f={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i},this._trigger("actionBegin",{data:f,requestType:"viewNavigate"}))return!1;if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),r!==u||!r&&!u){if(r=this.currentView(),this._navView?this.currentView(u):(e=this.currentView()==i.currentTarget.className.split("e-")[2].split(" ")[0]?!1:!0,this.currentView(n(i.currentTarget).hasClass("e-activeview")?this.currentView():i.currentTarget.className.split("e-")[2].split(" ")[0])),f={previousView:r,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i,requestType:"viewNavigate"},this._trigger("navigation",f))return this.currentView(r),this._navView=!1,!1;r!==this.currentView()&&(this._customOrientation=this.model.orientation);e&&this._renderCurrentView("ViewChange")}f={previousView:r,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i,requestType:"viewNavigate"};this._mediaQuery&&r!=this.currentView()&&this.element.find(".e-workareadiv,.e-navigate").addClass("navigate");this._trigger("actionComplete",{data:f,requestType:"viewNavigate"})},_renderCurrentView:function(i){var f,r,u;if(t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide"),this.model.orientation==t.Schedule.Orientation.Horizontal&&this._grouping.length>1&&(r=this.element.find(".e-parentnodecategory"),f=this,r.each(function(t){n(this).hasClass("e-resourceexpand")&&f._expandCollapseState.push(t)})),this._resWorkWeek=this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showWeekend&&this.currentView()=="workweek"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek),this._resCustomView=this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showWeekend&&this.currentView()=="customview"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.renderDates),this.element.find(".e-commonviewbutton").blur().removeClass("e-activeview"),this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.element.find(".e-headerdaydisplay,.e-datedisplay,.e-headrealldaytable").children().remove(),this._getRenderDates(),this.wTR.children().remove(),this.aTR.children().remove(),this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview").attr("tabIndex",0).focus(),t.isNullOrUndefined(this._scheduleDrawer)||this._navSelected||this._scheduleDrawer.ejNavigationDrawer({listViewSettings:{selectedItemIndex:this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())+1}}),this._renderHeaderAllDayTemplate(),this._renderContentAreaTemplate(),this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue()),this._renderCommon(),t.isNullOrUndefined(this.dataSource())||(i!="ScheduleResize"?this.model.enableLoadOnDemand?this._bindAppointmentsData(i):(this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()):this._renderAppointmentAll()),this.model.orientation==t.Schedule.Orientation.Horizontal&&this._grouping.length>1){for(r=this.element.find(".e-parentnodecategory"),u=0;u<this._expandCollapseState.length;u++)r.eq(this._expandCollapseState[u]).click();this.currentView()!="agenda"&&(this._expandCollapseState=[])}this.model.showAppointmentNavigator&&this._nextPrevButton();this.model.blockoutSettings.enable&&this._renderBlockAppointments();this._navView=!1},_renderHeaderDays:function(){var e,f,o,c,r,s,i,h,u;if(this.dateRender=[],e=n.extend(!0,[],this._getRenderDates()),this.res1=t.isNullOrUndefined(this.model.group)?[0]:this.res1,!this._resWorkWeek&&!this._resCustomView)for(i=0;i<this.res1.length;i++)for(f=0;f<e.length;f++)this.dateRender.push(new Date(e[f]));if(this.model.showHeaderBar&&this.element.find("div.e-datedisplay").html(this._getCurrentDateHeaderValue()),this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate),this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate),this.model.orientation=="vertical"&&this._customOrientation=="vertical")if(this.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),this.currentView()==="month"||this._isCustomMonthView())this._renderMonthTimeCells();else{if(t.isNullOrUndefined(this.model.dateHeaderTemplateId))for(i=0;i<this.dateRender.length;i++)o=this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this.dateRender[i]).getDay()]:this._dayShortNames[new Date(this.dateRender[i]).getDay()]:this._dayShortNames[new Date(this.dateRender[i]).getDay()],c=this.currentView()==="day"?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?t.format(new Date(this.dateRender[i]),this._pattern.D,this.model.locale):o+" "+new Date(this.dateRender[i]).getDate():o+" "+new Date(this.dateRender[i]).getDate(),this.element.find(".e-headerdaydisplay").eq(i).html(c),new Date(new Date(this.dateRender[i]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&this.element.find("td.e-headercells").eq(i).addClass("e-currentdayhighlight");else{if(r=[],s=this._getUserDateheaderTemplate(),this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)for(i=0;i<this.res1.length;i++)r=n.merge(r,s);else r=n.merge(r,s);for(i=0;i<this.dateRender.length;i++)this.element.find(".e-headerdaydisplay").eq(i).html(r[i].currentDay),new Date(new Date(this.dateRender[i]).setHours(0,0,0,0)).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&this.element.find("td.e-headercells").eq(i).addClass("e-currentdayhighlight")}if(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),!t.isNullOrUndefined(this.model.allDayCellsTemplateId)&&this.model.timeScale.enable){for(h=this._getUserAllDayCellsTemplate(),u=0;u<h.length;u++)this.element.find(".e-alldaycells").eq(u).html(h[u]);this.element.find(".e-leftindent").height(this.element.find(".e-alldaycells").height())}this.element.find(".e-headercells").addClass("e-dateheaderselect")}else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&this._renderHorizontalHeaderDays(this._culture)},_renderMonthTimeCells:function(){var l=0,u=this._dateRender,s=0,r=this.model.showWeekend?7:this.model.workWeek.length,f=t.isNullOrUndefined(this.model.group)?r:this.res1.length*r,a=this._tempResource.length!=0&&t.scheduleFeatures.resources?!0:!1,v,e,n,i,y,h,c,o;for(f=a?this._isCustomMonthView()&&this._oneWeek?this.res1.length*this._dateRender.length:this.res1.length*r:t.isNullOrUndefined(this.model.group)?r:this._isCustomMonthView()&&this._oneWeek?this.res1.length*this._dateRender.length:this.res1.length*7,v=a&&this._isCustomMonthView()&&this._oneWeek?!0:!1,e=this.element.find("div.e-monthheader"),n=0;n<u.length;n++){for(i=s;i<f;i=v?i+this._dateRender.length:i+r)y=new Date(this._dateRender[n]).getDate()==1?t.format(new Date(this._dateRender[n]),"MMM",this.model.locale)+" "+new Date(this._dateRender[n]).getDate():t.format(new Date(this._dateRender[n]),"dd",this.model.locale),e.eq(i).html(y),this.currentView()!=="customview"&&(new Date(u[n]).getMonth()!==new Date(this.currentDate()).getMonth()?this.model.showNextPrevMonth?e.eq(i).addClass("e-monthdateshighlight").closest(".e-monthcells").removeClass("e-othermonths").children().show():e.eq(i).addClass("e-monthdateshighlight").closest(".e-monthcells").addClass("e-othermonths").children().hide():e.eq(i).removeClass("e-monthdateshighlight").closest(".e-monthcells").removeClass("e-othermonths").children().show()),new Date(u[n]).getTime()==new Date((new Date).setHours(0,0,0,0)).getTime()&&(this.element.find("td.e-monthcells").eq(i).hasClass("e-othermonths")||this.element.find("td.e-monthcells").eq(i).addClass("e-currentdayhighlight"));s++;(n+1)%r==0&&(s=f,f=f+(t.isNullOrUndefined(this.model.group)?1:this.res1.length)*r,this.model.showNextPrevMonth||this.currentView()=="customview"?(h=t.format(new Date(u[n-(r-1)]),"MMM dd",this.model.locale),c=t.format(new Date(u[n]),"MMM dd",this.model.locale)):(o=new Date(this.currentDate()),h=n==r-1?t.format(new Date(o.getFullYear(),o.getMonth(),1),"MMM dd",this.model.locale):t.format(new Date(u[n-(r-1)]),"MMM dd",this.model.locale),c=n==u.length-1?t.format(new Date(o.getFullYear(),o.getMonth()+1,0),"MMM dd",this.model.locale):t.format(new Date(u[n]),"MMM dd",this.model.locale)),this.model.timeScale.enable&&this.element.find(".e-timecelldivs").eq(l).html(h+" - "+c),l++)}this.model.showNextPrevMonth||this.currentView()!="month"||this._refreshOtherMonthsBorder();this.element.find(".e-timecells").addClass("e-dateheaderselect");this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length))},_refreshOtherMonthsBorder:function(){for(var i,e,n,r=this.model.enableRTL?"e-borderright":"e-borderleft",u=this.element.find(".e-workcellstab tr").first().find(".e-othermonths").length,f=u/this.res1.length,t=f;t<u;t=t+f)this.element.find(".e-workcellstab tr").first().find(".e-othermonths").eq(t).addClass(r);for(i=this.element.find(".e-workcellstab tr").last().find(".e-othermonths").length,e=i/this.res1.length,n=0;n<i;n=n+e)this.element.find(".e-workcellstab tr").last().find(".e-othermonths").eq(n).addClass(r)},_nextPrevDate:function(n){var r,t=new Date(new Date(this.currentDate()).setHours(0,0,0,0)),i=this.currentView()==="day"||this.currentView()==="agenda"?1:this.currentView()==="customview"?this._dateRender.length:7,u,f,e;return this.currentView()==="month"?(u=n=="navigateprevious"?new Date(t.getFullYear(),t.getMonth()-1,t.getDate()):new Date(t.getFullYear(),t.getMonth()+1,t.getDate()),f=n=="navigateprevious"?new Date(t.getFullYear(),t.getMonth()-1,1):new Date(t.getFullYear(),t.getMonth()+1,
101),r=u.getMonth()==f.getMonth()?new Date(u):new Date(f._currentMonthDates().end)):this.currentView()==="customview"?(this._daterend=this._dateRender,this._dateNavigation=!0,t=this.model.showWeekend?new Date(this._dateRender[0]):new Date(this._renderStart),i=this.model.showWeekend?i:this._isCustomMonthView()?this._numDays:this._renderDays,r=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i)):this.currentView()!="day"&&this.currentView()!=="agenda"||this.model.showWeekend?(t=new Date(""+t),r=n=="navigateprevious"?new Date(t.setDate(t.getDate()-i)):new Date(t.setDate(t.getDate()+i))):(e=n=="navigateprevious"?new Date(t.getTime()-864e5):new Date(t.getTime()+864e5),i=this._getPrevNextDateCount(e,n=="navigateprevious"?"previous":"next")+1,t=n=="navigateprevious"?new Date(t.getTime()-864e5*i):new Date(t.getTime()+864e5*i),r=new Date(t)),new Date(r.getFullYear(),r.getMonth(),r.getDate())},_navigateClick:function(i,r){var u;this._viewchange=!0;var f=r,o=new Date(this.currentDate()),e={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:i};if(this._trigger("actionBegin",{data:e,requestType:"dateNavigate"}))return!1;if(t.isNullOrUndefined(i)||t.isNullOrUndefined(i.value)||(this._keyPressed=!0,this.currentDate(t.parseDate(i.value,this._pattern.d))),i!=null&&!this._setCurrentDate){if(n(i.currentTarget).hasClass("e-disable"))return!1;n(i.currentTarget).hasClass("e-navigateprevious")?(this._keyPressed=!0,this.currentDate(this._nextPrevDate("navigateprevious")),this.element.find(".e-navigateprevious").attr("tabIndex",0).focus(),f="Previous"):n(i.currentTarget).hasClass("e-navigatenext")&&(this._keyPressed=!0,this.currentDate(this._nextPrevDate("navigatenext")),this.element.find(".e-navigatenext").attr("tabIndex",0).focus(),f="Next")}if(i!=null&&(n(i.currentTarget).hasClass("e-navigateprevious")||n(i.currentTarget).hasClass("e-navigatenext")||i.type=="select")&&(e={previousDate:o,currentDate:new Date(this.currentDate()),currentView:this.currentView(),target:i,requestType:"dateNavigate"}),this._trigger("navigation",e))return this.currentDate(new Date(o)),!1;this.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell");this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");this.element.find(".e-appsoverflow").remove();this.element.find(".e-monthcells").removeClass("e-monthcurrenttime");this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));t.isNullOrUndefined(this._scheduleDrawer)||this._scheduleDrawer.ejNavigationDrawer("close");this.currentView()!=="month"&&this.currentView()!=="agenda"&&!this._isCustomMonthView()&&(this.currentView()!=="customview"||this.model.showWeekend)&&(this.currentView()!=="customview"||this.model.orientation!=="horizontal")&&this.model.timeScale.enable&&t.isNullOrUndefined(this.model.workCellsTemplateId)?(this._renderHeaderDays(),t.isNullOrUndefined(this.model.queryCellInfo)||(this._renderQueryCellInfo("renderHeaderAllDayTemplate"),this._renderQueryCellInfo("renderContentAreaTemplate"),this._renderQueryCellInfo("emptycell")),this.model.showOverflowButton||this.model.orientation!="horizontal"&&this._customOrientation!="horizontal"||(this._horizontalRender(),this._reRenderScroller()),t.isNullOrUndefined(this.dataSource())||(this.model.enableLoadOnDemand?this._bindAppointmentsData(f):(this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll())),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this._dragWeek||this._businessHourScroller(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.blockoutSettings.enable&&this._renderBlockAppointments()):this._renderCurrentView(f);this._validateMinMaxDate();!t.isNullOrUndefined(this.oldDate)&&this.oldDate!=""&&this._setCurrentDate&&(this.currentDate(new Date(this.oldDate)),this.oldDate="");this._setCurrentDate=!1;this._mediaQuery&&!t.isNullOrUndefined(i)&&(u=n(i.currentTarget).hasClass("e-navigateprevious")?this.element.width():n(i.currentTarget).hasClass("e-navigatenext")||i.type=="select"?-this.element.width():0,this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll,.e-emptyscrolltd").toggle(),this.model.enableRTL?this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginRight:-u,marginLeft:u}).toggle().animate({marginLeft:0,marginRight:0},500,this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.element.find(".e-vscroll").length==1?n.proxy(this._animateScroll,this):""):this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginLeft:-u,marginRight:u}).toggle().animate({marginLeft:0,marginRight:0},500,this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.element.find(".e-vscroll").length==1?n.proxy(this._animateScroll,this):""));this._trigger("actionComplete",{data:e,requestType:"dateNavigate"})},_animateScroll:function(){this.element.find(".e-emptyscrolltd").toggle();this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-vscroll").css({marginRight:0,marginLeft:0});(this._browserInfo.name=="webkit"||this._browserInfo.name=="msie")&&(highScrol=this.element.find(".e-businesshighlightworkcells").length!=0?this.element.find(".e-businesshighlightworkcells").first().parent()[0].rowIndex*n(".e-workcells").height():0,n("#"+this._id+"_scroller").ejScroller({scrollTop:highScrol+1}),this.element.find(".e-scrolltimecells").css("top",-(highScrol+1)+"px"))},_validateMinMaxDate:function(){this.element.find(".e-navigateprevious,.e-navigatenext").removeClass("e-disable");var u=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this._dateRender,i=new Date(u[0]),r=new Date(u[u.length-1]);this.currentView()=="workweek"&&(i=new Date(i.setDate(i.getDate()-1)),r=new Date(r.setDate(r.getDate()+1)));i<=this.model.minDate?this.element.find(".e-navigateprevious").addClass("e-disable"):this.element.find(".e-navigateprevious").removeClass("e-disable");r>=this.model.maxDate?this.element.find(".e-navigatenext").addClass("e-disable"):this.element.find(".e-navigatenext").removeClass("e-disable");(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"&&this.element.find(".e-navigateprevious,.e-navigatenext").hide()},_onScheduleResize:function(){var s,u,l,a,v,h,y,o,r,i,f,e,c;if(t.isNullOrUndefined(this._scheduleDrawer)||(t.isNullOrUndefined(this._scheduleDrawer.data("ejNavigationDrawer"))?(n(this._scheduleDrawer).remove(),this._scheduleDrawer=null):this._scheduleDrawer.ejNavigationDrawer("close")),this._mediaQuery&&t.isMobile()){if(t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("refresh"),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("refresh"),window.orientation==this._screenOrientation)return!1;this._screenOrientation=window.orientation}if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),e=this._mediaQuery,s=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:(document.documentElement.clientWidth+(s?17:0)<361||t.isMobile())&&this.model.isResponsive,this._mediaQuery?this.element.addClass("e-scheduleresponsive"):this.element.removeClass("e-scheduleresponsive"),u=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),this.currentView()!="agenda"){if(l=u.isVScroll()?this.element.find("div#"+this._id+"_scroller").find(".e-vscroll").width():0,this.element.find(".e-nextapp").css("left",this.element.width()-l-90+"px"),this.model.enableRTL&&this.element.find(".e-nextapp").css("left","-45px"),this.model.enableRTL&&this.element.find(".e-prevapp").css("left",this.element.width()-this.element.find(".e-scrolltimecells").width()-89+"px"),this.model.orientation!="horizontal"&&this._customOrientation!="horizontal"||t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||(this.element.find(".resemptytd").width(this.element.find(".e-horizontalrestd").width()<100?5:this.element.find(".e-horizontalrestd").width()>=100&&this.element.find(".e-horizontalrestd").width()<=150?10:25),this.element.find(".e-horizontalresheader").width(this._mediaQuery?"50px":"100%"),this.element.find(".e-parentnodecategory").width(this._mediaQuery?"12px":"20px")),a=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?(s&&this._mediaQuery?this.element.outerWidth()+17:this.element.outerWidth())-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width(),u.model.width=parseInt(a)-2,u.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),u.refresh(),this.model.orientation=="vertical"&&this._customOrientation=="vertical")this._renderHoriVerticalScroll(),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),this.element.find(".e-headrealldaytable").css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-upicon, .e-downicon").children().width(this.element.find(".e-workcells").width()),this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css("margin-left","0px"),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px");else if(!this._isCustomMonthView()||this.currentView()!="month"||this.currentView()!="day"||!this.model.enableRTL||this.model.timeScale.enable){for(this.element.find(".e-headeralldaydiv").width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-horizontalt
10imecells").find("table tr").eq(2).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),v=this.element.find(".e-horizontalalternatetd, .e-horizontaltimetd").children(),h=0,i=0;i<v.length;i++)this.element.find(".e-workcells").eq(i).width(this.element.find(".e-horizontalalternatetd, .e-horizontaltimetd").eq(i).width()),h=h+this.element.find(".e-workcells").eq(i).width();this.model.timeScale.enable?this.element.find(".e-workcellstab").width(this.element.find(".e-horizontaltabletimecell").width()):this.element.find(".e-workcellstab").css("width",this.element.find(".e-headerdays table").width());this._horizontalRender();this.model.showOverflowButton||this._renderAppointmentAll()}this.currentView()=="month"||this._isCustomMonthView()||this.model.orientation!="vertical"||this._customOrientation!="vertical"?(this._isCustomMonthView()||this.currentView()=="month"||this.currentView()=="day"||this.model.enableRTL||!this.model.timeScale.enable)&&(this._renderCurrentView("ScheduleResize"),this.model.timeScale.enable?(this.element.find(".e-workcells").width(this.element.find(".e-horizontaltimetd").width()),this.element.find(".e-workcellstab").width(this.element.find(".e-horizontaltabletimecell").width())):this.element.find(".e-workcellstab").css("width",this.element.find(".e-headerdays table").width())):this.model.enableRTL&&(this.model.cellWidth||this.model.cellHeight)?this._renderCurrentView("ScheduleResize"):(this.model.showAllDayRow&&this.model.timeScale.enable&&this.element.find("div.e-alldayappointment").remove()&&this._renderAllDayAppointments(),this.model.timeScale.enable||(this.element.find("div.e-monthappointment").remove(),this._currentViewAppointments=this.getCurrentViewAppointments(),this._renderMonthAppointment()),this._bindAppointmentAction());this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();this._highlightCurrentTime(this.model.showCurrentTimeIndicator)}else u.model.width=parseInt(this.element.width())-2,u.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),u.refresh(),y=n("div#"+this._id+"_scroller"),this.element.find(".e-headeralldaydiv").width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),y.ejScroller("isVScroll")?this.element.find(".e-emptyscrolltd").show()&&this.element.find(".e-draggableworkarea").height(this.element.find(".e-draggableworkarea").height()+1):this.element.find(".e-emptyscrolltd").hide();if((this._mediaQuery||this.element.width()<600)&&!n("#"+this._id+"navDrawer").hasClass("e-scheduledrawer")&&this._renderNavigationDrawer(),o=this._mediaQuery==e?!1:!0,!o&&(this.element.width()<600&&this.hTR.find(".e-mobileNavigation").length<1||this.element.width()>600&&this.hTR.find("table.e-viewstable").length<1)&&(this._reRenderHeaderBar(),this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this))),o){if(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")for(r=this._dateRender,i=0;i<r.length;i++)f=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?this._dayNames[new Date(r[i]).getDay()].split("")[0]:this.currentView()==="day"?t.isNullOrUndefined(this._tempResource)&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(r[i]).getDay()]:this._dayShortNames[new Date(r[i]).getDay()]:this._dayShortNames[new Date(r[i]).getDay()],e=this._mediaQuery&&(this.currentView()=="week"||this.currentView()=="workweek")?f+parseInt(t.format(new Date(r[i]),"dd",this.model.locale)):this.currentView()==="day"?t.isNullOrUndefined(this._tempResource)&&t.isNullOrUndefined(this.model.group)?f+" "+t.format(new Date(r[i]),"dd MMMM yyyy",this.model.locale):f+" "+t.format(new Date(r[i]),"dd MMM yy",this.model.locale):f+" "+new Date(r[i]).getDate(),this.element.find(".e-headerdaydisplay,.e-horizontalheaderdiv").length!=0&&(this.element.find(".e-headerdaydisplay,.e-horizontalheaderdiv")[i].innerHTML=e);this.model.showAppointmentNavigator=o&&!this._mediaQuery;this.model.showAppointmentNavigator?this._nextPrevAppointment(this.model.showAppointmentNavigator):this.element.find(".e-prevapp,.e-nextapp").remove();this.model.showHeaderBar&&this._reRenderHeaderBar();this.element.find(".e-leftindenttable").width(this.element.find(".e-workleftindent").width());this.currentView()!="agenda"&&this.element.find(".e-ampmdisplay").outerHeight(this.element.find(".e-workcells, .e-monthcells")[0].offsetHeight);this._businessHourScroller();this.model.showQuickWindow=this._mediaQuery?!1:this._quickWindow;this._mediaQuery&&(this.model.allowInline=!1);t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow();this._refreshAppointmentWindow();t.isNullOrUndefined(this._alertWindow)||this._alertWindow.ejDialog("close");t.isNullOrUndefined(this._recurEditWindow)||(this._recurEditWindow.ejDialog("close"),this._recurEditWindow.ejDialog({width:this._mediaQuery?"90%":360}));this._mediaQuery&&this._phoneChanges();this._renderAppointmentAll();this.model.blockoutSettings.enable&&this._renderBlockAppointments();this._mediaQuery?(this._off(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells,td.e-alldaycells"),this._off(this.element,"keydown click","td.e-workcells,td.e-monthcells,td.e-alldaycells"),this._on(this.element,"click","#"+this._id+"navDrawerIcon",n.proxy(this._drawerOpen,this))):(this._on(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells,td.e-alldaycells",n.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells,td.e-alldaycells",n.proxy(this._shiftSelection,this)),this.element.width()>600&&this._off(this.element,"click","#"+this._id+"navDrawerIcon"));this._mediaQuery||t.isTouchDevice()?this._on(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab",n.proxy(this._touchSchedule,this)):this._off(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab");this._on(this.element,t.isMobile()?"click":"dblclick",".e-workcells,.e-alldaycells,.e-alldayappointment,.e-monthcells",n.proxy(this._appointmentWindow,this));this._mediaQuery||t.isMobile()?this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this)):this._off(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment");c=n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper");this._mediaQuery?c.addClass("e-scheduleresponsive"):c.removeClass("e-scheduleresponsive");this._mediaQuery&&this.res1.length>1&&this.element.addClass("e-resources")}(this._mediaQuery||this.element.width()<600)&&this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"&&(this._addMonthNameRow(),this.element.find(".e-datecommondiv").addClass("e-datecursor"),this.element.find(".e-navigateprevious,.e-navigatenext").hide());this._trigger("actionComplete",{requestType:"scheduleResize"})}
10,_reRenderHeaderBar:function(){var t=this.element.find(".e-scheduleheader");t.empty();this._renderHeaderBar(t);this.element.find("#"+this._id+"_navigator").ejDatePicker({enableRTL:this.model.enableRTL,buttonText:this._getLocalizedLabels("Today"),select:n.proxy(this._onselect,this),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate});this.element.find(".e-datecommondiv").find(".e-datewidget").css("display","none");this.element.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview")},_renderTemplates:function(){this.workcellTemp=n.templates(l());this.addResWorkcellTemp=n.templates(a());this.addResMonthcellTemp=n.templates(v());this.monthcellTemp=n.templates(r());this.timeCellTemplate=n.templates(y());this.userTimeCellTemplate=n.templates(p());this.headTemplate=n.templates(s());this.alldayTemp=n.templates(c());this.leftIndent=n.templates(h());this.agendaheadTemplate=n.templates(w());this.agendacellTemp=n.templates(b());this.appTemplate=n.templates(u());this.inlineTemplate=n.templates(f());this.blockTimeTemplate=n.templates(e());t.scheduleFeatures.horizontal&&this._renderHorizontalTemplates();t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._renderResourcesTemplate();!t.isNullOrUndefined(this.model.categorizeSettings)&&this.model.categorizeSettings.enable&&(this._renderCategorizeTemplate(),this._categorizeMultipleTemplate=n.templates(o()))},_setNewStartEndHours:function(){this.currentView()==="month"||this._isCustomMonthView()||((this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this.aTR.children().remove(),this._renderHeaderAllDayTemplate()),this.wTR.children().remove(),this._renderContentAreaTemplate(),this._borderAddRemove(),this._renderScroller(),(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this._horizontalRender(),this.element.find(".e-ampmdisplay").outerHeight(this.element.find(".e-workcells")[0].offsetHeight),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").addClass("e-businesshighlightworkcells"),this._businessHourScroller(),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this._renderAppointmentAll(),this.model.blockoutSettings.enable&&(this.model.blockoutSettings.dataSource instanceof t.DataManager?this._bindBlockData():this._renderBlockAppointments()))},_renderInitSchedule:function(){var f,i,r,u;this.element.addClass("e-scheduleouter");this._screenOrientation=window.orientation;this._quickWindow=this.model.showQuickWindow;this._customOrientation=this.model.orientation;f=typeof innerWidth=="number"&&window.innerWidth>document.documentElement.clientWidth;this._mediaQuery=this._browserInfo.name=="msie"&&parseInt(this._browserInfo.version,10)<=8?!1:(document.documentElement.clientWidth+(f?17:0)<361||t.isMobile())&&this.model.isResponsive;this._mediaQuery?this.element.addClass("e-scheduleresponsive"):this.element.removeClass("e-scheduleresponsive");this._mediaQuery&&(this.model.showQuickWindow=!1);this._mediaQuery&&(this.model.allowInline=!1);t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.group.allowGroupEditing)||!this.model.group.allowGroupEditing||t.isNullOrUndefined(this._appointmentSettings.resourceFields)||!this.model.resources[this.model.resources.length-1].allowMultiple||(this._groupEditing=!0);t.isNullOrUndefined(this._clientWidth)&&(this._clientWidth=this.model.width);this.currentView(this.currentView().toLowerCase());this.model.views=this.model.views.length==0?this.currentView().toString().toLowerCase().split(","):this.model.views.toString().toLowerCase().split(",");this.model.workWeek=this.model.workWeek==""||this.model.workWeek==null?this._dayNamesArray:this.model.workWeek;this._resWorkWeek=this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showWeekend&&this.currentView()=="workweek"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.workWeek);this._resCustomView=this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showWeekend&&this.currentView()=="customview"&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.renderDates);this.model.endHour>24&&(this.model.endHour=24);this.model.startHour<0&&(this.model.startHour=0);i=t.preferredCulture(this.model.locale);r=!t.isNullOrUndefined(this.model.timeMode)&&(this.model.timeMode=="Hour12"||this.model.timeMode=="Hour24")?this.model.timeMode.replace("Hour",""):this.model.timeMode;this._timeMode=r==null?i.calendar.AM==null&&i.calendar.PM==null?"24":"12":i.calendar.AM==null&&i.calendar.PM==null?"24":r;i.calendar.patterns.T.split(/\s+/).length==1&&i.calendar.AM!=null&&i.calendar.PM!=null&&(this._timeMode="24");r==null?this._pattern=i.calendar.patterns:this._pattern.t=this._timeMode=="12"?"h:mm tt":"HH:mm";this._firstdayofweek=this.model.firstDayOfWeek!=null?typeof this.model.firstDayOfWeek=="string"?this._dayNamesArray.indexOf(this.model.firstDayOfWeek.toString().toLowerCase()):this.model.firstDayOfWeek:i.calendar.firstDay;this.model.workWeek=this.model.workWeek.toString().toLowerCase().split(",");this.model.width=this.model.width?this.element.width(this._clientWidth).width():this.element.width();this.model.height=this.model.height?this.element.height(this.model.height).height():this.element.height();this.scWidth=this._scWidth?parseInt(this._scWidth):parseInt(this.model.width);this.scHeight=this._scHeight?parseInt(this._scHeight):parseInt(this.model.height);this.currentDate()<this.model.minDate&&this.currentDate(this.model.minDate);this.currentDate()>this.model.maxDate&&this.currentDate(this.model.maxDate);this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())==-1&&this.currentView(this.model.views[0].toLowerCase());this._getRenderDates();this.element.css({width:this._clientWidth,height:this.model.height}).attr({role:"presentation",tabIndex:1});var o=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?"e-vertical":"e-horizontal",e=t.buildTag("div.e-scheduleinner "+o,"",{},{}).css({height:this.scHeight-2+"px",position:"relative"}),s=t.buildTag("table.e-table","",{},{}).addClass("e-scheduleoutertable"),h=t.buildTag("tbody");this.hTR=t.buildTag("tr.e-scheduleheader");this.aTR=t.buildTag("tr.e-headerarearow");this.wTR=t.buildTag("tr.e-contentarearow");this.model.cellHeight?this.wTR.removeClass("e-celldefaultheight"):this.wTR.addClass("e-celldefaultheight");this._renderTemplates();this.model.showHeaderBar&&this._renderHeaderBar(this.hTR);this._renderHeaderAllDayTemplate();this._renderContentAreaTemplate();e.append(s.append(h.append(this.hTR).append(this.aTR).append(this.wTR)));this._mediaQuery&&this.res1.length>1&&this.element.addClass("e-resources");this._renderToolTip();this.element.append(e);this.model.showHeaderBar||this.element.find(".e-scheduleheader").hide();this.model.showHeaderBar&&(this.hTR.find(".e-commonviewbutton.e-"+this.currentView()).addClass("e-activeview"),this.element.find("#"+this._id+"_navigator").ejDatePicker({startDay:this._firstdayofweek,enableRTL:this.model.enableRTL,buttonText:this._getLocalizedLabels("Today"),select:n.proxy(this._onselect,this),locale:this.model.locale,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate}
10),this.element.find("span.e-datewidget").css("display","none"));(this._mediaQuery||this.element.width()<600)&&this._renderNavigationDrawer();this._showContextMenu(this.model.contextMenuSettings.enable);u=n("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper");this._mediaQuery?u.addClass("e-scheduleresponsive"):u.removeClass("e-scheduleresponsive");this._mediaQuery&&this._phoneChanges();this.model.enableRTL&&this._browserInfo.name=="webkit"&&!t.isNullOrUndefined(this._appointmentAddWindow)&&this._appointmentAddWindow.find(".e-chk-image").css("margin-right","-13px");this._renderCommon()},_addMonthNameRow:function(){var i=n.extend(!0,[],this._dateRender),s,h,u,e,t,o,a;if(i.sort(),new Date(i[0]).getMonth()!=new Date(i[i.length-1]).getMonth()||new Date(i[0]).getFullYear()!=new Date(i[i.length-1]).getFullYear()){if(s=new Date(i[0]).getFullYear()==new Date(i[i.length-1]).getFullYear(),h=n.grep(n(".e-monthnamerow"),function(t){if(n(t).hasClass("e-monthnamerow"))return t}),h.length!=0&&n(".e-monthnamerow").remove(),u="<tr class='e-monthnamerow'>",this._resCustomView)for(e=0;e<Object.keys(this._resCustomDate).length;e++){var c=this._resCustomDate[e],l=c.map(function(n){return new Date(n).getMonth()+","+new Date(n).getFullYear()}),r=n.unique(c.map(function(n){return new Date(n).getMonth()+","+new Date(n).getFullYear()})),f={};for(l.forEach(function(n){f[n]=(f[n]||0)+1}),t=0,o=r.length;t<o;t++)u+="<td class='e-monthrow e-monthnamecells' colspan='"+f[r[t]]+"'><div class='e-monthnameheadertext'>"+(s?this._monthNames[r[t].split(",")[0]]:this._monthNames[r[t].split(",")[0]]+" "+r[t].split(",")[1])+"<\/div><\/td>"}else{var l=i.map(function(n){return new Date(n).getMonth()+","+new Date(n).getFullYear()}),r=n.unique(i.map(function(n){return new Date(n).getMonth()+","+new Date(n).getFullYear()})),f={};for(l.forEach(function(n){f[n]=(f[n]||0)+1}),t=0,o=r.length;t<o;t++)u+="<td class='e-monthrow e-monthnamecells' colspan='"+f[r[t]]+"'><div class='e-monthnameheadertext'>"+(s?this._monthNames[r[t].split(",")[0]]:this._monthNames[r[t].split(",")[0]]+" "+r[t].split(",")[1])+"<\/div><\/td>"}u+="<\/tr>";(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&i.length>7?(n(u).insertBefore(this.element.find(".e-headerdays").find("tr:first")),this.element.find(".e-horizontalmonthtimecellsht").addClass("e-monthheaderrow"),this.element.find(".e-horizontaltimecellsht").length>0&&this.element.find(".e-horizontaltimecellsht").addClass("e-monthheaderrow")):(n(u).insertBefore(this.element.find(".e-dateheader")),this.element.find(".e-headrealldaytable").addClass("e-monthheaderrow"),this.element.find(".e-headercellsheight").addClass("e-monthheaderrow"));this.element.find(".e-monthnameleftindentcell").length==0&&(a="<tr><td class='e-monthnameleftindentcell e-headercellsheight'><div><\/div><\/td><\/tr>",n(a).insertBefore(this.element.find(".e-settingsindent").parent()));this.model.enableRTL?this.element.find(".e-monthnamerow td:first-child").css("border-right","none"):this.element.find(".e-monthnamerow td:first-child").css("border-left","none")}},_renderToolTip:function(){var i=this,r;t.isNullOrUndefined(this.element.data("ejTooltip"))&&(r=this.model.tooltipSettings.enable?".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendacells.e-eventcolumn,.e-appup,.e-appdown,.e-appsoverflow":".e-appup,.e-appdown,.e-appsoverflow",this.element.ejTooltip({target:r,associate:"mousefollow",isBalloon:!1,beforeOpen:function(n){i._showToolTip(n)?i._openTooltip=!0:(n.cancel=!0,i._openTooltip=!1)},containment:"#"+this._id,tip:{adjust:{xValue:20,yValue:20}},position:{target:{horizontal:"center",vertical:"bottom"},stem:{horizontal:"left",vertical:"top"}},tracking:function(t){(!i._openTooltip||n(t.event.target).is(".e-tophandle,.e-bottomhandle,.e-schedulemouseclose,.e-righthandle,.e-lefthandle,.e-schedulerepeat,.e-editapp,.e-deleteapp"))&&(t.cancel=!0,this.hide())}}))},_renderQuickWindow:function(){this.model.showQuickWindow&&(this._renderQuickAppWindow(),this._renderQuickAppDetailsView())},_renderDialogs:function(){this._renderQuickWindow();this._renderAppointmentWindow();this._renderRecurrenceEditor();this._renderRecurEditWindow();this._renderAlertWindow()},_renderCommon:function(){if(this.currentView()!="agenda"){if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&(this._headerbarWidth(),(this.currentView()==="month"||this._isCustomMonthView())&&this._renderMonthTimeCells(),this.model.timeScale.enable||(this.element.find(".e-headercells").first("td").css("border-left","none"),this.element.find(".e-workcellstab tr td:first-child").css("border-left","none")),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),this.element.find(".e-ampmdisplay").length>0&&this.element.find(".e-ampmdisplay").css({outerHeight:this.element.find(".e-workcells")[0].offsetHeight})),this.currentView()!="agenda"&&(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0){var i=this.model.enableRTL?"border-right":"border-left";this.element.find(".e-horizontaldaterender").css(i,"0px");this.wTR.find(".e-workareadiv").parent().css(i,"0px");this.model.timeScale.enable||this.currentView()==="month"||this._isCustomMonthView()||this.element.find(".e-workcellstab tr td:nth-child(1)").css(i,"0px")}this.model.enableRTL&&this.element.addClass("e-rtl");this.model.timeScale.enable&&this._borderAddRemove();this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.currentView()!=="month"&&!this._isCustomMonthView()?this.element.find(".e-headercells").addClass("e-dateheaderselect"):"":this.element.find(".e-headercells").addClass("e-dateheaderselect");(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this.currentView()=="month"||this._isCustomMonthView())&&this.element.find(".e-workcells").width()<this.element.find(".e-dateheadercell").width()&&this.model.cellWidth==""&&(this.model.timeScale.enable?this.element.find(".e-workcells").css({width:this.element.find(".e-horizontmonthheaderdaytd").width()}):this.element.find(".e-headerdays table tr td:nth-child(1)").css({width:this.element.find(".e-horizontmonthheaderdaytd").width()+1}));this.model.orientation!="horizontal"&&this._customOrientation!="horizontal"||this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()||this.model.cellWidth!=""||this.element.find(".e-horizontmonthheaderdatetd,.e-horizontmonthheaderdaytd").width(this.element.find(".e-workcells").width());this.element.find(".e-horizontalresheader").css({width:this._mediaQuery?"50px":"100%"});(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"&&(this._addMonthNameRow(),this.element.find(".e-datecommondiv").addClass("e-datecursor"));this._renderScroller();this.model.showAppointmentNavigator&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon();this.model.orientation=="horizontal"||this._customOrientation=="horizontal"?this._horizontalRender():this.model.showOverflowButton||this.currentView()!="month"?this.currentView()=="month"||this._isCustomMonthView()?(this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length)),this.element.find(".e-timecells").width(this.element.find(".e-timecells").width()+1)):this.model.timeScale.enable&&this.element.find(".e-ampmdisplay").outerHeight(this.model.timeScale.minorSlotCount==1?this.element.find(".e-timecelldivs")[0].offsetHeight:this.element.find(".e-workcells")[0].offsetHeight):this._monthCellsRender();(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal?(this.model.timeScale.enable||this.element.find(".e-headercells").removeClass("e-dateheaderselect"),t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0||this._horizontalResIcon(),!this.model.timeScale.enable||t.isNullOrUndefined(this.model.dateHeaderTemplateId)||this.currentView()=="month"||this._isCustomMonthView()||this.element.find(".e-headercells").parent().parent().parent().css("width",this.element.width()/10*this._dateRender.length+"px"),this.element.find(".e-parentnodecategory").css({width:this._mediaQuery?"12px":"20px"})):t.isNullOrUndefined(this.model.allDayCellsTemplateId)||this.element.find(".e-leftindent").css({height:this.element.find(".e-alldaycells").height()});this.model.workHours.highlight&&this.model.highlightBusinessHours?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");this.model.timeScale.enable&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&(this.currentView()=="month"||this._isCustomMonthView())&&((!this._resWorkWeek&&this._dateRender.length>60||n.isNumeric(this.element.find(".e-monthcells")[0].offsetHeight)&&this.element.find(".e-monthcells")[0].offsetHeight!=this.element.find(".e-timecells")[0].offsetHeight&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showOverflowButton)&&this.element.find("td.e-timecells .e-timecelldivs").addClass("e-timedivcells"),(!this._resCustomView&&this._dateRender.length>60||n.isNumeric(this.element.find(".e-monthcells")[0].offsetHeight)&&this.element.find(".e-monthcells")[0].offsetHeight!=this.element.find(".e-timecells")[0].offsetHeight&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showOverflowButton)&&this.element.find("td.e-timecells .e-timecelldivs").addClass("e-timedivcells"));this.model.orientation==t.Schedule.Orientation.Vertical&&this._customOrientation=="vertical"&&this._isCustomMonthView()&&this.model.timeScale.enable&&this.element.find(".e-timecelldivs")[0].offsetHeight>=this.element.find(".e-timecelldivs").parent()[0].offsetHeight&&this.element.find(".e-timecelldivs").addClass("e-timedivcells");(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this._safariBrowser&&this.element.find(".e-workcells.e-dayend").width(this.element.find(".e-workcells.e-dayend").outerWidth()+1);this._browserInfo.name=="msie"&&this._browserInfo.version<9&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&(this.element.find(".e-workleftindent").find("tr").last().find("td").addClass("e-lastcell"),this.element.find(".e-workcellstab").find("tr").last().find("td").addClass("e-lastcell"))}this._highlightCurrentTime(this.model.showCurrentTimeIndicator);
10this._validateMinMaxDate();t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("emptycell");this._businessHourScroller()},_resourceSegregate:function(){var u="",i,r;if(this._tempResource=[],this._grouping=[],t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources))t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources)&&n.merge(this._tempResource,this.model.resources);else{for(i=0;i<this.model.group.resources.length;i++)if(r=this._findResourceIndex(this.model.resources,"name",this.model.group.resources[i],null,null),!t.isNullOrUndefined(r))if(this.model.resources.length!=0&&this.model.resources[r].resourceSettings.dataSource.length!=0)this._tempResource.push(n.extend(!0,[],this.model.resources[r])),this._grouping.push(this.model.group.resources[i]),u=i==this.model.group.resources.length-1?u+this.model.resources[r].field:u+this.model.resources[r].field+",";else return!1;this._appointmentSettings.resourceFields=u}},_borderAddRemove:function(){this.model.enableRTL?(this.element.find(".e-headrealldaytable tr td:first-child,.e-workcellstab tr td:first-child,.e-headerdays table tr td:first-child").css("border-right","none"),this.element.find(".e-horizontalheader,.e-horizontalrestd,.e-monthleftindent,.e-workleftindent,.e-empty").addClass("e-borderleft")):(this.element.find(".e-headrealldaytable tr td:first-child,.e-workcellstab tr td:first-child,.e-headerdays table tr td:first-child").css("border-left","none"),this.element.find(".e-horizontalheader,.e-horizontalrestd,.e-monthleftindent,.e-workleftindent,.e-empty").addClass("e-borderright"));this.model.orientation=="horizontal"||this._customOrientation=="horizontal"?this.currentView()=="month"?this.element.find(".e-headerdays table tr td:first-child").width(this.element.find(".e-workcellstab tr td:first-child").width()):this._browserInfo.name=="webkit"&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-horizontaltimetd").first().width()):this._safariBrowser&&(this.currentView()=="month"?this.element.find(".e-monthleftindent").width(this.element.find(".e-monthempty").width()+1):this.element.find(".e-workleftindent").attr("style","width:"+(this.element.find(".e-empty").width()+1)+"px !important"));t.isNullOrUndefined(this.oldDate)||this.oldDate==""||(this.currentDate(new Date(this.oldDate)),this.oldDate="")},_phoneChanges:function(){t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({allowDraggable:!1,position:{X:"0",Y:"0"}})},_dateConvert:function(i){if(t.isNullOrUndefined(i))r=null;else{var r=new Date(parseInt(i.match(/\d+/).toString()));r=n.type(r)=="date"?r:new Date}return r},_calculateCustomDays:function(){var o,f,i,r;if(n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0){if(this.oldDate=this.currentDate(),n.type(this.model.renderDates[0])=="object"){if(o=this.model.renderDates.length,t.isNullOrUndefined(this._renderDays))for(this._renderDays=0,f=0;f<o;f++)this._renderDays=this._renderDays+Math.round(Math.abs((new Date(t.format(this.model.renderDates[f].end,this._datepattern(),this.model.locale)).getTime()-new Date(t.format(this.model.renderDates[f].start,this._datepattern(),this.model.locale)).getTime())/864e5)+1)}else this._renderDays=this.model.renderDates.length;this._customOrientation=this._renderDays>7?"horizontal":this.model.orientation}else if(i=n.type(this.model.renderDates.start)!="date"?t.parseDate(this.model.renderDates.start,this._datepattern()):new Date(this.model.renderDates.start),i=t.isNullOrUndefined(i)?new Date(this.model.renderDates.start).toString()=="Invalid Date"||new Date(this.model.renderDates.start).toString()=="NaN"?this._dateConvert(this.model.renderDates.start):new Date(this.model.renderDates.start):i,r=n.type(this.model.renderDates.end)!="date"?t.parseDate(this.model.renderDates.end,this._datepattern()):new Date(this.model.renderDates.end),r=t.isNullOrUndefined(r)?new Date(this.model.renderDates.end).toString()=="Invalid Date"||new Date(this.model.renderDates.end).toString()=="NaN"?this._dateConvert(this.model.renderDates.end):new Date(this.model.renderDates.end):r,t.isNullOrUndefined(this.model.minDate)||t.isNullOrUndefined(this.model.maxDate)||(i=this.model.minDate>=i&&this.model.maxDate<=i?i:this.model.minDate>=i&&this.model.maxDate>=i?this.model.minDate:this.model.maxDate<=i?this.model.minDate:i,r=this.model.minDate>=r&&this.model.maxDate<=r?r:this.model.minDate<=r&&this.model.maxDate<=r?this.model.maxDate:this.model.minDate>=r?this.model.maxDate:r),this._renderStart=t.isNullOrUndefined(i)?r:new Date(i.getFullYear(),i.getMonth(),i.getDate()),this._renderEnd=t.isNullOrUndefined(r)?i:new Date(r.getFullYear(),r.getMonth(),r.getDate()),this._renderDays=Math.round((this._renderEnd-this._renderStart)/864e5)+1,this.oldDate=this.currentDate(),this._dateNavigation||this._renderStart.getTime()>this.currentDate().getTime()||this._renderEnd.getTime()<this.currentDate().getTime()?(this._renderStart=new Date(this.currentDate()),this._renderEnd=new Date(this._renderStart.getTime()+864e5*(this._renderDays-1)),this._dateNavigation=!1):this.currentDate(new Date(this._renderStart)),this._renderDays>7){var s=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?new Date(this._firstweekdate(this._renderStart)):new Date(this._renderStart),u=new Date(this._renderEnd),e=u.getDay();this._firstdayofweek==0&&e!=6?u.setDate(new Date(this._renderEnd).getDate()+(6-e)):u.setDate(new Date(this._renderEnd).getDate()+(6-e)+this._firstdayofweek);u=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?u:new Date(this._renderEnd);this._numDays=Math.round((u-s)/864e5)+1}return this},_isCustomMonthView:function(){return this.currentView()=="customview"&&!this._resCustomView?(this._oneWeek=this._dateRender.length>7?!1:!0,!this._oneWeek):!1},_headerbarWidth:function(){if(this.element.children().length==0)return!1;var n=this.currentView()=="workweek"?this.model.workWeek.length:this.currentView()=="day"?1:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:7,i=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.res1.length*n:n,r=this.element.outerWidth()-(this.element.find(".e-draggableworkarea").offset().left-this.element.offset().left)<parseInt(this.model.cellWidth)*i?1:0},_deviceRatio:function(){return t.browserInfo().name=="msie"?screen.deviceXDPI/screen.logicalXDPI:devicePixelRatio},_renderScroller:function(){if(this.element.children().length==0)return!1;var u=this.element.find("div#"+this._id+"_scroller"),r=this.scHeight-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),f=Math.ceil(this._deviceRatio())-1>0?r-1:r,i=this,e=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width()-1:this.element.width();u.ejScroller({enableRTL:this.model.enableRTL,height:f-1,width:parseInt(e)-2,cssClass:this.model.cssClass,thumbStart:function(r){var u=n(r.originalEvent.target);if(!i._mediaQuery&&!t.isTouchDevice()&&u.closest(".e-workcells").hasClass("e-workcells")||u.closest(".e-appointment").hasClass("e-appointment")||u.closest(".e-monthappointment").hasClass("e-monthappointment")||u.closest(".e-categorybar").hasClass("e-categorybar"))return!1},scroll:function(r){var e,o,u,f;t.isNullOrUndefined(r.scrollTop)||(r.scrollTop=parseInt(r.scrollTop));e=i.element.find("div#"+i._id+"_scroller").data("ejScroller");(e.isVScroll()||e.isHScroll())&&(i.model.orientation==="vertical"&&i._customOrientation==="vertical"?i.element.find(".e-scrolltimecells").css("top",-r.scrollTop+"px"):i.model.timeScale.enable&&i.currentView()!=="month"&&!i._isCustomMonthView()?n(i.element.find(".e-horizontalt
10imecells").find("table tr")[2]).css("left",-r.scrollLeft+"px"):i.element.find(".e-headerdays").css("left",-r.scrollLeft+"px"),i.element.find(".e-vhandle").length==1&&i.element.find(".e-horires").css("top",-r.scrollTop+"px"),i.model.orientation=="vertical"&&i._customOrientation=="vertical"?(i.element.find(".e-headrealldaytable").css("left",i.model.enableRTL?r.scrollData.scrollable-r.scrollLeft:-r.scrollLeft+"px"),o=i.element.find(".e-scrolltimecells").width()-3,i.element.find(".e-upicon, .e-downicon").css("left",-(r.scrollLeft-o)+"px"),i._timeMode!="12"||i.currentView()==="month"||i._isCustomMonthView()||(u=r.scrollTop/(i.element.find(".e-workcells").height()*i.model.timeScale.minorSlotCount),u=Math.round(u)<u?Math.round(u)+1:Math.round(u),f=t.preferredCulture(i.model.locale).calendar,f.AM&&f.PM&&i.element.find(".e-idAmpmstyle").each(function(t,i){t==u&&n(i).text().trim()=="00"?parseInt(n(i)[0].id)<12?n(i).text(f.AM[0]):n(i).text(f.PM[0]):(n(i).text()==f.AM[0]&&t>0||n(i).text()==f.PM[0]&&parseInt(n(i)[0].id)>12)&&n(i).text("00")})),i._mediaQuery&&i.element.find(".e-headrealldaytable").css("left","0px"),i.model.showAppointmentNavigator&&i.model.orientation=="vertical"&&i._customOrientation=="vertical"&&e.isVScroll()&&i.currentView()!="month"&&!i._isCustomMonthView()&&!i._mediaQuery&&(i._renderUpDownIcon(),i._renderUpDownIconPosition())):t.scheduleFeatures.horizontal&&(i.model.orientation=="horizontal"||i._customOrientation=="horizontal")&&i._horizontalScroll(r,i));t.isNullOrUndefined(i._quickAppointWindow)||!i.model.showQuickWindow||i._isQuickDialogOpened||(i._isQuickDialogOpened=!1,i._quickAppointWindow.ejDialog("close"),i._quickAppDetailsWindow.ejDialog("close"))}});this._mediaQuery||this._nextPrevAppointment(this.model.showAppointmentNavigator);this._renderHoriVerticalScroll();this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);this._showScrollTd()},_showScrollTd:function(){var n=this.model.enableRTL?"e-borderright":"e-borderleft",i=this.model.orientation=="horizontal"||this._customOrientation=="horizontal"?"16px":"17px";(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this.element.find(".e-vscroll").length>0?(this.element.find(".e-scheduleheader td").first().attr("colspan","3"),this.element.find(".e-workareadiv").parent().attr("colspan","2"),this.element.find(".e-emptyscrolltd").length==0&&this.aTR.append(t.buildTag("td.e-emptyscrolltd","",{},{}).css({width:this._mediaQuery?"0px":"16px"})),this.element.find(".e-emptyscrolltd").addClass("e-horizontalemptytd")):(this.element.find(".e-scheduleheader td").first().attr("colspan","2"),this.element.find(".e-workareadiv").parent().attr("colspan","2")));this.element.find(".e-vscroll").length>0?this.element.find(".e-emptyscrolltd").addClass(n).css("width",i).show():this.element.find(".e-emptyscrolltd").removeClass(n).css("width","0px").hide()},_renderHoriVerticalScroll:function(){var i=this.element.find("div#"+this._id+"_scroller"),f=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width(),r,h,e,y,c,l;f=parseInt(f)-1;var u=parseInt(this.scHeight)-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),o=i.ejScroller("isVScroll")?18:0,a=i.ejScroller("isHScroll")?18:0;if(this.element.find(".e-headeralldaydiv").width(this.element.find(".e-draggableworkarea").width()),!t.isNullOrUndefined(this.model.group)&&this.currentView()!="day"&&this.model.timeScale.enable&&this.element.find(".e-headrealldaytable").css("table-layout","auto"),this.model.orientation=="vertical"&&this._customOrientation=="vertical"){if(this.model.cellWidth||this.model.cellHeight){this.model.cellHeight&&!this.model.cellWidth&&this.element.find(".e-headrealldaytable").css("table-layout","");var s=(parseInt(this.model.cellWidth)+1)*this.element.find("div.e-draggableworkarea tr:first td").length,v=parseInt(this.model.cellHeight)*this.element.find("div.e-draggableworkarea tr").length,p=this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").width():0;this.element.find(".e-draggableworkarea").width(this.element.width()>s+p+o?s-1:f-1-o);this.model.cellHeight?this.element.find(".e-draggableworkarea").height(u>v?v:u-1-a):this.element.find(".e-draggableworkarea").height(u-1-a);this.model.cellWidth&&this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2);this.currentView()=="month"||this._isCustomMonthView()||this.element.find(".e-workcells").css("width",this.model.cellWidth)}else this.element.find(".e-headrealldaytable").css("table-layout",""),this.element.find(".e-draggableworkarea").height(u-1),!this.model.showOverflowButton&&(this.currentView()=="month"||this._isCustomMonthView())&&this._monthCellsRender(),this.element.find(".e-draggableworkarea").width(f-1-o);this.element.find(".e-timecells").height(this.element.find(".e-workcells").height()*this.model.timeScale.minorSlotCount+(this.model.timeScale.minorSlotCount-1));this.element.find(".e-headrealldaytable").width(this.model.cellWidth?"":"100%");r=this.model.cellWidth?this.model.cellWidth:this.element.find(".e-workcells,.e-monthcells").width()+"px";r=t.browserInfo().name=="webkit"&&this.currentView()!="day"?parseFloat(r)-1+"px":r;(this._tempResource.length>1&&!t.isNullOrUndefined(this.model.group)||this.model.cellWidth)&&this.element.find(".e-headercells").css({width:r,"min-width":r,"max-width":r});(t.isNullOrUndefined(this.model.group)||this.model.cellWidth||this.currentView()=="day")&&this.element.find(".e-headrealldaytable").css("width",s-1);this._mediaQuery&&this.res1.length>1&&(h=this.element.find(".e-draggableworkarea").width()*this.res1.length,this.element.find(".e-draggableworkarea").width(h),this.element.find(".e-headrealldaytable").width(h));this.element.find(".e-e-headeralldaydiv").width(this.element.find(".e-draggableworkarea").width());this._browserInfo.name=="chrome"||this._browserInfo.name=="webkit"?this.element.find(".e-scrolltimecells").height(this.element.find(".e-workcellstab").height()):this.element.find(".e-scrolltimecells").height(this.element.find(".e-workcellstab").height()-1);!this.model.timeScale.enable||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||this.element.find(".e-scrolltimecells tr").height(this.element.find(".e-workcells,.e-monthcells").outerHeight());e=t.isNullOrUndefined(this.element.find(".e-timecelltable td:first-child")[0])?0:this.element.find(".e-timecelltable td:first-child")[0].offsetHeight;y=e!=0?(e-2)/this.model.timeScale.minorSlotCount:e;this.element.find(".e-ampmstyle").css({height:y+"px",minHeight:(this.model.timeScale.enable&&this._mediaQuery&&this.currentView()!="month"?this.element.find(".e-workcells").height():0)+"px"})}else this.model.timeScale.enable||this.element.find(".e-workcellstab tr td:first-child").css("border-left","none"),i.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").css("height","100%")&&this.element.find(".e-resfootertr").css("height","0px"),i.ejScroller("isVScroll")?"":this.element.find(".e-draggableworkarea").css("height",u-19),this._mediaQuery&&(this.element.find(".e-horizontresdiv").height(i.height()),this.element.find(".e-draggableworkarea").children().height("100%"),this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height()),this.element.find(".e-horires").children().height("100%")),(this.model.cellWidth||this.model.cellHeight)&&(c=n(this.element.find(".e-workcells")[0]).parent().find("td").length,i.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").width(parseInt(this.model.cellWidth)*c+(c-1)),(this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable)&&this.element.find(".e-headerdays").children().css("width",this.element.find(".e-draggableworkarea").children().width()+"px").css("table-layout","auto"),this.model.cellHeight&&!this._tempResource&&this.element.find(".e-draggableworkarea").height(parseInt(this.model.cellHeight)-1)),!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||(this.currentView()=="month"||this._isCustomMonthView()?this.element.find(".e-headerdays table tr td:first-child").width(this.element.find(".e-workcellstab tr td:first-child").width()):this.element.find(".e-workcellstab").width(this.element.find(".e-workcellstab tr:first-child").children().length*(this.model.cellWidth?parseInt(this.model.cellWidth):this.element.find(".e-workcells,.e-monthcells").outerWidth()))),this.currentView()=="day"&&this.model.timeScale.enable&&n(this.element.find(".e-horizontalt
10imecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-horizontaltabletimecell").width(this.element.find(".e-workcellstab").width()),!this.model.timeScale.enable||i.ejScroller("isHScroll")||this.currentView()=="month"||this._isCustomMonthView()||(l=Math.floor(this.element.find(".e-draggableworkarea").width()/n(this.element.find(".e-workcells")[0]).parent().find("td").length),this.element.find(".e-workcells").width(l),this.element.find(".e-horizontaltabletimecell").find("tr td").width(l),this.element.find(".e-horizontaltabletimecell").css("table-layout","fixed").width(this.element.find(".e-draggableworkarea").width()),i.ejScroller("refresh")),this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()||(this.model.cellWidth||this._browserInfo.name=="webkit"?this._browserInfo.name=="webkit"&&this.currentView()!="month"&&(this.model.cellWidth&&this.element.find(".e-headerdays").width(this.model.cellWidth),this.element.find(".e-workcells").width(this.element.find(".e-draggableworkarea").width/this._dateRender.length),this.element.find(".e-dateheadercell").width(this.element.find(".e-workcells").width()),this.element.find(".e-headerdays table tr td:not(:first-child)").find(".e-dateheadercell").width(this.element.find(".e-workcells").width()-1),this.element.find(".e-workcells").width(this.element.find(".e-workcells").width())):this.element.find(".e-workcells").width(this.element.find(".e-horizontmonthheaderdaytd").width()))},_getDayNameIndex:function(n){var r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=[],t=this._firstdayofweek;do t>6&&(t=0),i.push(r[t]),t++;while(i.length<7);return i.indexOf(n.capitalizeFirstString())},_highlightBusinessHours:function(){var ot,st,r,f,e,it,a,ut,l,rt,u,et,i,v;if(this.currentView()=="agenda")return!1;if(ot=(this._resWorkWeek||this._resCustomView)&&this._resWorkWeek?"workWeek":"renderDates",st=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings[ot])||!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.start)||!t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.end):!1,st){this.element.find(".e-workcells, .e-monthcells").removeClass("e-businesshighlightworkcells e-monthcellhighlight");var c,k,d,y,p,w,nt,tt,g,l,o,s,a,ht,ct,b=0,lt=[],u=this.element.find(".e-workcellstab tr"),h=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this._grouping.length>1?this._resourceSort():this.res1;if(this.model.orientation=="vertical"&&this._customOrientation=="vertical")for(i=0;i<h.length;i++)if(o=t.isNullOrUndefined(h[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:h[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){for(c=this.dateRender,(t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.start))&&t.isNullOrUndefined(this._tempResource[this._tempResource.length-1].resourceSettings.end)?(k=this.model.workHours.start>=this.model.startHour?this.model.workHours.start-this.model.startHour:0,d=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour):(y=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.start],p=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.end],k=t.isNullOrUndefined(y)?this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour:y>=this.model.startHour?y:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,d=t.isNullOrUndefined(p)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:p<=this.model.endHour?p:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end),w=this.model.endHour-this.model.startHour,nt=Math.floor(u.length/w*k)-this.model.startHour*this.model.timeScale.minorSlotCount,tt=Math.floor(u.length/w*d)-this.model.startHour*this.model.timeScale.minorSlotCount,l=this.currentView()==="week"?this.model.showWeekend?7:o.length:this.currentView()==="workweek"?o.length:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length:1,this._resCustomView&&this.currentView()==="customview"&&(l=this._resCustomDate[i].length),r=nt;r<tt;r++)for(f=b;f<b+l;f++)for(e=0;e<o.length;e++)s=this._dayNamesArray.indexOf(o[e]),s==-1&&(s=this._getDayNameIndex(o[e])),s==new Date(c[f]).getDay()&&n(n(u[r]).children()[f]).addClass("e-businesshighlightworkcells");b+=l}else{if(this._resWorkWeek){for(r=0;r<o.length;r++)a=this._dayFullNames.indexOf(o[r].capitalizeFirstString()),a==-1&&(a=this._getDayNameIndex(o[r])),lt.push(this._renderDates[a]);c=lt}else c=this.currentView()!="month"&&!this._isCustomMonthView()?this.dateRender:this._dateRender;for(l=this._resWorkWeek?o.length:this.currentView()=="day"?1:7,ht=this.currentView()!="month"&&!this._isCustomMonthView()?b:i*7,ct=this.currentView()!="month"&&!this._isCustomMonthView()?b+l:(i+1)*7,r=0;r<u.length;r++)for(f=ht;f<ct;f++)for(e=0;e<o.length;e++)s=this._dayNamesArray.indexOf(o[e]),s==-1&&(s=this._getDayNameIndex(o[e])),s==new Date(c[f]).getDay()&&(n(n(u[r]).children()[f]).hasClass("e-othermonths")?n(n(u[r]).children()[f]).removeClass("e-monthcellhighlight"):n(n(u[r]).children()[f]).addClass("e-monthcellhighlight"));b+=l}else if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){for(c=this._dateRender,i=0;i<h.length;i++)if(h[i].classname!="e-parentnode")for(y=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.start],p=h[i][this._tempResource[this._tempResource.length-1].resourceSettings.end],k=t.
10isNullOrUndefined(y)?this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour:y>=this.model.startHour?y:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,d=t.isNullOrUndefined(p)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:p<=this.model.endHour?p:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end,w=this.model.endHour-this.model.startHour,g=n(u[i]).children().length/c.length,nt=Math.floor(g/w*k),tt=Math.floor(g/w*d),r=0;r<c.length;r++)for(f=0;f<this.model.workWeek.length;f++)if(s=this._dayNamesArray.indexOf(this.model.workWeek[f]),s==-1&&(s=this._getDayNameIndex(this.model.workWeek[f])),s==new Date(c[r]).getDay())for(e=g*r+nt;e<g*r+tt;e++)if(n(n(u[i]).children()[e]).addClass("e-businesshighlightworkcells"),this._grouping.length>1){it=i;a=this._tempResource.length-1;do ut=new t.DataManager(this._tempResource[a-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this._tempResource[a-1].resourceSettings.id,t.FilterOperators.equal,h[it][this._tempResource[this._tempResource.length-1].resourceSettings.groupId])),t.isNullOrUndefined(ut)||(it=h.indexOf(ut[0]),n(n(u[it]).children()[e]).addClass("e-businesshighlightworkcells")),a-=1;while(a>0)}}else this._horizontalBusinessHighlight(null,null,null,null,null)}else if(this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");var c=this.dateRender,u=this.element.find(".e-workcells"),at=this.model.workHours.start>=this.model.startHour?this.model.workHours.start-this.model.startHour:0,vt=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour,ft=60/this.model.timeScale.majorSlot*this.model.timeScale.minorSlotCount;if(this.res1=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.res1:[0],l=this.currentView()==="week"?this.model.showWeekend?7*this.res1.length:this.model.workWeek.length*this.res1.length:this.currentView()==="workweek"?this.model.workWeek.length*this.res1.length:this.currentView()==="customview"&&this._renderDays<=7?this._dateRender.length*this.res1.length:1*this.res1.length,this.model.orientation=="vertical"&&this._customOrientation=="vertical")for(i=Math.ceil(at*ft);i<vt*ft;i++)for(v=0;v<l;v++)for(rt=0;rt<this.model.workWeek.length;rt++)this._dayNamesArray.indexOf(this.model.workWeek[rt])==new Date(c[v]).getDay()&&n(u[i*l+v]).addClass("e-businesshighlightworkcells");else this._horizontalBusinessHighlight(this._dateRender,at,vt,ft,u)}else if(this.model.orientation=="vertical"&&this._customOrientation=="vertical")for(et=this.dateRender,u=this.element.find(".e-monthcells"),u.removeClass("e-monthcellhighlight"),i=0;i<et.length;i++)for(v=0;v<this.model.workWeek.length;v++)this._dayNamesArray.indexOf(this.model.workWeek[v])==new Date(et[i]).getDay()&&(n(u[i]).hasClass("e-othermonths")?n(u[i]).removeClass("e-monthcellhighlight"):n(u[i]).addClass("e-monthcellhighlight"));else this._horizontalBusinessHighlight(null,null,null,null,null)},_onselect:function(n){this._navigateClick(n,"DateNavigation")},_renderHeaderBar:function(n){var e=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?1:3,r=t.buildTag("td","",{},{colspan:e}),i=t.buildTag("div.e-datecommondiv").append(t.buildTag("div.e-icon e-navigateprevious","",{},{title:this._getLocalizedLabels("Previous"),role:"button","aria-label":this._getLocalizedLabels("Previous"),tabindex:0})).append(t.buildTag("div","",{},{"aria-label":this._getCurrentDateHeaderValue(),"aria-live":"assertive",tabindex:0}).html(this._getCurrentDateHeaderValue()).addClass("e-datedisplay")).append(t.buildTag("input#"+this._id+"_navigator","",{},{type:"text"}).css("display","none").addClass("dateCalendar")).append(t.buildTag("div.e-icon e-navigatenext","",{},{title:this._getLocalizedLabels("Next"),role:"button","aria-label":this._getLocalizedLabels("Next"),tabindex:0})),u,f;this._mediaQuery||this.element.width()<600?(this._mediaQuery&&(i=t.buildTag("div.e-datecommondiv").append(t.buildTag("div.e-icon e-navigateprevious","",{},{title:this._getLocalizedLabels("Previous")})).append(t.buildTag("div.e-icon e-navigatenext","",{},{title:this._getLocalizedLabels("Next")})).append(t.buildTag("div","",{},{"aria-live":"assertive",tabindex:0}).html(this._getCurrentDateHeaderValue()).addClass("e-datedisplay")).append(t.buildTag("input#"+this._id+"_navigator","",{},{type:"text"}).css("display","none").addClass("dateCalendar"))),u=t.buildTag("div#"+this._id+"navDrawerIcon.e-mobileNavigation e-icon"),n.append(r.append(t.buildTag("div").css("width","100%").append(i).append(u)))):(f=t.buildTag("div.e-viewsdiv"),n.append(r.append(t.buildTag("div").css("width","100%").append(i).append(f.append(this._renderViewNavigation(this.model.views))))));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderHeaderBar","",n
10)},_renderViewNavigation:function(n){for(var e,o=t.buildTag("table.e-table e-viewstable","",{},{}),s=t.buildTag("tbody"),u=t.buildTag("tr"),r=n,f,i=0;i<r.length;i++){f=r.length==1?"e-"+r[i].toLowerCase()+" e-singleview":i==0?"e-"+r[i].toLowerCase()+" e-firstview":i==r.length-1?"e-"+r[i].toLowerCase()+" e-lastview":"e-"+r[i].toLowerCase();e=!t.isNullOrUndefined(this.model.viewsName)&&this.model.viewsName[i]?this.model.viewsName[i]:null;switch(r[i]){case"day":u.append(t.buildTag("td").append(t.buildTag("div",e||this._getLocalizedLabels("Day"),{},{role:"button","aria-label":this._getLocalizedLabels("Day")}).addClass("e-commonviewbutton").addClass(f)));break;case"week":u.append(t.buildTag("td").append(t.buildTag("div",e||this._getLocalizedLabels("Week"),{},{role:"button","aria-label":this._getLocalizedLabels("Week")}).addClass("e-commonviewbutton").addClass(f)));break;case"workweek":u.append(t.buildTag("td").append(t.buildTag("div",e||this._getLocalizedLabels("WorkWeek"),{},{role:"button","aria-label":this._getLocalizedLabels("WorkWeek")}).addClass("e-commonviewbutton").addClass(f)));break;case"month":u.append(t.buildTag("td").append(t.buildTag("div",e||this._getLocalizedLabels("Month"),{},{role:"button","aria-label":this._getLocalizedLabels("Month")}).addClass("e-commonviewbutton").addClass(f)));break;case"customview":u.append(t.buildTag("td").append(t.buildTag("div",e||this._getLocalizedLabels("CustomView"),{},{role:"button","aria-label":this._getLocalizedLabels("CustomView")}).addClass("e-commonviewbutton").addClass(f)));break;case"agenda":u.append(t.buildTag("td").append(t.buildTag("div",e||this._getLocalizedLabels("Agenda"),{},{role:"button","aria-label":this._getLocalizedLabels("Agenda")}).addClass("e-commonviewbutton").addClass(f)))}}return o.append(s.append(u)),o},_renderNavigationDrawer:function(){var r,i;if(t.isNullOrUndefined(this._scheduleDrawer)){for(this._scheduleDrawer=t.buildTag("div#"+this._id+"navDrawer.navDrawerMenu e-scheduledrawer"),r="<ul><li data-ej-imageClass='e-icon e-mAddEvent' data-ej-text='"+this._getLocalizedLabels("AddEvent")+"' id='addEvent'><\/li>",i=0;i<this.model.views.length;i++)switch(this.model.views[i]){case"day":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Day")+"' id='"+this.model.views[i]+"'><\/li>";break;case"week":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Week")+"' id='"+this.model.views[i]+"'><\/li>";break;case"workweek":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("WorkWeek")+"' id='"+this.model.views[i]+"'><\/li>";break;case"month":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Month")+"' id='"+this.model.views[i]+"'><\/li>";break;case"customview":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("CustomView")+"' id='"+this.model.views[i]+"'><\/li>";break;case"agenda":r+="<li data-ej-imageClass='e-icon e-m"+this.model.views[i]+" e-"+this.model.views[i]+"' data-ej-text='"+this._getLocalizedLabels("Agenda")+"' id='"+this.model.views[i]+"'><\/li>"}r+="<\/ul>";this._scheduleDrawer.append(r);this.element.find(".e-scheduleinner").append(this._scheduleDrawer);this._navDrawer=!0;this._scheduleDrawer.ejNavigationDrawer({type:"overlay",targetId:this._id+"navDrawerIcon",direction:this.model.enableRTL?"left":"right",enableListView:!0,listViewSettings:{persistSelection:!0,selectedItemIndex:this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())+1,width:100,height:"auto",mouseUp:n.proxy(this._slideMenuClick,this)},position:"normal"});this.model.enableRTL&&this._scheduleDrawer.parent().css("left","0px");this._navDrawer=!1}},_slideMenuClick:function(t){var r,u,e,f,i,o;if(this._navDrawer)return!1;if(this._scheduleDrawer.ejNavigationDrawer("close"),r=t.item.find("div").hasClass("e-day")?"day":t.item.find("div").hasClass("e-week")?"week":t.item.find("div").hasClass("e-workweek")?"workweek":t.item.find("div").hasClass("e-month")?"month":t.item.find("div").hasClass("e-customview")?"customview":t.item.find("div").hasClass("e-agenda")?"agenda":"open",r!="open")this._navView=this._navSelected=!0,this.currentView()!=r&&this._viewChange(null,this.currentView(),r),this._navSelected=!1;else if(this.currentView()!="agenda"){for(u=new Date(this.currentDate()),f=0,u=new Date(u.setHours(0,0,0,0)),i=0;i<this.dateRender.length;i++)if(new Date(this.dateRender[i]).getTime()==u.getTime()){f=i;break}o=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.model.startHour+(new Date).getHours()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot):this.res1.length-1;e=this.currentView()!="month"&&this.currentView()!="customview"&&this.model.timeScale.enable?this.element.find(".e-draggableworkarea tr")[o].cells[f]:this.element.find(".e-monthcells")[f];n(e).addClass(".e-selectedCell").trigger(n.Event("click"));this._appointmentWindow({target:e})}},_renderAlertWindow:function(){this._alertWindow=t.buildTag("div.e-alertdialog#"+this._id+"alertWindow");var i="<div><div class='e-alerttext'><\/div><div class='e-alertbtn'><button id='"+this._id+"alertok' type='button' class='e-alertbutton e-alertOk e-buttonactive'>"+this._getLocalizedLabels("Ok")+"<\/button>
10<\/div><\/div>";this._alertWindow.append(i);this.element.append(this._alertWindow);this._alertWindow.find(".e-alertbutton").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass});this._alertWindow.ejDialog({width:this._mediaQuery?"75%":450,cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("RecurrenceAlert"),enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._alertClose,this)});n("#"+this._id+"alertWindow_wrapper").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_alertClose:function(t){this._alertWindow.ejDialog("close");this._alertWindow.hasClass("e-recurAlert")?(this._alertWindow.removeClass("e-recurAlert"),n(t.target).hasClass("e-alertOk")?(this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0}),this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(this._rRuleStr),this._appointmentAddWindow.find(".e-recuredit").css("display","inline"),this._appointmentAddWindow.find(".e-recurEditor").toggle(),this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).toggle().animate({"margin-left":10},300),this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","block"),this._appointmentAddWindow.find(".done").focus()):this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!1})):this._alertWindow.hasClass("e-seriesAlert")?(this._alertWindow.removeClass("e-seriesAlert"),n(t.target).hasClass("e-alertOk")?this._appointmentAddWindow.find("#done").click():this._seriesAlert=!0):this._alertWindow.hasClass("e-deleteAlert")&&(this._alertWindow.removeClass("e-deleteAlert"),n(t.target).hasClass("e-alertOk")&&this._deletingAppointment());this._alertWindow.find("#"+this._id+"alertcancel").length!=0&&this._alertWindow.find("#"+this._id+"alertcancel").remove()},_renderAppointmentWindow:function(){var i,r;n("#"+this._id+"AppointmentAddEditWindow_wrapper")&&n("#"+this._id+"AppointmentAddEditWindow_wrapper").remove();this._appointmentAddWindow=t.buildTag("div.e-scheduledialog e-appointmentaddwindow#"+this._id+"AppointmentAddEditWindow");i="<div class='e-appwindow e-windowmargin'><form id='"+this._id+"_AddEditForm'><table class='e-table' width='100%' cellpadding='7'><tbody>";this._mediaQuery?(i+="<tr id='"+this._id+"subjectlabeltr'><td colspan='3' class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><\/tr><tr id='"+this._id+"subjecttr' class='"+this._id+"subjecttr'><td colspan='3' class='e-rightfields'><input id='"+this._id+"subject' tabIndex='0' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><input id='id' class='id' type='text' name='"+this._appointmentSettings.id+"' value='' style='display: none'/><\/td><\/tr>",this.model.showLocationField&&(i+="<tr><td colspan='3' class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>"),i+="<tr id='"+this._id+"_appStartTime'><td class='e-textlabel' colspan='3'>"+this._getLocalizedLabels("StartTime")+":<\/td><\/tr><tr><td width='37%'><input id='"+this._id+"startdate' class='startenddate' type='text' name='StartDate' value='' /><\/td><td width=31%'><input type='text' id='"+this._id+"starttime' class='startendtime' name='StartTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td width='31%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>"),i+="<\/tr>",i+="<tr id='"+this._id+"_appEndTime'><td class='e-textlabel' colspan='3'>"+this._getLocalizedLabels("EndTime")+":<\/td><\/tr><tr><td>
10<input id='"+this._id+"enddate' class='startenddate' type='text' name='EndDate' value='' /><\/td><td><input type=''text' id='"+this._id+"endtime' class='startendtime' name='EndTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),i+="<\/tr>",this.model.prioritySettings.enable&&(i+="<tr><td class='e-leftfields e-textlabel' colspan='3'>"+this._getLocalizedLabels("Priority")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id= '"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value=''/><div id='prioritylist'><\/div><\/td><\/tr>"),i+="<tr class='"+this._id+"parrow'><td class='"+this._id+"allDay' colspan='3'><table class='e-table e-appchecktable' cellpadding='3'><tr><td><div class='e-allday e-checkboxmargin'><input id='"+this._id+"allday' tabIndex='0' class='allday' type='checkbox' name='"+this._appointmentSettings.allDay+"'/><\/div><\/td><td><div class='e-alldaytext'><label for='"+this._id+"allday'>"+this._getLocalizedLabels("AllDay")+"<\/label><\/div><\/td><td><div class='e-checkboxmargin e-recurrence'><input id='"+this._id+"recurrence' tabIndex='0' class='recurrence' type='checkbox' name='"+this._appointmentSettings.recurrence+"' value='recurrence'/><\/div><\/td><td><label class='e-repeatlbl' for='"+this._id+"recurrence'>"+this._getLocalizedLabels("Recurrence")+"<\/label><\/td><\/tr><\/table><\/td><\/tr>",i+="<tr id='"+this._id+"summary' class='"+this._id+"summary' style='display:none'><td class='e-textlabel'><label>"+this._getLocalizedLabels("Summary")+":<\/label><\/td><\/tr><tr class='"+this._id+"summary' style='display:none'><td colspan='4'><table><tr><td><label class='e-recurFinalRule'><\/label><\/td><td><div class='e-recuredit'><a class='e-recuredit' href='#' onclick='return false;'>"+this._getLocalizedLabels("Edit")+"<\/a><span class='e-icon e-edit_01 e-scheduleedit'><\/span><\/div><\/td><\/tr><\/table><\/td><\/tr>",this.model.categorizeSettings.enable&&(i+="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel' colspan='3'>"+this._getLocalizedLabels("Categorize")+":<\/td><\/tr><tr><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' name='"+this._appointmentSettings.categorize+"' class='e-categorizevalue' type='text' value=''/><\/td><\/tr>"),this._tempResource.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="<tr><td colspan='3'><textarea class='e-description e-textarea e-animation e-inputtext' id='"+this._id+"description' name='"+this._appointmentSettings.description+"'><\/textarea><span class='e-ripple-bar'><\/td><\/tr>",i+="<\/tbody><\/table><\/form>",i+="<div class='e-floatright' style='width:100%'><table width='100%' class='e-table' cellpadding='5'><tr><td width='30%'><div class='e-btnmargin e-floatleft'><button id='mDelete' class='e-btndelete e-appdelete'>"+this._getLocalizedLabels("Delete")+"<\/button><\/div><\/td><td width='30%'><div class='e-btnmargin e-floatleft'><button id='done' class='e-btndone e-appsave e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td width='30%'><div class='e-btnmargin e-floatleft'><button id='cancel' class='e-appointcancel cancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>"):(i+="<tr id='"+this._id+"subjecttr' class='"+this._id+"subjecttr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"subject' tabIndex='0' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><input id='id' class='id' type='text' name='"+this._appointmentSettings.id+"' value='' style='display: none'/><\/td><\/tr>",this.model.showLocationField&&(i+="<tr id='"+this._id+"showLocation' class='"+this._id+"showLocation'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Location")+":<\/td><td colspan='3' class='e-rightfields'><input id='"+this._id+"location' tabIndex='0' class='location e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.location+"' type='text' /><span class='e-ripple-bar'><\/td><\/tr>"),i+="<tr id='"+this._id+"_appStartTime'><td class='e-textlabel'>"+this._getLocalizedLabels("StartTime")+":<\/td><td width='25%'><input id='"+this._id+"startdate' class='startenddate' type='text' name='StartDate' value='' /><\/td><td width=22%'><input type='text' id='"+this._id+"starttime' class='startendtime' name='StartTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td width='28%'><input id='"+this._id+"startTimeZone' class='startutc' name='"+this._appointmentSettings.startTimeZone+"' type='text' value=''/><div id='Timezoneliststr'><\/div><\/td>"),i+="<\/tr>",i+="<tr id='"+this._id+"_appEndTime'><td class='e-textlabel'>"+this._getLocalizedLabels("EndTime")+":<\/td><td>
10<input id='"+this._id+"enddate' class='startenddate' type='text' name='EndDate' value='' /><\/td><td><input type=''text' id='"+this._id+"endtime' class='startendtime' name='EndTime'/><\/td>",this.model.showTimeZoneFields&&(i+="<td><input id='"+this._id+"endTimeZone' class='endutc' name='"+this._appointmentSettings.endTimeZone+"' type='text' value=''/><div id='Timezonelistend'><\/div><\/td>"),i+="<\/tr>",r=this.model.prioritySettings.enable?"<td colspan='1' class='e-textlabel "+this._id+"priorityshow'>"+this._getLocalizedLabels("Priority")+":<\/td><td colspan='1' class='"+this._id+"prioritylistshow'><input id='"+this._id+"priority' class='priority' type='text' name='"+this._appointmentSettings.priority+"' value='' /><div id='prioritylist'><\/div><\/td>":"",i+="<tr class='"+this._id+"parrow'>"+r+"<td class='"+this._id+"allDay' colspan='4'><table class='e-table e-appchecktable' cellpadding='3'><tr><td><div class='e-allday e-checkboxmargin'><input id='"+this._id+"allday' tabIndex='0' class='allday' type='checkbox' name='"+this._appointmentSettings.allDay+"'/><\/div><\/td><td><div class='e-alldaytext'><label for='"+this._id+"allday'>"+this._getLocalizedLabels("AllDay")+"<\/label><\/div><\/td><td><div class='e-checkboxmargin e-recurrence'><input id='"+this._id+"recurrence' tabIndex='0' class='recurrence' type='checkbox' name='"+this._appointmentSettings.recurrence+"' value='recurrence'/><\/div><\/td><td><label class='e-repeatlbl' for='"+this._id+"recurrence'>"+this._getLocalizedLabels("Recurrence")+"<\/label><\/td><\/tr><\/table><\/td><\/tr>",i+="<tr id='"+this._id+"summary' class='"+this._id+"summary' style='display:none'><td class='e-textlabel'><label>"+this._getLocalizedLabels("Summary")+":<\/label><\/td><td colspan='3'><table><tr><td><label class='e-recurFinalRule'><\/label><\/td><td><div class='e-recuredit'><a class='e-recuredit' href='#' onclick='return false;'>"+this._getLocalizedLabels("Edit")+"<\/a><span class='e-icon e-edit_01 e-scheduleedit'><\/span><\/div><\/td><\/tr><\/table><\/td><\/tr>",this.model.categorizeSettings.enable&&(i+="<tr id='"+this._id+"categorizetr'><td class='e-leftfields e-textlabel'>"+this._getLocalizedLabels("Categorize")+":<\/td><td colspan='3' class='e-rightfields'><input id= '"+this._id+"categorize' name='"+this._appointmentSettings.categorize+"' class='e-categorizevalue' type='text' value=''/><\/td><\/tr>"),this._tempResource.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="<tr><td colspan='4'><textarea class='e-description e-textarea e-animation e-inputtext' id='"+this._id+"description' name='"+this._appointmentSettings.description+"'><\/textarea><span class='e-ripple-bar'><\/td><\/tr>",i+="<\/tbody><\/table><\/form>",i+="<div class='e-floatright'><table class='e-table' cellpadding='5'><tr><td><div class='e-btnmargin e-floatleft'><button id='done' class='e-btndone e-appsave e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button><\/div><\/td><td><div class='e-btnmargin e-floatleft'><button id='cancel' class='e-appointcancel cancel'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div><\/div>");this._appointmentAddWindow.append(i);this.element.append(this._appointmentAddWindow);this._renderControls();this._appointmentAddWindow.ejDialog({width:this._mediaQuery?"100%":600,height:this._mediaQuery?"100%":"auto",cssClass:this.model.cssClass,showOnInit:!1,enableRTL:this.model.enableRTL,enableModal:!0,title:this._getLocalizedLabels("CreateAppointmentTitle"),enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._onclose,this)});this._mediaQuery?n("#"+this._id+"AppointmentAddEditWindow_wrapper").addClass("e-scheduledialog e-scheduleresponsive").find(".e-titlebar").addClass("e-dialogheader"):n("#"+this._id+"AppointmentAddEditWindow_wrapper").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader");n("#"+this._id+"priority_popup_wrapper").addClass("e-schedulepriority");this._on(this._appointmentAddWindow,"click","a.e-recuredit",n.proxy(this._editRecurrence,this));this._mediaQuery&&this._appointmentAddWindow.ejDialog("refresh");n.isFunction(n.validator)&&this._setValidation();this._mediaQuery&&this._phoneChanges()},_renderRecurrenceEditor:function(){t.isNullOrUndefined(this._recurrenceEditor)&&(this._recurrenceEditor=t.buildTag("div.e-recurEditor#"+this._id+"recurrenceEditor").ejRecurrenceEditor({selectedRecurrenceType:1,frequencies:["daily","weekly","monthly","yearly","everyweekday"],startDate:this.currentDate(),minDate:this.model.minDate,maxDate:this.model.maxDate,firstDayOfWeek:this.model.firstDayOfWeek,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,locale:this.model.locale}));var i="<div class='e-floatright'><table class='e-table' cellpadding='5'><tr><td><div class='e-btnmargin e-floatleft'><button id='"+this._id+"donerecur' class='recurbutton e-buttonactive'>"+this._getLocalizedLabels("Done")+"<\/button>
10<\/div><\/td><td><div class='e-btnmargin e-floatleft'><button id='"+this._id+"cancelrecur' class='e-cancelrecur recurbutton'>"+this._getLocalizedLabels("Cancel")+"<\/button><\/div><\/td><\/tr><\/table><\/div>";t.isNullOrUndefined(this._appointmentAddWindow)||(n(this._recurrenceEditor).insertAfter(this._appointmentAddWindow.find(".e-appwindow")),this._appointmentAddWindow.find(".e-recurEditor").append(i),this._appointmentAddWindow.find("#"+this._id+"donerecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._closeRecurence,this),cssClass:"e-flat"+this.model.cssClass}),this._appointmentAddWindow.find("#"+this._id+"cancelrecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._closeRecurence,this),cssClass:"e-flat"+this.model.cssClass}),this._appointmentAddWindow.find(".e-recurEditor").css("display","none"),this._mediaQuery&&this._phoneChanges())},_refreshAppointmentWindow:function(){this._destorySubControls(n("#"+this._id+"_AddEditForm"));this._destorySubControls(n("#"+this._id+"_RecurForm"));n("#"+this._id+"AppointmentAddEditWindow_wrapper").remove();this._renderAppointmentWindow();n.isFunction(n.validator)&&this._setValidation()},_renderQuickAppWindow:function(){var i,r;this._quickAppointWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppointmentQuickWindow");i="<div id='"+this._id+"_quickAppwindow' class='e-tableAppoint'><table cellpadding='7' class='e-qappwindow'><tbody>";i+="<tr><td colspan='2'><div class='e-quickstartend'><\/div> <div title='"+this._getLocalizedLabels("Close")+"' aria-label= '"+this._getLocalizedLabels("Close")+"' class='e-icon e-scheduleclose e-schedclosemargin e-pointercursor'><\/div><\/td><\/tr><tr><td class='e-subjectlabel'>"+this._getLocalizedLabels("AppointmentSubject")+":<\/td><td colspan='2' class='e-rightfields'><form id='"+this._id+"_AddForm' onsubmit='return false;'><input id='"+this._id+"quicksubject' class='subject e-textbox e-animation e-inputtext' name='"+this._appointmentSettings.subject+"' type='text' /><span class='e-ripple-bar'><\/span><\/form><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-quickcreatebottomcontainer'><div tabIndex='0' class='e-detailedapp e-detailedwindow'> "+this._getLocalizedLabels("Detailed")+" >><\/div><div style='margin-right:-3px;' class='e-floatright'><div class='e-quickAppDone'><button id='done' class='e-btndone e-qAppDone e-buttonactive' style='font-size:12px !important;'>"+this._getLocalizedLabels("CreateAppointmentTitle")+"<\/button><\/div><\/div><\/div><\/div>";this._quickAppointWindow.append(i);this.element.append(this._quickAppointWindow);this._quickAppointWindow.append(t.buildTag("div.e-quickarrow").append("<div class='e-outerarrowline'><\/div>").append("<div class='e-innerarrow'><\/div>"));r=this._quickAppointWindow;r.find(".e-btndone").ejButton({showRoundedCorner:!0,click:n.proxy(this._saveAppointment,this),cssClass:"e-flat"+this.model.cssClass,enableRTL:this.model.enableRTL});this._on(r.find(".e-scheduleclose"),"click",n.proxy(this._quickWindowClose,this));this._on(r.find(".e-detailedapp"),"click",n.proxy(this._appointmentWindow,this));this._quickAppointWindow.ejDialog({width:330,minHeight:0,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableAnimation:!1,showOnInit:!1,enableResize:!1,allowDraggable:!1,showHeader:!1,allowKeyboardNavigation:!1,close:n.proxy(function(){this._processFocus()},this)});n.isFunction(n.validator)&&this._setQuickValidation();n("#"+this._id+"AppointmentQuickWindow_wrapper").addClass("e-scheduledialog e-schedulequickdialog").css("overflow","visible").find("#"+this._id+"AppointmentQuickWindow").addClass("e-dialogouter")},_renderQuickAppDetailsView:function(){var i,r;this._quickAppDetailsWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppDetailsWindow");i="<div id='"+this._id+"_quickAppDetailswindow' class='e-tableAppoint e-appdetails'><table cellpadding='1' class='e-qappwindow'><tbody>";i+="<tr><td colspan='2'><div class='e-quicksubject e-textellipsis'><\/div> <div title='"+this._getLocalizedLabels("Close")+"' aria-label= '"+this._getLocalizedLabels("Close")+"' class='e-icon e-scheduleclose e-schedclosemargin e-pointercursor'><\/div><\/td><\/tr><tr><td colspan='2' class='e-quickduein e-rightfields'><\/td><\/tr><tr><td colspan='2'><div class='e-quickstartendtime'><\/div><\/td><\/tr><\/tbody><\/table>";i+="<div class='e-quickbottomcontainer'><div title='"+this._getLocalizedLabels("Delete")+"' aria-label= '"+this._getLocalizedLabels("Delete")+"' class='e-icon e-delete e-scheduledelete e-pointercursor' tabIndex='0'><\/div><div class='e-floatright'><div class='e-editevents'><div class='e-editevent e-textellipsis' tabIndex='0'>"+this._getLocalizedLabels("Editevent")+" | <\/div><div class='e-editseries e-textellipsis' tabIndex='0'>"+this._getLocalizedLabels("Editseries")+" >><\/div> <\/div><\/div><\/div><\/div>";this._quickAppDetailsWindow.append(i);this._recurrenceFutureActions&&(r=n("<div class='e-editfutureonly e-textellipsis' aria-label= '"+this._getLocalizedLabels("Editfollowingevent")+"' tabIndex='0'>"+this._getLocalizedLabels("Editfollowingevent")+" | <\/div>"),r.insertAfter(this._quickAppDetailsWindow.find(".e-editevent")));this.element.append(this._quickAppDetailsWindow);this._quickAppDetailsWindow.append(t.buildTag("div.e-quickarrow").append("<div class='e-outerarrowline'><\/div>").append("<div class='e-innerarrow'><\/div>"));this._on(this._quickAppDetailsWindow.find(".e-scheduleclose"),"click",n.proxy(this._quickAppDetailWindowClose,this));this._on(this._quickAppDetailsWindow.find(".e-scheduledelete"),"click",n.proxy(this._deleteAppoint,this));this._on(this._quickAppDetailsWindow.find(".e-editevent,.e-editfutureonly,.e-editseries"),"click",n.proxy(this._editClick,this));this._quickAppDetailsWindow.ejDialog({width:this._recurrenceFutureActions?360:270,minHeight:0,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableAnimation:!1,showOnInit:!1,enableResize:!1,allowDraggable:!1,showHeader:!1,allowKeyboardNavigation:!1,close:n.proxy(function(){this._processFocus()},this)});n("#"+this._id+"AppDetailsWindow_wrapper").addClass("e-scheduledialog e-schedulequickdialog").css("overflow","visible").find("#"+this._id+"AppDetailsWindow").addClass("e-dialogouter")}
10,_editClick:function(i){if((this._editclick=!0,n(i.target).hasClass("e-editseries")&&this._quickAppDetailsWindow.find(".e-editseries").hasClass("e-disable"))||n(i.target).hasClass("e-editfutureonly")&&this._quickAppDetailsWindow.find(".e-editfutureonly").hasClass("e-disable"))return!1;var r=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));n(i.target).hasClass("e-editevent")?r[0][this._appointmentSettings.recurrence]?(this._parentId=r[0].ParentId,this._currentAction=t.Schedule.Actions.EditOccurrence,this._showAppointmentDetails(this._appUid,!0)):t.isNullOrUndefined(r[0][this._appointmentSettings.recurrence])?(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(this._appUid,!0)):(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(r[0].Guid,!0)):n(i.target).hasClass("e-editfutureonly")?r[0][this._appointmentSettings.recurrence]&&(this._parentId=r[0].ParentId,this._currentAction=t.Schedule.Actions.EditFutureOccurrences,this._showAppointmentDetails(this._appUid,!0)):n(i.target).hasClass("e-editseries")&&r[0][this._appointmentSettings.recurrence]&&(this._parentId=r[0][this._appointmentSettings.recurrenceId]==null?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId],this._currentAction=t.Schedule.Actions.EditSeries,this._showAppointmentDetails(this._parentId,!1));this._editclick=!1;this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close")},_deleteAppoint:function(i){var r,f,u;!this.model.readOnly&&this.model.allowDelete&&(t.isNullOrUndefined(i)||!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this._quickAppDetailsWindow.ejDialog("isOpen")?(u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u[0][this._appointmentSettings.recurrence]||!this.model.showDeleteConfirmationDialog?(this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("isOpen")&&this._quickAppDetailsWindow.ejDialog("close"),this._deletingAppointment()):this._deleteConfirmation()):(r=n(i.target).parent(),f=r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment"),this._appUid=f.attr("data-guid"),this._mediaQuery&&(this._mAppId=this._appUid),u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),u[0][this._appointmentSettings.recurrence]||!this.model.showDeleteConfirmationDialog?this._deletingAppointment():this._deleteConfirmation()))},_deletingAppointment:function(){if(this._appUid=t.isNullOrUndefined(this._appUid)?this._deleteUid:this._appUid,this._appUid){this._currentAction=this._actionType=t.Schedule.Actions.Delete;var n=this._getAppointmentByParentId(this._mediaQuery?t.isNullOrUndefined(this._mAppId)?this._appUid:this._mAppId:this._appUid);n[this._appointmentSettings.recurrence]?this.model.showRecurrenceAlert?(t.isNullOrUndefined(this._recurEditWindow)&&this._renderRecurEditWindow(),this._parentId=n.ParentId,this._recurEditWindow.ejDialog("open"),this._recurEditWindow.focus(),this._deleteBeforeOpen()):(this._currentAction=this._actionType=t.Schedule.Actions.DeleteSeries,this._deleteApp(n.ParentId)):this._deleteApp(this._mediaQuery?t.isNullOrUndefined(this._mAppId)?this._appUid:this._mAppId:this._appUid)}t.isNullOrUndefined(this._alertWindow)||this._alertWindow.ejDialog("close")},_deleteConfirmation:function(){!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close");t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertbutton").css({margin:"0px 20px 15px 10px"}),n("#"+this._id+"alertWindow").ejDialog({width:this._mediaQuery?"90%":450,title:this._getLocalizedLabels("MouseOverDeleteTitle")}),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("DeleteConfirmation")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Delete")));this._alertWindow.ejDialog("isOpen")||(this._alertWindow.addClass("e-deleteAlert"),this._alertWindow.ejDialog("open"),this._alertWindow.find(".e-alertOk").attr("tabIndex",0).focus())},_quickAppDetailWindowClose:function(){this._quickAppDetailsWindow.ejDialog("close");this._processFocus()},_alldayCheck:function(){if(this._appointmentAddWindow.find(".allday").ejCheckBox("option","checked"))this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:this._timeMode=="12"?"12:00 AM":"00:00",enabled:!1}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:this._timeMode=="12"?"11:59 PM":"23:59",enabled:!1}),this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!1});else{if(this._tempStart!=""||this._tempEnd!=""){var n=t.format(new Date((new Date).setHours(0,0,0)),this._pattern.t,this.model.locale),i=t.format(new Date((new Date).setHours(23,59,59)),this._pattern.t,this.model.locale);this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:this._tempStart});this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:this._tempEnd});(this._timeMode=="12"?this._tempStart==n&&this._tempEnd==i:this._tempStart=="00:00"&&this._tempEnd=="23:59")&&(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:t.format(new Date("1/1/2000 "+this.model.workHours.start+":00:00"),this._pattern.t,this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:t.format(new Date("1/1/2000 "+this.model.workHours.start+":30:00"),this._pattern.t,this.model.locale)}))}this._appointmentAddWindow.find(".startendtime").ejTimePicker({enabled:!0});this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!0});this._endSlotChange=!0;this._startSlotChange=!0}},_renderRecurEditWindow:function(){var r,e;n("#"+this._id+"RecurrenceEdit_wrapper")&&n("#"+this._id+"RecurrenceEdit_wrapper").remove();this._recurEditWindow=t.buildTag("div.e-scheduledialog#"+this._id+"RecurrenceEdit");var o=t.buildTag("div.e-recureditmsg",this._getLocalizedLabels("RecurrenceEditMessage")),u=this._getLocalizedLabels("RecurrenceEditOnly"),f=this._getLocalizedLabels("RecurrenceEditSeries"),i=t.buildTag("div.e-recureditbtns").append(t.buildTag("button.e-editonly#"+this._id+"Editonly",u,{},{name:"recurrenceeditonly",value:u})).append(t.buildTag("button.e-editseries#"+this._id+"EditSeries",f,{},{name:"recurrenceeditseries",value:f}));this._recurrenceFutureActions&&(r=this._getLocalizedLabels("RecurrenceEditFollowingEvent"),e=t.buildTag("button.e-editfutureonly#"+this._id+"EditFutureOnly",r,{},{name:"recurrenceeditfutureonly",value:r}),e.insertAfter(i.find(".e-editonly")));this._recurEditWindow.append(o).append(i);i.find(".e-editonly,.e-editfutureonly,.e-editseries").ejButton({cssClass:"e-flat"+this.model.cssClass,enableRTL:this.model.enableRTL,showRoundedCorner:!0});this._on(this._recurEditWindow,"click",".e-editonly,.e-editfutureonly,.e-editseries",n.proxy(this._recurBtnClick,this));this._on(this._recurEditWindow,"click","div.e-scheduleclose",n.proxy(this._recrConformClose,this));this._recurEditWindow.appendTo(this.element);this._mediaQuery&&this._recurEditWindow.find(".e-editonly,.e-editfutureonly,.e-editseries").css({"margin-top":"10px"});this._recurEditWindow.ejDialog({width:this._mediaQuery?"90%":this._recurrenceFutureActions?500:360,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,title:this._getLocalizedLabels("RecurrenceEditTitle"),showOnInit:!1,enableModal:!0,enableResize:!1,allowKeyboardNavigation:!1,close:n.proxy(this._processFocus,this),beforeOpen:n.proxy(this._deleteBeforeOpen,this)});n("#"+this._id+"RecurrenceEdit_wrapper").addClass("e-scheduledialog")},_recrConformClose:function(){t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("close");this._processFocus()},_deleteBeforeOpen:function(){n("#"+this._id+"RecurrenceEdit_title").addClass("e-dialogheader");n("#"+this._id+"RecurrenceEdit_title").find(".e-title").html(this._currentAction==t.Schedule.Actions.Delete?this._getLocalizedLabels("RecurrenceDeleteTitle"):this._getLocalizedLabels("RecurrenceEditTitle"))},_recurBtnClick:function(i){var r,l,e,u,h,f,o,y,s,c,k,a;if(n(i.target).hasClass("e-editonly"))if(this._editOnlyClicked=!0,this._currentAction==t.Schedule.Actions.Delete){if(r=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],r[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1){if(this._trigger("actionBegin",{id:this._appUid,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence}))return!1;var p=r[this._appointmentSettings.recurrenceId]==null?r.ParentId:r[this._appointmentSettings.recurrenceId],v=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,p)),w=r[this._appointmentSettings.recurrence]?{appointment:r,currentAction:t.Schedule.Actions.DeleteOccurrence,recurrenceCollection:{occurrences:r,parentData:v[0]}}:{appointment:r,currentAction:t.Schedule.Actions.DeleteOccurrence};if(this._trigger("beforeAppointmentRemove",w))return!1;for(l=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"Guid",e=this._dataManager.remove(l,r[l],this.model.appointmentSettings.query._fromTable),this._groupEditing||this._groupEdit?new t.DataManager(this._currentAppointmentData).remove(this._appointmentSettings.id,r):this.dataSource()instanceof t.DataManager&&new t.DataManager(this._currentAppointmentData).remove("Guid",r),this._refreshCellsHeight(),this._groupEditing&&this._groupEdit?(u=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,r[this._appointmentSettings.startTime].toString())),u=new t.DataManager(u).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,r[this._appointmentSettings.id]))):u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:u},"Guid"),h=0;h<u.length;h++)this._appointmentRemove(u[h]),this._refreshDayAppointments(u[h]);this._trigger("appointmentRemoved",{appointment:v,requestType:"appointmentDeleted",currentAction:t.Schedule.Actions.DeleteOccurrence});this._trigger("actionComplete",{appointment:v,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence});!t.isNullOrUndefined(e)&&n.isFunction(e.promise)&&this.dataSource()instanceof t.DataManager&&(a=this,e.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&a._processUrlBinding(i)}))}else{if(this._trigger("actionBegin",{id:this._appId,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence}))return!1;var p=r[this._appointmentSettings.recurrenceId]==null?r.ParentId:r[this._appointmentSettings.recurrenceId],d=this._deleteOcurrence(p,r[this._appointmentSettings.startTime]),b=this._timeZoneAppointments(d[0],""),g=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,r[this._appointmentSettings.id])),w=r[this._appointmentSettings.recurrence]?{appointment:r,currentAction:t.Schedule.Actions.DeleteOccurrence,recurrenceCollection:{occurrences:r,parentData:g[0]}}:{appointment:r,currentAction:t.Schedule.Actions.DeleteOccurrence};if(this._trigger("beforeAppointmentRemove",w))return this._recurEditWindow.ejDialog("close"),!1;var l=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",e=this._dataManager.update(l,b,this.model.appointmentSettings.query._fromTable),nt=this._timeZoneAppointments(b,"reverse");if(new t.DataManager(this._currentAppointmentData).update("AppTaskId",nt),this._refreshCellsHeight(),this._groupEditing||this._groupEdit?(f=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,r[this._appointmentSettings.startTime].toString())),f=new t.DataManager(f).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,r[this._appointmentSettings.id]))):f=this._processed.filter(function(n){return n.Guid==r.Guid}),f.length>1)for(s=[],o=0;o<f.length;
10o++)y=this._processed.filter(function(n){return n.Guid==f[o].Guid}),y.length>0&&s.push(y[0]),new t.DataManager(this._processed).remove("Guid",f[o].Guid),new t.DataManager(this._renderedApp).remove("Guid",f[o].Guid),new t.DataManager(this._renderedAllDay).remove("Guid",f[o].Guid);else s=this._processed.filter(function(n){return n.Guid==r.Guid}),new t.DataManager(this._processed).remove("Guid",this._appUid),new t.DataManager(this._renderedApp).remove("Guid",this._appUid),new t.DataManager(this._renderedAllDay).remove("Guid",this._appUid),this._appUid=null;for(c=0,k=s.length;c<k;c++)this._appointmentRemove(s[c]),this._refreshDayAppointments(s[c]);this._trigger("appointmentRemoved",{appointment:r,requestType:"appointmentDeleted",currentAction:t.Schedule.Actions.DeleteOccurrence});this._trigger("actionComplete",{appointment:r,requestType:"appointmentDelete",currentAction:t.Schedule.Actions.DeleteOccurrence});!t.isNullOrUndefined(e)&&n.isFunction(e.promise)&&this.dataSource()instanceof t.DataManager&&(a=this,e.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&a._processUrlBinding(i)}))}this._currentViewAppointments=this.getCurrentViewAppointments();this.model.showAppointmentNavigator&&this._nextPrevButton()}else this._currentAction=t.Schedule.Actions.EditOccurrence,this._showAppointmentDetails(this._appUid,!0);else n(i.target).hasClass("e-editfutureonly")?(this._editOnlyClicked=!1,this._currentAction==t.Schedule.Actions.Delete?(this._actionType=t.Schedule.Actions.DeleteFutureOccurrences,this._deleteApp(this._appUid)):(this._currentAction=t.Schedule.Actions.EditFutureOccurrences,this._showAppointmentDetails(this._appUid,!0))):(this._editOnlyClicked=!1,this._currentAction==t.Schedule.Actions.Delete?(this._actionType=t.Schedule.Actions.DeleteSeries,this._deleteApp(this._appUid)):(this._currentAction=t.Schedule.Actions.EditSeries,this._showAppointmentDetails(this._parentId,!1)));t.isNullOrUndefined(this._recurEditWindow)||this._recurEditWindow.ejDialog("close")},_repeat:function(n){var i,r;n.isInteraction&&(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),this._appointmentAddWindow.find(".e-recurEditor").length==0&&this._renderRecurrenceEditor(),n.isChecked||this._recurChecked?this._currentAction==t.Schedule.Actions.EditSeries||this._appointmentAddWindow.find(".e-recurFinalRule").html()!=""?this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"):(this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").toggle(),this._appointmentAddWindow.find(".e-recurEditor").css("margin-left",700).toggle().animate({"margin-left":10},400),i=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),i.clearRecurrenceFields(),this._appointmentAddWindow.find(".e-recurEditor").css("display","block"),r=new Date(this._appointmentAddWindow.find(".startenddate").ejDatePicker("option","value")),i.model.startDate=r,i.setDefaultValues()):(this._currentAction==t.Schedule.Actions.EditSeries||this._appointmentAddWindow.find(".e-recurFinalRule").html()!="")&&this._appointmentAddWindow.find("."+this._id+"summary").css("display","none"),this._recurChecked=!1)},_resourceDaysReorder:function(n){var c=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],f=[],r=[],e=[],h=[],o=this._firstdayofweek,s,i,u;do o>6&&(o=0),f.push(c[o]),o++;while(f.length<7);for(s=0;s<n.length;s++)r.push(n[s].toLowerCase());for(i=0;i<r.length;i++)f.indexOf(r[i])!=-1&&(e[f.indexOf(r[i])]=r[i]);for(u=0;u<e.length;u++)t.isNullOrUndefined(e[u])||h.push(e[u]);return h},_daysReorder:function(n){var i=[],t=n,r=[0,1,2,3,4,5,6];do t>6&&(t=0),i.push(r[t]),t++;while(i.length<7);return i},_getWeekDays:function(){for(var t,r=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],i=[],n=0;n<this.model.workWeek.length;n++)t=r.indexOf(this.model.workWeek[n]),t!=-1&&i.push(t);return i},_resourceRenderDates:function(){var h,e,u,f,r,o,i,s,a;if(this._tempResource.length>1){for(h=this._resourceSort(),u=[],e=0;e<h.length;e++)i=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource.indexOf(h[e]),i!=-1&&u.push(h[e]);this.res1=u}else u=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource;var c=[],l=[],v=this;for(this._resDateRen={},f=0;f<u.length;f++)if(r=u[f][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],t.isNullOrUndefined(r))s=n.extend(!0,[],this._dateRender),a=this._getWeekDays(),s=s.filter(function(n){return a.indexOf(new Date(n).getDay())!=-1}),n.merge(c,s),this._resDateRen[f]=s;else{for(r=this._resourceDaysReorder(r),o=0;o<r.length;o++)i=this._getDayNameIndex(r[o].capitalizeFirstString()),i==-1&&(i=this._getDayNameIndex(r[o])),c.push(this._renderDates[i]),l.push(this._renderDates[i]);this._resDateRen[f]=l;l=[]}return c},_resourceCustomDates:function(){var c,s,p,f,e,r,l,h,a,o,u,v;if(this._tempResource.length>1){for(c=this._resourceSort(),f=[],s=0;s<c.length;s++)p=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource.indexOf(c[s]),p!=-1&&f.push(c[s]);this.res1=f}else f=this._tempResource[this._tempResource.length-1].resourceSettings.dataSource;var w=[],i=[],g=this;for(this._resCustomDate={},this._resCustomCollection=[],e=0;e<f.length;e++){if(r=f[e][this._tempResource[this._tempResource.length-1].resourceSettings.renderDates],t.isNullOrUndefined(r)){o=this._firstweekdate(this.currentDate());do i.push(new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime()),o.setDate(o.getDate()+1);while(i.length<7)}else{if(n.type(r[0])=="object")for(h=0;h<r.length;h++){var b=r[h].start,k=r[h].end,d=Math.round(Math.abs((k.getTime()-b.getTime())/864e5))+1,y=b;for(u=0;
10u<d;u++)i.push(new Date(y.getFullYear(),y.getMonth(),y.getDate()+u).getTime())}else for(a=0;a<r.length;a++)l=new Date(new Date(r[a]).getTime()),i.push(new Date(l.getFullYear(),l.getMonth(),l.getDate()).getTime());i.sort()}for(u=0;u<i.length;u++)w.push(i[u]);i.length>1&&(this._resCustomDate[e]=i,v={},v.id=f[e].id,v.renderDates=i,this._resCustomCollection.push(v),i=[])}return w},_customviewRenderDates:function(){var h,i,s,e,c,f,o,r;if(t.isNullOrUndefined(this.model.renderDates))r=this._monthdates();else if(this._calculateCustomDays(),r=[],h=this._getWeekDays(),n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0){if(n.type(this.model.renderDates[0])=="object")for(s=0;s<this.model.renderDates.length;s++){var a=new Date(t.parseDate(t.format((new Date).parseISO8601(this.model.renderDates[s].start),this._datepattern(),this.model.locale))),v=new Date(t.parseDate(t.format((new Date).parseISO8601(this.model.renderDates[s].end),this._datepattern(),this.model.locale))),y=Math.round(Math.abs((v.getTime()-a.getTime())/864e5))+1,u=a;for(e=0;e<y;e++)this.model.showWeekend?r.push(new Date(u.getFullYear(),u.getMonth(),u.getDate()+e).getTime()):(i=new Date(u.getFullYear(),u.getMonth(),u.getDate()+e),o=h.indexOf(i.getDay()),o!=-1&&r.push(new Date(u.getFullYear(),u.getMonth(),u.getDate()+e).getTime()))}else if(n.type(this.model.renderDates[0])=="string"||n.type(this.model.renderDates[0])=="date")for(c=this._renderDays,f=0;f<c;f++)i=new Date(new Date(t.parseDate(t.format((new Date).parseISO8601(this.model.renderDates[f]),this._datepattern(),this.model.locale))).getTime()),this.model.showWeekend?r.push(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()):(o=h.indexOf(i.getDay()),o!=-1&&r.push(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()));cusomRenderDates=r.sort();this._customOrientation=cusomRenderDates.length>7?"horizontal":this.model.orientation}else{this._setCurrentDate&&this.model.orientation!="horizontal"&&(this.oldDate=this.currentDate(),this._renderStart.getTime()<this.currentDate().getTime()&&this._renderEnd.getTime()>this.currentDate().getTime()?this.currentDate(new Date(this._renderStart)):(this._renderStart=new Date(this.currentDate()),this._renderEnd=new Date(this._renderStart.getTime()+(this._renderDays-1)*864e5)));var l=this._renderDays<=7?new Date(this.currentDate()):this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this._firstweekdate(this.currentDate()):new Date(this.currentDate()),c=this._renderDays<=7?this._renderDays:this._numDays,i=new Date(l.getFullYear(),l.getMonth(),l.getDate());for(f=0;f<c;f++)i=new Date(i.getFullYear(),i.getMonth(),i.getDate()),this.model.showWeekend?r.push(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()):(o=h.indexOf(i.getDay()),o!=-1&&r.push(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime())),i.setDate(i.getDate()+1)}return this._intialRenderedDates.length==0&&(this._intialRenderedDates=r),r.length==0&&(r=this._intialRenderedDates),r},_getRenderDates:function(){var r,t,f,u,e;if(this.currentDate(new Date(new Date(this.currentDate()).setHours(0,0,0,0))),this._dateRender=[],this.currentView()==="week"||this.currentView()==="workweek"){if(this.model.showWeekend){r=this._firstweekdate(this.currentDate());do this._dateRender.push(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime()),r.setDate(r.getDate()+1);while(this._dateRender.length<7);this._renderDates=n.extend(!0,[],this._dateRender)}else{u=this._getWeekDays();t=this._firstweekdate(this.currentDate());do f=u.indexOf(t.getDay()),f!=-1&&this._dateRender.push(new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()),t=new Date(new Date(t).getTime()+864e5);while(this._dateRender.length!=this.model.workWeek.length);this._renderDates=n.extend(!0,[],this._dateRender)}if(this._resWorkWeek)this.dateRender=this._dateRender=this._resourceRenderDates();else if(this.currentView()=="workweek"&&this.model.showWeekend){var o=this,s=this._daysReorder(this._firstdayofweek),h=this.model.workWeek.map(function(n){return o._dayNamesArray.indexOf(n)}),c=s.filter(function(n){return h.indexOf(n)!==-1}),l=this._dateRender.map(function(n){if(c.indexOf(new Date(n).getDay())!=-1)return n});this._dateRender=l.filter(function(n){return n!=i})}}else this.currentView()==="month"?this._dateRender=this._monthdates():this.currentView()==="customview"?this._dateRender=this._resCustomView?this._resourceCustomDates():this._customviewRenderDates():(this.model.showWeekend||(u=this._getWeekDays(),u.indexOf(this.currentDate().getDay())==-1&&(e=this._getPrevNextDateCount(this.currentDate(),"next"),this.currentDate(new Date(this.currentDate().getTime()+864e5*e)))),this._dateRender.push(new Date(this.currentDate().getFullYear(),this.currentDate().getMonth(),this.currentDate().getDate()).getTime()));return this._dateRender}
10,_getAgendaDateCount:function(){var t=this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0,r;if(!this.model.showWeekend){var u=this._getWeekDays(),i=0,n=agendaDate=new Date(this.currentDate());do r=u.indexOf(n.getDay()),r!=-1&&i++,n=new Date(new Date(n).getTime()+864e5);while(this.model.agendaViewSettings.daysInAgenda!=i);t=(n.getTime()-agendaDate.getTime())/864e5-1}return t},_getCurrentDateHeaderValue:function(){var r,i=this._resWorkWeek?this._renderDates:this._dateRender,u,e,s,f,o;return this.currentView()==="day"?r=this._formatDateHeaderValue(new Date(i[0]),new Date(i[i.length-1])):this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()=="agenda"?(u=this.currentView()=="agenda"?new Date(this.currentDate()):new Date(i[0]),e=this.currentView()=="agenda"?new Date(new Date(this.currentDate()).setDate(u.getDate()+this._getAgendaDateCount())):new Date(i[i.length-1]),this.currentView()==="agenda"&&this._getAgendaDateCount()==0?(r=this._formatDateHeaderValue(u,null),s=0):r=this._formatDateHeaderValue(u,e)):this.currentView()==="customview"?i.length==1?this.model.dateFormat==""||t.isNullOrUndefined(this.model.dateFormat)?(f=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),r=f.toLowerCase().startsWith("d")?t.format(new Date(i[0]),"dd MMM yyyy",this.model.locale):f.toLowerCase().startsWith("m")?t.format(new Date(i[0]),"MMM dd, yyyy",this.model.locale):t.format(new Date(i[0]),f,this.model.locale)):r=t.format(new Date(i[0]),this.model.dateFormat,this.model.locale):i.length>1&&i.length<=7&&!this._resCustomView&&!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="object"?r=this._formatDateHeaderValue(new Date(i[0]),new Date(i[i.length-1])):(o=i,i=i.concat().sort(),r=new Date(i[0]).getFullYear()==new Date(i[i.length-1]).getFullYear()?new Date(i[0]).getMonth()==new Date(i[i.length-1]).getMonth()?t.format(new Date(i[0]),"MMM yyyy",this.model.locale):t.format(new Date(i[0]),"MMM",this.model.locale)+" - "+t.format(new Date(i[i.length-1]),"MMM yyyy",this.model.locale):t.format(new Date(i[0]),"MMM yyyy",this.model.locale)+" - "+t.format(new Date(i[i.length-1]),"MMM yyyy",this.model.locale),i=o):r=t.format(new Date(this.currentDate()),"MMM yyyy",this.model.locale),r},_firstweekdate:function(n){var t=new Date(n),i=t.getDay(),r;return this._firstdayofweek==0?i!=0&&(t.setDate(t.getDate()-i),!this.model.timeScale.enable&&(this.currentView()=="workweek"||this._oneWeek)&&this._resize&&(t=new Date(this._dateRender[0]))):this._firstdayofweek!=0&&(r=t.getDay()-this._firstdayofweek<0?7+t.getDay()-this._firstdayofweek:t.getDay()-this._firstdayofweek,t=new Date(t.setDate(t.getDate()-r))),t},_formatDateHeaderValue:function(n,i){var r,u;if(this.currentView()==="day"||this.currentView()==="agenda"&&this._getAgendaDateCount()==0)this.model.dateFormat==""||t.isNullOrUndefined(this.model.dateFormat)?(r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim(),u=r.toLowerCase().startsWith("d")?t.format(new Date(n),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?t.format(new Date(n),"MMM dd, yyyy",this.model.locale):t.format(new Date(n),r,this.model.locale)):u=t.format(new Date(n),this.model.dateFormat,this.model.locale);else{if(this.model.dateFormat!=""&&!t.isNullOrUndefined(this.model.dateFormat))return t.format(n,this.model.dateFormat,this.model.locale)+" - "+t.format(i,this.model.dateFormat,this.model.locale);r=this._pattern.D.toString().replace(/\s*dddd,?/,"").trim();u=r.toLowerCase().startsWith("d")?new Date(n).getYear()===new Date(i).getYear()?new Date(n).getMonth()===new Date(i).getMonth()?t.format(new Date(n),"dd",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):t.format(new Date(n),"dd MMM",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):t.format(new Date(n),"dd MMM yyyy",this.model.locale)+" - "+t.format(new Date(i),"dd MMM yyyy",this.model.locale):r.toLowerCase().startsWith("m")?new Date(n).getYear()===new Date(i).getYear()?new Date(n).getMonth()===new Date(i).getMonth()?t.format(new Date(n),"MMM dd",this.model.locale)+" - "+t.format(new Date(i),"dd, yyyy",this.model.locale):t.format(new Date(n),"MMM dd",this.model.locale)+" - "+t.format(new Date(i),"MMM dd, yyyy",this.model.locale):t.format(new Date(n),"MMM dd, yyyy",this.model.locale)+" - "+t.format(new Date(i),"MMM dd, yyyy",this.model.locale):t.format(new Date(n),r,this.model.locale)+" - "+t.format(new Date(i),r,this.model.locale)}return u},_getHeaderAllDayCellsCount:function(){var c,f,e,o=[],r=[],s,u=1,h,i;if(this.dateRender=[],this._value=[],this.value=[],this.model.orientation=="vertical"&&this._customOrientation=="vertical"){if(t.isNullOrUndefined(this.model.dateHeaderTemplateId)||this.currentView()=="month"||this._isCustomMonthView())for(e=this._getColumnCount().length,this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(h=this._getMultipleResourceCellsCount(e),u=h.resCount,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(u=1)),i=0;i<e;i++)s=this.currentView()==="month"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],f=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":"",c=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:s,currentDateClass:"",cellToday:""}: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:f}:{currentDay:s+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:"",cellToday:f}:{currentDay:s+" "+new Date(this._dateRender[i]).getDate(),currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:f},o.push(c),this._value.push(i);else o=this._getUserDateheaderTemplate(),this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(h=this._getMultipleResourceCellsCount(e),u=h.resCount,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(u=1));if(this._resWorkWeek||this._resCustomView)r=n.merge(r,o),this.dateRender=n.merge(this.dateRender,this._dateRender),this.value=n.merge(this.value,this._value);else for(i=0;i<u;i++)this.dateRender=n.merge(this.dateRender,this._dateRender),r=n.merge(r,o),this.value=n.merge(this.value,this._value)}else r=this._getHorizontalheaderCellCount(this._culture);return r},_findResourceIndex:function(n,i,r,u,f){var o,s,e;if(!t.isNullOrUndefined(r))for(o=r.toString().split(","),t.isNullOrUndefined(f)||(s=f.toString().split(",")),e=0;e<n.length;e++)if(t.isNullOrUndefined(f)){if(n[e][i]==r||n[e][i]==o[0])return e}else if((n[e][i]==r||n[e][i]==o[0])&&(n[e][u]===f||n[e][u]==s[0]))return e},_renderHeaderAllDayTemplate:function(){var i,g,w,nt,tt,b,k,e;if(this.currentView()!="agenda")if(t.scheduleFeatures.horizontal&&(this.model.orientation=="horizontal"||this._customOrientation=="horizontal"))this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._renderMultipleResourceHeaderTemplate(null,null),this._renderHorizontalHeaderBar();else{var s=t.buildTag("div.e-headerscrolldiv"),h=t.buildTag("div.e-headeralldaydiv","",{},{}).css({position:"relative",overflow:"hidden"}),c=0,l=t.buildTag("table.e-table e-headrealldaytable","",{},{}).css({width:"100%"}),u=t.buildTag("tbody"),d=t.buildTag("tr.e-dateheader"),f=this._getHeaderAllDayCellsCount(),e=this.headTemplate.render({cols:f,view:this.currentView(),colspan:1});this._tempResource.length!=0&&t.scheduleFeatures.resources&&(u=this._renderMultipleResourceHeaderTemplate(u,f),c=t.isNullOrUndefined(this.model.group)?0:this._grouping.length,this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length==0&&(c=0));var a=t.buildTag("div.e-navigate","",{},{}),v=t.buildTag("table.e-table e-headertable","",{},{}),y=t.buildTag("tbody"),p=t.buildTag("tr.e-headertr"),it=this.currentView()=="month"||this._isCustomMonthView()?1:2,r=c+it,o=[];for(i=0;i<r;i++)this.currentView()=="month"||this._isCustomMonthView()?o.push({tdClass:i==r-1?"e-monthleftcells":"e-resourceleftindentcells",divClass:i==r-1?"e-dateheadercell":""}):o.push({tdClass:i==r-1?"e-leftindent":i==r-2?"e-settingsindent":"e-resourceleftindentcells",divClass:i==r-1?"e-schedulesettings e-textellipsis":i==r-2?"e-dateheadercell":""});this.model.showAllDayRow||new t.DataManager(o).remove("tdClass","e-leftindent");g=this.leftIndent.render({trs:o});this.model.timeScale.enable?this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td.e-empty").addClass(this.currentView()=="month"||this._isCustomMonthView()?"e-monthempty":"").append(g)).append(t.buildTag("td").append(s.append(h.append(l.append(u.append(d.append(e))))))).append(t.buildTag("td.e-emptyscrolltd","",{},{}).css({width:this.currentView()=="month"||this._isCustomMonthView()?"0px":this._mediaQuery?"0px":"18px"}))))))):this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td").append(s.append(h.append(l.append(u.append(d.append(e))))))).append(t.buildTag("td.e-emptyscrolltd","",{},{}).css({width:this.currentView()=="month"||this._isCustomMonthView()?"0px":this._mediaQuery?"0px":"18px"})))))));this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable&&this.model.showAllDayRow&&(w=t.isNullOrUndefined(this.model.allDayCellsTemplateId)?!1:!0,w&&(nt=this._getUserAllDayCellsTemplate()),tt=this.alldayTemp.render({cols:f,colspan:1,userTemp:w,userHtml:nt}),u.append(t.buildTag("tr").append(tt)))}else{var a=t.buildTag("div.e-navigate","",{},{}),v=t.buildTag("table.e-table e-headertable","",{},{}),y=t.buildTag("tbody"),p=t.buildTag("tr.e-headertr"),s=t.buildTag("div.e-headerscrolldiv"),h=t.buildTag("div.e-headeralldaydiv","",{},{}).css({position:"relative",overflow:"hidden"}),l=t.buildTag("table.e-table e-headrealldaytable","",{},{}).css({width:"100%"}),u=t.buildTag("tbody tr"),f=[{headertext:this._getLocalizedLabels("Date"),className:"e-datecolumn"},{headertext:this._getLocalizedLabels("Time"),className:"e-timecolumn"},{headertext:this._getLocalizedLabels("Event"),className:"e-eventcolumn"}];if(this._tempResource.length!=0&&t.scheduleFeatures.resources){for(this._renderMultipleResourceHeaderTemplate(null,null),b=[],k=0;k<this.render_Resources.length;k++)b.push({headertext:"",className:"e-resourcecolumn"});t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length==0||(f=n.merge(b,f))}e=this.agendaheadTemplate.render({cols:f});this.aTR.append(t.buildTag("td").append(a.append(v.append(y.append(p.append(t.buildTag("td").append(s.append(h.append(l.append(u.append(e)))))).append(t.buildTag("td.e-emptyscrolltd","",{},{}).css({width:"18px"})))))))}t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderHeaderAllDayTemplate")},_getDateTime:function(n){var t=n,r,i;return(this._cellIndex=this.model.timeScale.enable?t.is(".e-workcells, .e-alldaycells, .e-horizontmonthheaderdaytd")||this._isCustomMonthView()&&this._oneWeek?t.index():7-((parseInt(t.index()/7)+1)*7-t.index())+t.parent().index()*7:this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?7-((parseInt(t.index()/7)+1)*7-t.index())+t.parent().index()*7:t.index(),(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):this._cellIndex:t.index(),this._workCellIndex=t.parent().index()),r=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"&&this._customOrientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this._resWorkWeek||this._resCustomView?this._dateRender:this.dateRender:this._dateRender,r=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:r,i=new Date(r[this._cellIndex]),this.model.minDate>i||this.model.maxDate<i)?!1:(t.hasClass("e-workcells")&&this.model.showTimeScale&&this.currentView()!=="month"&&!this._isCustomMonthView()?this._calcCurrentTime(i,t,""):(this.cur_StartTime=new Date(new Date(i).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(i).setHours(23,59,59))),t.hasClass("e-horizontmonthheaderdaytd")?{startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,currentDate:i,cellIndex:this._cellIndex}:{startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,currentDate:i,cellIndex:this._cellIndex,resources:this._tempResource.length!=0?this._getResourceValue(t,this._cellIndex):null})},_getAgendaAppointment:function(i){var r=[],o,u,f,s,e;if(i.hasClass("e-datecolumn")){if(o=n(i).attr("rowspan"),u=n(i).parent().nextAll("tr").andSelf().slice(0,parseInt(o)),u.length>0)for(f=0;f<u.length;f++)s=n(u[f]).find(".e-eventcolumn .e-agendaappointment").attr("data-guid"),r.push(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,s))[0])}else r=i.hasClass("e-agendaappointment")?i:i.parent().find(".e-agendaappointment"),e=r.attr("data-guid"),this._mediaQuery&&(this._mAppId=e),r=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,e));return r},_monthdates:function(){var r=new Date(this.currentDate()),u=r._currentMonthDates(),t=u.start._currentWeekDates(this._firstdayofweek).start,e=u.end._currentWeekDates(this._firstdayofweek).end,f,i,o,n,s;this.model.showWeekend||this.model.showNextPrevMonth||(f=this._excludePrevMonthDates(u),t=f.start,e=f.end);i=[];this.monthDays=[];o=this._getWeekDays();n=new Date(t.getFullYear(),t.getMonth(),t.getDate());do this.model.showWeekend?(i.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()),new Date(r).getMonth()===new Date(n).getMonth()&&this.monthDays.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime())):(s=o.indexOf(new Date(n).getDay()),s!=-1&&(i.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()),new Date(r).getMonth()===new Date(n).getMonth()&&this.monthDays.push(new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime()))),n.setDate(n.getDate()+1);while(n.getTime()<=e.getTime());return this.model.orientation=="vertical"&&this._customOrientation=="vertical"?i:this.monthDays},_excludePrevMonthDates:function(n){var r=new Date(n.start),u=new Date(n.end),e=this._getWeekDays(),s=function(n,t){return n.filter(function(n){return t.indexOf(new Date(n).getDay())!=-1}).map(function(n){return new Date(n).getMonth()})},i=r._currentWeekDates(this._firstdayofweek),f=this._getWeekDates(i.start,i.end),o=s(f,e),t;if(o.indexOf(r.getMonth())==-1){t=new Date(i.end);do t=new Date(t.setDate(t.getDate()+1));while(e.indexOf(t.getDay())==-1);r=new Date(t)}else r=new Date(f[0]);if(i=u._currentWeekDates(this._firstdayofweek),f=this._getWeekDates(i.start,i.end),o=s(f,e),o.indexOf(u.getMonth())==-1){t=new Date(i.start);do t=new Date(t.setDate(t.getDate()-1));while(e.indexOf(t.getDay())==-1);u=new Date(t)}else u=new Date(f.slice(-1)[0]);return{start:r,end:u}},_getWeekDates:function(n,t){for(var r=[],i=n;i<=t;)r.push(new Date(i).getTime()),i=new Date(i.setDate(i.getDate()+1));return r},_getStartEndTime:function(){var i=[],f,u,e,o,r,n;if(this._timeInitial=0,u=this._culture.calendar,this.model.orientation==="vertical"&&this._customOrientation==="vertical")if(this.currentView()=="month"||this._isCustomMonthView())for(e=this._dateRender.length,o=this.model.showWeekend?7:this.model.workWeek.length,n=0;n<e/o;n++)i.push(n);else if(t.isNullOrUndefined(this.model.timeScale.majorSlotTempla
10teId))for(r=new Date((new Date).setHours(0,0,0,0)),n=this.model.startHour*60;n<this.model.endHour*60;)this._timeMode=="12"?new Date(new Date(r).setHours(this.model.endHour,0,0,0)).getTime()>new Date(new Date(r).setHours(0,n,0,0)).getTime()&&(f=(n/60===this.model.startHour||n/60==12)&&u.AM&&u.PM?t.format(new Date(new Date(r).setHours(0,n,0,0)),"hh tt",this.model.locale):t.format(new Date(new Date(r).setHours(0,n,0,0)),"hh mm",this.model.locale),i.push({time:f,id:n/60})):i.push({time:new Date(new Date(r).setHours(0,n,0,0)).toTimeString().slice(0,5)+" 00"}),n=n+this.model.timeScale.majorSlot;else i=this._getUserTimeCellsTemplate();else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&(i=this._getHoriStartEndTime(u));return i},_getWorkCellsCount:function(){var t=[],u=this.model.showWeekend?7:this.model.workWeek.length,f,r,i,n;if(this.model.timeScale.enable)if(this.currentView()=="month"||this._isCustomMonthView())for(i=this._dateRender.length,n=0;n<i/u;n++)t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});else for(f=this._getStartEndTime(),r=0,n=0;n<this.model.timeScale.minorSlotCount*f.length;n++)if(r=r+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,r>(this.model.endHour-this.model.startHour)*60){t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});break}else t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});else for(i=this._resWorkWeek||this._resCustomView?1:this._dateRender.length,n=0;n<i/u;n++)t.push({crow:n,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});return t},_renderContentAreaTemplate:function(){var n=t.buildTag("div.e-workareadiv"),i=t.buildTag("table.e-table e-worktable","",{},{}),r=t.buildTag("tbody"),u=t.buildTag("tr"),f=t.buildTag("td"),e=t.buildTag("div#"+this._id+"_scroller"),c,v;if(this.$WorkCellDiv=t.buildTag("div.e-draggableworkarea"),this.currentView()!="agenda")if(t.scheduleFeatures.horizontal&&(this.model.orientation=="horizontal"||this._customOrientation=="horizontal"))this._renderHorizontalContent(n,i,r,u,f,e);else{this.$TimeCellTD=t.buildTag("td","",{},{}).addClass(this.currentView()=="month"||this._isCustomMonthView()?"e-monthleftindent":"e-workleftindent");var l,a,o=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId)?!0:!1,s=t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?!1:!0,y=this.currentView()=="month"||this._isCustomMonthView()?1:0,h=this._timeSlot
10Count(o,s);(o||s)&&this.currentView()!="month"&&!this._isCustomMonthView()?(h.columnCount.pop(),l=this.userTimeCellTemplate.render({timerows:this._getStartEndTime(),cols1:h.columnCount,viewclass:y,timeScale:this.model.timeScale.minorSlotCount,cheight:this.model.cellHeight,userTemplateId:o,timeValue1:h.timeValue1,template:s})):l=this.timeCellTemplate.render({timerows:this._getStartEndTime(),cols1:h.columnCount,viewclass:y,timeScale:this.model.timeScale.minorSlotCount,userTemplateId:o,template:s});c=t.isNullOrUndefined(this.model.workCellsTemplateId)?!1:!0;c&&(v=this._getUserWorkCellsTemplate());a=this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?this.workcellTemp.render({cellrows:this._getWorkCellsCount(),cols1:this.value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:c,userHtml:v}):this.monthcellTemp.render({cellrows:this._getWorkCellsCount(),cols1:this.value,orientation:this.model.orientation,timeScale:this.model.timeScale.minorSlotCount,userTemplate:c,userHtml:v,tenable:this.model.timeScale.enable,cview:this.currentView()!=="month"&&!this._isCustomMonthView()});this.model.timeScale.enable?this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(this.$TimeCellTD.append(l)).append(f.append(e.append(this.$WorkCellDiv.append(a))))))))):this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv.append(a)))))))))}else this.wTR.append(t.buildTag("td").append(n.append(i.append(r.append(u.append(f.append(e.append(this.$WorkCellDiv))))))));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderContentAreaTemplate")},_renderQueryCellInfo:function(i,r,u){var it,c,v,y,ft,et,p,ht,ct,w,nt,tt,o,l,h,f,e,s;if(i=="renderHeaderBar"&&this._trigger("queryCellInfo",{element:u,requestType:"headerBar"}),i=="appointment"&&this._trigger("queryCellInfo",{appointment:r,element:u,requestType:"appointment"}),i=="blockAppointment"&&this._trigger("queryCellInfo",{appointment:r,element:u,requestType:"blockoutCells"}),i=="emptycell"&&(it=this.aTR.find(".e-emptyscrolltd"),this._trigger("queryCellInfo",{element:n(it[0]),requestType:"emptytd"})),i=="renderAgendaContent"){for(c=this.aTR.find(".e-headercells"),f=0;f<c.length;f++)this._trigger("queryCellInfo",{element:n(c[f]),cellType:"agendaheadercells",requestType:"agendacells"});var b=this.element.find(".e-draggableworkarea").find(".e-datecolumn"),k=this.element.find(".e-draggableworkarea").find(".e-timecolumn"),d=this.element.find(".e-draggableworkarea").find(".e-eventcolumn");if(this._tempResource.length!=0)for(v=this.element.find(".e-draggableworkarea").find(".e-resourcecolumn"),f=0;f<v.length;f++)e=this._getAgendaAppointment(n(v[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(v[f]),cellType:"agendaresourcecell",requestType:"agendacells"});for(f=0;f<b.length;f++)e=this._getAgendaAppointment(n(b[f])),this._trigger("queryCellInfo",{currentAppointmentDate:new Date(new Date(e[0][this._appointmentSettings.startTime]).setHours(0,0,0)),appointments:e,element:n(b[f]),cellType:"agendadatecell",requestType:"agendacells"});for(f=0;f<k.length;f++)e=this._getAgendaAppointment(n(k[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(k[f]),cellType:"agendatimecell",requestType:"agendacells"});for(f=0;f<d.length;f++)e=this._getAgendaAppointment(n(d[f])),this._trigger("queryCellInfo",{appointment:e[0],element:n(d[f]),cellType:"agendaeventcell",requestType:"agendacells"})}else if(i=="renderHeaderAllDayTemplate")if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"){var c=this.aTR.find(".e-headercells"),rt=this.res1,ut=this._getHeaderAllDayCellsCount();if(this.res1=rt,this.model.showAllDayRow)for(y=this.aTR.find(".e-alldaycells"),f=0;f<y.length;f++)e=this._getDateTime(n(y[f])),s={cellIndex:e.cellIndex,currentDate:e.currentDate,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(y[f]),requestType:"alldaycells"});if(this.currentView()!="agenda")for(ft=c.length/this.res1.length,f=0;f<c.length;f++)et=Math.floor(f/ft),this._trigger("queryCellInfo",{resource:this.res1[et],currentDay:ut[f].currentDay,element:n(c[f]),requestType:"headercells"});if(this._tempResource.length!=0){var l=[],ot=this.aTR.find(".e-resourcecells"),st=this.aTR.find(".e-resourceleftindentcells");for(p=0;p<this._tempResource.length;p++)n.merge(l,this._tempResource[p].resourceSettings.dataSource);for(f=0;f<ot.length;f++)this._trigger("queryCellInfo",{resource:l[f],element:n(ot[f]),cellType:"headercells",requestType:"resourceheadercells"});for(f=0;f<st.length;f++)this._trigger("queryCellInfo",{element:n(st[f]),cellType:"headerdivcells",requestType:"resourceheadercells"})}this.currentView()=="month"&&this._isCustomMonthView()||(ht=this.aTR.find(".e-leftindent"),this._trigger("queryCellInfo",{element:ht,requestType:"leftindentcells"}));ct=this.currentView()=="month"||this._isCustomMonthView()?this.aTR.find(".e-monthleftcells"):this.aTR.find(".e-settingsindent");this._trigger("queryCellInfo",{element:ct,requestType:"leftheadercells"})}else{var lt=this.aTR.find(".e-headercells"),rt=this.res1,ut=this._getHeaderAllDayCellsCount();this.res1=rt;
10var at=this.aTR.find(".e-horizontaltimetd "),a=this.aTR.find(".e-horizontalalternatetd"),g=this._getStartEndTime();for(f=0;f<at.length;f++)this._trigger("queryCellInfo",{cell:g[f],element:n(at[f]),cellType:"timecell",requestType:"timecells"});for(f=0;f<a.length;f++)this._trigger("queryCellInfo",{element:n(a[f]),cellType:"timeampmcell",requestType:"timecells"});if(this.currentView()!="agenda")for(f=0;f<lt.length;f++)this._trigger("queryCellInfo",{currentDay:ut[f].currentDay,element:n(lt[f]),requestType:"headercells"});for(w=this.aTR.find(".e-horizontmonthheaderdaytd"),f=0;f<w.length;f++)e=this._getDateTime(n(w[f])),s={cellIndex:e.cellIndex,currentDate:e.currentDate},this._trigger("queryCellInfo",{cell:s,element:n(w[f]),requestType:"headerdate"});if(this._tempResource.length!=0)for(nt=this.aTR.find(".e-horizontalheader"),f=0;f<nt.length;f++)this._trigger("queryCellInfo",{element:n(nt[f]),requestType:"resourcegroupheader"})}else if(i=="renderContentAreaTemplate")if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"){for(a=this.wTR.find(".e-timecelldivs"),timeCellAMPM=this.wTR.find(".e-ampmdisplay"),g=this._getStartEndTime(),this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?(o=this.wTR.find(".e-workcells"),tt="workcells"):(o=this.wTR.find(".e-monthcells"),tt="monthcells"),f=0;f<a.length;f++)this._trigger("queryCellInfo",{cell:g[f],element:n(a[f]).parent(),cellType:"timecell",requestType:"timecells"});for(f=0;f<timeCellAMPM.length;f++)this._trigger("queryCellInfo",{element:n(timeCellAMPM[f]),cellType:"timeampmcell",requestType:"timecells"});for(f=0;f<o.length;f++)e=this._getDateTime(n(o[f])),s=this.currentView()!="month"&&this.currentView()!="customview"&&this.model.timeScale.enable?{cellIndex:e.cellIndex,startTime:e.startTime,endTime:e.endTime,resources:e.resources}:{cellIndex:e.cellIndex,currentDate:e.currentDate,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(o[f]),requestType:tt})}else{if(o=t.isNullOrUndefined(this.$WorkCellDiv)?null:this.$WorkCellDiv.find(".e-workcells"),this._tempResource.length!=0&&!t.isNullOrUndefined(this.$WorkCellDiv)){for(l=this._resourceSort(),h=this.wTR.find(".e-horizontresheaderdiv"),f=0;f<h.length;f++)this._trigger("queryCellInfo",{resource:l[n(h[f]).index()],element:n(h[f]),cellType:"headerdivcells",requestType:"resourceheadercells"});for(f=0;f<h.length;f++)this._trigger("queryCellInfo",{resource:l[n(n(h[f]).parent()).index()],element:n(h[f]),cellType:"headercells",requestType:"resourceheadercells"})}if(!t.isNullOrUndefined(o))for(f=0;f<o.length;f++)n(o[f]).hasClass("e-childworkcell")&&n(o[f]).hasClass("e-workcells")&&(e=this._getDateTime(n(o[f])),s={cellIndex:e.cellIndex,startTime:e.startTime,endTime:e.endTime,resources:e.resources},this._trigger("queryCellInfo",{cell:s,element:n(o[f]),requestType:"workcells"}))}},_timeSlotCount:function(i,r){var e=0,o=[],a=[],h,v,f,c,u,l;if((i||r)&&this.currentView()!=="month"&&!this._isCustomMonthView()){for(u=0;u<this.model.timeScale.minorSlotCount;u++)o.push(u);c=o}else{for(h=this._getStartEndTime(),v=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.model.timeScale.minorSlotCount:this.model.timeScale.minorSlotCount-1,f=0;f<h.length;f++){for(u=0;u<v;u++)if(e=e+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,e>(this.model.endHour-this.model.startHour)*60){if(o.push(u),u==this.model.timeScale.minorslotcount-2){e=0;break}}else o.push(u);a.push(o);e=e+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;o=[]}c=a}if((i||r)&&this.currentView()!=="month"&&!this._isCustomMonthView()){var y=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),p=n.templates(n(this.model.timeScale.majorSlotTemplateId).html()),w=[],f=0;for(u=this.model.startHour;u<this.model.endHour;){for(var s=[],e=this.model.timeScale.majorSlot+f,b=f;f<e;)l=f,f=f*6e4,this._timeMode=="12"?l!=b||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?s.push(y.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):s.push(p.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):l!=b||t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)?s.push(y.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()):s.push(p.render(object={date:new Date(new Date(this._dateRender[0]).setHours(u,0,0,f))}).trim()),f=f/6e4+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount;u=this.model.timeScale.majorSlot>60?u+this.model.timeScale.majorSlot/60:f>=60?u+1:u;f=t.isNullOrUndefined(f)?0:f%60;w.push(s)}r=!0}return{columnCount:c,timeValue1:w,strTime:h}},_renderAgendaContent:function(){var a,s,o,f,it,c,p,rt,w,ut,bt,h,kt,dt,e,i,ti,u,n,v,y,l,ft;this.element.find(".e-agendacellstab").remove();var r=new Date(new Date(this.currentDate()).setHours(0,0,0,0)),b=[],et=[],ot,st,ht,ct,lt,k,at,d,vt,g,yt,nt,pt,tt,wt;for(this.model.group||(this.res1=["0"]),a=this._getLocalizedLabels("Recurrence"),s=this._getAgendaDate
10Count(),o=0;o<this.res1.length;o++){if(e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(r)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(new Date(r).setDate(r.getDate()+s)).setHours(23,59,59))),e=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[o][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,f=new t.DataManager(this._processed).executeLocal((new t.Query).where(e)),f=this._appointmentSort(f),!this.model.showWeekend){for(it=[],c=0;c<f.length;c++)f[c][this._appointmentSettings.startTime].getDay()!==0&&f[c][this._appointmentSettings.startTime].getDay()!==6&&it.push(f[c]);f=it}if(this._currentViewAppointments=this.getCurrentViewAppointments(),f.length>0){if(p=[],!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources){for(rt=this.res1[o][this._tempResource[this._tempResource.length-1].resourceSettings.groupId],u=this._resCollection,n=u.length-1;n>0;n--)w=new t.DataManager(u[n-1].dataSource).executeLocal((new t.Query).where(u[n-1].id,t.FilterOperators.equal,rt)),p.push({resId:"resLevel_"+n+"_"+w[0][u[n-1].id],text:w[0][u[n-1].text]}),rt=w[0][u[n-1].groupId];p.reverse()}for(ut=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?!0:!1,bt=f.length,tt=this.model.resourceHeaderTemplateId?!0:!1,wt=tt?this._getResourceHeadTemplate(this.res1[o]):"",h=0,new Date(r)<this.model.minDate&&(h=Math.floor((new Date(this.model.minDate)-new Date(r))/864e5)),new Date(new Date(r).setDate(r.getDate()+s))>this.model.maxDate&&(s=s-Math.floor((new Date(new Date(r).setDate(r.getDate()+s))-new Date(this.model.maxDate))/864e5));h<=s;h++)if((this.model.showWeekend||(kt=this._getWeekDays(),dt=new Date(new Date(r).setDate(r.getDate()+h)),kt.indexOf(dt.getDay())!=-1))&&(e=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(r).setDate(r.getDate()+h))).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(new Date(r).setDate(r.getDate()+h)).setHours(23,59,59))),e=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[o][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,i=new t.DataManager(f).executeLocal((new t.Query).where(e)),i=this._resourceOrderSort(i),i.length>0)){b.push(b.length+1);var ii=i.length,gt=!0,ni=!1;for(n=0;n<i.length;n++)n==i.length-1&&(ni=!0),ot=this._timeMode=="12"?t.format(i[n][this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[n][this._appointmentSettings.startTime],"HH:mm",this.model.locale),st=this._timeMode=="12"?t.format(i[n][this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[n][this._appointmentSettings.endTime],"HH:mm",this.model.locale),ht="<strong class='e-agendaday'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"dd",this.model.locale)+"<\/strong><span class='e-agendaweek'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"dddd",this.model.locale)+"<\/span><span class='e-agendamonth'>"+t.format(new Date(i[n][this._appointmentSettings.startTime]),"MMM, yyyy",this.model.locale)+"<\/span>",ct=!t.isNullOrUndefined(i[n][this._appointmentSettings.allDay])&&JSON.parse(i[n][this._appointmentSettings.allDay])?"<div class='e-icon e-circle e-scheduleallday'><\/div>"+this._getLocalizedLabels("AllDay"):ot+" - "+st,lt=!t.isNullOrUndefined(i[n][this._appointmentSettings.recurrence])&&JSON.parse(i[n][this._appointmentSettings.recurrence])?i[n][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?"<span class='e-icon e-schedulerepeatedit' title='"+a+"'/>
10"+i[n][this._appointmentSettings.subject]:"<span class='e-icon e-schedulerepeat' title='"+a+"'/>"+i[n][this._appointmentSettings.subject]:i[n][this._appointmentSettings.subject],k=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(i[n][this._appointmentSettings.categorize])&&i[n][this._appointmentSettings.categorize]!=""?this._getCategorizeColor(i[n]):this._tempResource.length!=0&&t.scheduleFeatures.resources?this._getResourceColor(i[n]):{appointData:"",appointCustomcss:"",appointtextcolor:""},at=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&this._tempResource.length!=0?this.res1[o][this._tempResource[this._tempResource.length-1].resourceSettings.text]:"",d=this.model.appointmentTemplateId?!0:!1,vt=d?i[n][this._appointmentSettings.recurrence]?i[n][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?"<span class='e-icon e-schedulerepeatedit' title='"+a+"'/>"+this._getUserAppointmentTemplate(i[n]):"<span class='e-icon e-schedulerepeat' title='"+a+"'/>"+this._getUserAppointmentTemplate(i[n]):this._getUserAppointmentTemplate(i[n]):"",g=this.model.agendaViewSettings.dateColumnTemplateId?!0:!1,yt=g?this._getUserTemplate(this.model.agendaViewSettings.dateColumnTemplateId,i[n]):"",nt=this.model.agendaViewSettings.timeColumnTemplateId?!0:!1,pt=nt?this._getUserTemplate(this.model.agendaViewSettings.timeColumnTemplateId,i[n]):"",et.push({readOnly:this.model.readOnly,allowDelete:this.model.allowDelete,edittext:this._getLocalizedLabels("Edit"),deletetext:this._getLocalizedLabels("Delete"),userResourceId:tt,userResourceHtml:wt,userDateId:g,userDateHtml:yt,userTimeId:nt,userTimeHtml:pt,userAppTemplId:d,userTemplate:vt,resGroup:p,resName:at,resChild:ut,resRowSpan:bt,id:i[n].AppTaskId,uid:i[n].Guid,dayRowSpan:i.length,dayChild:gt,dayBorderBottom:ni,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!k.applyFilter?!0:!1,background:k.appointData,date:ht,time:ct,event:lt}),gt=!1,ut=!1}}}if(ti=this.agendacellTemp.render({rows:b,cols:et}),this.element.find(".e-draggableworkarea").append(ti),!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)for(u=this.render_Resources,n=0;n<u.length-1;n++)for(v=0;v<u[n].length;v++)y="resLevel_"+(n+1)+"_"+u[n][v][this._resCollection[n].id],this.element.find("."+y).first().attr("rowspan",this.element.find("."+y).length),this.element.find("."+y).slice(1).addClass("e-hide"),this.element.find(".e-hide").remove(),this.model.resourceHeaderTemplateId&&this.element.find("."+y).children().empty().append(this._getResourceHeadTemplate(u[n][v]));l=this.element.find("div#"+this._id+"_scroller");t.isNullOrUndefined(l.data("ejScroller"))&&(l.ejScroller({enableRTL:this.model.enableRTL,height:this.scHeight-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top)-1,width:parseInt(this.element.width())-2,cssClass:this.model.cssClass}),this._mediaQuery||this._nextPrevAppointment(this.model.showAppointmentNavigator));l.ejScroller("refresh");ft=this.model.enableRTL?"e-borderright":"e-borderleft";l.ejScroller("isVScroll")?this.element.find(".e-emptyscrolltd").addClass(ft).show()&&this.element.find(".e-draggableworkarea").height(this.element.find(".e-draggableworkarea").height()+1):this.element.find(".e-emptyscrolltd").removeClass(ft).hide();this.element.find(".e-vscroll").css("left",this.model.enableRTL?0:this.element.outerWidth()-(l.ejScroller("isVScroll")?19:0));this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);this.element.find(".e-headeralldaydiv").width(this.element.find(".e-draggableworkarea").width());this.model.showAppointmentNavigator&&this._nextPrevButton();t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("renderAgendaContent")},_getUserTemplate:function(t,i){var r=n.extend(r,i);return r.View=this.currentView(),n.templates(n(t).html()).render(r)},_getColumnCount:function(){var t=[],i=this.currentView()==="month"||this._isCustomMonthView()?this._isCustomMonthView()?this._renderDays<=7?this._renderDays:this.model.showWeekend?7:this.model.workWeek.length:this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length,n;for(this._resCustomView&&this.currentView()=="customview"&&(i=this._dateRender.length),n=0;n<i;n++)t.push(n);return t},_bindAppointmentsData:function(i){if(t.isNullOrUndefined(this.model.appointmentSettings)||this.dataSource()==null)this.model.showAppointmentNavigator&&this._nextPrevButton();else if(this.model.enablePersistence&&(this.model.appointmentSettings.query=new t.Query,this._enablePersist=!0),!this.dataSource()instanceof t.DataManager&&this.dataSource().dataSource.offline&&this._dateFormat(this.dataSource()),this.dataSource()instanceof t.DataManager&&!this.dataSource().dataSource.offline)this._initDataSource(i);else{this._bindAppointments=this.dataSource().length>0?!0:!1;var r=i=="Refresh"?!1:this._viewchange;this._angular=this._bindAppointments&&!this._bindapp&&!this._setmodelvalue&&r==!0&&this._obj.length>0&&this.dataSource()[0][this._appointmentSettings.id]==this._obj[0][this._appointmentSettings.id];this._true=this.model.isDST?!0:!1;this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&!this.model.isDST?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0;this._currentAppointmentData=this.dataSource();n.extend(!0,this._obj=[],this.dataSource());!t.isNullOrUndefined(this.dataSource().dataSource)&&this.dataSource().dataSource.json&&(this._currentAppointmentData=this.dataSource().dataSource.json);this._dataCount=this._currentAppointmentData.length;
10this._dataCount==0&&(this._processed=[],this._currentViewAppointments=[]);this._dataCount>0&&(this._dataProcessing(this._currentAppointmentData),this.element.children().length>0&&this._renderAppointmentAll());this.model.showAppointmentNavigator&&this._nextPrevButton();this.tzone=this.model.timeZone;this._bindapp=!1;this._setmodelvalue=!1;this._viewchange=!1}},_initDataSource:function(i){var f,e,s,h,o,l,u,r,c;if(this._trigger("actionBegin",{currentAction:i,requestType:"dataBinding"}),f=this._columnToSelect(this.model.appointmentSettings,i),e=n.extend(!0,[],f._params),this._true=this.model.isDST?!0:!1,this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&!this.model.isDST?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0,f._params=[],(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()=="customview")s=new Date(new Date(this._dateRender[0]).setHours(0,0,0)),h=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(0,0,0)),f.addParams("StartDate",s).addParams("EndDate",h);else for(o=new Date(new Date(this.currentDate()).setHours(0,0,0)),l=new Date(o.getTime()+-this._timeZoneCalculate()*6e4),f.addParams("CurrentDate",o).addParams("CurrentView",this.currentView()).addParams("CurrentAction",i),u=0;u<e.length;u++)e[u].key!="CurrentDate"&&e[u].key!="CurrentView"&&e[u].key!="CurrentAction"&&f.addParams(e[u].key,e[u].value);r=this;c=this.dataSource().executeQuery(f);c.done(function(n){r._dataCount=n.result.length;t.isNullOrUndefined(n.result.result)||(r._dataCount=n.result.count+1,n.result=n.result.result);r._bindAppointments=n.result.length>0?!0:!1;r._currentAppointmentData=n.result;r._dataProcessing(n.result);r._renderAppointmentAll();r.model.showAppointmentNavigator&&r._nextPrevButton();r._trigger("actionComplete",{requestType:"dataBound"})});this.model.showAppointmentNavigator&&this._nextPrevButton()},_bindCategorizeData:function(){t.isNullOrUndefined(this.model.categorizeSettings)||(this._categoryInfo=[],!t.isNullOrUndefined(this.model.categorizeSettings.query)&&this.model.categorizeSettings.query instanceof t.Query||(this.model.categorizeSettings.query=t.Query()),this.model.categorizeSettings.dataSource instanceof t.DataManager?this._initCategorizeData(this.model.categorizeSettings):this._categoryInfo.push(this.model.categorizeSettings))},_initCategorizeData:function(n){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){t.isNullOrUndefined(i._appointmentAddWindow)&&i._renderAppointmentWindow();n.dataSource=r.result;i._categoryInfo.push(n);i._renderCategoryItems(i._appointmentAddWindow)})},_bindPriorityData:function(){t.isNullOrUndefined(this.model.prioritySettings)||(this._priorityInfo=[],!t.isNullOrUndefined(this.model.prioritySettings.query)&&this.model.prioritySettings.query instanceof t.Query||(this.model.prioritySettings.query=t.Query()),this.model.prioritySettings.dataSource instanceof t.DataManager?this._initPriorityData(this.model.prioritySettings):this._priorityInfo.push(this.model.prioritySettings))},_initPriorityData:function(n){var r=this._columnToSelect(n),i=this,u=n.dataSource.executeQuery(r);u.done(function(r){t.isNullOrUndefined(i._appointmentAddWindow)&&i._renderAppointmentWindow();n.dataSource=r.result;i._priorityInfo.push(n);
10i._renderPriorityItems(i._appointmentAddWindow)})},_bindBlockData:function(){if(!t.isNullOrUndefined(this.model.blockoutSettings)&&(!t.isNullOrUndefined(this.model.blockoutSettings.query)&&this.model.blockoutSettings.query instanceof t.Query||(this.model.blockoutSettings.query=t.Query()),this.model.blockoutSettings.dataSource instanceof t.DataManager)){var i=this._columnToSelect(this.model.blockoutSettings),n=this,r=this.model.blockoutSettings.dataSource.executeQuery(i);r.done(function(t){n.model.blockoutSettings.dataSource=t.result;n._renderBlockAppointments()})}},_dateFormat:function(n){if(n.length>0&&new Date(n[0][this._appointmentSettings.startTime]).toString()=="Invalid Date")for(var t=0,i=n.length;t<i;t++)n[t][this._appointmentSettings.startTime]=(new Date).parseISO8601(n[t][this._appointmentSettings.startTime]),n[t][this._appointmentSettings.endTime]=(new Date).parseISO8601(n[t][this._appointmentSettings.endTime])},_columnToSelect:function(n){var i=t.Query();return t.isNullOrUndefined(n.tableName)||this.dataSource().dataSource.url.match(n.tableName+"$")?i=n.query:(i=n.query,i.from(n.tableName)),i},_getColumns:function(n){var r=[];for(var i in n)i!=="tableName"&&i!=="query"&&i!=="dataSource"&&(t.isNullOrUndefined(n[i])||r.push(n[i]));return r},_sortAppById:function(n){return n.sort(function(n,t){var i=n.AppTaskId,r=t.AppTaskId;return i<r?-1:i>r?1:0}),n},_stdTimezoneOffset:function(){return Math.max(new Date((new Date).getFullYear(),0,1).getTimezoneOffset(),new Date((new Date).getFullYear(),6,1).getTimezoneOffset())},_timeZoneCalculate:function(){var i,r,u,o,s,f,h,c,l,e=(new Date)._isDST()&&!this.model.isDST?-(new Date).getTimezoneOffset()+this._timeZoneOffset:-(new Date).getTimezoneOffset();return i=e,t.isNullOrUndefined(this.model.timeZone)||(this.model.timeZone.indexOf(":")!==-1?(t.isNullOrUndefined(this.tzone)&&(this.tzone=this.model.timeZone),r=this.model.timeZone.split(" ")[this.model.timeZone.split(" ").length-1].split(":"),u=this.tzone.split(" ")[this.tzone.split(" ").length-1].split(":"),n.isNumeric(parseInt(r[0]))&&parseInt(r[0]).toString.length<=2||r[0].indexOf("UTC")!==-1?(o=this.model.timeZone.indexOf("-")!==-1?-parseInt(r[0].replace(/\D/g,"")):parseInt(r[0].replace(/\D/g,"")),s=parseInt(r[1]),f=-(o*60+s),this._setmodelvalue==!0?this.tzone==this.model.timeZone?i=-(-e+f):(h=this.tzone.indexOf("-")!==-1?-parseInt(u[0].replace(/\D/g,"")):parseInt(u[0].replace(/\D/g,"")),c=parseInt(u[1]),l=-(h*60+c),i=-(-l+f)):i=-f):i=-e):i=-e),i},_timeZoneAppointments:function(i,r){var s,h,u,f,e,c;if(this.model.appointmentSettings.applyTimeOffset){if(i[this._appointmentSettings.allDay]&&this._dataManager.dataSource.offline)i[this._appointmentSettings.startTime]=new Date(i[this._appointmentSettings.startTime]),i[this._appointmentSettings.endTime]=new Date(i[this._appointmentSettings.endTime]);else{if(t.isNullOrUndefined(this._dayLight)?(u=i[this._appointmentSettings.startTimeZone],f=i[this._appointmentSettings.endTimeZone],t.isNullOrUndefined(f)&&!t.isNullOrUndefined(u)&&(i[this._appointmentSettings.endTimeZone]=f=u),!t.isNullOrUndefined(f)&&t.isNullOrUndefined(u)&&(i[this._appointmentSettings.startTimeZone]=u=f),t.isNullOrUndefined(u)||t.isNullOrUndefined(f)||(u=u.indexOf("UTC")!=-1?parseInt(u.split(" ")[1].split(":")[0])*60+parseInt(u.split(" ")[1].split(":")[1]):parseInt(u.split(":")[0])*60+parseInt(u.split(":")[1]),f=f.indexOf("UTC")!=-1?parseInt(f.split(" ")[1].split(":")[0])*60+parseInt(f.split(" ")[1].split(":")[1]):parseInt(f.split(":")[0])*60+parseInt(f.split(":")[1])),e=t.isNullOrUndefined(u)&&!n.isNumeric(u)?this._timeZoneCalculate(i):u-this._timeZoneCalculate(i)):e=this._timeValue,e=r==""?-e:e,!this._dataManager.dataSource.offline&&!t.isNullOrUndefined(i[this._appointmentSettings.startTimeZone])){var l=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone,a=(new Date)._isDST()&&!this.model.isDST?(new Date).getTimezoneOffset()+this._timeZoneOffset:(new Date).getTimezoneOffset(),o=this._dataProcess?i[this._appointmentSettings.startTimeZone]:i[this._appointmentSettings.startTimeZone]!=l?l:i[this._appointmentSettings.startTimeZone];o=o.indexOf("UTC")!=-1?parseInt(o.split(" ")[1].split(":")[0])*60+parseInt(o.split(" ")[1].split(":")[1]):parseInt(o.split(":")[0])*60+parseInt(o.split(":")[1]);c=this._dataProcess?a- -o:-(a- -o);(new Date)._isDST()&&this.model.timeZone==null&&!this._dataProcess&&this.model.isDST&&(c=c-60)}return s=new Date(i[this._appointmentSettings.startTime]),h=new Date(i[this._appointmentSettings.endTime]),i[this._appointmentSettings.allDay]&&Math.round((new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5)<24?i:(i[this._appointmentSettings.startTime]=!this._dataManager.dataSource.offline&&!t.isNullOrUndefined(i[this._appointmentSettings.startTimeZone])?new Date(s.setMinutes(s.getMinutes()+e+c)):new Date(s.setMinutes(s.getMinutes()+e)),i[this._appointmentSettings.endTime]=!this._dataManager.dataSource.offline&&!t.isNullOrUndefined(i[this._appointmentSettings.startTimeZone])?new Date(h.setMinutes(h.getMinutes()+e+c)):new Date(h.setMinutes(h.getMinutes()+e)),this._universalTimeConversion(i,r),i)}return i}return i}
10,_universalTimeConversion:function(n,i){if(!this._dataManager.dataSource.offline&&!t.isNullOrUndefined(n[this._appointmentSettings.startTimeZone])&&i==""&&(t.isNullOrUndefined(this._dataProcess)||!this._dataProcess)){var r=(new Date)._isDST()&&!this.model.isDST&&this.model.timeZone==null?(new Date).getTimezoneOffset()+this._timeZoneOffset:(new Date).getTimezoneOffset();n[this._appointmentSettings.startTime]=new Date(n[this._appointmentSettings.startTime].getTime()+r*6e4);n[this._appointmentSettings.endTime]=new Date(n[this._appointmentSettings.endTime].getTime()+r*6e4)}},_processtimeZone:function(n){var t,i,r;return this.model.appointmentSettings.applyTimeOffset&&(t=new Date(n[this.model.blockoutSettings.startTime]),i=new Date(n[this.model.blockoutSettings.endTime]),n[this.model.blockoutSettings.isAllDay]?(n[this.model.blockoutSettings.startTime]=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n[this.model.blockoutSettings.endTime]=new Date(i.getFullYear(),i.getMonth(),i.getDate(),23,59,59)):(r=this._timeZoneCalculate(n),n[this.model.blockoutSettings.startTime]=new Date(t.setMinutes(t.getMinutes()+r)),n[this.model.blockoutSettings.endTime]=new Date(i.setMinutes(i.getMinutes()+r)))),n},_dataProcessing:function(i){var a,r,u;if(this._processed=[],this._appMainId=null,i.length>0){for(this._dataProcess=!0,a=this._sortAppById(i),this._maxId=t.isNullOrUndefined(i[0])||t.isNullOrUndefined(i[0].AppTaskId)?1:i[0].AppTaskId,r=0;r<i.length;r++)if(i[r][this._appointmentSettings.startTime]=(new Date).parseISO8601(i[r][this._appointmentSettings.startTime]),i[r][this._appointmentSettings.endTime]=(new Date).parseISO8601(i[r][this._appointmentSettings.endTime]),this._bindAppointments==!0&&!this._angular&&!this._setmodelvalue&&this._applyTimeOffset&&t.isNullOrUndefined(this._enablePersist)){var o,s=n.extend(s,i[r]),v=new Date(new Date(s.StartTime).setHours(0,0,0)),y=new Date((new Date).setHours(0,0,0)),h=new Date(v)._isDST(),c=(new Date)._isDST();if(this._dataManager.dataSource.offline||t.isNullOrUndefined(i[r][this._appointmentSettings.startTimeZone]))o="reverse";else{o="";var l=(new Date)._isDST()&&!this.model.isDST&&this.model.timeZone==null?(new Date).getTimezoneOffset()+this._timeZoneOffset:(new Date).getTimezoneOffset(),f=i[r][this._appointmentSettings.startTime],e=i[r][this._appointmentSettings.endTime];i[r][this._appointmentSettings.startTime]=new Date(f.setMinutes(f.getMinutes()-l));i[r][this._appointmentSettings.endTime]=new Date(e.setMinutes(e.getMinutes()-l))}u=this._timeZoneAppointments(i[r],o);this.model.isDST&&this.model.timeZone==null&&(f=new Date(u[this._appointmentSettings.startTime]),e=new Date(u[this._appointmentSettings.endTime]),c&!h&&(u[this._appointmentSettings.startTime]=new Date(f.setHours(f.getHours()-1)),u[this._appointmentSettings.endTime]=new Date(e.setHours(e.getHours()-1))),!c&h&&(u[this._appointmentSettings.startTime]=new Date(f.setHours(f.getHours()+1)),u[this._appointmentSettings.endTime]=new Date(e.setHours(e.getHours()+1))));this._appointmentProcessing(u)}else this._appointmentProcessing(i[r]);return this._bindAppointments=this._dataProcess=!1,this._setmodelvalue=!1,this._processed=this._sortAppById(this._processed),this._processed}},_guidFormatGenerate:function(){function n(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()},_groupAppointment:function(i){var r,e,s,o,h,f;if(i.AppTaskId=t.isNullOrUndefined(i.AppTaskId)?this._maxId:i.AppTaskId,t.isNullOrUndefined(i[this._appointmentSettings.id])&&(i[this._appointmentSettings.id]=i.AppTaskId),r=this._appointmentSettings.resourceFields.split(","),e=[],i[r[r.length-1]].length>1?e=i[r[r.length-1]].split(","):e.push(i[r[r.length-1]]),s=[],r.length-1>0)for(f=0;f<r.length-1;f++)i[r[f]].length>1?s.push(i[r[f]].split(",")):s.push((i[r[f]]+",").split(","));for(o=0,h=e;o<h.length;){var u={},l=new Date(i[this._appointmentSettings.startTime]),c=new Date(i[this._appointmentSettings.endTime]);if(this._idChecking(),u=this._addAppData(i,this._maxId,l,c,i.ParentId),u[r[r.length-1]]=parseInt(e[o]),r.length-1>0)for(f=0;f<r.length-1;f++)u[r[f]]=parseInt(s[f][o]);new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5<24&&i[this._appointmentSettings.allDay]!==!0?(u.Guid=this._guidFormatGenerate(),this._multipleDayApp(u,this._maxId,u[this._appointmentSettings.startTime],c)):Math.round((u[this._appointmentSettings.endTime]-u[this._appointmentSettings.startTime])/36e5)>24?(u.Guid=this._guidFormatGenerate(),this._multipleSplit(u,this._maxId,u[this._appointmentSettings.startTime],u[this._appointmentSettings.endTime])):n.isEmptyObject(u)||(u.Guid=this._guidFormatGenerate(),this._processed.push(u));o++;this._maxId++}},_groupRecurrenceAppointment:function(i){var o,r,s,h,w,p,f,l,a,v,y,e;if(t.RecurrenceEditor.prototype._initializePrivateProperties(),o=t.RecurrenceEditor.prototype,o._rRule={},i.AppTaskId=t.isNullOrUndefined(i.AppTaskId)?this._maxId:i.AppTaskId,t.isNullOrUndefined(i[this._appointmentSettings.id])&&(i[this._appointmentSettings.id]=i.AppTaskId),o.model.startDate=new Date(this.currentDate()),r=this._appointmentSettings.resourceFields.split(","),s=i[r[r.length-1]].length>1?i[r[r.length-1]].split(","):(i[r[r.length-1]]+",").split(","),h=[],r.length-1>0)for(f=0;f<r.length-1;f++)i[r[f]].length>1?h.push(i[r[f]].split(",")):h.push((i[r[f]]+",").split(","));for(w=o.recurrenceDateGenerator(i[this._appointmentSettings.recurrenceRule],i[this._appointmentSettings.startTime],i[this._appointmentSettings.recurrenceExDate]),p=w,f=0;f<=s.length-1;f++)if(s[f]!="")for(l=this._guidFormatGenerate(),a=0;a<p.length;){var u={},c=new Date(p[a]),b=i[this._appointmentSettings.endTime];
10if(o._rRule.freq!="MONTHLY"&&o._rRule.freq!="YEARLY"||t.isNullOrUndefined(o._rRule.setPositions)||(c=o._dayOfWeekInMonth(c,o._rRule.weekDays,o._rRule.setPositions)),v=new Date(c.getFullYear(),c.getMonth(),c.getDate(),new Date(i[this._appointmentSettings.startTime]).getHours(),new Date(i[this._appointmentSettings.startTime]).getMinutes(),new Date(i[this._appointmentSettings.startTime]).getSeconds()),y=new Date(new Date(v).setMilliseconds(i[this._appointmentSettings.endTime].getTime()-i[this._appointmentSettings.startTime].getTime())),this._idChecking(),i[this._appointmentSettings.recurrenceId]=i[this._appointmentSettings.recurrenceId]||i[this._appointmentSettings.id]||i.AppTaskId,i.ParentId=i[this._appointmentSettings.recurrenceId],t.isNullOrUndefined(o._rRule.exDate)?u=this._addAppData(i,this._maxId,v,y,i.ParentId):o._rRule.exDate.indexOf(t.format(new Date(c),this._pattern.d,this.model.locale))==-1&&(u=this._addAppData(i,this._maxId,v,y,i.ParentId)),new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5<24&&i[this._appointmentSettings.allDay]!==!0){if(u.Guid=this._guidFormatGenerate(),u.commonGuid=l,u[r[r.length-1]]=parseInt(s[f]),r.length-1>0)for(e=0;e<r.length-1;e++)u[r[e]]=parseInt(h[e][f]);this._multipleDayApp(u,this._maxId,u[this._appointmentSettings.startTime],y)}else if(Math.round((u[this._appointmentSettings.endTime]-u[this._appointmentSettings.startTime])/36e5)>24){if(u.Guid=this._guidFormatGenerate(),u.commonGuid=l,u[r[r.length-1]]=parseInt(s[f]),r.length-1>0)for(e=0;e<r.length-1;e++)u[r[e]]=parseInt(h[e][f]);this._multipleSplit(u,this._maxId,u[this._appointmentSettings.startTime],u[this._appointmentSettings.endTime])}else if(!n.isEmptyObject(u)){if(u.Guid=this._guidFormatGenerate(),u.commonGuid=l,u[r[r.length-1]]=parseInt(s[f]),r.length-1>0)for(e=0;e<r.length-1;e++)u[r[e]]=parseInt(h[e][f]);this._processed.push(u)}a++;this._maxId++}},_RecurrenceAppointment:function(i){var u,e,o;t.isNullOrUndefined(this._recurrenceEditor)&&this._renderRecurrenceEditor();u=this._recurrenceEditor.ejRecurrenceEditor("instance");u._rRule={};i.AppTaskId=t.isNullOrUndefined(i.AppTaskId)?this._maxId:i.AppTaskId;t.isNullOrUndefined(i[this._appointmentSettings.id])&&(i[this._appointmentSettings.id]=i.AppTaskId);u.model.startDate=new Date(this.currentDate());for(var c=u.recurrenceDateGenerator(i[this._appointmentSettings.recurrenceRule],i[this._appointmentSettings.startTime],i[this._appointmentSettings.recurrenceExDate]),s=0,h=c;s<h.length;){var r={},f=new Date(h[s]),l=i[this._appointmentSettings.endTime];u._rRule.freq!="MONTHLY"&&u._rRule.freq!="YEARLY"||t.isNullOrUndefined(u._rRule.setPositions)||(f=u._dayOfWeekInMonth(f,u._rRule.weekDays,u._rRule.setPositions));e=new Date(f.getFullYear(),f.getMonth(),f.getDate(),new Date(i[this._appointmentSettings.startTime]).getHours(),new Date(i[this._appointmentSettings.startTime]).getMinutes(),new Date(i[this._appointmentSettings.startTime]).getSeconds());o=new Date(new Date(e).setMilliseconds(i[this._appointmentSettings.endTime].getTime()-i[this._appointmentSettings.startTime].getTime()));this._idChecking();i[this._appointmentSettings.recurrenceId]=i[this._appointmentSettings.recurrenceId]||i[this._appointmentSettings.id]||i.AppTaskId;i.ParentId=i[this._appointmentSettings.recurrenceId];t.isNullOrUndefined(u._rRule.exDate)?r=this._addAppData(i,this._maxId,e,o,i.ParentId):u._rRule.exDate.indexOf(t.format(new Date(f),this._pattern.d,this.model.locale))==-1&&(r=this._addAppData(i,this._maxId,e,o,i.ParentId));new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5<24&&i[this._appointmentSettings.allDay]!==!0?(r.Guid=this._guidFormatGenerate(),this._multipleDayApp(r,this._maxId,r[this._appointmentSettings.startTime],o)):Math.round((r[this._appointmentSettings.endTime]-r[this._appointmentSettings.startTime])/36e5)>24?(r.Guid=this._guidFormatGenerate(),this._multipleSplit(r,this._maxId,r[this._appointmentSettings.startTime],r[this._appointmentSettings.endTime])):!n.isEmptyObject(r)&&(t.isNullOrUndefined(this._appointmentSettings.resourceFields)||t.isNullOrUndefined(i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()])||!0)&&(r.Guid=this._guidFormatGenerate(),this._processed.push(r));s++;this._maxId++}},_recurrenceAppSort:function(i){for(var e,u,f=[],r=0;r<i.length;r++)e=new t.DataManager(i).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i[r].Guid)),e.length>1?(u=n.extend(!0,[],e),u[0][this._appointmentSettings.endTime]=u[u.length-1][this._appointmentSettings.endTime],f.push(u[0]),r++):f.push(i[r]);return f},_appointmentProcessing:function(n){var r,u;
10this._maxId=t.isNullOrUndefined(this._appMainId)?parseInt(this._maxId):parseInt(this._appMainId)+1;t.isNullOrUndefined(this._recurrenceEditor)&&this._renderRecurrenceEditor();r=this._recurrenceEditor.ejRecurrenceEditor("instance");r._rRule={};t.isNullOrUndefined(n[this._appointmentSettings.recurrence])||t.isNullOrUndefined(n[this._appointmentSettings.recurrenceRule])||r.recurrenceRuleSplit(n[this._appointmentSettings.recurrenceRule],n[this._appointmentSettings.recurrenceExDate]);n[this._appointmentSettings.recurrence]&&t.isNullOrUndefined(r._rRule.recurEditId)?this._groupEditing?this._groupRecurrenceAppointment(n):this._RecurrenceAppointment(n):new Date(new Date(n[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(n[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(n[this._appointmentSettings.endTime]-n[this._appointmentSettings.startTime])/36e5<24&&n[this._appointmentSettings.allDay]!==!0&&(n[this._appointmentSettings.recurrence]&&!t.isNullOrUndefined(r._rRule.recurEditId)||!n[this._appointmentSettings.recurrence])?(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(r._rRule.recurEditId)?n[this._appointmentSettings.id]:r._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._maxId=n.AppTaskId,this._groupEditing||this._groupEdit?this._groupAppointment(n):(t.isNullOrUndefined(this._appointmentSettings.resourceFields)||t.isNullOrUndefined(n[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()])||!0)&&this._multipleDayApp(n,this._maxId,n[this._appointmentSettings.startTime],n[this._appointmentSettings.endTime])):(n[this._appointmentSettings.endTime]-n[this._appointmentSettings.startTime])/36e5>=24?(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(r._rRule.recurEditId)?n[this._appointmentSettings.id]:r._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._maxId=n.AppTaskId,endTime=new Date(n[this._appointmentSettings.endTime]),u=new Date(n[this._appointmentSettings.startTime]),this._groupEditing||this._groupEdit||new Date(u).getDate()==new Date(endTime).getDate()&&new Date(u).getMonth()==new Date(endTime).getMonth()&&new Date(u).getFullYear()==new Date(endTime).getFullYear()?this._groupEditing||this._groupEdit||new Date(endTime.setMilliseconds(-1e3)).getDate()!=n[this._appointmentSettings.startTime].getDate()?this._groupAppointment(n):this._processed.push(n):(t.isNullOrUndefined(this._appointmentSettings.resourceFields)||t.isNullOrUndefined(n[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()])||!0)&&this._multipleSplit(n,this._maxId,n[this._appointmentSettings.startTime],n[this._appointmentSettings.endTime])):n[this._appointmentSettings.recurrence]&&t.isNullOrUndefined(r._rRule.recurEditId)?n[this._appointmentSettings.recurrence]!=i&&n[this._appointmentSettings.allDay]!=i||n[this._appointmentSettings.recurrence]||(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=n[this._appointmentSettings.id],n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,n.RecurrenceId=n.recurrenceExDate=null,(t.isNullOrUndefined(this._appointmentSettings.resourceFields)||t.isNullOrUndefined(n[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()])||!0)&&this._processed.push(n)):(this._appMainId=n.AppTaskId=n.AppTaskId==null?this._maxId:n.AppTaskId,t.isNullOrUndefined(n[this._appointmentSettings.id])&&(n[this._appointmentSettings.id]=n.AppTaskId),n.ParentId=t.isNullOrUndefined(r._rRule.recurEditId)?n[this._appointmentSettings.id]:r._rRule.recurEditId,n[this._appointmentSettings.recurrence]&&(n.ParentId=n[this._appointmentSettings.recurrenceId]=n[this._appointmentSettings.recurrenceId]==null?n.ParentId:n[this._appointmentSettings.recurrenceId]),this._groupEditing||this._groupEdit?(this._maxId=n.AppTaskId,this._groupAppointment(n)):(t.isNullOrUndefined(this._appointmentSettings.resourceFields)||t.isNullOrUndefined(n[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()])||!0)&&(n.Guid=t.isNullOrUndefined(n.Guid)?this._guidFormatGenerate():n.Guid,this._processed.push(n)));this._appMainId=t.isNullOrUndefined(this._appMainId)||this._appMainId<this._maxId?this._maxId:this._appMainId},_idChecking:function(){for(var n,i,r=0;r<this._currentAppointmentData.length;r++)if(n=(new t.Query).where("AppTaskId",t.FilterOperators.equal,this._maxId),i=new t.DataManager(this._currentAppointmentData).executeLocal(n),i.length==0){this._maxId;break}else this._maxId++;for(;;)if(n=(new t.Query).where("AppTaskId",t.FilterOperators.equal,this._maxId),i=new t.DataManager(this._processed).executeLocal(n),i.length==0){this._maxId;break}else this._maxId++;return this._maxId},_getTotalDays:function(n,t){var u=this._getWeekDays(),i=new Date(n),r=0;do r=u.indexOf(i.getDay())!=-1?r+1:r,i=new Date(new Date(i).getTime()+864e5);while(new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()<=new Date(t).getTime());return r},_getPrevNextDateCount:function(n,t){for(var u=this._getWeekDays(),i=new Date(n),r=0;u.indexOf(i.getDay())<0;)i=t=="next"?new Date(new Date(i).getTime()+864e5):new Date(new Date(i).getTime()-864e5),r++;return r},_getPrevNextDates:function(n,t){for(var i=0,r=this._dateRender;r.indexOf(n.getTime())<0;)n=t=="next"?new Date(new Date(n).getTime()+864e5):new Date(new Date(n).getTime()-864e5),i++;return i},_getPrevNextCustomDates:function(n,t,i){for(var e,r=0,f=0,o=0,s=[],u=0;u<this._resCustomCollection.length;u++)this._resCustomCollection[u].id==i&&(s=this._resCustomCollection[u].renderDates);while(s.indexOf(n.getTime())<0)e=n,n=t=="next"?new Date(new Date(n).getTime()+864e5):new Date(new Date(n).getTime()-864e5),e.getFullYear()!=n.getFullYear()?(r=0,f=0,o++):e.getMonth()==n.getMonth()?r++:(r=0,f++);return{count:r,monthCount:f,yearCount:o}},_getCustomDatesCount:function(i,r){var u=this.res1[i][r];return 0+(t.isNullOrUndefined(u)||n.type(u[0])!="object"?u.length:this._getMultipleCustomDatesCount(u))},_getMultipleCustomDatesCount:function(n){for(var i=0,t=0;t<n.length;t++){var r=n[t].start,u=n[t].end,f=Math.round(Math.abs((u.getTime()-r.getTime())/864e5))+1;i=i+f}return i},_multipleDayApp:function(n,t,i,r){r.getHours()==0&&r.getMinutes()==0&&(r=new Date(r.getTime()-1e3));var f=new Date(i),u=new Date(r);for((this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.timeScale.enable||(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(i<new Date(this._dateRender[0])||r>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))))&&(u=new Date(new Date(i).setHours(23,59,59)));f>=new Date(i)&&f<=u&&u<=new Date(r);)this._processed.push(this._addAppData(n,t,f,u,n.ParentId)),f=new Date(new Date(u).setHours(24,0,0)),u=n[this._appointmentSettings.endTime],this._maxId=t=this._idChecking()},_multipleSplit:function(i,r,u,f){var e,c,a,s,y,v,o,l,p,h;for(u=new Date(u),e=new Date(new Date(u).getFullYear(),new Date(u).getMonth(),new Date(u).getDate(),new Date(u).getHours(),new Date(u).getMinutes(),new Date(u).getSeconds()),c=new Date(new Date(f).getFullYear(),new Date(f).getMonth(),new Date(f).getDate(),23,59,59);e<=c;)a=0,s=new Date(e),this.currentView()!=="day"&&this.currentView()!="agenda"&&(y=s._currentWeekDates(this._firstdayofweek),!this._isCustomMonthView()&&this._oneWeek?(e=new Date(new Date(s).getFullYear(),new Date(s).getMonth(),new Date(s).getDate()),a=this._dateRender.indexOf(e.getTime())!=-1?this._dateRender.length-1-this._dateRender.indexOf(e.getTime()):e.getTime()<new Date(this._dateRender[0]).getTime()?(new Date(new Date(this._dateRender[0]).setDate(new Date(this._dateRender[0]).getDate()-1)).getTime()-new Date(e).setHours(0,0,0,0))/864e5:e.getTime()>
10new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)?this._dateRender.length-1:0):a=this.currentView()!="month"||this.model.orientation!="horizontal"&&this._customOrientation!="horizontal"&&(this.model.showNextPrevMonth||new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()==new Date(e.getFullYear(),e.getMonth(),1).getTime())?(y.end.getTime()-new Date(s).setHours(0,0,0))/864e5:new Date(s.getFullYear(),s.getMonth()+1,0).getDate()-s.getDate()),this.currentView()=="workweek"&&new Date(s).getTime()==new Date(y.start).getTime()&&this._firstdayofweek==0&&(o=new Date(new Date(s).setHours(23,59,59)),v=this._addAppData(i,r,s,o,i.ParentId),this._processed.push(v),this._maxId=r=this._idChecking(),s=new Date(s.getFullYear(),s.getMonth(),s.getDate()+1)),this._isCustomMonthView()&&(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")?(this._dateRender.indexOf(c.setHours(0,0,0,0))==-1&&(o=new Date(this._dateRender[this._dateRender.length-1])),this._dateRender.indexOf(e.setHours(0,0,0,0))==-1&&(o=new Date(new Date(this._dateRender[0]).setDate(new Date(this._dateRender[0]).getDate()-1))),(o<s||t.isNullOrUndefined(o))&&(o=new Date(f))):(l=new Date(e.getFullYear(),e.getMonth(),e.getDate()+a),o=new Date(l).getDate()==new Date(c).getDate()&&new Date(l).getMonth()==new Date(c).getMonth()&&new Date(l).getFullYear()==new Date(c).getFullYear()&&this.currentView()!=="month"?new Date(new Date(l).setHours(f.getHours(),f.getMinutes(),f.getSeconds())):new Date(new Date(l).setHours(23,59,59)),o>=new Date(f)&&this.currentView()!=="day"&&(o=i[this._appointmentSettings.endTime]),this.model.showNextPrevMonth||this.currentView()!="month"||new Date(e.getFullYear(),e.getMonth(),1).getTime()==new Date(o.getFullYear(),o.getMonth(),1).getTime()||(o=new Date(e.getFullYear(),e.getMonth()+1,0,o.getHours(),o.getMinutes(),o.getSeconds()))),v=this._addAppData(i,r,s,o,i.ParentId),this._processed.push(v),this._maxId=r=this._idChecking(),p=this.model.showWeekend?1:this._getPrevNextDateCount(new Date(new Date(o).setHours(0,0,0,0)+864e5),"next")+1,e=new Date(new Date(o).getFullYear(),new Date(o).getMonth(),new Date(o).getDate()+p),e<=c&&(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"&&(h=0,this._resCustomView?(h=this._getPrevNextCustomDates(e,"next",i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]),e=h.yearCount>0?new Date(e.getFullYear()+h.yearCount,new Date(e.setMonth(0)).getMonth()+h.monthCount,new Date(e.setDate(1)).getDate()+h.count):h.monthCount>0?new Date(e.getFullYear(),e.getMonth()+h.monthCount,new Date(e.setDate(1)).getDate()+h.count):new Date(e.getFullYear(),e.getMonth()+h.monthCount,e.getDate()+h.count)):(h=this._getPrevNextDates(e,"next"),e=new Date(e.getFullYear(),e.getMonth(),e.getDate()+h)))},_deleteOcurrence:function(n,i){var u,o,e,s,f,c;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties();var h=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),l=(new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n),r=new t.DataManager(this._currentAppointmentData).executeLocal(l);if((this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()&&(u=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,i)),u=u.length==0?this._objDate:u,u=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u[0].AppTaskId))),!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceRule])){if(o=r[0][this._appointmentSettings.recurrenceRule],h.recurrenceRuleSplit(o,r[0][this._appointmentSettings.recurrenceExDate]),t.isNullOrUndefined(h._rRule.exDate))(this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()?u[0][this._appointmentSettings.startTime].getDay()==u[0][this._appointmentSettings.endTime].getDay()?(i=u[0][this._appointmentSettings.startTime],r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()):(r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()):(r[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d,this.model.locale),r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString());else{for(e=o.split(";"),s="",f=0;f<e.length;f++)s!=""&&(s+=";"),c=e[f].replace(/ /g,"").split("="),c[0]=="EXDATE"&&((this._currentAction=="delete"||this._currentAction=="editOccurrence")&&r[0][this._appointmentSettings.endTime].getDay()>r[0][this._appointmentSettings.startTime].getDay()?u[0][this._appointmentSettings.startTime].getDay()==u[0][this._appointmentSettings.endTime].getDay()?(i=u[0][this._appointmentSettings.startTime],e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale)):e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale):e[f]=e[f]+","+t.format(i,this._pattern.d,this.model.locale)),s+=e[f];r[0][this._appointmentSettings.recurrenceRule]=s;r[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(r[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d,this.model.locale).toString():r[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d,this.model.locale).toString()}return r}},_getWeekIndex:function(n){var i=0,t=new Date(n.getFullYear(),n.getMonth(),1),r=n.getDay();if(r!=t.getDay())do t=new Date(t.setDate(t.getDate()+1));while(r!=t.getDay());while(t.getDate()!=n.getDate())t=new Date(t.setDate(t.getDate()+7)),i++;return i},_addAppData:function(i,r,u,f,e){var s={},o,c,h,l;for(o in this._appointmentSettings)if(o!="dataSource"&&o!="query"&&o!="tableName"&&o!="resourceFields"&&(s[this._appointmentSettings[o]]=i[this._appointmentSettings[o]]),o=="resourceFields"&&!t.isNullOrUndefined(this._appointmentSettings.resourceFields))for(c=this._appointmentSettings.resourceFields.split(","),h=0,l=c.length;h<l;h++)s[c[h]]=i[c[h]];return t.isNullOrUndefined(r)||(s.AppTaskId=r),t.isNullOrUndefined(u)||(s[this._appointmentSettings.startTime]=u),t.isNullOrUndefined(f)||(s[this._appointmentSettings.endTime]=f),t.isNullOrUndefined(e)||(s.ParentId=e),n.extend({},i,s)},_renderAppointments:function(){var e=n.extend(!0,[],this._dateRender),c,r,u,h,f,o,i,s;for(this._overflowFlag=!1,this._renderedApp=[],this._renderedAllDay=[],c=1,this.level=0,this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length)),this.cellwidth=this.element.find(".e-workcells").width(),this.cellheight=this.element.find(".e-workcells")[0].offsetHeight,this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showAllDayRow&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none")),this.alldaycellsheight=this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&!t.isNullOrUndefined(this.element.find(".e-alldaycells")[0])?this.element.find(".e-alldaycells")[0].offsetHeight-1:this.element.find(".e-alldaycells").height(),this._horiHeaderCollection=this._horiGroupCollection(),this.leftPosition=0,this._variable=[],this.model.group&&(this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length!=0)||(this.res1=["0"]),this.resIndex=0,this._processed=this._appointmentSort(this._processed),r=0;r<this.res1.length;r++){if(u=0,f=e.length,new Date(e[0])<this.model.minDate&&(u=Math.floor((new Date(this.model.minDate)-new Date(e[0]))/864e5)),new Date(e[e.length-1])>this.model.maxDate&&(h=Math.floor((new Date(e[e.length-1])-new Date(this.model.maxDate))/864e5),f=e.length-h),this._resWorkWeek)for(f=0,u=0,o=0,i=0;i<r+1;i++)if(t.isNullOrUndefined(this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(f+=this.model.workWeek.length,i==r&&(o+=this.model.workWeek.length)):(f+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,i==r&&(o+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length)),i==r){u=f-o;break}if(this._resCustomView)for(f=0,u=0,o=0,i=0;i<r+1;i++)if(s=this._tempResource[this._tempResource.length-1].resourceSettings.renderDates,t.isNullOrUndefined(this.res1[i][s])||(f+=this._getCustomDatesCount(i,s),i==r&&(o+=this._getCustomDatesCount(i,s))),i==r){u=f-o;break}for(u;u<f;u++)this._getDayAppointments(u,r)}(this._overflowFlag||this._allDayDrag)&&this._reRenderScroller();this._overflowFlag=this._allDayDrag=!1},_appointmentRemove:function(n){this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment").filter("div[data-guid="+n.Guid+"]").remove();this.element.find(".e-categorybar").filter("div[id=categorybar_"+n.Guid+"]").remove()},_resourceCustomView:function(n,i){for(var f,o=0,u=0,s=0,e=0,r=0;r<n+1;r++)if(f=this._tempResource[this._tempResource.length-1].resourceSettings.renderDates,t.isNullOrUndefined(this.res1[r][f])||(o+=this._getCustomDatesCount(r,f),r==n&&(s+=this._getCustomDatesCount(r,f),e=this._resCustomDate[n].indexOf(i))),r==n){u=o-s;break}return e!=-1?u=u+e:u,u}
10,_resourceWorkWeek:function(n,i){for(var e=0,u=0,o=0,f=0,r=0;r<n+1;r++)if(t.isNullOrUndefined(this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(e+=this.model.workWeek.length,r==n&&(o+=this.model.workWeek.length,f=this._resDateRen[n].indexOf(i))):(e+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,r==n&&(o+=this.res1[r][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,f=this._resDateRen[n].indexOf(i))),r==n){u=e-o;break}return f!=-1?u=u+f:u,u},_refreshDayAppointments:function(n){var c,f,s,e,l,o;if(this.model.timeScale.enable&&this.currentView()!="agenda"&&this.currentView()!="month"&&!this._isCustomMonthView()){this._overflowFlag=!1;var r=new Date(n[this._appointmentSettings.startTime]).setHours(0,0,0,0),i=t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],null,null):this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2]]):0,u=this._dateRender.indexOf(r),h=0;this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._grouping.length>0&&(this._resWorkWeek?u=this._resourceWorkWeek(i,r):this._resCustomView?u=this._resourceCustomView(i,r):h+=i*(this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:this.currentView()=="week"||this.currentView()=="week"||this._isCustomMonthView()?this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length));(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(c=this._grouping.length>1?this._resCollect.indexOf(this.res1[i]):i);this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.element.find(".e-workcellstab tr td:nth-child("+(u+h+1)+")").find(".e-appointwrapper").remove():this.element.find(".e-workcellstab tr:nth("+c+")").find(".e-appointwrapper").remove();this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(f=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(r)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(r).setHours(23,59,59))),f=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?f.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):f,o=new t.DataManager(this._renderedApp).executeLocal((new t.Query).where(f))):(s=this.getCurrentViewAppointments(),this._grouping.length>0&&(e=this,l=s.filter(function(t){return t[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]})),o=this._grouping.length>0?l:s);new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:o},"AppTaskId");new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:o},"AppTaskId");var y=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?1:this._dateRender.length,a=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?u:0,v=0,a=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?u:0;this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length));this.cellwidth=this.element.find(".e-workcells").width();this.cellheight=this.element.find(".e-workcells")[0].offsetHeight;this.alldaycellsheight=t.isNullOrUndefined(this.alldaycellsheight)?this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&!t.isNullOrUndefined(this.element.find(".e-alldaycells")[0])?this.element.find(".e-alldaycells")[0].offsetHeight-1:this.element.find(".e-alldaycells").height():this.alldaycellsheight;this._horiHeaderCollection=this._horiGroupCollection();do this._getDayAppointments(a,i),v++,a++;while(v<y);this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showAllDayRow&&this._renderAllDayAppointments();this._overflowFlag&&(this._reRenderScroller(),this._overflowFlag=!1);this.model.showAppointmentNavigator&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.element.find(".e-vscroll").length>0&&this.currentView()!="month"&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIconPosition()}else this.currentView()=="agenda"?this._renderAgendaContent():this._renderMonthAppointment();this._bindAppointmentAction()},_renderUpDownIcon:function(){var t;if(this.element.find(".e-upicon, .e-downicon").length==0){var i="",r="",u="",f="",e=this.element.find(".e-hscroll").length==0?"0px":this.element.find(".e-hscroll").outerHeight()+"px";for(t=0;t<this.dateRender.length;t++)i=i+"<div class='upicon_"+t+"' style='width:100%;height:100%;'><span class='e-icon e-arrow-sans-up e-appup'><\/span><\/div>",r=r+"<div class='downicon_"+t+"' style='width:100%;height:100%;'><span class='e-icon e-arrow-sans-down e-appdown'><\/span><\/div>";u="<div class='e-upicon' style='pointer-events:none;top:0px;'>"+i+"<\/div>";f="<div class='e-downicon' style='pointer-events:none;bottom:"+e+";'>"+r+"<\/div>";n(u).insertBefore(this.element.find(".e-draggableworkarea").parent());n(f).insertAfter(this.element.find(".e-draggableworkarea").parent());this.model.enableRTL&&this.element.find(".e-appup, .e-appdown").addClass("e-rtl");this.element.find(".e-upicon, .e-downicon").css({width:this.element.find(".e-workcellstab").width()});this.element.find(".e-appup, .e-appdown").css({pointerEvents:"visible"});this.element.find(".e-upicon, .e-downicon").children().css({float:this.model.enableRTL?"right":"left",visibility:"hidden",
10width:Math.floor(this.element.find(".e-workcellstab").width()/this.element.find(".e-upicon").children().length)})}},_renderUpDownIconPosition:function(){var b,tt,n,it,o,u,i,y,a,h,et,r,e,p,v;if(this.element.find(".e-upicon, .e-downicon").children().css({visibility:"hidden"}),this.element.find(".e-vscroll").length>0){var w=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),d=t.isNullOrUndefined(w._scrollYdata)?this.element.height():w._scrollYdata.scrollable,g=w.scrollTop(),nt=g>d?d:g,ot=nt+this.element.find(".e-draggableworkarea").height(),st=parseInt(nt/this.element.find(".e-workcells")[0].offsetHeight)+1,ht=parseInt(ot/this.element.find(".e-workcells")[0].offsetHeight),c=this.element.find(".e-upicon"),l=this.element.find(".e-downicon"),ct=(this.model.startHour*60+st*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,lt=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4,at=(this.model.startHour*60+ht*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4+lt;for(this._currentViewAppointments=this.getCurrentViewAppointments(),b=this,tt=this._currentViewAppointments.filter(function(n){return(n[b._appointmentSettings.endTime]-n[b._appointmentSettings.startTime])/36e5<24}),n=0;n<this._dateRender.length;n++){var vt=this.model.endHour<24?new Date(new Date(this._dateRender[n]).setHours(this.model.endHour,0,0)):new Date(new Date(this._dateRender[n]).setHours(23,59,59)),yt=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(this._dateRender[n]).setHours(this.model.startHour,0,0))).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(vt)),k=new t.DataManager(tt).executeLocal((new t.Query).where(yt));if(k.length!=0){if(it=new Date(new Date(this._dateRender[n]).setMilliseconds(ct)),o=new t.DataManager(k).executeLocal((new t.Query).where(this._appointmentSettings.endTime,t.FilterOperators.lessThan,new Date(it))),o=this._appointmentSort(o).reverse(),!t.isNullOrUndefined(c)&&o.length!=0)if(this._grouping.length==0)c.children().eq(n).css({visibility:"visible"});else if(this._grouping.length==1)for(i=0;i<this.res1.length;i++)u=new t.DataManager(o).executeLocal((new t.Query).where(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[i].id)),u.length!=0&&c.children().eq(n+i*this._dateRender.length).css({visibility:"visible"});else for(i=0;i<this.res1.length;i++){var rt=t.Predicate(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[i].id),ut=t.Predicate(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2],t.FilterOperators.equal,this.res1[i].groupId),ft=rt.and(ut),u=new t.DataManager(o).executeLocal((new t.Query).where(ft)),f=this._resWorkWeek?this._resDateRen:this._resCustomDate,s=this._resWorkWeek||this._resCustomView;if(s&&f[i].indexOf(this._dateRender[n])==-1&&(u=[]),u.length==0||s){if(u.length!=0&&s){for(e=0,y=0;y<i;y++)e=e+f[y].length;for(a=0;a<f[i].length;a++)if(f[i][a]==this._dateRender[n])break;c.children().eq(e+a).css({visibility:"visible"})}}else c.children().eq(n+i*this._dateRender.length).css({visibility:"visible"})}if(h=new t.DataManager(k).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.greaterThan,new Date(new Date(this._dateRender[n]).setMilliseconds(at)))),h=this._appointmentSort(h),!t.isNullOrUndefined(l)&&h.length!=0)if(this._grouping.length==0)l.children().eq(n).css({visibility:"visible"});else if(this._grouping.length==1)for(r=0;r<this.res1.length;r++)et=new t.DataManager(h).executeLocal((new t.Query).where(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[r].id)),et.length!=0&&l.children().eq(n+r*this._dateRender.length).css({visibility:"visible"});else for(r=0;r<this.res1.length;r++){var rt=t.Predicate(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1],t.FilterOperators.equal,this.res1[r].id),ut=t.Predicate(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2],t.FilterOperators.equal,this.res1[r].groupId),ft=rt.and(ut),u=new t.DataManager(h).executeLocal((new t.Query).where(ft)),f=this._resWorkWeek?this._resDateRen:this._resCustomDate,s=this._resWorkWeek||this._resCustomView;if(s&&f[r].indexOf(this._dateRender[n])==-1&&(u=[]),u.length==0||s){if
10(u.length!=0&&s){for(e=0,p=0;p<r;p++)e=e+f[p].length;for(v=0;v<f[r].length;v++)if(f[r][v]==this._dateRender[n])break;l.children().eq(e+v).css({visibility:"visible"})}}else l.children().eq(n+r*this._dateRender.length).css({visibility:"visible"})}}}}},_renderAppPosition:function(i){var w=n(i.target).hasClass("e-appup")?"e-appup":"e-appdown",r=n(i.target).parent().index(),c=this.getCurrentViewAppointments(),e=this.element.find("div#"+this._id+"_scroller").data("ejScroller");switch(w){case"e-appup":var l=e.scrollTop(),o=parseInt(l/this.element.find(".e-workcells")[0].offsetHeight)+1,g=this.element.find(".e-draggableworkarea").find("tr").eq(o),u=(this.model.startHour*60+o*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,f=new Date(new Date(this.dateRender[r]).setMilliseconds(u)),a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(this.dateRender[r])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(f)),v=new t.DataManager(c).executeLocal((new t.Query).where(a));if(v.length!=0){var b=Math.abs(v[0][this._appointmentSettings.startTime]-f),y=parseInt((u-b)/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4)),p=l-(o-y)*(this.element.find(".e-workcells")[0].offsetHeight-1);this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:p});this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})}break;case"e-appdown":var k=e.scrollTop()+n(this.element.find(".e-vscroll")[0]).height(),s=parseInt(k/(this.element.find(".e-workcells")[0].offsetHeight-1)),nt=this.element.find(".e-draggableworkarea").find("tr").eq(s),u=(this.model.startHour*60+s*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4,f=new Date(new Date(this.dateRender[r]).setMilliseconds(u)),a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(this.dateRender[r]).setHours(23,59,59))),h=new t.DataManager(c).executeLocal((new t.Query).where(a));if(h.length!=0){var d=f.getTime()-h[0][this._appointmentSettings.endTime].getTime(),y=parseInt((u-d)/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4)),p=e.scrollTop()+(y-s)*(this.element.find(".e-workcells")[0].offsetHeight-1)+this.element.find("div#Appointment_"+h[0].AppTaskId).height();this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:p});this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})}}this._renderUpDownIconPosition();t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide")},_findAllDayApp:function(n){var i;if(!n[this._appointmentSettings.allDay])return i=n[this._appointmentSettings.recurrence]?new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n[this._appointmentSettings.id])):new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,n.ParentId)),t.isNullOrUndefined(i[0])?!1:(i[0][this._appointmentSettings.endTime]-i[0][this._appointmentSettings.startTime])/36e5>=24?!0:!1},_resourceOrderSort:function(i){if(i.length>0&&this._grouping.length==0&&this._tempResource.length>0){var r=this,u=[],e=this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),f=this._tempResource[this._tempResource.length-1].resourceSettings;i.forEach(function(t){var y=i.filter(function(n){return new Date(n[r._appointmentSettings.startTime]).getTime()==new Date(t[r._appointmentSettings.startTime]).getTime()&&new Date(n[r._appointmentSettings.endTime]).getTime()==new Date(t[r._appointmentSettings.endTime]).getTime()}),h=n(y).not(u),o,v,l,s;if(h.length!=0){var a=n.unique(h.map(function(n,t){return t[r._id+"_ownerfield_"+(r._tempResource.length-1)]})),p=f.dataSource.map(function(n){return n[f.id]}).toString(),c=a.length>0?a[0].split(","):p.split(",");for(o=0,v=c.length;o<v;o++)for(l=h.filter(function(n,t){return t[e]==(c[o]||parseInt(c[o]))}),s=0;s<l.length;s++)u.push(l[s])}});new t.DataManager(i).saveChanges({added:[],changed:[],deleted:u},"Guid");n.merge(i,u)}return i},_getDayAppointments:function(n,i){var f=this._dateRender,r=this._currentViewApp
10ointments=this.getCurrentViewAppointments(),s=new Date(new Date(f[n]).setHours(0,0,0)),h=new Date(new Date(f[n]).setHours(23,59,59)),v=t.Predicate(this._appointmentSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(s)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(h)),y=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(s)).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(h)),e=v.or(y),c,u,l,o,a;if(e=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim(),t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,e=!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?e.and(this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim(),t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.groupId]):e,r=new t.DataManager(r).executeLocal((new t.Query).where(e)),c=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(f[n-1]).setHours(24,0,0))).or(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(f[n])),r=new t.DataManager(r).executeLocal((new t.Query).where(c)),r=this._resourceOrderSort(r),this.model.orientation=="vertical"&&this._customOrientation=="vertical")for(u=0;u<r.length;u++)l=(r[u][this._appointmentSettings.endTime]-r[u][this._appointmentSettings.startTime])/36e5>=24,o=r[u][this._appointmentSettings.allDay],o=t.isNullOrUndefined(o)||o==""?!1:o,new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()==new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&o||l?this._setAllDayPos(r[u],n,i):new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(f[n]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()==new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(r[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&!o&&(this._findAllDayApp(r[u])?this._setAllDayPos(r[u],n,i):(a=this._renderedApp.filter(function(n){return n.Guid==r[u]}),a.length==0&&this._renderApp(r[u],n,i)));else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&this._getHorizontalDayAppointments(r,f,n,i)},_startUtc:function(n){!t.isNullOrUndefined(this.startutcValue)&&t.isNullOrUndefined(this.tempValue)?this._utcValue(n,"startUtc"):n.model.value==""?"":n.model.value==this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value")&&this._appointmentAddWindow.find("#"+this._id+"startTimeZone").attr("aria-expanded")=="true"?this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{text:n.text,value:n.value}):""},_endUtc:function(n){this._appointmentAddWindow.find("#"+this._id+"endTimeZone").attr("aria-expanded")=="true"?this._utcValue(n,"endUtc"):this.startutcValue=this.tempValue=null},_utcValue:function(n,i){var h,d,g,nt,l,a;t.preferredCulture(this.model.locale);i=="endUtc"?this._appointmentAddWindow.find(".endutc").val(n.text):"";var v={StartDate:this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("model.value"),EndDate:this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("model.value")},y={StartTime:this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("model.value"),EndTime:this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("model.value")},p=this._timeFormat(y.StartTime).split(":"),w=this._timeFormat(y.EndTime).split(":"),f=new Date(v.StartDate.setHours(parseInt(p[0],10),parseInt(p[1],10))),e=new Date(v.EndDate.setHours(parseInt(w[0],10),parseInt(w[1],10))),b=new Date(f),tt=new Date(e),u=i=="Appoint"?this.endTimeAppoint:i=="endUtc"?n.value:this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value"),r=i=="Appoint"?this.startTimeAppoint:i=="startUtc"?n.value:this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("model.value");if(r=r==""?this._timezoneStringValue():r,u=u==""?this._timezoneStringValue():u,u=u.indexOf("UTC")!=-1?parseInt(u.split(" ")[1].split(":")[0])*60+parseInt(u.split(" ")[1].split(":")[1]):parseInt(u.split(":")[0])*60+parseInt(u.split(":")[1]),r=r.indexOf("UTC")!=-1?parseInt(r.split(" ")[1].split(":")[0])*60+parseInt(r.split(" ")[1].split(":")[1]):parseInt(r.split(":")[0])*60+parseInt(r.split(":")[1]),h=u-r,f=new Date(f.setMinutes(f.getMinutes()+h)),i=="Appoint"){var k=new Date(n[this._appointmentSettings.startTime]),s=new Date(n[this._appointmentSettings.endTime]),c=t.isNullOrUndefined(this.model.timeZone)?-(new Date).getTimezoneOffset()+this._timeZoneOffset:this.model.timeZone.indexOf("UTC")!=-1?parseInt(this.model.timeZone.split(" ")[1].split(":")[0])*60+parseInt(this.model.timeZone.split(" ")[1].split(":")[1]):parseInt(this.model.timeZone.split(":")[0])*60+parseInt(this.model.timeZone.split(":")[1]),o=r==c?0:c-r;o=new Date(k.setMinutes(k.getMinutes()-o));d=this._timeMode=="12"?t.format(new Date(o),this._pattern.t,this.model.locale):t.format(new Date(o),"HH:mm",this.model.locale);this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker({value:t.format(new Date(o),this._datepattern(),this.model.locale)});g=u-c;this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:d})}e=i=="endUtc"||i=="Appoint"?new Date(b.setMinutes(b.getMinutes()+h)):f;e=i=="Appoint"?new Date(s.setMinutes(s.getMinutes()+g)):e;nt=this._timeMode=="12"?t.format(new Date(f),this._pattern.t,this.model.locale):t.format(new Date(f),"HH:mm",this.model.locale);i=="Appoint"?a=this._timeMode=="12"?t.format(new Date(s),this._pattern.t,this.model.locale):t.format(new Date(s),"HH:mm",this.model.locale):(l=new Date(e.setMinutes(e.getMinutes()+30)),a=this._timeMode=="12"?t.format(new Date(l),this._pattern.t,this.model.locale):t.format(new Date(l),"HH:mm",this.model.locale));this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker({value:t.format(new Date(e),this._datepattern(),this.model.locale)});this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:a});this.startutcValue=1},_rowHandlesOver:function(t){this.model.enableAppointmentResize&&n(t.target).addClass("e-rowcursor")},_colHandlesOver:function(t){this.model.enableAppointmentResize&&n(t.target).addClass("e-columncursor")},_getDateCount:function(n){var u,i,r,f;if(this._resWorkWeek)for(f=[],i=t.isNullOrUndefined(this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],i=this._resourceDaysReorder(i),r=0;r<i.length;r++)u=this._dayFullNames.indexOf(i[r].capitalizeFirstString()),u==-1&&(u=this._getDayNameIndex(i[r])),f.push(this._renderDates[u]);else f=this._resCustomView?this._resCustomDate[n]:this._dateRender;return f},_renderApp:function(i,r,u){var w=this.cellheight,y=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.startHour):0,b=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.endHour):24,p=this._getDateCount(u),e=new Date(i[this._appointmentSettings.startTime]),s=new Date(i[this._appointmentSettings.endTime]),kt=60-e.getMinutes(),h,c,k,nt,ut,ft,ot,d,et,st,l,f,ht,ct,o,lt,tt,at,it,yt,v,pt,g;if(e=new Date(e).getHours()<y?new Date(new Date(e).setHours(y-1,e.getMinutes()+kt,e.getSeconds())):e,this.model.orientation=="vertical"&&this._customOrientation=="vertical"){if(l=-1,e<=s&&new Date(p[0]).getTime()<=e.getTime()&&new Date(new Date(p[p.length-1]).setHours(23,59,59))>=e.getTime()&&(k=new Date(e).getHours()<y?new Date(e).getHours()+-new Date(e).getHours()+-new Date(e).getMinutes():new Date(e).getHours()+-y,nt=new Date(s).getHours()>b?new Date(s).getHours()+(-new Date(s).getHours()+(b-y))+-new Date(s).getMinutes():new Date(s).getHours()+-y,nt=new Date(s).getHours()==b?new Date(nt).getMinutes()+-new Date(s).getMinutes():nt,b<=s.getHours()?(ut=new Date(s.setHours(b,0,0
10)),c=parseFloat(new Date(ut).getHours()*60+new Date(ut).getMinutes()-(new Date(e).getHours()*60+new Date(e).getMinutes()))*w*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-2):(c=parseFloat(new Date(new Date(s).getTime())-new Date(new Date(e).getTime()))/6e4*w*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-2,c=i[this._appointmentSettings.endTime].getTimezoneOffset()-i[this._appointmentSettings.startTime].getTimezoneOffset()!=0?c-w*this.model.timeScale.minorSlotCount:c),c=c<0?w-2:c,ft=(parseFloat(new Date(e).getHours()*60+new Date(e).getMinutes()+new Date(e).getSeconds()/60)-parseInt(k*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-this.model.startHour*60)*w*(this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot),this.model.startHour<=new Date(e).getHours())){for(ot=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.id]:null,d=this._overlapApp(i.AppTaskId,i[this._appointmentSettings.startTime],i[this._appointmentSettings.endTime],ot),f=this,et=this._grouping.length>0&&this._tempResource.length>0&&this._tempResource[0].resourceSettings.dataSource.length>0&&t.scheduleFeatures.resources?d.filter(function(n){return(n[f._appointmentSettings.startTime].getTime()==i[f._appointmentSettings.startTime].getTime()&&n[f._appointmentSettings.endTime].getTime()>i[f._appointmentSettings.endTime].getTime()||n[f._appointmentSettings.endTime]>i[f._appointmentSettings.startTime]&&n[f._appointmentSettings.startTime]<i[f._appointmentSettings.endTime]||n[f._appointmentSettings.endTime].getTime()==i[f._appointmentSettings.startTime].getTime()&&n[f._appointmentSettings.startTime].getTime()==i[f._appointmentSettings.endTime].getTime())&&n[f._appointmentSettings.resourceFields.toString().split(",")[f._tempResource.length-1].trim()]==f.res1[u][f._tempResource[f._tempResource.length-1].resourceSettings.id]}):d.filter(function(n){return n[f._appointmentSettings.startTime].getTime()==i[f._appointmentSettings.startTime].getTime()&&n[f._appointmentSettings.endTime].getTime()>i[f._appointmentSettings.endTime].getTime()||n[f._appointmentSettings.endTime]>i[f._appointmentSettings.startTime]&&n[f._appointmentSettings.startTime]<i[f._appointmentSettings.endTime]||n[f._appointmentSettings.endTime].getTime()==i[f._appointmentSettings.startTime].getTime()&&n[f._appointmentSettings.startTime].getTime()==i[f._appointmentSettings.endTime].getTime()}),et.length>0&&(st=n.map(et,function(n){return[n.Index]}),l=this._smallestMissingNumber(st)),l=l==-1?0:l,i.Index=l,d.push(i),d.length!=1?t.isNullOrUndefined(this._variable[l])?this._variable.push([i]):this._variable[l].push(i):(this._variable=[],this._variable.push([i])),ht=this.element.find(".e-workcells").width()<20?60:90,h=(ht-this._variable.length)/this._variable.length+"%",this.leftPosition="0%",ct=this._resWorkWeek||this._resCustomView?0:this._dateRender.length*u,o=0,lt=this._variable.length;o<lt;o++)for(tt=0,at=this._variable[o].length;tt<at;tt++){var vt=this.element.find(".e-workcellstab tr td:nth-child("+(ct+r+1)+")").find(".e-appointwrapper").find(".e-appointment"),it=this._variable[o][tt].Guid,a=vt.filter("div[data-guid="+it+"]");t.isNullOrUndefined(a[0])||it==i.Guid?(h=t.isNullOrUndefined(this._variable[o-1])?(90-this._variable.length)/this._variable.length:!t.isNullOrUndefined(this.element.find("[data-guid="+this._variable[o-1][0].Guid+"]")[0])&&parseFloat(this.element.find("[data-guid="+this._variable[o-1][0].Guid+"]")[0].style.width),this.leftPosition=(h+1)*l+"%"):parseFloat(h)<=parseFloat(a[0].style.width)?(this.model.enableRTL?a[0].style.right=(parseFloat(h)+1)*o+"%":a[0].style.left=(parseFloat(h)+1)*o+"%",a[0].style.width=parseFloat(h)+"%"):(it=this._variable[t.isNullOrUndefined(this._variable[o-1])?o:o-1][0].Guid,yt=vt.filter("div[data-guid="+it+"]"),a[0].style.width=yt[0].style.width,this.model.enableRTL?a[0].style.right=(parseFloat(a[0].style.width)+1)*o+"%":a[0].style.left=(parseFloat(a[0].style.width)+1)*o+"%")}if(h=parseFloat(h)+"%",i.inline||this._renderedApp.push(n.extend(!0,{},i)),v=this._appointmentColor(i),this.model.allowInline&&!t.isNullOrUndefined(i.inline))this._inlineTemplate(i,this.leftPosition,ft,h,c,v,!0),pt=this._resWorkWeek||this._resCustomView?k*this.model.timeScale.minorSlotCount*this.element.find(".e-headercells").length+r:parseInt(k*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*p.length*this.res1.length+r+p.length*u,g=this.element.find("td.e-workcells").eq(pt),g.prepend(n("<div class='e-inlinewrapper' style='position:relative;'><\/div>").append(this._inlineText));else{var wt=this.model.appointmentTemplateId?!0:!1,dt=wt?this._getUserAppointmentTemplate(i):"",gt=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),ni=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale),ti=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,bt=this._indicationApp(i),rt=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),appHeight:c,rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!v.appoint
10Color.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:gt,endTime:ni,left:this.leftPosition,top:ft,appWidth:h,userAppTemplId:wt,userTemplate:dt,appClass:"e-appointment",appointData:v.appointColor.appointData,appointCustomcss:v.appointColor.appointCustomcss,appointtextcolor:v.appointColor.appointtextcolor,value:v.value,multiDiv:v.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:ti,topInd:bt.leftIndication,bottomInd:bt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),l=this._resWorkWeek||this._resCustomView?k*this.model.timeScale.minorSlotCount*this.element.find(".e-headercells").length+r:parseInt(k*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*p.length*this.res1.length+r+p.length*u,g=this.element.find("td.e-workcells").eq(l),ii=t.format(i[this._appointmentSettings.startTime],this._pattern.f,this.model.locale)+"to "+t.format(i[this._appointmentSettings.endTime],this._pattern.f,this.model.locale);rt.find(".e-apptime").attr("aria-label",ii);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,rt);g.find("div.e-appointwrapper").length>0?g.find("div.e-appointwrapper").append(rt):g.prepend(n("<div class='e-appointwrapper'><\/div>").append(rt))}}}else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&this._renderHorizontalApp(e,s,i,r,w,this.model.timeScale.minorSlotCount,y,b);delete i.Index},_priorityTemplate:function(n){return this.model.prioritySettings.template.replace("{","").replace("$","").replace("}","").replace(this.model.prioritySettings.template.indexOf("value")!=-1?this.model.prioritySettings.value:this.model.prioritySettings.text,n[this._appointmentSettings.priority])},_getUserAppointmentTemplate:function(t){var r=n.templates(n(this.model.appointmentTemplateId).html()),i=n.extend(i,t);return i.View=this.currentView(),r.render(i)},_getUserTimeCellsTemplate:function(){for(var i,e=n.templates(n(this.model.timeScale.minorSlotTemplateId).html()),u,f=[],r=this.model.startHour;r<this.model.endHour;){for(i=t.isNullOrUndefined(i)?0:i%60;i<60;)i=i*6e4,u=e.render({date:new Date(new Date(this._dateRender[0]).setHours(r,0,0,i))}),f.push({time:u.trim(),id:r+"_"+i}),i=i/6e4+this.model.timeScale.majorSlot;r=this.model.timeScale.majorSlot>60?r+this.model.timeScale.majorSlot/60:r+1}return f},_getUserAllDayCellsTemplate:function(){for(var r=[],u,e,i,f=n.templates(n(this.model.allDayCellsTemplateId).html()),t=0;t<this.res1.length;t++)for(i=0;i<this._dateRender.length;i++)u=new Date(new Date(this._dateRender[i]).setHours(this.model.startHour,0,0)),e=f.render({date:u,view:this.currentView(),resource:this.res1[t],timescale:this.model.timeScale.enable}),r.push(e.trim());return r},_getUserDateheaderTemplate:function(){for(var r=[],f,e,o,s,u=n.templates(n(this.model.dateHeaderTemplateId).html()),i=0;i<this._dateRender.length;i++)f=u.render({date:new Date(this._dateRender[i])}),e=this.currentView()==="month"||this.currentView()==="day"||this._isCustomMonthView()?this._tempResource.length==0&&t.isNullOrUndefined(this.model.group)?this._dayFullNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()]:this._dayShortNames[new Date(this._dateRender[i]).getDay()],o=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":"",s=this.currentView()==="month"||this._isCustomMonthView()?{currentDay:e,currentDateClass:"",cellToday:""}:{currentDay:f,currentDateClass:new Date(this._dateRender[i]).getDate()===new Date(this.currentDate()).getDate()?"e-activeview":"",cellToday:o},r.push(s),this._value.push(i);return r},_getUserWorkCellsTemplate:function(){var f,r=[],h=[],s,o,e=0,l=this.model.timeScale.minorSlotCount,a,p,u,y,g,nt,k,t,i;if(s=n.templates(n(this.model.workCellsTemplateId).html()),this._isCustomMonthView(),this.model.orientation=="vertical"&&this._customOrientation=="vertical")if(this.currentView()=="month"||this._isCustomMonthView())for(a=0,p=this.model.showWeekend?7:this.model.workWeek.length,t=0;t<this._dateRender.length/p;t++){for(r=[],i=0;i<this.res1.length;i++)for(a=t*7,u=0;u<p;u++)f=new Date(new Date(this._dateRender[a]).setHours(this.model.startHour,e,0)),o=s.render({date:f,view:this.currentView(),resource:this.res1[i],timescale:this.model.timeScale.enable}),r.push(o.trim()),a++;h.push(r)}else for(t=0;t<(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);t++){for(r=[],i=0;i<this.res1.length;i++)for(u=0;
10u<this._dateRender.length;u++)f=new Date(new Date(this._dateRender[u]).setHours(this.model.startHour,e,0)),o=s.render({date:f,view:this.currentView(),resource:this.res1[i],timescale:this.model.timeScale.enable}),r.push(o.trim());e=e+this.model.timeScale.majorSlot/l;h.push(r)}else{var d,v=[],w=[],b=[],c=this._tempResource.length==0?this.res1:this._resourceSort();if(this.model.timeScale.enable&&this.currentView()!="month"&&!this._isCustomMonthView())for(t=0;t<c.length;t++){for(r=[],w=[],b=[],i=0;i<this._dateRender.length;i++)for(e=0,u=0;u<(this.model.endHour-this.model.startHour)*(60/this.model.timeScale.majorSlot);u++)for(y=0;y<l;y++)f=new Date(new Date(this._dateRender[i]).setHours(this.model.startHour,e,0)),y==0?(o=s.render({date:f,view:this.currentView(),resource:c[t],timescale:this.model.timeScale.enable}),r.push(o.trim())):(d=s.render({date:f,view:this.currentView(),resource:c[t],timescale:this.model.timeScale.enable}),v.push(d.trim()),v.length==l-1&&(b.push(v),v=[])),e=e+this.model.timeScale.majorSlot/l;g=n.extend(!0,[],r);nt=n.extend(!0,[],b);w.push(g,nt);h.push(w)}else for(k=!this.model.timeScale.enable&&this.currentView()!="month"||this.currentView()=="customview"&&this._oneWeek?this._dateRender:this.monthDays,t=0;t<c.length;t++){for(r=[],i=0;i<k.length;i++)f=new Date(new Date(k[i]).setHours(this.model.startHour,e,0)),o=s.render({date:f,view:this.currentView(),resource:c[t],timescale:this.model.timeScale.enable}),r.push(o.trim());h.push(r)}}return h},_overlapApp:function(i,r,u,f){var o=this._renderedApp,h=[],c=[],a=[],l=[],e,s;if(this.model.orientation=="vertical"&&this._customOrientation=="vertical")e=this,h=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.filter(function(n){return(n[e._appointmentSettings.startTime].getTime()==r.getTime()&&n[e._appointmentSettings.endTime].getTime()>u.getTime()||n[e._appointmentSettings.endTime]>r&&n[e._appointmentSettings.startTime]<u||n[e._appointmentSettings.endTime].getTime()==r.getTime()&&n[e._appointmentSettings.startTime].getTime()==u.getTime())&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==f}):o.filter(function(n){return n[e._appointmentSettings.startTime].getTime()==r.getTime()&&n[e._appointmentSettings.endTime].getTime()>u.getTime()||n[e._appointmentSettings.endTime]>r&&n[e._appointmentSettings.startTime]<u||n[e._appointmentSettings.endTime].getTime()==r.getTime()&&n[e._appointmentSettings.startTime].getTime()==u.getTime()}),h.forEach(function(i){a=!t.isNullOrUndefined(e.model.group)&&e._tempResource.length!=0&&e._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?o.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(i[e._appointmentSettings.startTime])&&n[e._appointmentSettings.startTime]<=new Date(i[e._appointmentSettings.endTime])&&n[e._appointmentSettings.resourceFields.toString().split(",")[e._tempResource.length-1].trim()]==f}):o.filter(function(n){return n[e._appointmentSettings.endTime]>=new Date(i[e._appointmentSettings.startTime])&&n[e._appointmentSettings.startTime]<=new Date(i[e._appointmentSettings.endTime])});var r=n(a).not(h);return r.length!=0&&(c=n.merge(c,r)),c}),l=n.merge(h,c);else if((this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal)for(s=0;s<o.length;
10s++)t.scheduleFeatures.resources&&this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)?new Date(o[s][this._appointmentSettings.endTime])>new Date(r)&&new Date(o[s][this._appointmentSettings.startTime])<=new Date(u)&&o[s][this._tempResource[this._tempResource.length-1].field]==f&&new Date(new Date(o[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(r).setHours(0,0,0,0)).getTime()&&l.push(o[s]):new Date(o[s][this._appointmentSettings.endTime])>new Date(r)&&new Date(o[s][this._appointmentSettings.startTime])<=new Date(u)&&new Date(new Date(o[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(r).setHours(0,0,0,0)).getTime()&&l.push(o[s]);return l},_getOverlapCount:function(i,r,u,f){var s,o,c,e,y,l,a,p,w,h,v;if(this._renderedAllDay.length==0)i.Index=0,h=0;else{if(v=[],s=this,o=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?this._renderedAllDay.filter(function(n){return(n[s._appointmentSettings.endTime]>=new Date(u[r])&&n[s._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))||n[s._appointmentSettings.startTime]>=new Date(u[r])&&n[s._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59)))&&n[s._appointmentSettings.resourceFields.toString().split(",")[s._tempResource.length-1].trim()]==i[s._appointmentSettings.resourceFields.toString().split(",")[s._tempResource.length-1].trim()]}):this._renderedAllDay.filter(function(n){return n[s._appointmentSettings.endTime]>=new Date(u[r])&&n[s._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))||n[s._appointmentSettings.startTime]>=new Date(u[r])&&n[s._appointmentSettings.startTime]<=new Date(new Date(u[r]).setHours(23,59,59))}),c=[],this.model.orientation=="vertical"&&this._customOrientation=="vertical")for(e=0,y=o.length;e<y;e++)this.currentView()=="day"&&(a=this._currentAppointmentData.filter(function(n){return n.Guid==o[e].Guid}),t.isNullOrUndefined(a[e])||(o[e][this._appointmentSettings.endTime]=a[e][this._appointmentSettings.endTime],o[e][this._appointmentSettings.startTime]=a[e][this._appointmentSettings.startTime])),l=(o[e][this._appointmentSettings.endTime]-o[e][this._appointmentSettings.startTime])/36e5>=24,new Date(new Date(o[e][this._appointmentSettings.endTime]).setMilliseconds(-1e3)).getDate()==o[e][this._appointmentSettings.startTime].getDate()&&o[e][this._appointmentSettings.startTime].getTimezoneOffset()!=o[e][this._appointmentSettings.endTime].getTimezoneOffset()&&(l=!1),p=l&&new Date(new Date(o[e][this._appointmentSettings.endTime]).setMilliseconds(-1e3)).getDate()==o[e][this._appointmentSettings.startTime].getDate()?!0:!1,w=o[e][this._appointmentSettings.allDay],(new Date(new Date(u[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(o[e][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&w||l)&&(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)?o[e][this._tempResource[this._tempResource.length-1].field]==f:!0)&&(p||c.push(o[e]));else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&(c=this._getHorizontalOverlapCount(o,u,r,i,f));h=-1;h=this._findResourceIndex(c,"AppTaskId",i.AppTaskId,null,null);v=n.map(c,function(n){return[n.Index]});h=this._smallestMissingNumber(v);i.Index=h;h=h==-1?0:h}return h},_smallestMissingNumber:function(n){var i,t;if(n.length==0)return 0;for(i=Math.max.apply(Math,n),t=0;t<i;t++)if(n.indexOf(t)==-1)return t;return i+1},_setAllDayPos:function(i,r,u){var v=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._getOverlapCount(i,r,this._dateRender,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()]):this._getOverlapCount(i,r,this._dateRender,null),e=new Date(i[this._appointmentSettings.startTime]),f=new Date(i[this._appointmentSettings.endTime]),et,k,nt,p,ht,tt,y,h,s,c,l,ft;if(new Date(e)<=new Date(f)){var o=this._dateRender,d,b=0,a=this.element.find(".e-alldayappointment").length>0?this.element.find(".e-alldayappointment").outerHeight(!0):this._getElementHeight("e-alldayappointment"),g=a;if(this.level<=v&&(et=(v+1)*g+this.alldaycellsheight,this.element.find(".e-alldaycells,.e-leftindent").removeClass("e-alldaycellsheight").css("height",et+"px"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),this.element.find(".e-vscroll").length==0&&this.level==0&&this._reRenderScroller()),this._overflowFlag=!0,this._resWorkWeek){for(nt=[],k=t.isNullOrUndefined(this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:this.res1[u][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],p=0;p<k.length;p++)y=this._dayFullNames.indexOf(k[p].capitalizeFirstString()),y==-1&&(y=this._getDayNameIndex(k[p])),nt.push(this._renderDates[y]);o=nt}if(this._resCustomView&&(o=this._resCustomDate[u]),ht=n.inArray(new Date(i[this._appointmentSettings.startTime]).getTime(),o)==-1?i[this._appointmentSettings.startTime]:new Date(o[0]),tt=new Date(new Date(o[o.length-1]).setHours(23,59,59)),f=new Date(f)>new Date(tt)?tt:f,(this.currentView()=="workweek"||this.currentView()=="week"&&!this.model.showWeekend)&&n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this._dateRender)==-1)for(c=1;c<this._dateRender.length;c++)if(n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()-c).getTime(),this._dateRender)>0){y=n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()-c).getTime(),this._dateRender);f=new Date(new Date(this._dateRender[y]).setHours(i[this._appointmentSettings.endTime].getHours(),i[this._appointmentSettings.endTime].getMinutes(),i[this._appointmentSettings.endTime].getSeconds()));break}if(i.inline||this._renderedAllDay.push(n.extend(!0,{},i)),h=this._resWorkWeek||this.currentView()=="workweek"||this.currentView()=="week"&&!this.model.showWeekend?f.getHours()==0&&f.getMinutes()==0?i[this._appointmentSettings.allDay]?n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),o)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o)+1:n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),o)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o):n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),o)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o)+1:this.currentView()=="week"||this.currentView()=="day"||this.currentView()=="customview"&&parseFloat((f-e)/36e5)<=24?f.getHours()==0&&f.getMinutes()==0?i[this._appointmentSettings.allDay]?Math.ceil((new Date(f)-new Date(e))/864e5)+1:Math.ceil((new Date(f)-new Date(e))/864e5):Math.ceil((new Date(f).setHours(23,59,59)-new Date(e).setHours(0,0,0))/864e5):n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),this._dateRender)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),this._dateRender)+1,n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o)==-1&&this.currentView()=="workweek"||this.currentView()=="week"&&!this.model.showWeekend){for(s=new Date(i[this._appointmentSettings.startTime]),c=0;c<this._dateRender.length;c++)if(n.inArray(new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),o)==-1&&s.setDate(s.getDate()+1),n.inArray(new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),o)!=-1)break;e=s;h=n.inArray(new Date(f.getFullYear(),f.getMonth(),f.getDate()).getTime(),o)-n.inArray(new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o)+1}h=e.getTimezoneOffset()!=f.getTimezoneOffset()?h-1:h;h<=0&&(h=1);var ct=this.element.find(".e-alldaycells").width(),it=this._dateRender.length,rt=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._grouping.length:0,ut=this.currentView()==="day"?0:this._dateRender.indexOf(new Date(e).setHours(0,0,0));if(this._resWorkWeek||this._resCustomView?b=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[r].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[r].offsetLeft:t.isNullOrUndefined(this.element.find(".e-alldaycells")[ut+u*it])||(b=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[ut+u*it].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[ut+u*it].offsetLeft),d=h*ct+h-2,a=v*a+(v+1)+this.element.find(".e-headercells").outerHeight()+(rt!=0?rt*this.element.find(".e-headerbar").first().height():rt),(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"&&this.element.find(".e-monthnamerow").length>0&&(a=this.element.find(".e-monthnamerow").height()+a),l=this._appointmentColor(i),this.model.allowInline&&!t.isNullOrUndefined(i.inline))this._inlineTemplate(i,b,a,d,g,l,!1),this.element.find(".e-headrealldaytable").append(this._inlineText);else{var ot=this.model.appointmentTemplateId?!0:!1,lt=ot?this._getUserAppointmentTemplate(i):"",at=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),vt=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale),yt=i[this._appointmentSettings.recurrence]?i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1:!1,w=this._indicationApp(i),st=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),top:a,rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!l.appoint
10Color.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:at,endTime:vt,appHeight:this.model.appointmentTemplateId?g:"",appWidth:d+"px",allday:!0,left:b+"px",userAppTemplId:ot,userTemplate:lt,appClass:"e-alldayappointment",appointData:l.appointColor.appointData,appointCustomcss:l.appointColor.appointCustomcss,appointtextcolor:l.appointColor.appointtextcolor,value:l.value,multiDiv:l.multiDiv,orientation:this.model.orientation,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:yt,leftInd:w.leftIndication,rightInd:w.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]}));t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,st);this.element.find(".e-headrealldaytable").append(st)}}this._alldayLevel=!1;this.level=this.level<v?v:this.level;i[this._appointmentSettings.recurrence]||this.model.allowInline||(ft=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId)),new Date(i[this._appointmentSettings.endTime])<ft[0][this._appointmentSettings.endTime]&&(this.model.enableRTL?this.element.find("div[data-guid="+i.Guid+"]").children(".e-lefthandle").remove():this.element.find("div[data-guid="+i.Guid+"]").children(".e-righthandle").remove()),new Date(i[this._appointmentSettings.startTime])>ft[0][this._appointmentSettings.startTime]&&(this.model.enableRTL?this.element.find("div[data-guid="+i.Guid+"]").children(".e-righthandle").remove():this.element.find("div[data-guid="+i.Guid+"]").children(".e-lefthandle").remove()));t.isNullOrUndefined(w)||(w.leftIndication&&(this.model.enableRTL?this.element.find("div[data-guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find("div[data-guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),w.rightIndication&&(this.model.enableRTL?this.element.find("div[data-guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find("div[data-guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")));delete i.Index},_indicationApp:function(i){var u=!1,f=!1,r=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId))[0],s,h,c,e,l,o;return t.isNullOrUndefined(r)?{leftIndication:!1,rightIndication:!1}:(r[this._appointmentSettings.endTime].getHours()==0&&r[this._appointmentSettings.endTime].getMinutes()==0&&(r=n.extend(!0,[],r),r[this._appointmentSettings.endTime]=new Date(r[this._appointmentSettings.endTime].getTime()-1e3)),c=this.currentView()=="day"?[new Date(this._dateRender[0]).getTime()]:this._dateRender,s=n.inArray(new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime(),c),h=n.inArray(new Date(new Date(i[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime(),c),e=s!=h&&new Date(new Date(r[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(r[this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(r[this._appointmentSettings.endTime]-r[this._appointmentSettings.startTime])/36e5<24||i[this._appointmentSettings.endTime].getHours()==this.model.endHour&&i[this._appointmentSettings.endTime].getMinutes()>0||i[this._appointmentSettings.endTime].getHours()>this.model.endHour||i[this._appointmentSettings.startTime].getHours()<this.model.startHour,i[this._appointmentSettings.recurrence]?(l=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.Guid)),l.length>=1&&(o=this._sortAppById(l),e&&o[o.length-1][this._appointmentSettings.endTime].getHours()>=this.model.endHour&&this.currentView()!="month"?this.model.enableRTL?u=!0:f=!0:e&&o[0][this._appointmentSettings.startTime].getHours()<this.model.startHour&&this.currentView()!="month"&&(this.model.enableRTL?f=!0:u=!0),(o[0][this._appointmentSettings.startTime]<i[this._appointmentSettings.startTime]||s==-1)&&!e&&(this.model.enableRTL?f=!0:u=!0),(o[o.length-1][this._appointmentSettings.endTime]>i[this._appointmentSettings.endTime]||h==-1)&&!e&&(this.model.enableRTL?u=!0:f=!0))):(e&&r[this._appointmentSettings.endTime].getHours()>=this.model.endHour&&this.currentView()!="month"?this.model.enableRTL?u=!0:f=!0:e&&r[this._appointmentSettings.startTime].getHours()<this.model.startHour&&this.currentView()!="month"&&(this.model.enableRTL?f=!0:u=!0),(new Date(r[this._appointmentSettings.startTime])<i[this._appointmentSettings.startTime]||s==-1)&&!e&&(this.model.enableRTL?f=!0:u=!0),(new Date(r[this._appointmentSettings.endTime])>i[this._appointmentSettings.endTime]||h==-1)&&!e&&(this.model.enableRTL?u=!0:f=!0)),{leftIndication:t.isNullOrUndefined(u)?!1:u,rightIndication:t.isNullOrUndefined(f)?!1:f})}
10,_reRenderScroller:function(){var i,u,e;t.isNullOrUndefined(this._appointmentAddWindow)||(i=this._appointmentAddWindow.data("ejDialog"),i.option("enableAnimation",!1),i.close());var n=this.element.find("div#"+this._id+"_scroller"),r=n.data("ejScroller"),f=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?parseInt(this.element.width())-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?parseInt(this.element.width())-parseInt(this.element.find(".e-resourceheadertable").width()):parseInt(this.element.width());r.model.width=parseInt(f)-2;r.model.height=this.scHeight-1-(this.wTR.find(".e-draggableworkarea").offset().top-this.element.offset().top);r.refresh();this.model.cellWidth!=""&&(u=(parseInt(this.model.cellWidth)+1)*this.element.find("div.e-draggableworkarea tr:first td").length,e=this.wTR.find(".e-scrolltimecells").length>0?this.wTR.find(".e-scrolltimecells").width():0,this.wTR.find(".e-draggableworkarea").width(this.element.width()>u+e+(n.ejScroller("isVScroll")?18:0)?u-1:f-2-(n.ejScroller("isVScroll")?18:0)),this.aTR.find(".e-headeralldaydiv").width(this.wTR.find(".e-draggableworkarea").width()));this.model.orientation!="vertical"||this._customOrientation!="vertical"||this.model.cellHeight||this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable||this.element.find(".e-draggableworkarea").height(r.model.height-(n.ejScroller("isHScroll")?18:0));this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._mediaQuery&&this.res1.length>1&&this.element.find(".e-draggableworkarea").width(this.element.find(".e-draggableworkarea").width()*this.res1.length);this.aTR.find(".e-headeralldaydiv").width(this.wTR.find(".e-draggableworkarea").width());this.wTR.find(".e-scrolltimecells").css("top",-this.wTR.find(".e-draggableworkarea").scrollTop()+"px");this._mediaQuery&&!t.isNullOrUndefined(this._appointmentAddWindow)&&this._appointmentAddWindow.ejDialog("close");t.isNullOrUndefined(this._appointmentAddWindow)||i.option("enableAnimation",!0);((this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&n.ejScroller("isVScroll")||this._mediaQuery)&&this._renderHoriVerticalScroll();this._showScrollTd()},_appointmentSort:function(n){var t=this;return this.currentView()=="agenda"?n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime],f=n[t._appointmentSettings.endTime],e=i[t._appointmentSettings.endTime];return r.getTime()-u.getTime()||f.getTime()-e.getTime()}):this.currentView()!="day"?n.sort(function(n,i){var o=n[t._appointmentSettings.endTime]-n[t._appointmentSettings.startTime],s=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime],f=new Date(n[t._appointmentSettings.startTime]),e=new Date(i[t._appointmentSettings.startTime]),h=new Date(n[t._appointmentSettings.endTime]),c=new Date(i[t._appointmentSettings.endTime]),r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime];return f==e&&h==c?r-u||n.Guid.localeCompare(i.Guid):f-e==0?s-o||r-u||n.Guid.localeCompare(i.Guid):r-u||n.Guid.localeCompare(i.Guid)}):n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime],f=n[t._appointmentSettings.endTime]-n[t._appointmentSettings.startTime],e=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime];return r-u||e-f||n.Guid.localeCompare(i.Guid)}),n},_alldaySort:function(n){for(var i=[],t=0;t<n.length;t++)(new Date(n[t][this._appointmentSettings.endTime])-new Date(n[t][this._appointmentSettings.startTime]))/36e5<24&&!n[t][this._appointmentSettings.allDay]&&i.push(n[t]);return i},_appointmentRecurrenceSort:function(n){var t=this;return n.sort(function(n,i){var r=n[t._appointmentSettings.startTime],u=i[t._appointmentSettings.startTime];return r-u}),n},_renderMonthAppointment:function(){var u,e,f,s,a,v,r,y,o,h,c,p,w;this._overflowFlag=!1;this.filterData=[];this._renderedApp=[];this.element.find(".e-appointwrapper").remove();this.model.showOverflowButton||(this.initialCellHeight=this.model.cellHeight?parseInt(this.model.cellHeight):parseInt(this.element.find(".e-draggableworkarea").height()/this.element.find(".e-draggableworkarea tr").length));u=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.currentView()=="month"&&!this.model.showNextPrevMonth?this.monthDays:this._dateRender:this.monthDays;this._resCustomView?(e=n.extend(!0,[],u),e.sort()):e=u;
10var i=this._currentViewAppointments=this.getCurrentViewAppointments(),b=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(e[0])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(e[e.length-1]).setHours(23,59,59))),l=new t.DataManager(i).executeLocal((new t.Query).where(b));for(i=l,u=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this._dateRender:this.monthDays,this.model.group&&(this._tempResource.length==0||this._tempResource[0].resourceSettings.dataSource.length!=0)||(this.res1=["0"]),f=0,s=u.length,new Date(u[0])<this.model.minDate&&(f=Math.floor((new Date(this.model.minDate)-new Date(u[0]))/864e5)),new Date(u[u.length-1])>this.model.maxDate&&(s=u.length-Math.floor((new Date(u[u.length-1])-new Date(this.model.maxDate))/864e5)),f;f<s;f++)for(a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(u[f])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(u[f]).setHours(23,59,59))),i=new t.DataManager(l).executeLocal((new t.Query).where(a)),v=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(u[f])),i=new t.DataManager(i).executeLocal((new t.Query).where(v)),i=this._resourceOrderSort(i),r=0;r<i.length;r++)y=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!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,i[r][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]])):this.res1,y.length!=0&&new Date(new Date(u[f]).setHours(0,0,0,0)).getTime()==new Date(new Date(i[r][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(u[f]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(i[r][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(i[r][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(o=this._tempResource.length==0?0:this._tempResource.length>0&&this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],null,null):this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2]]),h=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._grouping.length>1?this._getIndex(f,i[r],u,this._renderedApp,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()],i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()]):this._getIndex(f,i[r],u,this._renderedApp,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()],null):this._getIndex(f,i[r],u,this._renderedApp,null,null),this._tempResource.length!=0&&(c=this._resCollection,p=this._horiGroupCollection()),w=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(c[0].dataSource,c[0].id,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()],null,null)+1:0:!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(p,this._tempResource[this._tempResource.length-2].resourceSettings.id,i[r][this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()],null,null)+1:0,cellId=this._renderCellId(i[r],f,o),celltd=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.element.find("td.e-monthcells").eq(cellId-1):this.element.find(".e-workcellstab tr").eq(o-1+w-1).find("td.e-workcells").eq(cellId-1),this.model.showOverflowButton&&celltd.find(".e-appsoverflow").length>0?(celltd.find(".e-appsoverflow").attr("data-appcount",h+1),this._renderedApp.push(n.extend(!0,{},i[r])),delete i[r].Index):this._renderAppointmentMonth(i[r],f,o,h));this._overflowFlag&&(this._reRenderScroller(),this._overflowFlag=!1);this.model.showAppointmentNavigator&&this._nextPrevButton()},_wireResizeEvents:function(){if(this.model.enableAppointmentResize&&!this.model.readOnly){this.element.find("div.e-lefthandle,div.e-righthandle,div.e-tophandle,div.e-bottomhandle").on("mousedown",n.proxy(this._appointmentResizeStart,this));this._on(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",n.proxy(this._colHandlesOver,this));this._on(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",n.proxy(this._rowHandlesOver,this))}},_unWireResizeEvents:function(){this.model.enableAppointmentResize&&(this.element.find("div.e-lefthandle,div.e-righthandle,div.e-tophandle,div.e-bottomhandle").off("mousedown",n.proxy(this._appointmentResizeStart,this)),this._off(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",n.proxy(this._colHandlesOver,this)),this._off(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",n.proxy(this._rowHandlesOver,this)))},_recuCollectionIndex:function(n,t){for(var r,u=this._appointmentSettings,i=0;i<n.length;i++)if(n[i].Guid==t.Guid&&n[i].AppTaskId==t.AppTaskId){r=i;break}return r},_getIndex:function(i,r,u,f,e,o){var h,s,y,c,v;if(this._renderedApp.length==0)r.Index=0,c=0;else{var v=[],l=this,p=u.length,a=[];for(h=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.resources&&this._tempResource.length>0&&this._grouping.length>0?f.filter(function(n){return n[l._appointmentSettings.resourceFields.toString().split(",")[l._tempResource.length-1].trim()]==r[l._appointmentSettings.resourceFields.toString().split(",")[l._tempResource.length-1].trim()]}):f,s=0,y=h.length;s<y;s++)(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0?this._grouping.length>1?h[s][this._tempResource[this._tempResource.length-1].field]==e&&h[s][this._tempResource[this._tempResource.length-2].field]==o:h[s][this._tempResource[this._tempResource.length-1].field]==e:!0)&&new Date(new Date(h[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(h[s][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(u[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(h[s][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(h[s][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&a.push(h[s]);c=-1;a.length>0&&(v=n.map(a,function(n){return[n.Index]}),c=this._smallestMissingNumber(v));c=c==-1?0:c;r.Index=c}return c},_recurrenceLocal:function(){var r=t.RecurrenceEditor.Locale[this.model.locale]=n.extend(!0,{},t.RecurrenceEditor.Locale["en-US"]),i=this;n.each(r,function(n){t.RecurrenceEditor.Locale[i.model.locale][n]=i._getLocalizedLabels(n)})},_minMaxIndex:function(){var t=n.unique(this._dateRender.map(function(n){return new Date(n).getDay()})),i=Math.min.apply(Math,t),r=Math.max.apply(Math,t);return{minIndex:i,maxIndex:r}},_renderCellId:function(n,i,r){var u=this.model.showWeekend?7:this._minMaxIndex().maxIndex+1,f=new Date(n[this._appointmentSettings.startTime]),e=Math.ceil((i+1)/(this.model.showWeekend?u:this.model.workWeek.length)),o;return o=this.model.showWeekend?this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.currentView()=="day"?r+1:this.currentView()=="workweek"||this._isCustomMonthView()&&this._oneWeek?r*this._dateRender.length+(i+1):this.currentView()=="workweek"?r*this._dateRender.length+(new Date(f).getDay()+1)+(e-1)*this.res1.length*this._dateRender.length:this._firstdayofweek==0?r*u+(new Date(f).getDay()+1)+(e-1)*this.res1.length*u:this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._firstdayofweek!=0?r*u+(new Date(f).getDay()+1)+(e-1)*this.res1.length*u-this._firstdayofweek:i+1:i+1:this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._isCustomMonthView()&&!this._oneWeek?r*u+(new Date(f).getDay()+1)+(e-1)*this.res1.length*u:i+1:this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(e-1)*this.res1.length*this.model.workWeek.length+r*this.model.workWeek.length+i%this.model.workWeek.length+1:i+1,this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._firstdayofweek!=0&&new Date(f).getDay()<this._firstdayofweek&&(o=r*u+(new Date(f).getDay()+1)+(e-1)*this.res1.length*u-this._firstdayofweek+u),o},_renderAppointmentMonth:function(i,r,u,f){var st=this.model.orientation=="vertical"&&this._customOrientation=="vertical"||!this.model.timeScale.enable?this._dateRender:this.monthDays,tt=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?"td.e-monthcells":"td.e-workcells",yi=this._renderedApp,ct=new Date(i[this._appointmentSettings.startTime]),bt=new Date(i[this._appointmentSettings.endTime]),s,y=0,l=new Date(ct),p=new Date(bt),kt=new Date(new Date(st[st.length-1]).setHours(23,59,59)),d,dt,gt,it,rt,g,e,lt,et,a,o,ht,fi,ot,wt;for(p=p>
10kt?kt:p,d=l.getHours()==0&&p.getHours()==0?i[this._appointmentSettings.allDay]?Math.ceil((new Date(p)-new Date(l))/864e5)+1:Math.ceil((new Date(p)-new Date(l))/864e5):Math.ceil((new Date(p).setHours(23,59,59)-new Date(l).setHours(0,0,0))/864e5),d=new Date(new Date(p).setMilliseconds(-1e3)).getDate()==l.getDate()&&l.getTimezoneOffset()!=p.getTimezoneOffset()?d-1:d,i[this._appointmentSettings.allDay]||(dt=new Date(l.getFullYear(),l.getMonth(),l.getDate()),gt=new Date(l.getFullYear(),l.getMonth(),l.getDate(),23,59,59),d=dt.getTimezoneOffset()!=gt.getTimezoneOffset()&&new Date(l.getFullYear(),l.getMonth(),l.getDate())-new Date(p.getFullYear(),p.getMonth(),p.getDate())==0?d-1:d),it=0,rt=ct,g=0;g<d;g++)this._dateRender.indexOf(new Date(rt.setHours(0,0,0)).getTime())!=-1&&it++,rt=new Date(rt.getFullYear(),rt.getMonth(),rt.getDate()+1);this.leftPosition=0;this.CellWidth=this.element.find(".e-monthcells, .e-workcells").width();this.CellHeight=this.element.find(".e-monthcells, .e-workcells")[0].offsetHeight;i.inline||this._renderedApp.push(n.extend(!0,{},i));var b=it,ni=this.model.showWeekend?7:this._minMaxIndex().maxIndex+1,ti=!this.model.timeScale.enable&&this._oneWeek?ni-st.indexOf(l.getTime()):ni-new Date(l).getDay()+this._firstdayofweek;if(ct.getTime()<=bt.getTime()){if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(b=b>=ti?ti:b,s=b*this.CellWidth-this.CellWidth/20):s=!this.model.timeScale.enable||this.currentView()=="month"||this._isCustomMonthView()?this.model.cellWidth!=""?b*this.CellWidth+b:b*this.CellWidth:this.CellWidth*b-parseInt(this.CellWidth/10),e=this._renderCellId(i,r,u),(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.model.cellWidth==""&&b>1&&!this.model.enableRTL){var ei=this.element.find(".e-workcellstab tr:first").children().eq(e-1).offset().left,ii=this.element.find(".e-workcellstab tr:first").children().eq(e-2+b),oi=ii.offset().left+ii.width();s=oi-ei}var si=s-1,ut=this.model.appointmentTemplateId?!0:!1,k=ut?this._getUserAppointmentTemplate(i):"",ft=this.element.find(".e-monthheader").length!=0?this.element.find(".e-monthheader").height():0,c=this.model.appointmentTemplateId?n(k).css("height")=="100%"?this.model.showOverflowButton?this.CellHeight-ft-15:this.initialCellHeight:n(k).css("height")=="0px"?this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):this._getElementHeight("e-monthappointment"):n(k).height():this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):this._getElementHeight("e-monthappointment");s=this.model.appointmentTemplateId?n(k).css("width")=="100%"||n(k).css("width")=="0px"?s:n(k).width():s;y=f*c;this.leftPosition=0;!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0&&!t.isNullOrUndefined(this._diffDays)&&(s=Math.abs(it)*this.CellWidth);this._tempResource.length!=0&&(lt=this._resCollection,et=this._horiGroupCollection());a=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(lt[0].dataSource,lt[0].id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()],null,null)+1:0:!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1?this._findResourceIndex(et,this._tempResource[this._tempResource.length-2].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()],null,null)+1:0;s=s<0?this.CellWidth-this.CellWidth/20:s;var h=this._appointmentColor(i),w=!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,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],null,null)+1:this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,i[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-2].trim()])+1:1,hi=this.element.find(".e-monthappointment").length!=0?this.element.find(".e-monthappointment").outerWidth(!0)-this.element.find(".e-monthappointment").width():0,ri=parseInt(this.CellWidth/(this.CellWidth<=s?this.CellWidth:s+hi)),ci=parseInt((this.CellHeight-ft-10)/(this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):c));this.CellHeight=this.model.orientation=="horizontal"||this._customOrientation=="horizontal"?isNaN(w)?0:this.element.find(".e-workcellstab tr").eq(w+a-1).find(".e-workcells")[0].offsetHeight:this.element.find(".e-workcellstab tr").eq(this.element.find("td.e-monthcells").eq(e-1).parent().index()).height();var nt=this._indicationApp(i),at=this._timeMode=="12"?t.format(i[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.startTime],"HH:mm",this.model.locale),vt=this._timeMode=="12"?t.format(i[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(i[this._appointmentSettings.endTime],"HH:mm",this.model.locale);if(this.model.showOverflowButton&&ut&&n(k).css("height")!="0px"&&this.model.orientation!="horizontal"?f+1<=ri*ci||!t.isNullOrUndefined(i.inline):this.CellHeight>ft+(f+1)*c+10||!t.isNullOrUndefined(i.inline))if(ut&&s<si&&this.element.find(".e-appointwrapper").eq(e-1).attr("style","height:"+(parseInt(f/ri)+1)*c+"px !important;width:"+this.CellWidth+"px !important;position:absolute !important;"),this.model.allowInline&&!t.isNullOrUndefined(i.inline))y=0,this._inlineTemplate(i,this.leftPosition,y,s,c,h,!1),o=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.element.find("td.e-monthcells").eq(e-1):this.element.find(".e-workcellstab tr").eq(w+a-1).find("td.e-workcells").eq(e-1),this.model.orientation=="vertical"&&this._customOrientation=="vertical"?o.find(".e-monthheader").after(n("<div class='e-inlinewrapper'><\/div>").append(this._inlineText)):o.prepend(n("<div class='e-inlinewrapper'><\/div>").append(this._inlineText));else{y>1&&(y=f*c);this.leftPosition=this.leftPosition>1?this.leftPosition-1:this.leftPosition;var yt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,v=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!h.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:at,endTime:vt,left:this.leftPosition+"px",top:y,appHeight:this.model.appointmentTemplateId?c:"",appWidth:s+"px",userAppTemplId:ut,userTemplate:k,appClass:"e-monthappointment",appointData:h.appointColor.appointData,appointCustomcss:h.appointColor.appoint
10Customcss,appointtextcolor:h.appointColor.appointtextcolor,value:h.value,multiDiv:h.multiDiv,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:yt,leftInd:nt.leftIndication,rightInd:nt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),pt=t.format(i[this._appointmentSettings.startTime],this._pattern.f,this.model.locale)+"to "+t.format(i[this._appointmentSettings.endTime],this._pattern.f,this.model.locale);v.find(".e-apptime").attr("aria-label",pt);o=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.element.find("td.e-monthcells").eq(e-1):this.element.find(".e-workcellstab tr").eq(w+a-1).find("td.e-workcells").eq(e-1);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,v);this.model.orientation=="vertical"&&this._customOrientation=="vertical"?o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(v):o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(v)):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&(
10o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(v):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(v)),!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(et,a,e-1,i,s,this.leftPosition));v=""}else{if(n("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(w+a-1)+"_"+(e-1)).length!=0&&n("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(w+a-1)+"_"+(e-1)).remove(),this.model.showOverflowButton){var it=e-1,li=Math.round((i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/864e5),g=it,ai=f+1;do o=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.element.find("td.e-monthcells").eq(g):this.element.find(".e-workcellstab tr").eq(w+a-1).find("td.e-workcells").eq(g),ht='<div id="'+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy",this.model.locale)+"_"+(w+a-1)+"_"+g+'" class="e-icon e-arrowhead-down e-appsoverflow" data-cellinfo="'+st[r]+'" data-appcount="'+ai+'"><\/div>',t.isNullOrUndefined(i.inline)==!0&&(o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(ht):this.model.orientation=="vertical"&&this._customOrientation=="vertical"?o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(ht)):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(ht))),g++;while(g<li+it);(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(et,a,e-1,i,s,this.leftPosition)}else{if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"){y=f*c;var yt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,vi=this.element.find("td.e-monthcells").eq(e-1).parent().index(),v=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!h.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:at,endTime:vt,left:this.leftPosition+"px",top:y,appHeight:this.model.appointmentTemplateId?c:"",appWidth:s+"px",userAppTemplId:ut,userTemplate:k,appClass:"e-monthappointment",appointData:h.appointColor.appointData,appointCustomcss:h.appointColor.appointCustomcss,appointtextcolor:h.appointColor.appointtextcolor,value:h.value,multiDiv:h.multiDiv,uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:yt,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),o=this.element.find("td.e-monthcells").eq(e-1),ui=this.element.find("td.e-monthcells").eq(e-1).parent().children().outerHeight(),pt=t.format(i[this._appointmentSettings.startTime],this._pattern.f,this.model.locale)+"to "+t.format(i[this._appointmentSettings.endTime],this._pattern.f,this.model.locale);v.find(".e-apptime").attr("aria-label",pt);this.CellHeight=ui>c*(f+1)+ft?c*(f+1)+ft+c:ui+(c-1);this.element.find("td.e-monthcells").eq(e-1).parent().children().css("height",this.CellHeight+"px");this.element.find(".e-timecells").eq(vi).css("height",this.CellHeight+"px");o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(v):o.find(".e-monthheader").after(n("<div class='e-appointwrapper'><\/div>").append(v))}else{y=f*c;this.CellHeight-10<c*(f+1)&&(this.element.find(".e-workcellstab tr").eq(w+a-1).find(".e-workcells").css("height",this.CellHeight+c+"px"),this.element.find(".e-resourceheadertable tr").eq(w+a-1).find(".e-childnode").css("height",this.CellHeight+c+"px"));var yt=t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])?!1:i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1,v=n(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),rtl:this.model.enableRTL,ignoreColorFilter:this._browserInfo.name=="msie"&&this._browserInfo.version<=9&&!h.appointColor.applyFilter?!0:!1,subject:i[this._appointmentSettings.subject],startTime:at,endTime:vt,left:this.leftPosition+"px",top:y,appHeight:this.model.appointmentTemplateId?c:"",appWidth:s+"px",userAppTemplId:ut,userTemplate:k,appClass:"e-monthappointment",appointData:h.appointColor.appointData,appointCustomcss:h.appointColor.appoint
10Customcss,appointtextcolor:h.appointColor.appointtextcolor,value:h.value,multiDiv:h.multiDiv,priority:this.model.prioritySettings.enable?i[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(i):i[this._appointmentSettings.priority],uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:yt,leftInd:nt.leftIndication,rightInd:nt.rightIndication,resId:t.isNullOrUndefined(this._appointmentSettings.resourceFields)?"":i[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]]})),pt=t.format(i[this._appointmentSettings.startTime],this._pattern.f,this.model.locale)+"to "+t.format(i[this._appointmentSettings.endTime],this._pattern.f,this.model.locale);v.find(".e-apptime").attr("aria-label",pt);t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,v);o=this.element.find(".e-workcellstab tr").eq(w+a-1).find("td.e-workcells").eq(e-1);o.find("div.e-appointwrapper").length>0?o.find("div.e-appointwrapper").append(v):o.prepend(n("<div class='e-appointwrapper'><\/div>").append(v));!t.isNullOrUndefined(this.model.group)&&this._grouping.length>1&&this._renderAppointmentCategory(et,a,e-1,i,s,this.leftPosition)}this._overflowFlag=!0}fi=this.element.find(".e-appsoverflow").length>0?this.element.find(".e-appsoverflow").height():0;y=this.CellHeight-(ft+fi-2);this.model.enableRTL?this.element.find(".e-icon.e-appsoverflow").css({right:this.CellWidth+this.leftPosition-25+"px",top:y+"px"}):this.element.find(".e-icon.e-appsoverflow").css({left:this.CellWidth+this.leftPosition-25+"px",top:y+"px"})}delete i.Index}i[this._appointmentSettings.recurrence]||this.model.allowInline||(ot=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i.ParentId)),wt=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.Guid)),new Date(i[this._appointmentSettings.endTime])<ot[0][this._appointmentSettings.endTime]&&(this.model.enableRTL?this.element.find(tt).eq(e-1).find("div[data-guid="+ot[0].Guid+"]").children(".e-lefthandle").remove():this.element.find(tt).eq(e-1).find("div[data-guid="+ot[0].Guid+"]").children(".e-righthandle").remove()),new Date(i[this._appointmentSettings.startTime])>ot[0][this._appointmentSettings.startTime]&&(this.model.enableRTL?this.element.find(tt).eq(e-1).find("div[data-guid="+i.Guid+"]").children(".e-righthandle").remove():this.element.find(tt).eq(e-1).find("div[data-guid="+i.Guid+"]").children(".e-lefthandle").remove()));!t.isNullOrUndefined(wt)&&wt>1&&(this.element.find(tt).eq(e-1).find("div[data-guid="+i.Guid+"]").children(".e-lefthandle").remove(),this.element.find(tt).eq(e-1).find("div[data-guid="+i.Guid+"]").children(".e-righthandle").remove());t.isNullOrUndefined(nt)||(nt.leftIndication&&(this.model.enableRTL?this.element.find("div[data-guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find("div[data-guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),nt.rightIndication&&(this.model.enableRTL?this.element.find("div[data-guid="+i.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find("div[data-guid="+i.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px")))},_getElementHeight:function(n){var i=t.buildTag("div").addClass(n).clone(!1),r;return i.css({visibility:"hidden",position:"absolute"}),i.appendTo(this.element.find(".e-scheduleinner")),r=i.outerHeight(!0),i.remove(),r},_quickWindowClose:function(){this._quickAppointWindow.find(".e-error").remove();this._quickAppointWindow.ejDialog("close");this._scrollerPosition();this._processFocus()},_appointmentWindow:function(i){var e,o,r,s,u,f;if(n(i.target).closest(".e-appointment,.e-alldayappointment,.e-monthappointment")&&i.type=="tap"&&(f=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,n(i.target).closest(".e-appointment,.e-alldayappointment,.e-monthappointment").attr("data-guid"))),this._trigger("appointmentClick",{appointment:f[0],events:i})))return!1;if(this.model.allowInline){if(n(i.target).hasClass("e-inlineedit"))return!1;(n(i.currentTarget).hasClass("e-agendacells")||n(i.currentTarget).hasClass("e-inline")||n(i.currentTarget).hasClass("e-monthcells")||n(i.currentTarget).hasClass("e-workcells")||n(i.currentTarget).hasClass("e-alldaycells"))&&
10!t.isNullOrUndefined(this._inlineText)&&this._inlineRemove()}if((t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&this._quickAppointWindow.ejDialog("close"),r=t.isNullOrUndefined(i.target)?n(i):n(i.target),this.currentView()=="agenda"||r.hasClass("e-detailedapp")||t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(r=t.isNullOrUndefined(n(i.target).closest(".e-appointment,.e-alldayappointment,.e-monthappointment"))?r.closest(".e-workcells, .e-alldaycells, .e-monthcells"):n(i.target).closest(".e-appointment,.e-alldayappointment,.e-monthappointment")),r.hasClass("e-appup")||r.hasClass("e-appdown")||r.closest(".e-categorybar").hasClass("e-categorybar"))||(s=r.closest(".e-blocktimeappointment"),r.hasClass("e-blocktimeappointment")&&r.hasClass(".e-blockenable")||s.length>0&&r.closest(".e-blockenable").length>0))return!1;s.length>0&&(i.target.closest(".e-blocktimeappointment").style.pointerEvents="none",r=n(document.elementFromPoint(i.pageX,i.pageY)),i.target.closest(".e-blocktimeappointment").style.pointerEvents="");var l=(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||this._cellClick||r.hasClass("e-detailedapp"))&&!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-schedulemouseclose")&&!r.hasClass("e-appointinnertext")&&!r.hasClass("e-apptext")&&!r.hasClass("e-apptime"),a=this.model.appointmentWindowOpen!=null||this.model.cellDoubleClick!=null||!t.isNullOrUndefined(this.model.serverEvents)&&(this.model.serverEvents.indexOf("appointmentWindowOpen")!=-1||this.model.serverEvents.indexOf("cellDoubleClick")!=-1),h={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,target:i,resources:a&&l&&this._tempResource.length!=0?this._getResourceValue(r):null};if(!(r.hasClass("e-workcells")||r.hasClass("e-alldaycells")||r.hasClass("e-monthcells")||this._cellClick||r.hasClass("e-detailedapp"))||r.hasClass("e-resourceheadercells")||r.hasClass("e-schedulemouseclose")||r.hasClass("e-appointinnertext")||r.hasClass("e-apptext")||r.hasClass("e-apptime")){if(!r.hasClass("e-resourceheadercells")&&!r.hasClass("e-schedulemouseclose")){if(r.hasClass("e-monthheader")||r.hasClass("e-appsoverflow"))return!1;u=this._editKey?n(i):r.hasClass("e-appointment")||r.hasClass("e-monthappointment")||r.hasClass("e-alldayappointment")||r.hasClass("e-agendaappointment")?r:r.parents(".e-monthappointment,.e-appointment,.e-alldayappointment,.e-agendaappointment");this.currentView()=="agenda"&&(u=u.hasClass("e-agendaappointment")?u:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"));u.length>0&&!t.isNullOrUndefined(u[0].id)&&(this._currentAction=t.Schedule.Actions.Save,this._appUid=u.attr("data-guid"),f=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),f[0][this._appointmentSettings.recurrence]?(this._parentId=f[0].ParentId,this._appId=f[0].Id,this.model.showRecurrenceAlert?(t.isNullOrUndefined(this._recurEditWindow)&&this._renderRecurEditWindow(),this._recurEditWindow.ejDialog("open"),this._recurEditWindow.focus(),this._deleteBeforeOpen()):(this._editclick=!1,this._showAppointmentDetails(this._appId,!1))):this._showAppointmentDetails(this._appUid,!0),!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"));this._editKey=!1}}else{if(!t.isNullOrUndefined(this.model.cellDoubleClick)&&this._trigger("cellDoubleClick",h))return!1;this._currentAction=t.Schedule.Actions.Add;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find(".e-recurEditor").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").css("display","block"));var v=this._cellIndex,y=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.dateRender:this._dateRender,c=new Date(y[v]);if(this.model.minDate>c||this.model.maxDate<c||(e=new Date(this.cur_StartTime),o=new Date(this.cur_EndTime),(!t.isNullOrUndefined(this.model.appointmentWindowOpen)||!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("appointmentWindowOpen")!=-1)&&this._trigger("appointmentWindowOpen",h)))return!1;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find("#"+this._id+"subject").val(this.model.showQuickWindow?this._quickAppointWindow.find(".subject").val():""),this._appointmentAddWindow.find("#"+this._id+"location").val(this.model.showQuickWindow?this._quickAppointWindow.find(".location").val():""),this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option",{value:t.format(new Date(e),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option",{value:t.format(new Date(o),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date(e),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(o),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option","value",this.model.prioritySettings.dataSource[0][this.model.prioritySettings.value]),(n(i.currentTarget).hasClass("e-alldaycells")||this.currentView()=="month"||this._isCustomMonthView())&&this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}),this._timeZoneCollection(null),this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value"),this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value"),this._alldayCheck(),t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._renderResourceData(r,this._cellIndex),this.model.readOnly||(this._appointmentAddWindow.find(".e-appsave ,#"+this._id+"donerecur").ejButton("enable",!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","none"),this._appointmentAddWindow.ejDialog("open")),this._mediaQuery||this._appointmentAddWindow.find(".subject").focus(),this._cellClick=!1)}},_openWindow:function(i){this._currentAction=t.Schedule.Actions.Add;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find(".e-recurEditor").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").css("display","block"));i=n(i);var r=this.getSlotByElement(i),u=r.startTime,f=r.endTime;if((!t.isNullOrUndefined(this.model.appointmentWindowOpen)||!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("appointmentWindowOpen")!=-1)&&this._trigger("appointmentWindowOpen",r))return!1;t.isNullOrUndefined(this._appointmentAddWindow)||(this._appointmentAddWindow.find("#"+this._id+"subject").val(""),this._appointmentAddWindow.find("#"+this._id+"location").val(""),this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option",{value:t.format(new Date(u),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option",{value:t.format(new Date(f),this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date(u),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(f),this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option","value",this.model.prioritySettings.dataSource[0][this.model.prioritySettings.value]),this._timeZoneCollection(null),this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value"),this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value"),this._alldayCheck(),t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._renderResourceData(i,i[0].cellIndex),this.model.readOnly||(this._appointmentAddWindow.find(".e-appsave ,#"+this._id+"donerecur").ejButton("enable",!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","none"),this._appointmentAddWindow.ejDialog("open")),this._mediaQuery||this._appointmentAddWindow.find(".subject").focus(),this._cellClick=!1)},showAppointmentWindow:function(n,i){t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();this._currentAction=i;switch(i){case t.Schedule.Actions.Add:this._openWindow(n);break;case t.Schedule.Actions.Save:case t.Schedule.Actions.EditSeries:case t.Schedule.Actions.EditOccurrence:t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("Editevent")});var r=n.Guid;this._parentId=n.ParentId;i==t.Schedule.Actions.EditSeries&&(this._appUid=n.Guid,r=n[this._appointmentSettings.id]);
10this._showAppointmentDetails(r,i!=t.Schedule.Actions.EditSeries)}},_editRecurrence:function(){this._appointmentAddWindow.find(".e-appwindow").toggle();this._mediaQuery&&this._appointmentAddWindow.parent().parent().find(".e-dialog-icon").css("display","none");this._appointmentAddWindow.find(".e-recurEditor").css("margin-left",700).toggle().animate({"margin-left":10},300)},_showAppointmentDetails:function(n,i){var e,s,o,f,r,h;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties();e=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor");this._appUid=t.isNullOrUndefined(this._appUid)?n:this._appUid;var c=i==!0?(new t.Query).where("Guid",t.FilterOperators.equal,n):(new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,n),l=i==!0?this._processed:this._currentAppointmentData,a=this._sortAppById(new t.DataManager(l).executeLocal(c)),u=this._recurrenceAppSort(a);if(this.model.showRecurrenceAlert||(s=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),o=this._recurrenceAppSort(s)),f=u[0][this._appointmentSettings.recurrence]?this.model.showRecurrenceAlert?{appointment:u[0],edit:i,editSeries:!i}:{appointment:u[0],edit:i,editSeries:!0,recurrenceCollection:{occurrences:o[0],parentData:u[0]}}:{appointment:u[0],edit:i},this._trigger("appointmentWindowOpen",f))return!1;i=!t.isNullOrUndefined(f.editSeries)&&!f.editSeries?!0:!1;this._currentAction=this.model.showRecurrenceAlert?t.isNullOrUndefined(this._currentAction)||this._currentAction==""?t.Schedule.Actions.Save:this._currentAction:this._editclick?this._currentAction:f.editSeries?t.Schedule.Actions.EditSeries:t.Schedule.Actions.EditOccurrence;i&&(t.isNullOrUndefined(u[0][this._appointmentSettings.recurrenceRule])||u[0][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")==-1||this._currentAction==t.Schedule.Actions.EditFutureOccurrences||(this._currentAction=t.Schedule.Actions.Save));t.isNullOrUndefined(this._appointmentAddWindow)||(r=this.model.showRecurrenceAlert?u[0]:f.editSeries?u[0]:o[0],this._appointmentAddWindow.find(".subject").val(r[this._appointmentSettings.subject]),this._appointmentAddWindow.find(".location").val(r[this._appointmentSettings.location]),this._appointmentAddWindow.find(".id").val(r.AppTaskId),this._appointmentAddWindow.find(".e-description").val(r[this._appointmentSettings.description]?r[this._appointmentSettings.description]:""),this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",t.format(r[this._appointmentSettings.startTime],this._datepattern(),this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",t.format(r[this._appointmentSettings.endTime],this._datepattern(),this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(r[this._appointmentSettings.startTime],this._pattern.t,this.model.locale)),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(r[this._appointmentSettings.endTime],this._pattern.t,this.model.locale)),this.model.prioritySettings.enable&&(t.isNullOrUndefined(r[this._appointmentSettings.priority])?this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option",{value:this.model.prioritySettings.dataSource[0][this.model.prioritySettings.value]}):this._appointmentAddWindow.find("#"+this._id+"priority").ejDropDownList("option",{value:r[this._appointmentSettings.priority]})),this._timeZoneCollection(r),this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value"),this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value"),r[this._appointmentSettings.allDay]&&this._appointmentAddWindow.find(".allday ").ejCheckBox({checked:!0}),r[this._appointmentSettings.recurrence]&&(e._recRule=r[this._appointmentSettings.recurrenceRule],i=this.model.showRecurrenceAlert?i:!f.editSeries,i?(this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0,enabled:this._currentAction==t.Schedule.Actions.EditFutureOccurrences?!0:!1}),this._currentAction!=t.Schedule.Actions.EditFutureOccurrences&&this._appointmentAddWindow.find(".e-repeatlbl").addClass("e-disable"),this._appointmentAddWindow.find("."+this._id+"summary").css({display:this._currentAction==t.Schedule.Actions.EditFutureOccurrences?"table-row":"none"}),this._appointmentAddWindow.find(".e-recurFinalRule").html(""),this._currentAction==t.Schedule.Actions.EditFutureOccurrences&&(e.recurrenceRuleSplit(r[this._appointmentSettings.recurrenceRule]),this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({value:t.format(r[this._appointmentSettings.startTime],this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find(".e-recurFinalRule").html(e.showRecurrenceSummary()),this._appointmentAddWindow.find(".e-recuredit").
10css("display","inline"))):(e.recurrenceRuleSplit(r[this._appointmentSettings.recurrenceRule],r[this._appointmentSettings.recurrenceExDate]),this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({value:t.format(r[this._appointmentSettings.startTime],this._datepattern(),this.model.locale)}),this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(e.showRecurrenceSummary(n)),this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:!0}),this._appointmentAddWindow.find(".e-recuredit").css("display","inline"))),this.model.categorizeSettings.enable&&!t.isNullOrUndefined(r[this._appointmentSettings.categorize])&&this._showCategorizeDetails(r),this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._showMultipleResourceDetails(r),(r[this._appointmentSettings.allDay]||this.currentView()=="agenda")&&this._alldayCheck(),h=this.model.readOnly?"disable":"enable",this._appointmentAddWindow.find(".e-appsave,#"+this._id+"donerecur").ejButton(h,!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","block"),this._appointmentAddWindow.ejDialog("open"),this._mediaQuery||this._appointmentAddWindow.find(".subject").focus())},_recurDateChange:function(n){this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",n);this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")<this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value")?this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",n):n!=this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")&&this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",n)},_cancel:function(){this._appointmentAddWindow.ejDialog("close")},_timeChange:function(n){var i=this._appointmentAddWindow.find("#"+this._id+"starttime").data("ejTimePicker");if(t.isNullOrUndefined(n.value)){i.option("value",new Date(this.cur_StartTime));return}if(i.showDropdown&&i._id==this._id+"starttime"){if(this._appointmentAddWindow.find(".startutc").val()!=this._appointmentAddWindow.find(".endutc").val())this._utcValue("","starttime");else{var u=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),f=new Date(new Date("1/1/2000").setHours(parseInt(u[0],10),parseInt(u[1],10))),e=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),r=new Date(new Date("1/1/2000").setHours(parseInt(e[0],10),parseInt(e[1],10))),o=this._timeFormat(n.prevTime).split(":"),s=new Date(new Date("1/1/2000").setHours(parseInt(o[0],10),parseInt(o[1],10))),h=new Date(new Date(r).setHours(r.getHours()+f.getHours()-s.getHours(),r.getMinutes()+f.getMinutes()-s.getMinutes()));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",h)}this._startSlotChange=!0}},_setQuickValidation:function(){var f,i,r,u;if(t.isNullOrUndefined(this._quickAppointWindow))return!1;f=this._id+"_AddForm";this._initValidator(f);t.isNullOrUndefined(this.model.appointmentSettings.subject)||t.isNullOrUndefined(this.model.appointmentSettings.subject.validationRules)||(i=this.model.appointmentSettings.subject.field,r=this.model.appointmentSettings.subject.validationRules,ele=this._quickAppointWindow.find(".subject"),ele.attr("name")||ele.attr("name",i),ele.rules("add",r),u=n("#"+this._id+"_AddForm").validate(),t.isNullOrUndefined(r.required)||(t.isNullOrUndefined(u.settings.messages[i])?u.settings.messages[i]={}:"",u.settings.messages[i].required=t.isNullOrUndefined(r.messages&&r.messages.required)?i+" is required.":r.messages.required))},_setValidation:function(){var r=this._id+"_AddEditForm",i;this._initValidator(r);i=this;n.each(this.model.appointmentSettings,function(n){t.isNullOrUndefined(i.model.appointmentSettings[n])||t.isNullOrUndefined(i.model.appointmentSettings[n].validationRules)||i._setValidationToField(n,i.model.appointmentSettings[n].field,i.model.appointmentSettings[n].validationRules)})},_initValidator:function(i){n("#"+i).validate({onfocusout:!1,ignore:".e-hide",errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,r){var e=r.closest("td"),u=n(i).addClass("e-error"),o=t.buildTag("div.e-errortail e-toparrow"),f;e.find(".e-error").remove();r.parent().hasClass("e-in-wrap")?u.insertAfter(r.closest(".e-widget")):u.insertAfter(r);
10u.prepend(o);f=r[0].type=="checkbox"||r[0].type=="hidden"?r.parent().offset().top+r.parent().height():r.offset().top+r.height();u.offset({top:f});u.fadeIn("slow")}})},_setValidationToField:function(i,r,u){var f,e,o;for(ele=i=="startTime"?this._appointmentAddWindow.find("#"+this._id+"startdate,#"+this._id+"starttime"):i=="endTime"?this._appointmentAddWindow.find("#"+this._id+"enddate,#"+this._id+"endtime"):i=="resourceFields"?n("#"+this._id+"AppointmentAddEditWindow").find("[id^="+this._id+"_ownerfield_][type!=hidden]").find(".e-autocomplete"):n("#"+this._id+"AppointmentAddEditWindow").find("[name="+r+"][type!=hidden]"),ele.length<1&&(ele=n("#"+this._id+i)),f=0;f<ele.length;f++)n(ele[f]).hasClass("e-autocomplete")&&(e=n(ele[f]).data("ejAutocomplete"),ele[f]=e.model.multiSelectMode=="visualmode"?e._hiddenInput:e.element),n(ele[f]).rules("add",u),o=n("#"+this._id+"_AddEditForm").validate(),t.isNullOrUndefined(u.required)||(t.isNullOrUndefined(o.settings.messages[r])?o.settings.messages[r]={}:"",o.settings.messages[r].required=t.isNullOrUndefined(u.messages&&u.messages.required)?r+" is required.":u.messages.required)},_endTimeChange:function(n){var i=this._appointmentAddWindow.find("#"+this._id+"endtime").data("ejTimePicker");if(t.isNullOrUndefined(n.value)){i.option("value",new Date(this.cur_EndTime));return}i.showDropdown&&i._id==this._id+"endtime"&&(this._endSlotChange=!0)},_renderControls:function(){var i=this._appointmentAddWindow;i.find(".allday").ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:n.proxy(this._alldayCheck,this)});i.find(".startenddate").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),startDay:this._firstdayofweek,enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,dateFormat:this.model.dateFormat,cssClass:this.model.cssClass,minDate:this.model.minDate,maxDate:this.model.maxDate});i.find("#"+this._id+"starttime").ejTimePicker({enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,change:n.proxy(this._timeChange,this),cssClass:this.model.cssClass,interval:30,timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});i.find("#"+this._id+"endtime").ejTimePicker({enableRTL:this.model.enableRTL,width:"100%",value:this.currentDate(),locale:this.model.locale,change:n.proxy(this._endTimeChange,this),cssClass:this.model.cssClass,interval:30,timeFormat:this._timeMode=="12"?this._pattern.t:"HH:mm"});i.find("#"+this._id+"startTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._startUtc,this),cssClass:this.model.cssClass});i.find("#"+this._id+"endTimeZone").ejDropDownList({enableRTL:this.model.enableRTL,dataSource:this.model.timeZoneCollection.dataSource,fields:{text:this.model.timeZoneCollection.text,id:this.model.timeZoneCollection.id,value:this.model.timeZoneCollection.value},width:"100%",select:n.proxy(this._endUtc,this),cssClass:this.model.cssClass});!this.model.prioritySettings.enable||this.model.prioritySettings.dataSource instanceof t.DataManager||this._renderPriorityItems(i);this._tempResource.length!=0&&t.scheduleFeatures.resources&&this._renderAppWindowResources(i);!this.model.categorizeSettings.enable||this.model.categorizeSettings.dataSource instanceof t.DataManager||this._renderCategoryItems(i);i.find(".recurrence").ejCheckBox({enableRTL:this.model.enableRTL,change:n.proxy(this._repeat,this),cssClass:this.model.cssClass});i.find(".e-btndone").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:this._mediaQuery?"100%":"100px",click:n.proxy(this._saveAppointment,this),cssClass:"e-flat"+this.model.cssClass});i.find(".cancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:this._mediaQuery?"100%":"100px",click:n.proxy(this._cancel,this),cssClass:"e-flat"+this.model.cssClass});this._mediaQuery&&i.find(".e-btndelete").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100%",click:n.proxy(this._mobileAp
10pDelete,this),cssClass:"e-flat"+this.model.cssClass})},_mobileAppDelete:function(){this._mediaQuery&&!t.isNullOrUndefined(this._editOnlyClicked)&&!this._editOnlyClicked&&this._appointmentAddWindow.find(".recurrence").ejCheckBox("option","checked")?this._deleteApp(this._appUid):this._deleteAppoint();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("close")},_renderPriorityItems:function(n){t.isNullOrUndefined(n)||n.find(".priority").ejDropDownList({enableRTL:this.model.enableRTL,template:t.isNullOrUndefined(this.model.prioritySettings.template)?"<div class='e-${"+this.model.prioritySettings.value+"}'><\/div><div>${"+this.model.prioritySettings.text+"}<\/div>":this.model.prioritySettings.template+"${"+this.model.prioritySettings.text+"}",dataSource:this.model.prioritySettings.dataSource,fields:{text:this.model.prioritySettings.text,value:this.model.prioritySettings.value},width:"100%",cssClass:this.model.cssClass})},_renderCategoryItems:function(i){t.isNullOrUndefined(i)||i.find(".e-categorizevalue").ejAutocomplete({enableRTL:this.model.enableRTL,showPopupButton:!0,width:"100%",cssClass:this.model.cssClass,delaySuggestionTimeout:10,multiSelectMode:this.model.categorizeSettings.allowMultiple?"visualmode":"none",open:function(){this.suggestionList.find(".e-ul").width("auto")},focusOut:n.proxy(this._categorizeValidate,this),dataSource:this.model.categorizeSettings.dataSource,fields:{text:this.model.categorizeSettings.text,key:this.model.categorizeSettings.id},template:this._categorizeTemplate,emptyResultText:this._getLocalizedLabels("EmptyResultText")})},_categorizeValidate:function(){if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddEditForm").validate().form())return!1},_appointmentColor:function(n){var i=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(n[this._appointmentSettings.categorize])&&n[this._appointmentSettings.categorize]!=""?this._getCategorizeColor(n):this._tempResource.length!=0&&t.scheduleFeatures.resources?this._getResourceColor(n):{appointData:"",appointCustomcss:"",appointtextcolor:"",applyFilter:!0};if(this.model.categorizeSettings.enable&&this.model.categorizeSettings.allowMultiple&&!t.isNullOrUndefined(n[this._appointmentSettings.categorize]))var u=n[this._appointmentSettings.categorize].split(","),f=u.length,e=f>1?!0:!1,r=this._categorizeMultipleDiv(n,u,f);if(!t.isNullOrUndefined(r)&&i.appointData.length>
100&&this.model.categorizeSettings.allowMultiple)return{appointColor:i,value:e,multiDiv:r,applyFilter:!1};if(i.appointData.length>0&&!this.model.categorizeSettings.allowMultiple||this._tempResource.length!=0&&t.scheduleFeatures.resources)return{appointColor:i,applyFilter:!1};var e="";return{appointColor:i,value:e,multiDiv:r,applyFilter:!0}},_categorizeMultipleDiv:function(n,i,r){for(var u,f,o=[],e=0;e<=r-1;e++)if(e!=r-1){if(u=this.model.categorizeSettings,f=this._findResourceIndex(u.dataSource,this.model.categorizeSettings.id,i[e],null,null),t.isNullOrUndefined(f)&&(f=this._findResourceIndex(u.dataSource,this.model.categorizeSettings.id,parseInt(i[e]),null,null)),t.isNullOrUndefined(f))return n[this._appointmentSettings.categorize]="",null;o.push({text:u.dataSource[f][u.text],value:u.dataSource[f][u.color],key:u.dataSource[f][u.id],fontColor:u.dataSource[f][u.fontColor]})}return this._categorizeMultipleTemplate.render({renderData:o})},_getResCategorySaveData:function(n,i,r,u,f){var l,o,k,d,y,p,a,w,b,h,g,nt,c,v,s,e;if(this._groupEditing){if(l=[],y=[],o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&!t.isNullOrUndefined(n[0][0])){for(p=n[n.length-1].length-1,a="",e=0;e<=p;e++)w=n[n.length-1][e][this.model.categorizeSettings.id],a=e!=p?a+w.toString()+",":a+w.toString();o[this._appointmentSettings.categorize]=a}if(i.length>0){if(b=o[this._appointmentSettings.categorize],s=this._appointmentSettings.resourceFields.toString().split(","),this._grouping.length!=0&&s.length!=this._grouping.length){for(e=0;e<this._grouping.length;e++)y.push(s[e]);s=y}if(h=this._getResourceCollection(),g=this._guidFormatGenerate(),i[i.length-1].length>0){for(r.commonGuid=g,o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=b),i[i.length-1].length>1&&(r.Guid=this._guidFormatGenerate(),u++,nt=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u)),u=nt.length==0?u:this._sortAppById(this._processed)[this._processed.length-1].AppTaskId+1,r[this._appointmentSettings.id]=f=u,this._currentAction==t.Schedule.Actions.EditSeries&&(r[this._appointmentSettings.recurrenceId]=u)),c=0;c<i[i.length-1].length;c++){for(t.isNullOrUndefined(o[s[s.length-1].trim()])?o[s[s.length-1].trim()]=i[s.length-1][c][h[h.length-1].id]+",":o[s[s.length-1].trim()]+=i[s.length-1][c][h[h.length-1].id]+",",v=i[s.length-1][c][h[h.length-1].id],e=s.length-1;e>0;e--)k=this.render_Resources[e]instanceof t.DataManager?this.render_Resources[e]:t.DataManager(this.render_Resources[e]),query=(new t.Query).where(h[e].id,t.FilterOperators.equal,v),appointId=k.executeLocal(query),d=this.render_Resources[e-1]instanceof t.DataManager?this.render_Resources[e-1]:t.DataManager(this.render_Resources[e-1]),query1=(new t.Query).where(h[e-1].id,t.FilterOperators.equal,appointId[0][h[e].groupId]),appointGroupId=d.executeLocal(query1),v=appointGroupId[0][h[e-1].id],grpId=appointGroupId[0][this._tempResource[e-1].resourceSettings.groupId],t.isNullOrUndefined(o[s[e-1]])?o[s[e-1]]=v+",":o[s[e-1]]+=v+",";this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId)}for(e=0;e<s.length;e++)o[s[e]]=o[s[e]].slice(",",-1);l.push(o);this._groupEdit=!0}else{if(s=this._appointmentSettings.resourceFields.toString().split(","),o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=b),s.length>1)for(e=0;e<s.length;e++)o[s[e].trim()]=this._tempResource[e].resourceSettings.dataSource[0][this._tempResource[e].resourceSettings.id];else o[s[s.length-1].trim()]=this._tempResource[0].resourceSettings.dataSource[0].id;this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId);l.push(o)}}return i.length==0&&n.length>0&&(this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId),l.push(o)),l}if(l=[],y=[],o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&!t.isNullOrUndefined(n[0][0])){for(p=n[n.length-1].length-1,a="",e=0;e<=p;e++)w=n[n.length-1][e][this.model.categorizeSettings.id],a=e!=p?a+w.toString()+",":a+w.toString();o[this._appointmentSettings.categorize]=a}if(i.length>0){if(b=o[this._appointmentSettings.categorize],s=this._appointmentSettings.resourceFields.toString().split(","),this._grouping.length!=0&&s.length!=this._grouping.length){for(e=0;e<this._grouping.length;e++)y.push(s[e]);s=y}if(h=this._getResourceCollection(),g=this._guidFormatGenerate(),i[i.length-1].length>0)for(c=0;c<i[i.length-1].length;c++){for(r.commonGuid=g,o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=b),i[i.length-1].length>1&&(r.Guid=this._guidFormatGenerate(),u++,nt=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u)),u=nt.length==0?u:this._sortAppById(this._processed)[this._processed.length-1].AppTaskId+1,r[this._appointmentSettings.id]=f=u,this._currentAction==t.Schedule.Actions.EditSeries&&(r[this._appointmentSettings.recurrenceId]=u)),o[s[s.length-1].trim()]=i[s.length-1][c][h[h.length-1].id],v=i[s.length-1][c][h[h.length-1].id],e=s.length-1;e>0;e--)k=this.render_Resources[e]instanceof t.DataManager?this.render_Resources[e]:t.DataManager(this.render_Resources[e]),query=(new t.Query).where(h[e].id,t.FilterOperators.equal,v),appointId=k.executeLocal(query),d=this.render_Resources[e-1]instanceof t.DataManager?this.render_Resources[e-1]:t.DataManager(this.render_Resources[e-1]),query1=(new t.Query).where(h[e-1].id,t.FilterOperators.equal,i[s.length-1][c][h[h.length-1].groupId]),appointGroupId=d.executeLocal(query1),v=appointGroupId[0][h[e-1].id],grpId=appointGroupId[0][this._tempResource[e-1].resourceSettings.groupId],o[s[e-1]]=v;this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId);l.push(o)}else{if(s=this._appointmentSettings.resourceFields.toString().split(","),o=this._addAppData(r,u,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),f),n.length>0&&(o[this._appointmentSettings.categorize]=b),s.length>1)for(e=0;e<s.length;e++)o[s[e].trim()]=this._tempResource[e].resourceSettings.dataSource[0][this._tempResource[e].resourceSettings.id];else o[s[s.length-1].trim()]=this._tempResource[0].resourceSettings.dataSource[0].id;this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId);l.push(o)}}return i.length==0&&n.length>0&&(this._currentAction==t.Schedule.Actions.EditOccurrence&&(o[this._appointmentSettings.id]=o.AppTaskId),l.push(o)),l},_timeZoneCollection:function(n){var u;t.isNullOrUndefined(n)||(this.startTimeAppoint=n[this._appointmentSettings.startTimeZone],this.endTimeAppoint=n[this._appointmentSettings.endTimeZone]);this.startutcValue=this.tempValue=null;!t.isNullOrUndefined(n)&&this.endTimeAppoint&&(this._utcValue(n,"Appoint"),this.tempValue=1);var s=this.model.timeZone==null?this._timezoneStringValue():this.model.timeZone,e=t.isNullOrUndefined(n)?s:t.isNullOrUndefined(this.startTimeAppoint)?s:this.startTimeAppoint,r=e.indexOf("UTC")!=0?"UTC "+e:e,o=r.split(" ")[1].split(":")[0].length!=3?r.split(" ")[1].split(":")[0][0]=="+"?"+0"+r.split(" ")[1].split(":")[0].split("+")[1]+":"+r.split(" ")[1].split(":")[1]:"-0"+r.split(" ")[1].split(":")[0].split("-")[1]+":"+r.split(" ")[1].split(":")[1]:r,f=o.indexOf("UTC")!=0?"UTC "+o:o,i=t.isNullOrUndefined(this._findResourceIndex(this.model.timeZoneCollection.dataSource,this.model.timeZoneCollection.value,f,null,null))?"add":this._findResourceIndex(this.model.timeZoneCollection.dataSource,this.model.timeZoneCollection.value,f,null,null);t.isNullOrUndefined(n)||i==="add"?i!=="add"&&(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("option",{text:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.text],value:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{text:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.text],value:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]})):(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("option",{value:!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(this.startTimeAppoint)?this.startTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{value:!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(this.endTimeAppoint)?this.endTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}));i=="add"&&(u={},u[this.model.timeZoneCollection.text]=f,u[this.model.timeZoneCollection.id]=(this.model.timeZoneCollection.dataSource.length+1).toString(),u[this.model.timeZoneCollection.value]=f,this.model.timeZoneCollection.dataSource.pu
10sh(u),this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),n!=null?this._timeZoneCollection(n):this._timeZoneCollection(null));this.tempValue=null},_timezoneStringValue:function(){var i=(new Date).getTimezoneOffset()<Math.max(new Date((new Date).getFullYear(),0,1).getTimezoneOffset(),new Date((new Date).getFullYear(),6,1).getTimezoneOffset()),t=(new Date).getTimezoneOffset()+(i?new Date((new Date).getFullYear(),0,1).getTimezoneOffset()-new Date((new Date).getFullYear(),6,1).getTimezoneOffset():0),r=t>0?"-":"+",n=Math.abs(t),u=Math.floor(n/60)<10?"0"+Math.floor(n/60):Math.floor(n/60),f=n%60<10?"0"+n%60:n%60;return r+u+":"+f},_showCategorizeDetails:function(t){for(var r=t[this._appointmentSettings.categorize].split(","),u,i=0;i<r.length;i++)u=n.type(r[i])=="string"?r[i]:parseInt(r[i]),this._appointmentAddWindow.find(".e-categorizevalue").data("ejAutocomplete").selectValueByKey(u)},_renderCategorizeTemplate:function(){var n=this.model.enableRTL?"margin-right:30px;margin-top:-18px":"",i=this.model.enableRTL?"float:none":"float:left";t.isNullOrUndefined(this.model.categorizeSettings)||(this._categorizeTemplate="<div class='e-categorizeTemplate' style='height:15px;margin-right:5px;margin-top:3px;"+i+";width:15px;background-color: ${"+this.model.categorizeSettings.color+"}'><\/div><div style= "+n+">${"+this.model.categorizeSettings.text+"}<\/div>")},_getCategorizeColor:function(n){var r=null,u="",e="",f="",i=this.model.categorizeSettings,o=null;return(o=this.model.categorizeSettings.allowMultiple||typeof n[this._appointmentSettings.categorize]=="string"?n[this._appointmentSettings.categorize].split(",")[n[this._appointmentSettings.categorize].split(",").length-1]:n[this._appointmentSettings.categorize],r=this._findResourceIndex(i.dataSource,this.model.categorizeSettings.id,o,null,null),t.isNullOrUndefined(r)&&(r=this._findResourceIndex(i.dataSource,this.model.categorizeSettings.id,parseInt(categorizeItems[categorizeItemsLength]),null,null)),t.isNullOrUndefined(r))?(n[this._appointmentSettings.categorize]="",{appointData:u,appointCustomcss:e,appointtextcolor:f}):(u=t.isNullOrUndefined(i.dataSource[r][i.color])?u:i.dataSource[r][i.color],f=t.isNullOrUndefined(i.dataSource[r][i.fontColor])?f:i.dataSource[r][i.fontColor],this._tempResource.length!=0&&t.scheduleFeatures.resources&&u==""?this._getResourceColor(n):{appointData:u,appointCustomcss:e,appointtextcolor:f,applyFilter:!1})},_currentDateFormat:function(i){var r,u,f,e;t.isNullOrUndefined(i)||n.type(this.currentDate())=="date"&&n.type(this.model.minDate)=="date"&&n.type(this.model.maxDate)=="date"?i=="MM/dd/yyyy"&&(n.type(this.currentDate())!="date"||n.type(this.model.minDate)!="date"||n.type(this.model.maxDate)!="date")&&(e=t.parseDate(this.currentDate()),r=t.parseDate(this.model.minDate),u=t.parseDate(this.model.maxDate),t.isNullOrUndefined(e)?this.currentDate(new Date):this.currentDate(e),this.model.minDate=t.isNullOrUndefined(r)?this.model.minDate:r,this.model.maxDate=t.isNullOrUndefined(u)?this.model.maxDate:u):(f=t.parseDate(this.currentDate(),this.model.dateFormat),r=t.parseDate(this.model.minDate,this.model.dateFormat),u=t.parseDate(this.model.maxDate,this.model.dateFormat),this.currentDate(t.isNullOrUndefined(f)?new Date(this.currentDate()).toString()=="Invalid Date"||new Date(this.currentDate()).toString()=="NaN"?this._dateConvert(this.currentDate()):new Date(this.currentDate()):f),this.model.minDate=t.isNullOrUndefined(r)?new Date(this.model.minDate).toString()=="Invalid Date"||new Date(this.model.minDate).toString()=="NaN"?this._dateConvert(this.model.minDate):new Date(this.model.minDate):r,this.model.maxDate=t.isNullOrUndefined(u)?new Date(this.model.maxDate).toString()=="Invalid Date"||new Date(this.model.maxDate).toString()=="NaN"?this._dateConvert(this.model.maxDate):new Date(this.model.maxDate):u)},_datepattern:function(){return this.model.dateFormat!=""&&!t.isNullOrUndefined(this.model.dateFormat)?this.model.dateFormat:this._pattern.d},_businessHourScroller:function(){var n,i,u,r,f;if(this.currentView()=="agenda")return!1;n=0;this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.timeScale.enable&&this.currentView()!="month"&&!this._isCustomMonthView()?(n=this.element.find(".e-businesshighlightworkcells").length!=0&&this.model.workHours.highlight?this.element.find(".e-businesshighlightworkcells").first().parent().index()*(this.element.find(".e-workcells")[0].offsetHeight-1):0,this.element.find("div#"+this._id+"_scroller").ejScroller({scrollTop:n}),this.element.find(".e-scrolltimecells").css({top:-this.element.find(".e-draggableworkarea").scrollTop()+"px"})):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.model.timeScale.enable&&(this.element.find(".e-businesshighlightworkcells").length!=0&&this.model.workHours.highlight&&this.currentView()!="month"?(n=this.element.find(".e-businesshighlightworkcells")[0].offsetLeft,(this.currentView()==="week"||this.currentView()==="workweek"||this.currentView()==="customview"&&this._renderDays<=7)&&(i=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index(),!t.isNullOrUndefined(i)&&i>=0&&(this.currentView()=="customview"?this.currentDate(new Date(this._dateRender[0])):this.currentDate(new Date(this._dateRender[i])),n=this.element.find(".e-workcells")[Math.ceil(i*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))].offsetLeft,u=this.model.workHours.start-this.model.startHour<=0?0:this.model.workHours.start-this.model.startHour,[0,6].indexOf(new Date(this._dateRender[i]).getDay())==-1&&this.currentView()!="customview"&&(r=u*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),n=this.element.find(".e-workcells")[Math.ceil(i*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+r)].offsetLeft)))):(r=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index()*(this.model.endHour-this.model.startHour)*Math.ceil(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),r=r>this.element.find(".e-workcells").length?this.element.find(".e-workcells").length-1:r,n=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index()!=-1?this.element.find(".e-workcells")[r].offsetLeft:0),f=this.model.enableRTL?this.element.find(".e-workcells")[0].offsetLeft-n:n,this.element.find("div#"+this._id+"_scroller").ejScroller({scrollLeft:f}))},_minToHour:function(n){return{h:parseInt(n/60),m:n%60}},_onclose:function(){this._appointmentAddWindow.find(".e-error").remove();this._appointmentAddWindow.find(".e-recurEditor").hide();this._appointmentAddWindow.find(".e-appwindow").css("margin-left",700).show().animate({"margin-left":10},300);this._clearFields();this._processFocus()},_printAppointment:function(i){var h=t.buildTag("div"),r,c,f,u,s,l,a;typeof i=="object"?r=i:(c=(new t.Query).where("Guid",t.FilterOperators.equal,i),list=new t.DataManager(this._processed).executeLocal(c),list.length>1?(f=n.extend(!0,[],list),f[0][this._appointmentSettings.endTime]=f[f.length-1][this._appointmentSettings.endTime],r=f[0]):r=list[0]);var e="<table align='center' style='margin-top:50px;margin-left:50;'>",o=this,v=["Guid","ParentId","RecurrenceId","RecurrenceExDate","AppTaskId"];return n.each(r,function(n,i){v.indexOf(n)!=-1||t.isNullOrUndefined(i)||t.isNullOrUndefined(n)||n=="null"||((n==o._appointmentSettings.startTime||n==o._appointmentSettings.endTime)&&(i=i),e+="<tr style='height:30px'><td style='width:300px'><b>"+n+":<\/b><\/td><td style='width:600px'>"+i+"<\/td><\/tr>")}),e+="<\/table>",u="",this._tempResource.length!=0&&(t.isNullOrUndefined(r[this._tempResource[this._tempResource.length-1].field])||(s=o._appointmentSettings.resourceFields.split(","),n.each(this._tempResource[this._tempResource.length-1].resourceSettings.dataSource,function(n,t){t.id==r[s[s.length-1].trim()]&&(u=t.text)}
10))),u=u==""?"Unknown":u,l="<font size='20' style='margin-top:50px;margin-left:50;font-family:Times New Roman'><b>"+u+"<\/b><\/font><\/br><hr style='margin-left:50' size='10'>",a=l+e,h.append(a),t.print(h),!1},_recurrenceValidate:function(n,i,r,u){var f=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),c,s,h,y,p,o,l,b,k,d,v,e;if(t.isNullOrUndefined(n)||f.recurrenceRuleSplit(n,i),t.isNullOrUndefined(u)?(y=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),c=new Date(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value").setHours(parseInt(y[0],10),parseInt(y[1],10)))):c=u,t.isNullOrUndefined(r)?(p=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),s=new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value").setHours(parseInt(p[0],10),parseInt(p[1],10)))):s=r,o=t.isNullOrUndefined(r)?this._appointmentAddWindow.find(".recurstartdate").ejDatePicker("option","value"):r,l=f._rRule.interval,t.isNullOrUndefined(f._rRule.until))if(t.isNullOrUndefined(f._rRule.count))h=new Date(new Date(this.currentDate()).setDate(o.getDate()+42*l));else switch(f._rRule.freq){case"DAILY":h=new Date(new Date(o).setDate(o.getDate()+f._rRule.count*l));break;case"WEEKLY":b=f._rRule.weekDays.split(",");k=Math.round(o.getDate()+f._rRule.count/b.length*7*l);h=new Date(new Date(o).setDate(k+1));break;case"MONTHLY":h=new Date(new Date(o).setMonth(o.getMonth()+f._rRule.count*l));break;case"YEARLY":h=new Date(new Date(o).setFullYear(o.getFullYear()+f._rRule.count*l))}else h=new Date(f._rRule.until),h.setDate(h.getDate()+1);if((h-o)/864e5<(f._rRule.freq=="DAILY"?2:f._rRule.freq=="WEEKLY"?7:1))return!0;switch(f._rRule.freq){case"DAILY":return d=f._rRule.interval,(c-s)/36e5>parseInt(d)*24?!1:!0;case"WEEKLY":if(n.split(";")[1].split("=")[0]=="INTERVAL"){var a=f._rRule.weekDays.split(","),nt={SU:0,MO:1,TU:2,WE:3,TH:4,FR:5,SA:6},w=[],g=[];for(e=0;e<a.length*(parseInt(f._rRule.interval)+1);e++)w[e]=a.length>e?nt[a[e]]:w[e-a.length]+7*parseInt(f._rRule.interval);for(v=w.sort(function(n,t){return n-t}),e=1;e<v.length;e++)g.push(v[e]-v[e-1]);return(c-s)/36e5>Math.min.apply(Math,g)*24?!1:!0}return(c-s)/36e5>24?!1:!0;case"MONTHLY":return c.getTime()>new Date(s).setMonth(s.getMonth()+parseInt(f._rRule.interval))?!1:!0;case"YEARLY":return c.getTime()>new Date(s).setFullYear(s.getFullYear()+parseInt(f._rRule.interval))?!1:!0}return!0},_saveAppointment:function(){var at,gi,r,ht,nr,ci,vt,et,nt,ot,li,ai,tt,kt,pr,yr,eu,br,it,kr,h,pt,ir,tr,s,u,vi,rr,st,ut,si,yi,ui,p,ur,o,dr,pi,fr,er,ni,yt,wi,bi,ct,f,gr,l,k,a,ti,ii,c,dt,y,d,bt,ki,oi,ri,ei,w,wt,ft,b,e,tu;if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),at=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),this._currentAction!=""){if(t.isNullOrUndefined(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value"))||t.isNullOrUndefined(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value")))return!1;var hr=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),cr=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),iu=new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value").setHours(parseInt(hr[0],10),parseInt(hr[1],10))),ru=new Date(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value").setHours(parseInt(cr[0],10),parseInt(cr[1],10)));if(iu>ru)return t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("StartEndError")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.ejDialog("open"),!1}if(this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox("option","checked")&&at._rec
10Rule!=""&&!t.isNullOrUndefined(at._recRule)&&this.model.enableRecurrenceValidation&&this._currentAction=="add"&&!this._recurrenceValidate(at._recRule))return this._alertCreateError(),!1;var ou=this._sortAppById(this._processed),ht,o,e=this,uu=this._currentAppointmentData.length>0?this._currentAppointmentData.map(function(n){return n[e._appointmentSettings.id]}).sort():[0],lr=Math.max.apply(Math,uu);if(this._cellClick&&(this.model.showQuickWindow||this.model.allowInline)){if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddForm").validate().form())return!1;if(r={},ht=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,this.model.enableLoadOnDemand&&(ht=lr+1),r[this._appointmentSettings.id]=r.AppTaskId=r.ParentId=ht,r[this._appointmentSettings.subject]=this.model.allowInline&&this._inline?this.element.find(".e-inlinetext").length>1&&this.currentView()!="month"?n(this.element.find(".e-inlinetext")[1]).val():this.element.find(".e-inlinetext").val():this._quickAppointWindow.find(".subject").val(),r[this._appointmentSettings.startTime]=new Date(this.cur_StartTime),r[this._appointmentSettings.endTime]=new Date(this.cur_EndTime),r[this._appointmentSettings.allDay]=this.currentView()==="month"||new Date(this.cur_StartTime).getHours()==0&&new Date(this.cur_EndTime).getHours()==23&&new Date(this.cur_EndTime).getMinutes()==59||this._isCustomMonthView()?!0:!1,this.model.appointmentSettings.applyTimeOffset&&!r[this._appointmentSettings.allDay]&&(r[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone,r[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),r[this._appointmentSettings.recurrence]=!1,(!t.isNullOrUndefined(this.model.group)||this._tempResource.length!=0&&t.scheduleFeatures.resources)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&(r=this._getResourceFields(r)),"null"in r&&delete r[null],ui=this._checkAvailability(r),u={appointment:r},this._trigger("actionBegin",{data:u.appointment,requestType:"appointmentSave"})||ui.length>0)return this._showBlockAlert&&ui.length>0&&this._alertBlockError(),t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close"),!1;if(t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentCreate")==-1||this._timeZoneAppointments(u.appointment,""),this._trigger("beforeAppointmentCreate",u))return t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close"),!1;for(this._currentAction==t.Schedule.Actions.Add,u.appointment.Guid=this._guidFormatGenerate(),n.extend(!0,gi={},u.appointment),p=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("beforeAppointmentCreate")!=-1?gi:this._timeZoneAppointments(gi,""),w=this._dataManager.insert(p,this.model.appointmentSettings.query._fromTable),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u.appointment),new t.DataManager(this._currentAppointmentData).update("AppTaskId",u.appointment),this._appointmentProcessing(u.appointment),this._currentViewAppointments=this.getCurrentViewAppointments(),this.model.enableLoadOnDemand&&(this._dataCount=this._currentAppointmentData.length),nr=this._groupEditing?this._currentViewAppointments.filter(function(n){return n.ParentId==u.appointment.ParentId}):this._currentViewAppointments.filter(function(n){return n.Guid==u.appointment.Guid}),ci=0;ci<nr.length;ci++)this._refreshDayAppointments(nr[ci]);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;this._trigger("appointmentCreated",{appointment:u.appointment,requestType:"appointmentSaved"});this._trigger("actionComplete",{data:u.appointment,requestType:"appointmentSave"});this._cellClick=!1;t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.ejDialog("close");this._scrollerPosition();!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(e=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,f,o;if(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))e._processUrlBinding(i);else if(n.isPlainObject(r)&&!t.isNullOrUndefined(r.added)&&r.added.length>0)for(e._dateFormat(r.added),f=0,o=r.added.length;f<o;f++)u.appointment[e._appointmentSettings.id]=r.added[f][e._appointmentSettings.id],u.appointment[e._appointmentSettings.recurrence]||(u.appointment.ParentId=r.added[f][e._appointmentSettings.id]),new t.DataManager(e._processed).update("Guid",u.appointment)}))}else{if(vt=[],et=[],t.isNullOrUndefined(this._inline)||this._inline==!1){if(n.isFunction(n.validator)&&!n("#"+this._id+"_AddEditForm").validate().form())return!1;var g,r={},p={},fu=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));for(ht=this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOccurrence||this._currentAction==t.Schedule.Actions.EditFutureOccurrences?this.model.enableLoadOnDemand?lr+1:t.isNullOrUndefined(this._appMainId)?parseInt(this._appId):this._appMainId+1:fu[0].AppTaskId,g=n("#"+this._id+"AppointmentAddEditWindow").find("#"+this._id+"_AddEditForm").get(0),h=0;h<g.length;h++)nt=g[h].name,ot=n(g[h]),nt!=i&&(tt=g[h].value,nt!=""&&r[nt]==null?(nt==this._appointmentSettings.id&&(tt=tt==""?parseInt(ht):parseInt(tt)),n(g[h]).hasClass("e-datepicker")?tt=ot.ejDatePicker("option","value"):n(g[h]).hasClass("e-timepicker")?tt=ot.ejTimePicker("option","value"):ot.data("ejDropDownList")?tt=ot.ejDropDownList("model.value"):ot.data("ejAutocomplete")&&(n(g[h])[0].id==this._id+"categorize"?et.push(ot.data("ejAutocomplete").getSelectedItems()):n(g[h])[0].id.indexOf(this._id+"_ownerfield_")==0&&vt.push(ot.data("ejAutocomplete").getSelectedItems())),nt!="StartDate"&&nt!="EndDate"&&nt!="StartTime"&&nt!="EndTime"?r[nt]=g[h].type!="checkbox"?tt:n(g[h]).is(":checked"):p[nt]=nt=="StartDate"||nt=="EndDate"?new Date(tt):tt):ot.data("ejAutocomplete")&&(n(g[h])[0].id==this._id+"categorize"?et.push(ot.data("ejAutocomplete").getSelectedItems()):n(g[h])[0].id.indexOf(this._id+"_ownerfield_")==0&&vt.push(ot.data("ejAutocomplete").getSelectedItems())));this.startutcValue=this.tempValue=null;this.model.showTimeZoneFields||(r[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone,r[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone);"null"in r&&delete r[null];li=this._timeFormat(p.StartTime).split(":");ai=this._timeFormat(p.EndTime).split(":");r[this._appointmentSettings.startTime]=new Date(p.StartDate.setHours(parseInt(li[0],10),parseInt(li[1],10)));r[this._appointmentSettings.endTime]=new Date(p.EndDate.setHours(parseInt(ai[0],10),parseInt(ai[1],10)));r[this._appointmentSettings.recurrence]&&(r[this._appointmentSettings.recurrenceRule]=at._recRule);this._publicMethodSave=!0;t.isNullOrUndefined(this.model.serverEvents)&&this._dataManager.dataSource.offline&&(tt=this._timeZoneSavingAppoint(r,p),r=tt.obj);kt=this._currentAction=="save"?"edit":this._currentAction}else{var r={},ar=[],vr=[],yr,gt=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)));if(gt.length==0)return!1;if(gt[0][this._appointmentSettings.endTime]=gt.length>1?gt[gt.length-1][this._appointmentSettings.endTime]:gt[0][this._appointmentSettings.endTime],r=gt[0],this._tempResource.length>0){for(vr=n.extend(!0,[],this._resourceCollection),vr.reverse(),f=0;f<this.res1.length;f++)if(this._grouping.length==1){if(this.res1[f][this._tempResource[this._tempResource.length-1].resourceSettings.id]==r[this._tempResource[this._tempResource.length-1].field])break}else if(this.res1[f][this._tempResource[this._tempResource.length-1].resourceSettings.id]==r[this._tempResource[this._tempResource.length-1].field]&&this.res1[f][this._tempResource[this._tempResource.length-1].resourceSettings.groupId]==r[this._tempResource[this._tempResource.length-2].field])break;if(ar.push(this.res1[f]),vt.push(ar),dt=0,eu=[],this._tempResource.length>1){for(yt=1,c=this._tempResource.length-2;c>=0;c--)yr=this._tempResource[c].resourceSettings.dataSource,pr=new t.DataManager(yr).executeLocal((new t.Query).where(this._tempResource[yt].resourceSettings.id,t.FilterOperators.equal,vt[dt][0][this._tempResource[c+1].resourceSettings.groupId])),vt.push(pr),yt++,dt++,yt=yt==this._tempResource.length?yt-1:yt;vt.reverse()}}ht=r.AppTaskId;var li=this._timeFormat(t.format(new Date(r[this._appointmentSettings.startTime]),this._pattern.t,this.model.locale)).split(":"),ai=this._timeFormat(t.format(new Date(r[this._appointmentSettings.endTime]),this._pattern.t,this.model.locale)).split(":"),kt=this._currentAction=r[this._appointmentSettings.recurrence]==!0?"editOccurrence":"save",wr=this.element.find(".e-inlineedit").val();if(r[this._appointmentSettings.recurrence]===!0,n.trim(this._subject)==wr)return this._inlineRemove(),!1;r[this._appointmentSettings.subject]=wr;r[this._appointmentSettings.startTimeZone]=t.isNullOrUndefined(r[this._appointmentSettings.startTimeZone])?"UTC "+this._timezoneStringValue():r[this._appointmentSettings.startTimeZone];r[this._appointmentSettings.endTimeZone]=t.isNullOrUndefined(r[this._appointmentSettings.endTimeZone])?"UTC "+this._timezoneStringValue():r[this._appointmentSettings.endTimeZone]}if(this.model.categorizeSettings.enable&&!this.model.categorizeSettings.allowMultiple&&et.length!=0&&et[0].length!=0&&(br=this._findResourceIndex(this.model.categorizeSettings.dataSource,this.model.categorizeSettings.id,et[0][0][this.model.categorizeSettings.id],null,null),et[0].push(this.model.categorizeSettings.dataSource[br]),et[0].shift()),it=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),r[this._appointmentSettings.recurrenceRule]!=""&&!t.isNullOrUndefined(r[this._appointmentSettings.recurrenceRule])&&this.model.enableRecurrenceValidation&&(this._currentAction=="editSeries"||this._currentAction=="editOccurrence"||this._currentAction=="save"))if(this._currentAction=="editOccurrence"){var fi=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],tr=fi[this._appointmentSettings.recurrenceId]==null?fi.ParentId:fi[this._appointmentSettings.recurrenceId],ir=fi[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,rt;if(rt=this._groupEditing||this._groupEdit?new t.DataManager(this._processed).executeLocal((new t.Query).where("commonGuid",t.FilterOperators.equal,fi.commonGuid)):new t.DataManager(this._processed).executeLocal((new t.Query).where(ir,t.FilterOperators.equal,tr)),kr=(r[this._appointmentSettings.endTime]-r[this._appointmentSettings.startTime])/36e5<24&&r[this._appointmentSettings.endTime].getDate()!=r[this._appointmentSettings.startTime].getDate(),kr&&(rt=this._recurrenceAppSort(rt)),rt=this._appointmentRecurrenceSort(rt),h=this._recuCollectionIndex(rt,fi),pt=this._appointmentSettings,h==0?t.isNullOrUndefined(rt[h+1])?!1:!(new Date(new Date(rt[h+1][pt.startTime]).setHours(0,0,0,0)).getTime()>
10new Date(new Date(r[pt.endTime]).setHours(0,0,0,0)).getTime()):h==rt.length-1?!(new Date(new Date(rt[h-1][pt.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(r[pt.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(rt[h-1][pt.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(r[pt.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(rt[h+1][pt.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(r[pt.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1}else if(!this._recurrenceValidate(r[this._appointmentSettings.recurrenceRule],it[0][this._appointmentSettings.recurrenceExDate]))return this._alertCreateError(),!1;if(this._currentAction==t.Schedule.Actions.EditOccurrence)this._objDate=it,ir=this._objDate[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,o=this._deleteOcurrence(this._objDate[0][ir],new Date(it[0][this._appointmentSettings.startTime])),r[this._appointmentSettings.recurrence]=!0,r[this._appointmentSettings.recurrenceRule]=o[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+o[0].ParentId,r[this._appointmentSettings.recurrenceId]=o[0][this._appointmentSettings.recurrenceId],r.Guid=this._appUid,r[this._appointmentSettings.recurrenceExDate]=o[0][this._appointmentSettings.recurrenceExDate],this._appointmentRemove(r);else if(this._currentAction==t.Schedule.Actions.EditSeries){if(tr=it[0][this._appointmentSettings.recurrenceId]==null?it[0].ParentId:it[0][this._appointmentSettings.recurrenceId],o=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,tr)),o[0][this._appointmentSettings.recurrenceRule].toString().indexOf("EXDATE")!=-1&&this._seriesAlert)return this._seriesAlert=!1,t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._alertWindow.find(".e-alertbtn").find(".e-alertCancel").length==0&&(this._alertWindow.find(".e-alertbtn").append("<button id='"+this._id+"alertcancel' class='e-alertbutton e-alertCancel'><\/button>"),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:n.proxy(this._alertClose,this),cssClass:"e-flat"+this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertbutton").css({margin:"0px 20px 15px 10px"})),this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert")),this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("SeriesChangeAlert")),this._alertWindow.find(".e-alertCancel").html(this._getLocalizedLabels("Cancel")),this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok")),this._alertWindow.addClass("e-seriesAlert"),this._alertWindow.ejDialog("open"),!1;o[0][this._appointmentSettings.recurrenceRule].toString().indexOf("EXDATE")!=-1&&(this._seriesAlert=!0);r.AppTaskId=o[0].AppTaskId;r[this._appointmentSettings.id]=o[0][this._appointmentSettings.id];r.Guid=this._appUid;ht=o[0].AppTaskId;r[this._appointmentSettings.recurrenceId]=o[0][this._appointmentSettings.recurrenceId];r[this._appointmentSettings.recurrenceExDate]=null;r[this._appointmentSettings.recurrenceRule]=t.isNullOrUndefined(at._recRule)||at._recRule==""?o[0][this._appointmentSettings.recurrenceRule]:at._recRule}if(this._currentAction!=t.Schedule.Actions.Add){if(r.Guid=it[0].Guid,r.AppTaskId=it[0].AppTaskId,r[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?it[0][this._appointmentSettings.id]:r[this._appointmentSettings.id],s=n.extend(s,r),this._trigger("actionBegin",{data:r,requestType:"appointmentEdit",currentAction:kt}))return this._appointmentAddWindow.ejDialog("close"),!1}else if(r.Guid=t.isNullOrUndefined(r.Guid)?this._guidFormatGenerate():r.Guid,this._trigger("actionBegin",{data:r,requestType:"appointmentSave"}))return this._appointmentAddWindow.ejDialog("close"),!1;if(u=[],this._startTimezone!=this._endTimezone?r[this._appointmentSettings.endTime]=tt.cloneEnddiffer:"",rr=this._currentAction==t.Schedule.Actions.Add?ht:it[0].ParentId,!t.isNullOrUndefined(this.model.categorizeSettings)&&et.length>0&&!t.isNullOrUndefined(et[0][0])||this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources?u=this._getResCategorySaveData(et,vt,r,ht,rr,li,ai):(vi=this._addAppData(r,ht,new Date(r[this._appointmentSettings.startTime]),new Date(r[this._appointmentSettings.endTime]),rr),this._currentAction==t.Schedule.Actions.EditOccurrence&&(vi[this._appointmentSettings.id]=v
10i.AppTaskId),u.push(vi)),this._currentAction==t.Schedule.Actions.Add){if(!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("beforeAppointmentCreate")!=-1)for(c=0;c<u.length;c++)this._timeZoneAppointments(u[c],"");if(this._trigger("beforeAppointmentCreate",{appointment:u,currentAction:kt}))return this._appointmentAddWindow.ejDialog("close"),!1}if(this._currentAction!=t.Schedule.Actions.Add&&this._currentAction!=t.Schedule.Actions.EditFutureOccurrences){if(this._currentAction!=t.Schedule.Actions.EditOccurrence)ut=new t.DataManager(u).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.notEqual,s[this._appointmentSettings.id])),ut.length>0&&(ut=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("beforeAppointmentChange")!=-1?[this._timeZoneAppointments(ut[0],"")]:ut),st=new t.DataManager(u).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,s[this._appointmentSettings.id])),st=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("beforeAppointmentChange")!=-1?[this._timeZoneAppointments(st[0],"")]:st;else for(f=0;f<u.length;f++)st=new t.DataManager(u).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,s[this._appointmentSettings.id])),st=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("beforeAppointmentChange")!=-1?[this._timeZoneAppointments(st[f],"")]:st,ut=new t.DataManager(u).executeLocal((new t.Query).where("ParentId",t.FilterOperators.notEqual,s[this._appointmentSettings.id])),ut.length>0&&(ut=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("beforeAppointmentChange")!=-1?[this._timeZoneAppointments(ut[f],"")]:ut);if(si=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,s[this._appointmentSettings.id])),si=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("beforeAppointmentChange")!=-1?[this._timeZoneAppointments(si[0],"")]:si,yi=u[0][this._appointmentSettings.recurrence]?{appointment:{added:ut,changed:st},currentAction:kt,recurrenceCollection:{occurrences:st[0],parentData:si[0]}}:{appointment:{added:ut,changed:st},currentAction:kt},kt==t.Schedule.Actions.EditSeries&&(yi.ignoreEditedOccurrences=!1),this._trigger("beforeAppointmentChange",yi))return this._appointmentAddWindow.ejDialog("close"),!1;this._ignoreModifyOccurrences=yi.ignoreEditedOccurrences}for(f=0;f<u.length;f++)if(ui=this._checkAvailability(u[f]),ui.length>0)break;if(u[this._appointmentSettings.startTime]>u[this._appointmentSettings.endTime]||ui.length>0)return this._showBlockAlert&&this._alertBlockError(),!1;if(this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOccurrence){for(p=[],c=0;c<u.length;c++)ur=u[c][this._appointmentSettings.startTimeZone],t.isNullOrUndefined(this.model.serverEvents)?p.push(this._timeZoneAppointments(u[c],"")):p.push(u[c]),new t.DataManager(this._currentAppointmentData).update("AppTaskId",u[c]);for(o=[],this._currentAction==t.Schedule.Actions.EditOccurrence&&(dr=this._inline?it[0].ParentId:this._parentId,pi=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,dr)),new t.DataManager(this._currentAppointmentData).update("AppTaskId",pi[0]),t.isNullOrUndefined(this.model.serverEvents)?o.push(this._timeZoneAppointments(pi[0],"")):o.push(pi[0])),ei=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",w=this._dataManager.saveChanges({added:p,changed:o,deleted:[]},ei,this.model.appointmentSettings.query._fromTable),this.model.enableLoadOnDemand&&(this._dataCount=this._currentAppointmentData.length),fr=[],y=0;y<p.length;y++)fr=t.isNullOrUndefined(this.model.serverEvents)?ur!=this.model.timeZone?this._timeZoneAppointments(p[y],"reverse"):p[y]:p[y],new t.DataManager(this._currentAppointmentData).update("AppTaskId",fr);for(er=[],y=0;y<o.length;y++)er=t.isNullOrUndefined(this.model.serverEvents)?ur!=this.model.timeZone?this._timeZoneAppointments(o[y],"reverse"):o[y]:o[y],new t.DataManager(this._currentAppointmentData).update("AppTaskId",er);for(d=0,yt=u.length;d<yt;d++)for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u[d]),ni=this._groupEditing||this._groupEdit?new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,u[d][this._appointmentSettings.startTime].toString())):this._processed.filter(function(n){return n.Guid==u[d].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ni},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ni},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ni}
10,"Guid"),this._maxId=t.isNullOrUndefined(this._maxId)?u[d].AppTaskId:this._maxId,this._appointmentProcessing(u[d]),this._currentViewAppointments=this.getCurrentViewAppointments(),wt=this._currentViewAppointments.filter(function(n){return n.ParentId==u[d].ParentId}),ft=0,b=wt.length;ft<b;ft++)this._refreshDayAppointments(wt[ft]);this._trigger("appointmentCreated",{appointment:u[0],requestType:"appointmentSaved"});this._trigger("actionComplete",{data:u,requestType:"appointmentSave"});!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(e=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,f,o;if(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))e._processUrlBinding(i);else if(n.isPlainObject(r)&&!t.isNullOrUndefined(r.added)&&r.added.length>0)for(e._dateFormat(r.added),f=0,o=r.added.length;f<o;f++)u[0][e._appointmentSettings.id]=r.added[f][e._appointmentSettings.id],u[0][e._appointmentSettings.recurrence]||(u[0].ParentId=r.added[f][e._appointmentSettings.id]),new t.DataManager(e._processed).update("Guid",u[0])}))}else if(this._currentAction==t.Schedule.Actions.Save||this._currentAction==t.Schedule.Actions.EditSeries){var hi=[],s=[],or=[];for(f=0;f<u.length;f++)if(vt.length!=0&&this._groupEditing)if(wi=this._currentAction==t.Schedule.Actions.Save?u[f].ParentId:u[f][this._appointmentSettings.recurrenceId],bi=this._currentAction==t.Schedule.Actions.Save?"ParentId":this._appointmentSettings.recurrenceId,o=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(bi,t.FilterOperators.equal,wi)),!t.isNullOrUndefined(o)&&o.length>0?s.push(u[f]):hi.push(u[f]),o.length>1&&this._currentAction!=t.Schedule.Actions.EditSeries)for(new t.DataManager(this._currentAppointmentData).remove(this._appointmentSettings.id,s[f][this._appointmentSettings.id]),l=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,s[f][this._appointmentSettings.id])),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:l},"Guid"),k=this.getCurrentViewAppointments(l),a=0,b=k.length;a<b;a++)this._appointmentRemove(k[a]),this._refreshDayAppointments(k[a]);else for(new t.DataManager(this._currentAppointmentData).remove("ParentId",s[f].ParentId),l=this._processed.filter(function(n){return n.ParentId==s[f].ParentId}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:l},"Guid"),k=this.getCurrentViewAppointments(l),a=0,b=k.length;a<b;a++)this._appointmentRemove(k[a]),this._refreshDayAppointments(k[a]);else wi=this._currentAction==t.Schedule.Actions.Save?u[f].Guid:u[f][this._appointmentSettings.recurrenceId],bi=this._currentAction==t.Schedule.Actions.Save?"Guid":this._appointmentSettings.recurrenceId,o=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(bi,t.FilterOperators.equal,wi)),!t.isNullOrUndefined(o)&&o.length>0?s.push(u[f]):hi.push(u[f]);if(this._currentAction==t.Schedule.Actions.EditSeries)if(this._ignoreModifyOccurrences)for(e=this,ct=this._getAppointmentByParentId(this._appUid),s[0][this._appointmentSettings.recurrenceRule]=ct[this._appointmentSettings.recurrenceRule],s[0][this._appointmentSettings.recurrenceExDate]=ct[this._appointmentSettings.recurrenceExDate],l=this._processed.filter(function(n){return n.ParentId==s[0].ParentId&&n[e._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")==-1}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:l}
10,"Guid"),k=this.getCurrentViewAppointments(l),a=0,b=k.length;a<b;a++)this._appointmentRemove(k[a]),this._refreshDayAppointments(k[a]);else for(f=0;f<s.length;f++)for(gr=new t.DataManager(this._currentAppointmentData).executeLocal(t.Query().where(t.Predicate(this._appointmentSettings.recurrenceRule,t.FilterOperators.contains,"RECUREDITID="+u[f][this._appointmentSettings.recurrenceId],!0))),or=or.concat(gr),this._appointmentAddWindow.find(".recurbutton").click(),s[f][this._appointmentSettings.recurrenceRule]=at._recRule,s[f][this._appointmentSettings.recurrenceExDate]=null,new t.DataManager(this._currentAppointmentData).remove("ParentId",s[f].ParentId),l=this._processed.filter(function(n){return n.ParentId==s[f].ParentId}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:l},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:l},"Guid"),k=this.getCurrentViewAppointments(l),a=0,b=k.length;a<b;a++)this._appointmentRemove(k[a]),this._refreshDayAppointments(k[a]);for(ti=[],ii=[],c=0;c<hi.length;c++)t.isNullOrUndefined(this.model.serverEvents)?ti.push(this._timeZoneAppointments(hi[c],"")):ti.push(hi[c]);for(dt=0;dt<s.length;dt++)t.isNullOrUndefined(this.model.serverEvents)?ii.push(this._timeZoneAppointments(s[dt],"")):ii.push(s[dt]);for(ei=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",w=this._dataManager.saveChanges({added:ti,changed:ii,deleted:or},ei,this.model.appointmentSettings.query._fromTable),y=0;y<ti.length;y++)t.isNullOrUndefined(this.model.serverEvents)?new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(ti[y],"reverse")):new t.DataManager(this._currentAppointmentData).update("AppTaskId",ti[y]);for(d=0;d<ii.length;d++)t.isNullOrUndefined(this.model.serverEvents)?new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(ii[d],"reverse")):new t.DataManager(this._currentAppointmentData).update("AppTaskId",ii[d]);if(s.length>0){for(bt=0;bt<u.length;bt++)for(new t.DataManager(this._currentAppointmentData).remove("Guid",u[bt]),ki=this._processed.filter(function(n){return n.Guid==u[bt].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ki},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ki},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ki},"Guid"),this._currentAppointmentData.push(u[bt]),this._appointmentProcessing(u[bt]),this._appointmentRemove(u[bt]),this._currentViewAppointments=this.getCurrentViewAppointments(),wt=this._currentViewAppointments.filter(function(n){return n.ParentId==u[bt].ParentId}),ft=0,b=wt.length;ft<b;ft++)this._refreshDayAppointments(wt[ft]);this._trigger("appointmentChanged",{appointment:s[0],requestType:"appointmentChanged",currentAction:kt});this._trigger("actionComplete",{data:s,requestType:"appointmentEdit",currentAction:kt});!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(e=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,f,o;if(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))e._processUrlBinding(i);else if(n.isPlainObject(r)&&!t.isNullOrUndefined(r.added)&&r.added.length>0)for(e._dateFormat(r.added),f=0,o=r.added.length;f<o;f++)u[0][e._appointmentSettings.id]=r.added[f][e._appointmentSettings.id],u[0][e._appointmentSettings.recurrence]||(u[0].ParentId=r.added[f][e._appointmentSettings.id])}))}}else if(this._currentAction==t.Schedule.Actions.EditFutureOccurrences){if(this._trigger("beforeAppointmentChange",{appointment:u[0],currentAction:t.Schedule.Actions.EditFutureOccurrences}))return this._appointmentAddWindow.ejDialog("close"),!1;var e=this,v=n.extend(!0,{},u[0]),ct=this._getAppointmentByParentId(this._appUid),di=this._updateRecurrenceRule(ct,v),ni=this._processed.filter(function(n){return n.ParentId==ct.ParentId});new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ni},"Guid");new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ni},"Guid");new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ni},"Guid");var lt=this._currentAppointmentData.filter(function(n){return n.ParentId==ct.ParentId}),sr=[],nu=[];if(t.isNullOrUndefined(ct[this._appointmentSettings.recurrenceExDate])||(sr=lt.filter(function(n){return new Date(new Date(n[e._appointmentSettings.startTime]).setHours(0,0,0,0))>=new Date(new Date(v[e._appointmentSettings.startTime]).setHours(0,0,0,0))&&n[e._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1})),oi=new t.DataManager(lt).remove("Guid",v.Guid),oi=t.isNullOrUndefined(oi)?[]:oi,n.merge(oi,sr),new t.DataManager(lt).saveChanges({added:[],changed:[],deleted:sr},"Guid"),new Date(ct[this._appointmentSettings.startTime]).setHours(0,0,0,0)==new Date(v[this._appointmentSettings.startTime]).setHours(0,0,0,0)&&new t.DataManager(lt).update(this._appointmentSettings.id,v),new Date(ct[this._appointmentSettings.startTime]).setHours(0,0,0,0)!=new Date(v[this._appointmentSettings.startTime]).setHours(0,0,0,0)){for(ri=0,b=lt.length;ri<b;ri++)lt[ri][this._appointmentSettings.recurrenceRule]=lt[ri][this._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1?lt[ri][this._appointmentSettings.recurrenceRule].replace(di.mainRule,di.parentRule):di.parentRule,this._appointmentProcessing(lt[ri]);v[this._appointmentSettings.recurrenceRule]=di.followRule;v.AppTaskId=this._appMainId;v.ParentId=v[this._appointmentSettings.id]=Math.max.apply(Math,this._processed.map(function(n){return n.AppTaskId}))+1;nu=[v]}for(ei=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",w=this._dataManager.saveChanges({added:nu,changed:lt,deleted:oi},ei,this.model.appointmentSettings.query._fromTable),this._appointmentProcessing(v),this._currentViewApp
10ointments=this.getCurrentViewAppointments(),wt=this._currentViewAppointments.filter(function(n){return n.ParentId==ct.ParentId||v.ParentId}),ft=0,b=wt.length;ft<b;ft++)this._refreshDayAppointments(wt[ft]);this._trigger("appointmentChanged",{appointment:v,requestType:"appointmentChanged",currentAction:t.Schedule.Actions.EditFutureOccurrences});this._trigger("actionComplete",{data:v,requestType:"appointmentEdit",currentAction:t.Schedule.Actions.EditFutureOccurrences});!t.isNullOrUndefined(w)&&n.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager&&(e=this,w.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,u,f;if(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))e._processUrlBinding(i);else if(n.isPlainObject(r)&&!t.isNullOrUndefined(r.added)&&r.added.length>0)for(e._dateFormat(r.added),u=0,f=r.added.length;u<f;u++)v[e._appointmentSettings.id]=r.added[u][e._appointmentSettings.id],v[e._appointmentSettings.recurrence]||(v.ParentId=r.added[u][e._appointmentSettings.id]),new t.DataManager(e._processed).update("Guid",v)}))}t.isNullOrUndefined(this._appointmentAddWindow)||(this._clearFields(),this._appointmentAddWindow.ejDialog("close"))}this.element.find("div.e-draggableworkarea tr").find("td").hasClass("e-selectedCell")&&this._processFocus();(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()!="agenda"&&this.element.find(".e-draggableworkarea").offset().top>this.element.find(".e-workcellstab").offset().top&&(tu=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-tu+"px"));this._recRule="";this.model.showAppointmentNavigator&&this._nextPrevButton();this.model.allowInline&&this._inlineRemove()},_updateRecurrenceRule:function(n,i){var o,r,a,s,b,v,k;t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor();var d=previousRule=n[this._appointmentSettings.recurrenceRule],y=new Date(i[this._appointmentSettings.startTime]),c=new Date(y.setDate(y.getDate()-1)),e=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),p=e.recurrenceDateGenerator(n[this._appointmentSettings.recurrenceRule],n[this._appointmentSettings.startTime]),y=new Date(p[p.length-1]),w=new Date(n[this._appointmentSettings.startTime]),l=[];for(o=0;o<2;o++){var u=previousRule.split(";"),f="",h="";for(f=previousRule.indexOf("COUNT")==-1&&o==0?"UNTIL="+t.format(c,this._pattern.d,this.model.locale):f,r=0;r<u.length;r++)f!=""&&(f+=";"),a=u[r].replace(/ /g,"").split("="),u[r]=a[0]=="COUNT"?"UNTIL="+t.format(c,this._pattern.d,this.model.locale):u[r],h=a[0]=="EXDATE"?u[r]:h,f+=u[r];this._recurrenceEditor.find(".recurstartdate").ejDatePicker({value:t.format(w,this._datepattern(),this.model.locale)});e.recurrenceRuleSplit(f);e.showRecurrenceSummary();s=e.getRecurrenceRule();s=h!=""&&o==0?s+";"+h:s;l.push(s);b=new Date(i[this._appointmentSettings.startTime]);this._recurrenceEditor.find(".recurstartdate").ejDatePicker({value:t.format(b,this._datepattern(),this.model.locale)});v=e.recurrenceDateGenerator(i[this._appointmentSettings.recurrenceRule],i[this._appointmentSettings.startTime]);k=new Date(v[v.length-1]);c=new Date(k);w=new Date(i[this._appointmentSettings.startTime]);previousRule=i[this._appointmentSettings.recurrenceRule]}return{mainRule:d,parentRule:l[0],followRule:l[1]}},_alertCreateError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("CreateError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_timeZoneSavingAppoint:function(n,i){var s,f,r,e;if(this.model.appointmentSettings.applyTimeOffset){if(this._startTimezone=n[this._appointmentSettings.startTimeZone],this._endTimezone=n[this._appointmentSettings.endTimeZone],!t.isNullOrUndefined(this._startTimezone)&&this._startTimezone!=""){var o=this._startTimezone.indexOf("UTC")!=-1?this._startTimezone.split(" ")[1].split(":"):this._startTimezone.split(":"),l=parseInt(o[0]),a=parseInt(o[1]),u=l*60+a;if(this.model.timeZone==null?(s=(new Date).getTimezoneOffset()-this._timeZoneOffset,r=this._minToHour(s+u)):(f=this.model.timeZone.indexOf("UTC")!=-1?this.model.timeZone.split(" ")[1].split(":"):this.model.timeZone.split(":"),r=this._minToHour(u),r.h=r.h-parseInt(f[0]),r.m=r.m-parseInt(f[1])
10),new Date(n[this._appointmentSettings.startTime].setHours(n[this._appointmentSettings.startTime].getHours()-r.h,n[this._appointmentSettings.startTime].getMinutes()-r.m)),this._startTimezone!=this._endTimezone&&this._publicMethodSave){this.startutcValue=null;this.tempValue=null;var h=this._endTimezone.indexOf("UTC")!=-1?this._endTimezone.split(" ")[1].split(":"):this._endTimezone.split(":"),v=parseInt(h[0]),y=parseInt(h[1]),p=v*60+y,w=u-p,b=new Date(i.StartDate),k=new Date(n[this._appointmentSettings.startTime]),c=new Date(i.EndDate);duration=new Date(c.setMinutes(c.getMinutes()+w));duration=new Date(duration.setMinutes(duration.getMinutes()-(r.h*60+r.m)));e=duration}else new Date(n[this._appointmentSettings.endTime].setHours(n[this._appointmentSettings.endTime].getHours()-r.h,n[this._appointmentSettings.endTime].getMinutes()-r.m))}return{obj:n,cloneEnddiffer:e}}return{obj:n,cloneEnddiffer:e}},_renderAllDayAppointments:function(){var l=this.element.find(".e-workcells").width()-20,f,u,r,o,s,n,e,i;if(this.level=0,f=this._dateRender,this._renderedAllDay=[],u=[],this.element.find(".e-alldayappointment").remove(),r=this.getCurrentViewAppointments(this._processed),this.model.group||(this.res1=["0"]),this._resWorkWeek)for(o=0,s=0,n=0;n<this.res1.length;n++)for(o+=t.isNullOrUndefined(this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek.length:this.res1[n][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,s;s<o;s++)for(i=0;i<r.length;i++)this._getMultipleResourceAlldayApp(f,s,n,r[i]),t.isNullOrUndefined(this.allDayCount[0])||u.push(this.allDayCount[0]);else if(this._resCustomView){var o=0,h=0,c=this._tempResource[this._tempResource.length-1].resourceSettings.renderDates;for(n=0;n<this.res1.length;n++)for(t.isNullOrUndefined(this.res1[n][c])||(o+=this._getCustomDatesCount(n,c)),h;h<o;h++)for(i=0;i<r.length;i++)this._getMultipleResourceAlldayApp(f,h,n,r[i]),t.isNullOrUndefined(this.allDayCount[0])||u.push(this.allDayCount[0])}else for(n=0;n<this.res1.length;n++)for(e=0;e<f.length;e++)for(i=0;i<r.length;i++)this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?(this._getMultipleResourceAlldayApp(f,e,n,r[i]),t.isNullOrUndefined(this.allDayCount[0])||u.push(this.allDayCount[0])
10):t.format(new Date(f[e]),this._pattern.d,this.model.locale)==t.format(new Date(r[i][this._appointmentSettings.startTime]),this._pattern.d,this.model.locale)&&(r[i][this._appointmentSettings.allDay]===!0||this._findAllDayApp(r[i]))&&(this._setAllDayPos(r[i],e,n),u.push(r[i]));this.allDayLevel=u.length;u.length==0&&this.level==0&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"));this._reRenderScroller()},_renderSingleApp:function(){this.element.find(".e-prevapp,.e-nextapp").css("display","none");this._dataProcessing(this._currentAppointmentData);this._renderAppointmentAll()},_timeFormat:function(n){var e=t.parseDate(n,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale),i,r,o,u,f;return e?(i=e.getHours(),r=e.getMinutes()):(i=Number(n.match(/^(\d+)/)[1]),r=Number(n.match(/:(\d+)/)[1]),t.isNullOrUndefined(n.split(" ")[1])||(o=n.match(/\s(.*)$/)[1],t.isNullOrUndefined(this._culture.calendar.AM)||t.isNullOrUndefined(this._culture.calendar.PM)||(o==this._culture.calendar.PM[0]&&i<12&&(i=i+12),o==this._culture.calendar.AM[0]&&i==12&&(i=i-12)))),u=i.toString(),f=r.toString(),i<10&&(u="0"+u),r<10&&(f="0"+f),u+":"+f},_processEscapeKey:function(){t.isNullOrUndefined(this._inlineText)||(this.model.orientation!="vertical"||this._customOrientation!="vertical"||t.isNullOrUndefined(this._inlineDate)||this.currentView()=="month"||this._isCustomMonthView()||this._refreshDayAppointments(this._app),this._inlineRemove());t.isNullOrUndefined(this._quickAppointWindow)||this._quickAppointWindow.find(".e-error").remove();this._processFocus();this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")},_processFocus:function(){var h=this.element.find("div.e-selectedAppointment"),s,a;if(h.length!=0&&h.focus(),this.element.find("td.e-selectedCell").hasClass("e-workcells")){var u=this.element.find("div.e-draggableworkarea tr"),c=u.length-1,r,i,l,e,f,o=this.currentView(),v=this;this.element.find("td.e-selectedCell").each(function(t,s){var h=n(s).index(),a;if(h!=null&&!isNaN(h))if(r==null?(r=h,l=n(s).parent()[0].rowIndex):r<h?r=r:r!=h&&(r=h,l=n(s).parent()[0].rowIndex),i==null){if(i=h,o!="month")for(f=parseInt(i),a=0;a<=c;a++)n(u[a].cells[f]).hasClass("e-selectedCell")&&(e=a)}else if(i>h)i=i;else if(i!=h&&(i=h,o!="month"))for(f=parseInt(i),a=0;a<=c;a++)n(u[a].cells[f]).hasClass("e-selectedCell")&&(e=a)});o!="month"?n(u[e].cells[i]).attr("tabIndex",0).focus():(s=u.find("td.e-selectedCell"),a=parseInt(s.length)-1,n(s[a]).attr("tabIndex",0).focus())}else this.element.focus(),this.element.find("td.e-selectedCell").attr("tabIndex",0).focus(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.ejDialog("isOpened")&&this._appointmentAddWindow.find(".subject").focus()},_clearFields:function(){this._appointmentAddWindow.find(".subject").val("");this._appointmentAddWindow.find(".id").val("");this._appointmentAddWindow.find(".e-description").val("").css("height","");this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",new Date);this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",new Date);this._appointmentAddWindow.find(".startendtime").ejTimePicker({enabled:!0});this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date,this._pattern.t,this.model.locale));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date,this._pattern.t,this.model.locale));this._appointmentAddWindow.find(".recurrence,.weekdays").ejCheckBox({checked:!1,enabled:!0});this._appointmentAddWindow.find(".e-repeatlbl").removeClass("e-disable");this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1});this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList("clearText");this._appointmentAddWindow.find("."+this._id+"summary").css("display","none");this._appointmentAddWindow.find(".e-recurFinalRule").html("");this._appointmentAddWindow.find(".e-recuredit").hide();this._appointmentAddWindow.find(".e-categorizevalue").ejAutocomplete("clearText")},_getNumericModel:function(){return numericModel={width:"100px",minValue:1,value:1,cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,localize:this.model.locale}},_deleteApp:function(i){var et=[],f=this._actionType==t.Schedule.Actions.DeleteSeries?t.Schedule.Actions.DeleteSeries:this._actionType==t.Schedule.Actions.DeleteOccurrence?t.Schedule.Actions.DeleteOccurrence:this._actionType==t.Schedule.Actions.DeleteFutureOccurrences?t.Schedule.Actions.DeleteFutureOccurrences:t.Schedule.Actions.Delete,at=this.model.showRecurrenceAlert?this._processed:f==t.Schedule.Actions.DeleteSeries?this._currentAppointmentData:this._processed,vt=this.model.showRecurrenceAlert?(new t.Query).where("Guid",t.FilterOperators.equal,i):f==t.Schedule.Actions.DeleteOccurrence?(new t.Query).where("Guid",t.FilterOperators.equal,i):(new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i),r,s,nt,u,it,v,l,b,k,y,p,st,d,h,a,e,rt,g,ht,ut,ft,o,w,c,lt;if(this._trigger("actionBegin",{id:i,requestType:"appointmentDelete",currentAction:f})||(r=new t.DataManager(at).executeLocal(vt),r.length==0)||(this.model.showRecurrenceAlert||(s=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),nt=this.model.showRecurrenceAlert?r[0][this._appointmentSettings.recurrence]?{appointment:r[0],currentAction:f,re
10currenceCollection:{occurrences:r[0],parentData:this._getAppointmentByParentId(i)}}:{appointment:r[0],currentAction:f}:{appointment:r[0],currentAction:f,recurrenceCollection:{occurrences:s[0],parentData:r[0]},deleteSeries:!0},u=this.model.showRecurrenceAlert?this._getAppointmentByParentId(i):nt.deleteSeries?r[0]:s[0],this._trigger("beforeAppointmentRemove",nt)))return!1;if(f=this.model.showRecurrenceAlert?f:this._currentAction=nt.deleteSeries?f:t.Schedule.Actions.DeleteOccurrence,f==t.Schedule.Actions.Delete&&this._groupEditing)var tt=r[0][this._appointmentSettings.recurrenceId]==null?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId],ot=r[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,yt=t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(ot,t.FilterOperators.equal,tt)),a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId";if(u[this._appointmentSettings.recurrence]){var tt=r[0][this._appointmentSettings.recurrenceId]==null?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId],ot=r[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,yt=t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(ot,t.FilterOperators.equal,tt)),a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId";if(f==t.Schedule.Actions.DeleteFutureOccurrences){for(it=this._updateRecurrenceRule(u,r[0]),v=this._processed.filter(function(n){return n.ParentId==u.ParentId}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:v},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:v},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:v},"Guid"),h=0,o=v.length;h<o;h++)this._appointmentRemove(v[h]),this._refreshDayAppointments(v[h]);for(l=this._currentAppointmentData.filter(function(n){return n.ParentId==u.ParentId}),t.isNullOrUndefined(u[this._appointmentSettings.recurrenceExDate])||(c=this,et=l.filter(function(n){return new Date(new Date(n[c._appointmentSettings.startTime]).setHours(0,0,0,0))>=new Date(new Date(r[0][c._appointmentSettings.startTime]).setHours(0,0,0,0))&&n[c._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1})),b=new t.DataManager(l).remove("Guid",r[0].Guid),b=t.isNullOrUndefined(b)?[]:b,n.merge(b,et),new t.DataManager(l).saveChanges({added:[],changed:[],deleted:et},"Guid"),k=0,o=l.length;k<o;k++)l[k][this._appointmentSettings.recurrenceRule]=l[k][this._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1?l[k][this._appointmentSettings.recurrenceRule].replace(it.mainRule,it.parentRule):it.parentRule;e=this._dataManager.saveChanges({added:[],changed:l,deleted:b},a,this.model.appointmentSettings.query._fromTable)}else if(f==t.Schedule.Actions.DeleteOccurrence)if(u=s,u[0][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1)e=this._dataManager.remove("Guid",u[0].Guid,this.model.appointmentSettings.query._fromTable),this.dataSource()instanceof t.DataManager&&new t.DataManager(this._currentAppointmentData).remove("Guid",u[0]),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:u},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:u},"Guid"),this._appointmentRemove(u[0]),this._refreshDayAppointments(u[0]),!t.isNullOrUndefined(e)&&n.isFunction(e.promise)&&this.dataSource()instanceof t.DataManager&&(c=this,e.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&c._processUrlBinding(i)}));else{var tt=s[0][this._appointmentSettings.recurrenceId]==null?s[0].ParentId:s[0][this._appointmentSettings.recurrenceId],pt=this._deleteOcurrence(tt,s[0][this._appointmentSettings.startTime]),ct=this._timeZoneAppointments(pt[0],""),a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",e=this._dataManager.update(a,ct,this.model.appointmentSettings.query._fromTable),wt=this._timeZoneAppointments(ct,"reverse");if(new t.DataManager(this._currentAppointmentData).update("AppTaskId",wt),this._refreshCellsHeight(),y=this._processed.filter(function(n){return n.Guid==s[0].Guid}),y.length>1)for(d=[],p=0;p<y.length;p++)st=this._processed.filter(function(n){return n.Guid==y[p].Guid}),st.length>0&&d.push(st[0]),new t.DataManager(this._processed).remove("Guid",y[p].Guid),new t.DataManager(this._renderedApp).remove("Guid",y[p].Guid),new t.DataManager(this._renderedAllDay).remove("Guid",y[p].Guid);else d=this._processed.filter(function(n){return n.Guid==s[0].Guid}),new t.DataManager(this._processed).remove("Guid",this._appUid),new t.DataManager(this._renderedApp).remove("Guid",this._appUid),new t.DataManager(this._renderedAllDay).remove("Guid",this._appUid),this._appUid=null;for(h=0,o=d.length;h<o;h++)this._appointmentRemove(d[h]),this._refreshDayAppointments(d[h]);!t.isNullOrUndefined(e)&&n.isFunction(e.promise)&&this.dataSource()instanceof t.DataManager&&(c=this,e.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&c._processUrlBinding(i)}))}else e=this._dataManager.saveChanges({added:[],changed:[],deleted:yt},a,this.model.appointmentSettings.query._fromTable)}else a=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",e=this._dataManager.remove(a,u[a],this.model.appointmentSettings.query._fromTable),this.dataSource()instanceof t.DataManager&&new t.DataManager(this._currentAppointmentData).remove(a,u[a]);if(this._refreshCellsHeight(),f!=t.Schedule.Actions.DeleteOccurrence)if(this.currentView()!="agenda")if(this._currentAppointmentData.length>0){for(w=r[0][this._appointmentSettings.recurrence]||this._groupEditing?this._processed.filter(function(n){return n[ot]==tt}):this._processed.filter(function(n){return n.Guid==i}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:w},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:w},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:w}
10,"Guid"),rt=this.getCurrentViewAppointments(w),g=0,o=rt.length;g<o;g++)this._appointmentRemove(rt[g]),this._refreshDayAppointments(rt[g]);if(f==t.Schedule.Actions.DeleteFutureOccurrences){for(ht=this._currentAppointmentData.filter(function(n){return n.ParentId==u.ParentId}),ut=0,o=ht.length;ut<o;ut++)this._appointmentProcessing(ht[ut]);for(this._currentViewAppointments=this.getCurrentViewAppointments(),ft=0,o=this._currentViewAppointments.length;ft<o;ft++)this._refreshDayAppointments(this._currentViewAppointments[ft])}}else this._processed=[],this._renderedApp=[],this._renderedAllDay=[],this.element.find("div.e-appointwrapper").remove(),this._appointmentRemove(r[0]),this._refreshDayAppointments(r[0]);else new t.DataManager(this._processed).remove("Guid",i),w=new t.DataManager(this._processed).executeLocal((new t.Query).where(t.Predicate("ParentId",t.FilterOperators.equal,r[0].ParentId))),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:w},"Guid"),this._renderAgendaContent();this._trigger("appointmentRemoved",{appointment:u,requestType:"appointmentDeleted",currentAction:f});this._trigger("actionComplete",{data:u,requestType:"appointmentDelete",currentAction:f});!t.isNullOrUndefined(e)&&n.isFunction(e.promise)&&this.dataSource()instanceof t.DataManager&&(c=this,e.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&c._processUrlBinding(i)}));this.model.timeScale.enable&&((r[0][this._appointmentSettings.endTime]-r[0][this._appointmentSettings.startTime])/36e5>24||r[0][this._appointmentSettings.allDay])&&this.currentView()!="month"&&!this._isCustomMonthView()&&this.currentView()!="agenda"&&this.allDayLevel==0&&(this.element.find(".e-alldaycells,.e-leftindent").addClass("e-alldaycellsheight"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),this._reRenderScroller());this._currentViewAppointments=this.getCurrentViewAppointments();this.model.showAppointmentNavigator&&this._nextPrevButton();this.model.showOverflowButton||this.model.orientation!="horizontal"&&this._customOrientation!="horizontal"||this.currentView()=="agenda"||(lt=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-lt+"px"));this._appUid=null;this._actionType=""},getCurrentViewAppointments:function(n){var i;if(this._resCustomView)i=this._processed;else{var r=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this.currentView()=="month"||this._isCustomMonthView())?this.monthDays:this._resWorkWeek?this._renderDates:this._dateRender,f=t.isNullOrUndefined(n)?this._appointmentSort(this._processed):this._appointmentSort(n),u=this.currentView()=="agenda"?new Date(new Date(this.currentDate()).setHours(0,0,0)):new Date(r[0]),e=this.currentView()=="agenda"?new Date(new Date(new Date(this.currentDate()).setDate(u.getDate()+(this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0))).setHours(23,59,59)):new Date(new Date(r[r.length-1]).setHours(23,59,59)),o=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,u).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,e);i=new t.DataManager(f).executeLocal((new t.Query).where(o))}return i},_reRenderAllDayAppointments:function(){this._alldayLevel=this.level==1?!0:!1;this.model.showAllDayRow&&this.element.find("div.e-alldayappointment").remove()&&this._renderAllDayAppointments();this._bindAppointmentAction()},_appointmentResizeStart:function(i){if(this.model.enableAppointmentResize){this._tooltipEvents("disable");this._appointdata=n(i.target).parent();var u=n(i.target).parent().attr("data-guid"),f=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,u))),r={element:n(i.target).parent(),appointment:f[0]};if(this._trigger("actionBegin",{data:r,requestType:"appointmentResize"})||this._trigger("resizeStart",r))return this._tooltipEvents("enable"),!1;i.preventDefault();!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"));this.resizeStart=!0;n(i.target).hasClass("e-lefthandle")||n(i.target).hasClass("e-righthandle")?(this.resize=i.pageX,this.appoint_width=n(i.target).parent().width(),this.appoint_left=parseInt(n(i.target).parent()[0].style.left),this._appointleft=parseInt(n(n(i.target).parent()[0]).offset().left),this._appointright=parseInt(n(n(i.target).parent()[0]).css("right")),(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.model.enableRTL?n(i.target).hasClass("e-lefthandle")?this._rightResizing=!0:this._leftResizing=!0:n(i.target).hasClass("e-lefthandle")?this._leftResizing=!0:this._rightResizing=!0):(n(i.target).hasClass("e-tophandle")||n(i.target).hasClass("e-bottomhandle"))&&(this.resize=i.pageY,this.appoint_height=n(i.target).parent().height(),this.appoint_top=parseInt(n(i.target).parent()[0].style.top),n(i.target).hasClass("e-tophandle")?this._topResizing=!0:this._bottomResizing=!0);this._curElmt=n(i.target).parent();this._resizeflag=!1;this.element.find(".e-workcells").removeClass("e-selectedCell,e-mousehover");n(document).on(t.eventType.mouseMove,n.proxy(this._appointmentResizing,this));n(document).on(t.eventType.mouseUp,n.proxy(this._appointmentResizeStop,this));if(n(i.target).hasClass("e-rowcursor")||n(i.target).hasClass("e-columncursor"))return!1}},_appointmentResizing:function(i){var o=n(i.target),u={element:o.parent(),interval:10},r,f,e;t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");r=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-alldayappointment")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");n(".e-scheduleAppGlassy").length==0&&(r.find(".e-schedulemouseclose").addClass("e-schedulemouseclosetemp").removeClass("e-schedulemouseclose e-icon"),r.clone().prop("id","cloneElement").appendTo(r.parent()),r.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose").appendTo(r.parent()),this._topResizing||this._bottomResizing?(this.model.enableRTL?r.css("right","0"):r.css("left","0"),r.css("width","98%")):(this._rightResizing||this._leftResizing)&&(this.model.orientation!="horizontal"?this.currentView()==="month"||this._isCustomMonthView()?this._appointmentResizeHeight(r,-this.element.find(".e-monthheader").height(),"e-monthcells"):this.model.timeScale.enable?(r.css("top",this.element.find(".e-headerarearow").height()-this.element.find(".e-alldaycells")[0].offsetHeight-2),r.css("height",this.element.find(".e-alldaycells")[0].offsetHeight-2)):r.css("height",this.element.find(".e-monthcells").height()-2):this.model.timeScale.enable||r.css("height",this.element.find(".e-workcells").height()-2)));r=n(i.target).hasClass("e-appointment")||n(i.target).hasClass("e-monthappointment")||n(i.target).hasClass("e-workcells")||n(i.target).hasClass("e-monthcells")||n(i.target).hasClass("e-alldayappointment")||n(i.target).hasClass("e-alldaycells")?n(i.target):n(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");
10f=this.element.find(".e-workcells").height();e=n(r[0]).height()/f;this._topResizing?e>0&&!n(i.target).hasClass("e-alldaycells")&&!n(i.target).hasClass("e-apptext")&&(this._curElmt.height(this.appoint_height+this.resize-i.pageY+3),this._curElmt.css("top",this.appoint_top-(this.resize-i.pageY)-3)):this._bottomResizing?this._curElmt.height(this.appoint_height+(i.pageY-this.resize)+2):this._rightResizing?(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+this.resize-i.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-i.pageX)-3)):(this._curElmt.width(this.appoint_width+(i.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(i.pageX-this.resize)-2)):this._leftResizing&&((this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+(i.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(i.pageX-this.resize)-2)):(this._curElmt.width(this.appoint_width+this.resize-i.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-i.pageX)-3)));this._trigger("resize",u);this._resizeInterval=u.interval;this._curElmt.hasClass("e-appointment")&&this._appointmentCurrentTimeUpdate()},_appointmentResizeHeight:function(i,r,u){if(i.length>0){var f=this.model.showOverflowButton?this.element.find("."+u):i.closest("td");i.css("top",r).css("height",(t.isNullOrUndefined(n(f)[0])?n(f).height():n(f)[0].offsetHeight)-2)}},_appointmentMonthUpdate:function(n,t){var i=new Date(this._dateRender[t]);return i.setHours(n.getHours(),n.getMinutes(),n.getSeconds()),new Date(i)},_appointmentCurrentTimeUpdate:function(){var b=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(this._curElmt.attr("id").split("_")[1])))[0],r=new Date(b[this._appointmentSettings.startTime]),i=new Date(b[this._appointmentSettings.endTime]),a=this.element.find(".e-workcells")[0].offsetHeight,v=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),nt,l,p,w,ut,o,f,e;if(this.currentView()!=="month"&&!this._isCustomMonthView())var y=this.element.find(".e-draggableworkarea"),ft=n(this._curElmt[0]).offset().top,k=y.height()+y.scrollTop(),et=n(this._curElmt[0]).outerHeight(),d=ft-y.offset().top+y.scrollTop(),g=d-a/this.model.timeScale.minorSlotCount<k?d:k-et;if(this._topResizing)l=g*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*a),r.setHours(parseInt(this.model.startHour)+parseInt(l/60)),r.setMinutes(parseInt(l%60)),v>=this._resizeInterval?r.setMinutes(Math.round(r.getMinutes()/this._resizeInterval)*this._resizeInterval):r.setMinutes(r.getMinutes()/this._resizeInterval*this._resizeInterval);else if(this._bottomResizing)nt=n(this._curElmt[0]).outerHeight()/a,l=(g+nt*a)*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*a),i.setHours(parseInt(this.model.startHour)+parseInt(l/60)),i.setMinutes(l%60),v>=this._resizeInterval?i.setMinutes(Math.round(i.getMinutes()/this._resizeInterval)*this._resizeInterval):i.setMinutes(i.getMinutes()/this._resizeInterval*this._resizeInterval);else if(this._rightResizing){if(p=this.model.endHour-this.model.startHour==24?this._curElmt.width()-this.appoint_width:this._curElmt.width(),o=p*60/(this.element.find(".e-workcells").width()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+1),this.model.endHour-this.model.startHour==24)i.setHours(new Date(i).getHours()+parseInt(o/60)),i.setMinutes(new Date(i).getMinutes()+parseInt(o%60));else{var tt=this.element.find(".e-scheduleAppGlassy").width(),it=this.element.find(".e-workcells").width(),h=new Date(r),c=new Date(i),u=this._dateRender.indexOf(new Date(c).setHours(0,0,0)),s=(this.model.endHour-this.model.startHour)*60,rt=it/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),p=tt-this.appoint_width,o=p/rt;i.setDate(c.getDate());i.setMinutes(c.getMinutes()+o);(i.getHours()>=this.model.endHour||c.getDate()!=i.getDate())&&this._resizeflag==!1?(f=(this.model.endHour-c.getHours())*60,f=c.getMinutes()===0?f:f-c.getMinutes(),f=f<0?0:f,e=o-f,e>s&&(e=e%s),u=u+Math.ceil((o-f)/s),u>=this._dateRender.length?(u=this._dateRender.length-1,i=this._appointmentMonthUpdate(i,u),i.setDate(new Date(this._dateRender[u]).getDate()),i.setHours(this.model.endHour,0,0)):(i=this._appointmentMonthUpdate(i,u),i.setDate(new Date(this._dateRender[u]).getDate()),i.setHours(this.model.startHour,0,0),i.setMinutes(e))):(i.getHours()<this.model.startHour||c.getDate()!=i.getDate())&&
10(this._resizeflag=!0,f=(this.model.startHour-c.getHours())*60,f=c.getMinutes()===0?f:f-c.getMinutes(),e=Math.abs(o-f),e>s&&(e=e%s),u=u-Math.ceil(Math.abs(o-f)/s),u=u<0?0:u,i=this._appointmentMonthUpdate(i,u),i.setDate(new Date(this._dateRender[u]).getDate()),i.setHours(this.model.endHour,0,0),i.setMinutes(-e))}v>=this._resizeInterval?i.setMinutes(Math.round(i.getMinutes()/this._resizeInterval)*this._resizeInterval):i.setMinutes(i.getMinutes()/this._resizeInterval*this._resizeInterval);i>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))&&(i=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)))}else if(this._leftResizing){if(w=n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left<n(this._curElmt).offset().left?this._curElmt.offset().left-this._appointleft:n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left-this._appointleft,this.model.enableRTL&&(ut=this._curElmt.width()-this.appoint_width,w=-ut),o=w*60/(this.element.find(".e-workcells").width()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+1),this.model.endHour-this.model.startHour==24)r.setHours(parseInt(new Date(r).getHours())+parseInt(o/60)),r.setMinutes(new Date(r).getMinutes()+parseInt(o%60));else{var tt=this.element.find(".e-scheduleAppGlassy").width(),it=this.element.find(".e-workcells").width(),h=new Date(r),c=new Date(i),u=this._dateRender.indexOf(new Date(h).setHours(0,0,0)),s=(this.model.endHour-this.model.startHour)*60,rt=it/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),p=tt-this.appoint_width,o=p/rt;r.setDate(h.getDate());r.setMinutes(h.getMinutes()-o);(r.getHours()<this.model.startHour||h.getDate()!=r.getDate())&&this._resizeflag==!1?(f=(h.getHours()-this.model.startHour)*60,f=h.getMinutes()===0?f:f+h.getMinutes(),f=f<0?0:f,e=o-f,e>s&&(e=e%s),u=u-Math.ceil((o-f)/s),u<0?(u=0,r.setMonth(new Date(this._dateRender[u]).getMonth()),r.setDate(new Date(this._dateRender[u]).getDate()),r.setHours(this.model.startHour,0,0)):(r.setMonth(new Date(this._dateRender[u]).getMonth()),r.setDate(new Date(this._dateRender[u]).getDate()),r.setHours(this.model.endHour,0,0),r.setMinutes(-e))):(r.getHours()>
10=this.model.endHour||h.getDate()!=r.getDate())&&(this._resizeflag=!0,f=(this.model.endHour-h.getHours())*60,f=h.getMinutes()===0?f:f-h.getMinutes(),e=Math.abs(o+f),e>s&&(e=e%s),u=u+Math.ceil(Math.abs(o+f)/s),u=u>=this._dateRender.length?this._dateRender.length-1:u,r.setMonth(new Date(this._dateRender[u]).getMonth()),r.setDate(new Date(this._dateRender[u]).getDate()),r.setHours(this.model.startHour,0,0),r.setMinutes(e))}v>=this._resizeInterval?r.setMinutes(Math.round(r.getMinutes()/this._resizeInterval)*this._resizeInterval):r.setMinutes(r.getMinutes()/this._resizeInterval*this._resizeInterval);r<new Date(this._dateRender[0])&&(r=new Date(this._dateRender[0]))}this.model.enableRTL?(this._curElmt.find(".e-apptext").html(t.format(new Date(r),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal"),this._curElmt.find(".e-apptime").html(t.format(new Date(i),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal").css("float","left").css("margin-top",this._curElmt.height()-(this._curElmt.find(".e-apptime").outerHeight()+this._curElmt.find(".e-apptext").outerHeight())+"px")):this.model.endHour-this.model.startHour==24?(this._curElmt.find(".e-apptext").html(t.format(new Date(r),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal"),this._curElmt.find(".e-apptime").html(t.format(new Date(i),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal").css("float","right").css("margin-top",this._curElmt.height()-(this._curElmt.find(".e-apptime").outerHeight()+this._curElmt.find(".e-apptext").outerHeight())+"px")):isNaN(r)||isNaN(i)||(this._curElmt.find(".e-apptext").html(t.format(new Date(r),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal"),this._curElmt.find(".e-apptime").html(t.format(new Date(i),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).css("font-size","12px").css("white-space","normal").css("float","right").css("margin-top",this._curElmt.height()-(this._curElmt.find(".e-apptime").outerHeight()+this._curElmt.find(".e-apptext").outerHeight())+"px"));this._resizeNewStartTime=r;this._resizeNewEndTime=i},_leftRightResize:function(t,i,r,u,f,e){var s=this._leftResizing?f:e,o=this._leftResizing?e:f,p,l,v,a,y,h,b,c;if(this._resWorkWeek||this._resCustomView?(h=i.offset(),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none"),p=this._leftResizing?t.elementFromPoint(h.left-n(t).scrollLeft(),h.top-n(t).scrollTop()):t.elementFromPoint(h.left+i.width()-n(t).scrollLeft(),h.top-n(t).scrollTop()),l=this._leftResizing?Math.floor(i.offset().left/this.element.find(".e-alldaycells").width())-1:Math.floor(i.offset().left/this.element.find(".e-alldaycells").width())+1,this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible")):l=this._leftResizing?r*u:r==this.res1.length-1?(r+1)*u-1:(r+1)*u,this.model.enableRTL)if(this._resWorkWeek||this._resCustomView){y=n.extend(!0,[],this._dateRender);y.reverse();h=i.offset();this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none");var p=this._rightResizing?t.elementFromPoint(h.left-n(t).scrollLeft(),h.top-n(t).scrollTop()):t.elementFromPoint(h.left+i.width()-n(t).scrollLeft(),h.top-n(t).scrollTop()),w=n.grep(p,function(t){if(n(t).closest("td").hasClass("e-alldaycells"))return t}),l=this.element.find(".e-alldaycells").length-1-n(w[0]).index();this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible");newEndTime=new Date(y[l]);newEndTime.setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())}else b=n(i[0]).width()-this.appoint_width,c=Math.round(n(i[0]).width()/this.element.find(".e-alldaycells").width())-1,newEndTime=this._rightResizing?new Date(e):new Date(s),this._rightResizing?newEndTime.setDate(new Date(newEndTime).getDate()-c):newEndTime.setDate(new Date(newEndTime).getDate()+c),newEndTime.setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()),newEndTime>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()))?newEndTime=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())):newEndTime<new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds()))&&(newEndTime=new Date(new Date(newEndTime).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())));else this._rightResizing?(a=i[0].offsetLeft+n(i[0]).width(),this._resWorkWeek&&this._resCustomView||(c=Math.floor(a/this.element.find(".e-alldaycells").width())-r*u),v=r==this.res1.length-1?n(this.element.find(".e-alldaycells")[l]).offset().left+this.element.find(".e-alldaycells").width():n(this.element.find(".e-alldaycells")[l]).offset().left):(a=this.element.find(".e-alldaycells").eq(l).offset().left,v=n(i[0]).offset().left),v>=a?(newStartTime=new Date(this._dateRender[0]),this._resWorkWeek&&this._resCustomView||!this._leftResizing||(a=n(i[0]).offset().left-n(this.element.find(".e-alldaycells")[r*u]).offset().left,c=Math.round(a/(this.element.find(".e-alldaycells").width()+1))),this.model.workWeek.length>0?this._resWorkWeek?(newStartTime=new Date(this._dateRender[l]),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(this._dateRender[c]).getDate()),newStartTime.setMonth(new Date(this._dateRender[c]).getMonth()),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(newStartTime).getDate()+(c>=u?c-1:c)),newStartTime.setHours(new Date(s).getHours(),new Date(s).getMinutes(),new Date(s).getSeconds()))):(this._rightResizing?this._rightResizing=!1:this._leftResizing=!1,this.model.enableRTL?newEndTime=e:newStartTime=f);return this.model.enableRTL?newEndTime:newStartTime},_appointmentResizeStop:function(r){var bt,ct,yt,hi,yr,pr,ni,ci,ki,ti,gt,li,p,g,ht,di,ai,nr,u,tr,ir,rr,ii,vt,ur,yi,ot,a,y,at,w,kt,h,ri,fr,er,pt,ui,et,tt,fi,ei,oi,ut,s,si,l,r,rt,it;this._tooltipEvents("enable");try{bt=this.element.find(".e-draggableworkarea");this.resizeStart=!1;n(document).off(t.eventType.mouseMove,n.proxy(this._appointmentResizing,this));n(document).off(t.eventType.mouseUp,n.proxy(this._appointmentResizeStop,this));var f=this._appointmentSettings,or=this.element.find(".e-workcellstab"),sr=or.find("tr").length*this.element.find(".e-workcells,.e-monthcells").height(),c=n(r.target).hasClass("e-appointment")||n(r.target).hasClass("e-monthappointment")||n(r.target).hasClass("e-alldayappointment")?n(r.target):n(r.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");c.length==0&&(c=this._appointdata);c.attr("data-guid")!=this._appointdata.attr("data-guid")&&(c=this._appointdata);this._appUid=c.attr("data-guid");var v=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),st=v.length>1?!0:!1,b=v[0][f.recurrence]&&v[0][f.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):v[0][f.recurrence]?v[0]:this._getAppointmentByParentId(this._appUid),nt=this.currentView()==="week"||this.currentView()==="month"||this._isCustomMonthView()?this.model.showWeekend?7:this.model.workWeek.length:this.currentView()==="workweek"&&this.model.workWeek.length>0?this.model.workWeek.length:1;if(nt=this.currentView()=="customview"&&this._renderDays<=7?this._renderDays:nt,this._resWorkWeek&&(yt=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,v[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]])),ct=t.isNullOrUndefined(yt[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?this.model.workWeek:yt[0][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek],nt=ct.length),this._resCustomView&&(yt=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,v[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]])),t.isNullOrUndefined(yt[0][this._tempResource[this._tempResource.length-1].resourceSettings.renderDates])||(ct=yt[0][this._tempResource[this._tempResource.length-1].resourceSettings.renderDates],nt=t.isNullOrUndefined(ct)||n.type(ct[0])!="object"?ct.length:this._getMultipleCustomDatesCount(ct))),b!=null||b!==i){var dr=b[this._appointmentSettings.startTime].getDate()<new Date(b[this._appointmentSettings.endTime]).getDate()?!0:!1,o=new Date(b[this._appointmentSettings.startTime]),e=new Date(b[this._appointmentSettings.endTime]);st&&v[0][f.recurrence]?(hi=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,v[0].Guid))),o=new Date(hi[0][this._appointmentSettings.startTime]),e=new Date(hi[1][this._appointmentSettings.endTime])):v[0][f.recurrence]&&(o=new Date(v[0][this._appointmentSettings.startTime]),e=new Date(v[0][this._appointmentSettings.endTime]));this.element.find("div[data-guid="+v[0].Guid+"]").removeClass("e-selectedAppointment");var k=b[this._appointmentSettings.startTime],d=b[this._appointmentSettings.endTime],pi=n(c[0]).outerHeight(),dt=this.element.find(".e-workcells").outerHeight();if(this.currentView()!=="month"&&!this._isCustomMonthView())var hr=n(c[0]).offset().top,wi=bt.height()+bt.scrollTop(),bi=hr-bt.offset().top+bt.scrollTop(),lt=bi-dt/this.model.timeScale.minorSlotCount<wi?bi:wi-pi;lt=t.isNullOrUndefined(lt)?0:lt;var cr=n(c[0]).outerHeight()/dt,lr=(lt+cr*dt)*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*dt)/30,ar=pi-parseInt(lr),vr
10=lt+ar;if(this._topResizing)yr=this._topResizing,lt>0?o=this._resizeNewStartTime:o.setHours(0,0,0),this._topResizing=!1,this._leftStartTime=!0;else if(this._bottomResizing)pr=this._bottomResizing,lt>=0&&vr<sr?e=this._resizeNewEndTime:e.setHours(23,59,59),this._bottomResizing=!1,this._leftStartTime=!1;else if(this._leftResizing){if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"){if(y=this.model.group?this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,b[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],null,null):this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,b[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-1].trim()],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,b[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-2].trim()]):0,this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable)this.model.enableRTL?e=this._leftRightResize(document,c,y,nt,k,d):o=this._leftRightResize(document,c,y,nt,k,d);else if(gt=this.model.enableRTL?n(this.element.find(".e-monthcells")[(y+1)*nt-1]).offset().left:n(this.element.find(".e-monthcells")[y*nt]).offset().left,n(c[0]).offset().left>gt)if(this.model.enableRTL)if(this.model.showWeekend)p=Math.round((n(c[0]).width()-this.appoint_width)/this.element.find(".e-monthcells").width()),e.setDate(new Date(e).getDate()+p),e.setHours(new Date(d).getHours(),new Date(d).getMinutes(),new Date(d).getSeconds());else{for(ni=this._getWeekDays();ni.indexOf(e.getDay())<0;)e=new Date(new Date(e).getTime()+864e5);g=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+p;e=new Date(this._dateRender[g]);e.setHours(new Date(d).getHours(),new Date(d).getMinutes(),new Date(d).getSeconds())}else if(this._resize=!0,o=new Date(this._firstweekdate(new Date(v[0][f.startTime]))),this._resize=!1,p=Math.round((n(c[0]).offset().left-n(this.element.find(".e-monthcells")[y*nt]).offset().left)/this.element.find(".e-monthcells").width()),this.model.showWeekend)o.setDate(o.getDate()+p),o.setHours(new Date(k).getHours(),new Date(k).getMinutes(),new Date(k).getSeconds());else{for(ni=this._getWeekDays();ni.indexOf(o.getDay())<0;)o=new Date(new Date(o).getTime()+864e5);g=this._dateRender.indexOf(new Date(o).setHours(0,0,0,0))+p;o=new Date(this._dateRender[g]);o.setHours(new Date(k).getHours(),new Date(k).getMinutes(),new Date(k).getSeconds())}}else ci=n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left<n(c[0]).offset().left?n(c[0]).offset().left-this._appointleft
10:n(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left-this._appointleft,this.model.enableRTL&&(ki=n(c[0]).width()-this.appoint_width,ci=-ki),this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?(p=Math.round(ci/(this.element.find(".e-workcells").width()+1)),this._diffDays=Math.round(n(c[0]).width()/this.element.find(".e-workcells").width()),!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0?(g=this._dateRender.indexOf(new Date(o).setHours(0,0,0,0))+p,ht=new Date(new Date(this._dateRender[g]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())),o=new Date(ht)):this.model.showWeekend?o.setDate(new Date(o).getDate()+p):(g=this._dateRender.indexOf(new Date(o).setHours(0,0,0,0))+p,ht=new Date(new Date(this._dateRender[g]).setHours(new Date(o).getHours(),new Date(o).getMinutes(),new Date(o).getSeconds())),o=new Date(ht))):o=this._resizeNewStartTime;this._leftResizing=!1;this._leftStartTime=!0}else this._rightResizing&&(this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(y=this.model.group?this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,b[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1]],null,null):this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,b[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-1].trim()],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,b[this._appointmentSettings.resourceFields.split(",")[this._tempResource.length-2].trim()]):0,this.currentView()!=="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?this.model.enableRTL?o=this._leftRightResize(document,c,y,nt,k,d):e=this._leftRightResize(document,c,y,nt,k,d):(ti=this.element.find(".e-monthcells").width(),gt=this.model.enableRTL?n(this.element.find(".e-monthcells")[y*nt]).offset().left+ti:y==this.res1.length-1?n(this.element.find(".e-monthcells")[(y+1)*nt-1]).offset().left+ti:n(this.element.find(".e-monthcells")[(y+1)*nt]).offset().left,gt>=n(c[0]).offset().left+n(c[0]).width()&&(p=this._diffDays=Math.round((n(c[0]).width()-this.appoint_width)/ti),this.model.enableRTL?this.model.showWeekend?(o.setDate(new Date(o).getDate()-p),o.setHours(new Date(k).getHours(),new Date(k).getMinutes(),new Date(k).getSeconds())):(g=this._dateRender.indexOf(new Date(o).setHours(0,0,0,0))-p,o=new Date(this._dateRender[g]),o.setHours(new Date(k).getHours(),new Date(k).getMinutes(),new Date(k).getSeconds())):this.model.showWeekend?(e.setDate(new Date(e).getDate()+p),e.setHours(new Date(d).getHours(),new Date(d).getMinutes(),new Date(d).getSeconds())):(g=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+p,e=new Date(this._dateRender[g]),e.setHours(new Date(d).getHours(),new Date(d).getMinutes(),new Date(d).getSeconds()))))):(li=this.model.endHour-this.model.startHour==24?n(c[0]).width()-this.appoint_width:n(c[0]).width(),this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?(li=n(c[0]).width()-this.appoint_width,p=Math.round(li/(this.element.find(".e-workcells").width()+1)),this._diffDays=Math.round(n(c[0]).width()/this.element.find(".e-workcells").width()),!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0?(g=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+p,ht=new Date(new Date(this._dateRender[g]).setHours(new Date(e).getHours(),new Date(e).getMinutes(),new Date(e).getSeconds())),e=new Date(ht)):this.model.showWeekend?e.setDate(new Date(e).getDate()+p):(g=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0))+p,ht=new Date(new Date(this._dateRender[g]).setHours(new Date(e).getHours(),new Date(e).getMinutes(),new Date(e).getSeconds())),e=new Date(ht))):(e=this._resizeNewEndTime,di=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,c.attr("data-guid"))),di[0][this.model.appointmentSettings.allDay]=!1)),this._rightResizing=!1,this._leftStartTime=!1);if((o>=e||n(c[0]).width()==0)&&(o=v[0][f.startTime],e=v[0][f.endTime]),o.getTime()==v[0][f.startTime].getTime()&&e.getTime()==v[0][f.endTime].getTime())return this.element.find("#cloneElement").length>0&&(ai=this.element.find(".e-monthappointment").length>1?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),this.model.enableRTL?this._curElmt.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.element.find("#cloneElement").width(),height:ai,top:this.element.find("#cloneElement").css("top"),right:this.element.find("#cloneElement").css("right")}):this._curElmt.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.element.find("#cloneElement").width(),height:ai,top:this.element.find("#cloneElement").css("top"),left:this.element.find("#cloneElement").css("left")}),this._curElmt.find(".e-apptext").replaceWith(this.element.find("#cloneElement").find(".e-apptext")).prop("style",!1),this._curElmt.find(".e-apptime").html(this.element.find("#cloneElement").find(".e-apptime").text()).prop("style",!1),this._curElmt.css("width",this.element.find("#cloneElement")[0].style.width),this._curElmt.hasClass("e-alldayappointment")&&this._curElmt.height(19),this.element.find("#cloneElement").remove(),n(c[0]).find(".e-schedulemouseclosetemp").addClass("e-schedulemouseclose e-icon").removeClass("e-schedulemouseclosetemp")),!1;this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove();this._refreshCellsHeight();var gi=new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1),wr=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),br=!this.model.showNextPrevMonth&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.currentView()=="month"?gi.getTime()!=new Date(o.getFullYear(),o.getMonth(),1).getTime()||gi.getTime()!=new Date(e.getFullYear(),e.getMonth(),1).getTime():!1;if(!br&&e>=new Date(this.model.minDate)&&e<=wr)if(b[f.recurrence]==1&&b[f.recurrenceRule].toString().indexOf("RECUREDITID")==-1){var y,at=!1,kr=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),v=kr,vi=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),ft=n.extend(!0,{},vi[0]);if(ft[this._appointmentSettings.endTime]=vi[vi.length-1][this._appointmentSettings.endTime],ii=ft[this._appointmentSettings.recurrenceId]==null?ft.ParentId:ft[this._appointmentSettings.recurrenceId],nr=ft[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,w=this._groupEditing||this._groupEdit?new t.DataManager(this._processed).executeLocal((new t.Query).where("commonGuid",t.FilterOperators.equal,ft.commonGuid)):new t.DataManager(this._processed).executeLocal((new t.Query).where(nr,t.FilterOperators.equal,ii)),st&&(a=v,w=this._recurrenceAppSort(w)),w=this._appointmentRecurrenceSort(w),u=n.extend({},v[0]),this._groupEditing)for(ri=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[this._appointmentSettings.id])),s=0;s<this._appointmentSettings.resourceFields.split(",").length;s++)u[this._appointmentSettings.resourceFields.split(",")[s].trim()]=ri[0][this._appointmentSettings.resourceFields.split(",")[s].trim()];if(st&&(u=n.extend({},w.filter(function(n){return n.Guid==v[0].Guid})[0]),this._groupEditing))for(s=0;s<this._appointmentSettings.resourceFields.split(",").length;s++)u[this._appointmentSettings.resourceFields.split(",")[s].trim()]=u[this._id+"_ownerfield_"+[s]];for(this.model.enableRecurrenceValidation&&u[f.recurrence]&&(y=this._recuCollectionIndex(w,ft)),!this.model.enableRecurrenceValidation||!u[f.recurrence]||(y==0?t.isNullOrUndefined(w[y+1])?!0:new Date(new Date(w[y+1][f.startTime]).setHours(0,0,0,0)).getTime()>
10new Date(new Date(e).setHours(0,0,0,0)).getTime():y==w.length-1?new Date(new Date(w[y-1][f.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(o).setHours(0,0,0,0)).getTime():new Date(new Date(w[y-1][f.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(o).setHours(0,0,0,0)).getTime()&&new Date(new Date(w[y+1][f.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(e).setHours(0,0,0,0)).getTime())?(tr=u[f.startTime],ir=u[f.endTime],u[f.startTime]=new Date(o),u[f.endTime]=new Date(e),pt=this._checkAvailability(u),ui=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("resizeStop")!=-1?{type:r.type}:r,t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("resizeStop")==-1||this._timeZoneAppointments(u,""),this._trigger("resizeStop",{appointment:u,target:ui})||pt.length>0?(this._showBlockAlert&&pt.length>0&&this._alertBlockError(),u[f.startTime]=new Date(tr),u[f.endTime]=new Date(ir),at=!0):(rr=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,ii=u[f.recurrenceId]==null?u.ParentId:u[f.recurrenceId],this._deleteOcurrence(ii,new Date(ft[f.startTime])),u[f.recurrenceRule]=v[0][f.recurrenceRule]+";RECUREDITID="+u.ParentId,u[f.id]=u.AppTaskId=rr)):(u[f.startTime]=ft[f.startTime],u[f.endTime]=ft[f.endTime],this._alertDragResizeError(),at=!0,this._groupEditing&&(u[f.resourceFields.split(",")[f.resourceFields.split(",").length-1].trim()]=ft[f.resourceFields.split(",")[f.resourceFields.split(",").length-1].trim()])),et=[],vt=[],t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("resizeStop")==-1?et.push(this._timeZoneAppointments(u,"")):et.push(u),ur=u[this._appointmentSettings.recurrenceId]==null?u.ParentId:u[this._appointmentSettings.recurrenceId],yi=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,ur)),t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("resizeStop")==-1?vt.push(this._timeZoneAppointments(yi[0],"")):vt.push(yi[0]),fi=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",at||(tt=this._dataManager.saveChanges({added:et,changed:vt,deleted:[]},fi,this.model.appointmentSettings.query._fromTable)),ot=0;ot<et.length;ot++)t.isNullOrUndefined(this.model.serverEvents)?new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(et[ot],"reverse")):new t.DataManager(this._currentAppointmentData).update("AppTaskId",et[ot]);for(ot=0;ot<vt.length;ot++)t.isNullOrUndefined(this.model.serverEvents)?new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(vt[ot],"reverse")):new t.DataManager(this._currentAppointmentData).update("AppTaskId",vt[ot]);if(at)for(this._appointmentRemove(u),this._groupEditing||this._groupEdit?(a=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,u[this._appointmentSettings.startTime].toString())),a=new t.DataManager(a).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,u.ParentId))):a=this._processed.filter(function(n){return n.Guid==u.Guid}),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:a},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:a},"Guid"),r=0,rt=a.length;r<rt;r++)this._refreshDayAppointments(a[r]);else{if(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(u),this._groupEditing||this._groupEdit)if(this._leftStartTime)if(st){var a=[],wt=this._processed.filter(function(n){return n.Guid==u.Guid}),l=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.endTime,t.FilterOperators.equal,wt[0][this._appointmentSettings.endTime].toString()));for(l=new t.DataManager(l).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,wt[0].ParentId)),s=0;s<l.length;s++)a.push(l[s]);for(wt=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.endTime,t.FilterOperators.equal,u[this._appointmentSettings.endTime].toString())),s=0;s<l.length;s++)a.push(l[s]);this._leftStartTime=!1}else a=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.endTime,t.FilterOperators.equal,u[this._appointmentSettings.endTime].toString())),a=new t.DataManager(a).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,u.ParentId)),this._leftStartTime=!1;else if(st){var a=[],wt=this._processed.filter(function(n){return n.Guid==u.Guid}),l=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,wt[0][this._appointmentSettings.startTime].toString()));for(l=new t.DataManager(l).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,wt[0].ParentId)),s=0;s<l.length;s++)a.push(l[s]);for(wt=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,u[this._appointmentSettings.startTime].toString())),s=0;s<l.length;s++)a.push(l[s])}else a=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,u[this._appointmentSettings.startTime].toString())),a=new t.DataManager(a).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,u.ParentId));else a=this._processed.filter(function(n){return n.Guid==u.Guid});for(new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:a},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:a},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:a},"Guid"),s=0;s<a.length;s++)this._appointmentRemove(a[s]);
10for(this._appointmentProcessing(u),this._currentViewAppointments=this.getCurrentViewAppointments(),l=this._groupEditing||this._groupEdit?this._currentViewAppointments.filter(function(n){return n.ParentId==u.ParentId}):this._currentViewAppointments.filter(function(n){return n.Guid==u.Guid}),r=0,rt=l.length;r<rt;r++)this._refreshDayAppointments(l[r])}this._trigger("actionComplete",{data:u,requestType:"appointmentResize"});!t.isNullOrUndefined(tt)&&n.isFunction(tt.promise)&&this.dataSource()instanceof t.DataManager&&(it=this,tt.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,f,e;if(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))it._processUrlBinding(i);else if(n.isPlainObject(r)&&!t.isNullOrUndefined(r.added)&&r.added.length>0)for(it._dateFormat(r.added),f=0,e=r.added.length;f<e;f++)u[it._appointmentSettings.id]=r.added[f][it._appointmentSettings.id],new t.DataManager(it._processed).update("Guid",u)}),tt.fail(function(){it._renderAppointmentAll()}))}else{if(at=!1,kt=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),w=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,kt[0].ParentId)),st&&(w=this._recurrenceAppSort(w)),w=this._appointmentRecurrenceSort(w),h=n.extend({},kt[0]),this._groupEditing)for(ri=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,h[this._appointmentSettings.id])),s=0;s<this._appointmentSettings.resourceFields.split(",").length;s++)h[this._appointmentSettings.resourceFields.split(",")[s].trim()]=ri[0][this._appointmentSettings.resourceFields.split(",")[s].trim()];if(this.model.enableRecurrenceValidation&&h[f.recurrence]&&(y=this._recuCollectionIndex(w,kt[0])),fr=h[f.startTime],er=h[f.endTime],h[f.startTime]=o,h[f.endTime]=e,pt=this._checkAvailability(h),ui=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("resizeStop")!=-1?{type:r.type}:r,t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("resizeStop")==-1||this._timeZoneAppointments(h,""),(this._trigger("resizeStop",{appointment:h,target:ui})||pt.length>0)&&(this._showBlockAlert&&pt.length>0&&this._alertBlockError(),h[f.startTime]=fr,h[f.endTime]=er,at=!0),et=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("resizeStop")!=-1?h:this._timeZoneAppointments(h,""),fi=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",at||(tt=this._dataManager.update(fi,et,this.model.appointmentSettings.query._fromTable)),ei=this._timeZoneAppointments(et,"reverse"),t.isNullOrUndefined(this.model.serverEvents)?new t.DataManager(this._currentAppointmentData).update("AppTaskId",ei):new t.DataManager(this._currentAppointmentData).update("AppTaskId",et),this._groupEditing&&!kt[0][this._appointmentSettings.recurrence]){for(new t.DataManager(this._currentAppointmentData).update("ParentId",ei),ut=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,h.ParentId)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ut},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ut},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ut},"Guid"),oi=0;oi<ut.length;oi++)this._appointmentRemove(ut[oi]);for(this._appointmentProcessing(h),this._currentViewAppointments=this.getCurrentViewAppointments(),l=this._groupEditing||this._groupEdit?this._processed.filter(function(n){return n.ParentId==h.ParentId}):this._processed.filter(function(n){return n.Guid==h.Guid}),r=0,rt=l.length;r<rt;r++)this._refreshDayAppointments(l[r]);this._trigger("actionComplete",{data:h,requestType:"appointmentResize"});this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(tt)&&n.isFunction(tt.promise)&&this.dataSource()instanceof t.DataManager&&(it=this,tt.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&it._processUrlBinding(i)}),tt.fail(function(){it._renderAppointmentAll()}))}if(st&&t.isNullOrUndefined(this._appointmentSettings.resourceFields)||st&&!this._groupEditing){for(ut=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,h.Guid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ut},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ut},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ut},"Guid"),s=0;s<ut.length;s++)this._appointmentRemove(ut[s]);
10for(this._appointmentProcessing(h),this._currentViewAppointments=this.getCurrentViewAppointments(),l=this._currentViewAppointments.filter(function(n){return n.ParentId==h.ParentId}),r=0,rt=l.length;r<rt;r++)this._refreshDayAppointments(l[r])}else if(this._groupEditing)for(new t.DataManager(this._currentAppointmentData).update(this._appointmentSettings.id,ei),si=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,h[this._appointmentSettings.id])),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:si},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:si},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:si},"Guid"),this._appointmentProcessing(h),this._currentViewAppointments=this.getCurrentViewAppointments(),l=this._currentViewAppointments.filter(function(n){return n.ParentId==h.ParentId}),r=0,rt=l.length;r<rt;r++)this._refreshDayAppointments(l[r]);else new t.DataManager(this._processed).update("Guid",h),new t.DataManager(this._renderedApp).remove("Guid",h),new t.DataManager(this._renderedAllDay).remove("Guid",h);for(this._currentViewAppointments=this.getCurrentViewAppointments(),l=this._groupEditing?this._currentViewAppointments.filter(function(n){return n[this._appointmentSettings.id]==h[this._appointmentSettings.id]}):this._currentViewAppointments.filter(function(n){return n.Guid==h.Guid}),r=0,rt=l.length;r<rt;r++)this._refreshDayAppointments(l[r]);this._trigger("actionComplete",{data:h,requestType:"appointmentResize"});this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(tt)&&n.isFunction(tt.promise)&&this.dataSource()instanceof t.DataManager&&(it=this,tt.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&it._processUrlBinding(i)}),tt.fail(function(){it._renderAppointmentAll()}))}else this._renderAppointmentAll()}this.element.find("div.e-tophandle,div.e-bottomhandle").removeClass("e-rowcursor");this.element.find("div.e-lefthandle,div.e-righthandle").removeClass("e-columncursor")}catch(r){}},_dragdropAppointments:function(){var r,f,i,u;if(this.model.readOnly)return!1;this._topResizing=!1;this._bottomResizing=!1;this._leftResizing=!1;this._rightResizing=!1;f=this.model.orientation=="vertical"?"div.e-draggableworkarea":"table.e-workcellstab";this.model.allowDragAndDrop&&(i=this,u=this.element.find(".e-appointment"),u.ejDraggable({handle:".e-appointment",dragOnTaphold:i._mediaQuery?!0:!1,dragArea:i.model.appointmentDragArea==""?i.element.find(f,".e-headrealldaytable tr"[!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._grouping.length+1:1]):n(i.model.appointmentDragArea),cursorAt:i.model.appointmentDragArea==""?{top:0,left:0}:{top:-40,left:-40},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n);var r=t.widgetBase.droppables[this.model.scope].helper;n.event.pageX===0&&n.event.type==="mousemove"&&(n.event.pageX=1);i.model.appointmentDragArea==""&&i._updatePosition(n,this,r)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-appointment")?n(t.sender.target):n(t.sender.target).parents(".e-appointment"),i._appointElement(r,i)}}),u=this.element.find(".e-alldayappointment"),u.ejDraggable({handle:".e-alldayappointment",dragOnTaphold:i._mediaQuery?!0:!1,dragArea:i.model.appointmentDragArea==""?i.element:n(i.model.appointmentDragArea),cursorAt:{top:17,left:0},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n);var r=t.widgetBase.droppables[this.model.scope].helper;n.event.pageX===0&&n.event.type==="mousemove"&&(n.event.pageX=1);i.model.appointmentDragArea==""&&i._updatePosition(n,this,r)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-alldayappointment")?n(t.sender.target):n(t.sender.target).parents(".e-alldayappointment"),i._appointElement(r,i)}}),u=this.element.find(".e-monthappointment"),u.ejDraggable({handle:".e-monthappointment",dragOnTaphold:i._mediaQuery?!0:!1,dragArea:i.model.appointmentDragArea==""?i.element.find(f):n(i.model.appointmentDragArea),cursorAt:i.model.appointmentDragArea==""?{top:0,left:0}:{top:-20,left:10},dragStart:function(n){i._dragStart(n)},drag:function(n){i._dragOver(n);var r=t.widgetBase.droppables[this.model.scope].helper;n.event.pageX===0&&n.event.type==="mousemove"&&(n.event.pageX=1);i.model.appointmentDragArea==""&&i._updatePosition(n,this,r)},dragStop:function(n){i._dragStop(n)},helper:function(t){return r=n(t.sender.target).hasClass("e-monthappointment")?n(t.sender.target):n(t.sender.target).parents(".e-monthappointment"),i._appointElement(r,i)}}))},_updatePosition:function(n,t,i){var r,u;this.model.orientation=="horizontal"&&this._customOrientation=="horizontal"&&(r=n.element.offsetParent().find(".e-scroller").ejScroller("instance"),r.scrollLeft()>0&&r.scrollLeft()+this.element.find(".e-draggableworkarea").width()!==this.element.find(".e-workcellstab").width()?(u=i.offsetParent().offset(),n.position.left
10=t.position.left-[u.left+t["border-left-width"]]):t._pageX-this.element.find(".e-draggableworkarea").offset().left>this.element.find(".e-draggableworkarea").width()-this.cellWidth&&(n.position.left=n.element[0].offsetLeft),r.scrollLeft()>0&&r.scrollLeft()+n.element[0].offsetLeft+n.element[0].offsetWidth>this.element.find(".e-workcellstab").width()&&(n.position.left=this.element.find(".e-draggableworkarea").width()-n.element[0].offsetWidth),t.position.top+n.element[0].offsetHeight-this.element.find(".e-draggableworkarea").offset().top>this.element.find(".e-draggableworkarea").height()&&(n.position.top=this.element.find(".e-draggableworkarea").height()-n.element[0].offsetHeight))},_appointElement:function(t,i){var r=i.model.orientation=="vertical"&&i._customOrientation=="vertical"&&t.hasClass("e-appointment")?t.closest("td").width()*.85:t.width(),u;return t.find(".e-schedulemouseclose").removeClass("e-schedulemouseclose e-icon"),t.find(".e-tophandle").removeClass("e-tophandle e-appointresizer-top e-icon e-nsexpand"),t.find(".e-bottomhandle").removeClass("e-bottomhandle e-appointresizer-bottom e-icon e-nsexpand"),t.find(".e-lefthandle").removeClass("e-lefthandle e-appointresizer-left e-icon e-ewexpand"),t.find(".e-righthandle").removeClass("e-righthandle e-appointresizer-right e-icon e-ewexpand"),t.clone().prop("id","cloneElement").appendTo(t.parent()),t.css("cursor","move"),u=this.model.orientation=="vertical"?i.element:i.element.find(".e-worktable .e-scroller"),i.model.appointmentDragArea==""?t.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose e-tophandle e-bottomhandle").css("width",r+"px").appendTo(u):t.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose e-tophandle e-bottomhandle").css("width",r+"px").appendTo(n(document.body))},_dragStart:function(i){var s,f,e,r,u,o;if(n(i.element[0]).hasClass("e-appointment")||n(i.element[0]).hasClass("e-monthappointment")||n(i.element[0]).hasClass("e-alldayappointment")){if((this._tooltipEvents("disable"),(this._mediaQuery||t.isMobile())&&this._off(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment"),s=this._curDragElmt=i.element,f=this._appointmentSettings,this._appUid=n(i.element[0]).attr("data-guid"),r=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),(this._groupEditing||this._groupEdit)&&(this._groupAppId=r[0].ParentId,this._groupRes=r[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()],this._appointmentSettings.resourceFields.split(",").length>1&&(this._groupRess=r[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2].trim()]),r[0][this._appointmentSettings.recurrence]&&(this._recStart=r[0][this._appointmentSettings.startTime])),this._dragApp=this._recurrenceAppSort(r),r[0][this._appointmentSettings.recurrence]&&!this._groupEditing&&(this._recAppGuid=this._appUid,this._recAppId=r[0].AppTaskId),r.length>1?(u=n.extend(!0,[],r),u[0][f.endTime]=u[u.length-1][f.endTime],e=u[0]):e=r[0],o={target:s,appointment:e},this._trigger("actionBegin",{data:o,requestType:"appointmentDrag"}))||this._trigger("dragStart",o))return i.cancel=!0,n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove(),this._renderAppointmentAll(),this._tooltipEvents("enable"),(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this)),!1}else i.cancel=!0;!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close"))},_dragOver:function(i){var p,o,h,d,u,e,g,tt,it,l,a,rt,r,v;if(this.element.find(".e-draggableworkarea")[0].offsetWidth>i.element[0].offsetWidth){p=n(i.element);o={target:p,interval:10,timeDelay:3e3,scrollBy:15};t.isNullOrUndefined(this.element.data("ejTooltip"))||this.element.ejTooltip("hide");this.element.find(".e-workcells").removeClass("e-selectedCell").removeClass("e-mousehover");this._trigger("drag",o);this._dragInterval=o.interval;this._scrollBy=o.scrollBy;this._timeDelay=o.timeDelay;var f=this.element.find("#"+this._id+"_scroller").ejScroller("instance"),w=this.element.find(".e-draggableworkarea").offset().top,y=this.element.find(".e-draggableworkarea").offset().left,b=Math.round(y+this.element.find(".e-draggableworkarea").width()),ut=Math.round(w+this.element.find(".e-draggableworkarea").height()),r=this,s=i.event;this.element.find(".e-draggableworkarea").height()>n(window).height()&&f._vScroll&&(i.element.offset().top<=n(window).scrollTop()?window.scrollBy(0,-this._scrollBy):Math.round(i.element.offset().top+i.element.outerHeight())>=n(window).scrollTop()+n(window).height()&&window.scrollBy(0,this._scrollBy));this.element.find(".e-draggableworkarea").width()>n(window).width()&&f._hScroll&&(i.element.offset().left<=n(window).scrollLeft()?window.scrollBy(-this._scrollBy,0):Math.round(i.element.offset().left+i.element.outerWidth())>=n(window).width()-(i.element.offset().left+i.element.outerWidth())&&window.scrollBy(this._scrollBy,0));f.isVScroll()&&(w==i.element.offset().top?this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:f.scrollTop()-this._scrollBy}):ut<=Math.round(i.element.offset().top+i.element.outerHeight())&&this.element.find("#"+this._id+"_scroller").ejScroller({scrollTop:f.scrollTop()+this._scrollBy}));function k(n){f.isHScroll()&&(n=="left"&&r.element.find("#"+r._id+"_scroller").ejScroller({scrollLeft:f.scrollLeft()-r._scrollBy}),n=="right"&&r.element.find("#"+r._id+"_scroller").ejScroller({scrollLeft:f.scrollLeft()+r._scrollBy}))}if(y+r.cellwidth>s.pageX&&y<s.pageX?t.isNullOrUndefined(this._autoScroll)&&(h=this.model.enableRTL?"right":"left",this._autoScroll=window.setInterval(k,1,h)):b-r.cellwidth<s.pageX&&b>s.pageX?t.isNullOrUndefined(this._autoScroll)&&(h=this.model.enableRTL?"left":"right",this._autoScroll=window.setInterval(k,1,h)):(clearInterval(this._autoScroll),this._autoScroll=null),this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.timeScale.enable&&this.model.showAllDayRow&&this._curDragElmt.hasClass("e-alldayappointment")){var ft=this.model.timeScale.enable?this.element.find(".e-scrolltimecells").width():0,et=ft+this.element.offset().left+1>=parseInt(this._curDragElmt.css("left")),ot=this.element.width()+this.element.offset().left<=this._curDragElmt.width()+parseInt(this._curDragElmt.css("left"))+(this.element.find("#"+this._id+"_scroller").data("ejScroller").isVScroll()?18:0),st=this._curDragElmt.find(".e-leftind").length;et?this.element.offset().left+(this.element.find(".e-leftindenttable").length>0?this.element.find(".e-leftindenttable").width():0)>=parseInt(this._curDragElmt.css("left"))&&(u=Math.floor(i.event.clientX/this.element.find(".e-alldaycells").width()),u=u<1?1:u,e=this.element.find(".e-alldaycells").width()*u-u,this._curDragElmt.css({width:e})):ot?(d=this.element.width()+this.element.offset().left,u=this._dateRender.length-Math.floor(i.event.clientX/this.element.find(".e-alldaycells").width()),u=u<1?1:u,e=this.element.find(".e-alldaycells").width()*u-u,this._curDragElmt.css({width:e,left:d-e})):st>0&&(e=Math.floor(i.event.clientX/this.element.find(".e-alldaycells").width())*this.element.find(".e-alldaycells").width(),g=this.element.offset().left+(this.model.timeScale.enable?this.element.find(".e-scrolltimecells").width():0),this._curDragElmt.css({width:e,left:g}))}if(this.currentView()!="month"&&!this._isCustomMonthView()&&(n(i.element[0]).hasClass("e-appointment")||!t.isNullOrUndefined(i.target)&&(t.isNullOrUndefined(i.target.className)?!1:i.target.className.indexOf("e-workcells")>-1))&&this._dragAppointmentCurrentTime(i),(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this._tempResource.length!=0&&this._grouping.length!=0){if(i.element.css("pointer-events","none"),this.model.group.resources.length>1){var ht=document.elementFromPoint(i.element.offset().left,i.element.offset().top),nt=n(ht).closest(".e-workcells").parent().index(),c=n(this.element.find(".e-resourceheadertable tr")[nt]).children();if(c.hasClass("e-parentnode")&&n(c.children()[0]).hasClass("e-resourceexpand")){for(n(c.children()[0]).removeClass("e-resourceexpand").addClass("e-resourcecollapse"),tt=n(c.children()[0]).attr("id").split("_")[0],it=new t.DataManager(this.res1).executeLocal((new t.Query).where(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,tt)),l=0;l<it.length;l++)a=nt+l+1,n(this.element.find(".e-resourceheadertable tr")[a]).is(":hidden")&&(n(this.element.find(".e-resourceheadertable tr")[a]).toggle(),n(this.element.find(".e-workcellstab tr")[a]).toggle());this.element.find(".e-horires").height(this.element.find(".e-draggableworkarea").height());this._horizontalRender();this.model.cellHeight&&this._reRenderScroller();this._horizontalResIcon()}}i.element.css("pointer-events","")}if(rt=this.model.enableLoadOnDemand?!(this.dataSource()instanceof t.DataManager):!0,rt){r=this;n(i.element[0]).hasClass("e-monthappointment")&&this._monthdrag(i);function ct(){var i,f,e,o;r._Prevend=Date.now();i=new Date(r._Prevstart).getSeconds()+parseInt(r._timeDelay/1e3);i>=60&&(i=i-60);var s=i==new Date(r._Prevend).getSeconds(),h=r.model.timeScale.enable?r.model.orientation=="horizontal"||r._customOrientation=="horizontal"?r.element.offset().left+1:r.element.find(".e-scrolltimecells").width()+r.element.offset().left+1:r.element.offset().left+1,u=h>=parseInt(r.element.find(".e-scheduleAppGlassy").css("left"));return(u=(r.model.orientation=="horizontal"||r._customOrientation=="horizontal")&&r.model.timeScale.enable?new Date(r._dateRender[0]).getDate()==r._dragNewStartTime.getDate()?new Date(r._dateRender[0]).getHours()==r._dragNewStartTime.getHours():!1:u,t.isNullOrUndefined(r._dragNewStartTime))?!1:((t.isNullOrUndefined(r._appointmentSettings.resourceFields)||r.model.resources[r.model.resources.length-1].allowGroupEdit!=!0)&&r._groupEdit!=!0||(r._groupAutoDrag=!0),u&&s?(r._dragWeek=!0,r.currentDate(r._nextPrevDate("navigateprevious")),r._navigateClick(null,"Previous"),t.isNullOrUndefined(r._recAppGuid)||(f=r._sortAppById(new t.DataManager(r._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,r._recAppId))),f[0].Guid=r._recAppGuid,new t.DataManager(r._processed).update("AppTaskId",f[0])),e=new Date(r._dateRender[0]),o=new Date(r._dateRender[0]),e.setHours(r._dragNewStartTime.getHours(),r._dragNewStartTime.getMinutes(),r._dragNewStartTime.getSeconds()),o.setHours(r._dragNewEndTime.getHours(),r._dragNewEndTime.getMinutes(),r._dragNewEndTime.getSeconds()),r._dragNewStartTime=new Date(e),r._dragNewEndTime=new Date(o),r._Prevstart=r._Nextstart=r._Prevend,r._Prevend=Date.now(),r.model.appointmentDragArea==""?r.model.orientation=="horizontal"||r._customOrientation=="horizontal"?r._curDragElmt.appendTo(n(".e-workcells")[0]):r._curDragElmt.appendTo(r.element):r._curDragElmt.appendTo(n(document.body))):void 0)}t.isNullOrUndefined(this._dragCountPrev)&&(this._Prevstart=Date.now(),this._dragCountPrev=window.setInterval(ct,r._timeDelay));function lt(){var i,s,u,f,e,o;r._Nextend=Date.now();i=new Date(r._Nextstart).getSeconds()+parseInt(r._timeDelay/1e3);i>=60&&(i=i-60);var h=i==new Date(r._Nextend).getSeconds(),c=n("#"+r._id+"_scroller").ejScroller("instance"),l=c.isVScroll();return((t.isNullOrUndefined(r._appointmentSettings.resourceFields)||r.model.resources[r.model.resources.length-1].allowGroupEdit!=!0)&&r._groupEdit!=!0||(r._groupAutoDrag=!0),s=l==!0?r.element.find(".e-scheduleAppGlassy").width()+parseInt(r.element.find(".e-scheduleAppGlassy").css("left"))-r.element.offset().left+25:r.element.find(".e-scheduleAppGlassy").width()+parseInt(r.element.find(".e-scheduleAppGlassy").css("left"))-r.element.offset().left+6,u=s>=parseInt(r.element.find(".e-scheduleAppGlassy").css("left")),u=(r.model.orientation=="horizontal"||r._customOrientation=="horizontal")&&r.model.timeScale.enable?new Date(r._dateRender[r._dateRender.length-1]).getDate()==r._dragNewEndTime.getDate()?u:!1:u,t.isNullOrUndefined(r._dragNewStartTime))?!1:u&&h?(r._dragWeek=!0,r.currentDate(r._nextPrevDate("navigatenext")),r._navigateClick(null,"Next"),t.isNullOrUndefined(r._recAppGuid)||(f=r._sortAppById(new t.DataManager(r._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,r._recAppId))),f[0].Guid=r._recAppGuid,new t.DataManager(r._processed).update("AppTaskId",f[0])),e=new Date(r._dateRender[r._dateRender.length-1]),o=new Date(r._dateRender[r._dateRender.length-1]),e.setHours(r._dragNewStartTime.getHours(),r._dragNewStartTime.getMinutes(),r._dragNewStartTime.getSeconds()),o.setHours(r._dragNewEndTime.getHours(),r._dragNewEndTime.getMinutes(),r._dragNewEndTime.getSeconds()),r._dragNewStartTime=new Date(e),r._dragNewEndTime=new Date(o),r._Nextstart=r._Prevstart=r._Nextend,r._Nextend=Date.now(),r.model.appointmentDragArea==""?r.model.orientation=="horizontal"||r._customOrientation=="horizontal"?r._curDragElmt.appendTo(n(".e-workcells")[0]):r._curDragElmt.appendTo(r.element):r._curDragElmt.appendTo(n(document.body))):void 0}t.isNullOrUndefined(this._dragCountNext)&&(this._Nextstart=Date.now(),this._dragCountNext=window.setInterval(lt,r._timeDelay))}}else i.element.width(this.element.find(".e-draggableworkarea").width()),v=this._processed.filter(function(n){return n.Guid==i.element.attr("data-guid")}),this._dragNewStartTime=new Date(v[0][this._appointmentSettings.startTime]),this._dragNewEndTime=new Date(v[v.length-1][this._appointmentSettings.endTime])},_monthdrag:function(i){var e=this._appointmentSettings,s=this.element.find(".e-draggableworkarea"),o=new Date(this._dragApp[0][e.startTime]),p=new Date(this._dragApp[0][e.endTime]),rt,d,b,v,ut,u,k,g,y,nt,h,ft,tt,it,r;if(this.model.orientation=="vertical"&&this._customOrientation=="vertical"){var w=n.extend(!0,{},this._dragApp),e=this._appointmentSettings,s=this.element.find(".e-draggableworkarea"),et=Math.ceil((w[e.endTime]-w[e.startTime])/36e5)<24&&w[e.endTime].getDay()!=w[e.startTime].getDay()?!0:!1;this._dragApp[0][e.recurrence]&&this._dragApp[0][e.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(o=this._dragApp[0][e.startTime],p=this._dragApp[this._dragApp.length-1][e.endTime]);u=new Date(new Date(this.model.currentDate).getFullYear(),new Date(this.model.currentDate).getMonth(),1);rt=u.getDay();u.setDate(u.getDate()-rt);this.currentView()!="month"&&(this.currentView()!="customview"||this._oneWeek)?(d=t.isNullOrUndefined(this.model.group)?this._dateRender.length:this._dateRender.length*this.res1.length,h=parseInt((n(i.element[0]).offset().left-s.offset().left)/Math.round(s.width()/d))):(h=Math.round((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-monthcells").eq(1).outerWidth()),h=this.model.enableRTL?6-h:h);et&&parseInt(i.element.attr("id").split("_")[1])==this._dragApp[this._dragApp.length-1].AppTaskId&&(h-=1);b=parseInt((n(i.element[0]).offset().top+s.scrollTop()-s.offset().top)/this.element.find(".e-monthcells").outerHeight());this.model.showOverflowButton||(b=this._findRowIndex(i));v=this.currentView()=="month"||this._isCustomMonthView()&&!this._oneWeek?this.model.showWeekend?7:this.model.workWeek.length:this._dateRender.length;ut=this.model.enableRTL?b*v+(h-Math.floor(h/v)*v)-(p.getDay()-o.getDay()):b*v+(h-Math.floor(h/v)*v);u=new Date(new Date(this._dateRender[ut]).setHours(o.getHours(),o.getMinutes(),o.getSeconds()))}else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&(u=cellstrtime=this._dragNewStartTime,k=cellendtime=this._dragNewEndTime,this.element.find(".e-appointment,.e-monthappointment").css({"pointer-events":"none"}),g=this.model.enableRTL?document.elementFromPoint(n(i.element[0]).offset().left,n(i.element[0]).offset().top-1).cellIndex-Math.round(n(i.element[0]).width()/30-1):Math.floor((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-workcells").eq(1).outerWidth(
10)),this.element.find(".e-appointment,.e-monthappointment").css({"pointer-events":"visible"}),y=parseInt((n(i.element[0]).offset().top+s.scrollTop()-s.offset().top)/this.element.find(".e-workcells")[0].offsetHeight),this.model.showOverflowButton?this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(y+=n(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return n(this).css("display")!=="none"})[y]).prevUntil("table.e-resourceheadertable").filter(function(){return n(this).css("display")=="none"}).length):y=this._findRowIndex(i),nt=n(this.element.find(".e-workcellstab tr")[y]).find("td")[g],h=y,n(nt).hasClass("e-resourceheadercells")||t.isNullOrUndefined(nt)||(this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.floor(n(i.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.floor((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-workcells").width()),n(i.element[0]).hasClass("e-monthappointment")&&(this._dragApp[0][e.recurrence]&&this._dragApp[0][e.recurrenceRule].toString().indexOf("RECUREDITID")==-1?(o=this._dragApp[0][e.startTime],p=this._dragApp[0][e.endTime]):this._dragApp[0][e.recurrence]&&this._dragApp[0][e.recurrenceRule].toString().indexOf("RECUREDITID")>0&&(o=this._dragApp[0][e.startTime],p=this._dragApp[0][e.endTime]),u=new Date(this.monthDays[g]),this.currentView()!="month"&&(this._cellIndex>0?(Math.floor(i.element[0].offsetWidth/this.CellWidth)+this._cellIndex==this._dateRender.length&&u.setHours(o.getHours()+24,o.getMinutes(),o.getSeconds()),u.setHours(o.getHours(),o.getMinutes(),o.getSeconds())):(u=new Date(this.monthDays[this._cellIndex]),u.setHours(o.getHours(),o.getMinutes(),o.getSeconds())),u.setHours(o.getHours(),o.getMinutes(),o.getSeconds())))));if(Math.ceil((this._dragApp[0][e.endTime]-this._dragApp[0][e.startTime])/36e5)>24?(ft=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(i.element.attr("id").split("_")[1]))),tt=new Date(ft[0][e.startTime])-new Date(this._dragApp[0][e.startTime]),cellstrtime=new Date(u-tt),u&&(it=u.getTime()-new Date(o).getTime()-new Date(tt).getTime())):(cellstrtime=new Date(u),it=u.getTime()-new Date(o).getTime()),k=new Date(new Date(p).getTime()+it),cellendtime=new Date(k),cellendtime.getHours()==this.model.endHour&&cellendtime.getMinutes()>0||cellendtime.getHours()>this.model.endHour||cellendtime.getHours()==this.model.startHour&&cellendtime.getMinutes()<0||cellendtime.getHours()<this.model.startHour){var a=new Date(cellendtime),f=this._dateRender.indexOf(new Date(a).setHours(0,0,0)),c=(this.model.endHour-this.model.startHour)*60;cellendtime.getHours()>=this.model.endHour||a.getDate()!=cellendtime.getDate()?(r=(a.getHours()-this.model.endHour)*60,r=a.getMinutes()===0?r:a.getMinutes()+r,r=r<0?0:r,r>c&&(r=r%c),f=f+Math.floor(r/c),f>=this._dateRender.length?(f=this._dateRender.length-1,cellendtime.setDate(new Date(this._dateRender[f]).getDate()),cellendtime.setHours(this.model.endHour,0,0)):(cellendtime.setDate(new Date(this._dateRender[f]).getDate()),cellendtime.setHours(this.model.startHour,0,0),cellendtime.setMinutes(r))):(cellendtime.getHours()<this.model.startHour||a.getDate()!=cellendtime.getDate())&&
10(this._resizeflag=!0,r=(this.model.startHour-a.getHours())*60,r=a.getMinutes()===0?r:r-a.getMinutes(),r>c&&(r=r%c),f=f-Math.ceil(r/c),f=f<0?0:f,cellendtime.setDate(new Date(this._dateRender[f]).getDate()),cellendtime.setHours(this.model.endHour,0,0),cellendtime.setMinutes(-r))}if(cellstrtime.getHours()<this.model.startHour){var l=new Date(u),a=new Date(k),f=this._dateRender.indexOf(new Date(l).setHours(0,0,0)),c=(this.model.endHour-this.model.startHour)*60;u.setDate(l.getDate());u.getHours()<this.model.startHour||l.getDate()!=u.getDate()?(r=(this.model.startHour-l.getHours())*60,r=l.getMinutes()===0?r:r-l.getMinutes(),r=r<0?0:r,r>c&&(r=r%c),f=f-Math.ceil(r/c),f<0?(f=0,u.setDate(new Date(this._dateRender[f]).getDate()),u.setHours(this.model.startHour,0,0)):(u.setDate(new Date(this._dateRender[f]).getDate()),u.setHours(this.model.endHour,0,0),u.setMinutes(-r))):(u.getHours()>=this.model.endHour||l.getDate()!=u.getDate())&&(this._resizeflag=!0,r=(this.model.endHour-l.getHours())*60,r=l.getMinutes()===0?r:r-l.getMinutes(),r>c&&(r=r%c),f=f+Math.ceil(r/c),f=f>=this._dateRender.length?this._dateRender.length-1:f,u.setDate(new Date(this._dateRender[f]).getDate()),u.setHours(this.model.startHour,0,0),u.setMinutes(r))}return this._dragNewStartTime=cellstrtime,this._dragNewEndTime=cellendtime,this.model.orientation==t.Schedule.Orientation.Vertical&&this._customOrientation=="vertical"&&(h=this.currentView()!="month"&&(this.currentView()!="customview"||this._oneWeek)?parseInt((n(i.element[0]).offset().left-s.offset().left)/Math.round(s.width()/d)):Math.round((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-monthcells").eq(1).outerWidth())),h},_dragStop:function(i){var b,d,e,kt,rt,dt,gt,iu,h,p,l,g,ct,pi,wi,bi,sr,hr,ni,ut,cr,lr,c,fi,di,ki,ar,vr,y,ft,yr,f,ei,gi,yt,pt,nr,ot,tr,oi,nt,ir,v,tt,u,pr,si,ti,ur,hi,s,br,vt,kr,dr,ht,o,it,gr,nu,ai,wt,a,at,bt,lt,er,vi,ci,tu,st,or,yi,et;clearInterval(this._dragCountPrev);clearInterval(this._dragCountNext);clearInterval(this._autoScroll);this.currentView()!="month"&&!this._isCustomMonthView()&&(n(i.element[0]).hasClass("e-appointment")||!t.isNullOrUndefined(i.target)&&(t.isNullOrUndefined(i.target.className)?!1:i.target.className.indexOf("e-workcells")>-1))&&this._dragAppointmentCurrentTime(i);this._dragCountPrev=this._dragCountNext=this._autoScroll=null;this._dragWeek=!1;(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",n.proxy(this._appointmentWindow,this));this._tooltipEvents("enable");!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close");var w=this,r=this._appointmentSettings,ii=this.element.find(".e-draggableworkarea");if(this._appUid=i.element.attr("data-guid"),this._groupAutoDrag){if(b=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,this._groupAppId))),b[0].Recurrence)for(d=0;d<b.length;d++)b[d][this._appointmentSettings.startTime].toString()==this._recStart.toString()&&(this._appUid=b[d].Guid,b[0]=b[d]);else for(d=0;d<b.length;d++)b[d][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()]==this._groupRes&&(this._appUid=b[d].Guid,b[0]=b[d]);e=[];e.push(b[0])}else e=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)));if(kt=n.extend(!0,{},e[0]),this.tempResApp=e[0],e.length>1&&!e[0][r.recurrence]?(rt=!0,o=this._groupEditing||this._groupEdit?new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,e[0].ParentId)):new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0]):(rt=e.length>1?!0:!1,dt=n.extend(!0,[],e),dt[0][r.endTime]=dt[dt.length-1][r.endTime],o=e[0][r.recurrence]&&e[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):e[0][r.recurrence]?e.length>1?dt[0]:e[0]:this._getAppointmentByParentId(this._appUid)),(t.isNullOrUndefined(this._dragNewStartTime)||t.isNullOrUndefined(this._dragNewEndTime)||(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this.currentView()=="month"||this._isCustomMonthView())&&e.length!=0&&w._dragWeek)&&(this._dragNewStartTime=new Date(e[0][this._appointmentSettings.startTime]),this._dragNewEndTime=new Date(e[e.length-1][this._appointmentSettings.endTime])),gt=n.extend(!0,{},o),iu=Math.ceil((gt[r.endTime]-gt[r.startTime])/36e5)<24&>[r.endTime].getDay()!=gt[r.startTime].getDay()?!0:!1,this.model.orientation=="vertical"&&this._customOrientation=="vertical")if(n(i.element[0]).hasClass("e-appointment"))h=l=this._dragNewStartTime,p=g=this._dragNewEndTime,((t.isNullOrUndefined(i.target.className)?!1:i.target.className.indexOf("e-alldaycells")>-1)||Math.ceil((this._dragNewEndTime.getTime()-this._dragNewStartTime.getTime())/36e5)>=24)&&(ct=!0,l=new Date(l.setHours(0,0,0,0)),g=new Date(g.setHours(23,59,59,59))),c=Math.round((n(i.element[0]).offset().left+ii.scrollLeft()-ii.offset().left)/this.element.find(".e-workcells").eq(1).outerWidth());else if(n(i.element[0]).hasClass("e-alldayappointment"))if(!t.isNullOrUndefined(i.target)&&(t.isNullOrUndefined(i.target.className)?!1:i.target.className.indexOf("e-workcells")>-1))c=i.target.cellIndex,l=this._dragNewStartTime,g=this._dragNewEndTime,ct=!1,this._allDayDrag=!0;else{h=new Date(o[r.startTime]);p=new Date(o[r.endTime]);e[0][r.recurrence]&&e[0][r.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(h=new Date(e[0][r.startTime]),p=new Date(e[0][r.endTime]));var c=Math.round((n(i.element[0]).offset().left+ii.scrollLeft()-ii.offset().left)/this.element.find(".e-workcells").eq(1).outerWidth()),ou=Math.round(n(i.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),su=Math.ceil((p-h)/864e5),hu=Math.round(n(i.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),ri=this.currentView()==="week"?7:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._renderDays:1,ru=new Date(h),uu=this._dateRender.indexOf(new Date(ru).setHours(0,0,0)),ui=!0;uu==-1?(pi=Math.ceil(this.element.find("#cloneElement").width()/this.element.find(".e-alldaycells").width())-Math.ceil(i.element.width()/this.element.find(".e-alldaycells").width()),h.setDate(h.getDate()-pi),p.setDate(p.getDate()-pi),ui=!1,l=new Date(h)):(h=new Date(this._dateRender[c]),p=new Date(this._dateRender[c]),p.setHours(o[r.endTime].getHours(),o[r.endTime].getMinutes(),o[r.endTime].getSeconds()),wi=Math.ceil(this.element.find("#cloneElement").width()/this.element.find(".e-alldaycells").width()),bi=Math.ceil(i.element.width()/this.element.find(".e-alldaycells").width()),wi!=bi&&(sr=this.element.offset().left+(this.element.find(".e-leftindenttable").length>0?this.element.find(".e-leftindenttable").width():0)>=parseInt(i.element.css("left")),hr=sr?wi-bi:0,h.setDate(h.getDate()-hr),ui=!1,l=new Date(h)));c<0&&ui?h<=new Date(this._dateRender[0])?(l=new Date(h),l.setDate(l.getDate()+c),l.setHours(new Date(o[r.startTime]).getHours(),new Date(o[r.startTime]).getMinutes()),l=new Date(l)):(ni=new Date(this._dateRender[0]),ni.setDate(ni.getDate()+c),ni.setHours(new Date(o[r.startTime]).getHours(),new Date(o[r.startTime]).getMinutes()),l=new Date(ni)):ui&&
10(h<new Date(this._dateRender[0])?(ut=c>ri-1?c%ri:c,ut=this.model.enableRTL?this._dateRender.length-1-ut:ut,this._resWorkWeek||this._resCustomView?h=new Date(new Date(this._dateRender[c])):h.setDate(new Date(o[w._appointmentSettings.startTime]).getDate()+ut),h.setHours(new Date(o[r.startTime]).getHours(),new Date(o[r.startTime]).getMinutes()),l=new Date(h)):(ut=c>ri-1?c%ri:c,ut=this.model.enableRTL?this._dateRender.length-1-ut:ut,l=this._resWorkWeek||this._resCustomView?new Date(new Date(this._dateRender[c])):new Date(new Date(this._dateRender[ut])),l.setHours(new Date(o[r.startTime]).getHours(),new Date(o[r.startTime]).getMinutes())));cr=new Date(l);lr=new Date(o[r.endTime]).getTime()-new Date(o[r.startTime]).getTime();g=new Date(new Date(cr).setMilliseconds(lr))}else n(i.element[0]).hasClass("e-monthappointment")&&(c=this._monthdrag(i),h=l=this._dragNewStartTime,p=g=this._dragNewEndTime);else(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&(c=this._monthdrag(i),h=l=this._dragNewStartTime,p=g=this._dragNewEndTime);if(this.model.orientation==t.Schedule.Orientation.Horizontal&&e[0][r.allDay]&&this.res1.length>1&&this.model.timeScale.enable&&!(this.currentView()==t.Schedule.CurrentView.Month||this._isCustomMonthView())&&(l=new Date(e[0][r.startTime]),g=new Date(e[0][r.endTime])),ki=!0,fi=this.element.find(".e-resourceheadertable .e-horizontresheaderdiv").eq(c).children().hasClass("e-parentnode"),fi=fi&&c>0?!0:!1,this._grouping.length>0&&(ft=n.extend(!0,{},e[0]),ft=c>=0?this._getDragDropResourceData(this,c,ft):ft,di=this._appointmentSettings.resourceFields.split(","),ki=ft[this._appointmentSettings.resourceFields.split(",")[di.length-1]]==e[0][this._appointmentSettings.resourceFields.split(",")[di.length-1]]),ki&&!t.isNullOrUndefined(h)&&new Date(h).getTime()==new Date(this._dragApp[0][r.startTime]).getTime()&&new Date(p).getTime()==new Date(this._dragApp[this._dragApp.length-1][r.endTime]).getTime()||fi){if(this.element.find("#cloneElement").length>0){var k=this._curDragElmt.clone(),fu=this._timeMode=="12"?t.format(e[0][r.startTime],this._pattern.t,this.model.locale):t.format(e[0][r.startTime],"HH:mm",this.model.locale),eu=this._timeMode=="12"?t.format(e[0][r.endTime],this._pattern.t,this.model.locale):t.format(e[0][r.endTime],"HH:mm",this.model.locale);k.find(".e-apptime").remove();k.find(".e-appointinnertext").append(n("<div class='e-apptime'>"+fu+" - "+eu+"<\/div>"));this.model.enableRTL?k.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.model.orientation=="vertical"&&this._customOrientation=="vertical"||!this.model.timeScale.enable?this.element.find("#cloneElement").outerWidth():this.element.find("#cloneElement").width(),height:this.model.orientation=="vertical"&&this._customOrientation=="vertical"||!this.model.timeScale.enable?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),top:this.element.find("#cloneElement").css("top"),right:this.element.find("#cloneElement").css("right"),cursor:""}):k.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.model.orientation=="vertical"&&this._customOrientation=="vertical"||!this.model.timeScale.enable?this.element.find("#cloneElement").outerWidth():this.element.find("#cloneElement").width(),height:this.model.orientation=="vertical"&&this._customOrientation=="vertical"||!this.model.timeScale.enable?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),top:this.element.find("#cloneElement").css("top"),left:this.element.find("#cloneElement").css("left"),cursor:""});!this.model.timeScale.enable||this.model.orientation!="vertical"||this._customOrientation!="vertical"||this.currentView()=="month"||this._isCustomMonthView()||k.hasClass("e-alldayappointment")?(k.children().eq(0).addClass("e-lefthandle e-appointresizer-left e-icon"),k.children().eq(1).addClass("e-righthandle e-appointresizer-right e-icon")):(k.children().eq(0).addClass("e-tophandle e-appointresizer-top e-icon"),k.children().eq(1).addClass("e-bottomhandle e-appointresizer-bottom e-icon"));k.children().eq(2).addClass("e-schedulemouseclose e-icon").removeAttr("style");(this.currentView()=="month"||this.model.orientation=="vertical")&&(k[0].style.height=this.model.orientation=="vertical"?this.element.find("#cloneElement")[0].style.height:this.element.find("#cloneElement")[0].offsetHeight+"px",k[0].style.width=this.model.orientation=="vertical"?this.element.find("#cloneElement")[0].style.width:this.element.find("#cloneElement")[0].offsetWidth+"px");this.element.find("#cloneElement").parent().append(k);this._bindAppointmentAction()}return this.element.find("#cloneElement").remove(),et=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,this._trigger("dragStop",{appointment:e[0],event:et,draggedAppointment:kt}),n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove(),!1}if(ar=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),vr=!this.model.showNextPrevMonth&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.currentView()=="month"?new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()!=new Date(l.getFullYear(),l.getMonth(),1).getTime():!1,!vr&&g>=new Date(this.model.minDate)&&g<=ar)if(this._refreshCellsHeight(),o[r.recurrence]==1&&o[r.recurrenceRule].indexOf("RECUREDITID")==-1){for(y=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),y.length>1&&(ft=n.extend(!0,[],y),ft[0][r.endTime]=ft[ft.length-1][r.endTime]),y=y.length>1?ft[0]:y[0],pt=y[r.recurrenceId]==null?y.ParentId:y[r.recurrenceId],yr=y[r.recurrenceId]==null?"ParentId":r.recurrenceId,s=this._groupEditing||this._groupEdit?new t.DataManager(this._processed).executeLocal((new t.Query).where("commonGuid",t.FilterOperators.equal,y.commonGuid)):new t.DataManager(this._processed).executeLocal((new t.Query).where(yr,t.FilterOperators.equal,pt)),rt&&(s=this._recurrenceAppSort(s)),s=this._appointmentRecurrenceSort(s),f=n.extend({},y),tt=!1,this._groupEditing&&(ei=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,f[this._appointmentSettings.id])),f[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()]=ei[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()],this._appointmentSettings.resourceFields.split(",").length>1&&(f[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2].trim()]=ei[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2].trim()])),rt&&(f=n.extend({},s.filter(function(n){return n.Guid==e[0].Guid})[0]),this._groupEditing&&(f[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()]=f[this._id+"_ownerfield_"+[this._appointmentSettings.resourceFields.split(",").length-1]],this._appointmentSettings.resourceFields.split(",").length>1&&(f[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2].trim()]=ei[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2].trim()]))),this.model.enableRecurrenceValidation&&f[r.recurrence]&&(v=this._recuCollectionIndex(s,y)),!this.model.enableRecurrenceValidation||!f[r.recurrence]||(v==0?t.isNullOrUndefined(s[v+1])?!0:new Date(new Date(s[v+1][r.startTime]).setHours(0,0,0,0)).getTime()>
10new Date(new Date(p).setHours(0,0,0,0)).getTime():v==s.length-1?new Date(new Date(s[v-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(h).setHours(0,0,0,0)).getTime():new Date(new Date(s[v-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(h).setHours(0,0,0,0)).getTime()&&new Date(new Date(s[v+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(p).setHours(0,0,0,0)).getTime())?(vt=n.extend(!0,[],y),f[r.startTime]=l,f[r.endTime]=g,!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&t.scheduleFeatures.resources&&(f=c>0?this._getDragDropResourceData(this,c,f):f),this._reverse&&(tt=!0,this._reverse=!1),t.isNullOrUndefined(ct)||(f[r.allDay]=ct),ht=this._checkAvailability(f),et=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("dragStop")==-1||this._timeZoneAppointments(f,""),this._trigger("dragStop",{appointment:f,event:et,draggedAppointment:kt})||ht.length>0?(this._showBlockAlert&&ht.length>0&&this._alertBlockError(),f=n.extend(!0,[],vt),tt=!0):(this._processed=this._sortAppById(this._processed),gi=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,this._appMainId=gi,pt=o[r.recurrenceId]==null?o.ParentId:o[r.recurrenceId],this._deleteOcurrence(pt,this.tempResApp[r.startTime]),f[r.recurrenceRule]=o[r.recurrenceRule]+";RECUREDITID="+f.ParentId,f[r.recurrenceExDate]=o[r.recurrenceExDate],f[r.id]=f.AppTaskId=gi)):(f[r.startTime]=y[r.startTime],f[r.endTime]=y[r.endTime],this._alertDragResizeError(),tt=!0),it=[],yt=[],t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("dragStop")==-1?it.push(this._timeZoneAppointments(f,"")):it.push(f),pt=f[r.recurrenceId]==null?o.ParentId:f[r.recurrenceId],nr=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,pt)),t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("dragStop")==-1?yt.push(this._timeZoneAppointments(nr[0],"")):yt.push(nr[0]),wt=this.dataSource()instanceof t.DataManager?r.id:"AppTaskId",tt||(a=this._dataManager.saveChanges({added:it,changed:yt,deleted:[]},wt,this.model.appointmentSettings.query._fromTable)),ot=0;ot<it.length;ot++)t.isNullOrUndefined(this.model.serverEvents)?new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(it[ot],"reverse")):new t.DataManager(this._currentAppointmentData).update("AppTaskId",it[ot]);for(ot=0;ot<yt.length;ot++)t.isNullOrUndefined(this.model.serverEvents)?new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(yt[ot],"reverse")):new t.DataManager(this._currentAppointmentData).update("AppTaskId",yt[ot]);if(tt)for(this._appointmentRemove(f),nt=this._processed.filter(function(n){return n.Guid==f.Guid}),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:nt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:nt},"Guid"),ir=this._processed.filter(function(n){return n.Guid==f.Guid}),at=0;at<ir.length;at++)this._refreshDayAppointments(ir[at]);else{for(this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(f),this._groupEditing||this._groupEdit?(nt=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,this.tempResApp[this._appointmentSettings.startTime].toString())),nt=new t.DataManager(nt).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,this.tempResApp.ParentId))):nt=this._processed.filter(function(n){return n.Guid==f.Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:nt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:nt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:nt},"Guid"),lt=0;lt<nt.length;lt++)this._appointmentRemove(nt[lt]);for(this._appointmentProcessing(f),tr=this._groupEditing||this._groupEdit?this._processed.filter(function(n){return n.ParentId==f.ParentId}):this._processed.filter(function(n){return n.Guid==f.Guid}),oi=0;oi<tr.length;oi++)this._refreshDayAppointments(tr[oi]);this._groupEditing||this._refreshDayAppointments(vt)}this._trigger("actionComplete",{appointment:f,requestType:"appointmentDrag"});this._groupAutoDrag&&(this._groupAutoDrag=!1);!t.isNullOrUndefined(a)&&n.isFunction(a.promise)&&this.dataSource()instanceof t.DataManager&&(a.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record,u,e;if(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))w._processUrlBinding(i);else if(n.isPlainObject(r)&&!t.isNullOrUndefined(r.added)&&r.added.length>0)for(w._dateFormat(r.added),u=0,e=r.added.length;u<e;u++)f[w._appointmentSettings.id]=r.added[u][w._appointmentSettings.id],new t.DataManager(w._processed).update("Guid",f)}),a.fail(function(){w._renderAppointmentAll()}))}else{if(tt=!1,pr=rt?this._currentAppointmentData:this._processed,u=this._groupEditing?rt&&!t.isNullOrUndefined(o[0])?new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,o[0].ParentId)):new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,o.ParentId)):new t.DataManager(pr).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,e[0].Guid)),u.length>1&&u[0][this._appointmentSettings.recurrence]){si=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,o.Guid));s=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,si[0][this._appointmentSettings.id]));rt&&(s=this._recurrenceAppSort(s));var s=this._appointmentRecurrenceSort(s),rr=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,si[0][this._appointmentSettings.id])),wr=n.extend({},rr[0]);for(this.model.enableRecurrenceValidation&&wr[r.recurrence]&&(v=this._recuCollectionIndex(s,si[0])),u[0]=wr,new t.DataManager(this._currentAppointmentData).remove(this._appointmentSettings.id,rr[0][this._appointmentSettings.id]),ti=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,rr[0][this._appointmentSettings.id])),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:ti},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:ti},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:ti}
10,"Guid"),ur=this.getCurrentViewAppointments(ti),hi=0,ci=ur.length;hi<ci;hi++)this._appointmentRemove(ur[hi])}else s=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,u[0].ParentId)),rt&&(s=this._recurrenceAppSort(s)),s=this._appointmentRecurrenceSort(s),this._groupEditing&&(br=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,u[0].AppTaskId)),u[0]=br[0]),vt=n.extend({},u[0]),this.model.enableRecurrenceValidation&&(v=this._recuCollectionIndex(s,u[0]));if(kr=u[0][r.startTime],dr=u[0][r.endTime],u[0][r.startTime]=l,u[0][r.endTime]=g,this._groupEditing?(u[0]=c>0?this._getDragDropResourceData(this,c,u[0]):u[0],t.isNullOrUndefined(ct)||(u[0][r.allDay]=ct),ht=this._checkAvailability(u[0]),et=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("dragStop")==-1||this._timeZoneAppointments(u[0],""),(this._trigger("dragStop",{appointment:u[0],event:et,draggedAppointment:kt})||ht.length>0)&&(this._showBlockAlert&&ht.length>0&&this._alertBlockError(),u[0]=n.extend(!0,{},vt),tt=!0)):!this.model.enableRecurrenceValidation||!u[0][r.recurrence]||(v==0?t.isNullOrUndefined(s[v+1])?!0:new Date(new Date(s[v+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(p).setHours(0,0,0,0)).getTime():v==s.length-1?new Date(new Date(s[v-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(h).setHours(0,0,0,0)).getTime():new Date(new Date(s[v-1][r.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(h).setHours(0,0,0,0)).getTime()&&new Date(new Date(s[v+1][r.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(p).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&&(u[0]=c>=0?this._getDragDropResourceData(this,c,u[0]):u[0]),t.isNullOrUndefined(ct)||(u[0][r.allDay]=ct),ht=this._checkAvailability(u[0]),et=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("dragStop")==-1||this._timeZoneAppointments(u[0],""),(this._trigger("dragStop",{appointment:u[0],event:et,draggedAppointment:kt})||ht.length>0)&&(this._showBlockAlert&&ht.length>0&&this._alertBlockError(),u[0]=n.extend(!0,{},vt),tt=!0)):(u[0][r.startTime]=kr,u[0][r.endTime]=dr,this._alertDragResizeError(),tt=!0),this.model.appointmentDragArea!=""&&(o=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),o.length==0))return!1;if(it=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?u[0]:this._timeZoneAppointments(u[0],""),wt=this.dataSource()instanceof t.DataManager?r.id:"AppTaskId",tt||(a=this._dataManager.update(wt,it,this.model.appointmentSettings.query._fromTable)),gr=t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("dragStop")==-1?this._timeZoneAppointments(it,"reverse"):it,nu=rt?"Guid":"AppTaskId",new t.DataManager(this._currentAppointmentData).update(nu,gr),this._groupEditing){if(u[0][this._appointmentSettings.recurrence]&&u.length>1){var fr=[],i=[],li=[];for(fr.push(u[0]),i.push(u[0]),ai=0;ai<fr.length;ai++)li.push(this._timeZoneAppointments(fr[ai],""));for(wt=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",a=this._dataManager.saveChanges({added:[],changed:li,deleted:[]},wt,this.model.appointmentSettings.query._fromTable),at=0;at<li.length;at++)new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(li[at],"reverse"));for(bt=0;bt<i.length;bt++)this._currentAppointmentData.push(i[bt]),this._appointmentProcessing(i[bt]),this._appointmentRemove(i[bt]),this._currentViewAppointments=this.getCurrentViewAppointments();this._trigger("actionComplete",{appointment:u[0],requestType:"appointmentDrag"});this._groupAutoDrag&&(this._groupAutoDrag=!1);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(a)&&a&&n.isFunction(a.promise)&&this.dataSource()instanceof t.DataManager&&(a.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&w._processUrlBinding(i)}),a.fail(function(){w._renderAppointmentAll()}))}else{for(st=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,u[0].ParentId)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:st},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:st},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:st},"Guid"),lt=0;lt<st.length;lt++)this._appointmentRemove(st[lt]);this._appointmentProcessing(u[0])}
10for(this._currentViewAppointments=this.getCurrentViewAppointments(),er=this._groupEditing||this._groupEdit?this._currentViewAppointments.filter(function(n){return n.ParentId==u[0].ParentId}):this._processed.filter(function(n){return n.Guid==u[0].Guid}),vi=0,ci=er.length;vi<ci;vi++)this._refreshDayAppointments(er[vi]);this._trigger("actionComplete",{appointment:u[0],requestType:"appointmentDrag"});this._groupAutoDrag&&(this._groupAutoDrag=!1);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(a)&&a&&n.isFunction(a.promise)&&this.dataSource()instanceof t.DataManager&&(a.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&w._processUrlBinding(i)}),a.fail(function(){w._renderAppointmentAll()}))}else{for(tu=new Date(new Date(u[0][r.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(u[0][r.endTime]).setHours(0,0,0,0)).getTime(),tu||rt?(st=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,u[0].Guid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:st},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:st},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:st},"Guid"),this._appointmentProcessing(u[0])):(new t.DataManager(this._processed).update("AppTaskId",u[0]),new t.DataManager(this._renderedApp).remove("AppTaskId",u[0]),new t.DataManager(this._renderedAllDay).remove("AppTaskId",u[0])),this._appointmentRemove(u[0]),or=this._processed.filter(function(n){return n.Guid==u[0].Guid}),yi=0;yi<or.length;yi++)this._refreshDayAppointments(or[yi]);this._groupEditing||this._refreshDayAppointments(vt);this._trigger("actionComplete",{appointment:u[0],requestType:"appointmentDrag"});this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;!t.isNullOrUndefined(a)&&a&&n.isFunction(a.promise)&&this.dataSource()instanceof t.DataManager&&(a.done(function(i){var r=t.isNullOrUndefined(i.record)?i:i.record;(n.isArray(r)||n.isPlainObject(r)&&t.isNullOrUndefined(r.added))&&w._processUrlBinding(i)}),a.fail(function(){w._renderAppointmentAll()}))}}else this._renderAppointmentAll(),et=!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("dragStop")!=-1?{type:i.type}:i,this._trigger("dragStop",{appointment:e[0],event:et});n(document.body).find(".e-scheduleAppGlassy").length>0&&n(document.body).find(".e-scheduleAppGlassy").remove();this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove();this.model.showAppointmentNavigator&&this.model.timeScale.enable&&this._nextPrevButton()},_findRowIndex:function(t){var i=n(t.element[0]).offset(),r,u;return this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","none"),r=n(document.elementFromPoint(Math.round(i.left-n(document).scrollLeft()),Math.round(i.top-n(document).scrollTop()+2))),u=n(r).closest("td").parent().index(),this.element.find(".e-appointment,.e-monthappointment").css("pointer-events","visible"),u},_alertDragResizeError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("RecurrenceAlert"));this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("DragResizeError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_processUrlBinding:function(i){if(this.model.enableLoadOnDemand||this.dataSource()instanceof t.DataManager&&this.dataSource().adaptor instanceof t.ODataAdaptor)this._initDataSource("refresh");else{var r=t.isNullOrUndefined(i.record)?i:i.record;this._currentAppointmentData.length=0;this._dateFormat(r);this._bindAppointments=!0;
10this._currentAppointmentData=n.merge(this._currentAppointmentData,r);this._dataProcessing(r);this._renderAppointmentAll()}},_refreshCellsHeight:function(){if(this.currentView()=="agenda")return!1;this.model.orientation!="horizontal"&&this._customOrientation!="horizontal"||this.model.showOverflowButton||(this._horizontalRender(),this._reRenderScroller());this.model.orientation!="vertical"||this._customOrientation!="vertical"||this.model.showOverflowButton||this.currentView()!="month"||(this._monthCellsRender(),this._reRenderScroller())},_dragAppointmentCurrentTime:function(i){var a,k,o,ct,d,b,vt,tt,yt,pt,kt,l,y,it,c,w,p,rt,et,r,dt,gt,e,ni,ft,ti,st,ii,ri,ut,fi;if(this.model.timeScale.enable){if(this._groupAutoDrag)if(o=[],a=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,this._groupAppId))),a[0].Recurrence){for(k=0;k<a.length;k++)a[k][this._appointmentSettings.startTime].toString()==this._recStart.toString()&&(this._appUid=a[k].Guid,a[0]=a[k]);o.push(a[0])}else o.push(a[0]);else o=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.element.attr("data-guid"))));var s=this.element.find(".e-draggableworkarea"),ht=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),u=this,v=u._appointmentSettings,f;if(o[0][v.recurrence]?(d=n.extend(!0,[],o),d[0][v.endTime]=d[d.length-1][v.endTime],f=o[0][v.recurrence]&&o[0][v.recurrenceRule].toString().indexOf("RECUREDITID")==1?this._getAppointmentByParentId(this._appUid):o[0][v.recurrence]?d[0]:this._getAppointmentByParentId(this._appUid)):this._groupEditing?(ct=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,o[0].ParentId)),f=ct[0]):f=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&(n(i.element[0]).hasClass("e-appointment")||(t.isNullOrUndefined(i.target.className)?!1:i.target.className.indexOf("e-workcells")>-1))){var lt=s.height()+s.scrollTop(),ei=i.element[0].offsetHeight,g=this.element.find(".e-workcells")[0].offsetHeight,at=n(i.element[0]).offset().top-s.offset().top+s.scrollTop(),nt=at-g/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))<lt?at:lt-ei,r,h,c,w;if(n(i.element[0]).hasClass("e-alldayappointment"))y=i.target.cellIndex,r=new Date(this.dateRender[y]),b=nt>0?nt*60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*g):60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*g),r.setHours(parseInt(this.model.startHour)+Math.round(b/60)),r.setMinutes(parseInt(b%60)),r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r),r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval),c=new Date(r),h=new Date(r).setMinutes(r.getMinutes()+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),w=new Date(h);else if((nt>0||!this.model.showAllDayRow)&&!t.isNullOrUndefined(i.target)&&(t.isNullOrUndefined(i.target.className)?!0:i.target.className.indexOf("e-alldaycells")!=1)){if(b=Math.round(nt>0?nt*60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*g):60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*g)),vt=new Date(new Date(f[u._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(f[u._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()?!0:!1,u.currentView()==="month"||u._isCustomMonthView()?(r=f[v.startTime],h=new Date(r)):(tt=new Date(u._firstweekdate(u.currentDate())),(u.currentView()==="workweek"||u.currentView()=="customview"&&u._renderDays==5)&&(yt=new Date(tt).getDay(),pt=yt==0?1:0,tt.setDate(tt.getDate()+pt)),r=tt,l=u.currentView()==="week"?this.model.showWeekend?7:this.model.workWeek.length:u.currentView()==="workweek"?this.model.workWeek.length:u.currentView()=="customview"?u._renderDays:1,l=t.isNullOrUndefined(u.model.group)?l:l*u.res1.length,y=Math.round((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-workcells").eq(1).outerWidth()),r=this.model.enableRTL?new Date(this.dateRender[l-y-1]
10):new Date(this.dateRender[y]),h=r),vt)r=this._getNewStartTime(b,r),c=new Date(r);else{var wt=(b%60).toFixed(1),bt=wt.toString().split("."),oi=t.isNullOrUndefined(bt[1])?0:bt[1]/1;r.setHours(parseInt(this.model.startHour)+Math.round(b/60),parseInt(wt.toString().split(".")[0]),oi,0);r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r);ht>=this._dragInterval?r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval):r.setMinutes(r.getMinutes()/this._dragInterval*this._dragInterval);c=new Date(r)}kt=new Date(f[v.endTime]).getTime()-new Date(f[v.startTime]).getTime();w=new Date(new Date(r).setMilliseconds(kt))}else l=this.currentView()==="week"?7:this.currentView()==="workweek"?this.model.workWeek.length:this.currentView()=="customview"?this._renderDays:1,l=t.isNullOrUndefined(this.model.group)?l:l*this.res1.length,y=Math.round((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-workcells").eq(1).outerWidth()),r=this.model.enableRTL?new Date(this.dateRender[l-y-1]):new Date(this.dateRender[y]),c=new Date(r.setHours(0,0,0)),w=new Date(r.setHours(23,59,59))}else if((this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&n(i.element[0]).hasClass("e-appointment")&&(c=new Date(f[u._appointmentSettings.startTime]),w=new Date(f[u._appointmentSettings.endTime]),p=this.model.enableRTL?document.elementFromPoint(n(i.element[0]).offset().left,n(i.element[0]).offset().top-1).cellIndex-Math.round(n(i.element[0]).width()/30-1):Math.round((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-workcells").eq(1).outerWidth()),this.element.find(".e-appointment,.e-monthappointment").css({"pointer-events":"visible"}),rt=parseInt((n(i.element[0]).offset().top+s.scrollTop()-s.offset().top)/this.element.find(".e-workcells")[0].offsetHeight),this.model.showOverflowButton?this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(rt+=n(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return n(this).css("display")!=="none"})[rt]).prevUntil("table.e-resourceheadertable").filter(function(){return n(this).css("display")=="none"}).length):rt=this._findRowIndex(i),et=n(this.element.find(".e-workcellstab tr")[rt]).find("td")[p],!n(et).hasClass("e-resourceheadercells")&&!t.isNullOrUndefined(et))){r=new Date(this._dateRender[0]);p>=0?(dt=this.element.find(".e-table .e-workcellstab tr:first td").length,gt=Math.ceil(i.element[0].offsetWidth/this.CellWidth)+p,it=this.model.enableRTL?p*30:(n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/n(this.element.find(".e-workcells")[1]).outerWidth(),e=this.model.startHour+p*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/60,ni=parseInt(p/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),e=e>=this.model.endHour?Math.round(it/60)+ni*(24-this.model.endHour+this.model.startHour):Math.round(it/60),r.setHours(parseInt(u.model.startHour)+e),r.setMinutes(parseInt(it%60)),r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()-1)):new Date(r),r=new Date(r).getHours()<this.model.startHour?new Date(new Date(r).setDate(new Date(r).getDate()-1)):r,r=new Date(r).getHours()<this.model.startHour?new Date(new Date(r).setHours(this.model.endHour-1)):r,ht>=this._dragInterval?r.setMinutes(Math.round(r.getMinutes()/this._dragInterval)*this._dragInterval):r.setMinutes(r.getMinutes()/this._dragInterval*this._dragInterval),r=new Date(r).getHours()>=this.model.endHour?new Date(new Date(r).setDate(new Date(r).getDate()+1)):r,r=new Date(r).getHours()>=this.model.endHour?new Date(new Date(r).setHours(this.model.startHour)):r,c=new Date(r),dt<=gt&&(t.isNullOrUndefined(o.length)||o.length>1?(ft=this._recurrenceAppSort(o),r=ft[0][u._appointmentSettings.startTime],r=new Date(r)):r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours()+1)):new Date(r),r=new Date(r.setMinutes(r.getMinutes()+this._dragInterval)),c=new Date(r))):(t.isNullOrUndefined(o.length)||o.length>1?(ft=this._recurrenceAppSort(o),r=ft[0][u._appointmentSettings.startTime],r=new Date(r)):r=new Date(r).getMinutes()>=30?new Date(new Date(r).setHours(new Date(r).getHours())):new Date(r),r=new Date(r).getMinutes()>0?new Date(r.setMinutes(r.getMinutes()-this._dragInterval)):r,c=new Date(r));var si=f[u._appointmentSettings.startTime],hi=f[u._appointmentSettings.endTime],ot=(hi-si)/1e3,st=Math.floor(ot/3600),ci=ot/3600;this.currentView()=="workweek"&&this.model.workWeek!=5&&new Date(f.StartTime).getDay()!=new Date(f.EndTime).getDay()&&(ti=new Date(f.EndTime).getDay()-new Date(f.StartTime).getDay(),st=st-(ti-1)*(this.model.endHour-this.model.startHour));ii=Math.round(Math.floor(ot%3600/60)/this._dragInterval)*this._dragInterval;h=u._getNewEndTime(r,ci,ii);new Date(f.StartTime).getDay()==new Date(f.EndTime).getDay()&&this.currentView()=="workweek"&&this.model.workWeek.length!=5&&(totalhrs=r.getHours()+st,totalhrs>24&&(ri=n.inArray(new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),this._dateRender)+1,h.setDate(new Date(this._dateRender[ri]).getDate())));ut=parseInt(p)+parseInt(n(i.element[0]).width()/this.element.find(".e-workcells").width())-1;ut=parseInt(ut/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)));var ui=new Date(h).getHours()>=this.model.endHour?parseInt(parseInt((new Date(h)-new Date(new Date(new Date(r).setHours(0,0,0,0)).setHours(this.model.endHour)))/36e5)/(this.model.endHour-this.model.startHour)):0,li=new Date(r),ai=this.currentView()=="workweek"?(ui-1)*(this.model.endHour-this.model.startHour):0;
10e=new Date(h).getHours()>=this.model.endHour?new Date(new Date(li).setHours(new Date(r).getHours()+ai+parseInt(n(i.element[0]).width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))+ui*(24-this.model.endHour+this.model.startHour))):h;this.model.endHour-this.model.startHour!=24&&(e.getHours()>=this.model.endHour?(fi=new Date(e).getHours()-this.model.endHour,e.setDate(new Date(this._dateRender[ut]).getDate()),e.setHours(this.model.startHour+fi),e.setMinutes(new Date(e).getMinutes())):(new Date(h).getHours()>=this.model.endHour&&e.setMinutes(new Date(r).getMinutes()+Math.round(parseInt(it%60)/this._dragInterval)*this._dragInterval),e=new Date(this._dateRender[ut]).setHours(new Date(e).getHours(),new Date(e).getMinutes(),new Date(e).getSeconds(),new Date(e).getMilliseconds())));w=new Date(e);this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.round(n(i.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.round((n(i.element[0]).offset().left+s.scrollLeft()-s.offset().left)/this.element.find(".e-workcells").eq(1).outerWidth())}i.element.find(".e-apptime").html(t.format(c,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(w,this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)).insertBefore(i.element.find(".e-apptext")).css("font-size","12px").css("white-space","nowrap");this._dragNewStartTime=c;this._dragNewEndTime=w}},_unWireDragDrop:function(){var n=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment");n.ejDraggable("destroy")},_getAppointmentByParentId:function(i){var f=this._currentAppointmentData,u=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i)),r=new t.DataManager(f).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[0].ParentId));return n.isEmptyObject(r)?r:r[0]},_renderAppointmentAll:function(){if(this.element.children().length==0)return!1;if(this.currentView()=="agenda")this._renderAgendaContent();else if(t.preferredCulture(this.model.locale),this.element.find("div.e-appointwrapper,.e-alldayappointment,.e-scheduleAppGlassy").remove(),this._currentViewAppointments=this.getCurrentViewAppointments(),this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable?(this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._reRenderScroller(),this._renderAppointments(),this.model.showAppointmentNavigator&&(this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.element.find(".e-vscroll").length>0&&!this._mediaQuery&&this._renderUpDownIconPosition(),this._nextPrevButton())):this._renderMonthAppointment(),this._bindAppointmentAction(),!this.model.showOverflowButton&&(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")){var n=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top;this.element.find(".e-horires").css({top:-n+"px"})}},_bindAppointmentAction:function(){this._unWireResizeEvents();this._wireResizeEvents();this._dragdropAppointments()},_renderBlockAppointments:function(){var u,r,f,h,e,o,s,i;if(this.element.find(".e-blocktimewrapper").remove(),this.model.blockoutSettings.enable&&!(this.model.blockoutSettings.dataSource instanceof t.DataManager)&&this.currentView()!="agenda")for(this._processBlockApps(),u=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?n.extend(!0,[],this.monthDays):n.extend(!0,[],this._dateRender),this.model.group||(this.res1=["0"]),r=0;r<this.res1.length;r++){if(f=0,e=u.length,new Date(u[0])<this.model.minDate&&(f=Math.floor((new Date(this.model.minDate)-new Date(u[0]))/864e5)),new Date(u[u.length-1])>this.model.maxDate&&(h=Math.floor((new Date(u[u.length-1])-new Date(this.model.maxDate))/864e5),e=u.length-h),this._resWorkWeek)for(e=0,f=0,o=0,i=0;i<r+1;i++)if(t.isNullOrUndefined(this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek])?(e+=this.model.workWeek.length,i==r&&(o+=this.model.workWeek.length)):(e+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length,i==r&&(o+=this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.workWeek].length)),i==r){f=e-o;break}if(this._resCustomView)for(e=0,f=0,o=0,s=this._tempResource[this._tempResource.length-1].resourceSettings.renderDates,i=0;i<r+1;i++)if(t.isNullOrUndefined(this.res1[i][s])||(e+=this._getCustomDatesCount(i,s),i==r&&(o+=this._getCustomDatesCount(i,s))),i==r){f=e-o;break}for(f;f<e;f++)this._getBlockIntervals(f,r,u)}},_processBlockApps:function(){var i,t;for(this._processedIntervals=[],i=n.extend(!0,[],this.model.blockoutSettings.dataSource),t=0;t<i.length;t++)i[t]=this._processtimeZone(i[t]),new Date(new Date(i[t][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[t][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()?this._blockTimeSplit(i[t],new Date(i[t][this.model.blockoutSettings.startTime]),new Date(i[t][this.model.blockoutSettings.endTime])):this._processedIntervals.push(i[t])},_blockTimeSplit:function(t,i,r){for(var u=new Date(this._dateRender[0])<=i?i:new Date(this._dateRender[0]),l=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate(),23,59,59),c=0,o,s,f,e,h;u<=l;)if(o=0,f=u,(this.currentView()=="month"||this._isCustomMonthView()||this.currentView()!="agenda"&&this.currentView()!="day"&&(this.model.orientation=="horizontal"||this._customOrientation=="horizontal"))&&((this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?o=new Date(f.getFullYear(),f.getMonth()+1,0).getDate()-f.getDate():this.currentView()=="customview"&&(this._renderDays<=7||this.model.orientation=="horizontal"||this._customOrientation=="horizontal")?(u=new Date(new Date(f).getFullYear(),new Date(f).getMonth(),new Date(f).getDate()),o=this._dateRender.indexOf(u.getTime())!=-1?this._dateRender.length-1-this._dateRender.indexOf(u.getTime()):u.getTime()<new Date(this._dateRender[0]).getTime()?(new Date(new Date(this._dateRender[0]).setDate(new Date(this._dateRender[0]).getDate()-1)).getTime()-new Date(u).setHours(0,0,0,0))/864e5:u.getTime()>
10new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)?this._dateRender.length-1:0):(o=this.model.showNextPrevMonth||this.currentView()!="month"||new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()==new Date(u.getFullYear(),u.getMonth(),1).getTime()?6-f.getDay()+this._firstdayofweek:new Date(f.getFullYear(),f.getMonth()+1,0).getDate()-f.getDate(),this._firstdayofweek>f.getDay()&&(o=6-f.getDay()-(7-this._firstdayofweek)))),s=new Date(new Date(u).getFullYear(),new Date(u).getMonth(),new Date(u).getDate()+o),e=new Date(s).getDate()==new Date(r).getDate()?new Date(new Date(s).setHours(r.getHours(),r.getMinutes(),r.getSeconds())):new Date(new Date(s).setHours(23,59,59)),e>=new Date(r)&&(e=t[this.model.blockoutSettings.endTime]),this.model.showNextPrevMonth||this.currentView()!="month"||new Date(u.getFullYear(),u.getMonth(),1).getTime()==new Date(e.getFullYear(),e.getMonth(),1).getTime()||(e=new Date(u.getFullYear(),u.getMonth()+1,0,e.getHours(),e.getMinutes(),e.getSeconds())),h={},h[this.model.blockoutSettings.startTime]=f,h[this.model.blockoutSettings.endTime]=e,this._processedIntervals.push(n.extend({},t,h)),c=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="workweek"&&new Date(this._dateRender[0]).getDay()==1&&new Date(this._dateRender[this._dateRender.length-1]).getDay()==5?3:1,u=new Date(new Date(e).getFullYear(),new Date(e).getMonth(),new Date(e).getDate()+c),new Date(this._dateRender[this._dateRender.length-1])<u)break},_getBlockIntervals:function(n,i,r){var u=this._processedIntervals,o=t.Predicate(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(r[n])).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(r[n]).setHours(23,59,59))),s=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(r[n])).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(r[n]).setHours(23,59,59))),e=o.or(s),f;for(e=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?e.and(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.id]):e,e=this._grouping.length>1?e.and(this.model.blockoutSettings.groupId,t.FilterOperators.equal,this.res1[i][this._tempResource[this._tempResource.length-1].resourceSettings.groupId]):e,u=new t.DataManager(u).executeLocal((new t.Query).where(e)),f=0;f<u.length;f++)new Date(new Date(r[n]).setHours(0,0,0,0)).getTime()==new Date(new Date(u[f][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(r[n]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[f][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(u[f][this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[f][this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime()&&(this.currentView()=="month"||this._isCustomMonthView()||!this.model.timeScale.enable?u[f][this.model.blockoutSettings.isAllDay]&&this._renderMonthBlockTime(u[f],n,i):this._renderBlockTime(u[f],n,i))},_renderBlockTime:function(i,r,u){var g=this.element.find(".e-workcells")[0].offsetHeight,c=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.startHour):0,w=parseInt(this.model.startHour)<parseInt(this.model.endHour)?parseInt(this.model.endHour):24,a=this._getDateCount(u),f=i[this.model.blockoutSettings.startTime],e=i[this.model.blockoutSettings.endTime],l,o,b,nt,v,ot,st,it,ht,rt,s,k,at,h,y;if(f=new Date(f).getHours()<c?new Date(new Date(f).setHours(c,f.getMinutes(),f.getSeconds())):f,e=w<=e.getHours()?new Date(new Date(e).setHours(w,0,0)):e,l=new Date(f).getHours()<c?new Date(f).getHours()+-new Date(f).getHours()+-new Date(f).getMinutes():new Date(f).getHours()+-c,f<=e&&new Date(a[0]).getTime()<=f.getTime()&&new Date(new Date(a[a.length-1]).setHours(23,59,59))>=f.getTime())if(this.model.orientation=="vertical"&&this._customOrientation=="vertical")o="100%",v=0,b=parseFloat(new Date(new Date(e).getTime())-new Date(new Date(f).getTime()))/6e4*g*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot,nt=(parseFloat(new Date(f).getHours()*60+new Date(f).getMinutes()+new Date(f).getSeconds()/60)-parseInt(l*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-this.model.startHour*60)*g*(this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot),y=this._generateBlockElement(i,o,b,nt,v),this._resWorkWeek||this._resCustomView?n(this.element.find("td.e-workcells")[l*this.model.timeScale.minorSlotCount*this.element.find(".e-headercells").length+r]).append(y):n(this.element.find("td.e-workcells")[parseInt(l*60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*a.length*this.res1.length+r+a.length*u]).append(y);else{var vt=this._horiGroupCollection(),b=g,o,nt=0,v,tt=0;if(!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&(predicate1=t.Predicate(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,i[this.model.blockoutSettings.resourceId]),predicate2=t.Predicate(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,i[this.model.blockoutSettings.groupId]),ot=predicate1.and(predicate2),st=new t.DataManager(this.res1).executeLocal((new t.Query).where(ot)),tt=this._findResourceIndex(vt,this._tempResource[this._tempResource.length-2].resourceSettings.id,st[0][this._tempResource[this._tempResource.length-1].resourceSettings.groupId],null,null)+1),it=!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource)?this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId],null,null)+1:this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,i[this.model.blockoutSettings.groupId])+1:1,new Date(new Date(new Date(i[this.model.blockoutSettings.startTime]).setHours(0,0,0,0)).getTime())<new Date(new Date(new Date(i[this.model.blockoutSettings.endTime]).setHours(0,0,0,0)).getTime())){var ct=new Date(e)<new Date(new Date(e).setHours(this.model.endHour,0,0))&&new Date(e)<new Date(new Date(e).setHours(this.model.startHour,0,0))?this.model.endHour*30:new Date(e).getHours()*60+new Date(e).getMinutes(),lt=new Date(f)>new Date(new Date(e).setHours(this.model.startHour,0,0))?this.model.startHour*60:new Date(f).getHours()*60+new Date(f).getMinutes(),d=1,ut,p,ft,et,ht;if(ut=this._dateRender.indexOf(new Date(e).setHours(0,0,0,0)),p=this._dateRender.indexOf(new Date(f).setHours(0,0,0,0)),ut==-1)while(d<7)if(new Date(this._dateRender[this._dateRender.length-d]).getTime()<new Date(e).setHours(0,0,0,0)){ft=this._dateRender.length-d;ct=this.model.endHour*60;break}else d++;else ft=ut;p==-1?(et=r,lt=this.model.startHour*60):et=p;ht=ft-et;s=ht*(w-c)*60-lt+ct;k=Math.floor((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*r+(p==-1?0:l*this.model.timeScale.minorSlotCount)*(60/this.model.timeScale.majorSlot));o=s/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+s/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1;rt>this._dateRender.length&&(rt=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(f).getDay(),s=rt*(w-c)*60,o=s/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+(s/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3));v=p==-1?0:parseFloat(new Date(f).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot}else at=Math.ceil((new Date(f).getMinutes()+new Date(f).getMilliseconds()/60)/Math.round(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))-1,v=parseFloat(new Date(f).getMinutes()+new Date(f).getMilliseconds()/60)*n(this.element.find(".e-workcells")[1]).width()*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot+at,s=new Date(e).getHours()*60+new Date(e).getMinutes()-(new Date(f).getHours()*60+new Date(f).getMinutes())+1,h=s*(this.element.find(".e-workcells").width()/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))/this.element.find(".e-workcells").width(),h=Math.floor(h)<2?h:Math.floor(h),o=h*this.element.find(".e-workcells").width()+h,k=Math.floor((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*r+l*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot));var yt=this.element.find(".e-workcellstab tr"),tt=!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0&&this._tempResource[0].resourceSettings.dataSource.length!=0&&this._grouping.length>1?this._findResourceIndex(this._horiGroupCollection(),this._tempResource[this._tempResource.length-2].resourceSettings.id,i[this.model.blockoutSettings.groupId.trim()],null,null)+1:0,it=!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,i[this.model.blockoutSettings.resourceId],null,null)+1:this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId.trim()],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,i[this.model.blockoutSettings.groupId.trim()])+1:1;celltd=yt.eq(it+tt-1).children().eq(k);b=celltd.outerHeight();o+=Math.ceil((e.getTime()-f.getTime())/864e5)-1;o=o+"px";y=this._generateBlockElement(i,o,b,nt,v);n(n(this.element.find(".e-workcellstab tr")[it+tt-1]).find("td.e-workcells")[k]).append(y)}},_generateBlockElement:function(i,r,u,f,e){var o=this.model.blockoutSettings.templateId?!0:!1,h=o?this._getUserTemplate(this.model.blockoutSettings.templateId,i):"",c=i[this.model.blockoutSettings.isBlockAppointment]?"e-blockenable":"",s=n(this.blockTimeTemplate.render({id:i[this.model.blockoutSettings.id],subject:i[this.model.blockoutSettings.subject],appWidth:r,appHeight:u,left:e,top:f,blockClass:c,customStyle:i[this.model.blockoutSettings.customStyle],userTempId:o,userTemplate:h}));return t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("blockAppointment",i,s),s},_renderMonthBlockTime:function(i,r){var k=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this._dateRender:this.monthDays,u=new Date(i[this.model.blockoutSettings.startTime]),o=new Date(i[this.model.blockoutSettings.endTime]),d,l,g,ft=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.element.find(".e-monthcells").width():this.element.find(".e-workcells").width(),e=new Date(u),nt=new Date(new Date(k[k.length-1]).setHours(23,59,59)),v=new Date(o)>nt?nt:new Date(o),s=e.getHours()==0&&v.getHours()==0?Math.ceil((new Date(v)-new Date(e))/864e5):Math.ceil((new Date(v).setHours(23,59,59)-new Date(e).setHours(0,0,0))/864e5),y,p,w,f,tt,h,it,rt,b,ut,a,c;u<=o&&(this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&(y=this._firstdayofweek==0?7-new Date(e).getDay():7-new Date(e).getDay()+this._firstdayofweek,s=s>=y?y:s,p=Math.ceil((r+1)/7)),d=s*ft+(Math.ceil((o.getTime()-u.getTime())/864e5)-1)+"px",w=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId],null,null):this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,i[this.model.blockoutSettings.groupId]):0,f=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?w*7+(new Date(u).getDay()+1)+(p-1)*this.res1.length*7-this._firstdayofweek:r+1,this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._firstdayofweek!=0&&new Date(u).getDay()<this._firstdayofweek&&(f=w*7+(new Date(u).getDay()+1)+(p-1)*this.res1.length*7-this._firstdayofweek+7),this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(g=n(this.element.find("td.e-monthcells")[f-1]).closest("tr").find(".e-monthcells")[0].offsetHeight,l=g-this.element.find(".e-monthheader").height()):(tt=this._horiGroupCollection(),h=0,!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&(predicate1=t.Predicate(this._tempResource[this._tempResource.length-1].resourceSettings.id,t.FilterOperators.equal,i[this.model.blockoutSettings.resourceId]),predicate2=t.Predicate(this._tempResource[this._tempResource.length-1].resourceSettings.groupId,t.FilterOperators.equal,i[this.model.blockoutSettings.groupId]),it=predicate1.and(predicate2),rt=new t.DataManager(this.res1).executeLocal((new t.Query).where(it)),h=this._findResourceIndex(tt,this._tempResource[this._tempResource.length-2].resourceSettings.id,rt[0][this._tempResource[this._tempResource.length-1].resourceSettings.groupId],null,null)+1),b=!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this._tempResource)?this._grouping.length==1?this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId],null,null)+1:this._findResourceIndex(this.res1,this._tempResource[this._tempResource.length-1].resourceSettings.id,i[this.model.blockoutSettings.resourceId],this._tempResource[this._tempResource.length-1].resourceSettings.groupId,i[this.model.blockoutSettings.groupId])+1:1,ut=this.element.find(".e-workcellstab tr"),c=ut.eq(b+h-1).children().eq(f-1),l=c.outerHeight()),a=this._generateBlockElement(i,d,l,0,0),c=n(this.element.find("td.e-monthcells")[f-1]),this.model.orientation=="vertical"&&this._customOrientation=="vertical"?c.find(".e-monthheader").after(a):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&t.scheduleFeatures.horizontal&&n(n(this.element.find(".e-workcellstab tr")[b+h-1]).find("td.e-workcells")[f-1]).prepend(a))},_checkAvailability:function(n){var r,f,e;if(this.model.blockoutSettings.enable){var u=new Date(n[this._appointmentSettings.startTime]),o=new Date(n[this._appointmentSettings.endTime]),r,s=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.greaterThanOrEqual,u).and(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThanOrEqual,u).and(this.model.blockoutSettings.startTime,t.FilterOperators.lessThan,o),h=t.Predicate(this.model.blockoutSettings.startTime,t.FilterOperators.lessThanOrEqual,u).and(this.model.blockoutSettings.endTime,t.FilterOperators.greaterThan,u),i=s.or(h);if(!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)if(this._groupEditing){for(r=n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()].toString().split(","),f=new t.Predicate(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,r[0]),e=1;e<r.length;e++)f=f.or(new t.Predicate(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,r[e]));i=i.and(f)}else r=n[this._appointmentSettings.resourceFields.toString().split(",")[this._tempResource.length-1].trim()],i=i.and(this.model.blockoutSettings.resourceId,t.FilterOperators.equal,r);return i=i.and(this.model.blockoutSettings.isBlockAppointment,t.FilterOperators.equal,!0),new t.DataManager(this._processedIntervals).executeLocal((new t.Query).where(i))}return[]},_alertBlockError:function(){t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow();this._alertWindow.ejDialog("instance").option("title",this._getLocalizedLabels("BlockIntervalAlertTitle"));this._alertWindow.find(".e-al
10erttext").html(this._getLocalizedLabels("BlockIntervalError"));this._alertWindow.find(".e-alertOk").html(this._getLocalizedLabels("Ok"));this._alertWindow.ejDialog("open")},_getNewEndTime:function(n,t){var i=new Date(n);return i.setMilliseconds(36e5*t),i},_getNewStartTime:function(n,t){return t.setHours(t.getHours()+parseInt(this.model.startHour)+parseInt(n/60)),t.setMinutes(t.getMinutes()+parseInt(n%60)),t.setMinutes(Math.round(t.getMinutes()/10)*10),t},_documentOnKeyDown:function(n){if(this.model.allowKeyboardNavigation){var t=n.target||document.activeElement||n.srcElement;n.which==27?this._processEscapeKey():n.which==13?this._processEnterKey(t):n.shiftKey==!1&&n.which==9&&this._processWindowTab(t)}},_processWindowTab:function(i){n(i).hasClass("e-qAppDone")&&!t.isNullOrUndefined(this._quickAppointWindow)?this._quickAppointWindow.find(".subject").focus():!t.isNullOrUndefined(this._appointmentAddWindow)&&(n(i).hasClass("e-appointcancel")||n(i).hasClass("e-cancelrecur"))?this._appointmentAddWindow.find(".subject").focus():n(i).hasClass("e-editseries")&&!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppDetailsWindow.focus()},_onKeyDown:function(i){var u,r,f,o,s,e,l;if(this.model.allowKeyboardNavigation){if(!t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._quickAppointWindow.data("ejDialog")&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),u=this.element.find("div.e-draggableworkarea tr"),r=i.target||document.activeElement||i.srcElement,n(r).hasClass("e-alldaycells")&&(u=this.element.find(".e-alldaycells").parent()),this._trigger("keyDown",{event:i}))return!1;if(n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells"))this._getDateByElement(n(r),null),f=this.curDate,i.which==39&&f.setDate(f.getDate()+1),i.which==37&&f.setDate(f.getDate()-1),f>=this.model.minDate&&f<=this.model.maxDate&&(this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"),(n(r).hasClass("e-workcells")||n(r).hasClass("e-alldaycells")||n(r).hasClass("e-monthcells"))&&n(r).addClass("e-selectedCell"),i.shiftKey==!1&&i.which==38?(this._stopDefaultAction(i),this._processUpArrow(r,u)):i.shiftKey==!1&&i.which==40?(this._stopDefaultAction(i),this._processDown(r,u)):i.ctrlKey==!1&&i.shiftKey==!1&&i.which==39?(this._stopDefaultAction(i),this._processRight(r,u)):i.ctrlKey==!1&&i.shiftKey==!1&&i.which==37?(this._stopDefaultAction(i),this._processLeft(r,u)):i.shiftKey==!0&&i.which==38?(this._stopDefaultAction(i),this._processShiftUp(r,i,u)):i.shiftKey==!0&&i.which==40?(this._stopDefaultAction(i),this._processShiftDown(r,i,u)):i.shiftKey==!0&&i.which==37?(this._stopDefaultAction(i),this._processShiftLeft(r,i,u)):i.shiftKey==!0&&i.which==39&&(this._stopDefaultAction(i),this._processShiftRight(r,i,u)));else if(this.currentView()=="agenda"&&n(r).hasClass("e-agendacells")&&(this._stopDefaultAction(i),i.which==38||i.which==40)){this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");var a=u.length-1,h=this.element.find(".e-selectedCell").parent().index(),c=i.which==38?parseInt(h)-1:parseInt(h)+1;c>=0&&c<=a&&h!="undefined"&&(n(u).find(".e-eventcolumn,.e-timecolumn").removeClass("e-selectedCell"),n(u[c]).find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus())}i.altKey==!0&&i.which==67?(this._stopDefaultAction(i),this.element.find(".e-datedisplay").click()):i.ctrlKey==!0&&i.which==37?(this._stopDefaultAction(i),this.element.find("div.e-navigateprevious").click(),this.element.find("div.e-navigateprevious").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.ctrlKey==!0&&i.which==39?(this._stopDefaultAction(i),this.element.find("div.e-navigatenext").click(),this.element.find("div.e-navigatenext").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.altKey==!0&&i.which==107||i.altKey==!0&&i.which==187||i.altKey==!0&&i.which==61?(this._stopDefaultAction(i),this._navigateToolbarRight(i)):i.altKey==!0&&i.which==189||i.altKey==!0&&i.which==109||i.altKey==!0&&i.which==45||i.altKey==!0&&i.which==173?(this._stopDefaultAction(i),this._navigateToolbarLeft(i)):i.ctrlKey==!0&&i.which==67?(this._stopDefaultAction(i),this._cancel()):i.which==32?n(document.activeElement)[0]===this.element.find("div.e-navigateprevious")[0]?(this._stopDefaultAction(i),this.element.find("div.e-navigateprevious").click(),this.element.find("div.e-navigateprevious").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):n(document.activeElement)[0]===this.element.find("div.e-navigatenext")[0]&&(this._stopDefaultAction(i),this.element.find("div.e-navigatenext").click(),this.element.find("div.e-navigatenext").attr("tabIndex",0).focus(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())})):i.altKey==!0&&i.which==78?(this._stopDefaultAction(i),this.currentView()!="agenda"&&this._newAppWindow(r,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):i.ctrlKey==!0&&i.which==69?(this._stopDefaultAction(i),o=this.element.find(".e-selectedAppointment"),this.currentView()=="agenda"&&this.element.find(".e-selectedCell").length>0&&(e=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),e.hasClass("e-agendaappointment")&&(o=e)),o.length>0&&(this._editKey=!0,this._cellClick=!1,this._appointmentWindow(o),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"))):i.which==46?(this._stopDefaultAction(i),s=this.element.find(".e-selectedAppointment"),this.currentView()=="agenda"&&this.element.find(".e-selectedCell").length>0&&(e=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),e.hasClass("e-agendaappointment")&&(s=e)),s.length>0&&(this._appUid=s.attr("data-guid"),this._deleteAppoint())):i.shiftKey==!0&&i.which==9?(this._stopDefaultAction(i),this._reverseTab(r,i,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):i.shiftKey==!1&&i.which==9&&(this._stopDefaultAction(i),this._processTab(r,i,u),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"));l=this;this.currentView()!="agenda"&&this._moveScrollContent(r,l)}},_processShiftUp:function(t,i,r){var u,s,o;if(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")return!1;if(n(t).hasClass("e-workcells")){var h=r.length-1,e=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;e>0&&e<=h&&e!="undefined"?(u=parseInt(e)-1,u>=0&&(n(r[u].cells[f]).hasClass("e-selectedCell")?(n(r[u].cells[f]).attr("tabIndex",0).focus(),n(r[e].cells[f]).removeClass("e-selectedCell")):(n(r[e].cells[f]).addClass("e-selectedCell"),n(r[u].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus())),this._currentRowIndex=u,this._currentColIndex=f):(n(r[e].cells[f]).attr("tabIndex",0).focus(),this._currentRowIndex=e,this._currentColIndex=f)}else if(n(t).hasClass("e-monthcells")){var c=Math.floor(n(t).index()/7),h=r.length-1,l=7*(c+1),a=7*parseInt(c),e=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;if(e>0&&e<=h&&e!="undefined")if(u=parseInt(e)-1,u>=0)if(n(r[u].cells[f]).hasClass("e-selectedCell")){for(s=f;s>=a;s--)n(r[e].cells[s]).attr("tabIndex",0).focus(),n(r[e].cells[s]).removeClass("e-selectedCell");for(o=l-1;o>=f;o--)u>=0&&(n(r[u].cells[o]).attr("tabIndex",0).focus(),n(r[u].cells[o]).removeClass("e-selectedCell"));n(r[u].cells[f]).hasClass("e-othermonths")||n(r[u].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(s=f;s>=a;s--)n(r[e].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus();for(o=l-1;o>=f;o--)u>=0&&(n(r[u].cells[o]).hasClass("e-othermonths")||n(r[u].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else n(r[u+1].cells[f]).attr("tabIndex",0).focus();else return!1}else return!1},_processShiftDown:function(t,i,r){var u,o,s;if(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")return!1;if(n(t).hasClass("e-workcells")){var h=r.length-1,f=n(t).parent()[0].rowIndex,e=n(t)[0].cellIndex;f>=0&&f<=h&&f!="undefined"&&(n(r[f].cells[e]).addClass("e-selectedCell").attr("tabIndex",0).focus(),u=parseInt(f)+1,u<=h?(n(r[u].cells[e]).hasClass("e-selectedCell")?(n(r[u].cells[e]).attr("tabIndex",0).focus(),n(r[f].cells[e]).removeClass("e-selectedCell")):(n(r[f].cells[e]).addClass("e-selectedCell"),n(r[u].cells[e]).addClass("e-selectedCell").attr("tabIndex",0).focus()),this._currentRowIndex=u,this._currentColIndex=e):(n(r[f].cells[e]).attr("tabIndex",0).focus(),this._currentRowIndex=f,this._currentColIndex=e))}else if(n(t).hasClass("e-monthcells")){var c=Math.floor(n(t).index()/7),h=r.length-1,l=7*(c+1),a=7*parseInt(c),f=n(t).parent()[0].rowIndex,e=n(t)[0].cellIndex;if(f>=0&&f<=h&&f!="undefined")if(u=parseInt(f)+1,u<this._dateRender.length/7)if(n(r[u].cells[e]).hasClass("e-selectedCell")){for(o=e;o<=l-1;o++)n(r[f].cells[o]).attr("tabIndex",0).focus(),n(r[f].cells[o]).removeClass("e-selectedCell");for(s=a;s<=e;s++)u<this._dateRender.length/7&&(n(r[u].cells[s]).attr("tabIndex",0).focus(),n(r[u].cells[s]).removeClass("e-selectedCell"));n(r[u].cells[e]).hasClass("e-othermonths")||n(r[u].cells[e]).addClass("e-selectedCell")}else{for(o=e;o<=l-1;o++)n(r[f].cells[o]).hasClass("e-othermonths")||n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();for(s=a;s<=e;s++)u<this._dateRender.length/7&&(n(r[u].cells[s]).hasClass("e-othermonths")||n(r[u].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else n(r[u-1].cells[e]).attr("tabIndex",0).focus();else return!1}else return!1},_processShiftLeft:function(t,i,r){var rt=r.length-1,c,l,h,v;if(n(t).hasClass("e-workcells")){var b=t,y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,d=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?y:this.currentView()=="month"?this.totdays.length:y*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),p=Math.floor(n(b).index()/d),g=d*p,o=n(b)[0].cellIndex,e=n(b).parent()[0].rowIndex,u=o-1,nt=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?0:e,tt=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?rt:e,it=this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showAllDayRow?!0:!1,k=this.element.find(".e-alldaycells").parent();if(o>0&&u>parseInt(g)-1&&o!="undefined"){if(n(r[e].cells[u]).hasClass("e-selectedCell")){for(c=nt;c<=parseInt(e);c++)n(r[c].cells[o]).removeClass("e-selectedCell");for(l=tt;l>=parseInt(e);l--)n(r[l].cells[u]).removeClass("e-selectedCell");it&&n(k[0].cells[o]).removeClass("e-selectedCell").attr("tabIndex",0).focus();
10n(r[e].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(c=nt;c<=parseInt(e);c++)n(r[c].cells[o]).addClass("e-selectedCell");for(l=tt;l>=parseInt(e);l--)n(r[l].cells[u]).addClass("e-selectedCell");it&&(n(k[0].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(k[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus());n(r[e].cells[u]).attr("tabIndex",0).focus()}this._currentRowIndex=e;this._currentColIndex=u}else n(r[e].cells[u+1]).attr("tabIndex",0).focus(),this._currentRowIndex=e,this._currentColIndex=u+1}else if(n(t).hasClass("e-monthcells")){var p=Math.floor(n(t).index()/7),rt=r.length-1,a=7*(parseInt(p)+1),w=7*parseInt(p),s=n(t).parent()[0].rowIndex,f=n(t)[0].cellIndex;if(f>=w&&f<=a&&f!="undefined")newcur=parseInt(f)-1,n(r[s].cells[newcur]).hasClass("e-selectedCell")?f==w&&s>=1?(h=parseInt(s)-1,v=parseInt(a)-1,h>=0&&(n(r[h].cells[v]).attr("tabIndex",0).focus(),n(r[h].cells[f]).removeClass("e-selectedCell"),n(r[s].cells[w]).removeClass("e-selectedClass"))):f<a&&(newcur=parseInt(f)-1,n(r[s].cells[newcur]).attr("tabIndex",0).focus(),n(r[s].cells[f]).removeClass("e-selectedCell")):f==w&&s>=0?(h=parseInt(s)-1,v=parseInt(a)-1,h>=0?n(r[h].cells[v]).hasClass("e-othermonths")||n(r[h].cells[v]).addClass("e-selectedCell").attr("tabIndex",0).focus():n(r[h+1].cells[f]).attr("tabIndex",0).focus()):f<a&&(newcur=parseInt(f)-1,n(r[s].cells[newcur]).hasClass("e-othermonths")||n(r[s].cells[newcur]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(t).hasClass("e-alldaycells")){var y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=Math.floor(n(t).index()/y),g=y*p,o=n(t)[0].cellIndex,u=o-1;o>0&&u>parseInt(g)-1&&o!="undefined"?(n(r[0].cells[u]).hasClass("e-selectedCell")?(n(r[0].cells[o]).removeClass("e-selectedCell"),n(r[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=u):(n(r[0].cells[u+1]).attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=u+1)}else return!1},_processShiftRight:function(t,i,r){var s,h,o;if(n(t).hasClass("e-workcells")){var g=r.length-1,l=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?l:this.currentView()=="month"?this.totdays.length:l*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),a=Math.floor(n(t).index()/p),c=p*(a+1),e=n(t).parent()[0].rowIndex,u=n(t)[0].cellIndex,f=parseInt(u)+1,w=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?0:e,b=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?g:e,y=this.element.find(".e-alldaycells").parent(),k=this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.model.showAllDayRow?!0:!1;if(u>=0&&u<parseInt(c)-1&&u!="undefined"){if(n(r[e].cells[f]).hasClass("e-selectedCell")){for(s=parseInt(e);s<=b;s++)n(r[s].cells[u]).removeClass("e-selectedCell");for(h=w;h<=e;h++)n(r[h].cells[f]).removeClass("e-selectedCell").attr("tabIndex",0).focus();k&&n(y[0].cells[u]).removeClass("e-selectedCell");n(r[e].cells[f]).addClass("e-selectedCell")}else{for(s=parseInt(e);s<=b;s++)n(r[s].cells[u]).addClass("e-selectedCell");for(h=w;h<=e;h++)n(r[h].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus();k&&(n(y[0].cells[f]).addClass("e-selectedCell"),n(y[0].cells[u]).addClass("e-selectedCell"))}this._currentRowIndex=e;this._currentColIndex=f}else n(r[e].cells[u]).attr("tabIndex",0).focus()}else if(n(t).hasClass("e-monthcells")){var a=Math.floor(n(t).index()/7),g=r.length-1,v=c=7*(parseInt(a)+1),d=7*parseInt(a),e=n(t).parent()[0].rowIndex,u=n(t)[0].cellIndex,f=parseInt(u)+1;if(u>=0&&u<=parseInt(c)-1&&u!="undefined")n(r[e].cells[f]).hasClass("e-selectedCell")?(f<v&&(n(r[e].cells[f]).attr("tabIndex",0).focus(),n(r[e].cells[u]).removeClass("e-selectedCell")),u==parseInt(c)-1&&e<this._dateRender.length/7&&(o=parseInt(e)+1,u=d,o<this._dateRender.length/7&&(n(r[o].cells[u]).hasClass("e-othermonths")||n(r[o].cells[u]).removeClass("e-selectedCell").attr("tabIndex",0).focus(),f<v&&(n(r[o].cells[f]).attr("tabIndex",0).focus(),n(r[o].cells[u]).removeClass("e-selectedCell"))))):(f<v&&(n(r[e].cells[f]).hasClass("e-othermonths")||n(r[e].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()),u==parseInt(c)-1&&e<this._dateRender.length/7&&(o=parseInt(e)+1,u=d,o<this._dateRender.length/7?(n(r[o].cells[u]).hasClass("e-othermonths")&&n(r[o].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),f<v&&n(r[o].cells[f]).hasClass("e-othermonths")&&n(r[o].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[o-1].cells[f-1]).attr("tabIndex",0).focus()));else return!1}else if(n(t).hasClass("e-alldaycells")){var l=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,a=Math.floor(n(t).index()/l),c=l*(a+1),u=n(t)[0].cellIndex,f=parseInt(u)+1;u>=0&&u<parseInt(c)-1&&u!="undefined"?(n(r[0].cells[f]).hasClass("e-selectedCell")?(n(r[0].cells[u]).removeClass("e-selectedCell"),n(r[0].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(r[0].cells[f]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=f):n(r[0].cells[u]).attr("tabIndex",0).focus()}else return!1},_processEnterKey:function(i){var o,s,f,r;if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),n(i).hasClass("e-workcells")||n(i).hasClass("e-monthcells")||n(i).hasClass("e-alldaycells"))if(o=this.element.find("td.e-selectedCell"),s=o.length-1,s==0){var e=this.getSlotByElement(i),u=this,h=[];h=this.model.blockoutSettings.dataSource.filter(function(n){return(n[u._appointmentSettings.endTime]>e.startTime&&n[u._appointmentSettings.startTime]<e.endTime||n[u._appointmentSettings.endTime].getTime()==e.startTime.getTime()&&n[u._appointmentSettings.startTime].getTime()==e.endTime.getTime())&&(t.isNullOrUndefined(n[u.model.blockoutSettings.resourceId])?!0:n[u.model.blockoutSettings.resourceId]==e.resources.id)});h.length==0&&this._cellSelection(i)}else this._multipleCellAppointCreation(i);else n(i).hasClass("e-inlinetext")||n(i).hasClass("e-inlineedit")?this._saveAppointment():n(i).hasClass("e-detailedapp e-detailedwindow")?this._appointmentWindow(i):n(i).parent().hasClass("e-allday")?(f=this._appointmentAddWindow.find("#"+this._id+"allday").ejCheckBox("option","checked"),r=f?!1:!0,this._appointmentAddWindow.find(".allday").ejCheckBox({checked:r})):n(i).parent().hasClass("e-recurrence")?(f=this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox("option","checked"),r=f?!1:!0,this._appointmentAddWindow.find(".recurrence").ejCheckBox({checked:r}),this._recurChecked=r?!0:!1,this._repeat(i)):n(i).hasClass("e-scheduledelete")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-scheduledelete").click():n(i).hasClass("e-editevent")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-editevent").click():n(i).hasClass(".e-editseries")?this.model.showQuickWindow&&this._quickAppDetailsWindow.find(".e-editseries").click():n(i).hasClass("e-appointment")||n(i).hasClass("e-alldayappointment")||n(i).hasClass("e-monthappointment")?this._cellSelection(i):n(i).parent().hasClass("e-weekday")&&(f=this._appointmentAddWindow.find("#"+n(i).children()[0].id).ejCheckBox("option","checked"),r=f?!1:!0,this._appointmentAddWindow.find("#"+n(i).children()[0].id).ejCheckBox({checked:r}))},_findMinMaxCellIndex:function(){var u=this.element.find("div.e-draggableworkarea tr"),o=u.length-1,i,t,f,s,e,r=this.currentView(),h=r=="day"?1:r=="workweek"?this.model.workWeek.length:7,c=this;return this.element.find("td.e-selectedCell").each(function(h,c){var a=n(c).index(),l;if(a!=null&&!isNaN(a)){if(i==null?(i=a,f=n(c).parent()[0].rowIndex):i<a?i=i:i!=a&&(i=a,f=n(c).parent()[0].rowIndex),r!="month")for(l=0;l<=o;l++)if(n(u[l].cells[i]).hasClass("e-selectedCell")){f=l;break}if(t==null){if(t=a,r!="month")for(e=parseInt(t),l=0;l<=o;l++)n(u[l].cells[e]).hasClass("e-selectedCell")&&(s=l)}else if(t>a)t=t;else if(t!=a&&(t=a,r!="month"))for(e=parseInt(t),l=0;l<=o;l++)n(u[l].cells[e]).hasClass("e-selectedCell")&&(s=l)}}),{rowInx:f,maxrowInx:s,omincolIndex:i,omaxcolIndex:t}},_multipleCellAppointCreation:function(i){var r;if(t.isNullOrUndefined(this._quickAppointWindow)&&this.model.showQuickWindow&&this._renderQuickWindow(),r=t.isNullOrUndefined(i.target)?n(i):n(i.target),this._multiple=!0,this.element.find(".e-inline").length>0&&this.element.find(".e-inlinetext").val()!=""&&this._saveAppointment(),this.element.find(".e-inlineedit").length>0&&this._saveAppointment(),this._slotByCellSelect(r),this.model.allowInline)this.model.orientation!="vertical"||this._customOrientation!="vertical"||t.isNullOrUndefined(this._inlineDate)||this.currentView()=="month"||this._isCustomMonthView()||this._refreshDayAppointments(this._app),this.element.find(".e-inlinetext").removeClass("e-inlinetext"),this.element.find(".e-inlinewrapper").remove(),t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(r,this._cellIndex),this._inlineAppointment(r);else if(this.model.showQuickWindow&&i.type!=="beforeOpen"){this._quickAppointWindow.find("#"+this._id+"_quickAppwindow").css("display","block");new Date(new Date(this.cur_StartTime).setHours(0,0,0,0)).getTime()==new Date(new Date(this.cur_EndTime).setHours(0,0,0,0)).getTime()?this._quickAppointWindow.find(".e-quickstartend").html(this._dayFullNames[new Date(this.cur_StartTime).getDay()]+", "+t.format(new Date(this.cur_StartTime),"M",this.model.locale)+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)):this._quickAppointWindow.find(".e-quickstartend").html(this._dayFullNames[new Date(this.cur_StartTime).getDay()]+", "+t.format(new Date(this.cur_StartTime),"M",this.model.locale)+", "+t.format(new Date(this.cur_StartTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale)+" - "+this._dayFullNames[new Date(this.cur_EndTime).getDay()]+", "+t.format(new Date(this.cur_EndTime),"M",this.model.locale)+", "+t.format(new Date(this.cur_EndTime),this._timeMode=="12"?this._pattern.t:"HH:mm",this.model.locale));this._quickAppointWindow.find(".subject").val("");this.model.readOnly||this._quickAppointWindow.ejDialog("open");var f=n(r).offset().left-(this._quickAppointWindow.width()-n(r).width())/2+10,e=n(r).offset().top-this._quickAppointWindow.height()-10,u=this._quickWindowPosition(f,e,n(r),this._quickAppointWindow);this._quickAppointWindow.ejDialog({position:{X:u.X,Y:u.Y}});this._quickAppointWindow.find(".subject").focus();t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._getResourceDetails(n(r))}this._cellClick=!0},_slotByCellSelect:function(t){var i=this.model.showWeekend?7:this.model.workWeek.length,r,e,o,s;this._cellIndex=n(t).hasClass("e-workcells")?n(t).index():n(t).hasClass("e-alldaycells")?n(t).index():i-((parseInt(n(t).index()/i)+1)*i-n(t).index())+n(t).parent().index()*i;this._cellIndex=this._resCustomView?n(t).index():this._cellIndex;(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this._cellIndex=this.currentView()!=="month"?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)):this._cellIndex,this._workCellIndex=n(t).parent().index());var h=this._findMinMaxCellIndex(),c=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.dateRender:this._dateRender,u=h.omincolIndex,f=h.omaxcolIndex,k=h.rowInx,a=h.maxrowInx,o=c[u],s=c[f];if(this.model.orientation=="vertical"&&this._customOrientation=="vertical")if(n(t).hasClass("e-workcells")){var v=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,y=this.model.startHour*36e5+k*v*6e4,p=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)-1==a?this.model.startHour*36e5+(a+1)*v*6e4-1:this.model.startHour*36e5+(a+1)*v*6e4;this.cur_StartTime=new Date(new Date(o).setMilliseconds(y));this.cur_EndTime=new Date(new Date(s).setMilliseconds(p))}else if(n(t).hasClass("e-monthcells")){if(r=this.element.find("td.e-selectedCell"),e=r.length-1,this.model.timeScale.enable||this.currentView()=="month")var w=n(r[0]).parent().index()*i+(n(r[0]).index()-Math.floor(n(r[0]).index()/i)*i),b=n(r[e]).parent().index()*i+(n(r[e]).index()-Math.floor(n(r[e]).index()/i)*i),d=new Date(this._dateRender[w]),g=new Date(this._dateRender[b]);else{i=this._dateRender.length;var w=(n(r[0]).parent().index()*i+(n(r[0]).index()-Math.floor(n(r[0]).index()/i)*i))%i,b=(n(r[e]).parent().index()*i+(n(r[e]).index()-Math.floor(n(r[e]).index()/i)*i))%i,d=new Date(this._dateRender[w]),g=new Date(this._dateRender[b])}this.cur_StartTime=new Date(d.setHours(0,0,0));this.cur_EndTime=new Date(g.setHours(23,59,59))}else n(t).hasClass("e-alldaycells")&&(this.cur_StartTime=new Date(o),this.cur_EndTime=new Date(new Date(s).setHours(23,59,59)));else if(this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){var l=this.element.find(".e-workcellstab tr:first-child").children().length/this._dateRender.length,nt=l<u?u-u%l:u,tt=l<f?f-f%l:f,o=c[parseInt(nt/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],s=c[parseInt(tt/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],it=u%(this.element.find(".e-workcellstab tr:first-child").children().length/this._dateRender.length),y=this.model.startHour+it/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),rt=f%(this.element.find(".e-workcellstab tr:first-child").children().length/this._dateRender.length),p=this.model.startHour+rt/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot));this.cur_StartTime=new Date(o).setMinutes(y*60);this.cur_EndTime=new Date(s).setMinutes(p*60);this.cur_EndTime=new Date(new Date(this.cur_EndTime).setMinutes(new Date(this.cur_EndTime).getMinutes()+this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))}else o=this.totdays[u],s=this.totdays[f],this.cur_StartTime=new Date(o),this.cur_EndTime=new Date(new Date(s).setHours(23,59,59))},_addCellSelection:function(t){var i=this.element.find("td.e-selectedCell"),r=i.length-1;r>0&&(this.element.find("td.e-selectedCell").removeClass("e-selectedCell"),n(t[this._currentRowIndex].cells[this._currentColIndex]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_processUpArrow:function(t,i){var e,r,u;if(n(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(t).hasClass("e-selectedCell")&&this._addCellSelection(i),e=this.element.find(".e-alldaycells"),n(t).hasClass("e-workcells")){var o=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)-1;if(r>0&&r<=o&&r!="undefined"){if(n(i[r-1].cells[u]).hasClass("e-resourceheadercells"))return!1;n(i[r].cells[u]).removeClass("e-selectedCell").blur();n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else r==0&&(this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(this.element).attr("tabIndex",0).focus(),n(e[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else{if(n(t).hasClass("e-alldaycells"))return!1;if(n(t).hasClass("e-monthcells")){var o=i.length-1,r=t
10his.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)-1;if(r>=0&&r<=o&&r!="undefined")f>=0?(n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[0].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._selectCurrentMonth(i,r,u);else return!1}else return!1}},_processDown:function(t,i){var o,s;if(n(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(t).hasClass("e-selectedCell")&&this._addCellSelection(i),n(t).hasClass("e-workcells")){var e=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)+1;if(r>=0&&r<=e&&r!="undefined")if(f<=e){if(n(i[r+1].cells[u]).hasClass("e-resourceheadercells"))return!1;n(i[r].cells[u]).removeClass("e-selectedCell").blur();n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else n(i[r].cells[u]).attr("tabIndex",0).focus()}else if(n(t).hasClass("e-alldaycells"))o=this.element.find("td.e-selectedCell")[0].cellIndex,s=this.element.find(".e-alldaycells"),n(s[o]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-workcells")[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(n(t).hasClass("e-monthcells")){var e=i.length-1,r=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,f=parseInt(r)+1;r>=0&&r<e&&r!="undefined"&&(f<=7?(n(i[r].cells[u]).removeClass("e-selectedCell").blur(),n(i[f].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i[f-1].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus());this._selectCurrentMonth(i,r,u)}else return!1},_processRight:function(i,r){var l,s,y,p,e,h;if(n(i).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i).hasClass("e-selectedCell")&&this._addCellSelection(r),n(i).hasClass("e-workcells")){var c=r[0].cells.length,f=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,o=parseInt(u)+1;if(u>=0&&u<parseInt(c)-1&&u!="undefined")n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(u==parseInt(c)-1)this.currentView()!="month"?(l=n(i).parent()[0].rowIndex,this.element.find("div.e-navigatenext").click(),n(r[l].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(this.element.find("div.e-navigatenext").click(),n(this.element.find("div.e-draggableworkarea tr")[f].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(i).hasClass("e-monthcells")){var a=Math.floor(n(i).index()/7),b=r.length-1,v=resmaxcolindex=7*(parseInt(a)+1),w=7*parseInt(a),f=n(i).parent()[0].rowIndex,u=n(i)[0].cellIndex,o=parseInt(u)+1;o<v&&(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus());u==parseInt(resmaxcolindex)-1&&f<this._dateRender.length/7&&(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),s=parseInt(f)+1,u=w,s<this._dateRender.length/7?(n(r[s].cells[u]).addClass("e-selectedCell").attr("tabIndex",0).focus(),o<v&&n(r[s].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(y=u/7,this.element.find("div.e-navigatenext").click(),p=t.isNullOrUndefined(this.model.group)?0:y*7,n(this.element.find(".e-monthcells")[p]).addClass("e-selectedCell").attr("tabIndex",0).focus()));this._selectCurrentMonth(r,f,u)}else if(n(i).hasClass("e-alldaycells"))if(e=this.element.find("td.e-selectedCell")[0].cellIndex,h=parseInt(this.element.find(".e-alldaycells").length)-1,e>=0&&e<h)n(this.element.find(".e-alldaycells")[e]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-alldaycells")[parseInt(e)+1]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(e==h)this.element.find("div.e-navigatenext").click(),n(this.element.find(".e-alldaycells")[0]).addClass("e-selectedCell").attr("tabIndex",0).focus();else return!1;this._keyPressed=!0},_processLeft:function(i,r){var l,f,u,h,w,b,k,d,e,c;if(n(i).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):n(i).hasClass("e-selectedCell")&&this._addCellSelection(r),n(i).hasClass("e-workcells")){var o=r[0].cells.length,f=this.element.find("td.e-selectedCell").parent()[0].rowIndex,u=this.element.find("td.e-selectedCell")[0].cellIndex,s=parseInt(u)-1;if(u>0&&u<=parseInt(o)-1&&u!="undefined")n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(u==0)this.currentView()!="month"?(l=n(i).parent()[0].rowIndex,this.element.find("div.e-navigateprevious").click(),n(r[l].cells[o-1]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(this.element.find("div.e-navigateprevious").click(),n(this.element.find("div.e-draggableworkarea tr")[f].cells[this.totdays.length-1]).addClass("e-selectedCell").attr("tabIndex",0).focus());else return!1}else if(n(i).hasClass("e-monthcells")){var a=Math.floor(n(i).index()/7),nt=r.length-1,v=7*(parseInt(a)+1),g=7*parseInt(a),y=this.currentView()=="day"?1:this.currentView()=="workweek"?this.model.workWeek.length:7,p=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?y:this.currentView()=="month"?this.totdays.length:y*(this.model.endHour-this.model.startHour)*2;o=this._tempResource.length!=0&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.render_Resources[this.render_Resources.length-1].length*p:p;f=this.element.find("td.e-selectedCell").parent()[0].rowIndex;u=this.element.find("td.e-selectedCell")[0].cellIndex;u==g&&f>=0?(h=parseInt(f)-1,w=parseInt(v)-1,h>=0?(n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[h].cells[w]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(b=u/7,this.element.find("div.e-navigateprevious").click(),k=this._dateRender.length/7,d=t.isNullOrUndefined(this.model.group)?0:b*7,n(this.element.find("div.e-draggableworkarea tr")[k-1].cells[d+6]).addClass("e-selectedCell").attr("tabIndex",0).focus())):u<v&&(s=parseInt(u)-1,n(r[f].cells[u]).removeClass("e-selectedCell").blur(),n(r[f].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus());this._selectCurrentMonth(r,f,u)}else if(n(i).hasClass("e-alldaycells"))if(e=this.element.find("td.e-selectedCell")[0].cellIndex,c=parseInt(this.element.find(".e-alldaycells").length)-1,e>0&&e<=c)n(this.element.find(".e-alldaycells")[e]).removeClass("e-selectedCell").blur(),n(this.element.find(".e-alldaycells")[parseInt(e)-1]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(e==0)this.element.find("div.e-navigateprevious").click(),n(this.element.find(".e-alldaycells")[c]).addClass("e-selectedCell").attr("tabIndex",0).focus();else return!1;this._keyPressed=!0},_selectCurrentMonth:function(t,i,r){t.find(".e-selectedCell").hasClass("e-othermonths")&&(t.find(".e-selectedCell").removeClass("e-selectedCell").blur(),n(t[i].cells[r]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_navigateToolbarRight:function(n){var t=this.model.views,i=this.element.find(".e-commonviewbutton.e-"+this.currentView()).parent().index(),r;i<t.length-1&&(r=t[i+1].toLowerCase(),this._navView=!0,this._viewChange(n,this.currentView(),r),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}))},_navigateToolbarLeft:function(n){var t=this.element.find(".e-commonviewbutton.e-"+this.currentView()).parent().index(),i;t>0&&(i=this.model.views[t-1].toLowerCase(),this._navView=!0,this._viewChange(n,this.currentView(),i),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}))},_newAppWindow:function(i){var u,f,b,v,k,w;if(n(i).hasClass("e-selectedCell")){t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow();this._currentAction=t.Schedule.Actions.Add;var h=i==null?w:i,ut=n(h).parent().index(),ft=n(h).index(),r=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="month"?this.monthDays:this.model.orientation=="vertical"&&this._customOrientation=="vertical"||this.currentView()=="customview"&&this._dateRender.length<=7?this.dateRender:this._dateRender;if(r=(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()=="customview"&&this._dateRender.length<=7?this._dateRender:r,u=parseInt(this.element.find("td.e-selectedCell").length)-1,_target=n(h),this._cellIndex=this.model.timeScale.enable?_target.hasClass("e-workcells")?_target.index():_target.hasClass("e-alldaycells")?_target.index():this._isCustomMonthView()&&this._oneWeek?_target.index():7-((parseInt(_target.index()/7)+1)*7-_target.index())+_target.parent().index()*7:this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this.currentView()=="month"||this.currentView()=="customview"&&this._dateRender.length>=7?7-((parseInt(_target.index()/7)+1)*7-_target.index())+_target.parent().index()*7:_target.index(),(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&(this._cellIndex=this.model.timeScale.enable?this.currentView()!=="month"&&!this._isCustomMonthView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*2)):this._cellIndex:_target.index(),this._workCellIndex=_target.parent().index()),u==0){if(f=new Date(r[this._cellIndex]),this.model.minDate>f||this.model.maxDate<f)return!1;_target.hasClass("e-workcells")&&this.model.timeScale.enable&&this.currentView()!=="month"&&!this._isCustomMonthView()?(b=this.model.orientation=="vertical"&&this._customOrientation=="vertical"?this.model.startHour+_target.parent().index()/2:this.model.startHour+(_target.index()-(this.model.endHour-this.model.startHour)*2*this._cellIndex)/2,v=b.toString().split("."),startTime=new Date(f).setHours(parseInt(v[0]),parseInt(v[1])==5?30:0),k=parseInt(new Date(startTime).getHours())==23&&parseInt(new Date(startTime).getMinutes())==30?new Date(startTime).getMinutes()+29:ne
10w Date(startTime).getMinutes()+30,endTime=new Date(new Date(startTime).setMinutes(k)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1})):(startTime=new Date(new Date(f).setHours(0,0,0)),endTime=new Date(new Date(f).setHours(23,59,59)),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}))}else if(u>0){var c=this._findMinMaxCellIndex(),l=c.omincolIndex,a=c.omaxcolIndex,d=c.rowInx,g=c.maxrowInx;if(this.model.orientation=="vertical"&&this._customOrientation=="vertical")if(n(i).hasClass("e-workcells")){var y=r[l],p=r[a],e=(this.model.startHour+d/2).toString().split("."),o=(this.model.startHour+g/2).toString().split(".");startTime=new Date(new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:0));endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:0);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else if(n(i).hasClass("e-monthcells")){var s=this.element.find("td.e-selectedCell"),nt=n(s[0]).parent().index()*7+(n(s[0]).index()-Math.floor(n(s[0]).index()/7)*7),tt=n(s[u]).parent().index()*7+(n(s[u]).index()-Math.floor(n(s[u]).index()/7)*7),it=new Date(this._dateRender[nt]),rt=new Date(this._dateRender[tt]);startTime=new Date(new Date(it).setHours(0,0,0));endTime=new Date(new Date(rt).setHours(23,59,59))}else n(i).hasClass("e-alldaycells")&&(startTime=new Date(new Date(r[l]).setHours(0,0,0)),endTime=new Date(new Date(r[a]).setHours(23,59,59)));else if(this.currentView()!="month"&&!this._isCustomMonthView()&&this.model.timeScale.enable){var y=r[0],p=r[0],e=(this.model.startHour+l/2).toString().split("."),o=(this.model.startHour+a/2).toString().split(".");startTime=new Date(new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:0));endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:0);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else{var y=this.totdays[l],p=this.totdays[a],e=this.model.startHour.toString().split("."),o=this.model.startHour.toString().split(".");startTime=new Date(y).setHours(parseInt(e[0]),parseInt(e[1])==5?30:0);endTime=new Date(p).setHours(parseInt(o[0]),parseInt(o[1])==5?30:0);endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30));endTime=new Date(new Date(endTime).setHours(23,59,59))}}if(w={startTime:new Date(startTime),endTime:new Date(endTime),target:_target,resources:(this.model.appointmentWindowOpen!=null||this.model.cellDoubleClick!=null)&&this._tempResource.length!=0?this._getResourceValue(_target):null},this._trigger("appointmentWindowOpen",w))return!1;t.scheduleFeatures.resources&&this._tempResource.length!=0&&this._renderResourceData(n(h),this._cellIndex);this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value",new Date(startTime));this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value",new Date(endTime));this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value",t.format(new Date(startTime),this._pattern.t,this.model.locale));this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(endTime),this._pattern.t,this.model.locale));(n(i).hasClass("e-alldaycells")||this.currentView()=="month"||this._isCustomMonthView())&&this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0});this._timeZoneCollection(null);this._tempStart=this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value");this._tempEnd=this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value");this._alldayCheck();this.model.readOnly||(this._appointmentAddWindow.find(".e-appsave,#"+this._id+"donerecur").ejButton("enable",!0),this._mediaQuery&&this._appointmentAddWindow.find(".e-btndelete").css("display","none"),this._appointmentAddWindow.ejDialog("open"));this._appointmentAddWindow.find(".subject").focus();this._cellClick=!1}},_tooltipEvents:function(n){var i;n=="disable"?t.isNullOrUndefined(this.element.data("ejTooltip"))||(i=this.element.ejTooltip("instance"),i._wireEvents(!1)):t.isNullOrUndefined(this.element.data("ejTooltip"))||(i=this.element.ejTooltip("instance"),i._wireEvents(!0))},_showToolTip:function(i){var i=i.event,u,r,f;if(t.isNullOrUndefined(i.target))return!1;if(u=this.element.data("ejTooltip"),n(i.target).hasClass("e-appup")||n(i.target).hasClass("e-appdown"))return u.setModel({content:this._getLocalizedLabels("AppointmentIndicator")}
10),!0;if(n(i.target).hasClass("e-appsoverflow"))return this._showAppCount(i);if(this.model.tooltipSettings.enable&&!t.isTouchDevice()){if(r=this._getAppDetails(i.currentTarget),r==!1)return!1;if(t.isNullOrUndefined(this.model.tooltipSettings.templateId))var e=this._timeMode=="12"?t.format(r[this._appointmentSettings.startTime],this._pattern.t,this.model.locale):t.format(r[this._appointmentSettings.startTime],"HH:mm",this.model.locale),o=this._timeMode=="12"?t.format(r[this._appointmentSettings.endTime],this._pattern.t,this.model.locale):t.format(r[this._appointmentSettings.endTime],"HH:mm",this.model.locale),s=r[this._appointmentSettings.subject]==""||t.isNullOrUndefined(r[this._appointmentSettings.subject])?this._getLocalizedLabels("NoTitle"):r[this._appointmentSettings.subject],f=s+": ("+e+"-"+o+")";else f=n(this.model.tooltipSettings.templateId).render(r).trim();return u.setModel({content:f}),!0}return!1},_showAppCount:function(i){var f=i.target.id.split("_"),l=this.currentView()!="day"?new Date(parseInt(n(i.currentTarget).attr("data-cellinfo"))):new Date(n(i.currentTarget).attr("data-cellinfo")),a,r,s,h,u,c,b;if(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)&&(a=this._resourceSort()[parseInt(f[f.length-2])].id),(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&this.currentView()!="month")var k=parseInt(f[f.length-1]),v=new Date(l.setMilliseconds((this.model.startHour*60+k*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*6e4)),d=new Date(v.setMilliseconds(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4));if(r=n.templates(n(this.model.appointmentTemplateId).html()),s=this.element.find(".e-appsoverflow").height(),this.model.orientation=="vertical"&&this._customOrientation=="vertical"){var y=this.element.find(".e-monthcells").outerHeight(),e=this.element.find(".e-monthappointment").outerHeight(),g=this.element.find(".e-monthheader").height();t.isNullOrUndefined(e)&&(e=this.model.appointmentTemplateId?n(r.markup).css("height")=="100%"?y-this.element.find(".e-monthheader").height()-15:n(r.markup).css("height")=="0px"?20:n(r.markup).height():19);var p=parseInt(n(i.currentTarget).attr("data-appcount")),w=p*e+g+s,o=Math.round((w-y)/e);o=o==0?1:o}else{h=this.element.find(".e-workcells")[0].offsetHeight;u=this.currentView()=="month"?u=this.element.find(".e-monthappointment").outerHeight():this.element.find(".e-appointment").height();t.isNullOrUndefined(u)&&(u=this.model.appointmentTemplateId?n(r.markup).css("height")=="100%"?h-15:n(r.markup).css("height")=="0px"?20:n(r.markup).height():20);var s=this.element.find(".e-appsoverflow").height(),p=parseInt(n(i.currentTarget).attr("data-appcount")),w=p*u+s,o=Math.ceil((w-h)/u)}return(c={Date:l,ResourceValue:a,StartTime:v,EndTime:d},this._overflowApp=c,b=this.element.data("ejTooltip"),this._trigger("overflowButtonHover",{event:i,datas:c}))?!1:(b.setModel({content:o+" "+this._getLocalizedLabels("OverFlowAppCount")}),!0)},_horizontalRender:function(){var u,i,r,n,f;t.isNullOrUndefined(this.model.group)||this._tempResource.length==0||this.element.find(".resemptytd").width(this.element.find(".e-horizontalrestd").width()<100?5:this.element.find(".e-horizontalrestd").width()>=100&&this.element.find(".e-horizontalrestd").width()<=150?10:25);this._mediaQuery?this.element.find(".e-parentnode,.e-childnode").css({height:this.element.find(".e-workcells").height()}):(u=this._tempResource.length==0?this.res1.length:this._resourceSort().length,i=this.element.find("div#"+this._id+"_scroller").ejScroller("isHScroll")?this.element.find("div#"+this._id+"_scroller").find(".e-hscroll").outerHeight():0,i=t.isNullOrUndefined(i)?0:i,r=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top+i),t.isNullOrUndefined(this.model.group)||this._tempResource.length==0?this.element.find(".e-workcells").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):Math.round(r-1)+"px"}):(n=Math.round(r/u)-1,n=n<20?20:n,this.element.find(".e-workcells").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.element.find(".e-childnode").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.element.find(".e-parentnode").css({height:this.model.cellHeight?parseInt(this.model.cellHeight):n+"px"}),this.currentView()!="agenda"&&(f=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css({top:-f+"px"}))));this.element.find(".e-workcells").height()>r&&this.element.find("div#"+this._id+"_scroller").ejScroller("refresh");this.element.find("div#"+this._id+"_scroller").ejScroller("isVScroll")&&this._showScrollTd()},_monthCellsRender:function(){var n=this.element.find(".e-workcellstab tr").length,t=parseInt(this.scHeight)-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top);this.element.find(".e-monthcells, .e-timecells").outerHeight(this.model.cellHeight?parseInt(this.model.cellHeight)+1:Math.round(t/n))},_processTab:function(t,i,r){var u=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment"),h,c,o,e,f,s;if((t.id==this._id||n(t).hasClass("e-datedisplay"))&&(u.length!=0?n(u[0]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),n(t).hasClass("e-selectedCell")&&u.length!=0){if(h=this.element.find("td.e-selectedCell"),c=parseInt(h.length)-1,c>0)for(o=0;o<=c;o++)h.eq(o).removeClass("e-selectedCell").blur();else n(t).removeClass("e-selectedCell").blur();n(u[0]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}n(t).hasClass("e-navigateprevious")?this.element.find(".e-navigatenext").attr("tabIndex",0).focus():n(t).hasClass("e-navigatenext")&&(n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(r[0].cells[0]).hasClass("e-resourceheadercells")&&n(r[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());(n(t).hasClass("e-appointment")||n(t).hasClass("e-alldayappointment")||n(t).hasClass("e-monthappointment")||n(t).hasClass("e-agendaappointment"))&&(e=u.length,f=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),f<e&&f>=0?(n(u[f]).removeClass("e-selectedAppointment").blur(),s=parseInt(f)+1,s<e?n(u[s]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():s==e&&this.element.find(".e-navigateprevious").attr("tabIndex",0).focus()):f==e&&this.element.find(".e-navigateprevious").attr("tabIndex",0).focus())},_reverseTab:function(t,i,r){var u=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment"),h,e,c,l,o,f,s;if((t.id==this._id||n(t).hasClass("e-datedisplay"))&&(e=parseInt(u.length)-1,u.length!=0&&n(u[e]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()),h=u.length,n(t).hasClass("e-selectedCell")&&(e=u.length-1,u.length!=0)){if(c=this.element.find("td.e-selectedCell"),l=parseInt(c.length)-1,l>0)for(o=0;o<=l;o++)c.eq(o).removeClass("e-selectedCell").blur();else n(t).removeClass("e-selectedCell").blur();n(u[e]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}n(t).hasClass("e-navigatenext")?n(this.element).find(".e-navigateprevious").attr("tabIndex",0).focus():n(t).hasClass("e-navigateprevious")&&(n(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),n(r[0].cells[0]).hasClass("e-resourceheadercells")&&n(r[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus());(n(t).hasClass("e-appointment")||n(t).hasClass("e-alldayappointment")||n(t).hasClass("e-monthappointment")||n(t).hasClass("e-agendaappointment"))&&(f=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),f<h&&f>0?(n(u[f]).removeClass("e-selectedAppointment").blur(),s=parseInt(f)-1,s<h&&f>=0?n(u[s]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():s==0&&n(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()):f==0&&(n(u[f]).removeClass("e-selectedAppointment").blur(),n(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()))},_stopDefaultAction:function(n){n.cancelBubble=!0;n.returnValue=!1;n.stopPropagation();n.preventDefault()},_getLocalizedLabels:function(n){return n=="Categorize"?t.isNullOrUndefined(this.model.categorizeSettings.title)?this._localizedLabels[n]===i?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]:this.model.categorizeSettings.title:n=="Priority"?t.isNullOrUndefined(this.model.prioritySettings.title)?this._localizedLabels[n]===i?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]:this.model.prioritySettings.title:this._localizedLabels[n]===i?t.Schedule.Locale["en-US"][n]:this._localizedLabels[n]},_refreshDatasource:function(){var i,n,r;if(!t.isNullOrUndefined(this.dataSource())&&this.dataSource().length>0)for(i=this.dataSource(),n=0,r=i.length;n<r;n++)this._timeZoneAppointments(i[n],"")},refreshAppointments:function(){t.isNullOrUndefined(this._appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():this.dataSource()!=null?t.DataManager(this.dataSource()):null);this._refreshDatasource();this._bindAppointmentsData("Refresh")},refresh:function(){this._refreshDatasource();var n=this._getSetScrollPosition();this._destroy();this._init();this._getSetScrollPosition(n)},getSlotByElement:function(i){var r=t.isNullOrUndefined(i)?n(this.element.find("td.e-selectedCell")):n(i);return t.isNullOrUndefined(r)||r.length==0||this.currentView()=="agenda"?!1:((r.hasClass("e-workcells")||r.hasClass("e-monthcells")||r.hasClass("e-alldaycells"))&&(r.length==1?this._slotByElement(r,""):this._slotByCellSelect(r)),{startTime:new Date(this.cur_StartTime),endTime:new Date(this.cur_EndTime),resources:!t.
10isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this._getResourceValue(r):null})},saveAppointment:function(i){var ut,oi,tt,ti,g,r,s,v,bt,ct,vt,f,it,kt,ri,ui,yt,c,at,e,b,lt,fi,ei,nt,ot,d,ft,h,ni,pt,rt,k,wt,p;if(!this.model.readOnly){if(t.isNullOrUndefined(this._appointmentAddWindow)&&this._renderAppointmentWindow(),t.isNullOrUndefined(this._appointmentAddWindow)||this._appointmentAddWindow.find(".e-recurEditor").length!=0||this._renderRecurrenceEditor(),t.isNullOrUndefined(this._appointmentAddWindow)&&t.RecurrenceEditor.prototype._initializePrivateProperties(),ut=t.isNullOrUndefined(this._appointmentAddWindow)?t.RecurrenceEditor.prototype:this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor"),oi=this._sortAppById(this._processed),this._publicMethodSave=!1,this.model.appointmentSettings.applyTimeOffset&&(t.isNullOrUndefined(i[this._appointmentSettings.startTimeZone])&&(i[this._appointmentSettings.startTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone),t.isNullOrUndefined(i[this._appointmentSettings.endTimeZone])&&(i[this._appointmentSettings.endTimeZone]=this.model.timeZone==null?"UTC "+this._timezoneStringValue():this.model.timeZone)),t.isNullOrUndefined(this.model.serverEvents)&&this._dataManager.dataSource.offline&&(ti=this._timeZoneSavingAppoint(i,""),i=ti.obj),t.isNullOrUndefined(i[this._appointmentSettings.id])&&!i[this._appointmentSettings.id]!=""||(g=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i[this._appointmentSettings.id])),t.isNullOrUndefined(g[0])||(i.Guid=g[0].Guid,i.AppTaskId=g[0].AppTaskId,i[this._appointmentSettings.recurrenceId]=g[0][this._appointmentSettings.recurrenceId],i[this._appointmentSettings.recurrenceExDate]=g[0][this._appointmentSettings.recurrenceExDate],i.ParentId=g[0].ParentId)),r=this,this._maxId=tt=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,s=this._currentAction=="save"?"edit":this._currentAction,t.isNullOrUndefined(i.AppTaskId)||i.AppTaskId==""){if((i[this._appointmentSettings.id]=t.isNullOrUndefined(i[this._appointmentSettings.id])||i[this._appointmentSettings.id]==""?tt:i[this._appointmentSettings.id],i.AppTaskId=i.ParentId=tt,i.Guid=this._guidFormatGenerate(),this._trigger("actionBegin",{data:i,requestType:"appointmentSave",methodType:"public"}))||(t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentCreate")==-1||this._timeZoneAppointments(i,""),this._trigger("beforeAppointmentCreate",{appointment:i,methodType:"public"})))return!1;for(v=t.isNullOrUndefined(this.model.serverEvents)?this._timeZoneAppointments(i,""):i,h=this._dataManager.insert(v,this.model.appointmentSettings.query._fromTable),t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentCreate")==-1?new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(v,"reverse")):new t.DataManager(this._currentAppointmentData).update("AppTaskId",v),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(v),this._appointmentProcessing(i),this._currentViewAppointments=this.getCurrentViewAppointments(),bt=this._currentViewAppointments.filter(function(n){return i.ParentId==n.ParentId}),ct=0,p=bt.length;ct<p;ct++)this._refreshDayAppointments(bt[ct]);this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId;this._trigger("appointmentCreated",{appointment:v,requestType:"appointmentSaved",methodType:"public"});this._trigger("actionComplete",{data:v,requestType:"appointmentSave",methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var u=t.isNullOrUndefined(i.record)?i:i.record,f,e;if(n.isArray(u)||n.isPlainObject(u)&&t.isNullOrUndefined(u.added))r._processUrlBinding(i);else if(n.isPlainObject(u)&&!t.isNullOrUndefined(u.added)&&u.added.length>0)for(r._dateFormat(u.added),f=0,e=u.added.length;f<e;f++)v[r._appointmentSettings.id]=u.added[f][r._appointmentSettings.id],v[r._appointmentSettings.recurrence]||(v.ParentId=u.added[f][r._appointmentSettings.id]),new t.DataManager(r._processed).update("Guid",v)})}else if(this._currentAction=="editOccurrence"){if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:s})||(b=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,i[this._appointmentSettings.id])),t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentChange")==-1||(b=[this._timeZoneAppointments(b[0],"")],i=this._timeZoneAppointments(i,"")),lt=i[this._appointmentSettings.recurrence]?{appointment:i,
10currentAction:s,recurrenceCollection:{occurrences:i,parentData:b[0]}}:{appointment:i,currentAction:s},this._trigger("beforeAppointmentChange",lt)))return!1;var w=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],at=w[this._appointmentSettings.recurrenceId]==null?w.ParentId:w[this._appointmentSettings.recurrenceId],vt=w[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,l=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(vt,t.FilterOperators.equal,at))),a=this._recuCollectionIndex(l,w),o=this._appointmentSettings;if(a==0?t.isNullOrUndefined(l[a+1])?!1:!(new Date(new Date(l[a+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()):a==l.length-1?!(new Date(new Date(l[a-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(l[a-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(l[a+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1;c=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid));this._objDate=c;vt=this._objDate[0][this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId;e=this._deleteOcurrence(this._objDate[0][vt],new Date(c[0][this._appointmentSettings.startTime]));i[this._appointmentSettings.recurrence]=!0;i[this._appointmentSettings.recurrenceRule]=e[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+e[0].ParentId;i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId];i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExdate];i.Guid=c[0].Guid;i[this._appointmentSettings.id]=c[0][this._appointmentSettings.id];f=[];it=this._addAppData(i,tt,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),i[this._appointmentSettings.recurrenceId]);it[this._appointmentSettings.id]=it.AppTaskId;f.push(it);var y=[],e=[],ii=f[0][this._appointmentSettings.startTimeZone];for(t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentChange")==-1?y.push(this._timeZoneAppointments(f[0],"")):y.push(f[0]),kt=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,this._parentId)),t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentChange")==-1?e.push(this._timeZoneAppointments(kt[0],"")):e.push(kt[0]),ft=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:y,changed:e,deleted:[]},ft,this.model.appointmentSettings.query._fromTable),ri=t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentCreate")==-1?ii!=this.model.timeZone?this._timeZoneAppointments(y[0],"reverse"):y[0]:y[0],new t.DataManager(this._currentAppointmentData).update("AppTaskId",ri),ui=t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentCreate")==-1?ii!=this.model.timeZone?this._timeZoneAppointments(e[0],"reverse"):e[0]:e[0],new t.DataManager(this._currentAppointmentData).update("AppTaskId",ui),this.dataSource()instanceof t.DataManager&&this._currentAppointmentData.push(f[0]),yt=this._processed.filter(function(n){return n.Guid==f[0].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:yt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:yt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:yt},"Guid"),this._appointmentProcessing(f[0]),this._currentViewAppointments=this.getCurrentViewAppointments(),rt=this._currentViewApp
10ointments.filter(function(n){return n.ParentId==f[0].ParentId}),k=0,p=rt.length;k<p;k++)this._refreshDayAppointments(rt[k]);this._trigger("appointmentChanged",{appointment:f[0],requestType:"appointmentChanged",currentAction:s,methodType:"public"});this._trigger("actionComplete",{data:f,requestType:"appointmentEdit",currentAction:s,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var u=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(u)||n.isPlainObject(u)&&t.isNullOrUndefined(u.added))r._processUrlBinding(i);else if(n.isPlainObject(u)&&!t.isNullOrUndefined(u.added)&&u.added.length>0)for(r._dateFormat(u.added),e=0,o=u.added.length;e<o;e++)f[0][r._appointmentSettings.id]=u.added[e][r._appointmentSettings.id],f[0][r._appointmentSettings.recurrence]||(f[0].ParentId=u.added[e][r._appointmentSettings.id]),new t.DataManager(r._processed).update("Guid",f[0])})}else if(this._currentAction=="save"&&i[this._appointmentSettings.recurrence]||this._currentAction==t.Schedule.Actions.EditSeries){if(c=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._currentAction!=t.Schedule.Actions.EditSeries){t.isNullOrUndefined(c[0][this._appointmentSettings.recurrenceRule])||(i[this._appointmentSettings.recurrenceRule]=c[0][this._appointmentSettings.recurrenceRule]);var w=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],at=w[this._appointmentSettings.recurrenceId]==null?w.ParentId:w[this._appointmentSettings.recurrenceId],vt=w[this._appointmentSettings.recurrenceId]==null?"ParentId":this._appointmentSettings.recurrenceId,l=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(vt,t.FilterOperators.equal,at))),a=this._recuCollectionIndex(l,w),o=this._appointmentSettings;if(a==0?t.isNullOrUndefined(l[a+1])?!1:!(new Date(new Date(l[a+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()):a==l.length-1?!(new Date(new Date(l[a-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()):!(new Date(new Date(l[a-1][o.endTime]).setHours(0,0,0,0)).getTime()<new Date(new Date(i[o.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(l[a+1][o.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[o.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1}else at=c[0][this._appointmentSettings.recurrenceId]==null?c[0].ParentId:c[0][this._appointmentSettings.recurrenceId],e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,at)),tt=i.AppTaskId=e[0].AppTaskId,i[this._appointmentSettings.id]=e[0][this._appointmentSettings.id],i[this._appointmentSettings.recurrenceId]=e[0][this._appointmentSettings.recurrenceId],i[this._appointmentSettings.recurrenceExDate]=e[0][this._appointmentSettings.recurrenceExDate],i[this._appointmentSettings.recurrenceRule]=t.isNullOrUndefined(ut._recRule)||ut._recRule==""?e[0][this._appointmentSettings.recurrenceRule]:ut._recRule;i.Guid=c[0].Guid;i[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?c[0][this._appointmentSettings.id]:i[this._appointmentSettings.id];var f=[],it,dt=this._currentAction==t.Schedule.Actions.EditOccurrence||!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?this._parentId:this._currentAction==t.Schedule.Actions.Save?c[0].AppTaskId:tt,gt=(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5>24&&this._currentAction!=t.Schedule.Actions.EditOccurrence&&i[this._appointmentSettings.allDay]==!0?dt:this._currentAction==t.Schedule.Actions.Save?c[0].AppTaskId:this._appMainId+1;if((gt=this._currentAction==t.Schedule.Actions.EditSeries?dt:gt,it=this._addAppData(i,gt,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),dt),f.push(it),this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:s}))||(b=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,i[this._appointmentSettings.id])),t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("beforeAppointmentChange")==-1||(b=[this._timeZoneAppointments(b[0],"")],i=this._timeZoneAppointments(i,"")),lt=i[this._appointmentSettings.recurrence]?{appointment:i,
10currentAction:s,recurrenceCollection:{occurrences:i,parentData:b[0]}}:{appointment:i,currentAction:s},this._trigger("beforeAppointmentChange",lt)))return!1;this._currentAction!=t.Schedule.Actions.EditSeries||t.isNullOrUndefined(i.RecurrenceExDate)||(this._isCustomAlert=!0);var y=[],u=[],et=[],si=this._currentAction==t.Schedule.Actions.Save?f[0].Guid:f[0][this._appointmentSettings.recurrenceId],hi=this._currentAction==t.Schedule.Actions.Save?"Guid":this._appointmentSettings.recurrenceId,e=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where(hi,t.FilterOperators.equal,si));if(!t.isNullOrUndefined(e)&&e.length>0?u.push(f[0]):y.push(f[0]),this._currentAction==t.Schedule.Actions.EditSeries)for(fi=t.Query().where(t.Predicate(this._appointmentSettings.recurrenceRule,t.FilterOperators.contains,"RECUREDITID="+f[0].ParentId,!0)),ei=new t.DataManager(this._currentAppointmentData).executeLocal(fi),et=et.concat(ei),u[0][this._appointmentSettings.recurrenceRule]=ut._recRule,u[0][this._appointmentSettings.recurrenceExDate]=null,nt=this._processed.filter(function(n){return n.ParentId==u[0].ParentId}),new t.DataManager(this._currentAppointmentData).remove("ParentId",u[0].ParentId),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:nt},"ParentId"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:nt},"ParentId"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:nt},"ParentId"),ot=0,p=nt.length;ot<p;ot++)this._appointmentRemove(nt[ot]),this._refreshDayAppointments(nt[ot]);else if(u.length>0)for(d=0;d<u.length;d++)new t.DataManager(this._processed).remove("Guid",u[d].Guid),new t.DataManager(this._renderedApp).remove("Guid",u[d].Guid),new t.DataManager(this._renderedAllDay).remove("Guid",u[d].Guid),this._appointmentRemove(u[d]),this._refreshDayAppointments(u[d]);var r=this,st=[],ht=[];for(y.length>0&&(t.isNullOrUndefined(this.model.serverEvents)?st.push(this._timeZoneAppointments(y[0],"")):st.push(y[0])),u.length>0&&(t.isNullOrUndefined(this.model.serverEvents)?ht.push(this._timeZoneAppointments(u[0],"")):ht.push(u[0])),ft=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.saveChanges({added:st,changed:ht,deleted:et},ft,this.model.appointmentSettings.query._fromTable),u.length>0&&(ni=t.isNullOrUndefined(this.model.serverEvents)?ht[0]:this._timeZoneAppointments(ht[0],"reverse")),y.length>0&&(ni=t.isNullOrUndefined(this.model.serverEvents)?st[0]:this._timeZoneAppointments(st[0],"reverse")),new t.DataManager(this._currentAppointmentData).update("AppTaskId",ni),new t.DataManager(this._currentAppointmentData).remove("Guid",u[0]),pt=this._processed.filter(function(n){return n.Guid==u[0].Guid}),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:pt},"Guid"),new t.DataManager(this._renderedApp).saveChanges({added:[],changed:[],deleted:pt},"Guid"),new t.DataManager(this._renderedAllDay).saveChanges({added:[],changed:[],deleted:pt},"Guid"),this._currentAppointmentData.push(u[0]),this._appointmentProcessing(u[0]),this._currentViewAppointments=this.getCurrentViewAppointments(),rt=this._currentViewAppointments.filter(function(n){return n.ParentId==u[0].ParentId}),k=0,p=rt.length;k<p;k++)this._refreshDayAppointments(rt[k]);for(wt=0,p=et.length;wt<p;wt++)this._refreshDayAppointments(et[wt]);this._trigger("appointmentChanged",{appointment:u[0],requestType:"appointmentChanged",currentAction:s,methodType:"public"});this._trigger("actionComplete",{data:u,requestType:"appointmentEdit",currentAction:s,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(i){var f=t.isNullOrUndefined(i.record)?i:i.record,e,o;if(n.isArray(f)||n.isPlainObject(f)&&t.isNullOrUndefined(f.added))r._processUrlBinding(i);else if(n.isPlainObject(f)&&!t.isNullOrUndefined(f.added)&&f.added.length>0)for(r._dateFormat(f.added),e=0,o=f.added.length;e<o;e++)u[0][r._appointmentSettings.id]=f.added[e][r._appointmentSettings.id],u[0][r._appointmentSettings.recurrence]||(u[0].ParentId=f.added[e][r._appointmentSettings.id])})}else{if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit",currentAction:s,methodType:"public"}
10)||this._trigger("beforeAppointmentChange",{appointment:i,currentAction:s,methodType:"public"}))return!1;var v=this._timeZoneAppointments(i,""),ft=this.dataSource()instanceof t.DataManager?this._appointmentSettings.id:"AppTaskId",h=this._dataManager.update(ft,v,this.model.appointmentSettings.query._fromTable);new t.DataManager(this._currentAppointmentData).update("AppTaskId",this._timeZoneAppointments(v,"reverse"));this._renderSingleApp();this._trigger("appointmentChanged",{appointment:i,requestType:"appointmentChanged",currentAction:s,methodType:"public"});this._trigger("actionComplete",{data:i,requestType:"appointmentEdit",currentAction:s,methodType:"public"});!t.isNullOrUndefined(h)&&n.isFunction(h.promise)&&this.dataSource()instanceof t.DataManager&&h.done(function(u){var f=t.isNullOrUndefined(u.record)?u:u.record,e,o;if(n.isArray(f)||n.isPlainObject(f)&&t.isNullOrUndefined(f.added))r._processUrlBinding(u);else if(n.isPlainObject(f)&&!t.isNullOrUndefined(f.added)&&f.added.length>0)for(r._dateFormat(f.added),e=0,o=f.added.length;e<o;e++)i[r._appointmentSettings.id]=f.added[e][r._appointmentSettings.id],i[r._appointmentSettings.recurrence]||(i.ParentId=f.added[e][r._appointmentSettings.id])})}this._currentViewAppointments=this.getCurrentViewAppointments();this.model.showAppointmentNavigator&&this._nextPrevButton()}},print:function(i){if(t.isNullOrUndefined(i)){var r=this.element.clone();this.currentView()=="agenda"?(r.width(this.element.find(".e-agendacellstab").width()+2),r.height(n("#"+this._id+" .e-headertr").height()+this.element.find(".e-agendacellstab").height()+n("#"+this._id+" .e-scheduleheader").height()+2),r.find("div#"+this._id+"_scroller").ejScroller({width:this.element.find(".e-agendacellstab").width(),height:this.element.find(".e-agendacellstab").height()+2}),r.find(".e-commonviewbutton").css({"margin-top":"0px"}),r.find(".e-viewstable").css({"padding-top":"15px"})):(r.find(".e-upicon,.e-downicon").remove(),this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(r.find(".e-borderleft").remove(),this.model.timeScale.enable?(r.width(this.element.find(".e-scheduleoutertable").width()),r.height(n("#"+this._id+" .e-headertr").height()+n("#"+this._id+" .e-workcellstab").height()+n("#"+this._id+" .e-scheduleheader").height()+2),r.find(".e-scroller").ejScroller({width:n(".e-dateheader").width(),height:n("#"+this._id+" .e-workcellstab").height()+2}),r.find(".e-scrolltimecells").css({top:0}),r.find(".e-commonviewbutton").css({"margin-top":"0px"}),r.find(".e-viewstable").css({"padding-top":"15px"}),r.children().first().css({border:"0px solid #bbbcbb"}),r.css({border:"1px solid #bbbcbb"}),this.currentView()=="month"&&r.find(".e-draggableworkarea").css({height:this.element.find(".e-timecells").height()*this.element.find(".e-timecells").length+2})):(r.width(this.element.find(".e-scheduleoutertable").width()),r.find(".e-workcellstab").css({left:-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"}))):this.currentView()=="month"||this._isCustomMonthView()&&this._renderDays>7?r.width(this.element.find(".e-scheduleoutertable").width()):(r.width(this.element.find(".e-scheduleoutertable").width()),r.find(".e-workcellstab").css({left:-n("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"}),r.find(".e-horizontaltimecells tr:nth-child(2)").css("left",this.model.enableRTL?this.element.find("div#"+this._id+"_scroller").data("ejScroller").scrollLeft()+"px":-this.element.find("div#"+this._id+"_scroller").data("ejScroller").scrollLeft())));this._schedulePrint(r)}else this._printAppointment(i)},_schedulePrint:function(i,r){var f=t.buildTag("div"),o=i.clone(),s=Math.round(o.width()/100)*100,r,e,u;f.append(o);r||(r=window.open("","print","height=452,width="+s+",tabbar=no"));r.document.write("<!DOCTYPE html>");e=n("head").find("link").add("style");t.browserInfo().name==="msie"?(u="",e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.write("<html><head><\/head><body>"+u+f[0].innerHTML+"<\/body><\/html>")):(u="",r.document.write("<html><head>"),e.each(function(t,i){i.tagName=="LINK"&&n(i).attr("href",i.href);u+=i.outerHTML}),r.document.writeln(u+"<\/head><body>"),r.document.writeln(f[0].innerHTML+"<\/body><\/html>"));r.document.close();
10r.focus();setTimeout(function(){t.isNullOrUndefined(r.window)||(r.print(),setTimeout(function(){r.close()},1e3))},1e3)},notifyChanges:function(i,r){var e,o,u,f,s;t.isNullOrUndefined(r)&&r.length==0||(i=="beforeAppointmentChange"?(e=r.added[0],o=r.changed[0]):o=t.isNullOrUndefined(r[0])?r:r[0],u=n.extend(!0,{},o),u[this._appointmentSettings.startTime]=new Date(u[this._appointmentSettings.startTime]),u[this._appointmentSettings.endTime]=new Date(u[this._appointmentSettings.endTime]),t.isNullOrUndefined(e)||(f=n.extend(!0,{},e),f[this._appointmentSettings.startTime]=new Date(f[this._appointmentSettings.startTime]),f[this._appointmentSettings.endTime]=new Date(f[this._appointmentSettings.endTime])),i=="beforeAppointmentCreate"?(new t.DataManager(this._currentAppointmentData).insert(u),this._appointmentProcessing(u),this._renderAppointmentAll()):i=="beforeAppointmentChange"||i=="dragStop"||i=="resizeStop"?(t.isNullOrUndefined(e)||(new t.DataManager(this._currentAppointmentData).insert(f),this._appointmentProcessing(f)),new t.DataManager(this._currentAppointmentData).update(this._appointmentSettings.id,u),new t.DataManager(this._processed).remove(this._appointmentSettings.id,u[this._appointmentSettings.id]),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()):i=="beforeAppointmentRemove"&&(s=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,u[this._appointmentSettings.id])),new t.DataManager(this._currentAppointmentData).remove(this._appointmentSettings.id,s[0][this._appointmentSettings.id]),new t.DataManager(this._processed).remove(this._appointmentSettings.id,s[0][this._appointmentSettings.id]),this._renderAppointmentAll()))},deleteAppointment:function(n){var i;!this.model.readOnly&&this.model.allowDelete&&(typeof n=="string"?(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,n)),i[0][this._appointmentSettings.recurrence]?(this._deleteUid=n,this._deletingAppointment()):this._deleteApp(n)):typeof n=="object"&&(this._deleteUid=n.Guid,t.isNullOrUndefined(this._deleteUid)&&(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,n.ParentId)),this._deleteUid=i[0].Guid),n[this._appointmentSettings.recurrence]?this._deletingAppointment():this._deleteApp(this._deleteUid)))},getAppointments:function(){return this.dataSource()},searchAppointments:function(n,i,r,u){var e=t.isNullOrUndefined(i)?this._getColumns(this._appointmentSettings):i,o=t.isNullOrUndefined(r)?"contains":r,s=t.isNullOrUndefined(u)?!0:u,f;return typeof n=="string"?f=n==""?[]:new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).search(n,e,o,s)):typeof n=="object"&&(f=this.filterAppointments(n)),f},filterAppointments:function(n){var e,o=t.Query(),u,r,f,i;if(!t.isNullOrUndefined(n)){for(r=n[0],u=t.isNullOrUndefined(r.matchcase)?!0:r.matchcase,f=t.Predicate(r.field,r.operator,r.value,u),i=1;i<n.length;i++)u=t.isNullOrUndefined(n[i].matchcase)?!0:n[i].matchcase,f=f[n[i].predicate](n[i].field,n[i].operator,n[i].value,u);o.where(f);e=new t.DataManager(this._currentAppointmentData).executeLocal(o)}return e},refreshScroller:function(){var i=this.element.find("div#"+this._id+"_scroller").data("ejScroller"),r=this.model.orientation==="vertical"&&this._customOrientation==="vertical"?this.element.width()-(this._mediaQuery&&(this.currentView()=="month"||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").length>0?this.element.find(".e-scrolltimecells").parent().outerWidth():0):(this.model.orientation=="horizontal"||this._customOrientation=="horizontal")&&!t.isNullOrUndefined(this.model.group)&&this._tempResource.length!=0?this.element.width()-this.element.find(".e-resourceheadertable").width():this.element.width();i.model.width=parseInt(r)-2;i.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top);i.refresh();this.model.orientation=="vertical"&&this._customOrientation=="vertical"?(this._renderHoriVerticalScroll(),this.element.find(".e-datecommondiv").parent().width(parseInt(this.element.width())-2),this.element.find(".e-headrealldaytable").css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px")):(n(this.element.find(".e-horizontalt
10imecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px"),this.element.find(".e-horizontresdiv").height(this.element.find(".e-draggableworkarea").height()));this._reRenderHeaderBar();this.model.showAppointmentNavigator&&this._refreshAppNavigation();this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove();this._highlightCurrentTime(this.model.showCurrentTimeIndicator);(this.currentView()=="month"||this._isCustomMonthView())&&this.model.orientation=="vertical"&&this._customOrientation=="vertical"&&this._renderCurrentView("ScheduleResize");this._showScrollTd();this.element.find(".e-mobileNavigation").css(this.model.enableRTL?"right":"left",this.element.outerWidth()-36);(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview"&&(this.element.find(".e-datecommondiv").addClass("e-datecursor"),this.element.find(".e-navigateprevious,.e-navigatenext").hide(),this.element.find(".e-prevapp,.e-nextapp").hide())},_refreshAppNavigation:function(){var i=this.element.find("#"+this._id+"_scroller");if((this._browserInfo.name!=="msie"||!(this._browserInfo.version<9))&&!t.isNullOrUndefined(i.data("ejScroller"))){var u=i.ejScroller("instance").isVScroll()?i.find(".e-vscroll").outerWidth():0,r=i.height()/2-75,n=this.element.find(".e-scrolltimecells").parent().outerWidth();n=t.isNullOrUndefined(n)?0:n;this.model.enableRTL?(this.element.find(".e-prevapp").css({top:r+40+"px",transform:"rotate(-90deg)",right:n-61+"px"}),this.element.find(".e-nextapp").css({top:r+40+"px",transform:"rotate(90deg)",right:this.element.find(".e-workareadiv").width()-61-u-30+"px"})):(this.element.find(".e-prevapp").css({top:r+40+"px",transform:"rotate(90deg)",left:n-61+"px"}),this.element.find(".e-nextapp").css({top:r+40+"px",transform:"rotate(-90deg)",left:this.element.find(".e-workareadiv").width()-61-u-30+"px"}))}},getDifference:function(n){var t="";return n.toString().indexOf("-")!=-1?(t=n.toString().substring(n.toString().indexOf("-")+1,n.toString().indexOf("-")+5),-(parseInt(t.substring(0,2))*60)+parseInt(t.substring(2,4))):(t=n.toString().substring(n.toString().indexOf("+")+1,n.toString().indexOf("+")+5),parseInt(t.substring(0,2))*60+parseInt(t.substring(2,4)))},_getExportModel:function(i){var f=t.isNullOrUndefined(i)?this.model:i,r=JSON.parse(JSON.stringify(n.extend(!0,{},f))),u;if(this._ignoreFromModelOnExport)for(u=0;u<this._ignoreFromModelOnExport.length;u++)delete r[this._ignoreFromModelOnExport[u]];return delete r.appointmentSettings.dataSource,delete r.blockoutSettings.dataSource,r},exportToExcel:function(i,r,u){var v=u?this._processed:this._currentAppointmentData,f=this,o=n.extend(!0,[],v),e,s,h,c,l,a;return o.forEach(function(n){delete n.AppTaskId;delete n.Guid;delete n[f._appointmentSettings.recurrenceId];delete n[f._appointmentSettings.recurrenceExDate];n[f._appointmentSettings.startTime]=new Date(n[f._appointmentSettings.startTime].getTime()+f.getDifference(n[f._appointmentSettings.startTime])*6e4);n[f._appointmentSettings.endTime]=new Date(n[f._appointmentSettings.endTime].getTime()+f.getDifference(n[f._appointmentSettings.endTime])*6e4)}),o.sort(function(n,t){var i=n[f._appointmentSettings.id],r=t[f._appointmentSettings.id];return i==r?0:i>r?1:-1}),e=t.buildTag("form","",null,{action:i,method:"post"}),s=this._getExportModel(),t.isNullOrUndefined(t.raiseWebFormsServerEvents)?(l=t.buildTag("input","",null,{name:"ScheduleModel",type:"hidden",value:JSON.stringify(s)}),a=t.buildTag("input","",null,{name:"ScheduleAppointment",type:"hidden",value:JSON.stringify(o)}),e.append(l),e.append(a),e.append(this),n("body").append(e),e.submit()):(h={model:s,originalEventType:r},c={ScheduleAppointment:JSON.stringify(o)},t.raiseWebFormsServerEvents(r,h,c)),!0},exportSchedule:function(i,r,u){var s={},e=[],o=[],c,v,y,l,a,f,b,k,d,g;for(this._currentViewAppointments=this.getCurrentViewAppointments(),n.extend(!0,s,this.model),n.extend(!0,e,this._currentViewAppointments),n.extend(!0,o,this._processedIntervals),f=0;f<e.length;f++)e[f][this._appointmentSettings.startTime]=new Date(e[f][this._appointmentSettings.startTime].getTime()+this.getDifference(e[f][this._appointmentSettings.startTime])*6e4),e[f][this._appointmentSettings.endTime]=new Date(e[f][this._appointmentSettings.endTime].getTime()+this.getDifference(e[f][this._appointmentSettings.endTime])*6e4);for(c=0;c<o.length;c++)o[c][this.model.blockoutSettings.startTime]=new Date(o[c][this.model.blockoutSettings.startTime].getTime()+this.getDifference(o[c][this.model.blockoutSettings.startTime])*6e4),o[c][this.model.blockoutSettings.endTime]=new Date(o[c][this.model.blockoutSettings.endTime].getTime()+this.getDifference(o[c][this.model.blockoutSettings.endTime])*6e4);if(v=new Date(new Date(this.currentDate()).setHours(0,0,0)),s.currentView=t.
10isNullOrUndefined(s.currentView_two)?s.currentView:s.currentView_two,s.currentDate=new Date(v.getTime()+this.getDifference(v)*6e4),(!t.isNullOrUndefined(this.model.renderDates)&&n.type(this.model.renderDates)=="array"&&this.model.renderDates.length>0||this._resCustomView)&&this.currentView()==="customview")for(f=0;f<this._dateRender.length;f++)y=new Date(new Date(this._dateRender[f]).setHours(0,0,0)),s.renderDates.custom[f]=new Date(y.getTime()+this.getDifference(y)*6e4);l=JSON.parse(JSON.stringify(this._appointmentSettings));n.extend(!0,s.appointmentSettings,l);a=JSON.parse(JSON.stringify(this.model.blockoutSettings));n.extend(!0,s.blockoutSettings,a);var p=this._getExportModel(s),nt={action:i,method:"post"},h=t.buildTag("form","",null,nt),w=this.currentView()=="day"?"Day":this.currentView()=="month"?"Month":this.currentView()=="week"?"Week":this.currentView()=="agenda"?"Agenda":this.currentView()=="workweek"?"WorkWeek":"CustomView";if(this._ignoreFromAppointmentOnExport)for(f=0;f<this._ignoreFromAppointmentOnExport.length;f++)delete l[this._ignoreFromAppointmentOnExport[f]],delete a[this._ignoreFromAppointmentOnExport[f]];if(t.raiseWebFormsServerEvents)b={model:p,originalEventType:r},k={appSetting:JSON.stringify(l),appId:u,processedApp:JSON.stringify(e),blockedApp:JSON.stringify(o),model:JSON.stringify(p),locale:this._getLocalizedLabels(w)+","+this._getLocalizedLabels("AllDay")+","+this._getLocalizedLabels("Date")+","+this._getLocalizedLabels("Time")+","+this._getLocalizedLabels("Event")},t.raiseWebFormsServerEvents(r,b,k);else{var tt={name:"ScheduleApps",type:"hidden",value:JSON.stringify(l)},it=t.buildTag("input","",null,tt),rt={name:"ScheduleBlockedApps",type:"hidden",value:JSON.stringify(a)},ut=t.buildTag("input","",null,rt),ft={name:"ScheduleModel",type:"hidden",value:JSON.stringify(p)},et=t.buildTag("input","",null,ft),e={name:"ScheduleProcesedApps",type:"hidden",value:JSON.stringify(e)},ot=t.buildTag("input","",null,e),o={name:"ScheduleProcesedIntervalsApps",type:"hidden",value:JSON.stringify(o)},st=t.buildTag("input","",null,o),ht={name:"Locale",type:"hidden",value:this._getLocalizedLabels(w)+","+this._getLocalizedLabels("AllDay")+","+this._getLocalizedLabels("Date")+","+this._getLocalizedLabels("Time")+","+this._getLocalizedLabels("Event")},ct=t.buildTag("input","",null,ht);h.append(et);h.append(ot);h.append(st);h.append(ct);t.isNullOrUndefined(u)||(d={name:"AppointmentId",type:"hidden",value:u},g=t.buildTag("input","",null,d),h.append(g));h.append(it);h.append(ut);h.append(this);n("body").append(h);h.submit()}return!0}});t.scheduleFeatures.resources&&n.extend(t.Schedule.prototype,t.scheduleFeatures.resources);t.scheduleFeatures.horizontal&&n.extend(t.Schedule.prototype,t.scheduleFeatures.horizontal);t.Schedule.Locale=t.Schedule.Locale||{};t.Schedule.Locale["default"]=t.Schedule.Locale["en-US"]={ReminderW
10indowTitle:"Reminder window",CreateAppointmentTitle:"Create Appointment",RecurrenceEditTitle:"Edit Repeat Appointment",RecurrenceEditMessage:"How would you like to change the appointment in the series?",RecurrenceEditOnly:"Only this appointment",RecurrenceEditFollowingEvent:"Following Events",RecurrenceEditSeries:"Entire series",PreviousAppointment:"Previous Appointment",NextAppointment:"Next Appointment",AppointmentSubject:"Subject",StartTime:"Start Time",EndTime:"End Time",AllDay:"All day",StartTimeZone:"Start TimeZone",EndTimeZone:"End TimeZone",Today:"Today",Recurrence:"Repeat",Done:"Done",Cancel:"Cancel",Ok:"OK",Repeat:"Repeat",RepeatBy:"Repeat by",RepeatEvery:"Repeat every",RepeatOn:"Repeat on",StartsOn:"Starts on",Ends:"Ends",Summary:"Summary",Daily:"Daily",Weekly:"Weekly",Monthly:"Monthly",Yearly:"Yearly",Every:"Every",EveryWeekDay:"Every weekday",Never:"Never",After:"After",Occurrence:"Occurrence(s)",On:"On",Edit:"Edit",RecurrenceDay:"Day(s)",RecurrenceWeek:"Week(s)",RecurrenceMonth:"Month(s)",RecurrenceYear:"Year(s)",The:"The",OfEvery:"of every",First:"First",Second:"Second",Third:"Third",Fourth:"Fourth",Last:"Last",WeekDay:"Weekday",WeekEndDay:"Weekendday",Subject:"Subject",Categorize:"Categories",DueIn:"Due In",DismissAll:"Dismiss All",Dismiss:"Dismiss",OpenItem:"Open Item",Snooze:"Snooze",Day:"Day",Week:"Week",WorkWeek:"Work Week",Month:"Month",AddEvent:"Add Event",CustomView:"Custom View",Agenda:"Agenda",Detailed:"Edit Appointment",EventBeginsin:"Appointment begins in",Editevent:"Edit Appointment",Editfollowingevent:"Following Events",Editseries:"Edit Series",Times:"times",Until:"until",Eventwas:"Appointment was",Hours:"hrs",Minutes:"mins",Overdue:"Overdue Appointment",Days:"day(s)",Event:"Event",Select:"select",Previous:"Previous",Next:"Next",Close:"Close",Delete:"Delete",Date:"Date",Showin:"Show in",Gotodate:"Go To Date",Resources:"RESOURCES",RecurrenceDeleteTitle:"Delete Repeat Appointment",Location:"Location",Priority:"Priority",RecurrenceAlert:"Alert",RecurrenceDateValidation:"Some months have fewer than selected dates. For these months, the occurrence will fall on the last date of the month.",NoTitle:"No Title",OverFlowAppCount:"more appointment(s)",AppointmentIndicator:"Click for more appointments",WrongPattern:"The recurrence pattern is not valid",CreateError:"The duration of the appointment must be shorter than how frequently it occurs. Shorten the duration, or change the recurrence pattern in the Appointment Recurrence dialog box.",DragResizeError:"Cannot reschedule an occurrence of the recurring appointment if it skips over a later occurrence of the same appointment.",StartEndError:"The selected end date occurs before the start date.",SeriesChangeAlert:"The changes made to specific instances of this series will be cancelled and those appointments will match the series again.",MouseOverDeleteTitle:"Delete Appointment",DeleteConfirmation:"Are you sure you want to delete this appointment?",Time:"Time",EmptyResultText:"No suggestions",BlockIntervalAlertTitle:"Alert",BlockIntervalError:"The selected time interval has been blocked and is unavailable for selection."};t.Schedule.Actions={Add:"add",Save:"save",Delete:"delete",DeleteOccurrence:"deleteOccurrence",DeleteFutureOccurrences:"deleteFutureOccurrences",DeleteSeries:"deleteSeries",EditOccurrence:"editOccurrence",EditFutureOccurrences:"editFutureOccurrences",EditSeries:"editSeries"};t.Schedule.CurrentView={Day:"day",Week:"week",Workweek:"workweek",Month:"month",CustomView:"customview",Agenda:"agenda"};t.Schedule.TimeMode={Hour12:"12",Hour24:"24"};t.Schedule.Orientation={Vertical:"vertical",Horizontal:"horizontal"};t.Schedule.DayOfWeek={Sunday:"Sunday",Monday:"Monday",Tuesday:"Tuesday",Wednesday:"Wednesday",Thursday:"Thursday",Friday:"Friday",Saturday:"Saturday"}}(jQuery,Syncfusion)});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.