/** * Kendo UI v2018.1.117 (http://www.telerik.com/kendo-ui) * Copyright 2018 Telerik AD. All rights reserved. * * Kendo UI commercial licenses may be obtained at * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete * If you do not own a commercial license, this file shall be governed by the trial license terms. */ !function(t,define){define("kendo.scheduler.timelineview.min",["kendo.scheduler.view.min"],t)}(function(){return function(t,e){function n(t){var e=new Date(1980,1,1,0,0,0);return u(e,g(t)),e}function i(t){var e=[],n=t.workWeekStart%7,i=Math.abs(t.workWeekEnd%7);for(e.push(n);i!=n;)n>6?n-=7:n++,e.push(n);return e}function o(t){var e,n=0;if(t.columns){for(e=0;e=0;i--)o=t[i].rectLeft,a=t[i].rectRight,r=o<=e&&a>=e,(r||o>=e&&a<=n||e<=o&&n>=o)&&(on&&(n=a));return s(t,e,n)}function s(t,e,n){var i,o,r=[];for(i=0;ie||o.rectLeft>=e&&o.rectRight<=n)&&r.push(t[i]);return r}var a,l=window.kendo,d=l.ui,u=l.date.setTime,c=d.SchedulerView,h=l._outerWidth,f=l._outerHeight,_=t.extend,p=t.proxy,v=l.date.getDate,g=l.date.getMilliseconds,m=l.date.MS_PER_DAY,w=l.date.MS_PER_MINUTE,T="k-current-time",k="k-current-time-arrow",D="k-scheduler-header-wrap",y=.8666,S=".kendoTimelineView",C=l.template('
#:kendo.format("{0:t} - {1:t}", start, end)#
${title}
'),V=l.template("#=kendo.format('{0:m}', date)#"),R='
# if(data.tail) {##}## if(data.isException()) {## } else if(data.isRecurring()) {## } #{0}#if (showDelete) {##}## if(data.head) {##}##if(resizable && !data.tail){##}##if(resizable && !data.head){##}#
',x=l.Class.extend({init:function(t){this._view=t},_getTimeSlotByPosition:function(t,e,n){var i=this._view.groups[n];return i.timeSlotByPosition(t,e)},_hideHeaders:function(){var t=this._view;t.timesHeader.find("table tr:last").hide(),t.datesHeader.find("table tr:last").hide()},_setColspan:function(t){o(t)},_createRowsLayout:function(t,e,n){var i=this._view;return i._createRowsLayout(t,e,n)},_createVerticalColumnsLayout:function(t,e,n,i){return i},_createColumnsLayout:function(t,e,n){var i=this._view;return i._createColumnsLayout(t,e,n)},_getRowCount:function(){var t=this._view;return t._groupCount()},_getGroupsCount:function(){return 1},_addContent:function(t,e,n,i,o,r,s,a){var d,u,c,h,f=this._view,_="",p=f.options,v=function(e){var n,i="",o="",r=function(t){return function(){return f._resourceBySlot({groupIndex:t})}};return l.date.isToday(t[c])&&(o+="k-today"),(l.date.getMilliseconds(e)=l.date.getMilliseconds(p.workDayEnd)||!f._isWorkDay(t[c]))&&(o+=" k-nonwork-hour"),i+="",n=l.date.getDate(t[c]),l.date.setTime(n,l.date.getMilliseconds(e)),i+=s({date:n,resources:r(a?d:u)}),i+=""};for(d=0;d",u=0;u"}return _},_addTimeSlotsCollections:function(t,e,n,i,o){var r,s,a,l,d,u,c,h,f,_,p,v,m=this._view,w=n.length;for(o&&(w=Math.floor(w/t)),r=0;r",r=i.datesHeader.find("."+D),s=Math.round(e[0].innerRect(n,new Date(n.getTime()+1),!1).left),a=t(o).prependTo(r).addClass(k+"-down");a.css({left:i._adjustLeftPosition(s-h(a)*y/2),top:r.find("tr:last").prev().position().top}),t(o).prependTo(i.content).css({left:i._adjustLeftPosition(s),width:"1px",height:i.content[0].scrollHeight-1,top:0})},_changeGroup:function(){return e},_prevGroupSlot:function(t,e,n){var i,o=this._view;return o._isVerticallyGrouped()?t:(i=e._collection(0,n),i.last())},_nextGroupSlot:function(t,e,n){var i,o=this._view;return o._isVerticallyGrouped()?t:(i=e._collection(0,n),i.first())},_verticalSlots:function(t,e){var n=this._view;return n._changeGroup(t,e)},_verticalMethod:function(t){return t?"leftSlot":"rightSlot"},_normalizeVerticalSelection:function(){return e},_horizontalSlots:function(t,e,n,i,o,r,s){var a=this._view,l={};return l.startSlot=e[n](i),l.endSlot=e[n](o),r||!a._isHorizontallyGrouped()||l.startSlot&&l.endSlot||(l.startSlot=l.endSlot=a._changeGroup(t,s)),l},_changeVerticalViewPeriod:function(){return!1},_changeHorizontalViewPeriod:function(t,e,n,i){var o=this._view;return!(t.startSlot&&t.endSlot||e||!o._changeViewPeriod(n,i,!1))},_updateDirection:function(t,e,n,i){var o=this._view;o._updateDirection(t,e,n,i,!0)},_createMoveHint:function(t,e){var n,i,o,r,s=this._view,a=t.start,l=s._createEventElement(e.occurrence,e.occurrence,!1,!1);l.addClass("k-event-drag-hint"),n=t.innerRect(e.occurrence.start,e.occurrence.end,s.options.snap),i=n.right-n.left-2,i<0&&(i=0),o=s._adjustLeftPosition(n.left),r={left:o,top:a.offsetTop,height:a.offsetHeight-2,width:i},l.css(r),s._appendMoveHint(l)},_adjustLeftPosition:function(t){var e=this._view;return e._isRtl&&(t-=e.content[0].scrollWidth-e.content[0].offsetWidth),t}}),H=l.Class.extend({init:function(t){this._view=t},_getTimeSlotByPosition:function(t,e,n){var i=this._view.groups[n];return i.timeSlotByPosition(t,e,!0)},_hideHeaders:function(){var t=this._view;t._isVerticallyGrouped()?t.times.find(".k-last").hide():(t.timesHeader.find("table tr").eq(2).hide(),t.datesHeader.find("table tr").eq(2).hide())},_setColspan:function(){},_createRowsLayout:function(t,e,n,i){var o=this._view;return o._createDateLayout(i,null,!0)},_createVerticalColumnsLayout:function(t,e,n){var i=this._view;return i._createColumnsLayout(t,null,n)},_createColumnsLayout:function(t,e,n,i){var o=this._view;return o._createColumnsLayout(t,e,n,i,!0)},_getRowCount:function(t){var e=this._view;return e._rowCountForLevel(t)},_getGroupsCount:function(){var t=this._view;return t._groupCount()},_addContent:function(t,e,n,i,o,r,s,a){var d,c,h,f,_=this._view,p="",v=_.options,g=function(e,n,i,o,r,a){var u,c="",f="",p=_._isVerticallyGrouped()?d:h,g=function(t){return function(){return _._resourceBySlot({groupIndex:t})}};return l.date.isToday(t[h])&&(f+="k-today"),(l.date.getMilliseconds(e)=l.date.getMilliseconds(v.workDayEnd)||!_._isWorkDay(t[p]))&&(f+=" k-nonwork-hour"),c+="",u=l.date.getDate(t[h]),l.date.setTime(u,l.date.getMilliseconds(e)),c+=s({date:u,resources:g(a)}),c+=""},m=new Date(o),T=_.options.minorTickCount,k=_.options.majorTick*w,D=k/T||1;for(c=0;c",c%(i/_._dates.length)===0&&(d=c/(i/_._dates.length),m=new Date(_._dates[d]),l.date.setTime(m,l.date.getMilliseconds(o))),h=0,f=e;h"}return p},_addTimeSlotsCollections:function(t,e,n,i,o){var r,s,a,l,d,u,c,h,f,_,p,v,m=this._view,w=n.length;for(o&&(w/=e),r=0;r",a=t(s).prependTo(i.times),l=Math.round(e[0].innerRect(n,new Date(n.getTime()+1),!1).top),d={};this._isRtl?(d.right=o.position().left+f(o)-f(r),a.addClass(k+"-left")):(d.left=r.position().left,a.addClass(k+"-right")),d.top=l-h(a)*y/2,a.css(d),t(s).prependTo(i.content).css({top:l,height:"1px",right:"1px",width:i.content[0].scrollWidth,left:0})},_changeGroup:function(t,e,n){var i=this._view;n||(t.groupIndex=e?i.groups.length-1:0)},_prevGroupSlot:function(t){return t},_nextGroupSlot:function(t){return t},_changeDate:function(t,e,n){var i,o,r=this._view,s=r.groups[t.groupIndex];if(e){if(i=s._getCollections(!1),o=n.index-1,o>=0)return i[0]._slots[o]}else if(i=s._getCollections(!1),o=n.index+1,i[0]&&i[0]._slots[o])return i[0]._slots[o]},_verticalSlots:function(t,e,n){return this._changeDate(t,e,n)},_verticalMethod:function(t,e){return e?t?"upSlot":"downSlot":t?"leftSlot":"rightSlot"},_normalizeVerticalSelection:function(t,n,i,o){var r=this._view;return o?e:r._normalizeVerticalSelection(t,n,i)},_horizontalSlots:function(t,e,n,i,o,r,s){var a=this._view,l=a._changeGroup(t,s),d={};return l?d.startSlot=d.endSlot=l:a._isVerticallyGrouped()||(d.startSlot=e[n](i),d.endSlot=e[n](o)),d},_changeVerticalViewPeriod:function(t,e,n,i){var o=this._view;return!(t.startSlot&&t.endSlot||e||!o._changeViewPeriod(n,i,o._isVerticallyGrouped()))},_changeHorizontalViewPeriod:function(t,e,n,i){var o=this._view;return!o._isVerticallyGrouped()&&!(t.startSlot&&t.endSlot||e||!o._changeViewPeriod(n,i,!1))},_updateDirection:function(t,e,n,i){var o=this._view;o._updateDirection(t,e,n,i,!o._isVerticallyGrouped())},_createMoveHint:function(t,e){var n,i,o,r,s=this._view,a=t.start,l=t.end;for(n=a.index;n<=l.index;n++)i=t.collection._slots[n],o=s._createEventElement(e.occurrence,e.occurrence,!1,!1),o.addClass("k-event-drag-hint"),r={left:i.offsetLeft+2,top:i.offsetTop,height:s.options.eventHeight,width:i.offsetWidth},o.css(r),s._appendMoveHint(o)},_adjustLeftPosition:function(t){var e=this._view;return e._isRtl&&!e._isVerticallyGrouped()&&(t-=e.content[0].scrollWidth-e.content[0].offsetWidth),t}});l.ui.scheduler.TimelineGroupedView=x,l.ui.scheduler.TimelineGroupedByDateView=H,a=c.extend({init:function(t,e){var n=this;c.fn.init.call(n,t,e),n._groupedView=n._getGroupedView(),n.title=n.options.title||n.options.name,n._workDays=i(n.options),n._templates(),n._editable(),n.calculateDateRange(),n._groups(),n._currentTime(!0)},name:"timeline",_getGroupedView:function(){return this._isGroupedByDate()?new l.ui.scheduler.TimelineGroupedByDateView(this):new l.ui.scheduler.TimelineGroupedView(this)},_getNextEventIndexBySlot:function(t,e,n){var i,o;if(this._isVerticallyGrouped())return l.ui.SchedulerView.fn._getNextEventIndexBySlot.call(this,t,e,n);for(i=0,o=0;oe[o].start.startDate())i++;else{if(!(t.startDate().getTime()===e[o].start.startDate().getTime()&&n>e[o].start.groupIndex))break;i++}return i},_getSelectedSlot:function(t,e,n,i,o,r){return this._isVerticallyGrouped()?l.ui.SchedulerView.fn._getSelectedSlot.call(this,t,e,n,i,o,r):t},_getSortedEvents:function(e){return this._isVerticallyGrouped()?l.ui.SchedulerView.fn._getSortedEvents.call(this,e):e.sort(function(e,n){var i=e.start.startDate().getTime()-n.start.startDate().getTime();return 0===i&&(e.start.isDaySlot&&!n.start.isDaySlot&&(i=-1),!e.start.isDaySlot&&n.start.isDaySlot&&(i=1)),0===i&&(i=e.start.groupIndex-n.start.groupIndex),0===i&&(i=t(e.element).index()-t(n.element).index()),i})},_currentTimeMarkerUpdater:function(){this._updateCurrentTimeMarker(new Date)},_updateCurrentTimeMarker:function(e){var n,i,o,r,s,a,d,u,c,f,_,p,v,g=this.options;if(this.datesHeader.find("."+T).remove(),this.times.find("."+T).remove(),this.content.find("."+T).remove(),this._isInDateSlot({start:e,end:e}))for(g.currentTimeMarker.useLocalTimezone===!1&&(n=g.dataSource.options.schema.timezone,g.dataSource&&n&&(i=l.timezone.offset(e,n),e=l.timezone.convert(e,e.getTimezoneOffset(),i))),o=g.group&&"vertical"!=g.group.orientation?this.groups.length:1,r=0;r",_=this.datesHeader.find("."+D),p=Math.round(d[0].innerRect(e,new Date(e.getTime()+1),!1).left),v=t(f).prependTo(_).addClass(k+"-down"),v.css({left:this._adjustLeftPosition(p-h(v)*y/2),top:_.find("tr:last").prev().position().top}),t(f).prependTo(this.content).css({left:this._adjustLeftPosition(p),width:"1px",height:this.content[0].scrollHeight-1,top:0})))}},_adjustLeftPosition:function(t){return this._groupedView._adjustLeftPosition(t)},_currentTime:function(t){var n=this,i=n.options.currentTimeMarker;i!==!1&&i.updateInterval!==e&&(n._currentTimeMarkerUpdater(),t&&(n._currentTimeUpdateTimer=setInterval(p(this._currentTimeMarkerUpdater,n),i.updateInterval)))},_editable:function(){this.options.editable&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var e=this;e.element.on("click"+S,".k-event a:has(.k-i-close)",function(n){e.trigger("remove",{uid:t(this).closest(".k-event").attr(l.attr("uid"))}),n.preventDefault()}),e.options.editable.create!==!1&&e.element.on("dblclick"+S,".k-scheduler-content td",function(t){var n,i=e._slotByPosition(t.pageX,t.pageY);i&&(n=e._resourceBySlot(i),e.trigger("add",{eventInfo:_({start:i.startDate(),end:i.endDate()},n)})),t.preventDefault()}),e.options.editable.update!==!1&&e.element.on("dblclick"+S,".k-event",function(n){e.trigger("edit",{uid:t(this).closest(".k-event").attr(l.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var n=this,i=0;l.support.mobileOS.android&&(i=5),n.options.editable.create!==!1&&(n._addUserEvents=new l.UserEvents(n.element,{threshold:i,filter:".k-scheduler-content td",tap:function(t){var i,o=t.x.location!==e?t.x.location:t.x,r=t.y.location!==e?t.y.location:t.y,s=n._slotByPosition(o,r);s&&(i=n._resourceBySlot(s),n.trigger("add",{eventInfo:_({start:s.startDate(),end:s.endDate()},i)})),t.preventDefault()}})),n.options.editable.update!==!1&&(n._editUserEvents=new l.UserEvents(n.element,{threshold:i,filter:".k-event",tap:function(e){var i=t(e.target).closest(".k-event");i.hasClass("k-event-active")||n.trigger("edit",{uid:i.attr(l.attr("uid"))}),e.preventDefault()}}))},_slotByPosition:function(t,e){var n,i,o,r=this.content,s=r.offset();for(t-=s.left,e-=s.top,this._isRtl?(o=l.support.browser,o.mozilla?(t+=r[0].scrollWidth-r[0].offsetWidth,t+=r[0].scrollLeft):o.msie?(t-=r.scrollLeft(),t+=r[0].scrollWidth-r[0].offsetWidth):o.webkit&&(t+=r[0].scrollLeft)):t+=r[0].scrollLeft,e+=r[0].scrollTop,t=Math.ceil(t),e=Math.ceil(e),i=0;il&&(l+=m),p=(l-a)/h),p=o?1:Math.round(p),r&&(p*=r);_',n=o.footer.command,n&&"workDay"===n?(e+='"):e+=" ",e+="",this.footer=t(e).appendTo(this.element),i=this,this.footer.on("click"+S,".k-scheduler-fullday",function(t){t.preventDefault(),i.trigger("navigate",{view:i.name||o.name,date:i.startDate(),isWorkDay:!o.showWorkHours})}))},_columnCountForLevel:function(t){var e=this.columnLevels[t];return e?e.length:0},_rowCountForLevel:function(t){var e=this.rowLevels[t];return e?e.length:0},_isWorkDay:function(t){var e,n=t.getDay(),i=this._workDays;for(e=0;e",a+=e._groupedView._addContent(t,s,o,r,n,i,d,u),a+="",this.content.find("table").append(a)},_groups:function(){var t,e,n,i,o,r,s=this._groupCount(),a=this._dates,d=a.length;for(this.groups=[],t=0;te?n=e:n1?this._eventsByResource(s,e.slice(1),n):n.push(s);else n.push(t)},_isInDateSlot:function(t){var e=t.start,n=t.end,i=v(this._startDate),o=l.date.addDays(v(this.visibleEndDate()),1);return e=a&&(d=v(n),u(d,s),f=!0),r>a&&r<=s&&(c=v(i),u(c,a),h=!0)):(s>o?(d=v(n),u(d,s),f=!0):a<=o&&(d=v(n),d=l.date.addDays(d,1),u(d,s),f=!0),ar&&(c=v(i),c=l.date.addDays(c,-1),u(c,a),h=!0)),e=t.clone({start:d?d:n,end:c?c:i,_startTime:d?l.date.toUtcTime(d):t._startTime,_endTime:c?l.date.toUtcTime(c):t._endTime,isAllDay:!1}),{occurrence:e,head:h,tail:f}},_renderEvents:function(t,e,n){var i,o,r,s,a,l,d,u,c,h,f;for(o=0,r=t.length;o=m,a=this.content,(s||this._isInTimeSlot(i))&&(l=this._adjustEvent(i),d=this.groups[e],d._continuousEvents||(d._continuousEvents=[]),this._isInTimeSlot(l.occurrence)&&(u=d.slotRanges(l.occurrence,!1),c=u[0],h=c.start.index,f=c.end.index,this._groupedView._renderEvent(n,i,l,d,c,a,h,f))))},addContinuousEvent:function(t,e,n,i){var o=t._continuousEvents;o.push({element:n,isAllDay:i,uid:n.attr(l.attr("uid")),start:e.start,end:e.end})},_createEventElement:function(e,n,i,o){var r,s,a=this.eventTemplate,d=this.options.editable,u=this._isMobile(),c=d&&d.destroy!==!1&&!u,h=d&&d.resize!==!1,f=n._time("start"),p=n._time("end"),v=n.start,g=n.end,m=this.eventResources(n);return n._startTime&&f!==l.date.getMilliseconds(n.start)&&(v=new Date(f),v=l.timezone.apply(v,"Etc/UTC")),n._endTime&&p!==l.date.getMilliseconds(n.end)&&(g=new Date(p),g=l.timezone.apply(g,"Etc/UTC")),r=_({},{ns:l.ns,resizable:h,showDelete:c,head:i,tail:o,singleDay:1==this._dates.length,resources:m,inverseColor:!(!m||!m[0])&&this._shouldInverseResourceColor(m[0]),messages:this.options.messages},n,{start:v,end:g}),s=t(a(r)),this.angular("compile",function(){return{elements:s,data:[{dataItem:r}]}}),s},_arrangeRows:function(t,e,n){var i,o,s,a,l,d,u=e.start.index,h=e.end.index,f=t.slotRange.innerRect(t.start,t.end,!1),_=f.right+this.options.eventMinWidth,p=r(e.events(),f.left,_);for(e.addEvent({slotIndex:u,start:u,end:h,rectLeft:f.left,rectRight:_,element:t.element,uid:t.uid}),p.push({start:u,end:h,uid:t.uid}),i=c.createRows(p),n.maxRowCount=m||this._isInTimeSlot(a)))for(i=this._adjustEvent(a),o=s.slotRanges(i.occurrence,!1),r=0;r=this.groups.length-1))return this._groupedView._nextGroupSlot(o,i,n)},_verticalSlots:function(t,e,n,i){var o=this._groupedView,r=o._verticalMethod(i,n),s=e[0].start,a=e[e.length-1].end,l=this.groups[t.groupIndex],d=o._normalizeVerticalSelection(t,e,i,n);return d&&(s=a=d),s=l[r](s),a=l[r](a),n||!this._isVerticallyGrouped()||s&&a||(s=a=o._verticalSlots(t,i,d)),{startSlot:s,endSlot:a}},_horizontalSlots:function(t,e,n,i){var o=i?"upSlot":"downSlot",r=e[0].start,s=e[e.length-1].end,a=this.groups[t.groupIndex],l={};return n?(l.startSlot=a[o](r),l.endSlot=a[o](s),n||!this._isHorizontallyGrouped()||r&&s||(l.startSlot=l.endSlot=this._changeGroup(t,i))):l=this._groupedView._horizontalSlots(t,a,o,r,s,n,i),l},_changeViewPeriod:function(t,e){var n,i=e?this.previousDate():this.nextDate(),o=t.start,r=t.end,s=new Date(i),a=new Date(i);return!this._isInRange(s,a)&&(t.start=s,t.end=a,this._isHorizontallyGrouped()&&(t.groupIndex=e?this.groups.length-1:0),n=r-o,e?(r=g(this.endTime()),r=0===r?m:r,u(t.start,r-n),u(t.end,r)):(o=g(this.startTime()),u(t.start,o),u(t.end,o+n)),t.events=[],!0)},move:function(t,e,n){var i,o,r,s,a,d=!1,u=this.groups[t.groupIndex],c=l.keys,h=this._groupedView,f=u.ranges(t.start,t.end,!1,!1);if(e===c.DOWN||e===c.UP){if(d=!0,r=e===c.UP,h._updateDirection(t,f,n,r),s=this._verticalSlots(t,f,n,r),h._changeVerticalViewPeriod(s,n,t,r))return d}else if((e===c.LEFT||e===c.RIGHT)&&(d=!0,r=e===c.LEFT,this._updateDirection(t,f,n,r,!1),s=this._horizontalSlots(t,f,n,r),h._changeHorizontalViewPeriod(s,n,t,r)))return d;return d&&(i=s.startSlot,o=s.endSlot,n?(a=t.backward,a&&i?t.start=i.startDate():!a&&o&&(t.end=o.endDate())):i&&o&&(t.start=i.startDate(),t.end=o.endDate()),t.events=[]),d},destroy:function(){var t=this;t.element&&t.element.off(S),t.footer&&t.footer.remove(),t._currentTimeUpdateTimer&&clearInterval(t._currentTimeUpdateTimer),c.fn.destroy.call(this),this._isMobile()&&t.options.editable&&(t.options.editable.create!==!1&&t._addUserEvents.destroy(),t.options.editable.update!==!1&&t._editUserEvents.destroy()); }}),_(!0,d,{TimelineView:a,TimelineWeekView:a.extend({options:{name:"TimelineWeekView",title:"Timeline Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",majorTick:120},name:"timelineWeek",calculateDateRange:function(){var t,e,n=this.options.date,i=l.date.dayOfWeek(n,this.calendarInfo().firstDay,-1),o=[];for(t=0,e=7;t