/* * Kendo UI Complete v2013.3.1119 (http://kendoui.com) * Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Complete commercial licenses may be obtained at * https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx * If you do not own a commercial license, this file shall be governed by the trial license terms. */ !function(define){return define(["./kendo.scheduler.view.min"],function(){!function(e){function t(e){var t=new Date(1980,1,1,0,0,0);return l(t,m(e)),t}function a(e,t,a){var s,i=t.getTime(),n=a.getTime();return s=e.getTime(),s>=i&&n>=s}function s(e,t,a,s){return s=s?a>=e:a>e,e>t&&s}function i(e,t,a,s){var i,n=e._continuousEvents,r=n[n.length-1],l=u(t.start.startDate()).getTime();if(s&&r&&u(r.start.startDate()).getTime()==l){for(i=n.length-1;i>-1&&!(n[i].isAllDay||u(n[i].start.startDate()).getTime()6?a-=7:a++,t.push(a);return t}var o=window.kendo,r=o.ui,l=o.date.setTime,d=r.SchedulerView,h=e.extend,c=e.proxy,u=o.date.getDate,p=o.date.MS_PER_MINUTE,f=o.date.MS_PER_DAY,m=o.date.getMilliseconds,v=".kendoMultiDayView",g=o.template('
#:kendo.format("{0:t} - {1:t}", start, end)#
${title}
'),D=o.template('
${title}
'),k=o.template("#=kendo.toString(date, 'ddd M/dd')#"),_='
# if(data.tail || data.middle) {##}## if(data.isException()) {## } else if(data.isRecurring()) {## } #{0}#if (showDelete) {##}## if(data.head || data.middle) {##}##if(resizable && !singleDay && !data.tail && !data.middle){##}##if(resizable && !singleDay && !data.head && !data.middle){##}#
',y='
# if(data.isException()) {## } else if(data.isRecurring()) {## } #{0}#if (showDelete) {##}## if(data.tail || data.middle) {## } ## if(data.head || data.middle) {## } ## if(resizable && !data.tail && !data.middle) {## } ## if(resizable && !data.head && !data.middle) {## } #
',T=d.extend({init:function(e,t){var a=this;d.fn.init.call(a,e,t),a.title=a.options.title||a.options.name,a._workDays=n(a.options),a._templates(),a._editable(),a.calculateDateRange(),a._groups()},_updateResizeHint:function(e,t,a,s){var i,n,r,l,h,c,u,p,f,m,v=e.isMultiDay(),g=this.groups[t],D=g.ranges(a,s,v,e.isAllDay);for(this._removeResizeHint(),i=0;i div"),m.length||(m=this.content)),this._resizeHint.appendTo(m),this._resizeHint.find(".k-label-top,.k-label-bottom").text(""),this._resizeHint.first().addClass("k-first").find(".k-label-top").text(o.toString(o.timezone.toLocalDate(a),f)),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(o.toString(o.timezone.toLocalDate(s),f))},_updateMoveHint:function(e,t,a){var s,i,n,r,l,d,h,c=e.isMultiDay(),u=this.groups[t],p=o.date.toUtcTime(e.start)+a,f=p+e.duration(),v=u.ranges(p,f,c,e.isAllDay);for(p=o.timezone.toLocalDate(p),f=o.timezone.toLocalDate(f),this._removeMoveHint(),!c&&(0===m(f)||m(f)1&&v.pop(),s=0;s div"),h.length||(h=this.content)),this._moveHint.appendTo(h)},_slotByPosition:function(e,t){var a,s,i,n;for(this._isVerticallyGrouped()?(s=this.content.offset(),t+=this.content[0].scrollTop,e+=this.content[0].scrollLeft):s=this.element.find(".k-scheduler-header-wrap:has(.k-scheduler-header-all-day)").find(">div").offset(),s&&(e-=s.left,t-=s.top),e=Math.ceil(e),t=Math.ceil(t),n=0;ns;s++)for(i=0,this._isVerticallyGrouped()&&(i=s),n=i*a,r=0,this._isVerticallyGrouped()||(r=s);(i+1)*a>n;){for(l=_[n].children,d=this.groups[s],0===n%a&&(o=m(new Date(+this.startTime()))),h=r*t;(r+1)*t>h;h++)c=l[h],u=h%t,p=d.getTimeSlotCollection(u),f=this._dates[u],v=Date.UTC(f.getFullYear(),f.getMonth(),f.getDate()),g=v+o,D=g+k,c.setAttribute("role","gridcell"),c.setAttribute("aria-selected",!1),p.addTimeSlot(c,g,D);o+=k,n++}},_daySlotGroups:function(e,t){var a,s,i,n,r,l,d,h,c,u,p,f;for(a=this._isVerticallyGrouped()?this.element.find(".k-scheduler-header-all-day"):this.element.find(".k-scheduler-header-all-day tr"),a.attr("role","row"),s=0;e>s;s++)for(i=0,this._isVerticallyGrouped()&&(i=s),n=this.groups[s],r=n.getDaySlotCollection(0),l=a[i].children,d=0,this._isVerticallyGrouped()||(d=s),h=0,c=d*t;(d+1)*t>c;c++)u=l[c],0===c%t&&(h=0),p=o.date.addDays(this.startDate(),h),f=Date.UTC(p.getFullYear(),p.getMonth(),p.getDate()),h++,u.setAttribute("role","gridcell"),u.setAttribute("aria-selected",!1),r.addDaySlot(u,f,f+o.date.MS_PER_DAY)},_groups:function(){var e,t,a,s=this._groupCount(),i=this._columnCountInResourceView();for(this.groups=[],e=0;s>e;e++){for(t=this._addResourceView(e),a=0;i>a;a++)t.addTimeSlotCollection(this._dates[a],o.date.addDays(this._dates[a],1));t.addDaySlotCollection(this._dates[0],this._dates[this._dates.length-1])}this._timeSlotGroups(s,i),this.options.allDaySlot&&this._daySlotGroups(s,i)},options:{name:"MultiDayView",selectedDateFormat:"{0:D}",allDaySlot:!0,showWorkHours:!1,title:"",startTime:o.date.today(),endTime:o.date.today(),minorTickCount:2,majorTick:60,majorTimeHeaderTemplate:"#=kendo.toString(date, 't')#",minorTimeHeaderTemplate:" ",slotTemplate:" ",allDaySlotTemplate:" ",eventTemplate:g,allDayEventTemplate:D,dateHeaderTemplate:k,editable:!0,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,footer:{command:"workDay"},messages:{allDay:"all day",showFullDay:"Show full day",showWorkDay:"Show business hours"}},events:["remove","add","edit"],_templates:function(){var e=this.options,t=h({},o.Template,e.templateSettings);this.eventTemplate=this._eventTmpl(e.eventTemplate,y),this.allDayEventTemplate=this._eventTmpl(e.allDayEventTemplate,_),this.majorTimeHeaderTemplate=o.template(e.majorTimeHeaderTemplate,t),this.minorTimeHeaderTemplate=o.template(e.minorTimeHeaderTemplate,t),this.dateHeaderTemplate=o.template(e.dateHeaderTemplate,t),this.slotTemplate=o.template(e.slotTemplate,t),this.allDaySlotTemplate=o.template(e.allDaySlotTemplate,t)},_editable:function(){this.options.editable&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var t=this;t.element.on("click"+v,".k-event a:has(.k-si-close)",function(a){t.trigger("remove",{uid:e(this).closest(".k-event").attr(o.attr("uid"))}),a.preventDefault()}),t.options.editable.create!==!1&&t.element.on("dblclick"+v,".k-scheduler-content td",function(a){var s,i;e(this).parent().hasClass("k-scheduler-header-all-day")||(s=t._slotByPosition(a.pageX,a.pageY),s&&(i=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({start:s.startDate(),end:s.endDate()},i)})),a.preventDefault())}).on("dblclick"+v,".k-scheduler-header-all-day td",function(e){var a,s=t._slotByPosition(e.pageX,e.pageY);s&&(a=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({},{isAllDay:!0,start:o.date.getDate(s.startDate()),end:o.date.getDate(s.startDate())},a)})),e.preventDefault()}),t.options.editable.update!==!1&&t.element.on("dblclick"+v,".k-event",function(a){t.trigger("edit",{uid:e(this).closest(".k-event").attr(o.attr("uid"))}),a.preventDefault()})},_touchEditable:function(){var t=this;t.options.editable.create!==!1&&(t._addUserEvents=new o.UserEvents(t.element,{filter:".k-scheduler-content td",tap:function(a){var s,i;e(a.target).parent().hasClass("k-scheduler-header-all-day")||(s=t._slotByPosition(a.x.location,a.y.location),s&&(i=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({start:s.startDate(),end:s.endDate()},i)})),a.preventDefault())}}),t._allDayUserEvents=new o.UserEvents(t.element,{filter:".k-scheduler-header-all-day td",tap:function(e){var a,s=t._slotByPosition(e.x.location,e.y.location);s&&(a=t._resourceBySlot(s),t.trigger("add",{eventInfo:h({},{isAllDay:!0,start:o.date.getDate(s.startDate()),end:o.date.getDate(s.startDate())},a)})),e.preventDefault()}})),t.options.editable.update!==!1&&(t._editUserEvents=new o.UserEvents(t.element,{filter:".k-event",tap:function(a){var s=e(a.target).closest(".k-event");s.hasClass("k-event-active")||t.trigger("edit",{uid:s.attr(o.attr("uid"))}),a.preventDefault()}}))},_layout:function(e){var t,a,s,i=[],n=[],r=this.options,l=this;for(t=0;t',a=i.footer.command,a&&"workDay"===a?(t+='"):t+=" ",t+="",this.footer=e(t).appendTo(this.element),s=this,this.footer.on("click"+v,".k-scheduler-fullday",function(e){e.preventDefault(),s.trigger("navigate",{view:s.name||i.name,date:s.startDate(),isWorkDay:!i.showWorkHours})}))},_forTimeRange:function(e,a,s,i){var n,o,r,d,h,c,u,v,g,D,k,_,y,T,w,S;for(e=t(e),a=t(a),r=this,d=m(e),h=m(a),c=r.options.minorTickCount,u=r.options.majorTick*p,v=u/c||1,g=new Date(+e),D=g.getDate(),k=0,_="",o=f/v,d!=h&&(d>h&&(h+=f),o=(h-d)/v),o=Math.round(o);o>k;k++)y=k%(u/v),T=0===y,w=c-1>y,S=y===c-1,_+=s(g,T,w,S),l(g,v,!1);return h&&(n=m(g),Dh&&(g=new Date(+a))),i&&(_+=i(g)),_},_content:function(e){var t,a,s,i,n=this,r=n.options,l=n.startTime(),d=this.endTime(),h=1,c=1,u=e.length,p="",f=this.groupedResources,m="",v=this.slotTemplate;if(f.length)if("vertical"===n._groupOrientation()){if(c=this._rowCountForLevel(this.rowLevels.length-2),r.allDaySlot){for(m='',t=0,a=e.length;a>t;t++)m+=""+this.allDaySlotTemplate({date:e[t]})+"";m+=""}}else h=this._columnCountForLevel(this.columnLevels.length-2);for(p+="",s=function(t,a){var s,i,r,l,d="",c="";for(d="",l=0;h>l;l++)for(s=0,i=u;i>s;s++)c="",o.date.isToday(e[s])&&(c+="k-today"),(o.date.getMilliseconds(t)=o.date.getMilliseconds(n.options.workDayEnd)||!n._isWorkDay(e[s]))&&(c+=" k-nonwork-hour"),d+="",r=o.date.getDate(e[s]),o.date.setTime(r,o.date.getMilliseconds(t)),d+=v({date:r}),d+="";return d+=""},i=0;c>i;i++)p+=m,p+=this._forTimeRange(l,d,s);p+="",this.content.find("table").append(p)},_isWorkDay:function(e){var t,a=e.getDay(),s=this._workDays;for(t=0;ts;s++)if(n=o.date.getDate(l[s]),r=new Date(o.date.getDate(l[s]).getTime()+f-(t?0:1)),a(e,n,r))return s*d;return-1},_positionAllDayEvent:function(t,a){var s,i,n,o,r,l,h,c=a.innerWidth(),u=a.start.index,p=a.end.index,f=d.collidingEvents(a.events(),u,p),m=this._headerColumnCount||0,v=2,g=u!==p?5:4,D=this._allDayHeaderHeight,k=a.startSlot();for(t.css({left:this._scrollbarOffset(k.offsetLeft+v,!0),width:c-g}),a.addEvent({slotIndex:u,start:u,end:p,element:t}),f.push({slotIndex:u,start:u,end:p,element:t}),s=d.createRows(f),s.length&&s.length>m&&(this._updateAllDayHeaderHeight(D*s.length+D),this._headerColumnCount=s.length),i=a.start.offsetTop,n=0,o=s.length;o>n;n++)for(r=s[n].events,l=0,h=r.length;h>l;l++)e(r[l].element).css({top:i+n*D})},_arrangeColumns:function(e,t,a,s){var i,n,o,r,l,h,c,u,p,f,m,v=s.start;for(e={element:e,slotIndex:v.index,start:t,end:t+a},o=v.clientWidth,r=.1*o,l=s.events(),h=d.collidingEvents(l,e.start,e.end),s.addEvent(e),h.push(e),i=d.createColumns(h),c=(o-r)/i.length,u=0,p=i.length;p>u;u++)for(n=i[u].events,f=0,m=n.length;m>f;f++)n[f].element[0].style.width=c-4+"px",n[f].element[0].style.left=(this._isRtl?this._scrollbarOffset(r):0)+v.offsetLeft+u*c+2+"px"},_positionEvent:function(e,t,a){var s,i,n=e.start,r=e.end;e.startTime&&(n=o.date.getMilliseconds(e.startTime)+o.date.toUtcTime(o.date.getDate(e.start))),e.endTime&&(r=o.date.getMilliseconds(e.endTime)+o.date.toUtcTime(o.date.getDate(e.end))),s=a.innerRect(n,r,!1),i=s.bottom-s.top-2,0>i&&(i=0),t.css({top:s.top,height:i}),this._arrangeColumns(t,s.top,t[0].clientHeight,a)},_eventTmpl:function(e,t){var a,s=this.options,i=h({},o.Template,s.templateSettings),n=i.paramName,r="",l=typeof e,d={storage:{},count:0};return"function"===l?(d.storage["tmpl"+d.count]=e,r+="#=this.tmpl"+d.count+"("+n+")#",d.count++):"string"===l&&(r+=e),a=o.template(o.format(t,r),i),d.count>0&&(a=c(a,d.storage)),a},_createEventElement:function(t,s,i,n){var r,l,d,c=s?this.eventTemplate:this.allDayEventTemplate,p=this.options,v=p.editable,g=this._isMobile(),D=v&&v.destroy!==!1&&!g,k=v&&v.resize!==!1,_=u(this.startDate()),y=u(this.endDate()),T=m(this.startTime()),w=m(this.endTime()),S=m(t.startTime||t.start),b=m(t.endTime||t.end);return T>=w&&(w=m(new Date(this.endTime().getTime()+f-1))),s||t.isAllDay||(y=new Date(y.getTime()+f)),l=t.end,t.isAllDay&&(l=u(t.end)),!a(u(t.start),_,y)&&!a(l,_,y)||s&&T>S&&b>w?r=!0:u(t.start)<_||s&&T>S?n=!0:(l>y&&!s||s&&b>w)&&(i=!0),d=this.eventResources(t),e(c(h({},{ns:o.ns,resizable:k,showDelete:D,middle:r,head:i,tail:n,singleDay:1==this._dates.length,resources:d,inverseColor:d&&d[0]?this._shouldInverseResourceColor(d[0]):!1},t,{start:t.startTime||t.start,end:t.endTime||t.end})))},_isInTimeSlot:function(e){var t,a=this.startTime(),i=this.endTime(),n=e.startTime||e.start,r=e.endTime||e.end;return m(i)===m(o.date.getDate(i))&&(i=o.date.getDate(i),l(i,f-1)),o.date.getDate(r)>o.date.getDate(n)&&(r=o.date.getDate(r),l(r,f-1)),r=m(r),n=m(n),i=m(i),a=m(a),a===n&&n===r?!0:(t=n!==i,s(n,a,i,t)||s(r,a,i,t)||s(a,n,r)||s(i,n,r))},_isInDateSlot:function(e){var t=this.startDate(),s=new Date(this.endDate().getTime()+f-1);return(a(e.start,t,s)||a(e.end,t,s)||a(t,e.start,e.end)||a(s,e.start,e.end))&&(!a(e.end,t,t)||a(e.end,e.start,e.start)||e.isAllDay)},_updateAllDayHeaderHeight:function(e){var t,a=this.element.find(".k-scheduler-header-all-day td");if(a.length)for(a.parent().add(this.element.find(".k-scheduler-times-all-day").parent()).height(e),t=0;t div");for(s=0,n=e.length;n>s;s++)if(a=e[s],this._isInDateSlot(a))if(o=a.isAllDay||a.end.getTime()-a.start.getTime()>=f,r=o&&!this._isVerticallyGrouped()?k:this.content,o)this.options.allDaySlot&&(h=this.groups[t],h._continuousEvents||(h._continuousEvents=[]),d=h.slotRanges(a),l=this._createEventElement(a,!o),this._positionAllDayEvent(l,d[0]),i(h,d[0],l,!0),l.appendTo(r));else if(this._isInTimeSlot(a))for(h=this.groups[t],h._continuousEvents||(h._continuousEvents=[]),d=h.slotRanges(a),c=d.length,u=0;c>u;u++)p=d[u],m=a.start,v=a.end,c>1&&(0===u?v=p.end.endDate():u==c-1?m=p.start.startDate():(m=p.start.startDate(),v=p.end.endDate())),g=a.clone({start:m,end:v,startTime:a.startTime,endTime:a.endTime}),this._isInTimeSlot(g)&&(D=p.head,l=this._createEventElement(a,!o,D,p.tail),l.appendTo(r),this._positionEvent(g,l,p),i(h,p,l,!1))},render:function(e){this._headerColumnCount=0,this._groups(),this.element.find(".k-event").remove(),this._updateAllDayHeaderHeight(this._allDayHeaderHeight),e=new o.data.Query(e).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray();var t=this.groupedResources;t.length?this._renderGroups(e,t,0):this._renderEvents(e,0,0),this.refreshLayout(),this.trigger("activate")},_renderGroups:function(e,t,a){var s,i,n,r,l=t[0];if(l)for(s=l.dataSource.view(),i=0;i1?a=this._renderGroups(r,t.slice(1),a++):this._renderEvents(r,a++);return a},_columnOffsetForResource:function(e){return this._columnCountForLevel(e)/this._columnCountForLevel(e-1)},_columnCountForLevel:function(e){var t=this.columnLevels[e];return t?t.length:0},_rowCountForLevel:function(e){var t=this.rowLevels[e];return t?t.length:0},clearSelection:function(){this.content.add(this.datesHeader).find(".k-state-selected").removeAttr("id").attr("aria-selected",!1).removeClass("k-state-selected")},_updateDirection:function(e,t,a,s,i){var n=e.isAllDay,o=t[0].start,r=t[t.length-1].end;a&&(i?n||o.index!==r.index||o.collectionIndex!==r.collectionIndex||(e.backward=s):(n&&o.index===r.index||!n&&o.collectionIndex===r.collectionIndex)&&(e.backward=s))},_changeViewPeriod:function(e,t,a){var s,i,n,o;return a?undefined:(s=t?this.previousDate():this.nextDate(),i=e.start,n=e.end,e.start=new Date(s),e.end=new Date(s),o=e.isAllDay?f:m(n),l(e.start,m(i)),l(e.end,o),this._isVerticallyGrouped()||(e.groupIndex=t?this.groups.length-1:0),e.events=[],!0)}});h(!0,r,{MultiDayView:T,DayView:T.extend({options:{title:"Day"},name:"day"}),WeekView:T.extend({options:{title:"Week",selectedDateFormat:"{0:D} - {1:D}"},name:"week",calculateDateRange:function(){var e,t,a=this.options.date,s=o.date.dayOfWeek(a,this.calendarInfo().firstDay,-1),i=[];for(e=0,t=7;t>e;e++)i.push(s),s=o.date.nextDay(s);this._render(i)}}),WorkWeekView:T.extend({options:{title:"Work Week",selectedDateFormat:"{0:D} - {1:D}"},nextDate:function(){return o.date.dayOfWeek(o.date.nextDay(this.endDate()),this.options.workWeekStart,1)},previousDate:function(){return o.date.previousDay(this.startDate())},calculateDateRange:function(){for(var e=this.options.date,t=o.date.dayOfWeek(e,this.options.workWeekStart,-1),a=o.date.dayOfWeek(t,this.options.workWeekEnd,1),s=[];a>=t;)s.push(t),t=o.date.nextDay(t);this._render(s)}})})}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(e,t){return t()}); //@ sourceMappingURL=kendo.scheduler.dayview.min.js.map