text: ﻿/*!
  *  filename: ej.gantt.min.js
  *  version : 15.1.0.33
  *  Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
  *  Use of this code is subject to the terms of our license.
  *  A copy of the current license can be obtained at any time by e-mailing
  *  licensing@syncfusion.com. Any infringement will be prosecuted under
  *  applicable laws. 
  */
  (function(n){typeof define=="function"&&define.amd?define(["./ej.treegrid.min","./../common/ej.globalize.min","jsrender","./../common/ej.core.min","./../common/ej.data.min","./../common/ej.draggable.min","./../common/ej.scroller.min","./ej.button.min","./ej.splitter.min","./ej.dialog.min","./ej.datepicker.min","./ej.datetimepicker.min","./ej.checkbox.min","./ej.dropdownlist.min","./ej.editor.min","./ej.maskedit.min","./ej.toolbar.min","./ej.tooltip.min"],n):n()})(function(){(function(n,r,u){r.widget("ejGantt","ej.Gantt",{_rootCSS:"e-gantt",element:null,validTags:["div"],model:null,_tags:[{tag:"holidays",attr:["day","background","label"],content:"template"},{tag:"stripLines",attr:["day","label","lineStyle","lineColor","lineWidth"],content:"template"},{tag:"editDialogFields",attr:["field","editType"],content:"template"},{tag:"addDialogFields",attr:["field","editType"],content:"template"},{tag:"sortSettings.sortedColumns",attr:["field","direction"]},{tag:"dayWorkingTime",attr:["from","to"],singular:"dayWorkingTime"}],_holidays:function(){this._$ganttchartHelper.ejGanttChart("refreshHolidays");this._trigger("refresh")},_stripLines:function(){this._$ganttchartHelper.ejGanttChart("refreshStripLines");this._trigger("refresh")},_editDialogFields:function(){this._trigger("refresh")},_addDialogFields:function(){this._trigger("refresh")},defaults:{allowSorting:!1,allowColumnResize:!1,allowSelection:!0,allowMultipleExporting:!1,allowDragAndDrop:!1,dragTooltip:{showTooltip:!1,tooltipItems:[],tooltipTemplate:""},dataSource:null,showColumnChooser:!1,showColumnOptions:!1,query:null,splitterSettings:{position:"",index:-1},splitterPosition:"",taskIdMapping:"",parentTaskIdMapping:"",taskNameMapping:"",startDateMapping:"",endDateMapping:"",baselineStartDateMapping:"",baselineEndDateMapping:"",childMapping:"",durationMapping:"",milestoneMapping:"",progressMapping:"",predecessorMapping:"",resourceInfoMapping:"",taskSchedulingModeMapping:"",notesMapping:"",resources:[],holidays:[],searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},highlightWeekends:!0,scheduleStartDate:null,scheduleEndDate:null,enableProgressBarResizing:!0,rowHeight:30,includeWeekend:!0,taskSchedulingMode:"auto",validateManualTasksOnLinking:!1,toolbarSettings:{showToolbar:!1,toolbarItems:[]},stripLines:[],workingTimeScale:"TimeScale8Hours",roundOffDayworkingTime:!0,durationUnit:"day",workUnit:"hours",taskType:"fixedUnit",perMinuteWidth:null,perHourWidth:null,perDayWidth:null,perWeekWidth:null,perMonthWidth:null,minuteInterval:null,scheduleHeaderSettings:{weekHeaderFormat:"MMM dd , yyyy",dayHeaderFormat:"",yearHeaderFormat:"yyyy",monthHeaderFormat:"MMM",hourHeaderFormat:"HH",scheduleHeaderType:"week",minutesPerInterval:"auto",weekendBackground:"",timescaleStartDateMode:"auto",timescaleUnitSize:"100%",weekStartDay:0},taskbarBackground:"",progressbarBackground:"",connectorLineBackground:"",parentTaskbarBackground:"",parentProgressbarBackground:"",connectorlineWidth:1,readOnly:!1,showTaskNames:!0,leftTaskLabelMapping:"",rightTaskLabelMapping:"",leftTaskLabelTemplate:"",rightTaskLabelTemplate:"",showGridCellTooltip:!1,cellTooltipTemplate:null,showGridExpandCellTooltip:!1,showProgressStatus:!0,showResourceNames:!0,enableTaskbarDragTooltip:!0,enableTaskbarTooltip:!0,enableWBS:!1,enableWBSPredecessor:!1,editSettings:{allowEditing:!1,allowAdding:!1,allowDeleting:!1,allowIndent:!1,editMode:"normal",beginEditAction:"dblclick",rowPosition:"belowselectedrow"},flatRecords:[],parentRecords:[],currentViewData:[],updatedRecords:[],ids:[],allowKeyboardNavigation:!0,cssClass:"",locale:"en-US",allowMultiSorting:!1,sortSettings:{sortedColumns:[]},enableAltRow:!0,enableVirtualization:!1,progressbarHeight:100,taskbarTooltipTemplate:"",progressbarTooltipTemplate:"",taskbarTooltipTemplateId:"",dateFormat:"",resourceIdMapping:"",resourceNameMapping:"",resourceUnitMapping:"",progressbarTooltipTemplateId:"",taskbarEditingTooltipTemplateId:"",taskbarEditingTooltipTemplate:"",selectedRowIndex:-1,allowGanttChartEditing:!0,sizeSettings:{height:"",width:""},selectedItem:null,selectionType:"single",selectionMode:"row",selectedCellIndexes:[],weekendBackground:"",baselineColor:"#fba41c",treeColumnIndex:0,editDialogFields:[],addDialogFields:[],columnDialogFields:[],renderBaseline:!1,enableContextMenu:!1,enableResize:!0,isResponsive:!0,enableCollapseAll:!1,enablePredecessorValidation:!0,taskbarTemplate:"",parentTaskbarTemplate:"",milestoneTemplate:"",durationUnitMapping:"",dayWorkingTime:[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}],exportToExcelAction:"",rowSelecting:null,rowSelected:null,rowDragStart:null,rowDrag:null,rowDragStop:null,cellSelecting:null,cellSelected:null,queryCellInfo:null,queryTaskbarInfo:null,beginEdit:null,endEdit:null,rowDataBound:null,expanding:null,expanded:null,collapsing:null,collapsed:null,actionBegin:null,actionComplete:null,taskbarEditing:null,taskbarEdited:null,load:null,create:null,contextMenuOpen:null,taskbarClick:null,taskbarHeight:20},dataTypes:{allowSorting:"boolean",allowColumnResize:"boolean",allowSelection:"boolean",dataSource:"data",query:"data",taskIdMapping:"string",parentTaskIdMapping:"string",taskNameMapping:"string",startDateMapping:"string",endDateMapping:"string",baselineStartDateMapping:"string",baselineEndDateMapping:"string",childMapping:"string",durationMapping:"string",milestoneMapping:"string",progressMapping:"string",predecessorMapping:"string",resourceInfoMapping:"string",taskSchedulingModeMapping:"string",resources:"array",holidays:"array",dayWorkingTime:"array",highlightWeekends:"boolean",scheduleStartDate:"data",scheduleEndDate:"data",enableProgressBarResizing:"boolean",rowHeight:"number",includeWeekend:"boolean",taskSchedulingMode:"string",validateManualTasksOnLinking:"boolean",toolbarSettings:{showToolbar:"boolean",toolbarItems:"array"},stripLines:"array",scheduleHeaderSettings:"data",roundOffDayworkingTime:"boolean",taskbarBackground:"string",progressbarBackground:"string",connectorLineBackground:"string",parentTaskbarBackground:"string",parentProgressbarBackground:"string",connectorlineWidth:"number",readOnly:"boolean",showTaskNames:"boolean",leftTaskLabelMapping:"string",rightTaskLabelMapping:"string",leftTaskLabelTemplate:"string",rightTaskLabelTemplate:"string",showProgressStatus:"boolean",showResourceNames:"boolean",enableTaskbarDragTooltip:"boolean",enableTaskbarTooltip:"boolean",editSettings:"data",flatRecords:"array",parentRecords:"array",currentViewData:"array",ids:"array",updatedRecords:"array",allowKeyboardNavigation:"boolean",cssClass:"string",locale:"string",allowMultiSorting:"boolean",showGridExpandCellTooltip:"boolean",sortSettings:{sortedColumns:"array"},enableAltRow:"boolean",enableVirtualization:"boolean",progressbarHeight:"number",taskbarTooltipTemplate:"string",progressbarTooltipTemplate:"string",taskbarTooltipTemplateId:"string",dateFormat:"string",resourceIdMapping:"string",resourceNameMapping:"string",resourceUnitMapping:"string",progressbarTooltipTemplateId:"string",taskbarEditingTooltipTemplateId:"string",taskbarEditingTooltipTemplate:"string",allowGanttChartEditing:"boolean",size:{height:"string",width:"string"},weekendBackground:"string",baselineColor:"string",renderBaseline:"boolean",enableContextMenu:"boolean",showGridCellTooltip:"boolean",treeColumnIndex:"number",editDialogFields:"array",addDialogFields:"array",showColumnChooser:"boolean",enableResize:"boolean",isResponsive:"boolean",enableCollapseAll:"boolean",enablePredecessorValidation:"boolean",durationUnitMapping:"string",taskbarTemplate:"string",parentTaskbarTemplate:"string",milestoneTemplate:"string",taskbarHeight:"number"},ignoreOnExport:["isEdit","toolbarClick","query","queryCellInfo","selectionType","currentViewData","enableRTL","rowDataBound","editSettings","localization","cssClass","dataSource","allowKeyboardNavigation"],observables:["selectedItem","selectedRowIndex","selectedCellIndexes","splitterPosition","dataSource","splitterSettings.position"],selectedItem:r.util.valueFunction("selectedItem"),selectedRowIndex:r.util.valueFunction("selectedRowIndex"),selectedCellIndexes:r.util.valueFunction("selectedCellIndexes"),splitterPosition:r.util.valueFunction("splitterSettings.position"),dataSource:r.util.valueFunction("dataSource"),_splitterPosition:r.util.valueFunction("splitterPosition"),getColumns:function(){return this._columns},setColumns:function(n){this._columns=n},customColumnFields:function(){for(var t=this,u=t.model,i=t._columns,r=i.length,n=0;n<r;n++)t._columnHeaderTexts[i[n].field]||(t._columnHeaderTexts[i[n].field]=i[n].headerText)},_init:function(){var t=this,n=t.model,i=n.scheduleHeaderSettings.minutesPerInterval,u=n.durationUnit;n.isdesignMode&&(n.taskIdMapping="Id",n.taskNameMapping="Name",n.startDateMapping="StartDate",n.durationMapping="Duration",n.progressMapping="Progress",n.scheduleStartDate="02/23/2014",n.scheduleEndDate="03/10/2014",this.dataSource([{Id:1,Name:"Task 1",StartDate:"02/23/2014",Duration:5,Progress:40},{Id:2,Name:"Task 2",StartDate:"02/24/2014",Duration:5,Progress:40},{Id:3,Name:"Task 3",StartDate:"02/25/2014",Duration:5,Progress:40}]),n.sizeSettings.height="300px",n.sizeSettings.width="800px");n.scheduleStartDate||n.scheduleEndDate||i!="auto"||(n.scheduleHeaderSettings.minutesPerInterval=r.Gantt.minutesPerInterval.FiveMinutes);t._initPrivateProperties();t._trigger("load");t.element.addClass("e-gantt-core");this.dataSource()!==null?this._checkDataBinding():t._initialize()},_setTaskbarHeight:function(n){this.taskbarHeight=n<this.model.rowHeight?n:this.model.rowHeight;this._milesStoneWidth=Math.floor(this.taskbarHeight/2)*2},_deSelectRowItem:function(){var n=this,t=n.model;n._$ganttchartHelper.ejGanttChart("selectRows",-1);n._$treegridHelper.ejTreeGrid("selectRows",-1);this.selectedRowIndex(-1);t.selectedItem=null},_checkDataBinding:function(){var t=this,i=t.model,e,o,u,f;if(this.dataSource()==null&&this.dataSource([]),this.dataSource()instanceof r.DataManager)this._initDataSource();else if(this.dataSource().length>0){if(i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t.dataSource(),o=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o);t._createGanttRecords(t.secondaryDatasource)}else t._createGanttRecords(this.dataSource());t._initialize()}else t._initialize()},_initDataSource:function(){var t=this,i=t.model,u=this._columnToSelect(),f=this.dataSource().executeQuery(u);f.done(r.proxy(function(r){var e,o,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=r.result,o=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createGanttRecords(t.secondaryDatasource);t._initialize()}))},_columnToSelect:function(){var t=this,n=t.model,i=r.Query();return n.query?n.query:i},_intersectionObjects:function(n,t){for(var r=[],i;n.length>0&&t.length>0;)i=t.indexOf(n[0]),i==-1?n.shift():(r.push(n.shift()),t.splice(i,1));return r},_reconstructDatasource:function(n){var u=this,f=u.model,i,s,e,t,o,h,c;for(s=r.Predicate(f.parentTaskIdMapping,r.FilterOperators.notEqual,"null"),i=r.DataManager(n).executeLocal(r.Query().where(s).group(f.parentTaskIdMapping)),e=[],t=0;t<i.length;t++){if(!r.isNullOrUndefined(i[t].key)&&(o=u._taskIds.indexOf(i[t].key),o>-1)){n[o][f.childMapping]=i[t].items;continue}h=i[t].items;for(c in i[t].items)e.push(h[c])}u.secondaryDatasource=u._intersectionObjects(n,e)},updateScheduleDates:function(t,i){var u=this,e=this.model,o=e.scheduleHeaderSettings.scheduleHeaderType,s,f;e.scheduleStartDate=t;e.scheduleEndDate=i;u._scheduleDays=[];u._scheduleMonths=[];u._scheduleWeeks=[];u._scheduleYears=[];u._scheduleHours=[];u._scheduleMinutes=[];u._calculateHeaderDates();s=n("#ejGanttChart"+u._id).ejGanttChart("instance");f=s.model;u._isTreeGridRendered=!1;u._isGanttChartRendered=!1;u._isChartRendering=!0;u._updateGanttRecords();f.projectStartDate=u._getDateFromFormat(u._projectStartDate);f.projectEndDate=u._getDateFromFormat(u._projectEndDate);f.scheduleDays=u._scheduleDays;f.scheduleMonths=u._scheduleMonths;f.scheduleWeeks=u._scheduleWeeks;f.scheduleYears=u._scheduleYears;f.scheduleHours=u._scheduleHours;f.scheduleMinutes=u._scheduleMinutes;f.renderBaseline=e.renderBaseline;f.scheduleHeaderSettings.scheduleHeaderType=o;o=="week"?(f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.weekHeaderFormat=e.scheduleHeaderSettings.weekHeaderFormat,f.scheduleHeaderSettings.dayHeaderFormat=e.scheduleHeaderSettings.dayHeaderFormat,f.durationUnit=e.durationUnit,f.perDayWidth=u._perDayWidth):o=="day"?(f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.dayHeaderFormat=e.scheduleHeaderSettings.dayHeaderFormat,f.scheduleHeaderSettings.hourHeaderFormat=e.scheduleHeaderSettings.hourHeaderFormat,f.durationUnit=e.durationUnit,f.perHourWidth=u._perHourWidth,f.perDayWidth=u._perDayWidth):o=="hour"?(f.dateFormat=e.dateFormat,f.durationUnit=r.Gantt.DurationUnit.Minute,f.scheduleHeaderSettings.minutesPerInterval=e.scheduleHeaderSettings.minutesPerInterval,f.workingTimeScale=e.workingTimeScale,f.minuteInterval=u._minuteInterval,f.perMinuteWidth=u._perMinuteWidth,f.perDayWidth=u._perDayWidth):o=="month"?(f.durationUnit=e.durationUnit,f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.monthHeaderFormat=e.scheduleHeaderSettings.monthHeaderFormat,f.scheduleHeaderSettings.weekHeaderFormat=e.scheduleHeaderSettings.weekHeaderFormat,f.perDayWidth=u._perDayWidth,f.perWeekWidth=u._perWeekWidth):o=="year"&&(f.durationUnit=e.durationUnit,f.dateFormat=e.dateFormat,f.scheduleHeaderSettings.yearHeaderFormat=e.scheduleHeaderSettings.yearHeaderFormat,f.perDayWidth=u._perDayWidth,f._perMonthWidth=u._perMonthWidth);n("#ejGanttChart"+u._id).ejGanttChart("refreshChartHeader",u._getDateFromFormat(t),u._getDateFromFormat(i));n("#ejGanttChart"+u._id).ejGanttChart("refreshContainersWidth");u._$ganttchartHelper.ejGanttChart("refreshHelper",u.model.currentViewData,u.model.updatedRecords,u._totalCollapseRecordCount);e.predecessorMapping&&(u._$ganttchartHelper.ejGanttChart("clearConnectorLines"),u._connectorlineIds=[],u._connectorLinesCollection=[],u._isValidationEnabled=!1,u._createConnectorLinesCollection(),u._isValidationEnabled=!0);s._$bodyContainer.ejScroller("refresh");u._isTreeGridRendered=!0;u._isGanttChartRendered=!0;u._isChartRendering=!1},reRenderChart:function(t){var i=this,u=i.model,e=i._getDateFromFormat(u.scheduleStartDate),o=i._getDateFromFormat(u.scheduleEndDate),f,s;u.flatRecords=[];u.parentRecords=[];n("#ejGanttChart"+i._id).empty();switch(t){case r.Gantt.ScheduleHeaderType.Week:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Week;i._perDayWidth=u.perDayWidth;i._calculateWeekSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Day:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Day;i._perHourWidth=u.perHourWidth;i._perDayWidth=i._perHourWidth*24;i._calculateDaySplit(e,o);break;case r.Gantt.ScheduleHeaderType.Month:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Month;i._perDayWidth=u.perDayWidth;i._perWeekWidth=u.perWeekWidth;i._calculateMonthSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Year:u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Year;i._perDayWidth=u.perDayWidth;i._perMonthWidth=u.perMonthWidth;i._calculateYearSplit(e,o);break;case r.Gantt.ScheduleHeaderType.Hour:if(u.scheduleHeaderSettings.scheduleHeaderType=r.Gantt.ScheduleHeaderType.Hour,f=u.scheduleHeaderSettings.minutesPerInterval,s=r.Gantt.minutesPerInterval,i._perMinuteWidth=u.perMinuteWidth,f)if(f==s.Auto){var h=o-e;h>864e6?(i._minuteInterval=30,i._perDayWidth=i._perMinuteWidth*48):h>6048e5?(i._minuteInterval=15,i._perDayWidth=i._perMinuteWidth*96):h>1728e5?(i._minuteInterval=5,i._perDayWidth=i._perMinuteWidth*288):(i._minuteInterval=1,i._perDayWidth=i._perMinuteWidth*1440)}else f==s.OneMinute?(i._minuteInterval=1,i._perDayWidth=i._perMinuteWidth*1440):f==s.FiveMinutes?(i._minuteInterval=5,i._perDayWidth=i._perMinuteWidth*288):f==s.FifteenMinutes?(i._minuteInterval=15,i._perDayWidth=i._perMinuteWidth*96):f==s.ThirtyMinutes&&(i._minuteInterval=30,i._perDayWidth=i._perMinuteWidth*48);i._calculateHourSplit(e,o)}i.element.ejGantt("destroy").ejGantt(u);i._isTreeGridRendered=!1;i._isGanttChartRendered=!1},changeTaskMode:function(n,t){var i=this,f=i.model,u={};u.data=n;i._isValidationEnabled=!0;t==r.Gantt.TaskSchedulingMode.Manual?(n.isAutoSchedule=!1,n.item[f.taskSchedulingModeMapping]=!0):t==r.Gantt.TaskSchedulingMode.Auto&&(n.isAutoSchedule=!0,n.item[f.taskSchedulingModeMapping]=!1);u.columnName="taskMode";i._updateEditedGanttRecords(u);i._isValidationEnabled=!1},autoSchedule:function(n){var t=this,u=t.model,i,f=u.updatedRecords;i=f.filter(function(t){return t.taskId===n});t.changeTaskMode(i[0],r.Gantt.TaskSchedulingMode.Auto)},manualSchedule:function(n){var t=this,u=t.model,i,f=u.updatedRecords;i=f.filter(function(t){return t.taskId===n});t.changeTaskMode(i[0],r.Gantt.TaskSchedulingMode.Manual)},_updateGanttRecords:function(){for(var i=this,f=i.model,e=f.flatRecords,o=e.length,n,t,u,r=0;r<o;r++)n=e[r],n.hasChildRecords===!1&&(n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n.width=n.isMilestone==!0?i._milesStoneWidth:f.flatRecords[r].width,n.progressWidth=n._calculateProgressWidth(n.width,n.status)),n.baselineStartDate&&n.baselineEndDate?(n.baselineLeft=n._calculateBaselineLeft(this),n.baselineRight=n._calculateBaselineRight(this),n.baselineWidth=n._calculateBaseLineWidth(this)):(n.baselineLeft=0,n.baselineRight=0,n.baselineWidth=0),t=n.parentItem,u=t&&t.childRecords,t&&u.indexOf(n)==u.length-1&&n.hasChildRecords===!1&&(t.isAutoSchedule?i._updateParentItem(n):i._updateManualParentItem(n))},_initPrivateProperties:function(){var n=this;model=n.model;scheduleMode=model.scheduleHeaderSettings.scheduleHeaderType;n._isFromGantt=!0;n._disabledToolItems=[];n._id=n.element.attr("id");n._scheduleWeeks=[];n._taskIds=[];n._duplicate=!1;n._wrongenddate=!1;n._addPosition=null;n._scheduleYears=[];n._scheduleMonths=[];n._scheduleYears=[];n._scheduleDays=[];n._scheduleHours=[];n._projectStartDate;n._projectEndDate;n._columns=[];n._storedIndex=-1;n._perDayWidth;n._prevDayWidth=0;n._rowIndexOfLastSelectedCell=-1;n._perMonthWidth;n._perWeekWidth;n._$treegridPane=null;n._$ganttchartPane=null;n._$treegrid=null;n._$ganttchart=null;n._$ejGantt=null;n._$treegridHelper=null;n._$ganttchartHelper=null;n._tdsOffsetWidth=[];n._subPosx=[];n._predecessorsCollection=[];n._connectorLinesCollection=[];n._updatedConnectorLineCollection=[];n._connectorlineIds=[];n._gridRows=null;n._collapsedRecordCount=0;n._expandedRecordsCount=0;n._totalCollapseRecordCount=0;n._isInExpandCollapse=!1;n._hiddenRecordCount=0;n.prevPredecessorTO=null;n.prevPredecessorFrom=null;n.prevPredecessorcount=0;n._isValidationEnabled=!0;n._isTreeGridRendered=!1;n._isGanttChartRendered=!1;n._isChartRendering=!1;n._holidaysList=n._getHoliday();n._stringHolidays=n._getStringHolidays();n._isinBeginEdit=!1;n._isMileStoneEdited=!1;n._cellEditColumn=null;n._isinAddnewRecord=!1;n._contextMenuItems=null;n._totalBorderWidth=2;n._totalBorderHeight=r.browserInfo().name=="msie"&&r.browserInfo().version<9?model.toolbarSettings.showToolbar?3:2:model.toolbarSettings.showToolbar?1:0;n._columnHeaderTexts=null;n._predecessorEditingTexts=null;n._editDialogTexts=null;n._toolboxTooltipTexts=null;n._durationUnitTexts=null;n._durationUnitEditText=null;n._workUnitTexts=null;n._taskTypeTexts=null;n._effortDrivenTexts=null;n._contextMenuTexts=null;n._columnMenuTexts=null;n._columnDialogTitle=null;n._deleteColumnText=null;n._okButtonText=null;n._cancelButtonText=null;n._confirmDeleteText=null;n._columnDialogTexts=null;n._newTaskTexts=null;n._months=null;n._days=null;n._dialogTabTitleTexts=null;n._isLoad=!0;n._updatedColumn="";n._isExistingUnitIsUpdated=!1;n._isDurationUpdated=!1;n._isResourceAddedOrRemoved=!1;n._newRecordResourceCollection=[];n._alertTexts=null;n._commonColumnWidth=150;n._searchString="";n._emptyDataColumns=[];n.secondaryDatasource=[];n._datasourceChildItems=[];n._$predecessorTable=null;n._mappingItems=[];n._editedDialogRecord=null;n._calculateDimensions();n._retrivedData=this.dataSource();n._isInExpandCollapseAll=!1;n._preTableCollection=[];n._defaultStartTime=null;n._defaultEndTime=null;n._workingTimeRanges=[];n._nonWorkingHours=[];this._validateTimeRange();JSON.stringify(model.dayWorkingTime)=='[{"from":"08:00 AM","to":"12:00 PM"},{"from":"01:00 PM","to":"05:00 PM"}]'&&(model.dayWorkingTime=model.workingTimeScale!=r.Gantt.workingTimeScale.TimeScale8Hours?[{from:"12:00 AM",to:"12:00 AM"}]:[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}]);n._secondsPerDay=n._getSecondsPerDay();n._timelineWidthCalculation();n._localizedLabels=n._getLocalizedLabels();n._setCultureInfo();n.setColumns(model.columns&&model.columns.length?model.columns:n.createTreeGridColumns());model.isRerender&&n._updateColumnDropDownData();n._updateColumnLocaleText();n._isRefreshAddedRecord=!1;n._isInAdd=!1;n._activeMenuItemId=null;n._isAddEditDialogSave=!1;n._setTaskbarHeight(model.taskbarHeight);n.isCriticalPathEnable=!1;n.criticalPathCollection=[];n.detailPredecessorCollection=[];n.collectionTaskId=[];n._enableDisableCriticalIcon=!1;n._generalTabColumnFields=[];n._addDialogGeneralColumns=[];n._addDialogcustomColumns=[];n._editDialogGeneralColumns=[];n._editDialogCustomColumns=[];model.resourceUnitMapping==""&&(model.resourceUnitMapping="unit");n._dialogTab=["General","Predecessors","Resources","Custom Fields","Notes"]},_updateModelsWidth:function(){var n=this,t=n.model;t.perDayWidth=n._perDayWidth?n._perDayWidth:null;t.perMonthWidth=n._perMonthWidth?n._perMonthWidth:null;t.perWeekWidth=n._perWeekWidth?n._perWeekWidth:null;t.perHourWidth=n._perHourWidth?n._perHourWidth:null;t.perMinuteWidth=n._perMinuteWidth?n._perMinuteWidth:null;t.minuteInterval=n._minuteInterval?n._minuteInterval:null},_timelineWidthCalculation:function(n){var t=this,f=t.model,e=!0,h=f.scheduleHeaderSettings.scheduleHeaderType,a=f.scheduleHeaderSettings.timescaleUnitSize,c=a.toString(),i,l,o,s;if(n==u&&a!="100%"&&(e=!1,l=c.indexOf("-"),i=l!=-1?100:+c.match(/\d+/)[0],i<50?i=50:i>500&&(i=500),f.scheduleHeaderSettings.timescaleUnitSize=i+"%"),n!=u&&(e=!1,l=c.indexOf("-"),i=l!=-1?a:+c.match(/\d+/)[0],i<50?i=50:i>500&&(i=500),f.scheduleHeaderSettings.timescaleUnitSize=i+"%"),h=="week")t._perDayWidth=e?30:Math.round(i*.3),t._perMinuteWidth=t._perDayWidth/1440;else if(h=="year")t._perDayWidth=e?3:Math.round(i*.03),t._perMonthWidth=t._perDayWidth*30,t._perMinuteWidth=t._perDayWidth/1440;else if(h=="month")t._perDayWidth=e?10:Math.round(i*.1),t._perWeekWidth=t._perDayWidth*7,t._perHourWidth=t._perDayWidth/24,t._perMinuteWidth=t._perDayWidth/1440;else if(h=="day")t._perHourWidth=e?20:Math.round(i*.2),t._perMinuteWidth=t._perHourWidth/60,t._perDayWidth=t._perHourWidth*24;else if(h=="hour"&&(o=f.scheduleHeaderSettings.minutesPerInterval,s=r.Gantt.minutesPerInterval,t._perMinuteWidth=e?20:Math.round(i*.2),o))if(o==s.Auto){var y=t._getDateFromFormat(f.scheduleStartDate),p=t._getDateFromFormat(f.scheduleEndDate),v=p-y;v>864e6?(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48):v>6048e5?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):v>1728e5?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440)}else o==s.OneMinute?(t._minuteInterval=1,t._perDayWidth=t._perMinuteWidth*1440):o==s.FiveMinutes?(t._minuteInterval=5,t._perDayWidth=t._perMinuteWidth*288):o==s.FifteenMinutes?(t._minuteInterval=15,t._perDayWidth=t._perMinuteWidth*96):o==s.ThirtyMinutes&&(t._minuteInterval=30,t._perDayWidth=t._perMinuteWidth*48);t._updateModelsWidth()},_updateTimescaleUnitSize:function(n){var t=this,i=t.model,u=i.scheduleHeaderSettings,f=u.timescaleUnitSize,r;u.timescaleUnitSize=n;t._timelineWidthCalculation(n);t.updateScheduleDates(i.scheduleStartDate,i.scheduleEndDate);r=t.selectedRowIndex();r>=0&&t.focusOnTask(r)},_validateTimeRange:function(){for(var n,o="01/01/2016",a=this,f=this.model,l=f.dayWorkingTime.length,i=!0,u=null,e=0;e<l;e++)if(n=f.dayWorkingTime[e],n.from&&n.to){var s=r.parseDate(o+" "+n.from,"MM/dd/yyyy h:mm tt","en-US"),h=n.to!="12:00 AM"?r.parseDate(o+" "+n.to,"MM/dd/yyyy h:mm tt","en-US"):r.parseDate("01/02/2016 "+n.to,"MM/dd/yyyy h:mm tt","en-US"),v=h.getTime()-s.getTime(),c=this._getSecondsInDecimal(s),t=this._getSecondsInDecimal(h);t==0&&(t=86400);c>=t?i=!1:u==null?u=t:(u>=c||u>=t)&&(i=!1)}else i=!1;i||(f.dayWorkingTime=[{from:"08:00 AM",to:"12:00 PM"},{from:"01:00 PM",to:"05:00 PM"}])},_getParsedDate:function(n,t,i){return r.parseDate(n,t,i)},_setTime:function(n,t){var i=parseInt(n/3600),r=parseInt((n-i*3600)/60),u=n-i*3600-r*60;t.setHours(i,r,u,0)},_checkStartDate:function(n,t){var i=new Date(n),u=this.model,e=this._getSecondsInDecimal(i),f,c,l,o,s,h;if(e<this._defaultStartTime)this._setTime(this._defaultStartTime,i);else if(e>=this._defaultEndTime)i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i);else if(e>this._defaultStartTime&&e<this._defaultEndTime)for(f=0;f<this._workingTimeRanges.length;f++)if(c=this._workingTimeRanges[f],e>=c.to&&this._workingTimeRanges[f+1]&&e<this._workingTimeRanges[f+1].from){this._setTime(this._workingTimeRanges[f+1].from,i);break}do if(l=new Date(i),!r.isNullOrUndefined(t)&&t.isAutoSchedule&&(!u.includeWeekend||u.holidays.length>0)||r.isNullOrUndefined(t)&&(!u.includeWeekend||u.holidays.length>0))for(u.includeWeekend||(i.getDay()==0?(i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i)):i.getDay()==6&&(i.setDate(i.getDate()+2),this._setTime(this._defaultStartTime,i))),o=0;o<u.holidays.length;o++)s=this._getDateFromFormat(u.holidays[o].day),h=new Date(s),s.setHours(0,0,0,0),h.setHours(23,59,59,59),i.getTime()>=s.getTime()&&i.getTime()<h.getTime()&&(i.setDate(i.getDate()+1),this._setTime(this._defaultStartTime,i));while(l.getTime()!=i.getTime());return new Date(i)},_checkEndDate:function(n,t){var i=new Date(n),u=this.model,e=this._getSecondsInDecimal(i),f,l,a,s;if(e>this._defaultEndTime)this._setTime(this._defaultEndTime,i);else if(e<=this._defaultStartTime)i.setDate(i.getDate()-1),this._setTime(this._defaultEndTime,i);else if(e>this._defaultStartTime&&e<this._defaultEndTime)for(f=0;f<this._workingTimeRanges.length;f++)if(l=this._workingTimeRanges[f],e>l.to&&this._workingTimeRanges[f+1]&&e<=this._workingTimeRanges[f+1].from){this._setTime(this._workingTimeRanges[f].to,i);break}do if(a=new Date(i),!r.isNullOrUndefined(t)&&t.isAutoSchedule&&(!u.includeWeekend||u.holidays.length>0)||r.isNullOrUndefined(t)&&(!u.includeWeekend||u.holidays.length>0))for(u.includeWeekend||(i.getDay()==0?(i.setDate(i.getDate()-2),this._setTime(this._defaultEndTime,i)):i.getDay()==6?(i.setDate(i.getDate()-1),this._setTime(this._defaultEndTime,i)):i.getDay()==1&&this._defaultEndTime==86400&&this._getSecondsInDecimal(i)==0&&i.setDate(i.getDate()-2)),s=0;s<u.holidays.length;s++){var o=this._getDateFromFormat(u.holidays[s].day),h=new Date(o),c=new Date(i);c.setMinutes(i.getMinutes()-2);o.setHours(0,0,0,0);h.setHours(23,59,59,59);(i.getTime()>=o.getTime()&&i.getTime()<h.getTime()||c.getTime()>=o.getTime()&&c.getTime()<h.getTime())&&(i.setDate(i.getDate()-1),i.getTime()==o.getTime()&&this._defaultEndTime==86400&&this._getSecondsInDecimal(i)==0||this._setTime(this._defaultEndTime,i))}while(a.getTime()!=i.getTime());return new Date(i)},_checkBaseLineStartDate:function(n){var t=new Date(n),e=this.model,u=this._getSecondsInDecimal(t),i,f;if(r.isNullOrUndefined(n))return"";if(u<this._defaultStartTime)this._setTime(this._defaultStartTime,t);else if(u>=this._defaultEndTime)t.setDate(t.getDate()+1),this._setTime(this._defaultStartTime,t);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(i=0;i<this._workingTimeRanges.length;i++)if(f=this._workingTimeRanges[i],u>=f.to&&this._workingTimeRanges[i+1]&&u<this._workingTimeRanges[i+1].from){this._setTime(this._workingTimeRanges[i+1].from,t);break}return t},_checkBaseLineEndDate:function(n){var t=new Date(n),e=this.model,u=this._getSecondsInDecimal(t),i,f;if(r.isNullOrUndefined(n))return"";if(u>this._defaultEndTime)this._setTime(this._defaultEndTime,t);else if(u<=this._defaultStartTime)t.setDate(t.getDate()-1),this._setTime(this._defaultEndTime,t);else if(u>this._defaultStartTime&&u<this._defaultEndTime)for(i=0;i<this._workingTimeRanges.length;i++)if(f=this._workingTimeRanges[i],u>f.to&&this._workingTimeRanges[i+1]&&u<=this._workingTimeRanges[i+1].from){this._setTime(this._workingTimeRanges[i].to,t);break}return t},_getTaskLeft:function(n){var t=new Date(n),u=this.model,i=u.scheduleHeaderSettings.scheduleHeaderType;return(i==r.Gantt.ScheduleHeaderType.Week||i==r.Gantt.ScheduleHeaderType.Month||i==r.Gantt.ScheduleHeaderType.Year)&&this._getSecondsInDecimal(t)==this._defaultStartTime&&t.setHours(0,0,0,0),this._projectStartDate?(t.getTime()-this._projectStartDate.getTime())/864e5*this._perDayWidth:0},_getTaskWidth:function(n,t){var i=new Date(n),u=new Date(t),e=this.model,f=e.scheduleHeaderSettings.scheduleHeaderType;return(f==r.Gantt.ScheduleHeaderType.Week||f==r.Gantt.ScheduleHeaderType.Month||f==r.Gantt.ScheduleHeaderType.Year)&&(this._getSecondsInDecimal(i)==this._defaultStartTime&&i.setHours(0,0,0,0),this._getSecondsInDecimal(u)==this._defaultEndTime&&u.setHours(24)),timeDiff=u.getTime()-i.getTime(),timeDiff/864e5*this._perDayWidth},_getHolidaysCount:function(n,t){for(var i,f=this.model,e=this.model.holidays,r=0,u=0;u<e.length;u++)i=this._getDateFromFormat(e[u].day),n.getTime()<i.getTime()&&t.getTime()>=i.getTime()&&(f.includeWeekend||i.getDay()==0||i.getDay()==6?f.includeWeekend&&(r+=1):r+=1);return r},_getWeekendCount:function(n,t){var i=new Date(n),u=new Date(t),r=0;for(i.setHours(0,0,0,0),i.setDate(i.getDate()+1),u.setHours(0,0,0,0);i.getTime()<u.getTime();)i.getDay()==0&&(r+=1,i.setDate(i.getDate()+5)),i.getTime()<t.getTime()&&i.getDay()==6&&(r+=1),i.setDate(i.getDate()+1);return r},_getDayDiff:function(n,t){return(t.getTime()-n.getTime())/864e5},_getNumberOfSeconds:function(n,t){var i=new Date(n),r=new Date(t),u=0;return i.setHours(0,0,0,0),i.setDate(i.getDate()+1),r.setHours(0,0,0,0),i.getTime()<r.getTime()&&(u=(r.getTime()-i.getTime())/1e3),u},_getEndDate:function(n,t,i,u){for(var e=0,s=-1,h=0,f=new Date(n),l=-1,o,c,e=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Hour?t*3600:t*60:this._secondsPerDay*t;e>0;){for(s=this._getSecondsInDecimal(f),o=0;o<this._workingTimeRanges.length;o++)if(c=this._workingTimeRanges[o],s>=c.from&&s<=c.to){l=o;break}if(h=Math.round(this._workingTimeRanges[l].to-s),h<=e)f.setSeconds(f.getSeconds()+h),e-=h;else{f.setSeconds(f.getSeconds()+e);break}e>0&&(f=this._checkStartDate(f,u))}return f},_getStartDate:function(n,t,i,u){for(var e=0,o=-1,h=0,f=new Date(n),l=-1,s,c,e=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Hour?t*3600:t*60:this._secondsPerDay*t;e>0;){for(o=this._getSecondsInDecimal(f),this._workingTimeRanges.length>0&&this._workingTimeRanges[this._workingTimeRanges.length-1].to==86400&&o==0&&(o=86400),s=0;s<this._workingTimeRanges.length;s++)if(c=this._workingTimeRanges[s],o>=c.from&&o<=c.to){l=s;break}if(h=Math.round(o-this._workingTimeRanges[l].from),h<=e)f.setSeconds(f.getSeconds()-h),e-=h;else{f.setSeconds(f.getSeconds()-e);break}e>0&&(f=this._checkEndDate(f,u))}return f},_getDuration:function(n,t,i,u){var e=t.getTime()-n.getTime(),s,h=!this.model.includeWeekend&&u?this._getWeekendCount(n,t):0,c=0,f=0,o=this._getNumberOfSeconds(n,t),l=u?this._getHolidaysCount(n,t):0;return e=e/1e3,o=(o-h*86400-l*86400)/86400,c=this._getNonWorkingSecondsOnDate(n,t),f=e-o*(86400-this._secondsPerDay)-h*86400-l*86400-c,s=i&&i!=r.Gantt.DurationUnit.Day?i==r.Gantt.DurationUnit.Minute?f/60:f/3600:f/this._secondsPerDay,parseFloat(s.toFixed(2))},_getSecondsInDecimal:function(n){return n.getHours()*3600+n.getMinutes()*60+n.getSeconds()+n.getMilliseconds()/1e3},_getNonWorkingSecondsOnDate:function(n,t){for(var u,i=this,s=this._getSecondsInDecimal(n),h=this._getSecondsInDecimal(t),f=-1,e=-1,o=0,r=0;r<this._workingTimeRanges.length;r++)u=this._workingTimeRanges[r],s>=u.from&&s<=u.to&&(f=r),h>=u.from&&h<=u.to&&(e=r);return n.getDate()!=t.getDate()?o=i._nonWorkingHours[i._nonWorkingHours.length-1-f]+86400-i._defaultEndTime+(i._nonWorkingHours[e]+i._defaultStartTime):f!=e&&(o=i._nonWorkingHours[e]-i._nonWorkingHours[f]),o},_getSecondsPerDay:function(){for(var i,e="01/01/2016",n=this,o=this.model,s=o.dayWorkingTime.length,h=0,t=0;t<s;t++)if(i=o.dayWorkingTime[t],i.from&&i.to){var c=r.parseDate(e+" "+i.from,"MM/dd/yyyy h:mm tt","en-US"),l=i.to!="12:00 AM"?r.parseDate(e+" "+i.to,"MM/dd/yyyy h:mm tt","en-US"):r.parseDate("01/02/2016 "+i.to,"MM/dd/yyyy h:mm tt","en-US"),a=l.getTime()-c.getTime(),f=this._getSecondsInDecimal(c),u=this._getSecondsInDecimal(l);u==0&&(u=86400);h+=a/1e3;t==0&&(n._defaultStartTime=f);t==s-1&&(n._defaultEndTime=u);t>0?n._nonWorkingHours.push(n._nonWorkingHours[n._nonWorkingHours.length-1]+f-n._workingTimeRanges[t-1].to):n._nonWorkingHours.push(0);n._workingTimeRanges.push({from:f,to:u})}return h},_updateColumnLocaleText:function(){var i=this.model,n=i.columns,t;if(n&&n.length>0)for(t=0;t<n.length;t++)n[t].field&&this._columnHeaderTexts[n[t].field]&&(n[t].headerText=this._columnHeaderTexts[n[t].field])},_calculateDimensions:function(){var t=this,u=this.model.sizeSettings,i=u.height,r=u.width,n=t.element,f=n[0].style.height,e=n[0].style.width,o=n.parent().height(),s=n.parent().width();r&&n.css("width",r);i&&n.css("height",i);i||f||(f="450px",n.css("height","450px"));r||e||(e="100%",t.element.css("width","100%"));t._ganttHeight=n.height();t._ganttWidth=n.width();t._ganttHeight===0&&(t._ganttHeight=450,n.css("450px"))},_setCultureInfo:function(){var i=this,e=i.model,f=e.locale,t=n.extend({},i._localizedLabels,r.isNullOrUndefined(r.cultures[f])?r.cultures["default"]:r.cultures[f]),u=n.extend({},r.cultures["default"],r.Gantt.Locale["default"]);e.dateFormat=e.dateFormat?e.dateFormat:t&&t.calendars&&t.calendars.standard.patterns?t.calendars.standard.patterns.d:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.patterns.d:u.calendars.standard.patterns.d;i._emptyRecordText=t&&t.emptyRecord?t.emptyRecord:u.emptyRecord;i._columnHeaderTexts=t&&t.columnHeaderTexts?t.columnHeaderTexts:u.columnHeaderTexts;i._columnHeaderTexts=n.extend({},u.columnHeaderTexts,i._columnHeaderTexts);i._taskModeTexts=t&&t.taskModeTexts?t.taskModeTexts:u.taskModeTexts;i._taskModeTexts=n.extend({},u.taskModeTexts,i._taskModeTexts);i._editDialogTexts=t&&t.editDialogTexts?t.editDialogTexts:u.editDialogTexts;i._editDialogTexts=n.extend({},u.editDialogTexts,i._editDialogTexts);i._columnDialogTexts=t&&t.columnDialogTexts?t.columnDialogTexts:u.columnDialogTexts;i._toolboxTooltipTexts=t&&t.toolboxTooltipTexts?t.toolboxTooltipTexts:u.toolboxTooltipTexts;i._toolboxTooltipTexts=n.extend({},u.toolboxTooltipTexts,i._toolboxTooltipTexts);i._durationUnitTexts=t&&t.durationUnitTexts?t.durationUnitTexts:u.durationUnitTexts;i._durationUnitTexts=n.extend({},u.durationUnitTexts,i._durationUnitTexts);i._durationUnitEditText=t&&t.durationUnitEditText?t.durationUnitEditText:u.durationUnitEditText;i._durationUnitEditText=n.extend({},u.durationUnitEditText,i._durationUnitEditText);i._workUnitTexts=t&&t.workUnitTexts?t.workUnitTexts:u.workUnitTexts;i._workUnitTexts=n.extend({},u.workUnitTexts,i._workUnitTexts);i._taskTypeTexts=t&&t.taskTypeTexts?t.taskTypeTexts:u.taskTypeTexts;i._taskTypeTexts=n.extend({},u.taskTypeTexts,i._taskTypeTexts);i._effortDrivenTexts=t&&t.effortDrivenTexts?t.effortDrivenTexts:u.effortDrivenTexts;i._effortDrivenTexts=n.extend({},u.effortDrivenTexts,i._effortDrivenTexts);i._contextMenuTexts=t&&t.contextMenuTexts?t.contextMenuTexts:u.contextMenuTexts;i._contextMenuTexts=n.extend({},u.contextMenuTexts,i._contextMenuTexts);i._newTaskTexts=t&&t.newTaskTexts?t.newTaskTexts:u.newTaskTexts;i._months=t&&t.calendars?t.calendars.standard.months.namesAbbr:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.months.namesAbbr:u.calendars.standard.months.namesAbbr;i._days=t&&t.calendars?t.calendars.standard.months.namesAbbr:r.preferredCulture(f)?r.preferredCulture(f).calendars.standard.days.namesAbbr:u.calendars.standard.days.namesAbbr;i._columnMenuTexts=t&&t.columnMenuTexts?t.columnMenuTexts:u.columnMenuTexts;i._columnMenuTexts=n.extend({},u.contextMenuTexts,i._columnMenuTexts);i._columnDialogTitle=t&&t.columnDialogTitle?t.columnDialogTitle:u.columnDialogTitle;i._deleteColumnText=t&&t.deleteColumnText?t.deleteColumnText:u.deleteColumnText;i._okButtonText=t&&t.okButtonText?t.okButtonText:u.okButtonText;i._cancelButtonText=t&&t.cancelButtonText?t.cancelButtonText:u.cancelButtonText;i._confirmDeleteText=t&&t.confirmDeleteText?t.confirmDeleteText:u.confirmDeleteText;i._predecessorEditingTexts=t&&t.predecessorEditingTexts?t.predecessorEditingTexts:u.predecessorEditingTexts;i._predecessorEditingTexts=n.extend({},u.contextMenuTexts,i._predecessorEditingTexts);i._alertTexts=t&&t.alertTexts?t.alertTexts:u.alertTexts;i._alertTexts=n.extend({},u.alertTexts,i._alertTexts);i._dialogTabTitleTexts=t&&t.dialogTabTitleTexts?t.dialogTabTitleTexts:u.dialogTabTitleTexts;i._dialogTabTitleTexts=n.extend({},u.dialogTabTitleTexts,i._dialogTabTitleTexts);i._predecessorCollectionText=t&&t.predecessorCollectionText?t.predecessorCollectionText:u.predecessorCollectionText},_getMappingItems:function(){for(var n=this,u=n.model,i=[],r=n._columns.length,t=0;t<r;t++)i.push(n._columns[t].mappingName);return i},_getContextMenuItems:function(){var t=this,n=this._contextMenuTexts;return[{headerText:n.taskDetailsText,eventHandler:null,isDefault:!0,menuId:"Task"},{headerText:n.addNewTaskText,eventHandler:null,isDefault:!0,menuId:"Add"},{headerText:n.indentText,eventHandler:null,isDefault:!0,menuId:"Indent"},{headerText:n.outdentText,eventHandler:null,isDefault:!0,menuId:"Outdent"},{headerText:n.deleteText,eventHandler:null,isDefault:!0,menuId:"Delete"},{iconPath:null,headerText:n.aboveText,eventHandler:null,menuId:"Above",parentMenuId:"Add"},{iconPath:null,headerText:n.belowText,eventHandler:null,menuId:"Below",parentMenuId:"Add"}]},_initialize:function(){if(!this._isFromSetModel){var n=this,t=n.model;n._$treegridPane=r.buildTag("div.e-treegridPane");n._$ganttchartPane=r.buildTag("div.e-ganttchartPane");n._$ejGantt=r.buildTag("div.e-gantt-Spliter#e-ejSpliter"+n._id,"",{},{unselectable:"on"});t.predecessorMapping&&n._updatePredecessors();n._render();t.updatedRecords=t.flatRecords.slice();t.currentViewData=t.flatRecords.slice();t.predecessorMapping&&t.enablePredecessorValidation&&n._updatedRecordsDateByPredecessor();n._calculateScheduleDates();n._calculateHeaderDates();n._updateGanttRecords();n._checkDataManagerUpdate();n._renderTreeGrid();t.updatedRecords=n.getUpdatedRecords();t.currentViewData=n.getCurrentViewData();n._renderGanttChart();n._enableCreateCollection=!0;n._isValidationEnabled=!1;n._isLoad=!1;t.predecessorMapping&&n._createConnectorLinesCollection();n._isValidationEnabled=!0;n._$treegridPane.css({overflow:"hidden"});n._initiateDialogTemplates();n._isTreeGridRendered=!0;n._isGanttChartRendered=!0;n._gridRows=n.getRows();n._ganttChartRows=n.getGanttChartRows();n._createContextMenuTemplate();n._wireEvents();n._initialEndRendering();n._getLocalizedLabels()}},_getLocalizedLabels:function(){return r.getLocalizedConstants(this.sfType,this.model.locale)},_initialEndRendering:function(){var n=this,t=this.model,i;t.enableCollapseAll&&(this.selectedRowIndex()!=-1&&n._deSelectRowItem(),n._collapseAll());n.selectedRowIndex()>=0&&n.selectedRowIndex()<n.model.updatedRecords.length&&t.selectionMode=="row"&&(i={},i.recordIndex=n.selectedRowIndex(),i.previousIndex=t.selectedItem?t.updatedRecords.indexOf(t.selectedItem):-1,n.rowSelecting(i)&&(n.selectRows(n.selectedRowIndex()),n._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")))},_checkDataManagerUpdate:function(){var n=this,t=this.dataSource();n._isDataManagerUpdate=!1;n._jsonData=null;t instanceof r.DataManager&&(t.dataSource.offline&&t.dataSource.json?(n._isDataManagerUpdate=!0,n._jsonData=t.dataSource.json):t.dataSource.offline||(n._isDataManagerUpdate=!0,n._jsonData=n._retrivedData))},_initiateDialogTemplates:function(){var t=this,i=this.model,u;t.customColumnFields();(i.editSettings.allowEditing||i.editSettings.editMode=="normal"||i.editSettings.editMode=="dialogTemplate")&&(t.editDialogTemplate(),n("#"+this._id+"_dialogEdit").length===0&&t.element.append(t._renderDialog()));i.editSettings.allowAdding&&(t.addDialogTemplate(),n("#"+this._id+"_dialogAdd").length===0&&(u=r.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none","overflow-x":"hidden"},{id:this._id+"_dialogAdd"}),t.element.append(u)))},_render:function(){var n=this,t=n.element,i=n.model;n.model.toolbarSettings.showToolbar&&t.append(n._renderToolBar());n._ganttHeight=parseInt(n._ganttHeight)-n._getToolBarHeight()-n._totalBorderHeight;n._$treegrid=r.buildTag("div.ejTreeGrid#ejTreeGrid"+n._id,"",{height:n._ganttHeight},{});n._$ganttchart=r.buildTag("div.ejGanttChart#ejGanttChart"+n._id,"",{height:n._ganttHeight},{});n._$ganttchartPane.append(n._$ganttchart);n._$treegridPane.append(n._$treegrid);n._$ejGantt.append(n._$treegridPane);n._$ejGantt.append(n._$ganttchartPane);t.append(n._$ejGantt);n._renderGantt()},_renderDialog:function(){return r.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none","overflow-x":"hidden"},{id:this._id+"_dialogEdit"})},editDialogTemplate:function(){var t=this,f=t.model,u=n.extend([],t._columns),s=u.length,f=t.model,ft=-1,et=-1,at=t._$treegridHelper.data("ejTreeGrid"),ot,st=t._dialogTab,vt=st.length,w,l,b,a,e,y,k,d,i,g,nt,tt,it,rt,ut;if(t._editDialogGeneralColumns=[],t._editDialogCustomColumns=[],t._generalTabColumnFields=["taskId","taskMode","taskName","startDate","endDate","duration","resourceInfo","status","work","taskType","effortDriven","baselineStartDate","baselineEndDate","predecessor","WBS","notes"],t._mappingItems=t._getMappingItems(),s!=0){if(f.editDialogFields.length>0){for(w=[],l=0;l<f.editDialogFields.length;l++)b=n.grep(t._columns,function(n){return n.mappingName===f.editDialogFields[l].field}),b.length&&w.push(b[0]);u=w}else f.enableWBS&&(f.enableWBSPredecessor&&(a=u.filter(function(n){return n.mappingName!="WBSPredecessor"})),a&&a.length&&(u=a));for(e=n.map(u,function(n,t){if(n.mappingName==f.taskNameMapping)return t}),(e[0]+1)%3==0&&u.splice(e[0]-1,0,u.splice(e[0],1)[0]),s=u.length,i=0;i<s;i++)if(n.inArray(u[i].mappingName,t._mappingItems)!=-1){if(!f.resourceInfoMapping&&(u[i].field=="work"||u[i].field=="taskType"||u[i].field=="effortDriven"))continue;u[i].mappingName!==f.predecessorMapping&&u[i].mappingName!=f.resourceInfoMapping&&u[i].mappingName!=f.notesMapping+"Text"?(e=n.map(t._generalTabColumnFields,function(n,t){if(n==u[i].field)return t}),e.length>0?t._editDialogGeneralColumns.push(u[i]):t._editDialogCustomColumns.push(u[i])):u[i].mappingName!==f.baselineStartDateMapping&&u[i].mappingName!==f.baselineEndDateMapping&&(u[i].mappingName!==f.predecessorMapping?et=i:ft=i)}var v=r.buildTag("div","",{},{}),o=r.buildTag("div","",{},{id:t._id+"EditTab"}),h=r.buildTag("ul","",{},{});for(o.append(h),v.append(o),y=0;y<vt;y++)switch(st[y]){case"General":h.append("<li><a href='#"+t._id+"EditGeneral'>"+t._dialogTabTitleTexts.generalTabText+"<\/a><\/li>");k=r.buildTag("div","",{padding:"4px"},{id:t._id+"EditGeneral"});d=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"GeneralEditForm"});k.append(d);o.append(k);$form=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"EditForm"});$genearlTable=r.buildTag("table","",{"border-spacing":"2px","border-collapse":"separate"},{});$tr=r.buildTag("tr");var p=0,c=t._editDialogGeneralColumns,s=c.length;for(i=0;i<s;i++)p<3?(c[i].mappingName!==f.taskNameMapping?(p++,$td=r.buildTag("td","",{"text-align":"left",padding:"5px 5px 0","font-weight":"normal",outline:"none"},{})):(p+=2,$td=r.buildTag("td","",{"text-align":"left",padding:"5px 5px 0","font-weight":"normal",outline:"none"},{colspan:"2"})),$innerTable=r.buildTag("table","",{outline:"none","border-spacing":"2px","border-collapse":"separate"},{}),$inTr=r.buildTag("tr","",{"line-height":"1.4"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none",padding:"1px"},{}),$inTd.append("<label for='"+c[i].field+"' style='font-weight:normal;margin-bottom:0px;'>"+t._columnHeaderTexts[c[i].field]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue","",{padding:"1px"},{}),ot=t._columns.indexOf(c[i]),r.TreeGrid._initCellEditType(at,$inTd2,t._id,ot,"Edit"),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($genearlTable.append($tr),$tr=$tempTr=r.buildTag("tr"),i--,p=0);$genearlTable.append($tr);d.append($genearlTable);break;case"Predecessors":f.predecessorMapping&&ft!=-1&&(h.append("<li><a href='#"+t._id+"EditPredecessors'>"+t._dialogTabTitleTexts.predecessorsTabText+"<\/a><\/li>"),g=r.buildTag("div","",{padding:"0px"},{id:t._id+"EditPredecessors"}),nt=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"PredecessorEditForm"}),g.append(nt),o.append(g),$predecessorTable=r.buildTag("table#"+t._id+"predecessoreditTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},""),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"EditDialog_PredecesorAdd' class='e-addpre e-icon e-enable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.addPredecessor+"<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id='"+t._id+"EditDialog_PredecesorDelete' class='e-deletepre e-icon e-disable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$predecessorTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"predecessorEdit","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$predecessorTable.append($inTr2),nt.append($predecessorTable));break;case"Resources":f.resourceInfoMapping&&et!=-1&&(h.append("<li><a href='#"+t._id+"EditResources'>"+t._dialogTabTitleTexts.resourcesTabText+"<\/a><\/li>"),tt=r.buildTag("div","",{padding:"0px"},{id:t._id+"EditResources"}),it=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"ResourceEditForm"}),tt.append(it),o.append(tt),$resourceTable=r.buildTag("table#"+t._id+"resourceeditTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"EditDialog_ResourceAdd' class='e-addpre e-icon e-enable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.addPredecessor+"<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id='"+t._id+"EditDialog_ResourceDelete' class='e-deletepre e-icon e-disable e-edit-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$resourceTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"resourceEdit","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$resourceTable.append($inTr2),it.append($resourceTable));break;case"Custom Fields":t._editDialogCustomColumns.length>0&&(h.append("<li><a href='#"+t._id+"EditCustomFields'>"+t._dialogTabTitleTexts.customFieldsTabText+"<\/a><\/li>"),rt=r.buildTag("div","",{padding:"0px"},{id:t._id+"EditCustomFields"}),ut=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"CustomFieldsEditForm"}),rt.append(ut),o.append(rt),$customFieldTable=r.buildTag("table#"+t._id+"customFieldeditTable","",{width:"100%",outline:"none",position:"relative",left:"-2px",top:"4px","border-collapse":"collapse"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse"},""),$inTd=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"customFieldEdit","",{},{}),$inTd.append($preDiv),$inTr.append($inTd),$customFieldTable.append($inTr),ut.append($customFieldTable));break;case"Notes":var ht=f.editDialogFields,s=ht.length,e=n.map(ht,function(n,t){if(n.field==f.notesMapping)return t});if(f.notesMapping&&s==0||s>0&&e.length>0){h.append("<li><a href='#"+t._id+"EditNotes'>"+t._dialogTabTitleTexts.notesTabText+"<\/a><\/li>");var ct=r.buildTag("div","",{padding:"0px"},{id:t._id+"EditNotes"}),lt=r.buildTag("div","",{padding:"0px",position:"relative",top:"5px",left:"-1px"},{}),yt=r.buildTag("textarea","",{},{id:t._id+"EditAreaNotes"});lt.append(yt);ct.append(lt);o.append(ct)}}v=t.renderDiaglogButton("edit",v);n.templates(t._id+"_JSONDialogEditingTemplate",v.html())}},addDialogTemplate:function(){var t=this,f=t.model,u=n.extend([],t._columns),s=u.length,f=t.model,ft=-1,et=-1,at=t._$treegridHelper.data("ejTreeGrid"),ot,st=t._dialogTab,vt=st.length,w,l,b,a,e,y,k,d,i,g,nt,tt,it,rt,ut;if(t._addDialogGeneralColumns=[],t._addDialogCustomColumns=[],t._generalTabColumnFields=["taskId","taskMode","taskName","startDate","endDate","duration","resourceInfo","status","work","taskType","effortDriven","baselineStartDate","baselineEndDate","predecessor","WBS","notes"],t._mappingItems=t._getMappingItems(),s!=0){if(f.addDialogFields.length>0){for(w=[],l=0;l<f.addDialogFields.length;l++)b=n.grep(t._columns,function(n){return n.mappingName===f.addDialogFields[l].field}),b.length&&w.push(b[0]);u=w}else f.enableWBS&&(f.enableWBSPredecessor&&(a=u.filter(function(n){return n.mappingName!="WBSPredecessor"})),a&&a.length&&(u=a));e=n.map(u,function(n,t){if(n.mappingName==f.taskNameMapping)return t});(e[0]+1)%3==0&&u.splice(e[0]-1,0,u.splice(e[0],1)[0]);var v=r.buildTag("div","",{},{}),o=r.buildTag("div","",{},{id:t._id+"AddTab"}),h=r.buildTag("ul","",{},{});for(o.append(h),v.append(o),s=u.length,i=0;i<s;i++)if(n.inArray(u[i].mappingName,t._mappingItems)!=-1){if(u[i].field=="work"||u[i].field=="taskType"||u[i].field=="effortDriven")continue;u[i].mappingName!==f.predecessorMapping&&u[i].mappingName!=f.resourceInfoMapping&&u[i].mappingName!=f.notesMapping+"Text"?(e=n.map(t._generalTabColumnFields,function(n,t){if(n==u[i].field)return t}),e.length>0?t._addDialogGeneralColumns.push(u[i]):t._addDialogCustomColumns.push(u[i])):u[i].mappingName===f.predecessorMapping?ft=i:u[i].mappingName===f.resourceInfoMapping&&(et=i)}for(y=0;y<vt;y++)switch(st[y]){case"General":h.append("<li><a href='#"+t._id+"AddGeneral'>"+t._dialogTabTitleTexts.generalTabText+"<\/a><\/li>");k=r.buildTag("div","",{padding:"4px"},{id:t._id+"AddGeneral"});d=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"GeneralAddForm"});k.append(d);o.append(k);$form=r.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:t._id+"AddForm"});$genearlTable=r.buildTag("table","",{"border-spacing":"2px","border-collapse":"separate"},{});$tr=r.buildTag("tr");var p=0,c=t._addDialogGeneralColumns,s=c.length;for(i=0;i<s;i++)p<3?(c[i].mappingName!==f.taskNameMapping?(p++,$td=r.buildTag("td","",{"text-align":"left",padding:"5px 5px 0","font-weight":"normal",outline:"none"},{})):(p+=2,$td=r.buildTag("td","",{"text-align":"left",padding:"5px 5px 0","font-weight":"normal",outline:"none"},{colspan:"2"})),$innerTable=r.buildTag("table","",{outline:"none","border-spacing":"2px","border-collapse":"separate"},{}),$inTr=r.buildTag("tr","",{"line-height":"1.4"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none",padding:"1px"},{}),$inTd.append("<label for='"+c[i].field+"' style='font-weight:normal;margin-bottom:0px'>"+t._columnHeaderTexts[c[i].field]+"<\/label>"),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=r.buildTag("tr"),$inTd2=r.buildTag("td.e-editValue","",{padding:"1px"},{}),ot=t._columns.indexOf(c[i]),r.TreeGrid._initCellEditType(at,$inTd2,t._id,ot,"Add"),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($genearlTable.append($tr),$tr=$tempTr=r.buildTag("tr"),i--,p=0);$genearlTable.append($tr);d.append($genearlTable);break;case"Predecessors":f.predecessorMapping&&ft!=-1&&(h.append("<li><a href='#"+t._id+"AddPredecessors'>"+t._dialogTabTitleTexts.predecessorsTabText+"<\/a><\/li>"),g=r.buildTag("div","",{padding:"0px",overflow:"visible"},{id:t._id+"AddPredecessors"}),nt=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"PredecessorAddForm"}),g.append(nt),o.append(g),$predecessorTable=r.buildTag("table#"+t._id+"predecessoraddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"AddDialog_PredecesorAdd' class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.addPredecessor+"<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id='"+t._id+"AddDialog_PredecesorDelete' class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$predecessorTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"predecessorAdd","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$predecessorTable.append($inTr2),nt.append($predecessorTable));break;case"Resources":f.resourceInfoMapping&&et!=-1&&(h.append("<li><a href='#"+t._id+"AddResources'>"+t._dialogTabTitleTexts.resourcesTabText+"<\/a><\/li>"),tt=r.buildTag("div","",{padding:"0px"},{id:t._id+"AddResources"}),it=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"ResourceAddForm"}),tt.append(it),o.append(tt),$resourceTable=r.buildTag("table#"+t._id+"resourceaddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"2px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse",height:"40px"},{}),$inTd=r.buildTag("td.editLabel","",{outline:"none","border-collapse":"collapse",padding:"1px"},{}),$inTd.append("<span id='"+t._id+"AddDialog_ResourceAdd' class='e-addpre e-icon e-enable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.addPredecessor+"<\/span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id='"+t._id+"AddDialog_ResourceDelete' class='e-deletepre e-icon e-disable e-add-dialog' style='cursor:pointer; width: auto;position:relative;left:10px;'>&nbsp;&nbsp;"+t._editDialogTexts.removePredecessor+"<\/span>"),$inTr.append($inTd),$resourceTable.append($inTr),$inTr2=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd2=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"resourceAdd","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$resourceTable.append($inTr2),it.append($resourceTable));break;case"Custom Fields":t._addDialogCustomColumns.length>0&&(h.append("<li><a href='#"+t._id+"AddCustomFields'>"+t._dialogTabTitleTexts.customFieldsTabText+"<\/a><\/li>"),rt=r.buildTag("div","",{padding:"0px"},{id:t._id+"AddCustomFields"}),ut=r.buildTag("form","",{height:"auto",width:"592px","font-size":"14px"},{id:t._id+"CustomfFieldsAddForm"}),rt.append(ut),o.append(rt),$customFieldTable=r.buildTag("table#"+t._id+"customfieldaddTable","",{width:"100%",outline:"none","border-collapse":"collapse",position:"relative",left:"-2px",top:"4px"},{}),$inTr=r.buildTag("tr","",{"border-collapse":"collapse"},{}),$inTd=r.buildTag("td.e-editValue","",{"border-collapse":"collapse",padding:"1px"},{}),$preDiv=r.buildTag("div#treegrid"+t._id+"customFieldAdd","",{},{}),$inTd.append($preDiv),$inTr.append($inTd),$customFieldTable.append($inTr),ut.append($customFieldTable));break;case"Notes":var ht=f.addDialogFields,s=ht.length,e=n.map(ht,function(n,t){if(n.field==f.notesMapping)return t});if(f.notesMapping&&s==0||s>0&&e.length>0){h.append("<li><a href='#"+t._id+"AddNotes'>"+t._dialogTabTitleTexts.notesTabText+"<\/a><\/li>");var ct=r.buildTag("div","",{padding:"0px"},{id:t._id+"AddNotes"}),lt=r.buildTag("div","",{padding:"0px",position:"relative",top:"5px",left:"-1px"},{}),yt=r.buildTag("textarea","",{},{id:t._id+"AddAreaNotes"});lt.append(yt);ct.append(lt);o.append(ct)}}v=t.renderDiaglogButton("add",v);n.templates(t._id+"_JSONDialogAddingTemplate",v.html())}},_clearContextMenu:function(){n(".e-contextmenu").remove();n(".e-innerContextmenu").remove()},_createContextMenuTemplate:function(){var t=this,u={},i,f,r;u["_"+t._id+"getHeaderName"]=n.proxy(t._getHeaderName,t);n.views.helpers(u);i="<li style='list-style-type:none;margin:0px;'>";f="<div class='e-menuitem{{if disable}} e-disable{{/if}}' id={{:menuId}}  style='cursor:pointer;min-width:100px;'>{{if iconPath}}<div class='e-icon e-gantticon' style='display:inline-block;margin-left:5px;position:relative;top:0px;background-image:{{:iconPath}};background-repeat:no-repeat;'/>{{else}}<span class='e-icon {{:iconClass}} e-gantticon' style='display:inline-block;padding:0px 5px 0px 7px;position:relative;top:0px;'/>{{/if}}<div style='display:inline-block;padding:5px;position:relative;top:-2px;'><span style='font-size:12px;padding:5px;'>{{:headerText}}<\/span><\/div>{{if ~_"+t._id+"getHeaderName(#data)}}<div class='e-icon e-expander e-gantticon' style='display:inline-block;padding:5px;float:right;position:relative;top:0px;'/> {{/if}}";i+=f;i+="<\/div><\/li>";r={};r[t._id+"contextMenuTemplate"]=i;n.templates(r)},_getHeaderName:function(n){var t=this._contextMenuItems.filter(function(t){if(n.menuId!=null&&n.menuId==t.parentMenuId)return!0});return t.length>0?!0:!1},initCellEditType:function(t,i,u){var f=this,o=f.model,e,s={},h,c,l,a;e=u?u:"";r.isNullOrUndefined(t.editType)&&(t.editType="stringedit");switch(t.editType){case"stringedit":t.mappingName===o.predecessorMapping?(s["_"+f._id+"predecessor"]=f._getPredecessorsValue,n.views.helpers(s),i.html(r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+f._id+"predecessor('"+f._id+"Object','"+o.predecessorMapping+"','"+t.field+"')}}",id:f._id+t.field,name:t.field}))):i.html(r.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u}));break;case"booleanedit":i.html("{{if "+t.field+'}} <input class="e-field e-checkbox" type ="checkbox" id='+f._id+t.field+" name="+t.field+' checked="checked"><\/input>{{else}} <input class="e-field e-checkbox" type ="checkbox" id='+f._id+t.field+" name="+t.field+" > {{/if}}");break;case"numericedit":h=r.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(h);break;case"datepicker":case"datetimepicker":c=r.buildTag("input.e-"+t.editType+" e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(c);break;case"dropdownedit":l=r.buildTag("input.e-field e-dropdownlist e-field","",{},{type:"text",value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(l);break;case"maskedit":a=r.buildTag("input .e-field e-maskedit","",{},{value:"{{:#data['"+t.field+"']}}",id:f._id+t.field+e,name:t.field,dialog:u});i.append(a)}},_getPredecessorsValue:function(n,t){return this.data.item?this.data.item[t]:""},_onHoliDayCheckBefore:function(n){var i=this,r=i.model.holidays,e=i.model.includeWeekend,t,u,f;if(isAutoSchedule&&r&&r.length){for(t=0,u=r.length,t=0;t<u;t++)if(f=i._getDateFromFormat(r[t].day),f.getTime()==n.getTime())n.setDate(n.getDate()-1),this.model.includeWeekend===!1&&i._setBeforeWeekend(n);else return n;return n}return n},_onHoliDayCheck:function(n){var i=this,r=i.model.holidays,e=i.model.includeWeekend,t,u,f;if(isAutoSchedule&&r&&r.length&&!i.hasChildRecords){for(t=0,u=r.length,t=0;t<u;t++)if(f=i._getDateFromFormat(r[t].day),f.getTime()==n.getTime())n.setDate(n.getDate()+1),this.model.includeWeekend===!1&&(n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2));else return n;return n}return n},_getDurationValues:function(n,t){var f=0,e=this.model,i=e.durationUnit,u,o;return typeof n=="string"?(u=n.match(/(\d*\.*\d+|[A-z]+)/g),u&&u.length<=2&&(f=parseFloat(u[0]),i=u[1]?u[1].toLowerCase():"",i=this._durationUnitEditText.minute.indexOf(i)!=-1?r.Gantt.DurationUnit.Minute:this._durationUnitEditText.hour.indexOf(i)!=-1?r.Gantt.DurationUnit.Hour:this._durationUnitEditText.day.indexOf(i)!=-1?r.Gantt.DurationUnit.Day:e.durationUnit)):(f=n,i=e.durationUnit),isNaN(f)&&(f=t?this._editedDialogRecord.duration:0,i=t?this._editedDialogRecord.durationUnit:e.durationUnit),o={},o.duration=f,o.durationUnit=i,o},_editStartDateChange:function(t,i){var e=this,f=e._id,c=e.model,l=t.attr("id"),ft=this.model.holidays,it=t.attr("dialog"),et=c.selectionMode=="row"?this.selectedItem():c.updatedRecords[e._rowIndexOfLastSelectedCell],r=this._editedDialogRecord,rt=r.effortDriven=="true"?!0:!1,a,s,v,y,p,d,g,nt,tt,w,b;if(!this._editedDialogRecord.isUpdatedFromDialog){this._editedDialogRecord.isUpdatedFromDialog=!0;it==="Add"?(a="#"+f+"startDateAdd",s="#"+f+"endDateAdd",v="#"+f+"durationAdd",effortDrivenId="#"+f+"effortDrivenAdd",typeId="#"+f+"taskTypeAdd",workId="#"+f+"workAdd",y="#"+f+"baselineStartDateAdd",p="#"+f+"baselineEndDateAdd"):(a="#"+f+"startDateEdit",s="#"+f+"endDateEdit",v="#"+f+"durationEdit",effortDrivenId="#"+f+"effortDrivenEdit",typeId="#"+f+"taskTypeEdit",workId="#"+f+"workEdit");var h=n(a).val(),o=n(s).val(),k=n(v).val(),ut=n(workId).val();(l===f+"startDateEdit"||l===f+"startDateAdd")&&(h||(h=r?r.startDate:u));k||(k=r?r.duration:u);o||(o=r?r.endDate:u);l===f+"startDateEdit"||l===f+"startDateAdd"?(h=i.value?e._getDateFromFormat(i.value):h,h=e._checkStartDate(h,r),e.getFormatedDate(h)!=i.value&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",h):n(a).ejDatePicker("option","value",h)),nt=e._getEndDate(h,r.duration,r.durationUnit,r),r.startDate=h,r.endDate=nt,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",nt):n(s).ejDatePicker("option","value",nt)):l===f+"endDateEdit"||l===f+"endDateAdd"?(o=i.value?e._getDateFromFormat(i.value):o,o.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,o),o=this._checkEndDate(o,r),e.getFormatedDate(o)!=i.value&&(c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)),r.isMilestone&&(r.startDate=this._checkStartDate(r.startDate,r),e.getFormatedDate(r.startDate)!=h&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",r.startDate):n(a).ejDatePicker("option","value",r.startDate)),e._updateResourceRelatedFields(r),n(workId).ejNumericTextbox("option","value",r.work),n(v).val(e._getDurationStringValue(r))),r.startDate.getTime()<=o.getTime()?(r.endDate=o,r.duration=this._getDuration(r.startDate,o,r.durationUnit,r.isAutoSchedule),k=e._getDurationStringValue(r),n(v).val(k)):c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",r.endDate):n(s).ejDatePicker("option","value",r.endDate)):l===f+"durationEdit"||l===f+"durationAdd"?(tt=e._getDurationValues(k,!0),d=tt.duration,g=tt.durationUnit,(r.duration!=d||r.durationUnit!=g)&&(r.duration=d,r.durationUnit=g,r.isMilestone&&(r.startDate=this._checkStartDate(r.startDate,r),e.getFormatedDate(r.startDate)!=h&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(a).ejDateTimePicker("option","value",r.startDate):n(a).ejDatePicker("option","value",r.startDate))),o=this._getEndDate(r.startDate,d,g,r),r.endDate=o,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)),e._updateResourceRelatedFields(r),rt||n(workId).ejNumericTextbox("option","value",r.work),n(v).val(e._getDurationStringValue(r)),r.taskType=="fixedWork"&&e._updateResourceDataSource(r)):l===f+"workEdit"||l===f+"workAdd"?(r.work=parseInt(ut),e._updateResourceRelatedFields(r),r.taskType!="fixedDuration"&&r.isAutoSchedule?(n(v).val(e._getDurationStringValue(r)),o=this._getEndDate(r.startDate,r.duration,r.durationUnit,r),r.endDate=o,c.dateFormat.indexOf("hh")!=-1?n(s).ejDateTimePicker("option","value",o):n(s).ejDatePicker("option","value",o)):e._updateResourceDataSource(r)):l===f+"baselineStartDateAdd"?n(p).length>0&&(w=e._getDateFromFormat(n(y).val()),b=e._getDateFromFormat(n(p).val()),w&&b&&w.getTime()>b.getTime()&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(y).ejDateTimePicker("option","value",i.prevDate):n(y).ejDatePicker("option","value",i.prevDate))):l===f+"baselineEndDateAdd"&&n(y).length>0&&(w=e._getDateFromFormat(n(y).val()),b=e._getDateFromFormat(n(p).val()),w&&b&&w.getTime()>b.getTime()&&(c.dateFormat.toLowerCase().indexOf("hh")!=-1?n(p).ejDateTimePicker("option","value",i.prevDate):n(p).ejDatePicker("option","value",i.prevDate)));this._editedDialogRecord.isUpdatedFromDialog=!1}},_taskNameCollection:function(){var i=this,t=i.model.flatRecords,r=[],n,u,f;for(idsCollection=[],i._preTableCollection=[],n=0;n<t.length;n++)u={id:t[n].taskId.toString(),text:t[n].taskId.toString()+"-"+t[n].taskName,value:t[n].taskId.toString()+"-"+t[n].taskName},f={id:t[n].taskId.toString()+"-"+t[n].taskName,text:t[n].taskId.toString(),value:t[n].taskId.toString()},r.push(u),idsCollection.push(f);i._preTableCollection.push(idsCollection);i._preTableCollection.push(r)},_idFromPredecessor:function(n){for(var u,i,r=n.split(","),f=[],t=0;t<r.length;t++){for(u=[],i=0;i<r[t].length;i++)if(isNaN(r[t].charAt(i)))break;else u.push(r[t].charAt(i));f.push(u.join(""))}return f},_preIdChangByName:function(){var i=this,r=n("#"+i._id+"PreEditForm");$targetTr=r.closest("tr");$val=r.find(".onEdit");var f=$val.val(),u=i._taskNameCollection(),t=n.map(u,function(n){if(n.text===$val.val())return n.id});t=t[0];$targetTr.find(".id").html(t)},_preEndEdit:function(t,i,u){var c=this,o=u.model.dataSource,f=u.model.selectedItem,l,s,h,e;c._taskNameCollection();u.value!==null&&(u.columnName==="name"||u.columnName==="id")&&(u.columnName==="name"&&u.value.length>0&&(l=u.value.split("-"),s=n.map(c._preTableCollection[1],function(n){if(n.id===l[0])return n.id}),s=s[0],f.id=s,f.name=u.value,e=o.indexOf(f.item),e===-1&&(o.push(f.item),e=o.indexOf(f.item)),o[e].id=s,o[e].name=u.value),u.columnName==="id"&&u.value.length>0&&(h=n.map(c._preTableCollection[0],function(n){if(n.value===u.value)return n.id}),h=h[0],f.name=h,f.id=s,e=o.indexOf(f.item),e===-1&&(o.push(f.item),e=o.indexOf(f.item)),o[e].name=h),f.type||r.isNullOrUndefined(e)||(f.type="Finish-Start",o[e].type="Finish-Start"),n(t).ejTreeGrid("refreshRow",u.model.selectedRowIndex),n(t).ejTreeGrid("selectRows",u.model.selectedRowIndex),c._enbleDisablePredecessorAddButton("enable",i))},_enableDisablePredecessorDelete:function(t){var i=this,r;r=t=="add"?n("#"+i._id+"AddDialog_PredecesorDelete"):n("#"+i._id+"EditDialog_PredecesorDelete");n(r).unbind("click",n.proxy(i._deletepredecessor,i)).bind("click",n.proxy(i._deletepredecessor,i));n(r).removeClass("e-disable").addClass("e-enable")},_enableDisableResouceDelete:function(t){var i=this,r;r=t=="add"?n("#"+i._id+"AddDialog_ResourceDelete"):n("#"+i._id+"EditDialog_ResourceDelete");n(r).unbind("click",n.proxy(i._deleteResource,i)).bind("click",n.proxy(i._deleteResource,i));n(r).removeClass("e-disable").addClass("e-enable")},_predecessorEditCollection:function(){var u=this,y=u.model,o,k,s,l=[],i,n,h,p,w,a,f,e,c,v,b;if(k="#"+u._id+"predecessor",s=u._predecessorCollectionText,l=[],i=y.selectedItem,u._taskNameCollection(),o=u._preTableCollection[1],!r.isNullOrUndefined(i)&&!r.isNullOrUndefined(i.predecessor)&&!r.isNullOrUndefined(i.item[y.predecessorMapping])){var t=i.predecessor,d=t.length,g=s.length,nt=o.length;for(n=0;n<d;n++)if(h=t[n].from,i.taskId.toString()!==h.toString()){for(a=0,f=0;f<nt;f++)if(o[f].id===h){p=o[f].value;break}for(e=0;e<g;e++)s[e].id==t[n].predecessorsType&&(w=s[e].text);c=t[n].offset!=1;v="";v+=t[n].offsetDurationUnit=="day"?c?this._durationUnitTexts.days:this._durationUnitTexts.day:t[n].offsetDurationUnit=="hour"?c?this._durationUnitTexts.hours:this._durationUnitTexts.hour:c?this._durationUnitTexts.minutes:this._durationUnitTexts.minute;a=t[n].offset+" "+v;b={id:h,name:p,type:w,offset:a};l.push(b)}}return l},_getResourceInfoIndex:function(n,t){var i=0,r=[];if(n&&t)for(i;i<n.length;i++)t[n[i]]&&r.push(n[i]);return r},_refreshEditForm:function(t){var i=this,vt=!1,ot,o=0,ii,f,p="165px",e=i.model,yt,s={},h,pt,nt,wt,d,b=e.selectionMode=="row"?e.selectedItem:e.updatedRecords[i._rowIndexOfLastSelectedCell],g,bt,kt,ft,dt,st,l,c,ht,gt,it,ni,lt,w,k,ct,y,a,ti;if(t.requestType=="add"){var ui=document.getElementById(i._id+"AddTab"),ri=n("#"+i._id+"_dialogAdd_wrapper"),ii=document.getElementById(i._id+"GeneralAddForm"),d="#treegrid"+i._id+"predecessorAdd",tt="#"+i._id+"AddAreaNotes",rt="#treegrid"+i._id+"resourceAdd",ut="#treegrid"+i._id+"customFieldAdd";!r.isNullOrUndefined(e.dataSource)&&e.dataSource.length==0&&e.predecessorMapping&&n(d).length>0?(g=[],g[0]=i._dialogTab.indexOf("Predecessors"),n("#"+i._id+"AddTab").ejTab("option","disabledItemIndex",g)):(g=[],g[0]=i._dialogTab.indexOf("Predecessors"),n("#"+i._id+"AddTab").ejTab("option","enabledItemIndex",g),n("#"+i._id+"AddTab").find("div.e-content").css("overflow","visible"));nt=i.model.flatRecords.length;nt=i._getNewTaskId(nt);i.model.enableWBS&&(bt=e.editSettings.rowPosition.toLowerCase(),kt=i._getNewWBSid(bt))}else{var ui=document.getElementById(i._id+"EditTab"),ri=n("#"+i._id+"_dialogEdit_wrapper"),ii=document.getElementById(i._id+"GeneralEditForm"),d="#treegrid"+i._id+"predecessorEdit",tt="#"+i._id+"EditAreaNotes",rt="#treegrid"+i._id+"resourceEdit",ut="#treegrid"+i._id+"customFieldEdit";e.flatRecords.length<=2&&e.parentRecords.length==1&&e.predecessorMapping&&n(d).length>0&&n("#"+i._id+"EditTab").ejTab("removeItem",1)}for(ot=n(ii).find("input,select"),k=ot.length,o;o<k;o++){if(f=ot.eq(o),s={},p=180,h=r.TreeGrid.getColumnByField(i._columns,f.prop("name")),h)a=t.data[h.field];else continue;if(f.hasClass("e-numerictextbox"))yt=p,s.width=yt,s.showSpinButton=!0,s.cssClass=e.cssClass,l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&(l=="statusEdit"||l=="workEdit")&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),(l=="statusEdit"||l=="statusAdd")&&(s.maxValue=100,s.minValue=0),(l=="workEdit"||l=="workAdd")&&(s.change=function(){i._updatedColumn="work";i._editStartDateChange(n(this.element[0]))}),s.value=a&&a.toString().length?parseFloat(a):0,r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejNumericTextbox(s),f.prop("name",f.prop("name").replace(i._id,""));else if(f.hasClass("e-datepicker"))s.width=p,s.cssClass=e.cssClass,s.dateFormat=e.dateFormat,s.locale=e.locale,s.startDay=e.scheduleHeaderSettings.weekStartDay,s.change=function(n){this.option("value",n.value);i._updatedColumn=this.element[0].name;i._editStartDateChange(this.element,n)},l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&b.isAutoSchedule&&(l=="startDateEdit"||l=="endDateEdit")&&t.requestType!=="add"&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),s.value=a&&a.toString().length?i._getDateFromFormat(a.toString()):i._getDateFromFormat(e.scheduleStartDate),h.format!==u&&h.format.length>0&&(pt=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),wt=pt.exec(h.format),s.dateFormat=wt[2],s.value=r.format(new Date(s.value),s.dateFormat,s.locale),f.val(s.value)),r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejDatePicker(s);else if(f.hasClass("e-datetimepicker"))s={width:p,rtl:e.rtl,locale:e.locale,cssClass:e.css,dateTimeFormat:e.dateFormat,startDay:e.scheduleHeaderSettings.weekStartDay},s.change=function(n){i._updatedColumn=this.element[0].name;this.option("value",n.value);this._prevDateTimeVal&&i._editStartDateChange(this.element,n)},l=f[0].id,l=l.replace(i._id,""),!r.isNullOrUndefined(b)&&b.hasChildRecords&&b.isAutoSchedule&&b.isAutoSchedule&&(l=="startDate"||l=="endDate")&&t.requestType!=="add"&&(s.readOnly=!0,f.closest("td").css("opacity",.5)),s.value=a&&a.toString().length?i._getDateFromFormat(a.toString()):i._getDateFromFormat(e.scheduleStartDate),r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejDateTimePicker(s);else if(f.hasClass("e-dropdownlist"))ft=h.dropdownData,h.field==="resourceInfo"?f.ejDropDownList({cssClass:e.cssClass,width:p,showCheckbox:!0,dataSource:ft,fields:{id:e.resourceIdMapping,text:e.resourceNameMapping,value:e.resourceNameMapping},selectedItems:t.requestType=="add"?i._getResourceInfoIndex(t.data.resourceInfo,e.resources):i.getIndexofresourceInfo(ft,t.data)}):(c={},c.cssClass=e.cssClass,c.width=p,c.dataSource=ft,c.value=a,c.change=function(){i._updateEditDialogFields(this)},r.isNullOrUndefined(h.editParams)||n.extend(c,h.editParams),f.val.length&&(h.field=="taskMode"?(c.value=r.isNullOrUndefined(c.value)?"false":a.toString(),a=t.requestType=="beginedit"?!t.data.isAutoSchedule:e.taskSchedulingMode=="manual"?!0:!1,f.val(a)):h.field=="taskType"?(a=t.requestType=="beginedit"?t.data.taskType:i.model.taskType,f.val(a)):h.field=="effortDriven"&&(a=t.requestType=="beginedit"?t.data.effortDriven:e.taskType=="fixedWork"?!0:!1,f.val(a))),t.requestType!="beginedit"||t.data.isAutoSchedule||h.field!="taskType"&&h.field!="effortDriven"||(c.enabled=!1),t.data.taskType=="fixedWork"&&h.field=="effortDriven"&&(c.enabled=!1),t.requestType=="add"&&h.field=="effortDriven"&&e.taskType=="fixedWork"&&(c.enabled=!1),(h.field=="taskType"||h.field=="effortDriven")&&t.data.hasChildRecords&&(c.enabled=!1),h.field=="taskMode"&&e.taskSchedulingMode!=r.Gantt.TaskSchedulingMode.Custom&&(c.enabled=!1),f.val(c.value),f.ejDropDownList(c),dt=f.ejDropDownList("instance"),dt._setValue(f.val()));else if(f.hasClass("e-maskedit"))c={},c.locale=e.locale,c.cssClass=e.cssClass,c.width=p,r.isNullOrUndefined(h.editParams)||n.extend(c,h.editParams),f.ejMaskEdit(c);else switch(f.prop("tagName")){case"INPUT":f.attr("type")!="checkbox"?(f.attr("name")==="taskId"?t.requestType!=="add"?(f.attr("readonly","readonly"),f.css("opacity",.5),f.val(t.data.taskId)):t.requestType==="add"&&(t.data.taskId==""||r.isNullOrUndefined(t.data.taskId)?f.val(nt):f.val(t.data.taskId)):f.attr("name")==="taskName"?t.requestType==="add"?t.data.taskName==""||r.isNullOrUndefined(t.data.taskName)?f.val(i._newTaskTexts.newTaskName+" "+nt):f.val(t.data.taskName):f.val(t.data.taskName):f.attr("name")==="duration"?(t.data&&f.val(i._getDurationStringValue(t.data)),st=i._getDurationValues(t.data),t.requestType!=="add"&&t.data.hasChildRecords&&t.data.isAutoSchedule?(f.attr("readonly","readonly"),f.css("opacity",.5)):t.requestType=="add"&&t.data.duration==""?f.val("0 "+i._durationUnitTexts[st.durationUnit]):f.val(t.data.duration+" "+i._durationUnitTexts[st.durationUnit]),f.change(function(){i._updatedColumn="duration";i._editStartDateChange(n(this))}),f.keyup(function(t){t.keyCode==13&&i._editStartDateChange(n(this))})):f.attr("name")==="WBS"?t.requestType!=="add"?(f.attr("readonly","readonly").css("opacity",.5),f.val(t.data.WBS)):t.requestType==="add"&&(f.val(kt),f.attr("readonly","readonly").css("opacity",.5)):f.attr("name")==="WBSPredecessor"&&f.attr("readonly","readonly").css("opacity",.5),f.attr("name")==="taskName"&&(p=380),l=f[0].id,l=l.replace(i._id,""),f.css("text-align",f.attr("name")!=null&&r.TreeGrid.getColumnByField(i._columns,f.prop("name"))!=null?r.TreeGrid.getColumnByField(i._columns,f.attr("name")).textAlign:"center"),f.outerWidth(p)):(c={},c.cssClass=e.cssClass,c.size="medium",r.isNullOrUndefined(h.editParams)||n.extend(s,h.editParams),f.ejCheckBox(c));break;case"SELECT":f.width(p).height(23)}f.is(":disabled")||vt||f.is(":hidden")&&typeof f.data("ejDropDownList")!="object"||i._isEnterKeyPressed||(i._focusElements(f.closest("td")),vt=!0)}if(e.predecessorMapping&&n(d).length&&(ht=[],t.requestType!=="add"&&(ht=i._predecessorEditCollection()),i._taskNameCollection(),gt=i._predecessorCollectionText,n(d).ejTreeGrid({dataSource:ht,allowSorting:!1,columns:[{headerText:i._columnHeaderTexts.taskId,field:"id",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:i._preTableCollection[0],width:"89px"},{headerText:i._columnHeaderTexts.taskName,field:"name",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:i._preTableCollection[1],width:"300px"},{headerText:i._columnHeaderTexts.type,field:"type",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:gt,width:"141px"},{headerText:i._columnHeaderTexts.offset,field:"offset",editType:r.TreeGrid.EditingType.String,width:"88px"}],enableAltRow:!1,allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",rowPosition:"bottom",beginEditAction:r.TreeGrid.BeginEditAction.Click},locale:e.locale,endEdit:n.proxy(i._preEndEdit,i,d,t.requestType),beginEdit:n.proxy(i._preBeginEdit,i),rowSelected:n.proxy(i._enableDisablePredecessorDelete,i,t.requestType),actionComplete:function(n){n.requestType=="delete"&&(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._disablePredecessorAddButton(d,t.requestType))},treeColumnIndex:5,predecessorTable:i._isFromGantt,sizeSettings:{width:"620px",height:"198px"},isResponsive:!1}),e.selectedItem&&e.selectedItem.hasChildRecords&&t.requestType!=="add"?(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._enbleDisablePredecessorAddButton("disable",t.requestType)):(i._enbleDisablePredecessorDeleteButton("disable",t.requestType),i._enbleDisablePredecessorAddButton("enable",t.requestType))),e.resourceInfoMapping&&n(rt).length){if(it=[],ct=n.extend(!0,[],e.resources),t.requestType!="add")for(w=t.data.resourceInfo,k=w?w.length:0,o=0;o<k;o++)it.push({name:w[o][e.resourceIdMapping],unit:w[o][e.resourceUnitMapping]});else if(t.data.resourceInfo.length!=0)for(ganttRecord=new r.Gantt.GanttRecord,ganttRecord.item=t.data,ni=e.resources,lt=t.data.resourceInfo,ganttRecord.resourceInfo=lt&&ganttRecord._setResourceInfo(lt,e.resourceIdMapping,e.resourceNameMapping,e.resourceUnitMapping,ni),w=ganttRecord.resourceInfo,k=w?w.length:0,o=0;o<k;o++)it.push({name:w[o][e.resourceIdMapping],unit:w[o][e.resourceUnitMapping]});ct=n.extend(!0,[],e.resources);n(rt).ejTreeGrid({dataSource:it,columns:[{headerText:i._columnHeaderTexts.resourceInfo,field:"name",width:"309px",editType:r.TreeGrid.EditingType.Dropdown,dropdownData:ct,editParams:{fields:{text:e.resourceNameMapping,value:e.resourceIdMapping}}},{headerText:i._columnHeaderTexts.unit,field:"unit",width:"309px",editType:r.TreeGrid.EditingType.Numeric,visible:!0,headerTextAlign:"center"}],enableAltRow:!1,allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",beginEditAction:r.TreeGrid.BeginEditAction.Click},locale:e.locale,endEdit:n.proxy(i._resourceEndEdit,i,rt,t.requestType),beginEdit:n.proxy(i._resourceBeginEdit,i,rt),rowSelected:n.proxy(i._enableDisableResouceDelete,i,t.requestType),actionBegin:function(t){(t.requestType=="delete"||t.requestType=="sorting")&&(this.model.columns[0].dropdownData=n.extend(!0,[],i.model.resources))},actionComplete:function(n){n.requestType=="delete"&&(i._enableDisableResourceAddButton(n,!0,t.requestType),i.enbleDisableDeleteResourceButton("disable",t.requestType))},treeColumnIndex:3,resourceTable:i._isFromGantt,sizeSettings:{width:"620px",height:"198px"},isResponsive:!1});t.requestType!=="add"&&it.length==e.resources.length?(i.enbleDisableDeleteResourceButton("enable",t.requestType),i.enbleDisableAddResourceButton("disable",t.requestType)):(i.enbleDisableDeleteResourceButton("disable",t.requestType),i.enbleDisableAddResourceButton("enable",t.requestType))}if(n(ut).length){if(t.requestType=="add"){var v=i._addDialogCustomColumns,at=[],et=0,k=v.length;for(o=0;o<k;o++)et++,y={},y.id=et,y.field=v[o].field,y.headerText=v[o].headerText,y.value=t.data[v[o].field],y.text=t.data[v[o].field],y.editType=v[o].editType?v[o].editType.toLowerCase():"stringedit",at.push(y)}else{var v=i._editDialogCustomColumns,at=[],et=0,k=v.length;for(o=0;o<k;o++)et++,y={},y.id=et,y.field=v[o].field,y.headerText=v[o].headerText,y.value=t.data[v[o].field],y.editType=v[o].editType?v[o].editType.toLowerCase():"stringedit",y.text=v[o].editType.toLowerCase()=="dropdownedit"?r.isNullOrUndefined(t.data[v[o].field])?"":i._getDropDownText(v[o],t.data[v[o].field]):t.data[v[o].field],at.push(y)}n(ut).ejTreeGrid({dataSource:at,allowSorting:!1,locale:e.locale,enableAltRow:!1,rowHeight:30,columns:[{headerText:i._columnHeaderTexts.dialogCustomFieldName,field:"headerText",allowEditing:!1},{headerText:"Original Value",field:"value",visible:!1},{headerText:"Field",field:"field",visible:!1},{headerText:i._columnHeaderTexts.dialogCustomFieldValue,field:"text",editTemplate:{create:function(){return"<input style='width:100%;'>"},read:n.proxy(i._customColumnRead,i,ut),write:n.proxy(i._customColumnWrite,i,v,ut)}}],allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing",beginEditAction:r.TreeGrid.BeginEditAction.Click},sizeSettings:{width:"620px",height:"234px"},isResponsive:!1})}e.notesMapping&&n(tt).length&&(t.requestType=="add"?a=t.data.notes:(ti=t.data.item[e.notesMapping],a=ti),n(tt).ejRTE({width:"620px",isResponsive:!1,height:"281px",value:a,locale:e.locale,tools:{font:["fontName","fontSize","fontColor","backgroundColor"],style:["bold","italic","underline","strikethrough"],alignment:["justifyLeft","justifyCenter","justifyRight","justifyFull"],doAction:["undo","redo"],indenting:[],clear:[],links:["createLink","removeLink"],images:[],media:[],tables:[],lists:["unorderedList"],clipboard:[],edit:[],formatStyle:[],view:[]}}),n(tt+"_wrapper").find(".e-toolbar.e-toolbarspan").css("border-bottom","none"),n(tt+"_editor").height("208"),n(tt+"_Iframe")[0].style.height="203px",n(ri).removeClass("e-rte"))},_enbleDisablePredecessorDeleteButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_PredecesorDelete"):n("#"+r._id+"EditDialog_PredecesorDelete");t==="enable"?(n(u).unbind("click",n.proxy(r._deletepredecessor,r)).bind("click",n.proxy(r._deletepredecessor,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._deletepredecessor,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_enbleDisablePredecessorAddButton:function(t,i){var r=this,u="";u=i=="add"?n("#"+r._id+"AddDialog_PredecesorAdd"):n("#"+r._id+"EditDialog_PredecesorAdd");t==="enable"?(n(u).unbind("click",n.proxy(r._addpredecessor,r)).bind("click",n.proxy(r._addpredecessor,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._addpredecessor,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_disablePredecessorAddButton:function(t,i){var f=this,e=n(t+"e-table"),o=!1,s=e[0].rows.length,r,u;for(f._enbleDisablePredecessorAddButton("disable",i),r=0;r<s;r++)u=e[0].rows[r],u.cells.length===4&&u.cells[1].innerText===""&&(o=!0);o||f._enbleDisablePredecessorAddButton("enable",i)},_updateEditDialogFields:function(t){var f=this,e=n(t.element).attr("dialog"),i,u;e=="Add"?(i=n("#"+f._id+"effortDrivenAdd").data("ejDropDownList"),u=n("#"+f._id+"taskTypeAdd").data("ejDropDownList")):(i=n("#"+f._id+"effortDrivenEdit").data("ejDropDownList"),u=n("#"+f._id+"taskTypeEdit").data("ejDropDownList"));r.isNullOrUndefined(i)||t._name!="taskType"||(t.model.value=="fixedWork"?(i.selectItemByValue("true"),i.disable()):i.enable(),f._editedDialogRecord[t._name]=t.model.value);t._name=="taskMode"&&(t.model.text=="Auto"&&(r.isNullOrUndefined(i)||r.isNullOrUndefined(u)||u.model.value=="fixedWork"||i.enable(),r.isNullOrUndefined(u)||u.enable(),f._editedDialogRecord.isAutoSchedule=!0),t.model.text=="Manual"&&(r.isNullOrUndefined(i)||i.disable(),r.isNullOrUndefined(u)||u.disable(),f._editedDialogRecord.isAutoSchedule=!1))},_customColumnWrite:function(t,i,r){var e=this,o=r.rowdata!==u?r.rowdata.text:"",s=n(i).ejTreeGrid("instance").model,h=t[s.selectedRowIndex],f={},c,l;h.editParams&&(f=n.extend(!0,{},h.editParams));f.value=o;f.locale=e.model.locale;switch(r.rowdata.editType.toLowerCase()){case"numericedit":f.height="25px";r.element.ejNumericTextbox(f);break;case"stringedit":n(r.element).val(o).css({padding:"0px",border:"0px",height:"25px"}).addClass("e-ejinputtext");break;case"datepicker":f.width="100%";f.height="25px";f.startDay=e.model.scheduleHeaderSettings.weekStartDay;r.element.ejDatePicker(f);break;case"datetimepicker":f.width="100%";f.height="25px";f.startDay=e.model.scheduleHeaderSettings.weekStartDay;r.element.ejDateTimePicker(f);break;case"maskedit":f.width="100%";f.height="25px";r.element.ejMaskEdit(f);break;case"dropdownedit":f.width="100%";f.height="25px";f.dataSource=h.dropdownData;f.value=s.currentViewData[s.selectedRowIndex].value;r.element.ejDropDownList(f);break;case"booleanedit":f.cssClass=model.cssClass;f.size="small";f.checked=o;r.element.ejCheckBox(f);c=r.element.parent(".e-chkbox-wrap");l=c.parent("form");l.length>0?l.css("margin-left","45%"):c.css("margin-left","45%")}},_customColumnRead:function(t,i){var u,r,f=n(t).ejTreeGrid("instance"),e=f.model.selectedRowIndex,o=f.model.updatedRecords;return n(i).blur(),n(i).focusout(),n(i[0]).hasClass("e-numerictextbox")?u=r=n(i).ejNumericTextbox("getValue"):n(i[0]).hasClass("e-datepicker")?u=r=n(i).ejDatePicker("getValue"):n(i[0]).hasClass("e-datepicker")?u=r=n(i).ejDatePicker("getValue"):n(i[0]).hasClass("e-dattimeepicker")?u=r=n(i).ejDateTimePicker("getValue"):n(i[0]).hasClass("e-maskedit")?u=r=n(i[0]).ejMaskEdit("model.value"):n(i[0]).hasClass("e-dropdownlist")?(r=n(i[0]).ejDropDownList("model.text"),u=n(i[0]).ejDropDownList("getSelectedValue")):u=n(i[0]).hasClass("e-checkbox")?r=n(i[0]).ejCheckBox("isChecked"):r=n(i).val(),o[e].value=u,o[e].text=r,f.refreshRow(e),r},_enableDisableResourceAddButton:function(t,i,r){var u=this,f=t.model.dataSource,e=!1,o;u.enbleDisableAddResourceButton("disable",r);i&&(o=n.map(f,function(n,t){if(n.name==""||n.name==null)return t}),o.length>0&&f.length>0&&(e=!0),e||u.enbleDisableAddResourceButton("enable",r))},_addpredecessor:function(t){var i=this,f,r,u;n(t.target).hasClass("e-edit-dialog")?(f="#treegrid"+i._id+"predecessorEdit",u="edit"):(f="#treegrid"+i._id+"predecessorAdd",u="add");i._enbleDisablePredecessorAddButton("disable",u);r=n(f).ejTreeGrid("instance");r.addRow({id:"",name:"",type:"Finish-Start",offset:"0"});r.clearSelection(r.model.selectedRowIndex);i._enbleDisablePredecessorDeleteButton("disable",u)},_deletepredecessor:function(t){var u=this,i,f,e,o;n(t.target).hasClass("e-edit-dialog")?(i="#treegrid"+u._id+"predecessorEdit",f="edit"):(i="#treegrid"+u._id+"predecessorAdd",f="add");e=n(i).ejTreeGrid("option","selectedRowIndex");o={};o.requestType=r.TreeGrid.Actions.Delete;e!==-1&&(n(i).ejTreeGrid("deleteRow"),u._enbleDisablePredecessorDeleteButton("disable",f));u._disablePredecessorAddButton(i,f)},enbleDisableDeleteResourceButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_ResourceDelete"):n("#"+r._id+"EditDialog_ResourceDelete");t==="enable"?(n(u).unbind("click",n.proxy(r._deleteResource,r)).bind("click",n.proxy(r._deleteResource,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._deleteResource,r)),n(u).addClass("e-disable").removeClass("e-enable"))},enbleDisableAddResourceButton:function(t,i){var r=this,u;u=i=="add"?n("#"+r._id+"AddDialog_ResourceAdd"):n("#"+r._id+"EditDialog_ResourceAdd");t==="enable"?(n(u).unbind("click",n.proxy(r._addResource,r)).bind("click",n.proxy(r._addResource,r)),n(u).addClass("e-enable").removeClass("e-disable")):(n(u).unbind("click",n.proxy(r._addResource,r)),n(u).addClass("e-disable").removeClass("e-enable"))},_addResource:function(t){var i=this,f,r,u;n(t.target).hasClass("e-edit-dialog")?(u="edit",f="#treegrid"+i._id+"resourceEdit"):(u="add",f="#treegrid"+i._id+"resourceAdd");i.enbleDisableAddResourceButton("disable",u);r=n(f).ejTreeGrid("instance");r.clearSelection(r.model.selectedRowIndex);r.addRow({name:"",unit:"100"},"bottom");i.enbleDisableDeleteResourceButton("disable",u)},_deleteResource:function(t){var u=this,i,f,e;i=n(t.target).hasClass("e-edit-dialog")?"#treegrid"+u._id+"resourceEdit":"#treegrid"+u._id+"resourceAdd";f=n(i).ejTreeGrid("option","selectedRowIndex");e={};e.requestType=r.TreeGrid.Actions.Delete;f!==-1&&n(i).ejTreeGrid("deleteRow")},_resourceEndEdit:function(t,i,r){var u=this,f=r.model.columns;f[0].dropdownData=n.extend(!0,[],u.model.resources);enableResourceAdd=r.model.dataSource.length<u.model.resources.length;u._enableDisableResourceAddButton(r,enableResourceAdd,i)},_resourceBeginEdit:function(t,i){for(var o,s=this,h=s.model.resourceIdMapping,f=i.model,c=f.columns,e=c[0].dropdownData,u=f.dataSource,l=u.length,a=i.data.item.name,r=0;r<l;r++)u[r].name!=""&&u[r].name!=null&&a!=u[r].name&&(o=n.map(e,function(n,t){if(n[h].toString()==u[r].name)return t}),e.splice(o[0],1))},getColumnIndexByField:function(n){var r=this,i=r.model.columns,u=i.length,t=0;for(t;t<u;t++)if(i[t].field==n)break;return t},getIndexofresourceInfo:function(n,t){var r=t.resourceInfo,i=0,f=r?r.length:0,u=[];for(i;i<f;i++)n.indexOf(r[i])!=-1&&u.push(n.indexOf(r[i]));return u},_focusElements:function(n){if(n.length){n.focus();var t=n.children();t[0].tagName.toLowerCase()=="select"||t[0].tagName.toLowerCase()=="input"?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t.find(".e-ddl").focus():t.find("input,select").select().focus()}},renderDiaglogButton:function(n,t){var e,i=this,u=i.model,o,l,a,s,v,h,f,c;return e=n=="edit"?"EditDialog_":"AddDialog_",o=r.buildTag("input","",{"border-radius":"3px","min-width":"70px"},{type:"button",id:e+i._id+"_Save"}),l=i._editDialogTexts.saveButton,o.ejButton({cssClass:u.cssClass,text:l,width:"auto"}),a=i._editDialogTexts.cancelButton,s=r.buildTag("input","",{"margin-left":"18px","border-radius":"3px","min-width":"70px"},{type:"button",id:e+i._id+"_Cancel"}),s.ejButton({cssClass:u.cssClass,text:a,width:"auto"}),v=i._editDialogTexts.deleteButton,h=r.buildTag("input","",{"border-radius":"3px","min-width":"90px"},{type:"button",id:"EditDialog_"+i._id+"_Delete"}),h.ejButton({cssClass:u.cssClass,text:v,width:"auto"}),f=r.buildTag("div","",{"margin-top":"10px",float:"right","margin-bottom":"3px","margin-right":"0px","z-index":"10"},{"class":"e-editform-btn"}),c=r.buildTag("div","",{"margin-top":"10px",float:"left","margin-bottom":"3px","margin-right":"0px","z-index":"10"},{"class":"e-editform-btn"}),f.append(o),n=="edit"&&u.editSettings.allowDeleting&&c.append(h),f.append(s),f.appendTo(t),c.appendTo(t),t},_renderToolBar:function(){var t=this,f=t.model,u=r.buildTag("div.e-gantttoolbar#e-gantttoolbar"+t._id,"",{height:"50px"},{id:t._id+"_toolbarItems"}),e=r.buildTag("ul","",{width:t._ganttWidth},{}),o,i;return!r.isNullOrUndefined(f.toolbarSettings.toolbarItems)&&f.toolbarSettings.toolbarItems.length&&t._renderLi(e),u.append(e),o=r.buildTag("ul"),u.append(o),i={},i.click=t._toolBarClick,i.cssClass="",i.rtl=!1,i.itemSeparator=!1,i.width=t._ganttWidth,i.fields={id:"",tooltipText:"",imageUrl:"",text:"",imageAttributes:"",spriteCSS:"",htmlAttributes:""},u.ejToolbar(i),u.ejToolbar("disableItem",t._disabledToolItems),t._disabledToolItems=n(),u},_renderLi:function(n){var f=this,i=f.model.toolbarSettings.toolbarItems,e=i.length,t=0,u;for(t;t<e;t++)u=r.buildTag("li","",{},{id:f._id+"_"+i[t],tabindex:"0"}),i[t]!=="search"&&u.css({width:"30px",height:"24px"}),f._renderLiContent(u,i[t]),n.append(u)},_renderLiContent:function(t,i){var f,u,e=this.selectedRowIndex(),nt=this.model.editSettings,s,h,c,l,a,v,y,p,w,b,k,d,o,g;switch(i){case"add":f=r.buildTag("span.e-addnewitem e-toolbaricons e-icon e-gantt-add","",{});s=this._toolboxTooltipTexts.addTool;t.attr("title",s);this.model.readOnly!=!0&&this.model.editSettings.allowAdding||this._disabledToolItems.push(t.get(0));break;case"edit":f=r.buildTag("span.e-edititem e-toolbaricons e-icon e-gantt-edit","",{});h=this._toolboxTooltipTexts.editTool;t.attr("title",h);this.model.readOnly!=!0&&this.model.editSettings.allowEditing&&e!=-1&&this.model.editSettings.beginEditAction!="click"||this._disabledToolItems.push(t.get(0));break;case"delete":c=this._toolboxTooltipTexts.deleteTool;t.attr("title",c);f=r.buildTag("span.e-deleteitem e-toolbaricons e-icon e-gantt-delete","",{});this.model.readOnly!=!0&&this.model.editSettings.allowDeleting&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"update":l=this._toolboxTooltipTexts.saveTool;t.attr("title",l);f=r.buildTag("span.e-saveitem e-toolbaricons e-icon e-gantt-save e-disabletool","",{});this._disabledToolItems.push(t.get(0));break;case"cancel":a=this._toolboxTooltipTexts.cancelTool;t.attr("title",a);f=r.buildTag("span.e-cancel e-toolbaricons e-icon e-gantt-cancel e-disabletool","",{});this._disabledToolItems.push(t.get(0));break;case"indent":v=this._toolboxTooltipTexts.indentTool;t.attr("title",v);u=r.buildTag("span.e-indent e-toolbaricons e-icon e-disabletool e-gantt-indent","",{},{});t.append(u);this.model.readOnly!=!0&&this.model.editSettings.allowIndent&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"outdent":y=this._toolboxTooltipTexts.outdentTool;t.attr("title",y);u=r.buildTag("span.e-outdent e-toolbaricons e-icon e-disabletool e-gantt-outdent","",{},{});t.append(u);this.model.readOnly!=!0&&this.model.editSettings.allowIndent&&e!=-1||this._disabledToolItems.push(t.get(0));break;case"expandAll":p=this._toolboxTooltipTexts.expandAllTool;t.attr("title",p);u=r.buildTag("span.e-expandall e-toolbaricons e-icon e-gantt-expandall","",{},{});t.append(u);break;case"collapseAll":w=this._toolboxTooltipTexts.collapseAllTool;t.attr("title",w);u=r.buildTag("span.e-collapseall e-toolbaricons e-icon e-gantt-collapseall","",{},{});t.append(u);break;case"prevTimeSpan":b=this._toolboxTooltipTexts.prevTimeSpanTool;t.attr("title",b);u=r.buildTag("span.e-prevtimespan e-toolbaricons e-icon e-gantt-prevtimespan","",{},{});t.append(u);break;case"nextTimeSpan":k=this._toolboxTooltipTexts.nextTimeSpanTool;t.attr("title",k);u=r.buildTag("span.e-nexttimespan e-toolbaricons e-icon e-gantt-nexttimespan","",{},{});t.append(u);break;case"criticalPath":d=this._toolboxTooltipTexts.criticalPathTool;t.attr("title",d);u=r.buildTag("span.e-criticaltask e-toolbaricons e-icon e-gantt-criticaltask","",{},{});t.append(u);break;case"search":o=this._toolboxTooltipTexts.searchTool;u=r.buildTag("input.e-ejinputtext","",{margin:"4px","text-indent":"4px"},{type:"text",placeholder:o},{color:"#E8E9E9"});t.css({float:"right",padding:"2px"});t.attr("title",o);t.addClass("e-search");t.append(u);this.model.allowSearching=!0;u.keydown(n.proxy(this._keyDown,this));break;case"excelExport":g=this._toolboxTooltipTexts.excelExportTool;t.attr("title",g);u=r.buildTag("span.e-excelIcon e-toolbaricons e-icon e-gantt-excelexport","",{},{});t.append(u)}t.append(f)},_keyDown:function(n){if(n.which===13)return this._toolbarOperation(this._id+"_search",n.currentTarget.value),n.preventDefault(),!1},_updateToolbarOptions:function(){var v=this,e=v.model,o=e.editSettings,i=n("#"+v._id+"_toolbarItems"),f=n(i).find(".e-addnewitem").parent()[0],r=n(i).find(".e-edititem").parent()[0],u=n(i).find(".e-deleteitem").parent()[0],s=n(i).find(".e-indent").parent()[0],h=n(i).find(".e-outdent").parent()[0],c=n(i).find(".e-saveitem").parent()[0],l=n(i).find(".e-cancel").parent()[0],t=[],a=[];e.readOnly==!0?(f&&t.push(n(f)),r&&t.push(n(r)),u&&t.push(n(u)),s&&t.push(n(s)),h&&t.push(n(h)),c&&t.push(n(c)),l&&t.push(n(l)),n(i).ejToolbar("disableItem",t)):(o.allowAdding?f&&a.push(f):f&&t.push(n(f)),e.selectedItem?(o.allowEditing&&e.editSettings.beginEditAction!="click"?r&&a.push(r):r&&t.push(n(r)),o.allowDeleting?u&&a.push(u):u&&t.push(n(u)),v.updateIndentOutdentOption(e.selectedItem)):(o.allowEditing&&r&&t.push(n(r)),o.allowDeleting&&u&&t.push(n(u)),c&&c&&t.push(n(c)),l&&l&&t.push(n(l)),s&&s&&t.push(n(s)),h&&h&&t.push(n(h))),n(i).ejToolbar("disableItem",t),n(i).ejToolbar("enableItem",a))},_renderGantt:function(){var i=this,a=i.model,t,c,u=parseInt(i._ganttWidth),e=i.splitterPosition(),s=!1,l=a.splitterSettings.index,h,o,f;if(e||(e=i._splitterPosition(),i.splitterPosition(e)),e||l>-1){if(e)e.indexOf("%")!=-1?(t=parseInt(e),s=!0):(t=parseInt(e)/u*100,s=!1);else{for(h=i.getColumns(),o=0,columnIndex=l,columnIndex>=h.length&&(columnIndex=h.length-1),f=0;f<=columnIndex;f++)o+=h[f].width;if(o<=u)t=parseInt(o)/u*100,l=f-1;else for(o=0,f=0;f<=columnIndex;f++)if(o+h[f].width<=u)o+=h[f].width,l=f;else{t=parseInt(o)/u*100;break}a.splitterSettings.index=l}(isNaN(t)||t<0)&&(t=0);t>100&&(t=(2*i._commonColumnWidth+3)/u*100,t=t<30?t:30,s=!0)}else t=(2*i._commonColumnWidth+3)/u*100,t=t<30?t:30,s=!0;c=100-t-900/u;c<=0?(s?i.splitterPosition("100%"):i.splitterPosition(u.toString()),t=100-900/u,c=0):c>0&&(s?i.splitterPosition(Math.round(t)+"%"):i.splitterPosition(Math.round(t*u/100).toString()));i._splitterPosition(i.splitterPosition());n("#e-ejSpliter"+i._id).ejSplitter({height:i._ganttHeight,width:u,orientation:r.Orientation.Horizontal,properties:[{paneSize:t+"%",collapsible:!1},{paneSize:c+"%",collapsible:!1}],enableAutoResize:!1,resize:n.proxy(i._onResize,i)})},_renderTreeGrid:function(){var i=this,t=i.model;i._$treegridHelper=n("#ejTreeGrid"+i._id).ejTreeGrid({enableAltRow:t.enableAltRow,allowColumnResize:t.allowColumnResize,enableVirtualization:t.enableVirtualization,allowSorting:t.allowSorting,showColumnChooser:t.showColumnChooser,showColumnOptions:t.showColumnOptions,allowMultiSorting:t.allowMultiSorting,sortSettings:t.sortSettings,allowSelection:t.allowSelection,selectionType:t.selectionMode=="cell"?t.selectionType:"single",selectionMode:t.selectionMode,selectedRowIndex:this.selectedRowIndex(),allowDragAndDrop:t.allowDragAndDrop,dragTooltip:t.dragTooltip,allowSearching:t.allowSearching,parentIdMapping:t.parentTaskIdMapping,allowKeyboardNavigation:t.allowKeyboardNavigation,cssClass:t.cssClass,locale:t.locale,columns:i.getColumns(),editSettings:t.editSettings,toolbarSettings:t.toolbarSettings,rowTemplate:t.rowTemplate,rowDataBound:t.rowDataBound,queryCellInfo:t.queryCellInfo,cellSelecting:t.cellSelecting,cellSelected:t.cellSelected,selectedCellIndexes:this.selectedCellIndexes(),dataSource:this.dataSource(),flatRecords:t.flatRecords,parentRecords:t.parentRecords,ids:i.model.ids,columns:i._columns,dateFormat:t.dateFormat,resourceInfoMapping:t.resourceInfoMapping,resourceNameMapping:t.resourceNameMapping,resourceIdMapping:t.resourceIdMapping,resourceUnitMapping:t.resourceUnitMapping,idMapping:t.taskIdMapping,readOnly:t.readOnly,notesMapping:t.notesMapping,showGridCellTooltip:t.showGridCellTooltip,cellTooltipTemplate:t.cellTooltipTemplate,showGridExpandCellTooltip:t.showGridExpandCellTooltip,taskNameMapping:t.taskNameMapping,taskSchedulingModeMapping:t.taskSchedulingModeMapping,startDateMapping:t.startDateMapping,endDateMapping:t.endDateMapping,childMapping:t.childMapping,durationMapping:t.durationMapping,durationUnitMapping:t.durationUnitMapping,durationUnit:t.durationUnit,progressMapping:t.progressMapping,predecessorMapping:t.predecessorMapping,rowHeight:t.rowHeight,emptyRecordText:i._emptyRecordText,isFromGantt:i._isFromGantt,treeColumnIndex:t.treeColumnIndex,workingTimeScale:t.workingTimeScale,enableWBS:t.enableWBS,enableWBSPredecessor:t.enableWBSPredecessor,columnMenuTexts:i._columnMenuTexts,columnDialogTitle:i._columnDialogTitle,deleteColumnText:i._deleteColumnText,okButtonText:i._okButtonText,cancelButtonText:i._cancelButtonText,confirmDeleteText:i._confirmDeleteText,columnDialogFields:t.columnDialogFields,columnDialogTexts:i._columnDialogTexts,workUnit:i._workUnitTexts[t.workUnit],taskTypeTexts:i._taskTypeTexts,effortDrivenTexts:i._effortDrivenTexts,dataManagerUpdate:{isDataManagerUpdate:i._isDataManagerUpdate,jsonData:i._jsonData},durationUnitEditText:this._durationUnitEditText,durationUnitTexts:i._durationUnitTexts,enableCollapseAll:t.enableCollapseAll,weekStartDay:t.scheduleHeaderSettings.weekStartDay,indentLevelWidth:this.indentLevelWidth})},_renderGanttChart:function(){var i=this,t=this.model;i._$ganttchartHelper=n("#ejGanttChart"+i._id).ejGanttChart({dataSource:this.dataSource(),scheduleStartDate:t.scheduleStartDate,scheduleEndDate:t.scheduleEndDate,startDateMapping:t.startDateMapping,endDateMapping:t.endDateMapping,taskNameMapping:t.taskNameMapping,taskIdMapping:t.taskIdMapping,progressMapping:t.progressMapping,durationMapping:t.durationMapping,childPropertyName:t.childMapping,predecessorMapping:t.predecessorMapping,enableVirtualization:t.enableVirtualization,highlightWeekends:t.highlightWeekends,milestoneMapping:t.milestoneMapping,enableRowHover:t.enableRowHover,perDayWidth:i._perDayWidth,workingTimeScale:t.workingTimeScale,roundOffDayworkingTime:t.roundOffDayworkingTime,durationUnit:t.durationUnit,isCriticalPathEnable:this.isCriticalPathEnable,criticalPathCollection:this.criticalPathCollection,perMonthWidth:i._perMonthWidth,perWeekWidth:i._perWeekWidth,perHourWidth:i._perHourWidth,perMinuteWidth:i._perMinuteWidth,perTopHourWidth:i._perTopHourWidth,minuteInterval:i._minuteInterval,includeWeekend:t.includeWeekend,connectorlineWidth:t.connectorlineWidth,workingTimeRanges:i._workingTimeRanges,secondsPerDay:i._secondsPerDay,scheduleHeaderSettings:t.scheduleHeaderSettings,taskbarBackground:t.taskbarBackground,progressbarBackground:t.progressbarBackground,connectorLineBackground:t.connectorLineBackground,parentTaskbarBackground:t.parentTaskbarBackground,parentProgressbarBackground:t.parentProgressbarBackground,holidays:t.holidays,dateFormat:t.dateFormat,locale:t.locale,enableTaskbarTooltip:t.enableTaskbarTooltip,enableTaskbarDragTooltip:t.enableTaskbarDragTooltip,flatRecords:t.flatRecords,parentRecords:t.parentRecords,scheduleWeeks:i._scheduleWeeks,projectStartDate:i._projectStartDate,projectEndDate:i._projectEndDate,scheduleYears:i._scheduleYears,scheduleMonths:i._scheduleMonths,scheduleDays:i._scheduleDays,scheduleHours:i._scheduleHours,progressbarHeight:t.progressbarHeight,tooltipTemplate:t.taskbarTooltipTemplate,tooltipTemplateId:t.taskbarTooltipTemplateId,progressbarTooltipTemplate:t.progressbarTooltipTemplate,progressbarTooltipTemplateId:t.progressbarTooltipTemplateId,queryTaskbarInfo:t.queryTaskbarInfo,readOnly:t.readOnly,showTaskNames:t.showTaskNames,leftTaskLabelMapping:t.leftTaskLabelMapping,rightTaskLabelMapping:t.rightTaskLabelMapping,leftTaskLabelTemplate:t.leftTaskLabelTemplate,rightTaskLabelTemplate:t.rightTaskLabelTemplate,showProgressStatus:t.showProgressStatus,showResourceNames:t.showResourceNames,resourceInfoMapping:t.resourceInfoMapping,resourceNameMapping:t.resourceNameMapping,resourceUnitMapping:t.resourceUnitMapping,enableProgressBarResizing:t.enableProgressBarResizing,allowGanttChartEditing:t.allowGanttChartEditing,taskbarEditingTooltipTemplateId:t.taskbarEditingTooltipTemplateId,taskbarEditingTooltipTemplate:t.taskbarEditingTooltipTemplate,ids:i.model.ids,stripLines:t.stripLines,_predecessorCollection:i._predecessorsCollection,_columns:i._columns,weekendBackground:t.weekendBackground,allowKeyboardNavigation:t.allowKeyboardNavigation,updatedRecords:i.model.updatedRecords,renderBaseline:t.renderBaseline,baselineColor:t.baselineColor,editSettings:t.editSettings,columnHeaderTexts:i._columnHeaderTexts,durationUnitTexts:i._durationUnitTexts,predecessorEditingTexts:i._predecessorEditingTexts,localizedDays:i._days,localizedMonths:i._months,rowHeight:t.rowHeight,allowSelection:t.allowSelection,selectionMode:t.selectionMode,taskbarTemplate:t.taskbarTemplate,parentTaskbarTemplate:t.parentTaskbarTemplate,milestoneTemplate:t.milestoneTemplate,durationUnitEditText:this._durationUnitEditText,taskbarClick:t.taskbarClick,predecessorText:i._getPredecessorText(),taskbarHeight:i.taskbarHeight})},_getPredecessorText:function(){var n=this._predecessorCollectionText[1],t={};return n=n.value.split("-"),t.Start=n[0],t.Finish=n[1],t},_updateColumnDropDownData:function(){for(var n=this,r=n.model,i=r.columns,u=i.length,t=0;t<u;t++)i[t].field=="taskMode"&&(i[t].dropdownData=[{id:1,text:n._taskModeTexts.manual,value:"true"},{id:2,text:n._taskModeTexts.auto,value:"false"}]),i[t].field=="taskType"&&(i[t].dropdownData=[{id:1,text:n._taskTypeTexts.fixedWork,value:"fixedWork"},{id:2,text:n._taskTypeTexts.fixedUnit,value:"fixedUnit"},{id:3,text:n._taskTypeTexts.fixedDuration,value:"fixedDuration"}]),i[t].field=="effortDriven"&&(i[t].dropdownData=[{id:1,text:n._effortDrivenTexts.yes,value:"true"},{id:2,text:n._effortDrivenTexts.no,value:"false"}])},createTreeGridColumns:function(){var u=this,i=u.model,t,f=[],n=i.taskIdMapping,e;return n.length&&(t=i.showColumnChooser?{field:"taskId",headerText:u._columnHeaderTexts.taskId,width:40,editType:r.Gantt.EditingType.String,mappingName:n,allowEditing:!1,allowCellSelection:!0}:{field:"taskId",headerText:u._columnHeaderTexts.taskId,width:30,editType:r.Gantt.EditingType.String,mappingName:n,allowEditing:!1,allowCellSelection:!0},f.push(t)),n=i.taskNameMapping,n.length&&(t={field:"taskName",headerText:u._columnHeaderTexts.taskName,width:150,editType:r.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},f.push(t)),n=i.startDateMapping,n.length&&(t={field:"startDate",headerText:u._columnHeaderTexts.startDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},f.push(t)),n=i.endDateMapping,n.length&&(t={field:"endDate",headerText:u._columnHeaderTexts.endDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},f.push(t)),n=i.resourceInfoMapping,n.length&&(t={field:"resourceInfo",headerText:u._columnHeaderTexts.resourceInfo,width:150,editType:r.Gantt.EditingType.Dropdown,mappingName:n,allowCellSelection:!0,dropdownData:i.resources},f.push(t)),n=i.durationMapping,n.length&&(t={field:"duration",headerText:u._columnHeaderTexts.duration,width:150,editType:r.Gantt.EditingType.String,allowCellSelection:!0,mappingName:n},f.push(t)),n=i.progressMapping,n.length&&(t={field:"status",headerText:u._columnHeaderTexts.status,width:150,editType:r.Gantt.EditingType.Numeric,mappingName:n,allowCellSelection:!0},f.push(t)),n=i.predecessorMapping,n.length&&(t={field:"predecessor",headerText:u._columnHeaderTexts.predecessor,width:150,editType:r.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},f.push(t)),i.renderBaseline&&i.baselineStartDateMapping&&i.baselineEndDateMapping&&(n=i.baselineStartDateMapping,n.length&&(t={field:"baselineStartDate",headerText:u._columnHeaderTexts.baselineStartDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},f.push(t)),n=i.baselineEndDateMapping,n.length&&(t={field:"baselineEndDate",headerText:u._columnHeaderTexts.baselineEndDate,width:150,editType:i.dateFormat.toLowerCase().indexOf("hh")==-1?r.Gantt.EditingType.DatePicker:r.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!0,allowCellSelection:!0},f.push(t))),i.enableWBS&&(n="WBS",n.length&&(t={field:"WBS",headerText:u._columnHeaderTexts.WBS,width:150,editType:r.Gantt.EditingType.String,allowEditing:!1,mappingName:n},f.push(t))),i.enableWBS&&i.enableWBSPredecessor&&(n="WBSPredecessor",n.length&&(t={field:"WBSPredecessor",headerText:u._columnHeaderTexts.WBSPredecessor,width:150,editType:r.Gantt.EditingType.String,allowEditing:!1,mappingName:n},f.push(t))),n=i.notesMapping,n.length&&(t={field:"notesText",headerText:u._columnHeaderTexts.notes,width:150,editType:"stringedit",mappingName:n+"Text",allowEditing:!0,allowCellSelection:!0},f.push(t)),n=i.taskSchedulingModeMapping,n.length&&(e=!1,i.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom&&(e=!0),t={field:"taskMode",headerText:u._columnHeaderTexts.taskMode,width:100,editType:r.Gantt.EditingType.Dropdown,allowCellSelection:e,allowEditing:e,mappingName:n,dropdownData:[{id:1,text:u._taskModeTexts.manual,value:"true"},{id:2,text:u._taskModeTexts.auto,value:"false"}],editParams:{field:{text:"text",value:"value"}}},f.push(t)),t={field:"work",headerText:u._columnHeaderTexts.work,width:150,editType:r.Gantt.EditingType.Numeric,allowEditing:!0,allowCellSelection:!0,visible:!1},f.push(t),t={field:"taskType",headerText:u._columnHeaderTexts.taskType,width:150,editType:r.Gantt.EditingType.Dropdown,dropdownData:[{id:1,text:u._taskTypeTexts.fixedWork,value:"fixedWork"},{id:2,text:u._taskTypeTexts.fixedUnit,value:"fixedUnit"},{id:3,text:u._taskTypeTexts.fixedDuration,value:"fixedDuration"}],editParams:{field:{text:"text",value:"value"}},allowEditing:!0,allowCellSelection:!0,visible:!1},f.push(t),t={field:"effortDriven",headerText:u._columnHeaderTexts.effortDriven,width:150,editType:r.Gantt.EditingType.Dropdown,dropdownData:[{id:1,text:u._effortDrivenTexts.yes,value:"true"},{id:2,text:u._effortDrivenTexts.no,value:"false"}],editParams:{field:{text:"text",value:"value"}},allowEditing:!0,allowCellSelection:!0,visible:!1},f.push(t),f},_createGanttRecords:function(n){var t=this,r=t.model,e=r.flatRecords,o=n.length,f=0,i,s=r.parentRecords,c=r.allowSorting,l=r.enableAltRow,h=t.model.ids;for(f;f<o;f++)r.enableWBS&&(n[f].WBS=(f+1).toString()),i=t._createGanttRecord(n[f],0,null,u,"Load"),t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,h[t._storedIndex]=i.taskId.toString(),e.push(i),s.push(i),i.childRecords&&t._addNestedGanttRecords(i.childRecords);r.enableWBS&&r.enableWBSPredecessor&&t.createWBSPredecessor()},createWBSPredecessor:function(){var c=this,n=c.model,u,r,i,s,h,o;if(n.enableWBS&&n.enableWBSPredecessor&&n.predecessorMapping)for(u=n.flatRecords.filter(function(n){return n&&n.predecessor}),r=0;r<u.length;r++){var f=u[r],e=f.predecessor,t=null;for(i=0;i<e.length;i++)s=+e[i].from,h=n.flatRecords.filter(function(n){return n&&n.taskId==s}),o=h[0].WBS+e[i].predecessorsType,t=t?t+","+o:o;f.WBSPredecessor=t;f.item.WBSPredecessor=t}},_calculateScheduleDates:function(t){var o=this,r,i,f,e,u=this.model,s=u.flatRecords,h;(!u.scheduleEndDate||!u.scheduleStartDate)&&s.length>0||t?(n.each(s,function(n,t){f=new Date(t.startDate);e=new Date(t.endDate);baseLineStartDate=t.baselineStartDate?new Date(t.baselineStartDate):null;baseLineEndDate=t.baselineEndDate?new Date(t.baselineEndDate):null;r?(r.getTime()>=f.getTime()&&(r=f),baseLineStartDate&&u.renderBaseline&&r.getTime()>=baseLineStartDate.getTime()?r=baseLineStartDate:baseLineEndDate&&u.renderBaseline&&r.getTime()>=baseLineEndDate.getTime()&&(r=baseLineEndDate)):r=baseLineStartDate&&u.renderBaseline&&f.getTime()>=baseLineStartDate.getTime()?baseLineStartDate:baseLineEndDate&&u.renderBaseline&&f.getTime()>=baseLineEndDate.getTime()?baseLineEndDate:f;i?(i.getTime()<=e.getTime()&&(i=e),baseLineEndDate&&u.renderBaseline&&i.getTime()<=baseLineEndDate.getTime()?i=baseLineEndDate:baseLineStartDate&&u.renderBaseline&&i.getTime()<=baseLineStartDate.getTime()&&(i=baseLineStartDate)):(baseLineEndDate&&u.renderBaseline&&e.getTime()<=baseLineEndDate.getTime()&&(i=baseLineEndDate),i=baseLineStartDate&&u.renderBaseline&&e.getTime()<=baseLineStartDate.getTime()?baseLineStartDate:e)}),h=o._updateScheduleDatesByTaskLables(r,i),r=h.minStartDate,i=h.maxEndDate):u.scheduleEndDate&&u.scheduleStartDate||s.length!==0||(r=o._getDateFromFormat(new Date),i=o._getDateFromFormat(new Date(r)),i.setDate(i.getDate()+20));t?(t.minStartDate=r,t.maxEndDate=i):(u.scheduleStartDate=r?o.getFormatedDate(r):u.scheduleStartDate,u.scheduleEndDate=i?o.getFormatedDate(i):u.scheduleEndDate)},_updateScheduleDatesByTaskLables:function(n,t){var f=this,e=this.model,s=e.scheduleHeaderSettings.scheduleHeaderType,h=r.Gantt.ScheduleHeaderType,i=f._getResourceStringWidth(),o,u={},c=e.scheduleEndDate&&this._getDateFromFormat(e.scheduleEndDate);return s==h.Week&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perDayWidth+7:7,t.setDate(t.getDate()+o))),s==h.Year&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perMonthWidth+1:1,t.setMonth(t.getMonth()+o))),s==h.Month&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perDayWidth+7:7,t.setDate(t.getDate()+o))),s==h.Day&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(o=i>0?i/f._perHourWidth+7:7,t.setHours(t.getHours()+o))),s==h.Hour&&(e.scheduleEndDate&&c.getTime()===t.getTime()||(numOfHours=i>0?i/f._perMinuteWidth+5:5,t.setHours(t.getHours()+numOfHours),n.setHours(n.getHours()-1))),u=f._updateScheduleDatesByStripLines(n,t),n=u.startDate,t=u.endDate,u=f._updateScheduleDatesByHolidays(n,t),n=u.startDate,t=u.endDate,u.minStartDate=n,u.maxEndDate=t,u},_updateScheduleDatesByHolidays:function(t,i){var u=this,f=this.model,r={};return u._holidaysList.length>0&&n.each(u._holidaysList,function(n,r){r.getTime()>t.getTime()&&r.getTime()<i.getTime()||(r.getTime()<t.getTime()?t=new Date(r):i=new Date(r))}),r.startDate=t,r.endDate=i,r},_updateScheduleDatesByStripLines:function(t,i){var f=this,u=this.model,r={};return u.stripLines.length>0&&n.each(u.stripLines,function(n,r){var u=f._getDateFromFormat(r.day);u.getTime()>t.getTime()&&u.getTime()<i.getTime()||(u.getTime()<t.getTime()?t=new Date(u):i=new Date(u))}),r.startDate=t,r.endDate=i,r},_getResourceStringWidth:function(){var s=this,u=this.model,f=u.resources,e="",o,i,t;if(f.length>0&&u.showResourceNames){for(i=0;i<f.length;i++)e+=f[i][u.resourceNameMapping]+" ,";return t=r.buildTag("span","",{"font-family":"Segoe UI","font-size":"12px"},{}),t.text(e),n(document.body).append(t),o=t.width(),t.remove(),o}return 0},_calculateHeaderDates:function(){var n=this,e=this.model,t=n._getDateFromFormat(e.scheduleStartDate),i=n._getDateFromFormat(e.scheduleEndDate),u=e.scheduleHeaderSettings.scheduleHeaderType,f=r.Gantt.ScheduleHeaderType;u==f.Week&&n._calculateWeekSplit(t,i);u==f.Year&&n._calculateYearSplit(t,i);u==f.Month&&n._calculateMonthSplit(t,i);u==f.Day&&n._calculateDaySplit(t,i);u==f.Hour&&n._calculateHourSplit(t,i)},_addNestedGanttRecords:function(n){var t=this,o=t.model.ids,s=t.model,h=s.flatRecords,u=0,c=n.length,f=[],r,a=s.enableAltRow;for(u;u<c;u++)if(r=n[u],t._storedIndex++,r.isAltRow=t._storedIndex%2==0?!1:!0,r.index=t._storedIndex,o[t._storedIndex]=r.taskId.toString(),h.push(r),f=r.childRecords,f){var e=0,l=f.length,i=null;for(e;e<l;e++)i=f[e],t._storedIndex++,i.isAltRow=t._storedIndex%2==0?!1:!0,i.index=t._storedIndex,o[t._storedIndex]=i.taskId.toString(),h.push(i),i.childRecords&&t._addNestedGanttRecords(i.childRecords)}},_createGanttRecord:function(n,t,i,f,e){var h=this,o,s=h.model,y=h._columns,nt=y.length,l=n[s.childMapping],b=r.isNullOrUndefined(n[s.durationMapping])?null:n[s.durationMapping],tt=n[s.progressMapping]?isNaN(parseFloat(n[s.progressMapping]))?0:parseFloat(n[s.progressMapping]):0,a=h._getDateFromFormat(n[s.startDateMapping]),c=h._getDateFromFormat(n[s.endDateMapping]),ut=n[s.resourceInfoMapping],p=n[s.predecessorMapping],k=n[s.notesMapping],ft=h._getDateFromFormat(n[s.baselineStartDateMapping]),w=h._getDateFromFormat(n[s.baselineEndDateMapping]),et=n.WBS?n.WBS:null,ot=s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Auto?!0:s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Manual?!1:s.taskSchedulingMode==r.Gantt.TaskSchedulingMode.Custom?n[s.taskSchedulingModeMapping]==!0?!1:!0:s.taskSchedulingMode,d=s.durationUnitMapping&&n[s.durationUnitMapping]?h._validateDurationUnitMapping(n[s.durationUnitMapping]):null,it=s.milestoneMapping&&n[s.milestoneMapping],st=a?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes()).getTime():null,ht=c?new Date(c.getFullYear(),c.getMonth(),c.getDate(),c.getHours(),c.getMinutes()).getTime():null,g,v,rt;if(o=new r.Gantt.GanttRecord,o.taskId=n[s.taskIdMapping],o.taskName=n[s.taskNameMapping],h._addItemValue(o,n,e),o.isAutoSchedule=ot,o.startDate=this._checkStartDate(a,o),!r.isNullOrUndefined(it)&&it?(o.duration=0,o.durationUnit=d,o.isMilestone=!0,o.endDate=new Date(o.startDate)):r.isNullOrUndefined(b)?c?(c.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,c),o.endDate=this._checkEndDate(c,o),o.startDate.getTime()>=o.endDate.getTime()?(o.endDate=new Date(o.startDate),o.isMilestone=!0,o.duration=0):o.duration=this._getDuration(o.startDate,o.endDate,s.durationUnit,o.isAutoSchedule),o.durationUnit=s.durationUnit):!c&&r.isNullOrUndefined(b)&&(o.isMilestone=!0,o.duration=0,o.endDate=new Date(o.startDate)):(g=this._getDurationValues(b),o.duration=g.duration,o.durationUnit=d?d:g.durationUnit,o.duration==0?(o.isMilestone=!0,o.endDate=new Date(o.startDate)):o.endDate=this._getEndDate(o.startDate,o.duration,o.durationUnit,o)),o.baselineStartDate=this._checkBaseLineStartDate(ft),w&&w.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,w),o.baselineEndDate=this._checkBaseLineEndDate(w),o.WBS=et,o.notes=k,o.notesText=k?h._getPlainText(k):"",nt)for(v=0;v<nt;v++)o[y[v].field]==u&&(o[y[v].field]=n[y[v].mappingName]);return o.status=tt,o.predecessor=p&&o._calculatePredecessor(p,this._durationUnitEditText,s.durationUnit),o.predecessorsName=p,rt=h._isinAddnewRecord?h._newRecordResourceCollection:s.resources,o.resourceInfo=ut&&o._setResourceInfo(n[s.resourceInfoMapping],s.resourceIdMapping,s.resourceNameMapping,s.resourceUnitMapping,rt),h._updateResourceName(o),o.parentItem=i,o.level=t,e||(o.width=o._calculateWidth(this),o.left=o._calculateLeft(this),o.progressWidth=o._calculateProgressWidth(o.width,tt),o.baselineStartDate&&o.baselineEndDate&&(o.baselineLeft=o._calculateBaselineLeft(this),o.baselineRight=o._calculateBaselineRight(this),o.baselineWidth=o._calculateBaseLineWidth(this))),h._updateItemValueInRecord(o),o.childRecords=l&&l.length>0&&h._createChildRecords(l,t+1,o),o.hasChildRecords=l&&l.length>0?!0:!1,o.isMilestone=o.hasChildRecords?!1:o.isMilestone,o.expanded=f!==u?f:l?l.length>0:!1,s.enableVirtualization===!1&&(o.isExpanded=!0),o.hasChildRecords&&(o.manualStartDate=o.startDate,o.manualEndDate=o.endDate,o.manualDuration=o.duration),o.taskType=n.taskType?n.taskType:s.taskType,o.effortDriven=n.effortDriven?n.effortDriven:o.taskType!="fixedWork"?"false":"true",o._updateWorkWithDuration(h),p&&h._predecessorsCollection.push(o),o},_validateDurationUnitMapping:function(n){var t=n;return this._durationUnitEditText.minute.indexOf(t)!=-1?t=r.Gantt.DurationUnit.Minute:this._durationUnitEditText.hour.indexOf(t)!=-1?t=r.Gantt.DurationUnit.Hour:this._durationUnitEditText.day.indexOf(t)!=-1&&(t=r.Gantt.DurationUnit.Day),t==r.Gantt.DurationUnit.Day||t==r.Gantt.DurationUnit.Hour||t==r.Gantt.DurationUnit.Minute?t:this.model.durationUnit},_updateItemValueInRecord:function(n){var t=this.model,i;n.item&&(i=n.item,t.startDateMapping&&(i[t.startDateMapping]=n.startDate),t.endDateMapping&&(i[t.endDateMapping]=n.endDate),t.durationMapping&&(i[t.durationMapping]=n.duration),t.durationUnitMapping&&(i[t.durationUnitMapping]=n.durationUnit),t.taskSchedulingModeMapping&&(i[t.taskSchedulingModeMapping]=!n.isAutoSchedule))},_addItemValue:function(n,t,i){var f=this,e=this.model,o,u;e.parentTaskIdMapping&&i?(o=t[e.taskIdMapping],u=f._taskIds.indexOf(o),n.item=u>-1?f._retrivedData[u]:[]):this.dataSource()instanceof r.DataManager&&this.dataSource().dataSource.json&&this.dataSource().dataSource.offline&&i?e.parentTaskIdMapping?(o=t[e.taskIdMapping],u=f._taskIds.indexOf(o),n.item=u>-1?f._retrivedData[u]:[]):n.item=t:n.item=t},_getPlainText:function(n){var t=document.createElement("DIV");return t.innerHTML=n,t.textContent||t.innerText||""},_updateResourceName:function(n){var f=this,i=n.resourceInfo,r=[],u,t;if(i){for(u=i.length,n.item?n.item[this.model.resourceInfoMapping]=[]:null,t=0;t<u;t++)r.push(i[t][this.model.resourceNameMapping]),n.item&&n.item[this.model.resourceInfoMapping].push(i[t][this.model.resourceIdMapping]);n.resourceNames=r.join(",")}},_updateResourceRelatedFields:function(n){var t=this,e=t.model,f=n.taskType,i=n.isAutoSchedule,u=n.effortDriven==="true";if(!r.isNullOrUndefined(n.resourceInfo))if(n.work>0)switch(f){case"fixedUnit":i&&n.resourceInfo.length&&(t._updatedColumn=="work"||u&&t._updatedColumn=="resourceInfo")?n._updateDurationWithWork(t):i||t._updatedColumn!="work"?n._updateWorkWithDuration(t):n._updateUnitWithWork(t);break;case"fixedWork":if(n.resourceInfo.length==0)return;i?t._updatedColumn=="duration"||t._updatedColumn=="endDate"?n._updateUnitWithWork(t):n._updateDurationWithWork(t):t._updatedColumn=="work"?n._updateUnitWithWork(t):n._updateWorkWithDuration(t);break;case"fixedDuration":n.resourceInfo.length&&(t._updatedColumn=="work"||i&&u&&t._updatedColumn=="resourceInfo")?n._updateUnitWithWork(t):n._updateWorkWithDuration(t)}else n._updateWorkWithDuration(t)},_updateResourceDataSource:function(t){for(var e,f,i,o,s=this,r=[],h=t.resourceInfo?t.resourceInfo.length:0,u=0;u<h;u++)r.push({name:t.resourceInfo[u][model.resourceIdMapping],unit:t.resourceInfo[u][model.resourceUnitMapping]});for(e="#treegrid"+s._id+"resourceEdit",f=n(e).data("ejTreeGrid").model.dataSource,i=0;i<f.length;i++)o=r.filter(function(n){return n.name===parseInt(f[i].name)}),o&&o.length==0&&r.push(f[i]);n(e).ejTreeGrid("option","dataSource",r)},_getHoliday:function(){var n;if(this.model.holidays!=null){var t=this.model.holidays,i=[],r=t.length;if(r>0){for(n=0;n<r;n++)i[n]=this._getDateFromFormat(t[n].day);return i}}return!1},_getStringHolidays:function(){var n;if(this._holidaysList!=null&&this._holidaysList.length>0){var t=this._holidaysList,i=[],u=t.length;if(u>0){for(n=0;n<u;n++)i[n]=r.format(t[n],this.model.dateFormat,this.model.locale);return i}}return[]},_createChildRecords:function(n,t,i){for(var f=[],s=this,r=0,h=n.length,e,o,r=0;r<h;r++)model.enableWBS&&(e=i.WBS,n[r].WBS=e+"."+(r+1)),n[r]&&(o=s._createGanttRecord(n[r],t,i,u,"Load"),f.push(o));return f},_createResourceInfoCollection:function(n){var i=this,t=0,r=n.length;for(t;t<r;t++)i._resourceInfoCollection.push(i._createResourceInfo(n[t]))},_createResourceInfo:function(n){var i=this.model,t={};return t.resourceId=n[i.resourceIdMapping],t.resourceName=n[i.resourceNameMapping],t},_calculateWeekSplit:function(n,t){var i=this,u=i.model,f=u.scheduleHeaderSettings.weekStartDay,e,r,o;e=u.scheduleHeaderSettings.timescaleStartDateMode=="month"?new Date(n.getFullYear(),n.getMonth(),1):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?new Date(n.getFullYear(),0,1):n;n=e;r=f>=0&&f<7?f:0;o=n.getDay()<=r?n.getDate()-(7-r+n.getDay()):n.getDate()-n.getDay()+r;n.setDate(o);n.setHours(0,0,0,0);do i._scheduleWeeks.push(new Date(n)),n.setDate(n.getDate()+7);while(!(n>t));i._projectStartDate=new Date(i._scheduleWeeks[0]);i._projectEndDate=new Date(i._scheduleWeeks[i._scheduleWeeks.length-1])},_calculateYearSplit:function(n,t){var i=this,r=i.model,u,f,e,o;if(r.scheduleHeaderSettings.timescaleStartDateMode=="month"){u=new Date(n.getFullYear(),n.getMonth(),1);n=u;do i._scheduleYears.push(new Date(n)),n=new Date(n.getFullYear()+1,0,1);while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0].getFullYear(),i._scheduleYears[0].getMonth(),1);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}else if(r.scheduleHeaderSettings.timescaleStartDateMode=="week"){f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay();n.setDate(f);do i._scheduleYears.push(new Date(n)),n=n.getDate()==29&&n.getMonth()==0&&n.getFullYear()%4!=0?new Date(n.getFullYear()+1,n.getMonth(),n.getDate()-1):new Date(n.getFullYear()+1,n.getMonth(),n.getDate());while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0]);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}else{n.setMonth(0);n.setDate(1);n.setHours(0,0,0,0);do i._scheduleYears.push(new Date(n)),n.setMonth(n.getMonth()+12);while(!(n>=t));i._projectStartDate=new Date(i._scheduleYears[0].getFullYear(),i._scheduleYears[0].getMonth(),1);i._projectEndDate=new Date(i._scheduleYears[i._scheduleYears.length-1].getFullYear(),11,31)}},_calculateDaySplit:function(n,t){var i=this,u=i.model,f,r;u.scheduleHeaderSettings.timescaleStartDateMode=="week"?(f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay(),n.setDate(f)):u.scheduleHeaderSettings.timescaleStartDateMode=="month"?(r=new Date(n.getFullYear(),n.getMonth(),1),n=r):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?(r=new Date(n.getFullYear(),0,1),n=r):n.setHours(0,0,0,0);do i._scheduleDays.push(new Date(n)),n.setDate(n.getDate()+1);while(n<=t);i._projectStartDate=new Date(i._scheduleDays[0]);i._projectEndDate=new Date(i._scheduleDays[i._scheduleDays.length-1])},_calculateHourSplit:function(n,t){var i=this,u=i.model,f,r;u.scheduleHeaderSettings.timescaleStartDateMode=="week"?(f=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay(),n.setDate(f)):u.scheduleHeaderSettings.timescaleStartDateMode=="month"?(r=new Date(n.getFullYear(),n.getMonth(),1),n=r):u.scheduleHeaderSettings.timescaleStartDateMode=="year"?(r=new Date(n.getFullYear(),0,1),n=r):n.setMinutes(0);do i._scheduleHours.push(new Date(n)),n.setHours(n.getHours()+1);while(n<=t);i._projectStartDate=new Date(i._scheduleHours[0]);i._projectEndDate=new Date(i._scheduleHours[i._scheduleHours.length-1])},_calculateMonthSplit:function(n,t){var i=this,f=i.model,e,u,o,r;if(f.scheduleHeaderSettings.timescaleStartDateMode=="week"){e=n.getDay()==0?n.getDate()-7:n.getDate()-n.getDay();n.setDate(e);do i._scheduleMonths.push(new Date(n)),n=n.getDate()==29&&n.getMonth()==0&&n.getFullYear()%4!=0?new Date(n.getFullYear(),n.getMonth()+1,n.getDate()-1):new Date(n.getFullYear(),n.getMonth()+1,n.getDate());while(!(n>=t))}else if(f.scheduleHeaderSettings.timescaleStartDateMode=="year"){u=new Date(n.getFullYear(),0,1);n=u;do i._scheduleMonths.push(new Date(n)),n.getMonth()==0||n.getMonth()==2||n.getMonth()==4||n.getMonth()==6||n.getMonth()==7||n.getMonth()==9||n.getMonth()==11?n.setDate(n.getDate()+31):n.getMonth()==3||n.getMonth()==5||n.getMonth()==8||n.getMonth()==10?n.setDate(n.getDate()+30):n.getMonth()==1&&(n.getFullYear()%4==0?n.setDate(n.getDate()+29):n.setDate(n.getDate()+28));while(!(n>=t))}else{u=new Date(n.getFullYear(),n.getMonth(),1);n=u;do i._scheduleMonths.push(new Date(n)),n.getMonth()==0||n.getMonth()==2||n.getMonth()==4||n.getMonth()==6||n.getMonth()==7||n.getMonth()==9||n.getMonth()==11?n.setDate(n.getDate()+31):n.getMonth()==3||n.getMonth()==5||n.getMonth()==8||n.getMonth()==10?n.setDate(n.getDate()+30):n.getMonth()==1&&(n.getFullYear()%4==0?n.setDate(n.getDate()+29):n.setDate(n.getDate()+28));while(!(n>=t))}o=new Date(i._scheduleMonths[0]);r=new Date(i._scheduleMonths[i._scheduleMonths.length-1]);r=new Date(r.getFullYear(),r.getMonth()+1,0);i._projectStartDate=o;i._projectEndDate=r},_updatePredecessors:function(){var u=this,i=0,f=u._predecessorsCollection,h=f.length,e,o,r=0,n,s,t;for(i;i<h;i++)for(e=f[i],o=e.predecessor,s=o.length,r=0;r<s;r++)t=o[r],n=u.model.flatRecords[u.model.ids.indexOf(t.from)],t.from!==e.taskId.toString()&&n&&(n.predecessor?n.predecessor.push(t):(n.predecessor=[],n.predecessor.push(t),f.push(n)))},getDateType:function(n){if(n!=null){if(typeof n=="object")return n;var t=new RegExp("\\-","g"),i=new RegExp("\\.","g");return n=n.replace(t,"/"),n=n.replace(i,"/"),new Date(n)}return null},getFormatedDate:function(n){return r.format(n,this.model.dateFormat,this.model.locale)},_getProgressWidth:function(n,t){return n*t/100},_wireEvents:function(){var t=this,u=t.model,i=n("#ejTreeGrid"+t._id),r=n("#ejGanttChart"+t._id),f=t._$ejGantt;t._on(t.element,"click",t.clickHandler);t._on(t.element,"click",".e-ejinputtext",t._searchTextFocusIn);t._on(t.element,"focusout",".e-ejinputtext",t._searchTextFocusOut);u.enableContextMenu&&(t._on(t.element,"contextmenu",t._rightClick),t._on(t.element,"keyup",this._preventContextMenu));u.enableResize&&u.isResponsive&&t._on(n(window),"resize",t.windowResize);i.ejTreeGrid({rowSelecting:n.proxy(t.rowSelecting,t)});i.ejTreeGrid({rowSelected:n.proxy(t.rowSelected,t)});i.ejTreeGrid({cellSelecting:n.proxy(t.cellSelecting,t)});i.ejTreeGrid({cellSelected:n.proxy(t.cellSelected,t)});i.ejTreeGrid({rowDrag:n.proxy(t.rowDrag,t)});i.ejTreeGrid({rowDragStart:n.proxy(t.rowDragStart,t)});i.ejTreeGrid({rowDragStop:n.proxy(t.rowDragStop,t)});i.ejTreeGrid({actionBegin:n.proxy(t.actionBegin,t)});i.ejTreeGrid({actionComplete:n.proxy(t.actionComplete,t)});i.ejTreeGrid({expandAllCollapseAllRequest:n.proxy(t.expandAllCollapseAllRequest,t)});i.ejTreeGrid({contextMenuAction:n.proxy(t.contextMenuAction,t)});i.ejTreeGrid({subContextMenuAction:n.proxy(t.subContextMenuAction,t)});i.ejTreeGrid({setInitialData:n.proxy(t.setInitialData,t)});u.queryCellInfo&&i.ejTreeGrid({queryCellInfo:n.proxy(t._queryCellInfo,t)});u.rowDataBound&&i.ejTreeGrid({rowDataBound:n.proxy(t._rowDataBound,t)});i.ejTreeGrid({beginEdit:n.proxy(t._beginEdit,t)});i.ejTreeGrid({endEdit:n.proxy(t._endEdit,t)});i.ejTreeGrid({expanding:n.proxy(t.expanding,t)});i.ejTreeGrid({collapsing:n.proxy(t.collapsing,t)});i.ejTreeGrid({expanded:n.proxy(t.expanded,t)});i.ejTreeGrid({collapsed:n.proxy(t.collapsed,t)});i.ejTreeGrid({refreshRow:n.proxy(t.refreshRow,t)});i.ejTreeGrid({cancelEditCell:n.proxy(t.cancelEditCell,t)});r.ejGanttChart({rowSelecting:n.proxy(t.rowSelecting,t)});r.ejGanttChart({rowSelected:n.proxy(t.rowSelected,t)});r.ejGanttChart({rowHover:n.proxy(t._ganttChartRowHover,t)});r.ejGanttChart({actionBegin:n.proxy(t.actionBegin,t)});r.ejGanttChart({actionComplete:n.proxy(t.chartactionComplete,t)});r.ejGanttChart({refreshRow:n.proxy(t.refreshRowData,t)});r.ejGanttChart({zooming:n.proxy(t.zoomingChart,t)});r.ejGanttChart({queryTaskbarInfo:n.proxy(t.queryTaskbarInfo,t)});r.ejGanttChart({expanding:n.proxy(t.expanding,t)});r.ejGanttChart({collapsing:n.proxy(t.collapsing,t)});r.ejGanttChart({expanded:n.proxy(t.expanded,t)});r.ejGanttChart({collapsed:n.proxy(t.collapsed,t)});r.ejGanttChart({expandAllCollapseAllRequest:n.proxy(t.expandAllCollapseAllRequest,t)});r.ejGanttChart({taskbarEditing:n.proxy(t.taskbarEditing,t)});r.ejGanttChart({taskbarEdited:n.proxy(t.taskbarEdited,t)});r.ejGanttChart({calculateEndDate:n.proxy(t.calculateEndDate,t)});r.ejGanttChart({calculateDuration:n.proxy(t.calculateDuration,t)});r.ejGanttChart({clearColumnMenu:n.proxy(t.clearColumnMenu,t)});r.ejGanttChart({deleteRow:n.proxy(t.deleteRow,t)});r.ejGanttChart({cancelEditCell:n.proxy(t.cancelEditCell,t)});f.ejSplitter({allowResizing:n.proxy(t._onResize,t)});t._on(t.element,"mousedown",t._mousedownhandler);t._enableEditingEvents()},_preventContextMenu:function(n){if(n.keyCode==93)return n.preventDefault(),n.stopPropagation(),!1},_onResize:function(t){var i=this,r=!1,u=i.splitterPosition();i._isinBeginEdit&&n("#ejTreeGrid"+i._id+"EditForm").length>0&&(i._$treegridHelper.ejTreeGrid("cancelEditCell"),i._isinBeginEdit=!1);r=u.indexOf("%")!=-1?!0:!1;r?i.splitterPosition(Math.round(t.prevPane.size/i._ganttWidth*100)+"%"):i.splitterPosition(Math.round(t.prevPane.size).toString());i._splitterPosition(i.splitterPosition());i._$treegridHelper.ejTreeGrid("refreshScroller",t.prevPane.size);i._$ganttchartHelper.ejGanttChart("refreshScroller",t.nextPane.size-1)},_searchTextFocusOut:function(t){var r=this,i=n(t.target);n(i).closest("li")&&n(i).closest("li").attr("id")==r._id+"_search"&&n(i).attr("placeholder","Search")},_searchTextFocusIn:function(t){var u=this,i=n(t.target),r=n(i).attr("placeholder");i.hasClass("e-ejinputtext")&&r&&i.removeAttr("placeholder")},clickHandler:function(t){var r=this,i=n(t.target);(r._clearContextMenu(),i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vhandlespace")||i.hasClass("e-vdown"))||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hup")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||(r._isinBeginEdit&&(i.closest("td").hasClass("e-editedcell")||i.hasClass("e-date")||i.hasClass("e-arrow")||i.hasClass("e-down-arrow")||i.closest("form#ejTreeGrid"+r._id+"EditForm").length!=0||!(n("#ejTreeGrid"+r._id+"EditForm").length>0)||(r._$treegridHelper.ejTreeGrid("saveCell"),r._isinBeginEdit=!1)),r.clearColumnMenu())},windowResize:function(){var nt,tt,it,rt,ut,v,ft,b,e,h,y;if(this.element.is(":visible")){var t=this,p="#e-ejSpliter"+this._id,c="#"+this._id+"_toolbarItems",k="#ejGanttChart"+this._id,et="#ejTreeGrid"+this._id,o=".e-ganttviewerbodyContianer",w=".e-ganttviewerheaderContainer",ot="#ejTreeGrid"+this._id,l="#ejTreeGrid"+this._id+"e-gridcontent",s=t.model.sizeSettings.width,a=t.model.sizeSettings.height,d=t.element[0].style.height,g=t.element[0].style.width,i,u,f;s&&typeof s!="number"&&s.indexOf("%")!=-1||g.indexOf("%")!=-1?(v=s?s:g,nt=n(t.element).parent().width()?n(t.element).parent().width():n(t.element).width(),i=nt/100*parseInt(v)):i=n(t.element).width();t.splitterPosition().indexOf("%")==-1?(tt=parseInt(t.splitterPosition())+7+2,t._ganttWidth=i=Math.max(i,tt)):t._ganttWidth=i;a&&typeof s!="number"&&a.indexOf("%")!=-1||d.indexOf("%")!=-1?(it=a?a:d,rt=n(t.element).parent().height()?n(t.element).parent().height():n(t.element).height(),ut=n(t.element).parent().height()?rt/100*parseInt(it):n(t.element).height(),u=ut):u=n(t.element).height();u=u-t._totalBorderHeight;i=Math.round(i);h=n(c).length?n(c).height():0;n(p).css("width",i);n(p).css("height",u-h);n(p).ejSplitter("refresh");n(c).length&&(n(c).css("width",i),n(c).children(".e-ul:first-child").css("width",i));v=n(k).width();ft=n(et).width();n(k).height(u-h);b=n(o).ejScroller("option","scrollTop");e=n(o).ejScroller("option","scrollLeft");n(o).ejScroller({width:v,height:u-h-n(w).height()-parseInt(n(w).css("border-bottom-width"))});n(o).ejScroller("refresh");f=t._$ganttchartHelper.ejGanttChart("getMaxScrollWidth");e>f&&(e=f>0?f:0);n(o).ejScroller("option","scrollTop",b);n(o).ejScroller("option","scrollLeft",e);n(ot).height(u-h);n(l).height(u-h-n(w).height()-t._totalBorderHeight);e=n(l).ejScroller("option","scrollLeft");n(l).width(ft);n(l).ejScroller("refresh");f=t._$treegridHelper.ejTreeGrid("getMaxScrollWidth");e>f&&(e=f>0?f:0);n(l).ejScroller("option","scrollLeft",e);t._$treegridHelper.ejTreeGrid("updateViewPortHeight");t._$ganttchartHelper.ejGanttChart("updateViewPortHeight");t.model.enableVirtualization&&(t._$treegridHelper.ejTreeGrid("cancelRowEditCell"),y={},y.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("processBindings",y),t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",y),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords),t._$ganttchartHelper.ejGanttChart("onScrollHelper",b));t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._updateRowHeightInConnectorLine(t._connectorLinesCollection);t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection);t.setSplitterPosition(t.splitterPosition())}},_updateRowHeightInConnectorLine:function(t){var u,i,r;if(t&&t.length&&(u=n("#ejGanttChart"+this._id).ejGanttChart("instance"),i=n("#"+u._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height,i&&!isNaN(i)))for(r=0;r<t.length;r++)t[r].RowHeight=i},setScrollTop:function(n){var t=this,i=t._$treegridHelper.ejTreeGrid("getMaxScrollHeight");t._isinBeginEdit&&t._$treegridHelper.ejTreeGrid("saveCell");(typeof n=="number"||typeof parseInt(n)=="number")&&(n=parseInt(n),n>=0&&(i>=n?t._$ganttchartHelper.ejGanttChart("onScrollHelper",n):t._$ganttchartHelper.ejGanttChart("onScrollHelper",i)))},_rightClick:function(t){t.preventDefault();var i=this,e=i.model,o=n(t.target),h=o.closest("tr"),s,c,r,u,l,f={};i._$treegridHelper.ejTreeGrid("disableTooltip");i.clearColumnMenu();n(h).hasClass("e-chartcell")||n(h).hasClass("e-ganttrowcell")?(s=i._$ganttchartHelper.ejGanttChart("getGanttChartRows"),f.target="ejTreeGrid"):(s=n(i._$treegridHelper.ejTreeGrid("getRows")),f.target="ejGanttChart");c=o.closest("tr");r=s.index(c);i.model.currentViewData=i.getCurrentViewData();u=i.model.currentViewData[r];r=i.model.updatedRecords.indexOf(u);f.data=u;f.recordIndex=r;u&&i.model.enableContextMenu?(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._updateIndentOutdentContextmenuOption(u),i._clearContextMenu(),i._contextMenuItems.length>0&&(i.model.readOnly!=!0&&i.model.editSettings.allowAdding||(i._removeContextMenuItem("Below"),i._removeContextMenuItem("Above")),i._renderContextMenu(t,r,u)),e.selectionMode=="row"&&(r!=i.model.selectedRowIndex&&i.rowSelected(f),i._$treegridHelper.ejTreeGrid("selectRows",r),i._$ganttchartHelper.ejGanttChart("selectRows",r),i.updateIndentOutdentOption(f.data)),e.selectionMode=="cell"&&(i._rowIndexOfLastSelectedCell=r,l=i._$treegridHelper.ejTreeGrid("getCellIndex",t),n(o.closest("td")).hasClass("e-chartcell")||i.selectCells([{rowIndex:r,cellIndex:l}])),e.editSettings.beginEditAction=="click"&&n("#ejTreeGrid"+i._id+"EditForm").length>0&&(i._$treegridHelper.ejTreeGrid("saveCell"),i._isinBeginEdit=!1)):i.model.flatRecords.length===0&&i.model.enableContextMenu&&(i._contextMenuItems=[],i._contextMenuItems=i._getContextMenuItems(),i._contextMenuItems.splice(5,2),i._updateIndentOutdentContextmenuOption(u),i._clearContextMenu(),i._contextMenuItems.length>0&&i._renderContextMenu(t,r,u))},_mousedownhandler:function(t){var i=n(t.target),r=this;r._clearContextMenu();(i.hasClass("e-vhandle")||i.hasClass("e-vscrollbar")||i.hasClass("e-vup")||i.hasClass("e-vdown")||i.hasClass("e-vhandlespace")||i.hasClass("e-hhandle")||i.hasClass("e-hscrollbar")||i.hasClass("e-hdown")||i.hasClass("e-hhandlespace")||i.hasClass("e-splitbar"))&&r.clearColumnMenu()},_removeContextMenuItem:function(n){var u=this,r,t=u._contextMenuItems,i;i=t.filter(function(t){if(t.menuId===n)return!0});i.length>0&&(r=t.indexOf(i[0]),t.splice(r,1))},_updateIndentOutdentContextmenuOption:function(n){var t=this,i=t.model,u=this.model.flatRecords,r=u.indexOf(n),f;t.model.readOnly==!0?(t._removeContextMenuItem("Add"),t._removeContextMenuItem("Task"),t._removeContextMenuItem("Delete"),t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")):(r===0?(t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")):r>0?n.level===0?t._removeContextMenuItem("Outdent"):(f=u[r-1],n.level-f.level==1&&t._removeContextMenuItem("Indent")):r<0&&(t._removeContextMenuItem("Task"),t._removeContextMenuItem("Delete"),t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")),i.editSettings.allowAdding||t._removeContextMenuItem("Add"),i.editSettings.allowDeleting||t._removeContextMenuItem("Delete"),i.editSettings.allowEditing||t._removeContextMenuItem("Task"),i.editSettings.allowIndent||(t._removeContextMenuItem("Indent"),t._removeContextMenuItem("Outdent")))},queryTaskbarInfo:function(n){this._trigger("queryTaskbarInfo",n)},zoomingChart:function(n){var t=this;t.reRenderChart(n.delta)},refreshRowData:function(n){var t=this,i=t._$treegridHelper.ejTreeGrid("instance");r.TreeGrid.refreshRow(i,n.index)},expanding:function(n){var t=this;if(!t._trigger("expanding",n)){if(t.model.enableVirtualization)r.TreeGrid.sendExpandCollapseRequest(t,n);else{if(t._isInExpandCollapse=!0,t._isRefreshAddedRecord){n.data.expanded=!0;t._$treegridHelper.ejTreeGrid("updateExpandStatus",n.data,!0);t._refreshChartAndGridRows();t._isRefreshAddedRecord=!1;return}r.TreeGrid.sendExpandCollapseRequest(t,n);t._isInExpandCollapse=!1}t.updateSelectedItemIndex()}},collapsing:function(t){var i=this,o=this.model,u=n("#"+i._id+"_toolbarItems"),f,e;if(!i._trigger("collapsing",t)){if(i.model.enableVirtualization)r.TreeGrid.sendExpandCollapseRequest(i,t);else{if(i._isInExpandCollapse=!0,i._isRefreshAddedRecord){t.data.expanded=!1;i._$treegridHelper.ejTreeGrid("updateExpandStatus",t.data,!1);i._refreshChartAndGridRows();i._isRefreshAddedRecord=!1;return}i._gridRows=i.getRows();r.TreeGrid.sendExpandCollapseRequest(i,t);i._isInExpandCollapse=!1}f=i.selectedItem();f&&(e=i.getExpandStatus(f),e||t.expanded?i.updateSelectedItemIndex():(i._deSelectRowItem(),o.toolbarSettings.showToolbar&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&(n(u).ejToolbar("disableItem",n(u).find(".e-deleteitem").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-indent").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-outdent").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&n(u).ejToolbar("disableItem",n(u).find(".e-edititem").parent()[0]))))}},refreshRow:function(n){var t=this;t._$ganttchartHelper.ejGanttChart("refreshRow",n.recordIndex)},_enableEditingEvents:function(){var t=this,i=t.model;t._off(n("#"+t._id+"_dialogEdit"),"click keypress","#EditDialog_"+t._id+"_Save ,#EditDialog_"+t._id+"_Cancel,#EditDialog_"+t._id+"_Delete",t._buttonClick);t._off(n("#"+t._id+"_dialogAdd"),"click keypress","#AddDialog_"+t._id+"_Save ,#AddDialog_"+t._id+"_Cancel",t._buttonClick);(i.editSettings.allowEditing||i.editSettings.editMode=="dialogTemplate"||i.toolbarSettings.showToolbar&&(i.editSettings.allowAdding&&i.toolbarSettings.toolbarItems.indexOf("add")!==-1||i.editSettings.allowEditing&&i.toolbarSettings.toolbarItems.indexOf("index")!==-1))&&(t._on(n("#"+t._id+"_dialogEdit"),"click keypress","#EditDialog_"+t._id+"_Save ,#EditDialog_"+t._id+"_Cancel,#EditDialog_"+t._id+"_Delete",t._buttonClick),t._on(n("#"+t._id+"_dialogAdd"),"click keypress","#AddDialog_"+t._id+"_Save ,#AddDialog_"+t._id+"_Cancel",t._buttonClick))},cancelEditCell:function(){var t=this;n("#ejTreeGrid"+t._id+"EditForm").length>0&&t._$treegridHelper.ejTreeGrid("cancelEditCell")},_keyPressed:function(){},_buttonClick:function(t){var e;if(t.type!="click"&&t.keyCode!==u&&t.keyCode!=13)return!0;var i=this,f=i.model;return f.editSettings.allowEditing||f.editSettings.editMode=="dialogTemplate"||f.toolbarSettings.showToolbar&&(f.editSettings.allowAdding&&f.toolbarSettings.toolbarItems.indexOf("add")!==-1||f.editSettings.allowEditing&&f.toolbarSettings.toolbarItems.indexOf("index")!==-1)?t.target.id=="EditDialog_"+i._id+"_Save"?i._sendSaveRequest("Edit")||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogEdit").ejDialog("close")):t.target.id=="EditDialog_"+i._id+"_Cancel"?(f.selectedItem.resourceInfo&&f.selectedItem._updateUnitWithWork(i),n("#"+i._id+"_dialogEdit").ejDialog("close")):t.target.id=="EditDialog_"+i._id+"_Delete"?(e=f.allowSelection!=!1||r.isNullOrUndefined(i._contextMenuSelectedIndex)?i._$treegridHelper.ejTreeGrid("deleteRow"):i._$treegridHelper.ejTreeGrid("deleteRow",null,!0,i._contextMenuSelectedIndex),e==!0||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogEdit").ejDialog("close"))):t.target.id=="AddDialog_"+i._id+"_Save"?i._sendSaveRequest("Add")||this._duplicate||this._wrongenddate||(i._isAddEditDialogSave=!0,n("#"+i._id+"_dialogAdd").ejDialog("close")):t.target.id=="AddDialog_"+i._id+"_Cancel"&&n("#"+i._id+"_dialogAdd").ejDialog("close"):i._sendCancelRequest(),!1},rowDrag:function(n){var t=this;t.model.selectedCellIndexes=[];t._trigger("rowDrag",n)},rowDragStart:function(n){var t=this;t._trigger("rowDragStart",n)},rowDragStop:function(n){var t=this;t._trigger("rowDragStop",n)},cellSelecting:function(n){var t=this,i=t.model;t._trigger("cellSelecting",n)},cellSelected:function(n){var t=this,i=t.model;t._trigger("cellSelected",n);i.selectedCellIndexes=t._$treegridHelper.ejTreeGrid("instance").model.selectedCellIndexes;t._rowIndexOfLastSelectedCell=i.selectedCellIndexes[0].rowIndex},rowSelecting:function(n){var i=this,t={},u=this.model;return i.model.rowSelecting&&u.selectionMode=="row"&&(t.recordIndex=n.recordIndex,t.previousIndex=n.previousIndex,t.previousData=u.updatedRecords[n.previousIndex],t.data=u.updatedRecords[n.recordIndex],t.previousChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",n.previousIndex),t.previousGridRow=r.TreeGrid.getRowByIndex(this,n.previousIndex),t.targetChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",n.recordIndex),t.targetGridRow=r.TreeGrid.getRowByIndex(this,n.recordIndex),i._trigger("rowSelecting",t))?!1:!0},rowSelected:function(t){var i=this,e=this.model,u=n("#"+i._id+"_toolbarItems"),h,o,s,f;e.allowSelection&&(t.target=="ejTreeGrid"&&i._$ganttchartHelper.ejGanttChart("selectRows",t.recordIndex),t.target=="ejGanttChart"&&i._$treegridHelper.ejTreeGrid("selectRows",t.recordIndex));h=t.recordIndex;this.selectedItem(t.data);this.selectedRowIndex(h);i.model.toolbarSettings.showToolbar&&t.requestType!="rowDragAndDrop"&&(i.model.readOnly==!0?(o=[],o.push(n(u).find(".e-deleteitem").parent()[0]),o.push(n(u).find(".e-addnewitem").parent()[0]),o.push(n(u).find(".e-edititem").parent()[0]),n(u).ejToolbar("disableItem",o)):((i.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1||i.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1)&&i.model.allowSelection&&i.updateIndentOutdentOption(t.data),s=[],i.model.editSettings.allowDeleting&&i.model.allowSelection&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&s.push(n(u).find(".e-deleteitem").parent()[0]),i.model.editSettings.allowAdding&&i.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&s.push(n(u).find(".e-addnewitem").parent()[0]),i.model.editSettings.allowEditing&&i.model.allowSelection&&e.editSettings.beginEditAction!="click"&&i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&s.push(n(u).find(".e-edititem").parent()[0]),n(u).ejToolbar("enableItem",s)));f={};f.recordIndex=t.recordIndex;data=n.extend({},e.updatedRecords[t.recordIndex]);delete data.childRecords;delete data.parentItem;f.data=data;f.targetChartRow=i._$ganttchartHelper.ejGanttChart("getRowByIndex",t.recordIndex);f.targetGridRow=r.TreeGrid.getRowByIndex(this,t.recordIndex);e.allowSelection&&e.selectionMode=="row"&&i._trigger("rowSelected",f)},_treeGridRowHover:function(n){var t=this;n.reason=="mouseenter"?t._$ganttchartHelper.ejGanttChart("addRowHover",n.index):n.reason=="mouseleave"&&t._$ganttchartHelper.ejGanttChart("removeRowHover")},updateIndentOutdentOption:function(t){var r=this,e=r.model.flatRecords,o=e.indexOf(t),s,i=n("#"+r._id+"_toolbarItems"),u=n(i).find(".e-indent").parent()[0],f=n(i).find(".e-outdent").parent()[0];o===0||r.model.editSettings.allowIndent==!1||r.model.readOnly==!0?(u&&n(i).ejToolbar("disableItem",u),f&&n(i).ejToolbar("disableItem",f)):t.level===0&&r.model.editSettings.allowIndent==!0?(u&&n(i).ejToolbar("enableItem",u),f&&n(i).ejToolbar("disableItem",f)):(s=e[o-1],t.level-s.level==1&&r.model.editSettings.allowIndent==!0&&r.selectedRowIndex()!=-1?(f&&n(i).ejToolbar("enableItem",f),u&&n(i).ejToolbar("disableItem",u)):r.model.editSettings.allowIndent==!0&&r.selectedRowIndex()!=-1&&(u&&n(i).ejToolbar("enableItem",u),f&&n(i).ejToolbar("enableItem",f)))},_ganttChartRowHover:function(n){var t=this;n.reason=="mouseenter"?t._$treegridHelper.ejTreeGrid("addRowHover",n.index):n.reason=="mouseleave"&&t._$treegridHelper.ejTreeGrid("removeRowHover")},_removeChildRecordsPredecessor:function(n){var i=this,r,t;if(n.hasChildRecords)for(r=n.childRecords.length,t=0,t;t<r;t++)n.childRecords[t].predecessor&&i._removePredecessor(n.childRecords[t].predecessor,n.childRecords[t]),n.childRecords[t].hasChildRecords&&i._removeChildRecordsPredecessor(n.childRecords[t])},getExpandedRecordCount:function(n,t){var i,u=this,r;if(!n.hasChildRecords)return 0;for(r=0;r<n.childRecords.length;r++)i=n.childRecords[r],u.getExpandStatus(i)&&t++,i.hasChildRecords&&(t=u.getExpandedRecordCount(i,t));return t},_updateExpandStatus:function(){for(var i=this,t=this.model.flatRecords,r=t.length,u,n=0;n<r;n++)u=t[n].isExpanded,i.getExpandStatus(t[n])!==t[n].isExpanded&&(t[n].isExpanded=i.getExpandStatus(t[n]),t[n].isExpanded?i._totalCollapseRecordCount--:i._totalCollapseRecordCount++)},actionComplete:function(n){var t=this,i=t.model,o=-1,h,c,f,e,s;if(t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t._gridRows=t.getRows(),t._ganttChartRows=t.getGanttChartRows(),t._totalCollapseRecordCount=t._$treegridHelper.ejTreeGrid("getCollapsedRecordCount"),(n.requestType==="searching"||n.requestType==="sorting")&&(t._isRefreshAddedRecord=!1,t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords,t._totalCollapseRecordCount),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection(),this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)),n.requestType=="sorting"&&t._deSelectRowItem(),n.requestType==="delete"){if(t._isRefreshAddedRecord=!1,this.dataSource(t._$treegridHelper.ejTreeGrid("getDataSource")),t._isDataManagerUpdate&&(this._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),t.model.flatRecords=t._$treegridHelper.ejTreeGrid("getFlatRecords"),t.model.ids=t._$treegridHelper.ejTreeGrid("getUpdatedIds"),t.model.updatedRecords=t.getUpdatedRecords(),i.selectedItem=null,this.selectedRowIndex(-1),h=0,c=0,i.parentRecords.indexOf(n.data)!==-1&&i.parentRecords.splice(i.parentRecords.indexOf(n.data),1),n.data.hasChildRecords&&t._removeChildRecordsPredecessor(n.data),n.isDragAndDropDelete||n.data.predecessor&&t._removePredecessor(n.data.predecessor,n.data),n.data.parentItem&&(parentRecord=n.data.parentItem,n.data.parentItem.childRecords.length>0?n.data.parentItem.isAutoSchedule?t._updateParentItem(n.data):n.data.parentItem.isAutoSchedule||t._updateManualParentItem(n.data):(parentRecord.expanded=!1,parentRecord.hasChildRecords=!1,t.refreshGanttRecord(parentRecord))),n.isDragAndDropDelete)return;t._isValidationEnabled=!1;t.model.predecessorMapping&&(t._connectorlineIds=[],t._connectorLinesCollection=[],t._predecessorsCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection());this.isCriticalPathEnable==!0&&this.showCriticalPath(!0,!0);t._$ganttchartHelper.ejGanttChart("refreshHelper",t.getCurrentViewData(),t.getUpdatedRecords(),t._totalCollapseRecordCount);t._updateToolbarOptions();t.updateAltRow(t.getUpdatedRecords(),0,1);this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)}if(n.requestType==="selection"&&t._$ganttchartHelper.ejGanttChart("selectRows",n.recordIndex),n.requestType==="rowHover"&&t._$ganttchartHelper.ejGanttChart("addRowHover",n.index),n.requestType==="scroll"&&t._$ganttchartHelper.ejGanttChart("onScrollHelper",n.delta),n.requestType=="dragAndDrop"&&(t._isRefreshAddedRecord=!1,this.dataSource(t._$treegridHelper.ejTreeGrid("getDataSource")),t._isDataManagerUpdate&&(this._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),i.flatRecords=t._$treegridHelper.ejTreeGrid("getFlatRecords"),i.ids=t._$treegridHelper.ejTreeGrid("getUpdatedIds"),i.updatedRecords=t.getUpdatedRecords(),f=n.draggedRow.parentItem,n.droppedPosition=="insertAsChild"&&f&&(f.taskType=r.Gantt.TaskType.FixedDuration,f.effortDriven="false"),i.predecessorMapping&&(n.droppedPosition=="insertAsChild"&&(f.predecessor&&t._removePredecessor(f.predecessor,f),f.item[i.predecessorMapping]=u,f.predecessorsName=u,f.predecessor=u),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection(),t._isValidationEnabled=!0),n.draggedRow.parentItem&&n.draggedRow.parentItem.isAutoSchedule?t._updateParentItem(n.draggedRow):n.draggedRow.parentItem&&!n.draggedRow.parentItem.isAutoSchedule&&t._updateManualParentItem(n.draggedRow),this.isCriticalPathEnable==!0&&this.showCriticalPath(!0,!0),n.draggedRow&&t._$ganttchartHelper.ejGanttChart("refreshHelper",t.getCurrentViewData(),t.getUpdatedRecords(),t._totalCollapseRecordCount),this.isCriticalPathEnable==!0&&t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId)),n.requestType==="save"&&(n._cAddedRecord?(i.enableWBS&&i.enableWBSPredecessor&&i.predecessorMapping&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n._cAddedRecord),t._renderAddedRow(n.index,n._cAddedRecord),n._cAddedRecord.parentItem&&n._cAddedRecord.parentItem.isAutoSchedule?t._updateParentItem(n._cAddedRecord):n._cAddedRecord.parentItem&&!n._cAddedRecord.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cAddedRecord),r.TreeGrid.updateAltRow(t,i.currentViewData[0],0,0),t.selectRows(i.updatedRecords.indexOf(n._cAddedRecord)),o=t.selectedRowIndex(),i.enableVirtualization||(e={},e.index=e.recordIndex=i.currentViewData.indexOf(n._cAddedRecord),t.refreshRowData(e),t.refreshRow(e))):n._cModifiedData&&(n._cModifiedData.hasChildRecords&&n._cModifiedData.isAutoSchedule?(n._cModifiedData.startDate=t._checkStartDate(n._cModifiedData.manualStartDate,n._cModifiedData),n._cModifiedData.left=n._cModifiedData._calculateManualLeft(this),n._cModifiedData.width=n._cModifiedData._calculateManualWidth(this),n._cModifiedData.progressWidth=n._cModifiedData._getProgressWidth(n._cModifiedData.width,n._cModifiedData.status),n._cModifiedData.endDate=n._cModifiedData.manualEndDate,n._cModifiedData._calculateDuration(this)):n._cModifiedData.hasChildRecords&&!n._cModifiedData.isAutoSchedule?(n._cModifiedData.left=n._cModifiedData._calculateLeft(this),n._cModifiedData.width=n._cModifiedData._calculateWidth(this),n._cModifiedData._calculateDuration(this),n._cModifiedData.manualStartDate=n._cModifiedData.startDate,n._cModifiedData.manualEndDate=n._cModifiedData.endDate,t._updateManualParentItem(n._cModifiedData,null,!0)):(n._cModifiedData.startDate=t._checkStartDate(n._cModifiedData.startDate,n._cModifiedData),n._cModifiedData.endDate=t._getEndDate(n._cModifiedData.startDate,n._cModifiedData.duration,n._cModifiedData.durationUnit,n._cModifiedData),n._cModifiedData.left=n._cModifiedData._calculateLeft(this),n._cModifiedData.width=n._cModifiedData._calculateWidth(this),n._cModifiedData.progressWidth=n._cModifiedData._getProgressWidth(n._cModifiedData.width,n._cModifiedData.status)),i.enableWBS&&i.enableWBSPredecessor&&i.predecessorMapping&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n._cModifiedData),t.refreshGanttRecord(n._cModifiedData),n._cModifiedData.parentItem&&n._cModifiedData.parentItem.isAutoSchedule?t._updateParentItem(n._cModifiedData):n._cModifiedData.parentItem&&!n._cModifiedData.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cModifiedData),n._cModifiedData.predecessor&&n.previousValue&&t._removeConnectorLine(n.previousValue,n._cModifiedData)),t.model.predecessorMapping&&(t._isValidationEnabled=n._cModifiedData&&n._cModifiedData.predecessor?!0:!1,n._cAddedRecord?(n._cAddedRecord.predecessor&&(t._validatePredecessorDates(n._cAddedRecord),t._addConnectorLine(n._cAddedRecord)),t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection()):n._cModifiedData&&(n.previousValue&&t._removeConnectorLine(n.previousValue,n._cModifiedData),t._addConnectorLine(n._cModifiedData),n._cModifiedData.predecessor&&(t._isUpdateOffset&&(t._editedTaskBarItem=n._cModifiedData),t._isMileStoneEdited=n._cModifiedData.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._validatePredecessor(n._cModifiedData,n.previousValue),t._isUpdateOffset&&(t._editedTaskBarItem=null),t._updatedConnectorLineCollection.length>0&&t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection)),n._cModifiedData.parentItem&&n._cModifiedData.parentItem.isAutoSchedule?t._updateParentItem(n._cModifiedData):n._cModifiedData.parentItem&&!n._cModifiedData.parentItem.isAutoSchedule&&t._updateManualParentItem(n._cModifiedData))),this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))),n.requestType==="validatePredecessor"){s=t._editedPredecessorValidation(n);n.result=s;return}t._ganttActionCompleteTrigger(n);o>=0&&t.focusOnTask(o)},focusOnTask:function(n){var r=this,h=r.model,o=r.element.find(".e-ganttviewerbodyContianer"),u=o.ejScroller("instance"),f=h.updatedRecords[n].left,s=u.model.width,i=u.model.scrollLeft,e=u._hScrollbar,t;e&&(e.model.maximum<i&&(i=e.model.maximum),(i>f||i+s<f)&&(t=f-s/2,t=t<0?0:t,o.ejScroller("scrollX",t,!0)));r._$ganttchartHelper.ejGanttChart("updateScrollBar")},calculateEndDate:function(n){var t=this,i=this._getEndDate(t._checkStartDate(n.startDate,n.record),n.duration,n.durationUnit,n.record);t._$ganttchartHelper.ejGanttChart("updateEditedRecordEndDate",t._checkEndDate(i,n.record))},calculateDuration:function(n){var t=this,i=this._getDuration(t._checkStartDate(n.startDate,n.record),t._checkEndDate(n.endDate,n.record),n.durationUnit,n.isAutoSchedule);t._$ganttchartHelper.ejGanttChart("updateEditedRecordDuration",i)},expandAllCollapseAllRequest:function(t){var r=this,i=n(r.element),u=i.ejGantt("instance"),f=i.attr("id");u._toolbarOperation(f+"_"+t.requestType)},chartactionComplete:function(n){var t=this,f,o,i,s,e;t.model.updatedRecords=t.getUpdatedRecords();t.model.currentViewData=t.getCurrentViewData();n.requestType==="updateConnectors"&&t.model.predecessorMapping&&(f=n.ganttRecord,t._isMileStoneEdited=f.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._editedTaskBarItem=f,t._validatePredecessor(f),t._updatedConnectorLineCollection.length>0&&t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),t._editedTaskBarItem=null);n.requestType==="rowHover"&&t._$treegridHelper.ejTreeGrid("addRowHover",n.index);n.requestType==="scroll"&&(t._isTreeGridRendered=!1,t._isGanttChartRendered=!1,n.vscrollExsist&&n.delta!==u&&t._$treegridHelper.ejTreeGrid("onScrollHelper",n.delta),t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t.model.enableVirtualization&&t.model.predecessorMapping&&(t._connectorLinesCollection.length>0&&t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._createConnectorLinesCollection()),t._isTreeGridRendered=!0,t._isGanttChartRendered=!0);n.requestType==="selection"&&t._$treegridHelper.ejTreeGrid("selectRows",n.recordIndex);n.requestType==="validatePredecessor"&&(o=t._editedPredecessorValidation(n),n.predecessorValidation=o);n.requestType==="drawConnectorLine"&&(i=n.toItem._calculatePredecessor(n.predecessor,this._durationUnitEditText,this.model.durationUnit),n.toItem.item[t.model.predecessorMapping]=n.predecessorString[0],n.toItem.predecessorsName=n.toItem.item[t.model.predecessorMapping],model.enableWBS&&model.enableWBSPredecessor&&t._$treegridHelper.ejTreeGrid("updateWBSPredecessor",n.toItem),n.fromItem.predecessor?n.fromItem.predecessor.push(i[0]):n.fromItem.predecessor=i,n.toItem.predecessor?n.toItem.predecessor.push(i[0]):(n.toItem.predecessor=[],n.toItem.predecessor.push(i[0])),t._isMileStoneEdited=n.toItem.isMilestone,t._updatedConnectorLineCollection=[],t._connectorlineIds=[],t._isValidationEnabled=n.toItem.isAutoSchedule||t.model.validateManualTasksOnLinking?!0:!1,t._validatePredecessor(n.toItem),t._updatedConnectorLineCollection.length>0&&t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection),n.toItem.isAutoSchedule||t.model.validateManualTasksOnLinking||(s=t._$treegridHelper.ejTreeGrid("instance"),r.TreeGrid.refreshRow(s,t.model.currentViewData.indexOf(n.toItem))),e={},e.data=n.toItem,t._updateScheduleDatesOnEditing(e),this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0)));t._ganttActionCompleteTrigger(n)},hideColumn:function(n){var t=this;t._$treegridHelper.ejTreeGrid("hideColumn",n)},showColumn:function(n){var t=this;t._$treegridHelper.ejTreeGrid("showColumn",n)},clearColumnMenu:function(){var n=this;n._$treegridHelper.ejTreeGrid("clearColumnMenu")},deleteRow:function(){var n=this;n._$treegridHelper.ejTreeGrid("deleteRow")},taskbarEditing:function(n){this._trigger("taskbarEditing",n)},setInitialData:function(){this._setInitialData()},sortColumn:function(n,t){var i=this;i._$treegridHelper.ejTreeGrid("sortColumn",n,t)},clearSorting:function(){var n=this,t=n.model;n._$treegridHelper.ejTreeGrid("clearSorting")},"export":function(t,i,f){var c=this,e=c.model,et={action:t,method:"post","data-ajax":"false"},h,o,v,s,tt,it,rt,ut,ft;n("form#"+c._id+"export").remove();var l=r.buildTag("form#"+c._id+"export","",null,et),a=c.ignoreOnExport,nt=a.length;if(!f){var y=e.updatedRecords,p=e.currentViewData,w=e.flatRecords,b=e.parentRecords,k=e.selectedItem,d=e.selectedItems,g=e.workUnit;for(c._$treegridHelper.ejTreeGrid("contextMenuOperations","Cancel"),delete e.updatedRecords,delete e.currentViewData,delete e.flatRecords,delete e.parentRecords,delete e.selectedItem,delete e.selectedItems,delete e.workUnit,h=n.extend(!0,{},e),e.updatedRecords=y,e.currentViewData=p,e.flatRecords=w,e.parentRecords=b,e.selectedItem=k,e.selectedItems=d,e.workUnit=g,o=h.columns,v=o.length,s=0;s<v;s++)if(h.columns[s].editType!=u)switch(o[s].editType){case"stringedit":o[s].editType="string";break;case"numericedit":o[s].editType="numeric";break;case"dropdownedit":o[s].editType="dropdown";break;case"booleanedit":o[s].editType="boolean"}if(this.ignoreOnExport)for(s=0;s<nt;s++)delete h[a[s]]}return r.raiseWebFormsServerEvents?(tt={model:h,originalEventType:i},it={model:JSON.stringify(h)},r.raiseWebFormsServerEvents(i,tt,it)):(rt={},f?n("body").find(".e-gantt").each(function(t,i){var c=n(i).data("ejGantt"),f,h,s,tt,it;if(!r.isNullOrUndefined(c)){for(f=c.model,y=f.updatedRecords,w=f.flatRecords,p=f.currentViewData,b=f.parentRecords,k=f.selectedItem,d=f.selectedItems,g=e.workUnit,delete f.updatedRecords,delete f.flatRecords,delete f.currentViewData,delete f.parentRecords,delete f.selectedItem,delete f.selectedItems,delete f.workUnit,h=JSON.parse(JSON.stringify(f)),f.updatedRecords=y,f.flatRecords=w,f.currentViewData=p,f.parentRecords=b,f.selectedItem=k,f.selectedItems=d,f.workUnit=g,o=h.columns,v=o.length,s=0;s<v;s++)if(o[s].editType!=u)switch(o[s].editType){case"stringedit":o[s].editType="string";break;case"numericedit":o[s].editType="numeric";break;case"dropdownedit":o[s].editType="dropdown";break;case"booleanedit":o[s].editType="boolean"}if(a){for(s=0;s<nt;s++)delete h[a[s]];rt[t]=JSON.stringify(h);tt={name:"GanttModel",type:"hidden",value:JSON.stringify(h)};it=r.buildTag("input","",null,tt);l.append(it)}}}):(ut={name:"GanttModel",type:"hidden",value:JSON.stringify(h)},ft=r.buildTag("input","",null,ut),l.append(ft),l.append(this)),n("body").append(l),l.submit()),!0},_refreshParent:function(n){this.refreshGanttRecord(n);n.parentItem&&this._refreshParent(n.parentItem)},taskbarEdited:function(n){var i=this,t=n.data,s=i.model,l=new Date(i._projectStartDate),f,u,h,c,e=s.scheduleHeaderSettings.scheduleHeaderType,o=r.Gantt.ScheduleHeaderType,nt=r.Gantt.DurationUnit,g,b,k,d,v,a;if(i._isValidationEnabled=!1,n.dragging){if(v="dragging",n.previousData.left!==t.left){if(f=t.left%i._perDayWidth,h=(t.left-f)/i._perDayWidth,u=f/i._perDayWidth,(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.left=t.left-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.left=t.left-f+a):u>.75&&(h+=1,u=0,t.left=t.left-f+i._perDayWidth)),c=e==o.Day||e==o.Hour?24:i._secondsPerDay/3600,c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);l=t._startDateUpdate(l,h,w,i._workingTimeRanges,e);t.startDate=i._checkStartDate(l,t);s.startDateMapping&&(t.item[s.startDateMapping]=t.startDate);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._isValidationEnabled=!0}}else if(n.rightResizing){if(v="Resizing",n.previousData.width!==t.width){if(e==o.Day||e==o.Hour?(g=new Date(t.startDate),b=new Date(t.startDate),b.setHours(0,0,0,0),k=g.getTime()-b.getTime(),d=k>0?t.width+k/864e5*i._perDayWidth:t.width,f=d%i._perDayWidth,h=(d-f)/i._perDayWidth,c=24):(f=t.width%i._perDayWidth,h=(t.width-f)/i._perDayWidth,c=i._secondsPerDay/3600),u=f/i._perDayWidth,startDate=i._getDateFromFormat(t.startDate),(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.width=t.width-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.width=t.width-f+a):u>.75&&(h+=1,u=0,t.width=t.width-f+i._perDayWidth)),c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);endDate=t._endDateUpdate(startDate,h-1,w,i._workingTimeRanges,e);t.endDate=i._checkEndDate(endDate,t);s.endDateMapping&&(t.item[s.endDateMapping]=t.endDate);t._calculateDuration(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._updatedColumn="duration";i._updateResourceRelatedFields(t)}}else if(n.leftResizing&&(v="Resizing",n.previousData.left!==t.left)){if(f=t.left%i._perDayWidth,h=(t.left-f)/i._perDayWidth,u=f/i._perDayWidth,(e==o.Week||e==o.Month||e==o.Year)&&(u<=.25?(u=0,t.left=t.left-f):u>.25&&u<=.75?(u=.5,a=u*i._perDayWidth,t.left=t.left-f+a):u>.75&&(h+=1,u=0,t.left=t.left-f+i._perDayWidth)),c=e==o.Day||e==o.Hour?24:i._secondsPerDay/3600,c&&u>0)var y=1/c,p=u/y,w=Math.round(p*60);l=t._startDateUpdate(l,h,w,i._workingTimeRanges,e);t.startDate=i._checkStartDate(l,t);s.startDateMapping&&(t.item[s.startDateMapping]=t.startDate);t.endDate=i._checkEndDate(t.endDate,t);t.isAutoSchedule&&s.includeWeekend==!1&&(e==o.Hour||e==o.Day)&&t._calculateEndDate(this);t._calculateDuration(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.hasChildRecords||(t.progressWidth=t._getProgressWidth(t.width,t.status));i._updatedColumn="duration";i._updateResourceRelatedFields(t)}n.progressResizing?n.previousData.status!=n.data.status&&(t.status=t._getProgressPercent(t.width,t.progressWidth),t.parentItem&&t._updateParentProgress(t.parentItem,s.progressMapping),i._refreshParent(t)):(i._isValidationEnabled=!0,i._updateEditedGanttRecord(t),t.predecessor&&(i._isMileStoneEdited=t.isMilestone,i._updatedConnectorLineCollection=[],i._connectorlineIds=[],i._editedTaskBarItem=t,s.enablePredecessorValidation?i._validatePredecessor(t):i._validatePredecessorOnEditing(t),i._updatedConnectorLineCollection.length>0&&i._$ganttchartHelper.ejGanttChart("appendConnectorLine",i._updatedConnectorLineCollection)),i._editedTaskBarItem=null,t.isAutoSchedule||!t.hasChildRecords||n.isChildren||n.rightResizing||i._validateAutoChildRecords(n),t.parentItem&&t.parentItem.isAutoSchedule?i._updateParentItem(t,v):t.parentItem&&!t.parentItem.isAutoSchedule&&i._updateManualParentItem(t,v));i.refreshGanttRecord(t);i._trigger("taskbarEdited",n);!n.cancel&&(n.leftResizing||n.rightResizing||n.dragging)&&i._isValidationEnabled&&i._updateScheduleDatesOnEditing(n);this.isCriticalPathEnable==!0&&(i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_validatePredecessorOnEditing:function(n,t){var i=this,r=i.model,s=n.taskId.toString(),r=this.model,h=n.predecessor,u=r.flatRecords,f=r.ids,c=null,o=h.filter(function(n){return n.to===s}),l=h.filter(function(n){return n.from===s}),a=o.length,v,e;for(count=0;count<a;count++)predecessor=o[count],isOffsetChanged=i._isOffsetChange(predecessor,c,count),parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],t&&(i._validateChildGanttRecord(parentGanttRecord,record,predecessor,r.enablePredecessorValidation,isOffsetChanged),t=!1),connectorLineId="parent"+parentGanttRecord.taskId+"child"+record.taskId,i._$ganttchartHelper&&i._$ganttchartHelper.ejGanttChart("removeConnectorline",connectorLineId);for(count=0;count<a;count++)(predecessor=o[count],parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],r.enableVirtualization!==!1||parentGanttRecord.isExpanded!==!1&&record.isExpanded!=!1)&&(connectorLineObject=i._createConnectorLineObject(parentGanttRecord,record,predecessor),connectorLineObject&&(i._connectorlineIds.length>0&&i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)==-1?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.length==0?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)!=-1&&(e=i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId),i._updatedConnectorLineCollection[e]=connectorLineObject)));for(v=l.length,count=0;count<v;count++)(predecessor=l[count],parentGanttRecord=u[f.indexOf(predecessor.from)],record=u[f.indexOf(predecessor.to)],connectorLineId="parent"+parentGanttRecord.taskId+"child"+record.taskId,isOffsetChanged=i._isOffsetChange(predecessor,c,count),i._$ganttchartHelper&&i._$ganttchartHelper.ejGanttChart("removeConnectorline",connectorLineId),t&&(i._validateChildGanttRecord(parentGanttRecord,record,predecessor,r.enablePredecessorValidation,isOffsetChanged),t=!1),r.enableVirtualization!==!1||parentGanttRecord.isExpanded!==!1&&record.isExpanded!=!1)&&(connectorLineObject=i._createConnectorLineObject(parentGanttRecord,record,predecessor),connectorLineObject&&(i._connectorlineIds.length>0&&i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)==-1?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.length==0?(i._updatedConnectorLineCollection.push(connectorLineObject),i._connectorlineIds.push(connectorLineObject.ConnectorLineId)):i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId)!=-1&&(e=i._connectorlineIds.indexOf(connectorLineObject.ConnectorLineId),i._updatedConnectorLineCollection[e]=connectorLineObject)))},_validateAutoChildRecords:function(t){for(var e=this,f=t.data,o=t.previousData,r=f.childRecords,u={},s=f.left-o.left,i=0;i<r.length;i++)r[i].isAutoSchedule&&!r[i].hasChildRecords&&(u.previousData=n.extend({},r[i]),r[i].left+=s,u.data=r[i],u.dragging=!0,t.isChildren=!0,e.taskbarEdited(u))},actionBegin:function(n){var t=this;t._trigger("actionBegin",n)||n.requestType==="beginedit"&&t._sendEditRequest()},_ganttActionCompleteTrigger:function(n){this._trigger("actionComplete",n);n.cancel||n.requestType!=="save"||(n._cModifiedData&&(n.data=n._cModifiedData),n._cAddedRecord&&(n.data=n._cAddedRecord),this._updateScheduleDatesOnEditing(n))},_queryCellInfo:function(n){this._trigger("queryCellInfo",n)},_beginEdit:function(t){var i=this,r=n("#"+i._id+"_toolbarItems"),u;if(!i._trigger("beginEdit",t)&&(i._isinBeginEdit=!0,i.model.toolbarSettings.showToolbar)){var f=[],e=n(r).find(".e-cancel").parent()[0],o=n(r).find(".e-saveitem").parent()[0];e&&f.push(e);o&&f.push(o);n(r).ejToolbar("enableItem",f);u=[];i.model.editSettings.allowAdding&&i.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&u.push(n(r).find(".e-addnewitem").parent()[0]);i.model.editSettings.allowEditing&&i.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&u.push(n(r).find(".e-edititem").parent()[0]);i.model.editSettings.allowDeleting&&i.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&u.push(n(r).find(".e-deleteitem").parent()[0]);n(r).ejToolbar("disableItem",u)}},_endEdit:function(t){var i=this,s=this.model,e=n("#"+i._id+"_toolbarItems"),u,r,o,f;i._trigger("endEdit",t)?(u="",t.data[t.columnName]=t.previousValue,t.columnName==="predecessor"?(u=i._predecessorToString(t.data.predecessor,t.data),t.data.item[t.columnObject.mappingName]=u,t.data.predecessorsName=u):(t.data.item[t.columnObject.mappingName]=t.previousValue,t.columnName==="resourceInfo"&&(i._updateResourceName(t.data),i._updateResourceRelatedFields(t.data)))):(i._updatedColumn=t.columnName,t.columnName=="taskType"&&t.value=="fixedWork"&&(t.data.effortDriven="true"),(t.columnName==="duration"||t.columnName=="work")&&i._updateResourceRelatedFields(t.data),t.columnName==="resourceInfo"&&(i._updateResourceName(t.data),i._updateResourceRelatedFields(t.data),i._isDurationUpdated==!1&&(r=t.data,o=t.data.hasChildRecords?!0:!1,o&&r.isAutoSchedule?i._updateParentItem(r,null,!0):o&&!r.isAutoSchedule&&i._updateManualParentItem(r,null,!0),r.parentItem&&r.parentItem.isAutoSchedule?i._updateParentItem(r,null,!1):r.parentItem&&!r.parentItem.isAutoSchedule&&i._updateManualParentItem(r,null,!1))),(t.isModified||i._isDurationUpdated)&&(i.model.currentViewData=i._$treegridHelper.ejTreeGrid("getCurrentViewData"),i._isValidationEnabled=t.data.isAutoSchedule||s.validateManualTasksOnLinking?!0:!1,i._updateEditedGanttRecords(t)));i._isDurationUpdated=!1;i._isinBeginEdit=!1;i.refreshGanttRecord(t.data);delete t.isModified;i.model.toolbarSettings.showToolbar&&(f=[],i.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&f.push(n(e).find(".e-cancel").parent()[0]),i.model.toolbarSettings.toolbarItems.indexOf("update")!==-1&&f.push(n(e).find(".e-saveitem").parent()[0]),n(e).ejToolbar("disableItem",f));t.cancel||t.columnName!=="startDate"&&t.columnName!=="endDate"&&t.columnName!=="duration"&&t.columnName!=="baselineStartDate"&&t.columnName!=="baselineEndDate"||i._updateScheduleDatesOnEditing(t);t.cancel||t.columnName!=="taskMode"&&t.columnName!=="startDate"&&t.columnName!=="endDate"&&t.columnName!=="duration"&&t.columnName!=="status"&&t.columnName!=="predecessor"||this.isCriticalPathEnable==!0&&(i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_updateScheduleDatesOnEditing:function(n){var i=this,t=this.model,o=i._getDateFromFormat(n.data.startDate),c=i._getDateFromFormat(n.data.endDate),s=i._projectStartDate,l=i._getDateFromFormat(t.scheduleEndDate),v,y,p,w,u=!1,r=t.scheduleStartDate,b,f=t.scheduleEndDate,e;if(n.data.hasChildRecords&&!n.data.isAutoSchedule&&(o=i._getDateFromFormat(n.data.manualStartDate),c=i._getDateFromFormat(n.data.manualEndDate)),i._calculateDatesForScheduleCheck(o),t.predecessorMapping)e={},e.onEditing=!0,i._calculateScheduleDates(e),i._calculateDatesForScheduleCheck(e.minStartDate),e.minStartDate.getTime()<s&&(r=n.data._getFormatedDate(e.minStartDate,t.dateFormat,t.locale),u=!0),e.maxEndDate.getTime()>l&&(f=n.data._getFormatedDate(e.maxEndDate,t.dateFormat,t.locale),u=!0),u&&i.updateScheduleDates(r,f);else{if(o.getTime()>=s.getTime()&&o.getTime()<=l.getTime()||(o.getTime()<s.getTime()?(v=o,s=o):(y=i._getDateFromFormat(n.data.startDate),l=i._getDateFromFormat(n.data.startDate))),c.getTime()>=s.getTime()&&c.getTime()<=l.getTime()||(c.getTime()<s.getTime()?v=c:y=c),y&&(u=!0,f=n.data._getFormatedDate(y,t.dateFormat,t.locale)),v&&(u=!0,r=n.data._getFormatedDate(v,t.dateFormat,t.locale)),t.renderBaseline&&n.data.baselineStartDate&&n.data.baselineEndDate){var h=i._getDateFromFormat(n.data.baselineStartDate),a=i._getDateFromFormat(n.data.baselineEndDate),r=i._getDateFromFormat(r),f=i._getDateFromFormat(f);h.getTime()>=r.getTime()&&h.getTime()<=f.getTime()||(h.getTime()<r.getTime()?(p=h,s=h):(w=h,l=h));a.getTime()>=r.getTime()&&a.getTime()<=f.getTime()||(a.getTime()<r.getTime()?p=a:w=a)}w&&(u=!0,f=n.data._getFormatedDate(w,t.dateFormat,t.locale));p&&(u=!0,r=n.data._getFormatedDate(p,t.dateFormat,t.locale));u&&(b=i._updateScheduleDatesByTaskLables(i._getDateFromFormat(r),i._getDateFromFormat(f)),i.updateScheduleDates(n.data._getFormatedDate(b.minStartDate,t.dateFormat,t.locale),n.data._getFormatedDate(b.maxEndDate,t.dateFormat,t.locale)))}},_calculateDatesForScheduleCheck:function(n){var f=this,u=this.model,t=u.scheduleHeaderSettings.scheduleHeaderType,i=r.Gantt.ScheduleHeaderType;t==i.Week&&n.setDate(n.getDate()-3);t==i.Year&&n.setDate(n.getDate()-5);t==i.Month&&n.setDate(n.getDate()-3);t==i.Day&&n.setHours(n.getHours()-2);t==i.Hour&&n.setMinutes(n.getMinutes()-5)},_updateScheduleDatesByToolBar:function(t){var i=this,f=this.model,u=t==="prevTimeSpan"?i._projectStartDate:i._getDateFromFormat(i.model.scheduleStartDate);endDate=i._getDateFromFormat(i.model.scheduleEndDate);chartObject=n("#ejGanttChart"+i._id).ejGanttChart("instance");scheduleHeaderType=f.scheduleHeaderSettings.scheduleHeaderType;scheduleHeaderValue=r.Gantt.ScheduleHeaderType;maxScrollWidth=0;scheduleHeaderType==scheduleHeaderValue.Week&&(t==="prevTimeSpan"?u.setDate(u.getDate()-6):endDate.setDate(endDate.getDate()+7));scheduleHeaderType==scheduleHeaderValue.Year&&(t==="prevTimeSpan"?u.setDate(u.getDate()-360):endDate.setDate(endDate.getDate()+365));scheduleHeaderType==scheduleHeaderValue.Month&&(t==="prevTimeSpan"?u.setMonth(u.getMonth()-1):endDate.setDate(endDate.getDate()+30));scheduleHeaderType==scheduleHeaderValue.Day&&(t==="prevTimeSpan"?u.setDate(u.getDate()-1):endDate.setDate(endDate.getDate()+1));scheduleHeaderType==scheduleHeaderValue.Hour&&(t==="prevTimeSpan"?u.setHours(u.getHours()-1):endDate.setHours(endDate.getHours()+1));t==="prevTimeSpan"?(i.updateScheduleDates(i._getFormatedDate(u,f.dateFormat,f.locale),i._getFormatedDate(endDate,f.dateFormat,f.locale)),chartObject._$bodyContainer.ejScroller("scrollX",0,!0),i.isCriticalPathEnable==!0&&f.predecessorMapping&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",i.criticalPathCollection,i.detailPredecessorCollection,!0,i.collectionTaskId)):t==="nextTimeSpan"&&(i.updateScheduleDates(i._getFormatedDate(u,f.dateFormat,f.locale),i._getFormatedDate(endDate,f.dateFormat,f.locale)),maxScrollWidth=chartObject.getMaxScrollWidth(),chartObject._$bodyContainer.ejScroller("scrollX",maxScrollWidth,!0),i.isCriticalPathEnable==!0&&f.predecessorMapping&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",i.criticalPathCollection,i.detailPredecessorCollection,!0,i.collectionTaskId))},_rowDataBound:function(n){this._trigger("rowDataBound",n)},_refreshToolBar:function(){var t=n("#"+this._id+"_toolbarItems");t.find("li").removeClass("e-hover")},_toolBarClick:function(t){var f=this,c=f.model,e=n(this.itemsContainer).closest(".e-gantt"),r=e.ejGantt("instance"),i=e.attr("id"),o=n("#"+r._id+"_toolbarItems");if(r._clearContextMenu(),t.event==u&&t.target.tagName=="INPUT"&&t.currentTarget.id==i+"_search")return!1;r.model.dateFormat.toLowerCase().indexOf("hh")!=-1?n.isFunction(n.fn.ejDateTimePicker)&&n("#"+i+"EditForm").find(".e-datetimepicker").ejDateTimePicker("hide"):n.isFunction(n.fn.ejDatePicker)&&n("#"+i+"EditForm").find(".e-datepicker").ejDatePicker("hide");var s=t.currentTarget,l=t.target,h={itemName:t.text,currentTarget:s,model:r.model};if(e.ejGantt("instance")._trigger("toolbarClick",h))return!1;n(o).ejToolbar("deselectItem",t.currentTarget);switch(t.currentTarget.id){case i+"_excelExport":r._toolbarOperation(i+"_excelExport");break;case i+"_add":r._toolbarOperation(i+"_add");break;case i+"_edit":r._toolbarOperation(i+"_edit");break;case i+"_delete":r._toolbarOperation(i+"_delete");break;case i+"_update":r._toolbarOperation(i+"_update");break;case i+"_cancel":r._toolbarOperation(i+"_cancel");break;case i+"_search":r._toolbarOperation(i+"_search",n(t.currentTarget).find("input").val());break;case i+"_indent":r._toolbarOperation(i+"_indent");break;case i+"_outdent":r._toolbarOperation(i+"_outdent");break;case i+"_expandAll":r._toolbarOperation(i+"_expandAll");break;case i+"_criticalPath":r._enableDisableCriticalIcon?r._enableDisableCriticalIcon&&r._toolbarOperation(i+"_criticalDisable"):r._toolbarOperation(i+"_criticalEnable");break;case i+"_collapseAll":r._toolbarOperation(i+"_collapseAll");break;case i+"_prevTimeSpan":r._toolbarOperation(i+"_prevTimeSpan");break;case i+"_nextTimeSpan":r._toolbarOperation(i+"_nextTimeSpan");break;case"milestoneTemplate":f._milestoneTemplate(options[option]);break;case"taskbarTemplate":f._taskbarTemplate(options[option]);break;case"parentTaskbarTemplate":f._parentTaskbarTemplate(options[option])}return!1},_toolbarOperation:function(t,i){var o=this.element,f=o.ejGantt("instance"),u=o.attr("id"),r=this,s=r.selectedRowIndex(),e;f._exportTo=f["export"];e=n("#"+r._id+"_toolbarItems");switch(t){case u+"_add":r._sendAddRequest();break;case u+"_edit":r._sendEditRequest();break;case u+"_delete":r._$treegridHelper.ejTreeGrid("deleteRow");r._isRefreshAddedRecord=!1;break;case u+"_update":r._$treegridHelper.ejTreeGrid("endEdit");r.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&r._disabledToolItems.push(n(e).find(".e-cancel").parent()[0]);r.model.toolbarSettings.toolbarItems.indexOf("update")!==-1&&r._disabledToolItems.push(n(e).find(".e-saveitem").parent()[0]);n(e).ejToolbar("disableItem",r._disabledToolItems);r._disabledToolItems=[];break;case u+"_cancel":r._$treegridHelper.ejTreeGrid("cancelEditCell");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_criticalEnable":r.showCriticalPath(!0);r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_criticalDisable":r.showCriticalPath(!1);r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_search":r.cancelEditCell();r._searchString!=i&&(r._$treegridHelper.ejTreeGrid("search",i),r._searchString=i,r.updateSelectedItemIndex(),r._updateToolbarOptions(),r._isRefreshAddedRecord=!1);break;case u+"_indent":r._sendIndentRequest();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");r._isRefreshAddedRecord=!1;break;case u+"_outdent":r._sendOutdentRequest();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");r._isRefreshAddedRecord=!1;break;case u+"_expandAll":r._expandAll();r.updateSelectedItemIndex();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_collapseAll":r._collapseAll();r.updateSelectedItemIndex();r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_prevTimeSpan":r._updateScheduleDatesByToolBar("prevTimeSpan");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_nextTimeSpan":r._updateScheduleDatesByToolBar("nextTimeSpan");r._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case u+"_excelExport":r._exportTo(f.model.exportToExcelAction,"excelExporting",f.model.allowMultipleExporting)}return r._refreshToolBar(),!1},updateSelectedItemIndex:function(){var n=this,t=this.model,u=t.updatedRecords,i;t.allowSelection&&!r.isNullOrUndefined(this.selectedItem())?n.getExpandStatus(this.selectedItem())?(i=u.indexOf(this.selectedItem()),n.selectRows(i)):n.selectRows(-1):t.allowSelection||r.isNullOrUndefined(this.selectedItem())||n.selectRows(-1)},clearSelection:function(){var n=this;n.model.selectedCellIndexes=[];n._$treegridHelper.ejTreeGrid("clearSelection")},selectCells:function(n,t){var i=this,r=i.model;r.selectionMode=="cell"&&r.allowSelection&&i._$treegridHelper.ejTreeGrid("selectCells",n,t)},selectRows:function(n){var i=this,u=this.model,t;u.selectionMode!="cell"&&(n!==-1&&!r.isNullOrUndefined(n)&&n<u.updatedRecords.length?(t={},t.recordIndex=n,t.data=u.updatedRecords[t.recordIndex],t.target="ejTreeGrid",i.rowSelecting(t)&&(i.rowSelected(t),i._$treegridHelper.ejTreeGrid("selectRows",t.recordIndex),i._$ganttchartHelper.ejGanttChart("selectRows",t.recordIndex)),i.updateIndentOutdentOption(t.data)):n===-1&&(i._deSelectRowItem(),i._updateToolbarOptions()))},_setModel:function(t){var i=this,u,f=i.model,s,o,e;for(u in t)switch(u){case"sortSettings":i._sendSortingRequest(t[u]);break;case"allowSorting":i._sortingRequest(t[u]);f.showColumnChooser&&f.showColumnOptions&&i._$treegridHelper.ejTreeGrid("columnAddDialogTemplate");break;case"allowMultiSorting":f.allowMultiSorting=t[u];i._$treegridHelper.ejTreeGrid("model.allowMultiSorting",f.allowMultiSorting);break;case"destroy":i.destroy();break;case"treeColumnIndex":i._columnIndex(t[u]);break;case"allowGanttChartEditing":i._ganttChartEditing(t[u]);break;case"enableProgressBarResizing":i._resizeProgressbar(t[u]);break;case"enableTaskbarTooltip":i._showTooltip(t[u]);break;case"enableTaskbarDragTooltip":i._showEditingTooltip(t[u]);break;case"validateManualTasksOnLinking":f.validateManualTasksOnLinking=t[u];break;case"enableAltRow":i._updateAltRow(t[u]);break;case"locale":f.flatRecords=[];f.parentRecords=[];i._clearContextMenu();f.locale=t[u];f.isRerender=!0;i.element.ejGantt("destroy").ejGantt(f);break;case"allowSelection":f.allowSelection=t[u];f.allowSelection?(i._$treegridHelper.ejTreeGrid("instance").model.allowSelection=!0,i._$ganttchartHelper.ejGanttChart("instance").model.allowSelection=!0):(i._deSelectRowItem(),i._$treegridHelper.ejTreeGrid("instance").model.allowSelection=!1,i._$ganttchartHelper.ejGanttChart("instance").model.allowSelection=!1);i._updateToolbarOptions();break;case"editSettings":n.extend(f.editSettings,t[u]);i._updateEditSettings(t[u]);i._initiateDialogTemplates();i._enableEditingEvents();this.cancelEditCell();break;case"taskbarBackground":i._updateTaskbarBackground(t[u]);break;case"progressbarBackground":i._updateProgressbarBackground(t[u]);break;case"parentTaskbarBackground":i._updateParentTaskbarBackground(t[u]);break;case"parentProgressbarBackground":i._updateParentProgressbarBackground(t[u]);break;case"showTaskNames":i._updateRenderTaskNames(t[u]);break;case"leftTaskLabelMapping":i._refreshLeftTaskLabelMapping(t[u]);break;case"rightTaskLabelMapping":i._refreshRightTaskLabelMapping(t[u]);break;case"leftTaskLabelTemplate":i._refreshLeftTaskLabelTemplate(t[u]);break;case"rightTaskLabelTemplate":i._refreshRightTaskLabelTemplate(t[u]);break;case"showProgressStatus":i._updateRendeProgressStatus(t[u]);break;case"showResourceNames":i._updateRenderResourceNames(t[u]);break;case"progressbarHeight":i._updateProgressbarHeight(t[u]);break;case"baselineColor":i._updateBaselineColor(t[u]);break;case"renderBaseline":i._updateRenderBaseline(t[u]);break;case"allowColumnResize":i._updateAllowColumnResize(t[u]);break;case"allowKeyboardNavigation":i._updateAllowKeyboardNavigation(t[u]);break;case"selectedItem":i._updateSelectedItem(t[u]);break;case"dataSource":i._deSelectRowItem();i._updateToolbarOptions();this._refreshDataSource(t[u]);i._enableDisableCriticalIcon&&i.showCriticalPath(!0);break;case"readOnly":i._updateReadOnly(t[u]);break;case"showGridCellTooltip":i._updateShowGridCellTooltip(t[u]);break;case"showGridExpandCellTooltip":i._updateShowGridExpandCellTooltip(t[u]);break;case"highlightWeekends":i._updateHighlightWeekends(t[u]);break;case"connectorLineBackground":i._updateConnectorLineBackground(t[u]);i._enableDisableCriticalIcon&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId);break;case"connectorlineWidth":i._updateConnectorlineWidth(t[u]);i._enableDisableCriticalIcon&&i._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId);break;case"weekendBackground":i._updateWeekendBackground(t[u]);break;case"scheduleHeaderSettings":s=t[u];for(setting in s)switch(setting){case"timescaleUnitSize":i._updateTimescaleUnitSize(s[setting])}break;case"enableContextMenu":f.enableContextMenu=t[u];i._clearContextMenu();i._off(i.element,"contextmenu",i._rightClick);f.enableContextMenu&&i._on(i.element,"contextmenu",i._rightClick);break;case"enableResize":f.enableResize?(i.model.enableResize=t[u],i._on(n(window),"resize",i.windowResize)):i._off(n(window),"resize",i.windowResize);break;case"isResponsive":f.isResponsive?(i.model.isResponsive=t[u],i._on(n(window),"resize",i.windowResize)):i._off(n(window),"resize",i.windowResize);break;case"selectedRowIndex":this.selectedRowIndex()===-1||this.selectedRowIndex()===""?(i._deSelectRowItem(),i._updateToolbarOptions()):this.selectedRowIndex()!==-1&&!r.isNullOrUndefined(this.selectedRowIndex())&&this.selectedRowIndex()<i.model.updatedRecords.length&&(o={},o.recordIndex=i.selectedRowIndex(),o.previousIndex=f.selectedItem?f.updatedRecords.indexOf(f.selectedItem):-1,i.rowSelecting(o)&&(e={},e.recordIndex=this.selectedRowIndex(),e.data=i.model.updatedRecords[e.recordIndex],e.target="ejTreeGrid",i._$treegridHelper.ejTreeGrid("selectRows",e.recordIndex),i.rowSelected(e)));break;case"selectedCellIndexes":f.allowSelection&&f.selectionMode=="cell"&&i.selectCells(t[u]);break;case"selectionMode":f.allowSelection&&(i.clearSelection(),i._$treegridHelper.ejTreeGrid("selectRows",-1),i._$ganttchartHelper.ejGanttChart("selectRows",-1),f.selectedItem=null,f.selectionMode=t[u],i._$treegridHelper.ejTreeGrid("option","selectionMode",t[u]),i._$ganttchartHelper.ejGanttChart("option","selectionMode",t[u]),t[u]=="row"&&(i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType="single"),i._updateToolbarOptions());break;case"selectionType":f.allowSelection&&(i.clearSelection(),f.selectionMode=="cell"?(f.selectionType=t[u],i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType=t[u]):(f.selectionType="single",i._$treegridHelper.ejTreeGrid("instance").model.selectionSettings.selectionType="single"));break;case"showColumnChooser":f.showColumnChooser=t[u];i._$treegridHelper.ejTreeGrid("setModel",{showColumnChooser:f.showColumnChooser});break;case"showColumnOptions":f.showColumnOptions=t[u];i._$treegridHelper.ejTreeGrid("setModel",{showColumnOptions:f.showColumnOptions});break;case"splitterPosition":i.setSplitterPosition(i._splitterPosition());break;case"addDialogFields":f.editSettings.allowAdding&&(f.addDialogFields=t[u],i.addDialogTemplate());break;case"dragTooltip":i._$treegridHelper.ejTreeGrid("setModel",{dragTooltip:t[u]});break;case"allowDragAndDrop":f.allowDragAndDrop=t[u];i._$treegridHelper.ejTreeGrid("setModel",{allowDragAndDrop:f.allowDragAndDrop});break;case"editDialogFields":f.editSettings.allowEditing&&(f.editDialogFields=t[u],i.editDialogTemplate());break;case"toolbarSettings":n.extend(i.model.toolbarSettings,t[u]);i._updateToolbar();break;case"holidays":f.holidays=t[u];i._refreshHolidays();break;case"stripLines":f.stripLines=t[u];i._updateStripLines();break;case"splitterSettings":n.extend(f.splitterSettings,t[u]);!r.isNullOrUndefined(t[u].index)&&r.isNullOrUndefined(t[u].position)?i.setSplitterIndex(f.splitterSettings.index):i.setSplitterPosition(i.splitterPosition());break;case"enablePredecessorValidation":f.enablePredecessorValidation=t[u];break;case"sizeSettings":this._calculateDimensions();this.windowResize();break;case"dayWorkingTime":f.dayWorkingTime=t[u].slice();f.flatRecords=[];f.parentRecords=[];f.updatedRecords=[];f.ids=[];f.scheduleStartDate=f.scheduleStartDate;f.scheduleEndDate=f.scheduleEndDate;i._storedIndex=-1;i.selectedRowIndex(-1);i._predecessorsCollection=[];i.element.ejGantt("destroy").ejGantt(f);break;case"workUnit":f.workUnit=t[u];this._updateWorkUnit();break;case"resources":i._updateResourcesData(t[u])}},_updateResourcesData:function(t){var u=this,i=u.model,e,f=-1,o=u.getColumns();i.resources=n.extend(!0,[],t);n.each(o,function(n,t){if(t.mappingName==i.resourceInfoMapping){f=n;return}});f>-1&&(o[f].dropdownData=i.resources);flatRecords=i.flatRecords.slice();flatRecords.reverse();e=r.Gantt.GanttRecord.prototype;n.each(flatRecords,function(n,t){t.resourceInfo&&t.resourceInfo.length>0&&(t.resourceInfo=e._setResourceInfo(t.item[i.resourceInfoMapping],i.resourceIdMapping,i.resourceNameMapping,i.resourceUnitMapping,i.resources),u._updateResourceName(t),u._updateResourceRelatedFields(t),t.hasChildRecords?t.isAutoSchedule?u._updateParentItem(t,null,!0):t.isAutoSchedule||u._updateManualParentItem(t,null,!0):u.refreshGanttRecord(t))})},_updateWorkUnit:function(){var n=this,f=n.model,e=f.flatRecords,s=n.getCurrentViewData(),o=n._$treegridHelper.ejTreeGrid("instance"),i,t,u;for(o.model.workUnit=f.workUnit,i=0;i<e.length;i++)t=e[i],u=s.indexOf(t),t._updateWorkWithDuration(n),t.parentItem&&n._updateParentItem(t),u!=-1&&r.TreeGrid.refreshRow(o,u)},_dataBindingForSetModel:function(){var t=this,i=t.model,s,h,e,o,u,f;if(this.dataSource()==null&&this.dataSource([]),this.dataSource()instanceof r.DataManager)s=this._columnToSelect(),h=this.dataSource().executeQuery(s),h.done(r.proxy(function(r){var e,o,u,f;if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:r.result,i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t.dataSource(),o=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o)}else t.secondaryDatasource=t._retrivedData;t._createGanttRecords(t.secondaryDatasource);t._refreshGanttWithNewRecords()}));else if(this.dataSource().length>0){if(i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){for(e=t.dataSource(),o=[],u=0;u<e.length;u++)f=e[u],o.push(n.extend(!0,{},f)),f[i.taskIdMapping]&&t._taskIds.push(f[i.taskIdMapping]);i.childMapping||(i.childMapping="Children");t._reconstructDatasource(o);t._createGanttRecords(t.secondaryDatasource)}else t._createGanttRecords(this.dataSource());this._refreshGanttWithNewRecords()}else this._refreshGanttWithNewRecords()},_refreshGanttWithNewRecords:function(){var n=this,t=this.model,i={};this._updatePredecessors();this._$treegridHelper.ejTreeGrid("setUpdatedRecords",t.flatRecords,t.updatedRecords,t.ids,t.parentRecords,this.dataSource());this._$treegridHelper.ejTreeGrid("processBindings");n.model.updatedRecords=n.getUpdatedRecords();n.model.currentViewData=n.getCurrentViewData();n._gridRows=n.getRows();n._totalCollapseRecordCount=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");this._$ganttchartHelper.ejGanttChart("setUpdatedRecords",t.currentViewData,t.updatedRecords,t.flatRecords,t.ids);this._calculateScheduleDates();this.updateScheduleDates(t.scheduleStartDate,this.model.scheduleEndDate);i.requestType=r.TreeGrid.Actions.Refresh;n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i);this._isFromSetModel=!1},_refreshDataSource:function(n){var t=this;this.resetModelCollections();this.dataSource(n);this._isFromSetModel=!0;t.secondaryDatasource=[];t._retrivedData=this.dataSource();this._dataBindingForSetModel()},resetModelCollections:function(){var t=this,n=t.model;n.dataSource=[];n.flatRecords=[];n.parentRecords=[];n.updatedRecords=[];n.ids=[];n.scheduleStartDate=n.scheduleStartDate;n.scheduleEndDate=n.scheduleEndDate;t._storedIndex=-1;t.selectedRowIndex(-1);t._predecessorsCollection=[]},_refreshHolidays:function(){var n=this,i=this.model,t,r;n._holidaysList=n._getHoliday();n._stringHolidays=n._getStringHolidays();t=n._updateScheduleDatesByHolidays(new Date(n._projectStartDate),new Date(n._projectEndDate));t.startDate.getTime()!==n._projectStartDate.getTime()||t.endDate.getTime()!==n._projectEndDate.getTime()?(r=n._$ganttchartHelper.data("ejGanttChart"),r.model.holidays=i.holidays,n.updateScheduleDates(t.startDate,t.endDate)):(n._isTreeGridRendered=!1,n._isGanttChartRendered=!1,n._updateGanttRecords(),n._$ganttchartHelper.ejGanttChart("refreshHelper",n.model.currentViewData,n.model.updatedRecords,n._totalCollapseRecordCount),i.predecessorMapping&&(n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._connectorlineIds=[],n._connectorLinesCollection=[],n._isValidationEnabled=!1,n._createConnectorLinesCollection(),n._isValidationEnabled=!0),this._$ganttchartHelper.ejGanttChart("refreshHolidays",i.holidays),n._isTreeGridRendered=!0,n._isGanttChartRendered=!0);n._$treegridHelper.ejTreeGrid("renderRecords")},_updateStripLines:function(){var n=this,r=this.model,t,i;t=n._updateScheduleDatesByStripLines(new Date(n._projectStartDate),new Date(n._projectEndDate));t.startDate.getTime()!==n._projectStartDate.getTime()||t.endDate.getTime()!==n._projectEndDate.getTime()?(i=n._$ganttchartHelper.data("ejGanttChart"),i.model.stripLines=r.stripLines,n.updateScheduleDates(t.startDate,t.endDate)):this._$ganttchartHelper.ejGanttChart("refreshStripLines",this.model.stripLines)},_updateWeekendBackground:function(n){var t=this;this.model.weekendBackground=n;t._$ganttchartHelper.ejGanttChart("updateWeekendBackground",n)},_updateConnectorlineWidth:function(n){var t=this;this.model.connectorlineWidth=n;t._$ganttchartHelper.ejGanttChart("updateConnectorlineWidth",n);t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection)},_updateConnectorLineBackground:function(n){var t=this;this.model.connectorLineBackground=n;t._$ganttchartHelper.ejGanttChart("updateConnectorLineBackground",n);t._$ganttchartHelper.ejGanttChart("clearConnectorLines");t._$ganttchartHelper.ejGanttChart("renderConnectorLines",t._connectorLinesCollection)},_updateHighlightWeekends:function(n){var t=this;this.model.highlightWeekends=n;t._$ganttchartHelper.ejGanttChart("updateHighlightWeekends",n)},_updateReadOnly:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateReadOnly",n);t._$ganttchartHelper.ejGanttChart("updateReadOnly",n);t._updateToolbarOptions()},_updateShowGridCellTooltip:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateShowGridCellTooltip",n)},_updateShowGridExpandCellTooltip:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateShowGridExpandCellTooltip",n)},_updateSelectedItem:function(n){var t=this,i={};n[t.model.taskIdMapping]!=null&&(i.recordIndex=t.model.ids.indexOf(n[t.model.taskIdMapping].toString()),i.item=t.model.flatRecords[i.recordIndex],i.target="ejTreeGrid",t.rowSelected(i),t._$treegridHelper.ejTreeGrid("selectRows",i.recordIndex),t._$ganttchartHelper.ejGanttChart("selectRows",i.recordIndex),t._$ganttchartHelper.ejGanttChart("updateSelectedItem",i.recordIndex))},_updateAllowKeyboardNavigation:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateAllowKeyboardNavigation",n);t._$ganttchartHelper.ejGanttChart("updateAllowKeyboardNavigation",n)},_updateAllowColumnResize:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateAllowColumnResize",n)},_updateProgressbarHeight:function(n){var t=this;this.model.progressbarHeight=n;t._$ganttchartHelper.ejGanttChart("updateProgressbarHeight",n)},_updateBaselineColor:function(n){var t=this;this.model.baselineColor=n;t._$ganttchartHelper.ejGanttChart("updateBaselineColor",n)},_updateRenderBaseline:function(n){var t=this,i=t.model,r,u;this.model.renderBaseline=n;t._$ganttchartHelper.ejGanttChart("updateRenderBaseline",n);i.renderBaseline&&(t.setColumns(t.createTreeGridColumns()),t._trigger("load"));i.renderBaseline||(r=t._columns.map(function(n){return n.field}).indexOf("baselineStartDate"),t._columns.splice(r,1),u=t._columns.map(function(n){return n.field}).indexOf("baselineEndDate"),t._columns.splice(u,1));t._$treegridHelper.ejTreeGrid("updateColumns",t._columns);t.addDialogTemplate();t.editDialogTemplate()},_updateRenderTaskNames:function(n){var t=this;this.model.showTaskNames=n;t._$ganttchartHelper.ejGanttChart("updateRenderTaskNames",n)},_refreshLeftTaskLabelMapping:function(n){var t=this;this.model.leftTaskLabelMapping=n;t._$ganttchartHelper.ejGanttChart("refreshLeftTaskLabelMapping",n)},_refreshRightTaskLabelMapping:function(n){var t=this;this.model.rightTaskLabelMapping=n;t._$ganttchartHelper.ejGanttChart("refreshRightTaskLabelMapping",n)},_refreshLeftTaskLabelTemplate:function(n){var t=this;this.model.leftTaskLabelTemplate=n;t._$ganttchartHelper.ejGanttChart("refreshLeftTaskLabelTemplate",n)},_refreshRightTaskLabelTemplate:function(n){var t=this;this.model.rightTaskLabelTemplate=n;t._$ganttchartHelper.ejGanttChart("refreshRightTaskLabelTemplate",n)},_updateRendeProgressStatus:function(n){var t=this;this.model.showProgressStatus=n;t._$ganttchartHelper.ejGanttChart("updateRendeProgressStatus",n)},_updateRenderResourceNames:function(n){var t=this;this.model.showResourceNames=n;t._$ganttchartHelper.ejGanttChart("updateRenderResourceNames",n)},_updateTaskbarBackground:function(n){var t=this;this.model.taskbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateTaskbarBackground",n)},_updateProgressbarBackground:function(n){var t=this;this.model.progressbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateProgressbarBackground",n)},_updateParentTaskbarBackground:function(n){var t=this;this.model.parentTaskbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateParentTaskbarBackground",n)},_updateParentProgressbarBackground:function(n){var t=this;this.model.parentProgressbarBackground=n;t._$ganttchartHelper.ejGanttChart("updateParentProgressbarBackground",n)},_updateEditSettings:function(n){var t=this;t._$ganttchartHelper.ejGanttChart("updateEditSettings",n);t._$treegridHelper.ejTreeGrid("updateEditSettings",n);t._updateToolbarOptions()},_updateRowSelection:function(n){var t=this;t._$treegridHelper.ejTreeGrid("updateRowSelection",n)},_updateAltRow:function(n){var t=this;t._$treegridHelper.ejTreeGrid("option","enableAltRow",n)},_renderAddedRow:function(n,t){var i=this,u=this.model,f;u.currentViewData=i._$treegridHelper.ejTreeGrid("getUpdatedCurrentViewData");i._$ganttchartHelper.ejGanttChart("setUpdatedRecords",u.currentViewData,u.updatedRecords,u.flatRecords,u.ids);u.enableVirtualization?(f={},f.requestType=r.TreeGrid.Actions.Refresh,i._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",f),i._$ganttchartHelper.ejGanttChart("refreshHelper",u.currentViewData,u.updatedRecords,i._totalCollapseRecordCount)):(i._$treegridHelper.ejTreeGrid("renderNewAddedRow",n,t),i._$ganttchartHelper.ejGanttChart("renderNewAddedRow",n,t));i._$treegridHelper.ejTreeGrid("updateHeight");i._gridRows=i.getRows();i._ganttChartRows=i.getGanttChartRows()},_getVisibleChildRecordCount:function(n,t,i){var e=this,o=this.model,u,f,r;if(n.hasChildRecords)for(u=n.childRecords,f=u.length,r=0;r<f;r++)i.indexOf(u[r])!==-1&&t++,u[r].hasChildRecords&&(t=e._getVisibleChildRecordCount(u[r],t,i));else i.indexOf(n)!==-1&&t++;return t},_validateAddRecordPrecessorValue:function(n){var u=this,i=n.data,t=this.model,r;return t.predecessorMapping&&i[t.predecessorMapping]&&i[t.predecessorMapping].length>0?(r={},r.currentRecord=n.currentRecord,r.predecessorString=i[t.predecessorMapping].split(","),u._editedPredecessorValidation(r)?!0:(i[t.predecessorMapping]="",n.currentRecord.predecessor=null,n.currentRecord.predecessorsName="",!1)):!0},openAddDialog:function(){this.cancelEditCell();this._sendAddRequest()},openEditDialog:function(){this.cancelEditCell();this._sendEditRequest()},searchItem:function(t){var i=this;i.cancelEditCell();i._searchString!=t&&(i._$treegridHelper.ejTreeGrid("search",t),i._searchString=t,n("#gantt_search input").val(t))},addRecord:function(n,t){var u=this,e=this.model,tt=e.selectionMode=="row"?this.selectedRowIndex():u._rowIndexOfLastSelectedCell,f=e.updatedRecords[tt],i,g=e.taskIdMapping,h=e.updatedRecords,p=e.flatRecords,w=e.parentRecords,nt=e.ids,c=this.dataSource(),v=0,b,s={},o,y,l,a,k,it,d,rt;u.clearSelection();u.cancelEditCell();(r.isNullOrUndefined(c)||r.isNullOrUndefined(c[0]))&&(this.dataSource([]),c=this.dataSource());Object.prototype.toString.call(n)!=="[object Object]"&&(n={});(tt!==-1||t!==r.Gantt.RowPosition.AboveSelectedRow&&t!==r.Gantt.RowPosition.BelowSelectedRow&&t!==r.Gantt.RowPosition.Child)&&t||(t=r.Gantt.RowPosition.Top);n[g]&&(n[g]=e.ids.indexOf(n[g].toString())!=-1?null:isNaN(parseInt(n[g]))?null:parseInt(n[g]));u._updateAddData(n,t);u._isDataManagerUpdate&&(u._jsonData=u._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData"));switch(t){case r.Gantt.RowPosition.Top:if(v=0,o=null,i=u._createGanttRecord(n,v),i.index=i.taskId,s.data=n,s.currentRecord=i,!u._validateAddRecordPrecessorValue(s)&&u._isinAddnewRecord)return!1;p.splice(0,0,i);h.splice(0,0,i);nt.splice(0,0,i.taskId.toString());w.splice(0,0,i);u._isDataManagerUpdate?u._jsonData.splice(0,0,i.item):c.splice(0,0,i.item);b=0;break;case r.Gantt.RowPosition.Bottom:if(v=0,o=null,i=u._createGanttRecord(n,v),i.index=i.taskId,s.data=n,s.currentRecord=i,!u._validateAddRecordPrecessorValue(s)&&u._isinAddnewRecord)return!1;p.push(i);h.push(i);nt.push(i.taskId.toString());w.push(i);u._isDataManagerUpdate?u._jsonData.push(i.item):c.push(i.item);b=h.indexOf(i);break;case r.Gantt.RowPosition.AboveSelectedRow:if(v=f.level,o=f.parentItem,i=u._createGanttRecord(n,v,o),i.index=i.taskId,s.data=n,s.currentRecord=i,!u._validateAddRecordPrecessorValue(s)&&u._isinAddnewRecord)return!1;l=p.indexOf(f);a=h.indexOf(f);p.splice(l,0,i);h.splice(a,0,i);nt.splice(l,0,i.taskId.toString());r.isNullOrUndefined(o)?(w.splice(w.indexOf(f),0,i),u._isDataManagerUpdate?u._jsonData.splice(u._jsonData.indexOf(f.item),0,i.item):c.splice(c.indexOf(f.item),0,i.item)):(y=o.childRecords.indexOf(f),o.childRecords.splice(y,0,i),e.parentTaskIdMapping?(i.item[e.parentTaskIdMapping]=i.parentItem.taskId,u._isDataManagerUpdate?u._jsonData.push(i.item):c.push(i.item)):o.item[e.childMapping].splice(y,0,i.item));b=a;break;case r.Gantt.RowPosition.BelowSelectedRow:if(v=f.level,o=f.parentItem,i=u._createGanttRecord(n,v,o),i.index=i.taskId,s.data=n,s.currentRecord=i,!u._validateAddRecordPrecessorValue(s)&&u._isinAddnewRecord)return!1;k=p.indexOf(f);f.hasChildRecords?(dataChildCount=u._$treegridHelper.ejTreeGrid("getChildCount",f,0),l=k+dataChildCount+1,a=h.indexOf(f)+u._getVisibleChildRecordCount(f,0,h)+1):(l=k+1,a=h.indexOf(f)+1);p.splice(l,0,i);h.splice(a,0,i);nt.splice(l,0,i.taskId.toString());r.isNullOrUndefined(o)?(w.splice(w.indexOf(f)+1,0,i),u._isDataManagerUpdate?u._jsonData.splice(u._jsonData.indexOf(f.item)+1,0,i.item):c.splice(c.indexOf(f.item)+1,0,i.item)):(y=o.childRecords.indexOf(f),o.childRecords.splice(y+1,0,i),e.parentTaskIdMapping?(i.item[e.parentTaskIdMapping]=i.parentItem.taskId,u._isDataManagerUpdate?u._jsonData.push(i.item):c.push(i.item)):o.item[e.childMapping].splice(y+1,0,i.item));b=a;break;case r.Gantt.RowPosition.Child:if(v=f.level+1,o=f,i=u._createGanttRecord(n,v,o),i.index=i.taskId,s.data=n,s.currentRecord=i,!u._validateAddRecordPrecessorValue(s)&&u._isinAddnewRecord)return!1;k=p.indexOf(f);f.hasChildRecords?(dataChildCount=u._$treegridHelper.ejTreeGrid("getChildCount",f,0),l=k+dataChildCount+1,f.expanded||(it={},it.expanded=!0,it.data=f,u._isInAdd=!0,u.expanding(it),u._isInAdd=!1,h=u.getUpdatedRecords()),a=h.indexOf(f)+u._getVisibleChildRecordCount(f,0,h)+1):(f.hasChildRecords=!0,f.childRecords=[],f.expanded=!0,e.parentTaskIdMapping||(f.item[e.childMapping]=[]),f.isMilestone=!1,l=k+1,a=h.indexOf(f)+1,f.predecessor&&u._updatePredecessorOnIndentOutdent(f));p.splice(l,0,i);h.splice(a,0,i);nt.splice(l,0,i.taskId.toString());r.isNullOrUndefined(o)||(y=o.childRecords.indexOf(f),o.childRecords.splice(y+1,0,i),e.parentTaskIdMapping?(i.item[e.parentTaskIdMapping]=i.parentItem.taskId,u._isDataManagerUpdate?u._jsonData.push(i.item):c.push(i.item)):o.item[e.childMapping].splice(y+1,0,i.item));b=a}return u._deSelectRowItem(),u._$treegridHelper.ejTreeGrid("setUpdatedRecords",e.flatRecords,e.updatedRecords,e.ids,e.parentRecords,this.dataSource()),d={},d.requestType="save",d._cAddedRecord=d.addedRecord=i,d.index=b,u.actionComplete(d),e.enableWBS&&u.updateWBSdetails(),rt=u._$treegridHelper.ejTreeGrid("instance"),e.enableVirtualization===!1&&(rt.model.sortSettings.sortedColumns.length>0||rt._searchString.length>0)&&(u._isRefreshAddedRecord=!0),e.selectionMode=="cell"?(tt=e.updatedRecords.indexOf(i),u._$treegridHelper.ejTreeGrid("updateScrollBar",tt)):u._$treegridHelper.ejTreeGrid("updateScrollBar"),!0},updateWBSdetails:function(n,t,i){var h=this,e=h.model,r=n?n:e.selectionMode=="row"?e.selectedItem:e.updatedRecords[h._rowIndexOfLastSelectedCell],c,o,l,u,s,a,v,f,y;newWBS=r.WBS;r.parentItem?(c=r.parentItem.childRecords,o=c.indexOf(r),u=c,s=u.length):e.flatRecords.length&&(a=e.flatRecords,v=a.filter(function(n){return n&&n.level==0}),u=v,o=u.indexOf(r),s=u.length);l=t?u.slice(o,s):u.slice(o+1,s);l.length&&(f=newWBS.lastIndexOf(".")!=-1?parseInt(newWBS.substr(newWBS.lastIndexOf(".")+1)):parseInt(newWBS),y=r.parentItem?r.parentItem.WBS:null,t&&!i?f--:t&&i?f=f:f++,h.reCalculateWBS(l,f,y))},deleteItem:function(){var n=this;n.cancelEditCell();n._$treegridHelper.ejTreeGrid("deleteRow")},expandAllItems:function(){this.cancelEditCell();this._expandAll();this.updateSelectedItemIndex();this._$treegrid.focus()},collapseAllItems:function(){this._collapseAll();this.updateSelectedItemIndex();this._$treegrid.focus()},indentItem:function(){var e=this,r=this.model,u=e.model.flatRecords,n=r.selectedItem,t=!0,i,f;if(r.editSettings.allowIndent==!1)return!0;if(n&&(i=u.indexOf(n),i===0?t=!1:n.level===0?t=!0:(f=u[i-1],t=n.level-f.level==1?!1:!0)),t)this._sendIndentRequest();else return!1},outdentItem:function(){this._sendOutdentRequest()},updateGanttColumns:function(n){var t=this,i=t.model;i.columns=n;t._columns=n},cancelEdit:function(){this.sendCancelRequest()},expandCollapseRecord:function(t){var e=this,u={},i,o=this.model,h,s,f;i=o.flatRecords[o.ids.indexOf(t.toString())];!r.isNullOrUndefined(i)&&i.hasChildRecords&&(u={},u.expanded=i.expanded==!0?!1:!0,h=e.getExpandStatus(i),h?(u.data=i,u.expanded?e.expanding(u):e.collapsing(u)):(i.expanded=u.expanded,s=o.currentViewData.indexOf(i),s==-1||o.enableVirtualization||(f=n(e.getRows()[s]),i.expanded?(f.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),f.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")):(f.find(".e-treegridexpand").removeClass("e-treegridexpand").addClass("e-treegridcollapse"),f.removeClass("e-treegridrowexpand").addClass("e-treegridrowcollapse")))))},saveEdit:function(){var n=this;n._$treegridHelper.ejTreeGrid("endEdit")},setSplitterIndex:function(t){var r=this,e=r.model,f=r.getColumns(),u=0,o=n("#ejTreeGrid"+r._id+"e-gridcontent"),i;if(columnIndex=parseInt(t),columnIndex>-1&&columnIndex<f.length){for(i=0;i<=columnIndex;i++)u+=f[i].width;if(u>r._ganttWidth)for(u=0,i=0;i<=columnIndex;i++)if(u+f[i].width<=r._ganttWidth)u+=f[i].width,t=i;else{e.splitterSettings.index=t;break}else e.splitterSettings.index=columnIndex;o.ejScroller("isHScroll")&&o.ejScroller("scrollLeft",0);r.setSplitterPosition(u.toString())}},showCriticalPath:function(n,t){var a=this,tt=this.model.ids,h=this.model.flatRecords,y,e,g,yt,et,i,u,pt,ut,wt,l,ot,st;if(n==!0)if(this.isCriticalPathEnable=!0,h.length!=0){var r=[],ct,it,f=[],s=[],c=[],nt=[],lt=[],at=[],o=this.model.flatRecords,b=this.model.parentRecords,kt=[],ft=0,rt=0,vt=[],v,ht;for(v=this.model.parentRecords[0].endDate,this.model.parentRecords[0].manualEndDate>this.model.parentRecords[0].endDate&&!this.model.parentRecords[0].isAutoSchedule&&(v=this.model.parentRecords[0].manualEndDate),ht=this.model.parentRecords[0].taskId,y=1;y<b.length;y++)b[y].endDate>=v&&(v=b[y].endDate,ht=b[y].taskId),b[y].isAutoSchedule||b[y].manualEndDate>=v&&(v=b[y].manualEndDate,ht=b[y].taskId);for(e=0;e<o.length;e++)o[e].isCritical=!1,ft=a._getDuration(o[e].endDate,v,o[e].durationUnit,o[e].isAutoSchedule),o[e].slack=ft+" "+o[e].durationUnit,o[e].endDate>=v&&nt.push(o[e].taskId),o[e].predecessor&&o[e].predecessor.length!=0&&(r.push(o[e]),lt.push(o[e].taskId));for(g=0;g<nt.length;g++)lt.indexOf(nt[g])==-1?(rt=tt.indexOf(nt[g].toString()),h[rt].status<100&&(h[rt].isCritical=!0),h[rt].slack=0+h[rt].durationUnit,at.push(nt[g])):kt.push(nt[g]);for(yt=r.length,et=[],i=0;i<yt;i++){var p=-1,w=-1,k=-1,d=-1;for(ct=r[i].predecessor.length,it=parseInt(r[i].taskId),currentIndex=i,u=0;u<ct;u++)r[i].predecessor[u].from==it&&(p==-1?r[i].predecessor[u].offset?(p=r[i].predecessor[u].to+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,k=r[i].predecessor[u].predecessorsType):(p=r[i].predecessor[u].to,k=r[i].predecessor[u].predecessorsType):r[i].predecessor[u].offset?(p=p+","+r[i].predecessor[u].to+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,k=k+","+r[i].predecessor[u].predecessorsType):(p=p+","+r[i].predecessor[u].to,k=k+","+r[i].predecessor[u].predecessorsType)),r[i].predecessor[u].to==it&&(w==-1?r[i].predecessor[u].offset?(w=r[i].predecessor[u].from+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,d=r[i].predecessor[u].predecessorsType):(w=r[i].predecessor[u].from,d=r[i].predecessor[u].predecessorsType):r[i].predecessor[u].offset?(w=w+","+r[i].predecessor[u].from+":"+r[i].predecessor[u].offset+r[i].predecessor[u].offsetDurationUnit,d=d+","+r[i].predecessor[u].predecessorsType):(w=w+","+r[i].predecessor[u].from,d=d+","+r[i].predecessor[u].predecessorsType));w==-1&&(w=null,d=null);p==-1&&(p=null,k=null);f.push({from:w,fromPredecessor:d,taskid:it,to:p,toPredecessor:k,currentIndex:currentIndex,slack:null,ff:0,fs:0,enddate:null,fsslack:0});s.push(parseInt(it))}for(pt=f.length,ut=0,l=0;l<pt;l++)f[l].to||(wt=f[l].taskid,ut=tt.indexOf(wt.toString()),ft=a._getDuration(h[ut].endDate,v,"minute",h[ut].isAutoSchedule),f[l].slack=ft,f[l].fs=-1,f[l].enddate=h[ut].endDate,et.push({fromdata:f[l].from,todateID:f[l].taskid,fromDataPredecessor:f[l].fromPredecessor}));for(ot=0;ot<et.length;ot++)vt.push(et[ot]),a._slackCalculation(vt,f,s,v,h,tt);c=a._finalCriticalPath(f,at,h,tt);this.criticalPathCollection=c;this.detailPredecessorCollection=f;this.collectionTaskId=s;t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),a._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!0}else{var c=[],f=[],s=[];t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),this._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!0}if(n==!1){var c=[],f=[],s=[],bt=0;for(this.isCriticalPathEnable=!1,st=0;st<a.criticalPathCollection.length;st++)bt=tt.indexOf(a.criticalPathCollection[st].toString()),h[bt].isCritical=!1;t?t&&this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s):(this._$ganttchartHelper.ejGanttChart("criticalDataMapping",c,n,f,s),this._$ganttchartHelper.ejGanttChart("criticalPathColor",c,n,f,s),this._$treegridHelper.ejTreeGrid("refresh"));a._enableDisableCriticalIcon=!1}},_finalCriticalPath:function(n,t,i,r){for(var o=this,e=[],u,f=0;f<n.length;f++)u=r.indexOf(n[f].taskid.toString()),i[u].durationUnit=="day"?(i[u].slack=n[f].slack/60/(o._secondsPerDay/3600),i[u].slack=i[u].slack%1!=0?i[u].slack.toFixed(2)+" day":i[u].slack+" day"):i[u].durationUnit=="hour"?(i[u].slack=n[f].slack/60,i[u].slack=i[u].slack%1!=0?i[u].slack.toFixed(2)+" hour":i[u].slack+" hour"):i[u].slack=n[f].slack+" minutes",n[f].slack<=0&&i[u].status<100&&(i[u].isCritical=!0,e.push(n[f].taskid));return e.concat(t)},_slackCalculation:function(n,t,i,u,f,e){var l=this,w=n[0].fromdata.split(","),p=n[0].fromDataPredecessor.split(","),s=[],o,c,b=w.length,y,v,h,a;for(xx=0;xx<b;xx++)s=w[xx].split(":"),o=i.indexOf(parseInt(s[0])),c=i.indexOf(parseInt(n[0].todateID)),p[xx]=="FS"&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexfromtaskid].endDate>f[indexenddate].startDate?-l._getDuration(f[indexenddate].startDate,f[indexfromtaskid].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,f[indexenddate].startDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="SS"&&(indexfromtaskid=e.indexOf(s[0].toString()),f[indexfromtaskid].isAutoSchedule?(indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexfromtaskid].startDate>f[indexenddate].startDate?-l._getDuration(f[indexenddate].startDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].startDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=t[c].slack+h<0?0:t[c].slack+h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate)):f[indexfromtaskid].isAutoSchedule||(enddate=0,h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&t[o].slack!=0&&(t[o].slack=h)),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="FF"&&(t[c].fs==1||t[c].ff==1||t[c].fs==-1?(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),t[c].fs==1?(y=f[indexenddate].endDate,v=t[c].slack):t[c].ff==1&&(y=f[indexenddate].endDate,v=t[c].slack),t[c].fs==-1&&(y=t[c].enddate,v=t[c].slack),h=y>f[indexfromtaskid].endDate?-l._getDuration(f[indexfromtaskid].endDate,y,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(y,f[indexfromtaskid].endDate,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?(s.length<=1?t[o].slack=v-h<0?0:v-h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack-h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].ff=1,t[o].enddate=y,t[o].fsslack=v):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?t[o].slack=v-h<0?0:v-h:s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack-h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].ff=1,t[o].enddate=y,t[o].fsslack=v)):(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?s.length<=1?r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&(t[o].slack=h):s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)):t[o].slack>h&&t[o].slack!=0&&(s.length<=1?r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&(t[o].slack=h):s.length>1&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0))),t[o].ff=1),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),p[xx]=="SF"&&(indexfromtaskid=e.indexOf(s[0].toString()),f[indexfromtaskid].isAutoSchedule?r.isNullOrUndefined(t[o].slack)?(s.length<=1?r.isNullOrUndefined(t[c].to)?(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack=h):r.isNullOrUndefined(t[c].to)||(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].startDate?-l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack=t[c].slack+h<0?0:t[c].slack+h):s.length>1&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].endDate?f[indexfromtaskid].startDate>f[indexenddate].endDate?-l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0)),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):(s.length<=1?(r.isNullOrUndefined(t[c].to)?(indexfromtaskid=e.indexOf(s[0].toString()),h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule)):r.isNullOrUndefined(t[c].to)||(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].startDate?-l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule)),t[o].slack>h&&t[o].slack!=0&&(r.isNullOrUndefined(t[c].to)?t[o].slack=h:r.isNullOrUndefined(t[c].to)||(t[o].slack=t[c].slack+h<0?0:t[c].slack+h))):s.length>1&&(indexfromtaskid=e.indexOf(s[0].toString()),indexenddate=e.indexOf(n[0].todateID.toString()),h=f[indexenddate].endDate>f[indexfromtaskid].endDate?f[indexfromtaskid].startDate>f[indexenddate].endDate?-l._getDuration(f[indexenddate].endDate,f[indexfromtaskid].startDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].startDate,f[indexenddate].endDate,"minute",f[indexfromtaskid].isAutoSchedule):l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),t[o].slack>h&&t[o].slack!=0&&(a=s[1].indexOf("hour")!=-1?parseInt(s[1])*60:s[1].indexOf("day")!=-1?parseInt(s[1])*(l._secondsPerDay/3600)*60:parseInt(s[1]),t[o].slack=t[c].slack+h,t[o].slack=t[o].slack-a,t[o].slack<0&&(t[o].slack=0))),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=f[indexfromtaskid].startDate):f[indexfromtaskid].isAutoSchedule||(h=l._getDuration(f[indexfromtaskid].endDate,u,"minute",f[indexfromtaskid].isAutoSchedule),r.isNullOrUndefined(t[o].slack)?t[o].slack=h:t[o].slack>h&&t[o].slack!=0&&(t[o].slack=h)),f[indexfromtaskid].endDate>=u&&f[indexfromtaskid].endDate<=u&&(t[o].slack=0)),t[o].from&&n.push({fromdata:t[o].from,todateID:t[o].taskid,fromDataPredecessor:t[o].fromPredecessor});n&&(n.splice(0,1),n.length>0&&l._slackCalculation(n,t,i,u,f,e))},setSplitterPosition:function(t){var i=this,o=i.model,e=0,f;if(ganttWidth=parseInt(i._ganttWidth)-i._totalBorderWidth,isPercentage=!1,!r.isNullOrUndefined(t)){if(t.indexOf("%")!=-1?(u=parseInt(t),isPercentage=!0):(u=parseInt(t)/i._ganttWidth*100,isPercentage=!1),u=isNaN(u)?0:u,u<=100)u=u<0?0:u,e=100-u-900/ganttWidth,e<=0?(isPercentage?i.splitterPosition("100%"):i.splitterPosition(ganttWidth.toString()),u=100-900/ganttWidth,e=0):e>0&&(isPercentage?i.splitterPosition(Math.round(u)+"%"):i.splitterPosition(Math.round(u*i._ganttWidth/100).toString())),f=n("#e-ejSpliter"+i._id).ejSplitter("instance"),f.model.properties[0].paneSize=u+"%",f.model.properties[1].paneSize=e+"%",f.refresh(),i._$treegridHelper.ejTreeGrid("refreshScroller",Math.round(u*ganttWidth/100)),i._$ganttchartHelper.ejGanttChart("refreshScroller",f.model.properties[1].paneSize-1),i._clearContextMenu();else{var f=n("#e-ejSpliter"+i._id).ejSplitter("instance"),u=f.model.properties[0].paneSize,e=f.model.properties[1].paneSize;parseInt(e)==0?isPercentage?i.splitterPosition("100%"):i.splitterPosition(ganttWidth.toString()):isPercentage?i.splitterPosition(Math.round(parseInt(u)/ganttWidth*100)+"%"):i.splitterPosition(u.toString())}i._splitterPosition(i.splitterPosition())}},_showTooltip:function(n){var t=this;this.model.enableTaskbarTooltip=n;t._$ganttchartHelper.ejGanttChart("showTooltip",n)},_showEditingTooltip:function(n){var t=this;this.model.enableTaskbarDragTooltip=n;t._$ganttchartHelper.ejGanttChart("showEditingTooltip",n)},_ganttChartEditing:function(n){var t=this;t.model.allowGanttChartEditing=n;t._$ganttchartHelper.ejGanttChart("ganttChartEditing",n)},_resizeProgressbar:function(n){var t=this;t.model.enableProgressBarResizing=n;t._$ganttchartHelper.ejGanttChart("resizeProgressbar",n)},_milestoneTemplate:function(n){var t=this;t.model.milestoneTemplate=n;t._$ganttchartHelper.ejGanttChart("changeMilestoneTemplate",t.model.milestoneTemplate)},_taskbarTemplate:function(n){var t=this;t.model.taskbarTemplate=n;t._$ganttchartHelper.ejGanttChart("changeTaskbarTemplate",t.model.taskbarTemplate)},_parentTaskbarTemplate:function(n){var t=this;t.model.parentTaskbarTemplate=n;t._$ganttchartHelper.ejGanttChart("changeParentTaskbarTemplate",t.model.parentTaskbarTemplate)},_sendSortingRequest:function(n){var r=this,t,i;t=n.sortedColumns[0].field;i=n.sortedColumns[0].direction;r._$treegridHelper.ejTreeGrid("sortColumn",t,i)},_sortingRequest:function(n){var t=this,i=t.model;t.model.allowSorting=n;t._$treegridHelper.ejTreeGrid("sortSetting",n)},_columnIndex:function(n){var t=this;t._$treegridHelper.ejTreeGrid("columnIndex",n)},sendCancelRequest:function(){var t=this,i=n("#"+t._id+"_toolbarItems");t._$treegridHelper.ejTreeGrid("cancelEditCell");t.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&t._disabledToolItems.push(n(i).find(".e-cancel").parent()[0]);t.model.toolbarSettings.toolbarItems.indexOf("save")!==-1&&t._disabledToolItems.push(n(i).find(".e-saveitem").parent()[0]);n(i).ejToolbar("disableItem",t._disabledToolItems);t._disabledToolItems=[]},_sendAddRequest:function(){var t=this,i=t._columns,f=i.length,n=0,u={},r={};for(t._isinAddnewRecord=!0,n;n<f;n++)i[n].mappingName&&(u[i[n].mappingName]="");r.data=u;r.requestType="add";t.renderedEditDialog(r)},_sendEditRequest:function(t){var i=this,e=i.model,u={},f;r.isNullOrUndefined(t)?(i._currentTrIndex=e.selectionMode=="row"?this.selectedRowIndex():i._rowIndexOfLastSelectedCell,i._$currentTr=n(i._$treegridHelper.ejTreeGrid("getRows")).eq(this.selectedRowIndex())):(i._currentTrIndex=t.index(),i._$currentTr=t);f=i.getUpdatedRecords()[i._currentTrIndex];u.data=f;u.requestType="beginedit";u.data&&i.renderedEditDialog(u)},_updateAddData:function(n,t){var u=this,i=this.model,f,e;n[i.taskIdMapping]||(f=i.flatRecords.length,f=u._getNewTaskId(f),n[i.taskIdMapping]=f);i.taskNameMapping&&!n[i.taskNameMapping]&&(n[i.taskNameMapping]=u._newTaskTexts.newTaskName+" "+n[i.taskIdMapping]);n[i.startDateMapping]||(n[i.startDateMapping]=i.scheduleStartDate);i.durationMapping&&r.isNullOrUndefined(n[i.durationMapping])&&(n[i.endDateMapping]||(n[i.durationMapping]="5"));i.progressMapping&&(n[i.progressMapping]=n[i.progressMapping]?n[i.progressMapping]>100?100:n[i.progressMapping]:0);!n[i.endDateMapping]&&i.endDateMapping&&(n[i.durationMapping]||(e=u._getDateFromFormat(i.scheduleStartDate),e.setDate(e.getDate()+4),n[i.endDateMapping]=r.format(e,this.model.dateFormat,this.model.locale)));i.enableWBS&&!n.WBS&&(n.WBS=u._getNewWBSid(t));i.enableWBS&&!n.WBS&&(n.WBS=u._getNewWBSid(t));r.isNullOrUndefined(i.selectedItem)||(n.taskType=i.selectedItem.taskType,n.effortDriven=i.selectedItem.effortDriven)},_sendSaveRequest:function(t){var e={},pt=document,i=this,f=i.model,v,wt,ti,p,tt,l,it,k,d,rt,ft,u={},c,et,w,ot,a,o,ut,st,bt,ht,s,vt,kt,g,dt,h,y,b,yt,gt,nt,ni;if(this._duplicate=!1,this._wrongenddate=!1,t==="Add"){if(v=pt.querySelectorAll("#"+i._id+"GeneralAddForm","#"+i._id+"PredecessorAddForm","#"+i._id+"ReosurceAddForm","#"+i._id+"CustomFieldsAddForm"),wt=v&&v.length,it="Add",k="#treegrid"+i._id+"predecessorAdd",d="#treegrid"+i._id+"resourceAdd",rt="#treegrid"+i._id+"customFieldAdd",ft="#"+i._id+"AddAreaNotes",p=n("#"+i._id+"taskId"+it),tt=r.TreeGrid.getColumnByField(i._columns,"taskId"),i._cellEditColumn=tt,c=i._addDialogGeneralColumns,et=c.length,w=i._addDialogCustomColumns,ot=w.length,tt&&p.length>0&&(l=i.getCurrentEditCellData(p,tt.dropdownData)),i.model.ids.indexOf(l)!=-1&&l?this._duplicate=!0:l&&(this._duplicate=!1),!this.addFormValidate())return!0}else if(v=pt.getElementById(i._id+"GeneralEditForm"),wt=v&&v.length,k="#treegrid"+i._id+"predecessorEdit",d="#treegrid"+i._id+"resourceEdit",rt="#treegrid"+i._id+"customFieldEdit",ft="#"+i._id+"EditAreaNotes",it="Edit",c=i._editDialogGeneralColumns,et=c.length,w=i._editDialogCustomColumns,ot=w.length,!this.editFormValidate())return!0;if(ti=n(v).closest("div"),this._duplicate)return alert(i._alertTexts.idValidationAlert),!0;for(o=0;o<et;o++)if(p=n(v).find("#"+i._id+c[o].field+it),p.length>0){if(i._cellEditColumn=c[o],i._cellEditColumn.field=="duration"||i._cellEditColumn.field=="startDate"||i._cellEditColumn.field=="endDate"){e[c[o].mappingName]=this._editedDialogRecord[i._cellEditColumn.field];i._cellEditColumn.field=="duration"&&f.durationUnitMapping&&(e[f.durationUnitMapping]=this._editedDialogRecord.durationUnit);continue}l=i.getCurrentEditCellData(p,c[o].dropdownData);i._isinAddnewRecord===!1&&c[o].mappingName===i.model.predecessorMapping&&(u.previousValue=i._updatePredecessorValue(e,l));c[o].mappingName===i.model.progressMapping&&r.isNullOrUndefined(l)&&(l=0);i._cellEditColumn.field=="work"||i._cellEditColumn.field=="taskType"||i._cellEditColumn.field=="effortDriven"?e[c[o].field]=l:e[c[o].mappingName]=l}if(n(rt).length)for(a=n(rt).ejTreeGrid("model.updatedRecords"),o=0;o<ot;o++)e[w[o].mappingName]=w[o].editType=="dropdownedit"?a[o].value:a[o].text;if(ut=n(ft),ut.length&&(e[f.notesMapping]=ut.ejRTE("getHtml"),e[f.notesMapping+"Text"]=ut.ejRTE("getText")),date1=i._getDateFromFormat(e[f.startDateMapping]),date2=i._getDateFromFormat(e[f.endDateMapping]),st=0,date1&&date2&&(st=date2.getTime()-date1.getTime()),this._wrongenddate=st<0?!0:!1,this._wrongenddate)return alert(i._alertTexts.dateValidationAlert),!0;if(bt=n(d),ht=!0,bt.length>0){var ct=[],a=n(d).ejTreeGrid("option","dataSource"),ii=n(d).ejTreeGrid("option","selectedRowIndex");if(n.each(a,function(u,o){var l,c,v,y;if(o.name!=null&&o.name!="")if(c=n.map(f.resources,function(n,t){if(n[f.resourceIdMapping].toString()==o.name)return t}),l=f.resources[c[0]],t==="Add")ct.push(l[f.resourceIdMapping]),l[f.resourceUnitMapping]=o.unit,i._newRecordResourceCollection.push(l);else{r.isNullOrUndefined(f.selectedItem.resourceInfo)&&(f.selectedItem.resourceInfo=[]);var p=i.model,h=p.selectedItem,s=h.resourceInfo,w=p.resourceIdMapping;if((r.isNullOrUndefined(s)||s.length!=a.length)&&(i._isResourceAddedOrRemoved=!0),s)for(c=0;c<s.length;c++)if(s[c][w]===l[w]){v=c;break}else v=-1;else s=[];(r.isNullOrUndefined(v)||v==-1)&&s.length!=a.length&&(y=n.extend({},l),p.selectedItem._updateResourceUnit(l,y,f.resourceUnitMapping),y[f.resourceUnitMapping]=100,s.push(y));s[u][f.resourceUnitMapping]!=a[u].unit&&(i._isExistingUnitIsUpdated=!0);s[u][f.resourceIdMapping]=parseInt(a[u].name);s[u][f.resourceNameMapping]=f.resources[parseInt(a[u].name)-1][f.resourceNameMapping];s[u][f.resourceUnitMapping]=a[u].unit;ct.push(s[u]);i._isExistingUnitIsUpdated&&(h.isAutoSchedule&&h.taskType!="fixedDuration"?h._updateDurationWithWork(i):h._updateWorkWithDuration(i),e.Duration=h.duration,e.work=h.work,i._editedDialogRecord.duration=h.duration,i._editedDialogRecord.work=h.work,i._isExistingUnitIsUpdated=!1)}else return ht=!1,!1}),ht)e[f.resourceInfoMapping]=ct;else return alert(i._alertTexts.dialogResourceAlert),!0}e[f.taskIdMapping]||t!=="Edit"||(e[f.taskIdMapping]=i._editedDialogRecord.taskId);u.data=e;var lt=[],at=!1;if(f.predecessorMapping&&(t==="Edit"?(at=f.editDialogFields.length===0?!0:!1,lt=n.grep(f.editDialogFields,function(n){return n.field===f.predecessorMapping})):t==="Add"&&(at=f.addDialogFields.length===0?!0:!1,lt=n.grep(f.addDialogFields,function(n){return n.field===f.predecessorMapping}))),lt.length>0||at){if(s=[],vt=!0,n(k).ejTreeGrid("model.isEdit")&&n(k).ejTreeGrid("saveCell"),s=n(k).ejTreeGrid("option","dataSource"),n.each(s,function(n,t){(r.isNullOrUndefined(t.id)||r.isNullOrUndefined(t.name)||r.isNullOrUndefined(t.type)||!(t.id.length>0&&t.name.length&&t.type.length))&&(vt=!1)}),vt){for(kt=[],g=[],types=i._predecessorCollectionText,h=0;h<s.length;h++){for(y={},y.from=e.taskID,y.to=s[h].id,y.isdrawn=!1,y.offset=s[h].offset,b=0;b<types.length;b++)if(s[h].type==types[b].text){y.predecessorType=types[b].id;dt=types[b].id;break}yt=s[h].id+dt;s[h].offset=parseFloat(s[h].offset);s[h].offset!==0&&(yt+=s[h].offset<0?s[h].offset.toString():"+"+s[h].offset.toString());g.push(yt);kt.push(y)}u.predecessorString=g}else return alert(i._alertTexts.predecessorAddingValidationAlert),!0;if(i._isinAddnewRecord===!1)if(u.currentRecord=f.selectionMode=="row"?this.selectedItem():f.updatedRecords[i._rowIndexOfLastSelectedCell],i._editedPredecessorValidation(u))u.previousValue=i._updatePredecessorValue(e,g.join(","));else return alert(i._alertTexts.predecessorEditingValidationAlert),!0;e[f.predecessorMapping]=g.join(",")}if(u.requestType=r.TreeGrid.Actions.Save,u.recordIndex=this.selectedRowIndex()!==-1?this.selectedRowIndex():-1,i._trigger("actionBegin",u))return!0;if(t==="Edit")u._cModifiedData=i._updateRecord(e),i._editedDialogRecord&&(u._cModifiedData.startDate=new Date(i._editedDialogRecord.startDate),u._cModifiedData.endDate=new Date(i._editedDialogRecord.endDate),u._cModifiedData.duration=i._editedDialogRecord.duration,u._cModifiedData.durationUnit=i._editedDialogRecord.durationUnit,i._isResourceAddedOrRemoved&&i._updateResourceRelatedFields(u._cModifiedData),f.durationUnitMapping&&(u._cModifiedData.item[f.durationUnitMapping]=i._editedDialogRecord.durationUnit),i._editedDialogRecord=null),u.data[f.endDateMapping]&&(r.isNullOrUndefined(u.data[f.durationMapping])||u.data[f.durationMapping]==="")&&i._isDurationUpdated==!1&&(u._cModifiedData.startDate=i._checkStartDate(u._cModifiedData.startDate,u._cModifiedData),u._cModifiedData.endDate=i._checkEndDate(u._cModifiedData.endDate,u._cModifiedData),u._cModifiedData._calculateDuration(this)),u._cModifiedData.isMilestone=u._cModifiedData.duration==0&&u._cModifiedData.startDate.getTime()==u._cModifiedData.endDate.getTime()?!0:!1,u.data[f.baselineStartDateMapping]&&u.data[f.baselineEndDateMapping]&&(gt=i._getDateFromFormat(u.data[f.baselineStartDateMapping]),nt=i._getDateFromFormat(u.data[f.baselineEndDateMapping]),nt&&nt.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,nt),u._cModifiedData.baselineStartDate=this._checkBaseLineStartDate(gt),u._cModifiedData.baselineEndDate=this._checkBaseLineEndDate(nt),u._cModifiedData.baselineLeft=u._cModifiedData._calculateBaselineLeft(this),u._cModifiedData.baselineRight=u._cModifiedData._calculateBaselineRight(this),u._cModifiedData.baselineWidth=u._cModifiedData._calculateBaseLineWidth(this)),u.modifiedRecord=u._cModifiedData,i.actionComplete(u);else if(t==="Add"&&(ni=i._addPosition!=null?i._addPosition:f.editSettings.rowPosition,!i.addRecord(e,ni)))return alert(i._alertTexts.predecessorEditingValidationAlert),!0;return i._cModifiedData=null,i._cAddedRecord=null,i._primaryKeyValues=[],i._isinAddnewRecord=!1,i._isResourceAddedOrRemoved=!1,!1},_recordReturnerByID:function(n){for(var r=this,i=r.model.flatRecords,t=0;t<i.length;t++)if(i[t].taskId.toString()===n.toString())return i[t];return null},_editedPredecessorValidation:function(t){var h=this,c=t.currentRecord.taskId,i,l=t.predecessorString.join(","),u,e,o,s,y,f,p,w;if(l.length>0)for(u=h._idFromPredecessor(l),e=0;e<u.length;e++){if(o=t.currentRecord,o&&o.parentItem&&u.indexOf(o.parentItem.taskId.toString())!==-1)return!1;var b=u.slice(0),a=[],v=!0;if(n.each(b,function(n,t){a.indexOf(t)===-1?a.push(t):v=!1}),v===!1)return!1;for(i=u[e],s=[],y=u.slice(0),y.splice(e,1);i!==null;)if(f=[],s.indexOf(i)===-1){if((currentRecord=h._recordReturnerByID(i),r.isNullOrUndefined(currentRecord))||(!r.isNullOrUndefined(currentRecord.predecessor)&&currentRecord.predecessor.length>0&&n.each(currentRecord.predecessor,function(n,t){currentRecord.taskId.toString()!==t.from&&(f.push(t.from.toString()),p=n)}),c.toString()===currentRecord.taskId.toString()||f.indexOf(c.toString())!==-1))return!1;if(s.push(i),!r.isNullOrUndefined(currentRecord.predecessor)&&currentRecord.predecessor.length>0){if(f.length>1?w=this._predecessorValidation(f,t):f.length==1&&(i=currentRecord.predecessor[p].from),w===!1)return!1}else break}else break}return!0},_predecessorValidation:function(t,i){for(var f,s,e,h=this,o=i.currentRecord.taskId,u=0;u<t.length;u++)for(currentId=t[u],f=[],s=t.slice(0),s.splice(u,1);currentId!==null;)if(e=[],f.indexOf(currentId)===-1){if((currentRecord=h._recordReturnerByID(currentId),r.isNullOrUndefined(currentRecord))||(!r.isNullOrUndefined(currentRecord.predecessor)&&currentRecord.predecessor.length>0&&n.each(currentRecord.predecessor,function(n,t){currentRecord.taskId.toString()!==t.from&&e.push(t.from.toString())}),o.toString()===currentRecord.taskId.toString()||e.indexOf(o.toString())!==-1))return!1;if(f.push(currentId),!r.isNullOrUndefined(currentRecord.predecessor)&&currentRecord.predecessor.length>0)currentId=currentRecord.predecessor[0].from;else break}else break;return!0},_sendCancelRequest:function(){var t=this,u=t.model,i={};u.dateFormat.toLowerCase().indexOf("hh")!=-1?n("#"+t._id+"EditForm").find(".e-datepicker").ejDateTimePicker("destroy"):n("#"+t._id+"EditForm").find(".e-datepicker").ejDatePicker("destroy");i.requestType=r.TreeGrid.Actions.Cancel;t._$treegridHelper.ejTreeGrid("processBindings",i);t._primaryKeyValues=[];t.model.currentData=null},_updatePredecessorValue:function(n,t){var f=this,r,e,l=0,s,h=[],o=0,i=model.selectionMode=="row"?f.selectedItem():model.updatedRecords[f._rowIndexOfLastSelectedCell],u,c;for(r=i.predecessor,t.length>0&&(e=i._calculatePredecessor(t,this._durationUnitEditText,this.model.durationUnit)),e&&(l=e.length),u=0,c=0,r&&(c=r.length),u=0;u<c;u++)s=r[u],s.from===i.taskId.toString()&&h.push(s);for(o=0;o<l;o++)h.push(e[o]);return i.predecessor=h,f.model.predecessorMapping&&(i.item[f.model.predecessorMapping]=t,i.predecessorsName=t),r},getCurrentEditCellData:function(t,i){var u=this,o=u.model,e,f;if(n("#"+u._id+"EditForm").length||n("#"+u._id+"GeneralAddForm").length||n("#"+u._id+"GeneralEditForm").length){f="";switch(u._cellEditColumn.editType){case r.TreeGrid.EditingType.String:f=t.val();break;case r.TreeGrid.EditingType.Numeric:f=t.ejNumericTextbox("getValue");break;case r.TreeGrid.EditingType.Dropdown:f=t.attr("id").indexOf("resourceInfo")>0?u._getSelectedItem(t.ejDropDownList("model.selectedItems"),i):t.attr("id").indexOf("taskMode")>0?t.ejDropDownList("model.value")=="true"?!0:!1:t.ejDropDownList("model.value");break;case r.TreeGrid.EditingType.Boolean:f=t.is(":checked");break;case r.TreeGrid.EditingType.DatePicker:e=t.ejDatePicker("model.value");f=u._cellEditColumn&&!u._cellEditColumn.format?u.getFormatedDate(e):e;break;case r.TreeGrid.EditingType.DateTimePicker:e=t.ejDateTimePicker("model.value");f=u._cellEditColumn&&!u._cellEditColumn.format?f=u.getFormatedDate(e):e;break;case r.TreeGrid.EditingType.Maskedit:f=t.ejMaskEdit("model.value")}return f}return null},_getSelectedItem:function(t,i){var r=0,f=t.length,u=[];if(i)for(r=0;r<f;r++)n.each(i,function(n,i){t[r]===n&&u.push(i)});return u},_getDropDownText:function(t,i){var s,u,o,f,h=t.dropdownData,e;for(i=i.split(","),selectedDropDownText=[],s=i.length,u=t.editParams,u&&u.fields?(f=u.fields.text?u.fields.text:"text",o=u.fields.value?u.fields.value:"value"):(o="value",f="text"),e=0;e<s;e++)n.each(h,function(n,t){if(r.isNullOrUndefined(t[o])){if(i[e]===t[f].toString())return selectedDropDownText.push(t[f].toString()),!1}else if(i[e]===t[o].toString())return selectedDropDownText.push(t[f]),!1});return selectedDropDownText.join(",")},_updateRecord:function(t){var f=this,e=this.model,r=f._columns,c,i=0,l=e.selectionMode=="row"?this.selectedRowIndex():f._rowIndexOfLastSelectedCell,u=f.getUpdatedRecords()[l],s,o,h;if(f._isUpdateOffset=!1,e.editDialogFields.length>0){for(s=[],o=0;o<e.editDialogFields.length;o++)h=n.grep(f._columns,function(n){return n.mappingName===e.editDialogFields[o].field}),h.length&&s.push(h[0]);r=s}for(c=r.length,i=0;i<c;i++)r[i].field.toString()!=="predecessor"&&(r[i].field=="startDate"&&u[r[i].field].getTime()!=t[r[i].mappingName].getTime()&&(f._isUpdateOffset=!0),r[i].field=="endDate"&&u[r[i].field].getTime()!=t[r[i].mappingName].getTime()&&(f._isUpdateOffset=!0),r[i].field=="duration"&&u[r[i].field]!=t[r[i].mappingName]&&(f._isUpdateOffset=!0),r[i].field=="taskMode"&&(u.isAutoSchedule=!t[e.taskSchedulingModeMapping]),r[i].field!="work"&&r[i].field!="taskType"&&(u[r[i].field]=t[r[i].mappingName],u.item[r[i].mappingName]=t[r[i].mappingName]),(r[i].field=="work"||r[i].field=="taskType"||r[i].field=="effortDriven")&&(u[r[i].field]=t[r[i].field]),r[i].field.toString()==="resourceInfo"&&f._updateResourceName(u),r[i].field.toString()==="notesText"&&(u.notes=t[e.notesMapping],u.item[e.notesMapping]=t[e.notesMapping]));return u},_sendIndentRequest:function(){var t=this,i=t.model,n=t.getCurrentData(),f={},c={},u,s=!1,y=t._$treegridHelper.ejTreeGrid("instance"),l,o,e,p,h,a,v,w;if(t.cancelEditCell(),r.isNullOrUndefined(n))alert(t._alertTexts.indentAlert);else if(u=i.flatRecords[i.flatRecords.indexOf(n)-1],f.data=n,f.requestType="indent",!t._trigger("actionBegin",f)){if(n.parentItem?(l=n.parentItem.childRecords.indexOf(n),n.parentItem.childRecords.splice(l,1),i.parentTaskIdMapping||n.parentItem.item[i.childMapping].splice(l,1)):this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?(o=this.dataSource().dataSource.json.indexOf(n.item),i.parentTaskIdMapping||this.dataSource().dataSource.json.splice(o,1)):t._isDataManagerUpdate&&(o=t._jsonData.indexOf(n.item),i.parentTaskIdMapping||(t._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDatamanagerData"),t._jsonData.splice(o,1))):(o=this.dataSource().indexOf(n.item),i.parentTaskIdMapping||this.dataSource().splice(o,1)),n.level===u.level?u.childRecords?u.expanded||(u.childRecords.splice(u.childRecords.length,0,n),n.parentItem=u,i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.taskId:u.item[i.childMapping].splice(u.childRecords.length,0,n.item)):(u.childRecords=[],u.childRecords.push(n),u.expanded=!0,u.taskType=r.Gantt.TaskType.FixedDuration,u.effortDriven="false",n.parentItem=u,u.item[i.childMapping]=[],i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.taskId:u.item[i.childMapping].push(n.item)):u.level-n.level==1?(u.parentItem.childRecords.splice(u.parentItem.childRecords.length,0,n),i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=u.parentItem.taskId:u.parentItem.item[i.childMapping].splice(u.parentItem.childRecords.length,0,n.item),n.parentItem=u.parentItem):u.level-n.level>1&&(e=t.getParentItem(u,n.level),e.childRecords.splice(e.childRecords.length,0,n),i.parentTaskIdMapping?n.item[i.parentTaskIdMapping]=e.taskId:e.item[i.childMapping].splice(e.childRecords.length,0,n.item),n.parentItem=e),n.parentItem.isMilestone&&(n.parentItem.isMilestone=!1),u.hasChildRecords=u.childRecords?u.childRecords.length>0:!1,n.level+=1,(y._searchString.length>0||y.model.sortSettings.sortedColumns.length>0)&&(s=!0),t.updateLevel(n,1,s),s||t.refreshGanttRecord(n),u.level===0&&i.parentRecords.indexOf(u)===-1&&i.parentRecords.push(u),n.level>0&&i.parentRecords.indexOf(n)!==-1&&(p=i.parentRecords.indexOf(n),i.parentRecords.splice(p,1)),n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n),n.parentItem&&n.parentItem.predecessor&&i.predecessorMapping&&t._updatePredecessorOnIndentOutdent(n.parentItem),s||t.refreshGanttRecord(u),t.getExpandStatus(n)||(h={},h.expanded=!0,h.data=n.parentItem,t.expanding(h)),t._$treegridHelper.ejTreeGrid("setUpdatedRecords",i.flatRecords,i.updatedRecords,i.ids,i.parentRecords,this.dataSource()),s&&(f.requestType="indent",t._$treegridHelper.ejTreeGrid("processBindings",f),a={},a.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",a),t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),t._$ganttchartHelper.ejGanttChart("setUpdatedRecords",i.currentViewData,i.updatedRecords,i.flatRecords,i.ids),t._$ganttchartHelper.ejGanttChart("refreshHelper",i.currentViewData,i.updatedRecords,t._totalCollapseRecordCount),t.updateAltRow(i.updatedRecords,0,1)),i.predecessorMapping&&(t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection()),v=i.updatedRecords.indexOf(n),w=t.getGanttChartRows(),f={rowElement:w.eq(v),data:t.model.selectedItem,recordIndex:v},t._$ganttchartHelper.ejGanttChart("selectRows",f.recordIndex),t._$treegridHelper.ejTreeGrid("selectRows",f.recordIndex),this.selectedItem(f.data),this.selectedRowIndex(f.recordIndex),i.allowSelection&&i.selectionMode!="cell"&&t.updateIndentOutdentOption(n),i.enableWBS){var b=n.parentItem.WBS,k=n.parentItem.childRecords.length,d=[n];t.reCalculateWBS(d,k,b);t.updateWBSdetails(n.parentItem)}c.data=n;c.requestType="indent";this._trigger("actionComplete",c)}this.isCriticalPathEnable==!0&&(t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!1,this.collectionTaskId),this.showCriticalPath(!0))},_updatePredecessorOnIndentOutdent:function(n){for(var o,i=this,h=n.predecessor.length,u=n.predecessor,f,t,e,s=[],r=0;r<h;r++)u[r].to===n.taskId.toString()?(t=i.model.flatRecords[i.model.ids.indexOf(u[r].from)],f=t.predecessor.indexOf(u[r]),t.predecessor.splice(f,1),e="parent"+t.taskId+"child"+n.taskId,i._$ganttchartHelper.ejGanttChart("removeConnectorline",e)):u[r].from===n.taskId.toString()&&(t=i.model.flatRecords[i.model.ids.indexOf(u[r].to)],n.childRecords.indexOf(t)!==-1?(f=t.predecessor.indexOf(u[r]),t.predecessor.splice(f,1),o=i._predecessorToString(t.predecessor,t),t.item[model.predecessorMapping]=o,t.predecessorsName=o,model.enableWBS&&model.enableWBSPredecessor&&i._$treegridHelper.ejTreeGrid("updateWBSPredecessor",t),e="parent"+n.taskId+"child"+t.taskId,i._$ganttchartHelper.ejGanttChart("removeConnectorline",e),i.refreshGanttRecord(t)):s.push(u[r]));n.predecessor=s;n.item[model.predecessorMapping]="";n.predecessorsName="";model.enableWBS&&model.enableWBSPredecessor&&(n.WBSPredecessor="",n.item.WBSPredecessor="")},_removePredecessor:function(n,t){var r=this,o=n.length,u=0,f=r.model,i,e;for(u;u<o;u++)n[u].from!==t.taskId.toString()?i=r.model.flatRecords[r.model.ids.indexOf(n[u].from)]:n[u].to!==t.taskId.toString()&&(i=r.model.flatRecords[r.model.ids.indexOf(n[u].to)]),i&&(e=i.predecessor.indexOf(n[u]),e!==-1&&i.predecessor.splice(e,1),i.item[f.predecessorMapping]&&(i.item[f.predecessorMapping]=r._predecessorToString(i.predecessor,i),i.predecessorsName=i.item[f.predecessorMapping],f.enableWBS&&f.enableWBSPredecessor&&r._$treegridHelper.ejTreeGrid("updateWBSPredecessor",i),r.refreshGanttRecord(i)))},_predecessorToString:function(n,t){var e=this,u=[],i=0,f=n.length,r;for(i;i<f;i++)t.taskId.toString()!==n[i].from&&(r=n[i].from+n[i].predecessorsType,n[i].offset=isNaN(n[i].offset)?0:n[i].offset,n[i].offset!==0&&(n[i].offset<0?r+=n[i].offset.toString()+"d":n[i].offset>0&&(r+="+"+n[i].offset.toString()+"d")),u.push(r));return u.join(",")},getParentItem:function(n,t){var i=this;return n.parentItem.level===t?n.parentItem:i.getParentItem(n.parentItem,t)},getSubChangeIndex:function(n,t,i){for(var u=this,f,r=0;r<u.model.updatedRecords.length;r++)if(u.model.updatedRecords[r].level==n&&u.model.updatedRecords[r].index>t){i.parentItem&&u.model.updatedRecords[r].parentItem.taskId==i.parentItem.taskId&&(f=u.model.updatedRecords[r].index);break}return f},_nextSameLevelItem:function(n,t){var e=this,r=n.parentItem.level,f=t.indexOf(n),u;for(i=f;i<t.length;i++)if(r===t[i].level||r>t[i].level){u=t[i];break}return u},_sendOutdentRequest:function(){var t=this,u=t.model,n=t.getCurrentData(),f={},y={},o,s,p,a,v,e,c,w,h,b,d,k,g,nt,l;if(t.cancelEditCell(),r.isNullOrUndefined(n))alert(t._alertTexts.outdentAlert);else if(f.data=n,f.requestType="outdent",!t._trigger("actionBegin",f)){if(n.level===0||u.editSettings.allowIndent==!1)return;if(o=t._nextSameLevelItem(n,u.flatRecords),p=u.flatRecords.indexOf(n),a=n.parentItem,v=n.parentItem.childRecords.indexOf(n),e=n.parentItem.parentItem,c=e&&n.parentItem.parentItem.childRecords.indexOf(o),n.parentItem.childRecords.splice(v,1),u.parentTaskIdMapping||n.parentItem.item[u.childMapping].splice(v,1),n.parentItem.childRecords.length==0?(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1):n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n.parentItem.childRecords[0]):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n.parentItem.childRecords[0]),e?(c!=-1?e.childRecords.splice(c,0,n):e.childRecords.push(n),u.parentTaskIdMapping?n.item[u.parentTaskIdMapping]=e.taskId:c!=-1?e.item[u.childMapping].splice(c,0,n.item):e.item[u.childMapping].push(n.item),n.parentItem=e):(this.dataSource()instanceof r.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?u.parentTaskIdMapping||this.dataSource().dataSource.json.push(n.item):t._isDataManagerUpdate&&(u.parentTaskIdMapping||(t._jsonData=t._$treegridHelper.ejTreeGrid("getUpdatedDatamanagerData"),t._jsonData.push(n.item))):u.parentTaskIdMapping||(o?(d=this.dataSource().indexOf(o.item),this.dataSource().splice(d,0,n.item)):this.dataSource().push(n.item)),n.parentItem=null,u.parentTaskIdMapping&&(n.item[u.parentTaskIdMapping]=null)),w=t._$treegridHelper.ejTreeGrid("getChildCount",n,0),h=u.flatRecords.splice(p,w+1),b=u.ids.splice(p,w+1),s=o?u.flatRecords.indexOf(o):u.flatRecords.length,n.hasChildRecords&&n.childRecords.length>0)for(i=0;i<h.length;i++)u.flatRecords.splice(s,0,h[i]),u.ids.splice(s,0,b[i]),h[i].level-=1,s++;else u.flatRecords.splice(s,0,h[0]),u.ids.splice(s,0,b[0]),h[0].level-=1;n.parentItem&&(n.parentItem.isMilestone&&(n.parentItem.isMilestone=!1),n.parentItem&&n.parentItem.isAutoSchedule?t._updateParentItem(n):n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n));n.hasChildRecords&&(n.isAutoSchedule?t._updateParentItem(n,null,!0):t._updateManualParentItem(n,null,!0));n.level===0&&u.parentRecords.indexOf(n)===-1&&u.parentRecords.push(n);n.predecessor&&n.predecessor.length>0&&u.predecessorMapping&&n.hasChildRecords&&t._updatePredecessorOnIndentOutdent(n);u.updatedRecords=u.enableVirtualization?t._$treegridHelper.ejTreeGrid("getExpandedRecords",u.flatRecords):u.flatRecords.slice();t._$treegridHelper.ejTreeGrid("setUpdatedRecords",u.flatRecords,u.updatedRecords,u.ids,u.parentRecords,this.dataSource());f.requestType="outdent";t._$treegridHelper.ejTreeGrid("processBindings",f);k={};k.requestType=r.TreeGrid.Actions.Refresh;t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",k);t.model.updatedRecords=t.getUpdatedRecords();t.model.currentViewData=t.getCurrentViewData();t._$ganttchartHelper.ejGanttChart("setUpdatedRecords",u.currentViewData,u.updatedRecords,u.flatRecords,u.ids);t.model.predecessorMapping&&(t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection());t._$ganttchartHelper.ejGanttChart("refreshHelper",u.currentViewData,u.updatedRecords,t._totalCollapseRecordCount);t.updateAltRow(u.updatedRecords,0,1);g=u.updatedRecords.indexOf(n);nt=t.getGanttChartRows();f={data:t.model.selectedItem,recordIndex:g};t._$ganttchartHelper.ejGanttChart("selectRows",f.recordIndex);t._$treegridHelper.ejTreeGrid("selectRows",f.recordIndex);this.selectedItem(f.data);this.selectedRowIndex(f.recordIndex);u.allowSelection&&u.selectionMode!="cell"&&t.updateIndentOutdentOption(n);u.enableWBS&&(l=a.childRecords&&a.childRecords[v],l&&t.updateWBSdetails(l,!0),t.updateWBSdetails(a),l&&t.updateWBSdetails(l,!0,!0));y.data=n;y.requestType="outdent";this._trigger("actionComplete",y)}this.isCriticalPathEnable==!0&&(this.showCriticalPath(!0,!0),t._$ganttchartHelper.ejGanttChart("criticalConnectorLine",this.criticalPathCollection,this.detailPredecessorCollection,!0,this.collectionTaskId))},_refreshChildLevel:function(n){for(var r=this,t=0,u=n.childRecords,f=u.length,i,t=0;t<f;t++)i=u[t],r.refreshGanttRecord(i),i.hasChildRecords&&r._refreshChildLevel(i)},_updateChildLevel:function(n){for(var u=this,i=0,r=n.childRecords,f=r.length,t,i=0;i<f;i++)t=r[i],t.level=t.level-1,t.hasChildRecords&&u._updateChildLevel(t)},_removeChildRecords:function(n,t){if(n.parentItem){var o=this,i=o.model,u=0,r,f=0,e=0;for(parentChildRecords=n.parentItem.childRecords,parentChildRecordsLength=parentChildRecords&&parentChildRecords.length,u=t;u<parentChildRecordsLength;u++)r=parentChildRecords[u],r&&(n.childRecords?(e=n.childRecords.length,n.childRecords.splice(e,0,r),i.parentTaskIdMapping?r.item[i.parentTaskIdMapping]=n.taskId:n.item[i.childMapping].splice(e,0,r.item)):(n.childRecords=[],n.item[i.childMapping]=[],n.childRecords.push(r),i.parentTaskIdMapping?r.item[i.parentTaskIdMapping]=n.taskId:n.item[i.childMapping].push(r.item)),r.parentItem=n,f++);n.parentItem.childRecords&&(n.parentItem.childRecords.splice(t,f),i.parentTaskIdMapping||n.parentItem.item[i.childMapping].splice(t,f),n.parentItem.childRecords.length==0&&(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1,o.refreshGanttRecord(n.parentItem)))}},updateChildGanttRecordLevel:function(n,t){for(var r=0,u=this,f=u.model,e=n.parentItem&&n.parentItem.parentItem&&n.parentItem.parentItem.childRecords,o=e&&e.length,i,r=t;r<o;r++)i=e[r],i.childRecords?(i.childRecords.splice(i.childRecords.length,0,i),i.item[f.childMapping].splice(i.childRecords.length,0,i.item)):(i.childRecords=[],i.item[f.childMapping]=[],i&&(i.childRecords.push(i),i.item[f.childMapping].push(i.item))),u.refreshGanttRecord(n.parentItem),n.parentItem=i,++addedChildGanttRecordCount;n.parentItem.childRecords.splice(t,addedChildGanttRecordCount);n.parentItem.childRecords.length==0&&(n.parentItem.childRecords=null,n.parentItem.expanded=!1,n.parentItem.hasChildRecords=!1);u.refreshGanttRecord(n.parentItem)},updateLevel:function(n,t,i){var e=this,u=0,f=n.childRecords,o=f&&f.length,r;for(u;u<o;u++)r=f[u],r.level+=t,i||e.refreshGanttRecord(r),r.childRecords&&e.updateLevel(r,t,i)},addNewGanttRecord:function(){var t=this,n={},i;i=this.model.flatRecords[this.model.flatRecords.length].item;n.requestType="save";n._cAddedRecord=n.addedRecord=jQuery.extend(!0,{},i);n.recordIndex=index+1;t.subContextMenuAction(n);t._clearContextMenu()},getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this.getExpandStatus(t.parentItem):!0:!0},subContextMenuAction:function(t){var u=this,f=u.model,i=n.extend(!0,{},u._contextMenuSelectedItem.item),e;f.durationUnitMapping||(i.duration=this._getDurationStringValue(u._contextMenuSelectedItem));delete i[f.childMapping];delete i[f.predecessorMapping];delete i.WBSPredecessor;delete i[f.taskNameMapping];e=t.position==="Below"?r.Gantt.RowPosition.BelowSelectedRow:r.Gantt.RowPosition.AboveSelectedRow;f.enableWBS&&(i.WBS=u._getNewWBSid(e));u.addRecord(i,e)},reCalculateWBS:function(n,t,i){var u=this,e=u.model,f,r;if(i)for(r=0;r<n.length;r++)f=t+r,n[r].WBS=i+"."+f,n[r].item.WBS=i+"."+f,e.enableWBSPredecessor&&e.predecessorMapping&&u._getPredecessorIds(n[r]),u.refreshGanttRecord(n[r]),n[r].hasChildRecords&&u._updateChildWBS(n[r]);else for(r=0;r<n.length;r++)f=(t+r).toString(),n[r].WBS=f,n[r].item.WBS=f,e.enableWBSPredecessor&&e.predecessorMapping&&u._getPredecessorIds(n[r]),u.refreshGanttRecord(n[r]),n[r].hasChildRecords&&u._updateChildWBS(n[r])},_updateChildWBS:function(n){for(var r=this,u=r.model,i=n.childRecords,f=n.WBS,t=0;t<i.length;t++)i[t].WBS=f+"."+(t+1),i[t].item.WBS=f+"."+(t+1),u.enableWBSPredecessor&&u.predecessorMapping&&r._getPredecessorIds(i[t]),r.refreshGanttRecord(i[t]),i[t].hasChildRecords&&r._updateChildWBS(i[t])},_getPredecessorIds:function(n){var r=this,u=r.model,f=n.taskId,e=u.flatRecords,i=e.filter(function(n){var i,t,r,u;if(n.predecessorsName)for(i=n.predecessorsName.split(","),t=0;t<i.length;t++)if(r=i[t].match(/(\d+|[A-z]+)/g),u=+r[0],u==f)return n});if(i.length)for(t=0;t<i.length;t++)r._$treegridHelper.ejTreeGrid("updateWBSPredecessor",i[t]),r.refreshGanttRecord(i[t])},_getNewWBSid:function(n){var e=this,u=e.model,i=u.selectionMode=="row"?u.selectedItem:u.updatedRecords[e._rowIndexOfLastSelectedCell],t,o,f,s;return t=i?i.WBS:1,i&&n==r.Gantt.RowPosition.BelowSelectedRow&&(o=t.lastIndexOf(".")!=-1?parseInt(t.substr(t.lastIndexOf(".")+1)):parseInt(t),f=o+1,i.parentItem?(s=i.parentItem?i.parentItem.WBS:null,t=s+"."+f):t=f),t.toString()},_getNewTaskId:function(n){var t=this;return t.model.ids.indexOf(n.toString())==-1?n==0?1:n:(n++,t._getNewTaskId(n))},contextMenuAction:function(n){var t=this;n.requestType=="contextMenuAdd"&&t._sendAddRequest();n.requestType=="contextMenuIndent"&&t._sendIndentRequest();n.requestType=="contextMenuOutdent"&&t._sendOutdentRequest();n.requestType=="contextMenuDelete"&&t._$treegridHelper.ejTreeGrid("deleteRow",null,!0,t._contextMenuSelectedIndex);n.requestType=="contextMenuTaskDetails"&&t._sendEditRequest()},_renderContextMenu:function(t,i,f){var e=this,s={},h,w,l,o,v,b,c,k,p;if((e._contextMenuSelectedIndex=i,e._contextMenuSelectedItem=f,e._contextMenuEvent=t,b=e._$treegridHelper.ejTreeGrid("getCellIndex",t),t||(t=window.event),t.pageX||t.pageY?(w=h=t.pageX,l=t.pageY):(t.clientX||t.clientY)&&(w=h=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),c=this._$treegridHelper.ejTreeGrid("getOffsetRect",e.element[0]),c.bottom=c.top+this.element[0].offsetHeight,c.right=c.left+n(this.element).width(),s.requestType="ContextMenuOpen",s.contextMenuItems=e._contextMenuItems,s.columnIndex=b,s.item=e._contextMenuSelectedItem,s.targetElement=t,s.index=i,!e._trigger("contextMenuOpen",s))&&(e._activeMenuItemId=null,e._contextMenuItems=s.contextMenuItems,e._contextMenuItems.length!=0)){o=r.buildTag("div.e-contextmenu","",{position:"absolute","z-index":e._$treegridHelper.ejTreeGrid("getMaxZIndex")+1},{id:e._id+"_ContextMenu"});k=s.contextMenuItems.filter(function(n){if(n.parentMenuId==null||n.parentMenuId==u)return!0});v=r.buildTag("ul.e-gantt-contextmenu",n.render[e._id+"contextMenuTemplate"](k),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"});o.append(v);n(document.body).append(o);var d=n(o).outerHeight(),a=n(o).outerWidth(),y=o.find(".e-menuitem");y.width(a+2);a=n(o).outerWidth();(c.left>h||c.right<h+a)&&(c.right<h+a&&(h=h-a),h<0&&(h=c.left+10));c.bottom<l+n(v).outerHeight()?(p=l-n(v).outerHeight(),p>0&&(l=p)):n(window).height()+n(window).scrollTop()<l+d&&(l=l-d);o.css({left:h+"px",top:l+"px"});e._$treegridHelper.ejTreeGrid("setFocusOnTreeGridElement");n(o).css({height:"auto"});e._on(o,"contextmenu",function(n){n.preventDefault()});n(y).click(function(){e._contextMenuClickHandler(this)});n(y).mouseenter(function(){n(this).hasClass("e-disable")||(o.find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),e._activeMenuItemId=n(this).attr("id"),e._showSubContextMenu(this,s.contextMenuItems))});t.preventDefault()}},_showSubContextMenu:function(t,i){var a=this.model,f=this,e=[],s=n(t).attr("id"),u,l,h=[],o,c;h=i.filter(function(n){return n.menuId==s&&(e=n),n.parentMenuId==s?!0:void 0});e.parentMenuId||n(".e-innerContextmenu").remove();e.parentMenuId&&this._removeContextMenu(e,i);h.length>0&&(u=r.buildTag("div.e-innerContextmenu","",{position:"absolute","z-index":f._$treegridHelper.ejTreeGrid("getMaxZIndex")+1},{id:this._id+"_SubContextMenu"+s}),l=r.buildTag("ul.e-gantt-innercontextmenu",n.render[f._id+"contextMenuTemplate"](h),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),u.append(l),n(document.body).append(u),o=u.find(".e-menuitem"),o.css({width:n(u).width()}),c=f._getSubContextMenuPosition(t,u),n(u).css({top:c.top,left:c.left}),n(o).mouseenter(function(){n(this).hasClass("e-disable")||(f._showSubContextMenu(this,i),n(this).closest(".e-innerContextmenu").find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),n(this).addClass("e-contextmenu-mouseover"),f._activeMenuItemId=n(this).attr("id"))}),f._on(u,"contextmenu",function(n){n.preventDefault()}),n(o).click(function(){f._contextMenuClickHandler(this)}))},_removeContextMenu:function(t,i){var e=n("#"+this._id+"_SubContextMenu"+t.parentMenuId),r=n(e).find(".e-contextmenu-mouseover"),u,f;n(r).length>0&&(u=i.filter(function(t){if(t.menuId==n(r).attr("id"))return!0}),u.length>0&&(f=i.filter(function(n){if(n.parentMenuId==u[0].menuId)return!0}),f.length>0&&this._removeContextMenu(f[0],i)),n("#"+this._id+"_SubContextMenu"+n(r).attr("id")).remove())},_getSubContextMenuPosition:function(t,i){var a=this.model,s=n(i).outerWidth(),h=n(i).outerHeight(),c=this._$treegridHelper.ejTreeGrid("getOffsetRect",t),u={top:"",left:""},o=n(t).closest(".e-contextmenu"),f,l,r,e;return o.length==0&&(o=n(t).closest(".e-innerContextmenu")),l=n(o).outerWidth(),u.top=c.top-1,u.left=c.left+n(o).width()+1,f=u.left,r=this._$treegridHelper.ejTreeGrid("getOffsetRect",this.element[0]),r.bottom=r.top+this.element[0].offsetHeight,r.right=r.left+n(this.element).width(),(r.left>f||r.right<f+s)&&(r.right<f+s&&(f=f-l-s),f>0&&(u.left=f)),r.bottom<u.top+h&&(e=u.top+h-r.bottom,e=u.top-e-2,e>0&&(u.top=e)),u},_contextMenuClickHandler:function(t){var u=n(t).attr("id"),i=this,r={};if(!n(t).hasClass("e-disable")&&n(t).find(".e-expander").length==0)switch(u){case"Task":r.requestType="contextMenuTaskDetails";i.contextMenuAction(r);i._clearContextMenu();break;case"Indent":r.requestType="contextMenuIndent";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Outdent":r.requestType="contextMenuOutdent";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Delete":r.requestType="contextMenuDelete";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Above":r.requestType="save";r.position="Above";i.subContextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Below":r.requestType="save";r.position="Below";i.subContextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Open":r.requestType="contextMenuAdd";i.contextMenuAction(r);i._clearContextMenu();i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement");break;case"Add":i._setInitialData();break;default:r.data=i._contextMenuSelectedItem;i._triggerMenuEventHandler(u,r);i._clearContextMenu()}},_triggerMenuEventHandler:function(t,i){var s=this,e=s._contextMenuItems,f,o,u;r.isNullOrUndefined(e)||(f=e.filter(function(n){if(n.menuId.toString()===t)return!0}),f.length>0&&(o=f[0],i.menuId=t,u=o.eventHandler,u&&(typeof u=="string"&&(u=r.util.getObject(u,window)),n.isFunction(u)&&(args=r.event("customContextMenuHandler",this.model,i),u.call(this,args)))))},_setInitialData:function(){var n=this,t=n.model;t.flatRecords.length==0&&(n.addRecord(),n._clearContextMenu())},updateConnectorLines:function(t,i){for(var f=this,s=t.length/2,r=0,e,u,o,r=0;r<s;r++)e=t[r],u=n(f._gridRows).index(e),u!==-1&&(o=f.model.currentViewData[u],o.isExpanded=i)},updateAltRow:function(t,i,r){var f=this;if(f.model.enableAltRow)for(var u=0,h=f.model.currentViewData,c=h.length,e=t.isAltRow,o,s=n(f._gridRows),u=i+r;u<c;u++)n(s[u]).css("display")!=="none"&&(o=h[u],o.isAltRow=!e,e=o.isAltRow,e?n(s[u]).addClass("e-alt-row"):n(s[u]).removeClass("e-alt-row"))},renderedEditDialog:function(t){var i=this,o=this.model,y=o.columns,b=y.length,p={},c,v,s,e,u,w,l,h,f,a;switch(t.requestType){case r.TreeGrid.Actions.Add:if(s=document.createElement("div"),e=n("#"+i._id+"_dialogAdd"),n(s).addClass("e-addedrow"),s.innerHTML=n.render[i._id+"_JSONDialogAddingTemplate"](t.data),n(e).html(n(s)),u={},u.cssClass=o.cssClass,u.enableModal=!0,u.width="650px",u.height="auto",u.enableResize=!1,u.contentSelector="#"+i._id,u.rtl=o.rtl,u.showOnInit=!1,u.allowKeyboardNavigation=!1,u.beforeClose=function(n){i._closeAddEditDialog(n,"Add")?n.cancel=!0:i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")},l=i._editDialogTexts.addFormTitle,u.title=l,i._editedDialogRecord={},h=n("#"+i._id+"AddTab"),n(h).ejTab({headerSize:"25px",height:"auto",locale:o.locale,itemActive:function(t){var u=n(t.activeHeader).find("a").attr("href"),r;u=="#"+i._id+"AddNotes"?n("#"+i._id+"AddAreaNotes_Iframe").height("202"):u=="#"+i._id+"AddCustomFields"?(r=n("#treegrid"+i._id+"customFieldAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"280px"}})):u=="#"+i._id+"AddPredecessors"?(r=n("#treegrid"+i._id+"predecessorAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}})):u=="#"+i._id+"AddResources"&&(r=n("#treegrid"+i._id+"resourceAdd").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}}))}}),n(h).find("div.e-content").css("overflow","visible"),n(h).find("div.e-hidebottom.e-addborderbottom.e-content").css("min-height","283px"),n(e).ejDialog(u),f={},f.data=t.data,f.rowPosition=o.editSettings.rowPosition,f.requestType="beforeOpenAddDialog",f.element=n("#"+i._id+"_dialogAdd"),!i._trigger("actionBegin",f)){for(c=0;c<b;c++)p[y[c].field]=f.data[y[c].mappingName];t.data=p;i._refreshEditForm(t);f.data=t.data;f.requestType="OpenAddDialog";f.element=n("#"+i._id+"_dialogAdd");i._trigger("actionBegin",f)||(a=n("#"+i._id+"_dialogAdd_wrapper"),n(e).find(".e-addedrow").css("overflow","visible"),a.addClass("e-ganttdialog"),n(e).ejDialog("refresh"),n(e).ejDialog("open"))}i._addPosition=f.rowPosition;v=this._getDateFromFormat(o.scheduleStartDate);this._getSecondsInDecimal(v)!=this._defaultStartTime&&this._setTime(this._defaultStartTime,v);this._editedDialogRecord.isUpdatedFromDialog=!1;i._editedDialogRecord.startDate=t.data.startDate!=""?t.data.startDate:this._checkStartDate(new Date(v));i._editedDialogRecord.endDate=t.data.endDate!=""?t.data.endDate:new Date(i._editedDialogRecord.startDate);i._editedDialogRecord.duration=t.data.duration!=""?t.data.duration:0;i._editedDialogRecord.durationUnit=o.durationUnit;break;case r.TreeGrid.Actions.BeginEdit:s=document.createElement("div");e=n("#"+i._id+"_dialogEdit");n(s).addClass("e-editedrow");s.innerHTML=n.render[i._id+"_JSONDialogEditingTemplate"](t.data);n(e).html(n(s));u={};u.cssClass=i.model.cssClass;u.rtl=o.rtl;u.width="650px";u.height="auto";u.enableResize=!1;u.contentSelector="#"+i._id;u.enableModal=!0;u.showOnInit=!1;u.allowKeyboardNavigation=!1;u.beforeClose=function(n){i._closeAddEditDialog(n,"Edit")?n.cancel=!0:i._$treegrid.ejTreeGrid("setFocusOnTreeGridElement")};w=o.selectionMode=="row"?i.selectedItem():i.model.updatedRecords[i._rowIndexOfLastSelectedCell];l=i._editDialogTexts.editFormTitle;u.open=function(){var r=this,i=this._id,t=n("#"+i+"_title").children(".e-title");t.width("450px");t.css({"word-wrap":"normal","text-overflow":"ellipsis","white-space":"nowrap",display:"inline-block","overflow-x":"hidden",float:"left"});t.attr("title",l)};u.title=l;h=n("#"+i._id+"EditTab");n(h).ejTab({headerSize:"25px",height:"auto",locale:o.locale,itemActive:function(t){var u=n(t.activeHeader).find("a").attr("href"),r;u=="#"+i._id+"EditNotes"?n("#"+i._id+"EditAreaNotes_Iframe").height("202"):u=="#"+i._id+"EditCustomFields"?(r=n("#treegrid"+i._id+"customFieldEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"279px"}})):u=="#"+i._id+"EditPredecessors"?(r=n("#treegrid"+i._id+"predecessorEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}})):u=="#"+i._id+"EditResources"&&(r=n("#treegrid"+i._id+"resourceEdit").ejTreeGrid("instance"),r.setModel({sizeSettings:{width:"620",height:"240px"}}))}});n(h).find("div.e-content").css("overflow","visible");n(h).find("div.e-hidebottom.e-addborderbottom.e-content").css("min-height","283px");n(e).ejDialog(u);f={};f.data=t.data;f.requestType="beforeOpenEditDialog";f.element=n("#"+i._id+"_dialogEdit");i._trigger("actionBegin",f)||(i._editedDialogRecord=jQuery.extend({},w),this._editedDialogRecord.isUpdatedFromDialog=!1,i._refreshEditForm(t),f.data=t.data,f.requestType="openEditDialog",f.element=n("#"+i._id+"_dialogEdit"),i._trigger("actionBegin",f)||(a=n("#"+i._id+"_dialogEdit_wrapper"),n(e).find(".e-editedrow").css("overflow","visible"),a.addClass("e-ganttdialog"),n(e).ejDialog("refresh"),n(e).ejDialog("open")));this._editedDialogRecord&&(this._editedDialogRecord.isUpdatedFromDialog=!1)}},_closeAddEditDialog:function(n,t){var i=this,r;if(i._isAddEditDialogSave)i._isAddEditDialogSave=!1;else return r={},r.requestType=t==="Add"?"closeAddDialog":"closeEditDialog",i._trigger("actionBegin",r)},editFormValidate:function(){return n.isFunction(n.validator)?n("#"+this._id+"GeneralEditForm").validate().form():!0},addFormValidate:function(){return n.isFunction(n.validator)?n("#"+this._id+"GeneralAddForm").validate().form():!0},getCurrentData:function(){var n=this,t=n.getUpdatedRecords(),i=n.model.selectionMode=="row"?this.selectedRowIndex():n._rowIndexOfLastSelectedCell;return t&&t[i]},getCurrentViewData:function(){return this._$treegridHelper.ejTreeGrid("getCurrentViewData")},getUpdatedCurrentViewData:function(){return this._$treegridHelper.ejTreeGrid("getUpdatedCurrentViewData")},getRows:function(){return this._$treegridHelper.ejTreeGrid("getRows")},getSelectedCells:function(){return this._$treegridHelper.ejTreeGrid("getSelectedCells")},getGanttChartRows:function(){return this._$ganttchartHelper.ejGanttChart("getGanttChartRows")},getUpdatedRecords:function(){return this._$treegridHelper.ejTreeGrid("getUpdatedRecords")},_getToolBarHeight:function(){var n=0;return this.model.toolbarSettings.showToolbar&&(n=this.element.find(".e-gantttoolbar").height()),n},_initValidator:function(){var t=this;n("#"+this._id+"EditForm").validate({errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,u){var e=u.closest("td"),f=n(i).addClass("e-error"),o=r.buildTag("div.e-errortail e-toparrow");e.find(".e-error").remove();u.hasClass("e-numerictextbox")?f.insertAfter(u.closest(".e-numeric")):f.insertAfter(u);f.prepend(o);t.model.editSettings.editMode!="normal"&&f.offset({left:u.offset().left});f.fadeIn("slow")}})},setValidation:function(){this._initValidator();for(var n=0;n<this._columns.length;n++)r.isNullOrUndefined(this._columns[n].validationRules)||this.setValidationToField(this._columns[n].field,this._columns[n].validationRules)},setValidationToField:function(t,i){var f=n("#"+this._id+t).length>0?n("#"+this._id+t):n("#"+t),u;f.rules("add",i);u=n("#"+this._id+"EditForm").validate();r.isNullOrUndefined(i.required)||(u.settings.messages.Name={},u.settings.messages.Name.required=r.TreeGrid.getColumnByField(proxy._columns,t).headerText+" is required")},_createConnectorLinesCollection:function(n){var u=this,r=this.model,e=r.currentViewData.length,i,f,t,s=u._predecessorsCollection,h=s.length,l=h/2,c=r.enableVirtualization,o;if(r.enableVirtualization&&n==="Load")for(e=r.updatedRecords.length,i=0;i<e;i++)t=r.updatedRecords[i],f=t.predecessor,f&&(o=t,u._addPredecessorsCollection(t,f));else for(i=0;i<e;i++)(t=r.currentViewData[i],c!==!1||t.isExpanded!==!1)&&r.currentViewData.indexOf(t)!==-1&&(f=t.predecessor,f&&(o=t,u._addPredecessorsCollection(t,f)));u._$ganttchartHelper&&u._$ganttchartHelper.ejGanttChart("renderConnectorLines",u._connectorLinesCollection)},_addPredecessorsCollection:function(t,i){var r=this,v,o,e,s,u,h=r.model,f={},c=h.flatRecords,y=h.updatedRecords,l=h.ids,a,p;if(i){for(v=i.length,o=0;o<v;o++)(e=i[o],s=c[l.indexOf(e.from)],u=c[l.indexOf(e.to)],!h.enableVirtualization&&(s&&s.isExpanded===!1||u&&u.isExpanded===!1))||r._isValidationEnabled&&!r._isInExpandCollapse&&u&&r._validatePredecessorDates(u);if(!r._enableCreateCollection)return;for(a=0,n.each(i,function(n,i){return i.to===t.taskId.toString()&&a++,a}),o=0;o<v;o++)(e=i[o],a>1&&(e.isdrawn=!1),s=c[l.indexOf(e.from)],u=c[l.indexOf(e.to)],y.indexOf(s)!==-1&&y.indexOf(u)!=-1)&&(h.enableVirtualization||s.isExpanded!==!1&&u.isExpanded!==!1)&&s&&u&&(f=r._createConnectorLineObject(s,u,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._connectorLinesCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._connectorLinesCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._connectorLinesCollection[p]=f),e.isdrawn=!0))}},_createConnectorLineObject:function(t,i,u){var f={},a=this,v=a.model,l=v.updatedRecords,e=l.indexOf(t),o=l.indexOf(i),c=0,s=0,h,y,p;if(e!==-1&&o!==-1){if(!v.enableVirtualization)if(h=0,o>e){for(c=0;c<e;c++)l[c].isExpanded===!1&&++h;for(s=e,e-=h,s;s<o;s++)l[s].isExpanded===!1&&++h;o-=h}else if(e>o){for(c=0;c<o;c++)l[c].isExpanded===!1&&++h;for(s=o,o-=h,s;s<e;s++)l[s].isExpanded===!1&&++h;e-=h}return y=n("#ejGanttChart"+a._id).ejGanttChart("instance"),p=r.browserInfo().name=="msie"&&r.browserInfo().version<9?v.rowHeight:n("#"+y._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height,e!=-1&&o!=-1?(f.ParentLeft=t.left,f.ChildLeft=i.left,f.ParentWidth=t.width==0||t.isMilestone?a._milesStoneWidth:t.width,f.ChildWidth=i.width==0||i.isMilestone?a._milesStoneWidth:i.width,f.ParentIndex=e,f.ChildIndex=o,f.RowHeight=p,f.Type=u.predecessorsType,f.ConnectorLineId="parent"+t.taskId+"child"+i.taskId,f.milestoneParent=t.isMilestone?!0:!1,f.milestoneChild=i.isMilestone?!0:!1,f):void 0}},_getDateAfterWeekendHolidays:function(n,t){var o=this,r=this.model,e=this._getStringHolidays(),u=new Date(n),i=!1,f;return u.setHours(0,0,0,0),f=this._getFormatedDate(u,r.dateFormat,r.locale),t&&e.indexOf(f)!=-1&&(n.setDate(n.getDate()+1),i=!0),t&&r.includeWeekend===!1&&(n.getDay()==0?(n.setDate(n.getDate()+1),i=!0):n.getDay()==6&&(n.setDate(n.getDate()+2),i=!0)),i?this._getDateAfterWeekendHolidays(n,t):n},_getDateBeforeWeekendHolidays:function(n,t){var o=this,r=this.model,e=this._getStringHolidays(),u=new Date(n),i=!1,f;return u.setHours(0,0,0,0),f=this._getFormatedDate(u,r.dateFormat,r.locale),t&&e.indexOf(f)!=-1&&(n.setDate(n.getDate()-1),i=!0),t&&r.includeWeekend===!1&&(n.getDay()==0?(n.setDate(n.getDate()-2),i=!0):n.getDay()==6&&(n.setDate(n.getDate()-1),i=!0)),i?this._getDateBeforeWeekendHolidays(n,t):n},_updateDateByOffset:function(n,t,i,r){var u,f=t.offset,e=t.offsetDurationUnit;return f<0?u=this._getStartDate(this._checkEndDate(n,r),f*-1,e,r):(u=this._getEndDate(n,f,e,r),i||(u=this._checkStartDate(u,r))),u},_setStartDateByDurationEndDate:function(n){var s=this,f=this.model,h=f.scheduleHeaderSettings.scheduleHeaderType,c=r.Gantt.ScheduleHeaderType,i=f.durationUnit,e=n.isAutoSchedule,o=i==r.Gantt.DurationUnit.Day?n.duration-1:n.duration,t,u;if(n.isMilestone)n.startDate=n.endDate;else{for(t=new Date(n.endDate),u=0;u<o;u++)i==r.Gantt.DurationUnit.Hour?t.setHours(t.getHours()-1):i==r.Gantt.DurationUnit.Day?t.setDate(t.getDate()-1):i==r.Gantt.DurationUnit.Minute&&t.setMinutes(t.getMinutes()-1),t=this._getDateBeforeWeekendHolidays(t,e);n.startDate=new Date(t)}},_validateChildGanttRecord:function(n,t,i){var r=this,h=r.model;if(r._editedTaskBarItem!==t){switch(i.predecessorsType){case"SS":var f=t.taskId.toString(),u=t.predecessor,e=u.filter(function(n){return n.to===f}),o=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(o);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"SF":var f=t.taskId.toString(),u=t.predecessor,e=u.filter(function(n){return n.to===f}),o=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(o);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"FS":var u=t.predecessor,f=t.taskId.toString(),e=u&&u.filter(function(n){return n.to===f}),s=r._getPredecessorDate(t,e,i.predecessorsType);t.startDate=new Date(s);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status);break;case"FF":var f=t.taskId.toString(),u=t.predecessor,e=u&&u.filter(function(n){return n.to===f});t.startDate=r._getPredecessorDate(t,e,i.predecessorsType);t._calculateEndDate(this);t.left=t._calculateLeft(this);t.width=t._calculateWidth(this);t.progressWidth=t._calculateProgressWidth(t.width,t.status)}this._updateItemValueInRecord(t);t.parentItem&&t.parentItem.isAutoSchedule?r._updateParentItem(t):t.parentItem&&!t.parentItem.isAutoSchedule&&r._updateManualParentItem(t);(r._isTreeGridRendered||r._isGanttChartRendered)&&r.refreshGanttRecord(t)}},_calculateOffset:function(n,t){var r=this,e=r.model,i=r._daydiff(n,t),u,f;return e.includeWeekend||(u=r._calculateWeekendCount(n,i),i=i>0?i-u:i+u),e.holidays.length&&(f=r._calculateHolidayCount(n,t),i=i>0?i-f:i+f),i},_getValidatedStartDate:function(n,t,i){var e=i.predecessorsType,u=i.offset,r,f;switch(e){case"FS":r=new Date(t.endDate);n.isMilestone&&u==0||(r=this._checkStartDate(r,n));u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));f=n.isMilestone?new Date(r):this._checkStartDate(r,n);break;case"FF":r=new Date(t.endDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone));r=this._updateDateByOffset(r,i,n.isMilestone,n);r=this._checkEndDate(r,n);f=this._getStartDate(r,n.duration,n.durationUnit,n);break;case"SF":r=new Date(t.startDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));n.isMilestone||(r=this._checkEndDate(r,n));f=this._getStartDate(r,n.duration,n.durationUnit,n);break;case"SS":r=new Date(t.startDate);u!=0&&(r=this._updateDateByOffset(r,i,n.isMilestone,n));f=n.isMilestone?r:this._checkStartDate(r,n)}return f},_getPredecessorDate:function(n,t){var e=this.model,i=null,o,r,s=e.flatRecords,h=e.ids,u,c,l,f=t.filter(function(t){if(t.to===n.taskId.toString())return!0});if(f)for(o=f.length,r=0;r<o;r++)predecessor=f[r],c=s[h.indexOf(predecessor.from)],l=s[h.indexOf(predecessor.to)],u=this._getValidatedStartDate(l,c,predecessor),i==null?i=new Date(u):u.getTime()>i.getTime()&&(i=new Date(u));return i},_setBeforeWeekend:function(n){n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1)},_setAfterWeekend:function(n){n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2)},_updateEditedGanttRecords:function(t){var r=this,f=r.model,i=t.data,s=new Date(i.startDate),p=i.isAutoSchedule,y=!1,l,h,e,c,a,o,v;t.columnName==="startDate"?(l=n.extend({},t.data),s=r._checkStartDate(s,i),i.startDate=new Date(s),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate),i._calculateEndDate(this),i.left=i._calculateLeft(this),i.width=i._calculateWidth(this),i.hasChildRecords?(h={},h.previousData=l,h.data=i,r._validateAutoChildRecords(h)):i.progressWidth=i._calculateProgressWidth(i.width,i.status),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName==="endDate"?(e=new Date(i.endDate),e.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,e),e=this._checkEndDate(e,i),i.endDate=new Date(e),f.endDateMapping&&(i.item[f.endDateMapping]=i.endDate),i.isMilestone&&(i.startDate=this._checkStartDate(i.startDate,i),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate)),s.getTime()<=e.getTime()?(i._calculateDuration(this),i.width=i._calculateWidth(this),i.hasChildRecords||(i.progressWidth=i._calculateProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):(i.endDate=t.previousValue,i.item[f.endDateMapping]=t.previousValue),i.isMilestone=i.duration===0?!0:!1,r._updateResourceRelatedFields(i)):t.columnName=="duration"||r._isDurationUpdated?(c=i.duration,c!=0&&i.isMilestone&&(i.startDate=this._checkStartDate(i.startDate,i),f.startDateMapping&&(i.item[f.startDateMapping]=i.startDate)),i._calculateEndDate(this),i.isMilestone=c===0?!0:!1,i.width=i._calculateWidth(this),i.hasChildRecords||(i.progressWidth=i._calculateProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName=="predecessor"?(y=!0,t.previousValue&&r._removeConnectorLine(t.previousValue,i),r._addConnectorLine(i)):t.columnName=="status"?(i.status=i.status>100?100:i.status,i.hasChildRecords||(i.progressWidth=r._getProgressWidth(i.width,i.status)),i.parentItem&&i.parentItem.isAutoSchedule?r._updateParentItem(i):i.parentItem&&!i.parentItem.isAutoSchedule&&r._updateManualParentItem(i)):t.columnName=="taskMode"?r._updateGanttRecord(i):(t.columnName=="baselineStartDate"||t.columnName=="baselineEndDate")&&(a=r._getDateFromFormat(i.baselineStartDate),o=r._getDateFromFormat(i.baselineEndDate),o&&o.getHours()==0&&this._defaultEndTime!=86400&&this._setTime(this._defaultEndTime,o),i.baselineStartDate=this._checkBaseLineStartDate(a),i.baselineEndDate=this._checkBaseLineEndDate(o),i.baselineStartDate&&i.baselineEndDate&&(i.baselineLeft=i._calculateBaselineLeft(this),i.baselineRight=i._calculateBaselineRight(this),i.baselineWidth=i._calculateBaseLineWidth(this)));i.predecessor&&(r._isMileStoneEdited=i.isMilestone,r._updatedConnectorLineCollection=[],r._connectorlineIds=[],t.columnName==="predecessor"?f.enablePredecessorValidation?r._validatePredecessor(i,t.previousValue):(v=!0,r._validatePredecessorOnEditing(i,v)):r._validatePredecessor(i,u,"successor"),r._updatedConnectorLineCollection.length>0&&r._$ganttchartHelper.ejGanttChart("appendConnectorLine",r._updatedConnectorLineCollection));r._isValidationEnabled=!1;r.refreshGanttRecord(i)},_removeConnectorLine:function(n,t){for(var c=this,e=this.model,o,r,u,i=0,l=n&&n.length,f=-1,s=e.flatRecords,h=e.ids,i=0;i<l;i++)r=s[h.indexOf(n[i].from)],u=s[h.indexOf(n[i].to)],t.taskId.toString()===n[i].to.toString()&&(f=r.predecessor.indexOf(n[i]),f>=0&&r.predecessor.splice(f,1)),r&&u&&(o="parent"+r.taskId+"child"+u.taskId,c._$ganttchartHelper.ejGanttChart("removeConnectorline",o))},_addConnectorLine:function(n){var f=this,r=0,e=f.model,u=n.predecessor,o,i,s=e.flatRecords,h=e.ids,t;if(u)for(o=u.length,r=0;r<o;r++)i=u[r],i.to===n.taskId.toString()&&(t=s[h.indexOf(i.from)]),t&&(t.predecessor?t.predecessor.push(i):(t.predecessor=[],t.predecessor.push(i),f._predecessorsCollection.push(t)))},_calculateUpdatedDate:function(n,t){var i=this,f=i.model,e=r.Gantt.DurationUnit,u=0,o;if(t>0)for(u;u<t;u++)f.durationUnit==e.Day?n=i.dateUpdate(n,1,0):f.durationUnit==e.Hour?n=i.dateUpdate(n,0,1):f.durationUnit==e.Minute&&(n=i.dateUpdate(n,0,0,1)),n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2);else for(o=-1*t,u=0;u<o;u++)f.durationUnit==e.Day?n=i.dateUpdate(n,-1,0):f.durationUnit==e.Hour&&(n=i.dateUpdate(n,0,-1)),n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1);return new Date(n)},_updateEditedGanttRecord:function(n){var t=this;if(n.predecessor)for(var o=n.predecessor,u=0,a=o.length,r,f,e,s,i,h=t.model,c=h.flatRecords,l=h.ids,u=0;u<a;u++)t._updatedConnectorLineCollection=[],t._connectorlineIds=[],r=o[u],r.to===n.taskId.toString()&&(f=c[l.indexOf(r.from)],e=c[l.indexOf(r.to)],f&&e&&(s="parent"+f.taskId+"child"+e.taskId,t._$ganttchartHelper.ejGanttChart("removeConnectorline",s),i=t._createConnectorLineObject(f,e,r),i&&(t._connectorlineIds.length>0&&t._connectorlineIds.indexOf(i.ConnectorLineId)==-1?(t._updatedConnectorLineCollection.push(i),t._connectorlineIds.push(i.ConnectorLineId)):t._connectorlineIds.length==0&&(t._updatedConnectorLineCollection.push(i),t._connectorlineIds.push(i.ConnectorLineId)),t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection))))},_updateTargetGanttRecord:function(n){var t=this,i=t.model;n.startDate=t._checkStartDate(n.startDate,n);n.endDate=this._getEndDate(n.startDate,n.duration,n.durationUnit,n);n.left=n._calculateLeft(this);n.width=n._calculateWidth(this);n.progressWidth=n._calculateProgressWidth(n.width,n.status);n.parentItem&&(n.parentItem.isAutoSchedule==!0?t._updateParentItem(n):t._updateManualParentItem(n));t.refreshGanttRecord(n)},_updateGanttRecord:function(n){var t=this,i=t.model;n.hasChildRecords&&n.isAutoSchedule?(n.startDate=t._checkStartDate(n.manualStartDate,n),n.left=n._calculateManualLeft(this),n.width=n._calculateManualWidth(this),n.progressWidth=n._calculateProgressWidth(n.width,n.status),n.endDate=n.manualEndDate,n._calculateDuration(this)):n.hasChildRecords&&!n.isAutoSchedule?(n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n._calculateDuration(this),n.manualStartDate=n.startDate,n.manualEndDate=n.endDate,t._updateManualParentItem(n,null,!0)):(n.startDate=t._checkStartDate(n.startDate,n),n.endDate=this._getEndDate(n.startDate,n.duration,n.durationUnit,n),n.left=n._calculateLeft(this),n.width=n._calculateWidth(this),n.progressWidth=n._calculateProgressWidth(n.width,n.status));n.parentItem&&n.parentItem.isAutoSchedule&&t._updateParentItem(n);n.parentItem&&!n.parentItem.isAutoSchedule&&t._updateManualParentItem(n);t.refreshGanttRecord(n)},refreshGanttRecord:function(n){var t=this,u,f,i;t._isTreeGridRendered&&(t.model.currentViewData=t.getCurrentViewData(),u=t.model.currentViewData.indexOf(n),f=t._$treegridHelper.ejTreeGrid("instance"),f.model.allowSelection=t.model.allowSelection,r.TreeGrid.refreshRow(f,u),t._isGanttChartRendered&&t._$ganttchartHelper.ejGanttChart("refreshRow",u),i={},i.data=n,i.item=n.item,i.requestType="recordUpdate",t._trigger("actionComplete",i))},_updateManualParentItem:function(n,t,i){var f=this,u=i?n:n.parentItem,h=f.model,rt=h.scheduleHeaderSettings.scheduleHeaderType,ut=r.Gantt.ScheduleHeaderType,ft=new Date(u.startDate),w=new Date(u.manualStartDate),it=new Date(n.startDate),b=new Date(u.endDate),a=new Date(u.manualEndDate),c=new Date(n.endDate),p;it.getTime()<w.getTime()&&(u.manualStartDate=n.startDate);c.getTime()>b.getTime()&&f._isLoad&&(dateDiff=f._daydiff(b,c));c.getTime()>a.getTime()&&(u.manualEndDate=n.endDate,dateManualDiff=f._daydiff(a,c));for(var l=0,v=u.childRecords,k=v&&v.length,e,d=null,o=null,s=null,y=0,g=0,nt=0,tt=0,l=0;l<k;l++)e=v[l],o===null&&(o=new Date(e.startDate)),s===null&&(s=new Date(e.endDate),d=h.flatRecords.indexOf(e)),e.endDate.getTime()>s.getTime()&&(s=new Date(e.endDate),d=h.flatRecords.indexOf(e)),e.startDate.getTime()<o.getTime()&&(o=new Date(e.startDate)),tt+=parseInt(e.work),e.isMilestone?g++:nt+=parseInt(e.status);w.getTime()!==o.getTime()&&(u.manualStartDate=new Date(o));a.getTime()!=s.getTime()&&(u.manualEndDate=new Date(s));(f._isLoad||f._isChartRendering)&&(u._calculateDuration(this),u.width=u._calculateWidth(this));u.left=u._calculateLeft(this);u.manualLeft=u._calculateManualLeft(this);u._calculateManualDuration(this);u.manualWidth=u._calculateManualWidth(this);u._updateWorkWithDuration(f);u.work+=tt;p=k-g;y=p>0?nt/p:0;u.progressWidth=f._getProgressWidth(u.manualWidth,y);u.status=Math.floor(y);h.progressMapping&&(u.item[h.progressMapping]=u.status);(f._isTreeGridRendered||f._isGanttChartRendered)&&f.refreshGanttRecord(u);u.parentItem&&u.parentItem.isAutoSchedule&&!i?f._updateParentItem(u):!u.parentItem||u.parentItem.isAutoSchedule||i||f._updateManualParentItem(u,t)},_updateParentItem:function(n,t,i){var o=this,u=i?n:n.parentItem,e=o.model,ut=e.scheduleHeaderSettings.scheduleHeaderType,ft=r.Gantt.ScheduleHeaderType,k=new Date(u.startDate),rt=new Date(n.startDate),v=new Date(u.endDate),d=new Date(n.endDate),c,l,b;rt.getTime()<k.getTime()&&(u.startDate=n.startDate,e.startDateMapping&&(u.item[e.startDateMapping]=u.startDate));d.getTime()>v.getTime()&&(dateDiff=o._daydiff(v,d),u.endDate=n.endDate,e.endDateMapping&&(u.item[e.endDateMapping]=u.endDate));for(var a=0,y=u.childRecords,g=y&&y.length,f,nt=null,s=null,h=null,p=0,w=0,tt=0,it=0,a=0;a<g;a++)f=y[a],c=f.startDate,l=f.endDate,f.hasChildRecords&&!f.isAutoSchedule&&(c=f.startDate.getTime()>f.manualStartDate.getTime()?f.manualStartDate:f.startDate),f.hasChildRecords&&!f.isAutoSchedule&&(l=f.endDate.getTime()<f.manualEndDate.getTime()?f.manualEndDate:f.endDate),s===null&&(s=new Date(c)),h===null&&(h=new Date(l),nt=e.flatRecords.indexOf(f)),l.getTime()>h.getTime()&&(h=new Date(l),nt=e.flatRecords.indexOf(f)),c.getTime()<s.getTime()&&(s=new Date(c)),it+=parseInt(f.work),f.isMilestone?w++:tt+=parseInt(f.status);k.getTime()!==s.getTime()&&(u.startDate=new Date(s),e.startDateMapping&&(u.item[e.startDateMapping]=u.startDate));v.getTime()!=h.getTime()&&(u.endDate=new Date(h),e.endDateMapping&&(u.item[e.endDateMapping]=u.endDate));u._calculateDuration(this);u.left=u._calculateLeft(this);u.width=u._calculateWidth(this);w==u.childRecords.length&&(u.startDate.getTime()==u.endDate.getTime()?u.width=Math.floor((e.rowHeight-6)/2)*2:u.width+=Math.floor((e.rowHeight-6)/2)*2);b=g-w;p=b>0?tt/b:0;u.progressWidth=o._getProgressWidth(u.width,p);u.status=Math.floor(p);u._updateWorkWithDuration(o);u.work+=it;u.taskType=r.Gantt.TaskType.FixedDuration;u.effortDriven="false";e.progressMapping&&(u.item[e.progressMapping]=u.status);(o._isTreeGridRendered||o._isGanttChartRendered)&&o.refreshGanttRecord(u);u.parentItem&&u.parentItem.isAutoSchedule&&!i?o._updateParentItem(u):!u.parentItem||u.parentItem.isAutoSchedule||i||o._updateManualParentItem(u)},UpdatePredecessor:function(){var n=this;n._updatedRecordsDateByPredecessor();n._$ganttchartHelper.ejGanttChart("clearConnectorLines");n._connectorLinesCollection=[];n._createConnectorLinesCollection();n._$ganttchartHelper.ejGanttChart("renderConnectorLines",n._connectorLinesCollection)},_updatedRecordsDateByPredecessor:function(){for(var r=this,i=this.model,t=i.flatRecords,u=t.length,n=0;n<u;n++)t[n].predecessor&&t[n].item[i.predecessorMapping]&&r._validatePredecessorDates(t[n])},_validatePredecessorDates:function(n){var r=this,u=r.model,y;if(n.predecessor){for(var f=n.predecessor,e,o=null,i,s=u.flatRecords,h=u.ids,c=n.taskId.toString(),l=f.filter(function(n){return n.to===c}),a=f.filter(function(n){return n.from===c}),v=l.length,t=0;t<v;t++)i=l[t],e=s[h.indexOf(i.from)],o=s[h.indexOf(i.to)],r._validateChildGanttRecord(e,o,i);y=a.length}},_validatePredecessor:function(n,t,i){var r=this,c=r.model,nt,p;if(n.predecessor){for(var b=n.predecessor,h,o=null,v,e,f,l=c.flatRecords,a=c.ids,y=!1,k=n.taskId.toString(),w=b.filter(function(n){return n.to===k}),d=b.filter(function(n){return n.from===k}),g=w.length,s=0;s<g;s++)e=w[s],y=r._isOffsetChange(e,t,s),h=l[a.indexOf(e.from)],o=l[a.indexOf(e.to)],v="parent"+h.taskId+"child"+o.taskId,r._$ganttchartHelper&&r._$ganttchartHelper.ejGanttChart("removeConnectorline",v),r._isValidationEnabled=o.isAutoSchedule||c.validateManualTasksOnLinking?!0:!1,(n.taskId.toString()===e.to||n.taskId.toString()===e.from)&&(!i||i=="predecessor")&&r._isValidationEnabled&&r._validateChildGanttRecord(h,o,e,c.enablePredecessorValidation,y);for(s=0;s<g;s++)(e=w[s],h=l[a.indexOf(e.from)],o=l[a.indexOf(e.to)],c.enableVirtualization!==!1||h.isExpanded!==!1&&o.isExpanded!=!1)&&(f=r._createConnectorLineObject(h,o,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._updatedConnectorLineCollection[p]=f)));for(nt=d.length,s=0;s<nt;s++)(e=d[s],h=l[a.indexOf(e.from)],o=l[a.indexOf(e.to)],v="parent"+h.taskId+"child"+o.taskId,y=r._isOffsetChange(e,t,s),r._isValidationEnabled=o.isAutoSchedule||c.validateManualTasksOnLinking?!0:!1,r._$ganttchartHelper&&r._$ganttchartHelper.ejGanttChart("removeConnectorline",v),i!="predecessor"&&r._isValidationEnabled&&r._validateChildGanttRecord(h,o,e,c.enablePredecessorValidation,y),c.enableVirtualization!==!1||h.isExpanded!==!1&&o.isExpanded!=!1)&&(f=r._createConnectorLineObject(h,o,e),f&&(r._connectorlineIds.length>0&&r._connectorlineIds.indexOf(f.ConnectorLineId)==-1?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.length==0?(r._updatedConnectorLineCollection.push(f),r._connectorlineIds.push(f.ConnectorLineId)):r._connectorlineIds.indexOf(f.ConnectorLineId)!=-1&&(p=r._connectorlineIds.indexOf(f.ConnectorLineId),r._updatedConnectorLineCollection[p]=f)),o&&r._validatePredecessor(o,u,"successor"))}},_isOffsetChange:function(n,t,i){var e=this,o=e.model,u=!1;if(!o.enablePredecessorValidation)if(t&&t.length){var s=n.offset?parseInt(n.offset):0,f=t[i],h=f.offset?parseInt(f.offset):0;u=s!=h?!0:!1}else u=r.isNullOrUndefined(t)?!1:!0;return u},_calculateDateDifference:function(n,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(n,t):t+this._calculateWeekendCount(n,t)},_calculateWeekendCount:function(n,t){var u=t>=0?t:-1*t,r=0,i=0;if(t>0)for(i=0;i<t;i++)n.getDay()==0?(r++,n.setDate(n.getDate()+1)):n.getDay()==6?(r+=2,++i,n.setDate(n.getDate()+2)):n.setDate(n.getDate()+1);else for(i=0;i<u;i++)n.setDate(n.getDate()-1),(n.getDay()==0||n.getDay()==6)&&(r+=1);return r},_daydiff:function(n,t){return(new Date(t)-new Date(n))/864e5},_calculateHolidayCount:function(n,t){for(var r=this,e=r.model,u=e.holidays,o=u.length,s=n<t?n:t,h=n>t?n:t,f=0,i=0;i<o;i++)r._getDateFromFormat(u[i].day)>=s&&r._getDateFromFormat(u[i].day)<=h&&f++;return f},dateUpdate:function(n,t,i,r){return r||(r=0),new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours()+i,n.getMinutes()+r,n.getSeconds(),n.getMilliseconds())},_refreshChartAndGridRows:function(){var n=this,t=this.model,i;n._$treegridHelper.ejTreeGrid("processBindings");i={};i.requestType=r.TreeGrid.Actions.Refresh;n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",i);n.model.updatedRecords=n.getUpdatedRecords();n.model.currentViewData=n.getCurrentViewData();collapsedRecordCount=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");n._totalCollapseRecordCount=collapsedRecordCount;height=(n.model.updatedRecords.length-collapsedRecordCount)*t.rowHeight;n._$ganttchartHelper.ejGanttChart("setUpdatedRecords",t.currentViewData,t.updatedRecords,t.flatRecords,t.ids);n._$ganttchartHelper.ejGanttChart("refreshHelper",t.currentViewData,t.updatedRecords,n._totalCollapseRecordCount);n._isInAdd||(n._$treegridHelper.ejTreeGrid("updateHeight"),n._$ganttchart.ejGanttChart("updateHeight",height),n._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",collapsedRecordCount),n._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",n.model.updatedRecords.length-collapsedRecordCount),t.enableAltRow&&t.currentViewData.length>0&&r.TreeGrid.updateAltRow(n,t.currentViewData[0],0,0),t.predecessorMapping&&(n._isValidationEnabled=!1,n._connectorlineIds=[],n._connectorLinesCollection=[],n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._createConnectorLinesCollection()))},_refreshGanttOnExpandCollapseAll:function(){var n=this,u={},t=this.model,i=0,f=0;if(t.enableVirtualization)u.requestType=r.TreeGrid.Actions.ExpandCollapse,n._$treegridHelper.ejTreeGrid("updateAltRowOnCollapseAll"),n._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",u),t.updatedRecords=n.getUpdatedRecords(),t.currentViewData=n.getCurrentViewData(),n._$ganttchartHelper.ejGanttChart("clearConnectorLines"),n._$ganttchartHelper.ejGanttChart("refreshHelper",n.model.currentViewData,n.model.updatedRecords),n._$treegridHelper.ejTreeGrid("updateHeight");else{if(n._isRefreshAddedRecord){n._refreshChartAndGridRows();n._isRefreshAddedRecord=!1;return}i=n._$treegridHelper.ejTreeGrid("getCollapsedRecordCount");n._totalCollapseRecordCount=i;f=(n.model.updatedRecords.length-i)*t.rowHeight;n._$ganttchartHelper.ejGanttChart("clearConnectorLines");n._$treegridHelper.ejTreeGrid("updateHeight");n._$ganttchart.ejGanttChart("updateHeight",f);n._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",i);n._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",n.model.updatedRecords.length-i);t.enableAltRow&&t.currentViewData.length>0&&r.TreeGrid.updateAltRow(n,t.currentViewData[0],0,0)}t.predecessorMapping&&(n._isValidationEnabled=!1,n._connectorlineIds=[],n._connectorLinesCollection=[],n._createConnectorLinesCollection());n.isCriticalPathEnable==!0&&n._$ganttchartHelper.ejGanttChart("criticalConnectorLine",n.criticalPathCollection,n.detailPredecessorCollection,!0,n.collectionTaskId)},_collapseAll:function(){var n=this,f=n.model,t=0,i,u={},o=f.enableVirtualization,e=n.getRows();for(n._$treegridHelper.ejTreeGrid("cancelEditCell"),n._gridRows=e,n._isInExpandCollapse=!0,n._isInExpandCollapseAll=!0,t=0;t<n.model.parentRecords.length;t++)i=n.model.parentRecords[t],u.data=i,u.recordIndex=t,u.expanded=!1,i.hasChildRecords&&(n._expandCollapseInnerLevelRecord(i,u.expanded),i.expanded&&r.TreeGrid.sendExpandCollapseRequest(n,u));f.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapse=!1;n._isInExpandCollapseAll=!1},_expandCollapseInnerLevelRecord:function(n,t){for(var f=this,e=n.childRecords.length,u={},i=0;i<e;i++)n.childRecords[i].hasChildRecords&&(f._expandCollapseInnerLevelRecord(n.childRecords[i],t),u.data=n.childRecords[i],u.expanded=t,n.childRecords[i].expanded!==t&&r.TreeGrid.sendExpandCollapseRequest(f,u))},_expandAll:function(){var n=this,f=n.model,t=0,i,u={},s=f.enableVirtualization,e=f.parentRecords,o=e.length;for(n._isInExpandCollapse=!0,n._isInExpandCollapseAll=!0,t=0;t<o;t++)i=e[t],u.data=i,u.recordIndex=t,u.expanded=!0,i.hasChildRecords&&(n._expandCollapseInnerLevelRecord(i,u.expanded),i.expanded||r.TreeGrid.sendExpandCollapseRequest(n,u));f.flatRecords.length>0&&n._refreshGanttOnExpandCollapseAll();n._isInExpandCollapse=!1;n._isInExpandCollapseAll=!1},_getDateFromFormat:function(n){if(n!=null)return typeof n=="object"?new Date(n):n?r.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):r.parseDate(n,this.model.dateFormat,this.model.locale):void 0},_getFormatedDate:function(n,t,i){return r.format(n,t,i)},_destroy:function(){var t=this,i,r;this.element.off();t._off(n(window),"resize",t.windowResize);n("#"+t._id+"_dialogEdit").data("ejDialog")&&n("#"+t._id+"_dialogEdit").data("ejDialog").destroy();n("#"+t._id+"_dialogAdd").data("ejDialog")&&n("#"+t._id+"_dialogAdd").data("ejDialog").destroy();n("#"+t._id+"_dialogAdd").remove();n("#"+t._id+"_dialogEdit").remove();n("#"+this._id+"_toolbarItems_Main").remove();n("#"+this._id+"_dialogEdit_wrapper").remove();n("#"+this._id+"startDateEdit_popup").remove();n("#"+this._id+"endDateEdit_popup").remove();n("#"+this._id+"startDateAdd_popup").remove();n("#"+this._id+"endDateAdd_popup").remove();n("#"+this._id+"taskTypeEdit_popup_wrapper").remove();n("#"+this._id+"_dialogAdd_wrapper").remove();n("#"+this._id+"effortDrivenEdit_popup_wrapper").remove();i=t._$ganttchartHelper.ejGanttChart("instance");i.destroy();r=t._$treegridHelper.ejTreeGrid("instance");r.destroy();t.element.empty().removeClass("e-gantt-core e-gantt "+t.model.cssClass)},_updateToolbar:function(){var t=this,u=t.model,e;n("#"+t._id+"_toolbarItems").remove();u.toolbarSettings.showToolbar&&(t._renderToolBar().insertBefore(n("#e-ejSpliter"+t._id)),t._updateToolbarOptions(""));t._totalBorderHeight=r.browserInfo().name=="msie"&&r.browserInfo().version<9?u.toolbarSettings.showToolbar?3:2:u.toolbarSettings.showToolbar?1:0;t._$treegridHelper.ejTreeGrid("cancelEditCell");var o=n("#"+t._id+"_toolbarItems"),i=t.element.find(".e-ganttviewerbodyContianer"),l=t.element.find(".e-ganttviewerheaderContainer"),s="#ejTreeGrid"+t._id+"e-gridcontent",a=n("#e-ejSpliter"+t._id),h=n(t.element).height()-t._totalBorderHeight,f=h-l.height()-2-o.height(),c=i.ejScroller("option","scrollTop"),v=i.ejScroller("option","scrollLeft");i.ejScroller({height:f});ganttHeight=h-o.height();a.height(ganttHeight);n("#ejTreeGrid"+t._id).height(ganttHeight);n("#ejGanttChart"+t._id).height(ganttHeight);n(s).height(f);i.height(f);n(s).ejScroller("refresh");i.ejScroller("option","scrollTop",c);i.ejScroller("option","scrollLeft",v);t._$treegridHelper.ejTreeGrid("updateViewPortHeight");t._$ganttchartHelper.ejGanttChart("updateViewPortHeight");t.model.enableVirtualization&&(t._$treegridHelper.ejTreeGrid("processBindings"),e={},e.requestType=r.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",e),t._$ganttchartHelper.ejGanttChart("refreshHelper",t.model.currentViewData,t.model.updatedRecords),t._$ganttchartHelper.ejGanttChart("onScrollHelper",c));t._clearContextMenu()},_getDurationStringValue:function(n){var i="",t;return n.duration!=null&&n.duration!=u&&(i+=n.duration+" "),n.durationUnit!=null&&n.durationUnit!=u&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this._durationUnitTexts.days:this._durationUnitTexts.day:n.durationUnit=="hour"?t?this._durationUnitTexts.hours:this._durationUnitTexts.hour:t?this._durationUnitTexts.minutes:this._durationUnitTexts.minute),i}});r.Gantt.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",Maskedit:"maskedEdit"};r.Gantt.ToolbarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",Search:"search",Indent:"indent",Outdent:"outdent",ExpandAll:"expandAll",CollapseAll:"collapseAll",PrevTimeSpan:"prevTimeSpan",NextTimeSpan:"nextTimeSpan",NextTimeSpan:"nextTimeSpan",CriticalPath:"criticalPath",ExcelExport:"excelExport"};r.Gantt.ScheduleHeaderType={Year:"year",Month:"month",Week:"week",Day:"day",Hour:"hour"};r.Gantt.minutesPerInterval={Auto:"auto",OneMinute:"oneMinute",FiveMinutes:"fiveMinutes",FifteenMinutes:"fifteenMinutes",ThirtyMinutes:"thirtyMinutes"};r.Gantt.DurationUnit={Day:"day",Hour:"hour",Minute:"minute"};r.Gantt.WorkUnit={Day:"days",Hour:"hours",Minute:"minutes"};r.Gantt.TaskType={FixedUnit:"fixedUnit",FixedWork:"fixedWork",FixedDuration:"fixedDuration"};r.Gantt.workingTimeScale={TimeScale8Hours:"TimeScale8Hours",TimeScale24Hours:"TimeScale24Hours"};r.Gantt.RowPosition={Top:"top",Bottom:"bottom",AboveSelectedRow:"aboveselectedrow",BelowSelectedRow:"belowselectedrow",Child:"child"};r.Gantt.BeginEditAction={DblClick:"dblClick",Click:"click"};r.Gantt.SelectionType={Single:"single",Multiple:"multiple"};r.Gantt.TimescaleRoundMode={Auto:"auto",Year:"year",Month:"month",Week:"week"};r.Gantt.SelectionMode={Row:"row",Cell:"cell"};r.Gantt.TaskSchedulingMode={Auto:"auto",Manual:"manual",Custom:"custom"};r.Gantt.Locale=r.Gantt.Locale||{};r.Gantt.Locale["default"]=r.Gantt.Locale["en-US"]={emptyRecord:"No records to display",alertTexts:{indentAlert:"There is no gantt record is selected to perform the Indent",outdentAlert:"There is no gantt record is selected to perform the Outdent",predecessorEditingValidationAlert:"Cyclic Dependency Occured, Please Check The Predecessor",predecessorAddingValidationAlert:"Fill all the columns in predecessor table",idValidationAlert:"Duplicate ID",dateValidationAlert:"Invalid End date",dialogResourceAlert:"Fill All the columns in resource table"},columnHeaderTexts:{taskId:"ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",resourceInfo:"Resources",duration:"Duration",status:"Progress",taskMode:"Task Mode",subTasksStartDate:"SubTasks Start Date",subTasksEndDate:"SubTasks End Date",scheduleStartDate:"Schedule Start Date",scheduleEndDate:"Schedule End Date",predecessor:"Predecessors",type:"Type",offset:"Offset",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",WBS:"WBS",WBSPredecessor:"WBS Predecessor",dialogCustomFieldName:"Column Name",dialogCustomFieldValue:"Value",notes:"Notes",taskType:"Task Type",work:"Work",unit:"Unit",effortDriven:"Effort Driven"},editDialogTexts:{addFormTitle:"New Task",editFormTitle:"Task Information",saveButton:"Save",deleteButton:"Delete Task",cancelButton:"Cancel",addPredecessor:"Add New",removePredecessor:"Remove"},columnDialogTexts:{field:"Field",headerText:"Header Text",editType:"Edit Type",filterEditType:"Filter Edit Type",allowFiltering:"Allow Filtering",allowFilteringBlankContent:"Allow Filtering Blank Content",allowSorting:"Allow Sorting",visible:"Visible",width:"Width",textAlign:"Text Alignment",headerTextAlign:"Header Text Alignment",columnsDropdownData:"Column Dropdown Data",dropdownTableText:"Text",dropdownTableValue:"Value",addData:"Add",deleteData:"Remove",allowCellSelection:"Allow Cell Selection"},toolboxTooltipTexts:{addTool:"Add",editTool:"Edit",saveTool:"Update",deleteTool:"Delete",cancelTool:"Cancel",searchTool:"Search",indentTool:"Indent",outdentTool:"Outdent",expandAllTool:"ExpandAll",collapseAllTool:"CollapseAll",nextTimeSpanTool:"Next Timespan",prevTimeSpanTool:"Previous Timespan",prevTimeSpanTool:"Previous Timespan",criticalPathTool:"Critical Path",excelExportTool:"Excel Export"},durationUnitTexts:{days:"days",hours:"hours",minutes:"minutes",day:"day",hour:"hour",minute:"minute"},durationUnitEditText:{minute:["m","min","minute","minutes"],hour:["h","hr","hour","hours"],day:["d","dy","day","days"]},workUnitTexts:{days:"days",hours:"hours",minutes:"minutes"},taskTypeTexts:{fixedWork:"Fixed Work",fixedUnit:"Fixed Units",fixedDuration:"Fixed Duration"},effortDrivenTexts:{yes:"Yes",no:"No"},contextMenuTexts:{taskDetailsText:"Task Details...",addNewTaskText:"Add New Task",indentText:"Indent",outdentText:"Outdent",deleteText:"Delete",aboveText:"Above",belowText:"Below"},newTaskTexts:{newTaskName:"New Task"},columnMenuTexts:{sortAscendingText:"Sort Ascending",sortDescendingText:"Sort Descending",columnsText:"Columns",insertColumnLeft:"Insert Column Left",insertColumnRight:"Insert Column Right",deleteColumn:"Delete Column",renameColumn:"Rename Column"},taskModeTexts:{manual:"Manual",auto:"Auto"},columnDialogTitle:{insertColumn:"Insert Column",deleteColumn:"Delete Column",renameColumn:"Rename Column"},deleteColumnText:"Are you sure you want to delete this column?",okButtonText:"OK",cancelButtonText:"Cancel",confirmDeleteText:"Confirm Delete",predecessorEditingTexts:{fromText:"From",toText:"To"},dialogTabTitleTexts:{generalTabText:"General",predecessorsTabText:"Predecessors",resourcesTabText:"Resources",customFieldsTabText:"Custom Fields",notesTabText:"Notes"},predecessorCollectionText:[{id:"SS",text:"Start-Start",value:"Start-Start"},{id:"SF",text:"Start-Finish",value:"Start-Finish"},{id:"FS",text:"Finish-Start",value:"Finish-Start"},{id:"FF",text:"Finish-Finish",value:"Finish-Finish"}]};r.Gantt.GanttRecord=function(){var n=this;n.taskId=null;n.taskName=null;n.startDate=null;n.endDate=null;n.duration=null;n.isMilestone=!1;n.status=null;n.predecessor=null;n.resourceInfo=null;n.parentItem=null;n.isSelected=!1;n.childRecords=null;n.hasChildRecords=!1;n.expanded=!1;n.level=0;n.left=0;n.width=0;n.progressWidth=0;n.item=null;n.baselineLeft=0;n.baselineWidth=0;n.baselineStartDate=null;n.baselineEndDate=null;n.isCritical=!1;n.slack=null;n.isReadOnly=!1;n.hasFilteredChildRecords=!0;n.taskbarBackground=null;n.progressbarBackground=null;n.parentProgressbarBackground=null;n.cellBackgroundColor=null;n.rowBackgroundColor=null;n.treeMappingName=[];n.dragState=!0;n.isSelected=!1;n.durationUnit="";n.isAutoSchedule=!0;n.manualStartDate=null;n.manualEndDate=null;n.manualLeft=0;n.manualDuration=0;n.manualWidth=0};r.Gantt.GanttRecord.prototype={_calculateLeft:function(n){return n._getTaskLeft(this.startDate)},_calculateManualLeft:function(n){return n._getTaskLeft(this.manualStartDate)},_calculateBaselineLeft:function(n){var t=new Date(this.baselineStartDate),i=new Date(this.baselineEndDate);return t&&i?n._getTaskLeft(t):0},_calculateBaselineRight:function(n){var i=new Date(this.baselineStartDate),t=new Date(this.baselineEndDate);return i&&t?n._getTaskLeft(t):0},_updateHoliday:function(n,t,i){var r=0,u=t&&t.length,f;if(u>0){for(r=0;r<u;r++)f=new Date(n),f.setHours(0,0,0,0),this._getFormatedDate(t[r],i.dateFormat,i.locale)==this._getFormatedDate(n,i.dateFormat,i.locale)&&n.setDate(n.getDate()+1);i.includeWeekend==!1&&n.getDay()==6&&n.setDate(n.getDate()+2)}},_calculateGanttRecordLeft:function(n,t,i){var r=this,u=r._daydiff(t,n);return u*i},_calculateReverseLeft:function(n,t,i){var h,u=this,e=0,r=u.startDate,o=u.duration&&parseInt(u.duration),f,s;if(r==null&&(r=new Date(u.endDate),r.setDate(r.getDate()-o)),i==!1){for(f=new Date(u.endDate),s=0;s<o;s++)f.getDay()==0?(e+=2,f.setDate(f.getDate()-2)):f.getDay()==6&&e++,f.setDate(f.getDate()-1);r=new Date(u.endDate);e=o===0?1:e;r.setDate(r.getDate()-(o+e-1))}return u.startDate=new Date(r),h=Math.ceil((r-n)/864e5),h*t},_calculateReverseWidth:function(n,t,i,r){var e=this,s=0,a,u,h=0,f=e.startDate,c=e.duration&&parseInt(e.duration),o=e.endDate,l;if(f==null&&(f=new Date(o),f.setDate(f.getDate()-c+1)),i==!1){for(u=new Date(o),h=0;h<c;h++)u.getDay()==0?(s+=2,u.setDate(u.getDate()-2)):u.getDay()==6&&s++,u.setDate(u.getDate()-1);f=new Date(o);f.setDate(f.getDate()-(c+s-1))}if(r!=null&&r.length>0){for(u=new Date(f),h=0;h<c;h++){for(u.setDate(u.getDate()+1),l=0;l<r.length;l++)e._getDateFromFormat(r[l].day).getDate()==u.getDate()&&s++;i==!1&&(u.getDay()==0||u.getDay()==6)&&s++}o=new Date(e.startDate);o.setDate(o.getDate()+(c+s-1))}return a=Math.ceil((new Date(o)-e.startDate)/864e5)+1,a*n},_calculateWidth:function(n){var t=this,i=new Date(t.startDate),r=new Date(t.endDate);return n._getTaskWidth(i,r)},_calculateManualWidth:function(n){var t=this,i=new Date(t.manualStartDate),r=new Date(t.manualEndDate);return n._getTaskWidth(i,r)},_calculateBaseLineWidth:function(n){var r=this,t=new Date(this.baselineStartDate),i=new Date(this.baselineEndDate);return n._getTaskWidth(t,i)},_getFormatedDate:function(n,t,i){return r.format(n,t,i)},_getDateFromFormat:function(n,t,i){if(n)return r.parseDate(n,t,i)==null?new Date(n):r.parseDate(n,t,i)},_calculateProgressWidth:function(n,t){return n*t/100},_setResourceInfo:function(t,i,r,u,f){var c=this,e=0,h=[],o,s;for(e;e<t.length;e++)o=f.filter(function(n){return t[e]===n[i]}),s=n.extend({},o[0]),o.length?(h.push(s),c._updateResourceUnit(o[0],s,u)):(t.splice(e,1),e--);return h},_updateResourceUnit:function(n,t,i){i!=""?r.isNullOrUndefined(n[i])&&(t[i]=100):t.unit=100},_updateEndDate:function(n,t){var i=this,s=new Date(n),h=new Date(i.startDate),e=i._daydiff(s,h),r=new Date(i.endDate),o=0,u,f;if(t==!1)for(u=0,u;u<=e;u++)r.setDate(r.getDate()+1),(r.getDay()==0||r.getDay()==6)&&(o+=1);f=i.endDate;f.setDate(f.getDate()+e+o);i.endDate=new Date(f)},_calculateFormatedDate:function(n,t,i){return r.format(n,t,i)},_updateParentProgress:function(n,t){var i=0,r=n.childRecords,e=r?r.length:0,o=0,s=0,f=0,u,h;if(r){for(u=0;u<e;u++)r[u].isMilestone?s+=1:o+=parseInt(r[u].status);f=e-s;i=f>0?o/f:0;isNaN(i)&&(i=0);h=n.isAutoSchedule?n.width:n.manualWidth;n.progressWidth=this._getProgressWidth(h,i);n.status=Math.floor(i);t&&(n.item[t]=n.status)}n.parentItem&&this._updateParentProgress(n.parentItem,t)},_getProgressWidth:function(n,t){return n*t/100},_calculatePredecessor:function(n,t,i){var o=[],f,r={},u,s=this.taskId.toString(),e,h=this;return typeof n=="string"&&n.split(",").forEach(function(n){u=n.split("+");e="+";n.indexOf("-")>=0&&(u=n.split("-"),e="-");f=u[0].match(/(\d+|[A-z]+)/g);r={from:f[0],predecessorsType:f.length>1?f[1].toUpperCase():"FS",offset:u.length>1?e+""+u[1]:"0",isdrawn:!1,to:s};var c=h._getOffsetDurationUnit(r.offset,t,i);r.offset=c.duration;r.offsetDurationUnit=c.durationUnit;o.push(r)}),o},_getOffsetDurationUnit:function(n,t,i){var e=0,u=i,f,o;return typeof n=="string"?(f=n.match(/(-?\d*\.*\d+|[A-z]+)/g),f&&f.length<=2&&(e=parseFloat(f[0]),u=f[1]?f[1].toLowerCase():"",u=t.minute.indexOf(u)!=-1?r.Gantt.DurationUnit.Minute:t.hour.indexOf(u)!=-1?r.Gantt.DurationUnit.Hour:t.day.indexOf(u)!=-1?r.Gantt.DurationUnit.Day:i)):(e=n,u=i),isNaN(e)&&(e=0,u=r.Gantt.DurationUnit.Day),o={},o.duration=e,o.durationUnit=u,o},_updateGanttRecord:function(n,t,i,r,u,f,e,o){var s=this,h=s.left%f,c=(s.left-h)/f;startDate=new Date(u);startDate.setDate(u.getDate()+c);startDate.getDay()==0?startDate.setDate(startDate.getDate()+1):startDate.getDay()==6&&startDate.setDate(startDate.getDate()+2);s.startDate=new Date(startDate);s.left=s._calculateLeft(this);s.width=s._calculateWidth(this);s.parentItem&&s._updateParentItem(s,n,t,i,r,u,f,e,o)},_calculateUpdatedDate:function(n,t){var r=this,i=0,u;if(t>0)for(i;i<t;i++)n=r._dataSubtract(n,1),n.getDay()==0?n.setDate(n.getDate()+1):n.getDay()==6&&n.setDate(n.getDate()+2);else for(u=-1*t,i=0;i<u;i++)n=r._dataSubtract(n,-1),n.getDay()==0?n.setDate(n.getDate()-2):n.getDay()==6&&n.setDate(n.getDate()-1);return new Date(n)},_dataSubtract:function(n,t){return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())},_calculateEndDate:function(n){var t=n.model,i=n._getEndDate(this.startDate,this.duration,this.durationUnit,this);this.endDate=new Date(i);t.endDateMapping&&(this.item[t.endDateMapping]=this.endDate)},_calculateTimeScale8Hour:function(n,t){24-n>8&&(t=this.duration<8?this.duration:this.duration%8);(24-n<8||this.duration>8)&&(n=8);t==0&&(t=8);var i=n;do n>=8&&n<13||n>13&&n<=17?(i++,t--,n=n==24?0:n+1):(n=n==24?0:n+1,i++,t--);while(t>0);return i},_dateUpdate:function(n,t,i,r){return r||(r=0),new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours()+i,n.getMinutes()+r,n.getSeconds(),n.getMilliseconds())},_calculateDuration:function(n){var t=n._getDuration(this.startDate,this.endDate,this.durationUnit,this.isAutoSchedule);this.duration=t;model.durationMapping&&this.item&&(this.item[model.durationMapping]=t,model.durationUnitMapping&&(this.item[model.durationUnitMapping]=this.durationUnit))},_calculateManualDuration:function(n){var t=n._getDuration(this.manualStartDate,this.manualEndDate,this.durationUnit,this.isAutoSchedule);this.manualDuration=t},_calculateDateDifference:function(n,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(n,t)+1:t+this._calculateWeekendCount(n,t)},_calculateWeekendCount:function(n,t){var u=t>=0?t:-1*t,r=0,i=0;if(t>0)for(i=0;i<t;i++)n.getDay()==0?(r++,n.setDate(n.getDate()+1)):n.getDay()==6?(r+=2,++i,n.setDate(n.getDate()+2)):n.setDate(n.getDate()+1);else for(i=0;i<u;i++)n.setDate(n.getDate()-1),(n.getDay()==0||n.getDay()==6)&&(r+=1);return r},_updateDurationWithWork:function(n){for(var h,c,i=n.model,e,u=this.resourceInfo,o=u?u.length:0,s=0,t=0,r=n._secondsPerDay/3600,f=0;f<o;f++)h=u[f][i.resourceUnitMapping],c=r*h/100,s+=c;e=this._getTotalWorksInHours(i,r);o!=0&&(t+=e/s);i.durationUnit=="minute"&&(t=t*r*60);i.durationUnit=="hour"&&(t=t*r);t%1!=0&&(t=t.toFixed(2));n._isDurationUpdated=!0;this.duration=t},_updateWorkWithDuration:function(n){for(var e,o,i=n.model,r=this.resourceInfo,s=r?r.length:0,t=0,u=n._secondsPerDay/3600,h=this._getDurationInDays(u),f=0;f<s;f++)e=r[f][i.resourceUnitMapping],o=u*e/100,t+=o*h;i.workUnit=="minutes"&&(t=t*60);i.workUnit=="days"&&(t=t/u);t%1!=0&&(t=t.toFixed(2));this.work=parseFloat(t)},_updateUnitWithWork:function(n){var e=n.model,r=this.resourceInfo,u=r?r.length:0,f=n._secondsPerDay/3600,i;if(u!=0){var o=this._getDurationInDays(f),s=this._getTotalWorksInHours(e,f),h=s/(o*f)*100,t=h/u;for(t%1!=0&&(t=t.toFixed(2)),i=0;i<u;i++)r[i][e.resourceUnitMapping]=t}},_getTotalWorksInHours:function(n,t){var i=this;return n.workUnit=="days"?i.work*t:n.workUnit=="minutes"?i.work/60:i.work},_getDurationInDays:function(n){var t=this;return this.durationUnit=="hour"?t.duration/n:this.durationUnit=="minute"?t.duration/(n*60):t.duration},_daydiff:function(n,t){return(t-n)/864e5},_hourdiff:function(n,t){return(t-n)/36e5},_getProgressPercent:function(n,t){return Math.ceil((t/n*100).toFixed(2))},_minutediff:function(n,t){return(t-n)/6e4},_setTime:function(n,t){var i=parseInt(n/3600),r=parseInt((n-i*3600)/60),u=n-i*3600-r*60;t.setHours(i,r,u,0)},_endDateUpdate:function(n,t,i,r,u){i||(i=0);var f=new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds());return u=="day"||u=="hour"?(f.setHours(24),f.setMinutes(i)):r.length&&(i>0?(f.setHours(24),this._setTime(r[0].from,f),f.setMinutes(i)):this._setTime(r[r.length-1].to,f)),f},_startDateUpdate:function(n,t,i,r,u){i||(i=0);var f=new Date(n.getFullYear(),n.getMonth(),n.getDate()+t,n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds());return u=="day"||u=="hour"?f.setMinutes(i):r.length&&(i>0?(this._setTime(r[0].from,f),f.setMinutes(i)):this._setTime(r[0].from,f)),f}};r.Gantt._getPredecessorsValue=function(n){var e=n.predecessor,o,r,u,t,i,f;if(e)for(o=e.length,r="",u=0;u<o;u++)t=e[u],i="",t.from!=n.taskId&&(i=t.from+t.predecessorsType,t.offset!=0&&(i+=t.offset>0?"+"+t.offset+" ":t.offset+" ",f=t.offset!=1,i+=t.offsetDurationUnit=="day"?f?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:t.offsetDurationUnit=="hour"?f?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:f?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r=r.length>0?r+","+i:i);return r};r.Gantt._getDurationStringValue=function(n){var i="",t;return n.duration!=null&&n.duration!=u&&(i+=n.duration+" "),n.durationUnit!=null&&n.durationUnit!=u&&(t=n.duration!=1,i+=n.durationUnit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.durationUnit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),i};r.Gantt._getCellValue=function(n){var t=this.data[n];return t?t:this.data.item&&this.data.item[n]}})(jQuery,Syncfusion),function(n,t,i){t.widget("ejGanttChart","ej.GanttChart",{element:null,model:null,_rootCSS:"e-ganttchart",keyConfigs:{focus:"e",insertRecord:"45",deleteRecord:"46",editRecord:"113",saveRequest:"13",cancelRequest:"27",firstRowSelection:"36",lastRowSelection:"35",leftArrow:"37",rightArrow:"39",upArrow:"38",downArrow:"40",moveCellRight:"9",moveCellLeft:"shift+9",selectedRowExpand:"alt+40",totalRowExpand:"ctrl+40",selectedRowCollapse:"alt+38",totalRowCollapse:"ctrl+38"},defaults:{childPropertyName:"",taskIdMapping:"",taskNameMapping:"",startDateMapping:"",endDateMapping:"",childMapping:"",finishDateMapping:"",durationMapping:"",milestoneMapping:"",progressMapping:"",predecessorMapping:"",resourceInfoMapping:"",resourceNameMapping:"",resourceCollection:[],holidays:[{day:null,label:null,background:null}],stripLines:[{day:null,label:null,lineStyle:"dotted",lineColor:"#169dd7",lineWidth:2}],enableTaskbarTooltip:!0,enableTaskbarDragTooltip:!0,highlightWeekends:!0,scheduleStartDate:null,scheduleEndDate:null,enableProgressBarResizing:!0,rowHeight:30,progressbarHeight:100,connectorlineWidth:1,dateFormat:"MM/dd/yyyy",locale:"en-US",taskbarBackground:"#DE8080",progressbarBackground:"#C44647",weekendBackground:"#F2F2F2",connectorLineBackground:"#383838",parentTaskbarBackground:"#383838",parentProgressbarBackground:"#1C1C1C",selectedItem:null,selectedRowIndex:-1,perDayWidth:null,perMonthWidth:null,perWeekWidth:null,perHourWidth:null,queryTaskbarInfo:null,taskbarTemplate:"",progressbarTemplate:null,parenttaskbarTemplate:"",parentprogressbarTemplate:null,milestoneTemplate:"",flatRecords:[],updatedRecords:[],ids:[],currentViewData:[],scheduleWeeks:[],scheduleYears:[],scheduleMonths:[],scheduleDays:[],scheduleHours:[],projectStartDate:null,projectEndDate:null,tooltipTemplate:"",tooltipTemplateId:"",progressbarTooltipTemplateId:"",taskbarEditingTooltipTemplateId:"",taskbarEditingTooltipTemplate:"",progressbarTooltipTemplate:"",showTaskNames:!0,leftTaskLabelMapping:"",rightTaskLabelMapping:"",LeftTaskLabelTemplate:"",rightTaskLabelTemplate:"",showProgressStatus:!0,showResourceNames:!0,enableRowHover:!1,includeWeekend:!1,allowZooming:!1,readOnly:!1,allowGanttChartEditing:!0,allowKeyboardNavigation:!0,renderBaseline:!1,baselineColor:"#fba41c ",editSettings:{allowEditing:!1,allowAdding:!1,allowDeleting:!1,editMode:"normal",dialogEditorTemplateId:null},scheduleHeaderSettings:{weekHeaderFormat:"MMM dd , yyyy",dayHeaderFormat:"",weekendBackground:"#F2F2F2",yearHeaderFormat:"yyyy",monthHeaderFormat:"MMM",hourHeaderFormat:"HH",minuteHeaderFormat:"mm",scheduleHeaderType:"week",weekStartDay:0},workingTimeScale:"TimeScale8Hours",roundOffDayworkingTime:!0,durationUnit:"day",localizedDays:null,localizedMonths:null,columnHeaderTexts:null,predecessorEditingTexts:null,enablePredecessorEditing:!0,taskbarClick:null},updateHighlightWeekends:function(n){var t=this;t.model.highlightWeekends=n;t.model.highlightWeekends==!0?t._renderWeekends():t._$weekendsContainer.remove()},updateWeekendBackground:function(n){var t=this;t.model.weekendBackground=n;t._$weekendsContainer.remove();t._renderWeekends()},showTooltip:function(n){var t=this;t.model.enableTaskbarTooltip=n;t._createTaskbarTemplate();t._refresh()},showEditingTooltip:function(n){var t=this;t.model.enableTaskbarDragTooltip=n;t._createTaskbarTemplate();t._refresh()},updateConnectorLineBackground:function(n){var t=this;t.model.connectorLineBackground=n;t._createConnectorLineTemplate()},updateConnectorlineWidth:function(n){var t=this;t.model.connectorlineWidth=parseInt(n);t._createConnectorLineTemplate()},updateEditedRecordEndDate:function(n){var t=this;t._currentEditedRecord.endDate=n},updateEditedRecordDuration:function(n){var t=this;t._currentEditedRecord.duration=n},updateTaskbarBackground:function(n){var t=this;t.model.taskbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateProgressbarBackground:function(n){this.model.progressbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateParentTaskbarBackground:function(n){this.model.parentTaskbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateParentProgressbarBackground:function(n){this.model.parentProgressbarBackground=n;this._createTaskbarTemplate();this._refresh()},updateRenderTaskNames:function(n){var t=this;t.model.showTaskNames=n;t._createTaskbarTemplate();t._refresh()},refreshLeftTaskLabelMapping:function(n){var t=this;t.model.leftTaskLabelMapping=n;t._createTaskbarTemplate();t._refresh()},refreshRightTaskLabelMapping:function(n){var t=this;t.model.rightTaskLabelMapping=n;t._createTaskbarTemplate();t._refresh()},refreshLeftTaskLabelTemplate:function(n){var t=this;t.model.leftTaskLabelTemplate=n;t._createTaskbarTemplate();t._refresh()},refreshRightTaskLabelTemplate:function(n){var t=this;t.model.rightTaskLabelTemplate=n;t._createTaskbarTemplate();t._refresh()},updateRendeProgressStatus:function(n){var t=this;t.model.showProgressStatus=n;t._createTaskbarTemplate();t._refresh()},updateRenderResourceNames:function(n){var t=this;t.model.showResourceNames=n;t._createTaskbarTemplate();t._refresh()},changeMilestoneTemplate:function(n){var t=this;t.model.milestoneTemplate=n;t._createTaskbarTemplate();t._refresh()},changeTaskbarTemplate:function(n){var t=this;t.model.taskbarTemplate=n;t._createTaskbarTemplate();t._refresh()},changeParentTaskbarTemplate:function(n){var t=this;t.model.parentTaskbarTemplate=n;t._createTaskbarTemplate();t._refresh()},ganttChartEditing:function(n){var t=this;t.model.allowGanttChartEditing=n},updateReadOnly:function(n){var t=this;t.model.readOnly=n},resizeProgressbar:function(n){var t=this;t.model.enableProgressBarResizing=n},updateAllowKeyboardNavigation:function(n){this.model.allowKeyboardNavigation=n},updateProgressbarHeight:function(n){var t=this;this.model.progressbarHeight=n;t._createTaskbarTemplate();t._refresh()},updateBaselineColor:function(n){var t=this;this.model.baselineColor=n;t._createTaskbarTemplate();t._refresh()},updateRenderBaseline:function(n){var t=this;this.model.renderBaseline=n;t._createTaskbarTemplate();t._refresh();t._createConnectorLineTemplate()},focusGanttElement:function(){if(t.browserInfo().name=="msie")try{this.element[0].setActive()}catch(n){}else this.element[0].focus()},_getYearWidth:function(){for(var i=this,n=0,t=0,n=0;n<this.model.scheduleYears.length;n++)t+=this._getTemplateYearWidth(this.model.scheduleYears[n]);return t},_getMonthWidth:function(){for(var r,e,u,h,o=this,c=o.model,n,s=c.scheduleMonths,i=0,f=0;f<s.length;f++)r=s[f],n=typeof r=="object"?new Date(r):t.parseDate(r,this.model.dateFormat,this.model.locale),e=new Date(n.getFullYear(),n.getMonth()+1,0),u=e.getDate(),n.getTime()===o.model.scheduleMonths[0].getTime()?(h=e.getDate()-n.getDate(),i+=this.model.perDayWidth*(h+1)):u==31?i+=this.model.perDayWidth*31:u==30?i+=this.model.perDayWidth*30:u==28&&(i+=this.model.perDayWidth*28);return i},_getWeekWidth:function(){return this.model.perDayWidth*7},_getNumberOftWeeks:function(n,t){var i=new Date(n),u=new Date(t),r=[];do r.push(new Date(i)),i.setDate(i.getDate()+7);while(!(i>u));return r},_getHeight:function(){return this._containerHeight},_setHeight:function(n){this._containerHeight=n},getGanttChartRows:function(){return this._ganttChartRows},getUpdatedRecords:function(){return this.model.flatRecords},setUpdatedRecords:function(n,t,i,r){var u=this;u.model.currentViewData=n;u.model.updatedRecords=t;u.model.flatRecords=i;u.model.ids=r},_getFormatedDate:function(n,i,r){return t.format(n,i,r)},_getViewportHeight:function(){var n=this,t=n._$headerContainer;return n.element.height()-t.height()-parseFloat(t.css("border-bottom-width"))},updateViewPortHeight:function(){var n=this;n._viewportHeight=n._getViewportHeight()},_init:function(){var r=this,u=r.model,f=u.scheduleHeaderSettings.scheduleHeaderType,e,o;r.element.addClass("e-ganttchart-core");r.element.attr("tabindex","0");r._initPrivateProperties();r._initialize();r._renderGanttChart();r._$bodyContainerParent.append(r._$bodyContainer);r._$bodyContainer.append(r._$bodyContent);r._$ganttChartContainer.append(r._$bodyContainerParent);n(r._$bodyContainer).css({height:r._viewportHeight+"px"});r.model.enableVirtualization&&n(r._$bodyContent).css({height:u.rowHeight*u.updatedRecords.length+"px"});f=="week"?n(r._$bodyContent).css({width:u.scheduleWeeks.length*r._scheduleWeekWidth+"px"}):f=="year"?n(r._$bodyContent).css({width:r._scheduleYearWidth+"px"}):f=="month"?n(r._$bodyContent).css({width:r._scheduleMonthWidth+"px"}):f=="day"?n(r._$bodyContent).css({width:u.scheduleDays.length*u.perHourWidth*24+"px"}):f=="hour"&&n(r._$bodyContent).css({width:u.scheduleHours.length*u.perMinuteWidth*r._totalInterval+"px"});r.createGridLinesTable();r.renderGanttRecords();e=t.buildTag("div");e.append(r._$bodyContent);r._$bodyContainer.append(e);r._$bodyContainer.ejScroller({width:r.element.width()-1,enableTouchScroll:!1,height:r._getViewportHeight(),scroll:function(n){var t=n.scrollTop;n.requestType="scroll";n.delta=t;t!=i?r.onScrollHelper(t,!0)===!1&&(n.cancel=!0):r._handleScroll(n)}});r._$bodyContainer.ejScroller("model.keyConfigs",{up:"",down:"",left:"",right:""});r._$bodyContainer.ejScroller("refresh");o=r._$bodyContainer.ejScroller("isHScroll");o?r._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):r._$bodyContainer.find("div.e-content").addClass("e-borderbox");r._wireEvents()},reRenderGanttChart:function(t,i){var r=this,u=r.model,f=u.scheduleHeaderSettings.scheduleHeaderType;r._wireEvents();u.perDayWidth=t;u.flatRecords=i;r._scheduleWeekWidth=r._getWeekWidth();r._scheduleYearWidth=r._getYearWidth();r._scheduleMonthWidth=r._getMonthWidth();n(r._$headerContainer).empty();n(r._$scheduleDiv).empty();r._renderGanttChart();r._$bodyContainerParent.append(r._$bodyContainer);r._$bodyContainer.append(r._$bodyContent);r._$ganttChartContainer.append(r._$bodyContainerParent);f=="week"?n(r._$bodyContent).css({width:u.scheduleWeeks.length*r._scheduleWeekWidth+"px"}):f=="year"?n(r._$bodyContent).css({width:r._scheduleYearWidth+"px"}):f=="month"?n(r._$bodyContent).css({width:r._scheduleMonthWidth+"px"}):f=="day"?n(r._$bodyContent).css({width:u.scheduleDays.length*u.perHourWidth*24+"px"}):f=="hour"&&n(r._$bodyContent).css({width:u.scheduleHours.length*u.perMinuteWidth*r._totalInterval+"px"})},_initPrivateProperties:function(){var t=this;t._viewportHeight=0;t._prevScrollTop=0;t._scrollTop=0;t._vScrollDir=1;t._$ganttChartContainer=null;t._$headerContainer=null;t._$bodyContainer=null;t._$bodyContent=null;t._$dependencyViewContainer=null;t._$secondaryCanvas=null;t._$ganttViewTable=null;t._$ganttViewTablebody=null;t._weekdays=[];t._rowMargin=0;t._renderedRange=null;t._visibleRange=null;t._vTop=null;t._vBottom=null;t._rTop=null;t._rBottom=null;t._vscrollDist=0;t._containerHeight=0;t._id=this.element.attr("id");t._ganttChartRows=null;t._filteredRecords=[];t._sortedRecords=[];t._tempSortedRecords=[];t._scheduleHours=[];t._scheduleMinutes=[];t._updateScheduleWidth();t._totalMonthWidth=0;t._tempFilteredRecords=[];t._prevLeft=0;t._allowDragging=!1;t._leftResizing=!1;t._rightResizing=!1;t._progressResizing=!1;t._editingContainer=null;t._allowExpandCollapse=!0;t._leftResizer=null;t._taskbarItem=null;t._progressbarItem=null;t._progressResizer=null;t._rightResizer=null;t._manualRightResizer=null;t._tasknameContainer=null;t._mousePosX=0;t._currMousePosX=0;t._currMousePosY=0;t._prevItem={};t._parentCollectionPreviousValues=[];t._mouseTarget=null;t._mouseDown=!1;t._$scheduleDiv=null;t._leftResizerGripper=null;t._rightResizerGripper=null;t._progressHandle=null;t._progressHandleChild=null;t._currentEditedRecord={taskId:null,taskName:null,startDate:null,endDate:null,duration:null,isMilestone:!1,status:null,predecessor:null,resourceInfo:null,parentItem:null,isSelected:!1,childRecords:null,hasChildRecords:!1,expanded:!1,level:0,left:0,width:0,progressWidth:0,item:null,baselineLeft:0,baselineWidth:0,baselineStartDate:null,baselineEndDate:null,isReadOnly:!1,hasFilteredChildRecords:!0,serialNumber:null,taskbarBackground:null,progressbarBackground:null,parentProgressbarBackground:null,parentTaskbarBackground:null,cellBackgroundColor:null,rowBackgroundColor:null,treeMappingName:[],dragState:!0,isSelected:!1,durationUnit:""};t._mouseHoverTooltip=document.getElementById(this.model.tooltipTemplate);t._progressBarTooltipID=document.getElementById(this.model.progressbarTooltipTemplateId);t._taskbarEditingTooltipID=document.getElementById(this.model.taskbarEditingTooltipTemplateId);t._scrollBarHeight=18;t._windowWidth=n(window).width();t._windowHeight=n(window).height();t._editingItem=null;t._editingTarget=null;t.tooltipState=null;t._visibleRecordsCount=0;t._tooltipTimer;t._$gridLinesTablebody=null;t._leftConnectorPoint=null;t._rightConnectorPoint=null;t._childLeftConnectorPoint=null;t._childRightConnectorPoint=null;t._editPredecessor=!1;t._connectorPointX=null;t._connectorPointY=null;t._predecessorTooltip=null;t._totalCollapsedRecordCount=0;t._milesStoneWidth=0;t._connectorPointWidth=0;t._newXYPos=!0;t._posX1=null;t._posY1=null},_updateScheduleWidth:function(){var n=this;n._scheduleWeekWidth=n._getWeekWidth();n._numOfWeeks=n._getNumberOftWeeks(this.model.projectStartDate,this.model.projectEndDate);n._scheduleYearWidth=n._getYearWidth();n._scheduleMonthWidth=n._getMonthWidth();n._totalWeekWidth=n._scheduleWeekWidth*n._numOfWeeks.length;n._balanceWidth=n._totalWeekWidth-n._scheduleMonthWidth;n._scheduleMonthWidth+=n._balanceWidth},_initialize:function(){var n=this;n._$ganttChartContainer=t.buildTag("div.e-ganttviewercontainer#ganttviewercontainer"+n._id,"",{width:"100%"},{});n._$headerContainer=t.buildTag("div.e-ganttviewerheaderContainer#ganttviewerheaderContainer"+n._id,"",{"border-right-style":"solid","border-right-width":"1px"},{});n._$bodyContainer=t.buildTag("div.e-ganttviewerbodyContianer#ganttviewerbodyContianer"+n._id,"",{"-ms-touch-action":"none"},{});n._$bodyContainerParent=t.buildTag("div.e-ganttviewerbodyContianerparent#ganttviewerbodyContianerParent"+n._id,"",{"-ms-touch-action":"none","border-right-style":"solid","border-right-width":"1px","box-sizing":"border-box",width:"auto",height:"auto"},{});n._$bodyContent=t.buildTag("div.e-ganttviewerbodyContent#ganttviewerbodyContent"+n._id,"",{},{});n._$dependencyViewContainer=t.buildTag("div.e-ganttviewerbodyContianer-dependencyViewContainer#dependencyViewContainer"+n._id,"",{"z-index":"4",position:"absolute"},{});n._$secondaryCanvas=t.buildTag("div.e-ganttviewerbodyContianer-secondaryCanvas","",{"z-index":"3",position:"absolute"},{});n._$stripLineContainer=t.buildTag("div.e-ganttviewerbodyContianer-stripLines","",{"z-index":"6",position:"absolute"},{});n._$weekendsContainer=t.buildTag("div.e-ganttviewerbodyContianer-weekendsContainer","",{"z-index":"1",position:"absolute"},{});n._$ganttViewTable=t.buildTag("table.e-ganttviewerbodyContianer-ganttViewTable#ganttViewTable"+n._id,"",{"z-index":"5",position:"absolute"},{cellspacing:"0px"});n._$scheduleDiv=t.buildTag("div.e-gantt-schedule-container#gantt-schedule"+n._id+"","",{},{})},_getScheduleLength:function(n){var t=this,i=t.model;switch(n){case"week":return i.scheduleWeeks.length*t._scheduleWeekWidth;case"year":return t._scheduleYearWidth;case"month":return t._scheduleMonthWidth;case"day":return i.scheduleDays.length*t.model.perHourWidth*24;case"hour":return i.scheduleHours.length*i.perMinuteWidth*t._totalInterval;default:return i.scheduleWeeks.length*t._scheduleWeekWidth}},_renderGanttChart:function(){var i=this,r=i.model,f,e,o=r.scheduleHeaderSettings.scheduleHeaderType,s,u;if(i._createSchedule(i._getDateType(r.scheduleStartDate),i._getDateType(r.scheduleEndDate)),i._viewportHeight=i._getViewportHeight(),i._$ganttViewTable.css("width",i._getScheduleLength(o)+"px"),f=t.buildTag("colgroup","",{},{}),e=n(document.createElement("col")),e.css("width",i._getScheduleLength(o)+"px"),f.append(e),i._$ganttViewTable.append(f),i._createTooltipTemplate(),i._createEditingTooltipTemplate(),i._createProgressbarTooltipTemplate(),i._createTaskbarTemplate(),i._createConnectorLineTemplate(),i._updateCurrentViewData(),i.model.highlightWeekends==!0&&r.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Week&&i._renderWeekends(),i._$stripLineContainer.empty(),i.model.stripLines!=null&&this._renderStripLines(i.model.stripLines),i._$secondaryCanvas.empty(),i.model.holidays!=null)for(s=i.model.holidays.length,u=0;u<s;u++)i._renderHoliday(i.model.holidays[u])},renderConnectorLines:function(t){var i=this,r=n.render[i._id+"ConnectorLineTemplate"](t);n(i._$dependencyViewContainer).empty();i._$dependencyViewContainer.append(r);i._$bodyContent.append(i._$dependencyViewContainer)},clearConnectorLines:function(){n(this._$dependencyViewContainer).empty()},appendConnectorLine:function(t){var i=this,r=n.render[i._id+"ConnectorLineTemplate"](t);i._$dependencyViewContainer.append(r)},setCollapsedRecordCount:function(n){this._totalCollapsedRecordCount=n},getCollapsedRecordCount:function(){return this._totalCollapsedRecordCount},removeConnectorline:function(n){this.element.find("#ConnectorLine"+n).remove()},_wireEvents:function(){var i=this,r=jQuery.uaMatch(navigator.userAgent);t.isTouchDevice()?(i._on(i.element,"touchstart",".e-gantt-milestone-container,.e-childContainer",this._mouseHover),i._on(i.element,"touchstart",".e-childContainer,.e-gantt-milestone-container,.e-parentContainer",i._mousedown),n(document.body).bind("touchmove",n.proxy(i.handleMouseMove,i)),i._on(i.element,"touchleave",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseLeave),n(i._$bodyContainer).bind("touchend",n.proxy(i._handleMouseUp,i)),i._on(i.element,"tap",i._cellClickHandler)):(i._on(i.element,"mouseenter",".e-gantt-milestone-container,.e-childContainer,.e-parentContainer",this._mouseHover),i._on(i.element,"mouseleave",".e-gantt-milestone-container,.e-childContainer,.e-parentContainer",this._mouseLeave),i._on(i.element,"click",i._cellClickHandler),i._on(i.element,"mouseenter",".taskbarresizer-left",i._resizerleftOver),i._on(i.element,"mouseenter",".taskbarresizer-right",i._resizerrightOver),i._on(i.element,"mouseenter",".progressbarresizer-right",i._progressresizerOver),i._on(i.element,"mouseenter",".e-connectorpoint-left",i._dragLeftOver),i._on(i.element,"mouseenter",".e-connectorpoint-right",i._dragRightOver),t.browserInfo().name!="msie"?i._on(i.element,"mousedown",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._mousedown):i._on(i.element,"mousedown",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._mousedown),n(i._$bodyContainer).bind("mouseup",n.proxy(i._handleMouseUp,i)),n(document).bind("mouseup",n.proxy(i._tooltipMouseup,i)),i._on(i.element,"mouseenter",".e-stripline",i._stripLineMouseOver),i._on(i.element,"mouseleave",".e-stripline",i._stripLineMouseLeave),r.browser.toLowerCase()=="chrome"&&(i._on(i.element,"touchstart",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseHover),i._on(i.element,"touchstart",".e-childContainer,.e-gantt-milestone-container",i._mousedown),i._on(i.element,"touchleave",".e-gantt-milestone-container,.e-childContainer, .e-parentContainer",this._mouseLeave),n(document.body).bind("touchmove",n.proxy(i.handleMouseMove,i)),i._on(i.element,"touchleave",".e-parentContainer,.e-childContainer,.e-gantt-milestone-container",i._handleMouseUp),n(i._$bodyContainer).bind("touchend",n.proxy(i._handleMouseUp,i)),n(i._$bodyContainer).bind("touchleave",n.proxy(i._handleMouseUp,i))));i._enableEditingEvents()},_enableEditingEvents:function(){var n=this,i=n.model;i.editSettings.allowEditing&&i.editSettings.editMode==="normal"?t.isTouchDevice?n._on(this.element,"doubletap",".e-ganttviewerbodyContent",n._editdblClickHandler):n._on(this.element,"dblclick",".e-ganttviewerbodyContent",n._editdblClickHandler):t.isTouchDevice?n._off(this.element,"doubletap",".e-ganttviewerbodyContent",n._editdblClickHandler):n._off(this.element,"dblclick",".e-ganttviewerbodyContent",n._editdblClickHandler)},updateEditSettings:function(n){var i=this;n&&(n.editMode&&(i.model.editSettings.editMode=n.editMode),t.isNullOrUndefined(n.allowAdding)||(i.model.editSettings.allowAdding=n.allowAdding),t.isNullOrUndefined(n.allowEditing)||(i.model.editSettings.allowEditing=n.allowEditing),t.isNullOrUndefined(n.allowDeleting)||(i.model.editSettings.allowDeleting=n.allowDeleting),t.isNullOrUndefined(n.beginEditAction)||(i.model.editSettings.beginEditAction=n.beginEditAction),i._enableEditingEvents())},_editdblClickHandler:function(){var n=this,i={};n.model.editSettings.editMode==="normal"&&!model.readOnly&&n.model.editSettings.allowEditing&&(i.requestType=t.TreeGrid.Actions.BeginEdit,n._trigger("actionBegin",i))},_enableRowHover:function(){var n=this;n.model.enableRowHover?n._on(n.element,"mouseleave mouseenter","#ganttviewerbodyContent,.e-ganttviewerbodyContent tr,.e-ganttviewerbodyContent"+n._id,n._rowHover):n._on(n.element,"mouseleave mouseenter","#ganttviewerbodyContent,.e-ganttviewerbodyContent tr,.e-ganttviewerbodyContent"+n._id)},_stripLineMouseLeave:function(){window.clearTimeout(this._tooltipTimer);this._clearTooltip()},_stripLineMouseOver:function(i){i.target.style.cursor="pointer";var r=this,h=r.model,u=n(i.target),c,f,e,l,o=0,s=0;r._clearTooltip();c=u.hasClass("e-striplinespan")?u[0].parentNode:u[0];f=c.id.match(/(\d+|[A-z]+)/g);(i.type=="mouseenter"||i.type=="mousemove")&&(i||(i=window.event),i.originalEvent.pageX||i.originalEvent.pageY?(o=i.originalEvent.pageX,s=i.originalEvent.pageY):(i.originalEvent.clientX||i.originalEvent.clientY)&&(o=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop),e=t.buildTag("table.e-tooltiptable","",{width:"auto"},{cellspacing:"2px",cellpadding:"2px"}),l=t.buildTag("tbody","<tr><td>"+h.stripLines[f[1]].day+"<\/td><\/tr><tr><td>"+h.stripLines[f[1]].label+"<\/td><\/tr>",{},{}),e.append(l),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",e,{position:"absolute","z-index":r._getMaxZIndex()+1},{}),setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700))},_tooltipMouseup:function(){var n=this;n._mouseTarget==null||t.isTouchDevice()||n._handleMouseUp(n._mouseTarget)},_clearTooltip:function(){var t=this;t._mouseHoverTooltip&&n(t._mouseHoverTooltip).remove();n(".e-editingtooltip").remove();n("#tooltipgantt").remove();n(".e-progressbartooltip").remove();t._mouseHoverTooltip=null},_mouseWheel:function(n){if(this.model.allowZooming){var r=this,i={},t=null;if(n=n.originalEvent,n.preventDefault(),n.wheelDelta?t=-n.wheelDelta/120:n.detail&&(t=n.detail/3),!t)return;i.requestType="scroll";i.delta=t;r._enbleZooming(i)}},_resizerrightOver:function(n){var t=this,i=n.target,r=i.parentNode;t.model.allowGanttChartEditing==!0&&t.model.readOnly==!1&&(this._mouseDown==!1&&(n.target.style.cursor="w-resize"),t._setEditingElements(r))},_resizerrightLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_resizerleftOver:function(n){var t=this,i=n.target,r=i.parentNode;t.model.allowGanttChartEditing==!0&&t.model.readOnly==!1&&(this._mouseDown==!1&&(n.target.style.cursor="e-resize"),t._setEditingElements(r))},_resizerleftLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_progressresizerOver:function(t){var i=this,r=t.target,u=r.parentNode;i.model.allowGanttChartEditing==!0&&i.model.readOnly==!1&&(i.model.enableProgressBarResizing?(i._mouseDown==!1&&n(r).prev(".e-gantt-childtaskbar").has(".e-gantt-childtaskbar-progress").length>0&&(r.style.cursor="col-resize"),i._setEditingElements(u)):r.style.cursor="move")},_progressresizerLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.readOnly==!1&&n._removeEditingElements()},_secondMouseOverConnectorPoint:function(t,i){var r=this,v,y,p,u,a;if(r._mouseDown&&r._falseLine||i&&r._falseLine){var e=n(t.target),w=r.getGanttChartRows(),v=e.closest("tr.e-ganttrowcell"),y=w.index(v),p=r.model.currentViewData[y],h=r._editingItem,c=p,f,l,o,s=r.model.predecessorText;if(r._prevItem.predecessorTarget==="Start"?f=h.taskId+"S":r._prevItem.predecessorTarget==="Finish"&&(f=h.taskId+"F"),e.hasClass("e-connectortouchpoint")?e.parent().hasClass("e-connectorpoint-left")?(f+="S",o=s.Start):e.parent().hasClass("e-connectorpoint-right")&&(f+="F",o=s.Finish):e.hasClass("e-connectorpoint-left")?(f+="S",o=s.Start):e.hasClass("e-connectorpoint-right")&&(f+="F",o=s.Finish),r._predecessorTooltip&&($table=r._predecessorTooltip.find("table"),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(2)").text(c.taskName),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(3)").text(o)),u={},u.requestType="validatePredecessor",u.fromItem=h,u.toItem=c,l=u.toItem.item[r.model.predecessorMapping]?u.toItem.item[r.model.predecessorMapping]+","+f:f,u.predecessor=f,u.currentRecord=c,u.predecessorString=[],u.predecessorString.push(l),a=r._completeAction(u),r._predecessorTooltip&&($td=$table.find("tbody").find("tr:eq(0)").find("td:eq(0)"),a?($td.removeClass(),$td.addClass("e-predecessor-true")):($td.removeClass(),$td.addClass("e-predecessor-false"))),i)return u}},_dragLeftOver:function(t){var i=this,r=t.target,u=r.parentNode;t.type=="touchmove"&&n(t.target).hasClass("e-connectortouchpoint")&&(u=r.parentNode.parentNode);i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&i.model.readOnly==!1&&(this._mouseDown==!1&&(r.style.cursor="pointer"),i._setEditingElements(u));n(u).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragLeftLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.enablePredecessorEditing&&n.model.readOnly==!1&&n._removeEditingElements()},_dragRightOver:function(t){var i=this,r=t.target,u=r.parentNode;t.type=="touchmove"&&n(t.target).hasClass("e-connectortouchpoint")&&(u=r.parentNode.parentNode);i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&i.model.readOnly==!1&&(this._mouseDown==!1&&(r.style.cursor="pointer"),i._setEditingElements(u));n(u).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragRightLeave:function(){var n=this;n.model.allowGanttChartEditing==!0&&n.model.enablePredecessorEditing&&n.model.readOnly==!1&&n._removeEditingElements()},_setEditingElements:function(t){var i=this,r;if(i._editingTarget&&!i._editPredecessor&&n(t).find(i._editingTarget).length==0)return!0;n(t).hasClass("e-childContainer")&&(i._leftResizerGripper=t.querySelector(".taskbarresizer-left"),i._rightResizerGripper=t.querySelector(".taskbarresizer-right"),r=t.querySelector(".progressbarresizer-right"),i._progressHandle=r&&r.firstChild,i._progressHandleChild=r&&r.childNodes[1],n(i._leftResizerGripper).addClass("gripper"),n(i._rightResizerGripper).addClass("gripper"),i.model.progressMapping&&(n(i._progressHandle).addClass("e-progresshandle"),n(i._progressHandleChild).addClass("e-progresshandleafter")));i.model.enablePredecessorEditing&&(n(t).hasClass("e-childContainer")&&i.model.predecessorMapping&&!i._falseLine?(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-gantt-milestone-container")&&i.model.predecessorMapping&&!i._falseLine?(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-childContainer")&&i.model.predecessorMapping&&i._falseLine?(i._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._childRightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-gantt-milestone-container")&&i.model.predecessorMapping&&i._falseLine?(i._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._childRightConnectorPoint).addClass("e-connectorpoint-hover")):n(t).hasClass("e-parentContainer")&&i.model.predecessorMapping&&!i._falseLine&&(i._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),i._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),n(i._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-connectorpoint-hover"),n(t).hasClass("e-manualparenttaskbar")&&(n(i._leftConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(i._rightConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"))))},_removeEditingElements:function(){var t=this;n(t._leftResizerGripper).removeClass("gripper");n(t._rightResizerGripper).removeClass("gripper");t.model.progressMapping&&(n(t._progressHandle).removeClass("e-progresshandle"),n(t._progressHandleChild).removeClass("e-progresshandleafter"));t.model.enablePredecessorEditing&&(t.model.predecessorMapping&&t._mouseDown==!1&&(n(t._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(t._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),t._leftConnectorPoint=null,t._rightConnectorPoint=null),(t.model.predecessorMapping&&t._leftConnectorPoint!==null&&t._mouseDown==!0||t._childLeftConnectorPoint)&&(n(t._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),n(t._childRightConnectorPoint).removeClass("e-connectorpoint-hover"),t._predecessorTooltip&&($table=t._predecessorTooltip.find("table"),$table.find("tbody").find("tr:eq(1)").find("td:eq(2)").text(""),$table.find("tbody").find("tr:eq(1)").find("td:eq(3)").text(""),$td=$table.find("tbody").find("tr:eq(0)").find("td:eq(0)").removeClass(),$td.addClass("e-predecessor-false"))))},refreshHeight:function(){var n=this;n._$bodyContainer.ejScroller("refresh")},_mousedown:function(i){var r,s,o;if(i.which==2||i.which==3)return!1;r=this;r._clearTooltip();r._mouseDown=!0;args={};var f=n(i.target),l=r.getGanttChartRows(),h=f.closest("tr.e-ganttrowcell"),c=l.index(h),e=r.model.currentViewData[c],a=e.parentItem,u=f[0].parentNode,v=jQuery.uaMatch(navigator.userAgent),y=this.model;t.isNullOrUndefined(e)||(i.type=="touchstart"&&(i.preventDefault(),n(".e-connectortouchpoint").addClass("e-enableconnectortouchpoint")),r._editingItem=e,r._editingTarget=f,r._allowExpandCollapse=!0,u=n(u).hasClass("progressbarresizer-right")?u.parentNode:n(u).hasClass("e-gantt-childtaskbar-progress")?n(u).closest("div.e-childContainer"):n(u).hasClass("progressbarhandler")?f.closest(".e-childContainer")[0]:n(u).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container"),(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-parentContainer")||n(u).hasClass("e-gantt-milestone-container"))&&(n(h).addClass("e-editmode"),r._mouseTarget=i),r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container")||n(u).hasClass("e-parentContainer"))&&((i.target.style.cursor=="e-resize"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone"))||i.type=="touchstart"&&i.target.className=="taskbarresizer-left")&&(r._updateEditingType(),r._leftResizing=!0),(i.target.style.cursor=="w-resize"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-parentContainer"))||i.type=="touchstart"&&i.target.className=="taskbarresizer-right")&&(r._updateEditingType(),r._rightResizing=!0),s=n(i.target).closest(".progressbarresizer-right"),((i.target.style.cursor=="col-resize"||s.length&&s[0].style.cursor=="col-resize")&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone"))||i.type=="touchstart"&&i.target.className=="progressbarresizer-right")&&(r._updateEditingType(),r._progressResizing=!0),o=n(i.target).closest("[style*='cursor: move']"),((i.target.style.cursor=="move"||o.length&&o[0].style.cursor=="move")&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container"))||n(f[0]).hasClass("e-gantt-manualparenttaskbar"))&&(r._updateEditingType(),r._allowDragging=!0),(i.target.style.cursor==""&&(o.length&&o[0].style.cursor==""||o.length==0)&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container"))||e.isAutoSchedule&&n(f).hasClass("e-gantt-manualparenttaskbar"))&&(r._updateEditingType(),i.target.className=="taskbarresizer-left e-icon"||i.target.className=="taskbarresizer-left e-icon gripper"?r._leftResizing=!0:i.target.className=="taskbarresizer-right e-icon"||i.target.className=="taskbarresizer-right e-icon gripper"?r._rightResizing=!0:i.target.className=="progressbarhandler e-progresshandle"||i.target.className=="e-progresshandler-element"||i.target.className=="e-progresshandlerafter-element"||i.target.className=="progressbarresizer-right"?r._progressResizing=!0:(i.target.className=="e-gantt-childtaskbar-progress  progressbar"||i.target.className=="e-tasklabel"||i.target.className=="e-gantt-childtaskbar"||i.target.className=="e-gantt-milestone milestone-top"||i.target.className=="e-gantt-milestone milestone-bottom"||n(i.target).hasClass("e-gantt-milestone")||n(i.target).closest(".e-gantt-milestone").length>0||n(i.target).closest(".e-gantt-childtaskbar").length>0)&&(r._allowDragging=!0)),r.model.enablePredecessorEditing&&(i.target.style.cursor=="pointer"&&(n(u).hasClass("e-childContainer")||n(u).hasClass("e-gantt-milestone")||n(u).hasClass("e-gantt-milestone-container")||n(u).hasClass("e-parentContainer"))||i.type=="touchstart"&&(i.target.className=="e-connectorpoint-right"||i.target.className=="e-connectorpoint-left"||i.target.className=="e-connectorpoint-right e-connectorpoint-hover"||i.target.className=="e-connectorpoint-left e-connectorpoint-hover"))&&(r._updateEditingType(),r._editPredecessor=!0,f.hasClass("e-connectorpoint-left")||f.hasClass("e-connectorpoint-left e-connectorpoint-hover")?r._prevItem.predecessorTarget="Start":(f.hasClass("e-connectorpoint-right")||f.hasClass("e-connectorpoint-right e-connectorpoint-hover"))&&(r._prevItem.predecessorTarget="Finish")),i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(r._posX1=r._currMousePosX=i.originalEvent.pageX,r._posY1=r._currMousePosY=i.originalEvent.pageY,r.dragPosX=i.originalEvent.pageX):i.originalEvent.clientX||i.originalEvent.clientY?(r._posX1=r.dragPosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,r._posY1=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(r._posX1=r._currMousePosX=i.originalEvent.changedTouches[0].pageX,r._posY1=r._currMousePosY=i.originalEvent.changedTouches[0].pageY,r.dragPosX=i.originalEvent.changedTouches[0].pageX),r._prevItem.left=e.left,r._prevItem.status=e.status,r._prevItem.duration=e.duration,r._prevItem.startDate=e.startDate,r._prevItem.endDate=e.endDate,r._prevItem.width=e.width,r._parentCollectionPreviousValues=r._getParentCollectionPreviousValues(e),r.model.enablePredecessorEditing&&(r._connectorPointX=r._currMousePosX-r._$bodyContent.offset().left,r._connectorPointY=r._currMousePosY-r._$bodyContent.offset().top),n(r._$bodyContainer).bind("mousemove",n.proxy(r.handleMouseMove,r))),r._appendTooltip(f,c),r._trigger("clearColumnMenu"))},_getParentCollectionPreviousValues:function(n){var r=n,i={},u=[];do parentItem=r.parentItem,t.isNullOrUndefined(parentItem)||(i.left=parentItem.left,i.status=parentItem.status,i.duration=parentItem.duration,i.startDate=parentItem.startDate,i.endDate=parentItem.endDate,i.width=parentItem.width,i.index=parentItem.index,i.isAutoSchedule||(i.manualLeft=parentItem.manualLeft,i.manualStartDate=parentItem.manualStartDate,i.manualEndDate=parentItem.manualEndDate,i.manualDuration=parentItem.manualDuration),u.push(i),r=parentItem,i={});while(r.parentItem);return u},handleMouseMove:function(n){this._updateOnmouseMove(n)},_handleMouseUp:function(i){var r=this,u={},p=r.getGanttChartRows(),a,c,v=0,f,w=r._posX1,b=r._posY1,o,s,y,l,e,h;t.isNullOrUndefined(i.pageX)?(o=i.originalEvent.changedTouches[0].pageX,s=i.originalEvent.changedTouches[0].pageY,t.isNullOrUndefined(r._predecessorTooltip)||(i.target=document.elementFromPoint(o,s))):(o=i.pageX,s=i.pageY);(n(i.target).hasClass("e-connectorpoint-left")||n(i.target).hasClass("e-connectorpoint-right")||n(i.target).hasClass("e-connectortouchpoint"))&&r._falseLine&&!n(i.target).parent().hasClass("e-parentContainer")&&(r._trigger("cancelEditCell"),n(i.target).hasClass("e-connectortouchpoint")&&(i.target=n(i.target).parent()),e=r._secondMouseOverConnectorPoint(i,!0),u.currentRecord=e.currentRecord,u.fromItem=e.fromItem,u.toItem=e.toItem,u.predecessor=e.predecessor,u.predecessorString=e.predecessorString,u.requestType="validatePredecessor",r._trigger("actionBegin",u)||e.predecessorValidation&&(e.requestType="drawConnectorLine",r._completeAction(e)));r._editingTarget!=null&&r._editingItem!=null&&(a=r._editingTarget,c=a.closest("tr.e-ganttrowcell"),v=p.index(c),f=r._editingItem,n(c).hasClass("e-editmode")&&(n(c).removeClass("e-editmode"),r._mouseTarget=null));n("#ganttviewerbodyContianer"+r._id).unbind("mousemove");r._mouseDown=!1;r._clearTooltip();w!=o||b!=s?(r._editingTarget=null,r._editingItem=null,r._$ganttChartContainer[0].style.cursor="auto",f!=null&&(r._allowDragging||r._leftResizing||r._rightResizing||r._progressResizing)&&(u.editingFields={startdate:f.startDate,enddate:f.endDate,progress:f.status,duration:f.duration,durationunit:f.durationUnit},u.data=f,u.previousData=r._prevItem,u.dragging=r._allowDragging,u.leftResizing=r._leftResizing,u.rightResizing=r._rightResizing,u.progressResizing=r._progressResizing,r._taskbarEdited(u)),u.cancel&&(r._getPrevItem(f,v),f.parentItem&&r._getParentPreviousValue(),r.model.predecessorMapping&&(u.dragging||u.rightResizing||u.leftResizing)&&(u.requestType="updateConnectors",u.ganttRecord=f,r._trigger("actionComplete",u))),r._updateEditingType(),r._falseLine&&r._falseLine.remove(),r._falseLine=null,r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,n(r._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._childRightConnectorPoint).removeClass("e-connectorpoint-hover"),n(r._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),r._leftConnectorPoint=null,r._rightConnectorPoint=null,r._childRightConnectorPoint=null,r._childLeftConnectorPoint=null,r._trigger("clearColumnMenu")):(r._newXYPos=!1,r._$ganttChartContainer[0].style.cursor="auto",r._allowDragging=!1,r._falseLine&&r._falseLine.remove(),r._falseLine=null,f&&r.model.enableTaskbarTooltip&&(r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,y={ttipstartDate:this._getFormatedDate(f.startDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(f.endDate,this.model.dateFormat,this.model.locale),ttipduration:f.duration,ttipprogress:f.status.toString(),ttiptaskname:f.taskName,ttipdurationunit:f.durationUnit},l=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),r.model.tooltipTemplate||r.model.tooltipTemplateId?r.model.tooltipTemplate?(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="Template",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](f),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)):r.model.tooltipTemplateId&&(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="TemplateID",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](f),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)):(r.tooltipState="",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](y),{},{}),l.append(h),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",l,{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r._mouseHoverTooltip.innerHTML="<table>"+l[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s+20)},300)),n(r._mouseHoverTooltip).addClass("customTooltip"),r._trigger("clearColumnMenu")));i.type=="touchend"&&n(".e-connectortouchpoint").removeClass("e-enableconnectortouchpoint")},getChildCount:function(n,t){var r,u=this,i;if(!n.hasChildRecords)return 0;for(i=0;i<n.childRecords.length;i++)r=n.childRecords[i],t++,r.hasChildRecords&&(t=u.getChildCount(r,t));return t},criticalDataMapping:function(n,i,r,u){i==!0&&(this.model.isCriticalPathEnable=!0,t.isNullOrUndefined(n)||(this.model.criticalPathCollection=n,this.model.detailPredecessorCollection=r,this.collectionTaskId=u));i==!1&&(this.model.isCriticalPathEnable=!1)},criticalPathColor:function(n,i,r,u){i==!0&&(t.isNullOrUndefined(n)||(this._refresh(),t.isNullOrUndefined(r)||this.criticalConnectorLine(n,r,!0,u)));i==!1&&(this.criticalConnectorLine(n,r,!1,u),this._refresh())},criticalConnectorLine:function(n,t,i,r){var e,u,o,f,s,h;if(i==!1)this.element.find(".e-line").removeClass("e-criticalconnectorline"),this.element.find(".connectorline-rightarrow").removeClass("e-criticalconnectorlinerightarrow"),this.element.find(".connectorline-leftarrow").removeClass("e-criticalconnectorlineleftarrow");else if(t.length!=0)for(e=0,o=[],s=0;s<this.model.criticalPathCollection.length;s++)if(e=r.indexOf(this.model.criticalPathCollection[s]),u=t[e],e!=-1&&u.to)for(o=u.to.split(","),h=0;h<o.length;h++)f=parseInt(o[h]),n.indexOf(f)!=-1&&(this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".e-line").addClass("e-criticalconnectorline"),this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".connectorline-rightarrow").addClass("e-criticalconnectorlinerightarrow"),this.element.find("#ConnectorLineparent"+u.taskid+"child"+f).find(".connectorline-leftarrow").addClass("e-criticalconnectorlineleftarrow"))},_getCollapsedParentItem:function(n){var t=n.parentItem;return t?this._getExpandStatus(t)===!0?t:this._getCollapsedParentItem(t):null},updateScrollBar:function(){var n=this,t=n.model,u,r,f,s,e;if(r=n.getExpandedRecords(t.updatedRecords),f=r.indexOf(t.selectedItem),t.selectedItem&&f!=-1){var i=f*t.rowHeight,h=i+t.rowHeight,o,c=n._$bodyContainer.children(".e-content").length;o=c?n._$bodyContainer.children(".e-content").scrollTop():n._$bodyContainer.scrollTop();(n._$bodyContainer.ejScroller("isHScroll")||n.element.find(".e-borderbox").length>0)&&(u=18);s=i<o;e=o+n._viewportHeight-u<h;(s||e)&&(i+n._viewportHeight>r.length*t.rowHeight&&(i=r.length*t.rowHeight-n._viewportHeight,e&&(i+=u)),n._$bodyContainer.ejScroller("scrollY",i,!0),t.enableVirtualization&&n.focusGanttElement())}},getExpandedRecords:function(n){var t=this;return n.filter(function(n){return t._getExpandStatus(n)==!0})},_keyPressed:function(n,t,i,r){var u=this,f=this.model,e,s=f.updatedRecords,l=u.getExpandedRecords(s),c;if(r.stopImmediatePropagation(),r.preventDefault(),!f.allowKeyboardNavigation)return!0;switch(n){case"downArrow":s.length>0&&f.selectedItem&&(lastRowIndex=s.length-1,f.selectedRowIndex!=lastRowIndex&&(e=l.indexOf(f.selectedItem),c=l[e+1],e=s.indexOf(c),c&&e<=lastRowIndex&&!u._rowSelectingEventTrigger(f.selectedRowIndex,e)&&(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(f.selectedRowIndex))));break;case"upArrow":f.selectedRowIndex!==0&&s.length>0&&f.selectedItem&&(e=l.indexOf(f.selectedItem),c=l[e-1],e=s.indexOf(c),u._rowSelectingEventTrigger(f.selectedRowIndex,e)||(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(f.selectedRowIndex)));break;case"firstRowSelection":s.length>0&&(u._rowSelectingEventTrigger(f.selectedRowIndex,0)||(u.selectRows(0),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(0)));break;case"lastRowSelection":s.length>0&&(lastRowIndex=l.length-1,c=l[lastRowIndex],e=s.indexOf(c),u._rowSelectingEventTrigger(f.selectedRowIndex,e)||(u.selectRows(e),u.focusGanttElement(),u.updateScrollBar(),u._rowSelectedEventTrigger(e)));break;case"rightArrow":var a=u.model.selectedRowIndex,h=u.model.updatedRecords[a],o={},v;o.data=h;o.recordIndex=a;o.expanded=!0;h&&(u._rowSelectingEventTrigger()||!h.hasChildRecords||h.expanded||(a>=0&&(v=u._trigger("expanding",o)),f.enableVirtualization&&u.focusGanttElement()));break;case"leftArrow":var a=u.model.selectedRowIndex,h=u.model.updatedRecords[a],o={},v;o.data=h;o.recordIndex=a;o.expanded=!1;h&&!u._rowSelectingEventTrigger()&&h.hasChildRecords&&h.expanded&&(a>=0&&u._trigger("collapsing",o),f.enableVirtualization&&u.focusGanttElement());break;case"deleteRecord":f.editSettings.allowDeleting&&f.selectedRowIndex>=0&&(u._trigger("deleteRow"),u.focusGanttElement());break;case"totalRowCollapse":o={};o.requestType="collapseAll";u._trigger("expandAllCollapseAllRequest",o);break;case"totalRowExpand":o={};o.requestType="expandAll";u._trigger("expandAllCollapseAllRequest",o)}return!0},_rowSelectingEventTrigger:function(n,t){var r=this,u=r.model,i={};if(u.selectionMode=="row")return i.previousIndex=n,i.recordIndex=t,r._trigger("rowSelecting",i)},_rowSelectedEventTrigger:function(n){var t=this,i;t.model.selectionMode=="row"&&(i={data:t.model.selectedItem,target:"ejGanttChart",recordIndex:n},t._trigger("rowSelected",i))},_updateEditingType:function(){var n=this;n._leftResizing=!1;n._allowDragging=!1;n._rightResizing=!1;n._progressResizing=!1;n._editPredecessor=!1},_getHolidaysCount:function(n,t){for(var u=this,r=this.model.holidays,f=0,i=0;i<r.length;i++)u._getDateFromFormat(r[i].day)>=n&&u._getDateFromFormat(r[i].day)<=t&&(f+=1);return f},updateConnectorLineOffset:function(n){var u,a=this.model,i=n.predecessor,v=[],o,s,h,c,l=a.includeWeekend,r,f,t,e;if(i){for(t=0;t<i.length;t++)i[t].to===n.taskId.toString()&&(u=a.flatRecords[a.ids.indexOf(i[t].from)],r=a.flatRecords[a.ids.indexOf(i[t].to)],o=new Date(u.startDate),s=new Date(u.endDate),h=new Date(r.startDate),c=new Date(r.endDate),i[t].predecessorsType=="FS"&&(r.left<u.left+u.width?(f=(u.left+u.width-r.left)/this.model.perDayWidth,f=r.isMilestone==!0?f-1:f,i[t].offset=Math.round(-f)):r.left>u.left+u.width?(f=(r.left-(u.left+u.width))/this.model.perDayWidth,f>=0&&(i[t].offset=Math.round(f))):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(s,new Date(h)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(s,h)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(h),s),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(h,s))),i[t].predecessorsType=="SS"&&(r.left<u.left?(f=(u.left-r.left)/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left>u.left?(f=(r.left-u.left)/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(o,new Date(h)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(o,h)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(h),o),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(h,o))),i[t].predecessorsType=="SF"&&(r.left+r.width<u.left?(f=(u.left-(r.left+r.width))/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left+r.width>u.left?(f=(r.left+r.width-u.left)/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(o,new Date(c)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(o,c)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(c),o),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(c,o))),i[t].predecessorsType=="FF"&&(r.left+r.width<u.left+u.width?(f=(u.left+u.width-(r.left+r.width))/this.model.perDayWidth,i[t].offset=Math.round(-f)):r.left+r.width>u.left+u.width?(f=(r.left+r.width-(u.left+u.width))/this.model.perDayWidth,i[t].offset=Math.round(f)):i[t].offset=0,i[t].offset>0?(l||(e=this._calculateWeekendDays(s,new Date(c)),i[t].offset-=e),i[t].offset-=this._getHolidaysCount(s,c)):i[t].offset<0&&(l||(e=this._calculateWeekendDays(new Date(c),s),i[t].offset+=e),i[t].offset+=this._getHolidaysCount(c,s))),i[t].offset<0?v.push(i[t].from+""+i[t].predecessorsType+""+i[t].offset+"d"):i[t].offset>=1?v.push(i[t].from+""+i[t].predecessorsType+"+"+i[t].offset+"d"):v.push(i[t].from+""+i[t].predecessorsType));v.length>0&&(n.item[a.predecessorMapping]=v.join(","))}},_calculateWeekendDays:function(n,t){var i=0;for(n=new Date(n);n<t;)n.setDate(n.getDate()+1),(n.getDay()===0||n.getDay()==6)&&++i;return i},_getPrevItem:function(n,t){var i=this,r;n.left=i._prevItem.left;n.width=i._prevItem.width;n.startDate=i._prevItem.startDate;n.endDate=i._prevItem.endDate;n.duration=i._prevItem.duration;n.status=i._prevItem.status;n.progressWidth=this._getProgressWidth(n.width,n.status);this.refreshRow(t);r={};r.index=t;this._refreshRow(r)},_getParentPreviousValue:function(){for(var u,i=this,n,t,f=i.model,e=i._parentCollectionPreviousValues.length,r=0;r<e;r++)n=i._parentCollectionPreviousValues[r],t=n.index,parentItem=f.updatedRecords[t],parentItem.left=n.left,parentItem.width=n.width,parentItem.startDate=n.startDate,parentItem.endDate=n.endDate,parentItem.duration=n.duration,parentItem.status=n.status,parentItem.progressWidth=this._getProgressWidth(parentItem.width,parentItem.status),this.refreshRow(t),u={},u.index=t,this._refreshRow(u)},_enableLeftResizing:function(i,r){var u=this,o=this.model,f=o.scheduleHeaderSettings.scheduleHeaderType,e=t.Gantt.ScheduleHeaderType;i.target.style.cursor="e-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.left-=u._mousePosX,r.width+=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.left+30<r.left+r.width&&r.left+u._mousePosX<=this._prevItem.left+this._prevItem.width&&(r.left+=u._mousePosX,r.width-=u._mousePosX));this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.width=f==e.Day?r.width<u.model.perHourWidth?u.model.perHourWidth:r.width:f==e.Hour?r.width<u.model.perMinuteWidth?u.model.perMinuteWidth:r.width:r.width<u.model.perDayWidth?u.model.perDayWidth:r.width;r.progressWidth=u._getProgressWidth(r.width,r.status);r.left=this._prevItem.left+this._prevItem.width-r.width;u._setItemPosition(r)},_enableProgressResizing:function(i,r){var u=this,f,e;i.target.style.cursor="col-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u._progressResizer&&(u._progressHandle=u._progressResizer&&u._progressResizer.firstChild,u._progressHandleChild=u._progressResizer&&u._progressResizer.childNodes[1]);u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.progressWidth-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.progressWidth+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.progressWidth=r.progressWidth>r.width?r.width:r.progressWidth;r.progressWidth=r.progressWidth<0?0:r.progressWidth;f=r.width-r.progressWidth;e=f<=4?4-f:0;n(u._progressbarItem).css({width:r.progressWidth+"px","border-top-right-radius":e+"px","border-bottom-right-radius":e+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._progressHandle).addClass("e-progresshandle");n(u._progressHandleChild).addClass("e-progresshandleafter")},_enableRightResizing:function(i,r){var u=this,f=this.model;i.target.style.cursor="w-resize";n(u._leftResizer).addClass("gripper");n(u._rightResizer).addClass("gripper");u.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.width-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.width+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.width=f.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Day?r.width<u.model.perHourWidth?u.model.perHourWidth:r.width:f.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Hour?r.width<u.model.perMinuteWidth?u.model.perMinuteWidth:r.width:r.width<u.model.perDayWidth?u.model.perDayWidth:r.width;r.hasChildRecords?n(u._manualRightResizer).css({left:r.width-parseInt(u._manualRightResizer.style.borderRightWidth.replace("px",""))+"px"}):(r.progressWidth=u._getProgressWidth(r.width,r.status),n(u._tasknameContainer).css({left:r.left+"px",width:r.width+"px"}));n(u._taskbarItem).css({left:r.left+"px",width:r.width+"px"});n(u._progressbarItem).css({width:r.progressWidth+"px"});n(u._rightResizer).css({left:r.left+r.width-u._resizerRightAdjust+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._leftConnectorPoint).css({left:r.left-u._connectorPointWidth+"px"});n(u._rightConnectorPoint).css({left:r.left+r.width+"px"})},_enableDragging:function(i,r){var u=this;i.target.style.cursor="move";n(i.target.parentNode).hasClass("e-parentContainer")&&(u._allowExpandCollapse=!1);this.dragPosX>u._mousePosX?(u._mousePosX=u.dragPosX-u._mousePosX,r.left>0&&(r.left-=u._mousePosX)):(u._mousePosX-=u.dragPosX,r.left+=u._mousePosX);this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX;r.left=r.left<0?0:r.left;n(u._taskbarItem).css({left:r.left+"px"});n(u._rightResizer).css({left:r.left+r.width-u._resizerRightAdjust+"px"});n(u._leftResizer).css({left:r.left+2+"px"});n(u._progressResizer).css({left:r.left+r.progressWidth-10+"px"});n(u._tasknameContainer).css({left:r.left+"px",width:r.width+"px"});n(u._leftConnectorPoint).css({left:r.left-u._connectorPointWidth+"px"});n(u._rightConnectorPoint).css({left:r.left+r.width+"px"})},_appendTooltip:function(i,r){var u=this,h,o,l=n(i),s=this.model,e=u.model.currentViewData[r],p=u.model.columnHeaderTexts,a=u.model.predecessorEditingTexts,c,v,y,f;e!=null&&(c=l[0],n(l[0]).hasClass("progressbarresizer-right")&&(c=l.closest(".e-childContainer")[0]),(n(c).hasClass("e-parentContainer")||n(c).hasClass("e-childContainer"))&&(u._editingContainer=c,u._leftResizer=u._editingContainer.querySelector(".e-connectorpoint-left"),u._taskbarItem=u._editingContainer.querySelector(".taskbarresizer-left"),u._progressbarItem=u._editingContainer.querySelector(".e-gantt-childtaskbar"),u._progressResizer=u._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),u._rightResizer=u._editingContainer.querySelector(".progressbarresizer-right")),this.model.enableTaskbarDragTooltip&&!l.hasClass("e-parentContainer")&&(this._progressResizing==!0?(u._$ganttChartContainer[0].style.cursor="col-resize",o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),f=t.buildTag("tbody","",{},{}),f[0].innerHTML="<tr><td>"+p.status+" : "+e.status+"%<\/td><\/tr>",o.append(f),u.model.progressbarTooltipTemplate?(u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),f=t.buildTag("tbody",n.render[u._id+"progressbarTooltipTemplate"](e),{},{}),u._progressBarTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u.model.progressbarTooltipTemplateId?(u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),f=t.buildTag("tbody",n.render[u._id+"progressbarTooltipTemplate"](e),{},{}),u._progressBarTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+u._id+"",o,{position:"absolute","z-index":u._getMaxZIndex()+1},{onselectstart:"return false"}),u._progressBarTooltipID&&(n(document.body).append(u._progressBarTooltipID),u._updateTooltipPosition(u._progressBarTooltipID,u._currMousePosX,u._currMousePosY,!0))):this._editPredecessor===!0&&u.model.enablePredecessorEditing?(v=s.predecessorText,u._predecessorTooltip===null&&(u._predecessorTooltip=t.buildTag("div.e-tooltipganttpredecessor#predecessortooltip"+u._id+"","",{top:u._currMousePosY+10+"px",left:u._currMousePosX+10+"px",position:"absolute","z-index":u._getMaxZIndex()+1},{onselectstart:"return false"}),o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),f=t.buildTag("tbody","",{},{}),y="<tr><td class='e-predecessor-false'><\/td><td >"+a.fromText+":<\/td><td class='e-tooltiptaskname'>"+e.taskName+"<\/td><td>"+v[u._prevItem.predecessorTarget]+"<\/td> <\/tr><tr><td><\/td><td>"+a.toText+":<\/td><td class='e-tooltiptaskname'><\/td><td><\/td><\/tr>",n(f).html(y),o.append(f),u._predecessorTooltip.append(o),n(document.body).append(u._predecessorTooltip),u._updateTooltipPosition(u._predecessorTooltip,u._currMousePosX,u._currMousePosY))):(u._leftResizing==!0||u._rightResizing==!0||u._allowDragging==!0)&&(u._leftResizing==!0?(u._$ganttChartContainer[0].style.cursor="e-resize",h={ttipstartDate:this._getFormatedDate(e.startDate,s.dateFormat,s.locale),ttipduration:e.duration,ttipdurationunit:e.durationUnit}):u._rightResizing==!0?(u._$ganttChartContainer[0].style.cursor="w-resize",h={ttipendDate:this._getFormatedDate(e.endDate,s.dateFormat,s.locale),ttipduration:e.duration,ttipdurationunit:e.durationUnit}):u._allowDragging==!0&&(u._$ganttChartContainer[0].style.cursor="move",h={ttipstartDate:this._getFormatedDate(e.startDate,s.dateFormat,s.locale),ttipendDate:this._getFormatedDate(e.endDate,s.dateFormat,s.locale)}),o=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),u.model.taskbarEditingTooltipTemplate?(u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),u.tooltipState="editingTemplateID",f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](e),{},{}),u._taskbarEditingTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):u.model.taskbarEditingTooltipTemplateId?(u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"","",{position:"absolute","z-index":u._getMaxZIndex()+1},{}),u.tooltipState="editingTemplate",f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](e),{},{}),u._taskbarEditingTooltipID[0].innerHTML="<table>"+f[0].innerHTML+"<\/table>"):(u.tooltipState="",h&&(f=t.buildTag("tbody",n.render[u._id+"editingTooltipTemplate"](h),{},{}),o.append(f)),u._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+u._id+"",o,{position:"absolute","z-index":u._getMaxZIndex()+1},{})),u._taskbarEditingTooltipID&&(n(document.body).append(u._taskbarEditingTooltipID),u._updateTooltipPosition(u._taskbarEditingTooltipID,u._currMousePosX,u._currMousePosY,!0)))))},_setItemPosition:function(t){var i=this;n(i._leftResizer).css({left:t.left+2+"px"});n(i._rightResizer).css({left:t.left+t.width-i._resizerRightAdjust+"px"});n(i._taskbarItem).css({left:t.left+"px",width:t.width+"px"});n(i._progressbarItem).css({width:t.progressWidth+"px"});n(i._progressResizer).css({left:t.left+t.progressWidth-10+"px"});n(i._tasknameContainer).css({left:t.left+"px",width:t.width+"px"});n(i._leftConnectorPoint).css({left:t.left-i._connectorPointWidth+"px"});n(i._rightConnectorPoint).css({left:t.left+t.width+"px"})},_getTemplate:function(t){var i,r;return typeof t!="object"?(i=n.parseHTML(this.model.tooltipTemplate),i[0]):(r=n(t)[0].innerHTML,i=n.parseHTML(r),i[1])},_updateOnmouseMove:function(i){var r=this,o={},s,e=r._editingTarget?r._editingTarget:null,c=r.getGanttChartRows(),h=e?e.closest("tr.e-ganttrowcell"):null,l=c.index(h),u=r._editingItem,f=e?e[0].parentNode:null;r._newXYPos=!0;f=n(f).hasClass("progressbarresizer-right")?f.parentNode:n(f).hasClass("e-gantt-childtaskbar-progress")?n(f).closest("div.e-childContainer")[0]:n(f).hasClass("progressbarhandler")?e.closest(".e-childContainer")[0]:n(f).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0];u!=null&&(r._trigger("cancelEditCell"),o.editingFields={startdate:u.startDate,enddate:u.endDate,progress:u.status,duration:u.duration,durationunit:u.durationUnit},o.rowData={rowData:u},r._taskbarEditing(o),o.cancel||(i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(r._mousePosX=i.originalEvent.pageX,s=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(r._mousePosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):(i.originalEvent.touches[0].pageX||i.originalEvent.touches[0].pageY)&&(r._mousePosX=i.originalEvent.targetTouches[0].pageX,s=i.originalEvent.targetTouches[0].pageY),e.hasClass("e-gantt-milestone")||n(f).hasClass("e-gantt-milestone")?n(h).hasClass("e-editmode")&&this._editMilestone(i):(n(f).hasClass("e-childContainer")?(r._editingContainer=f,r._leftResizer=r._editingContainer.querySelector(".taskbarresizer-left"),r._taskbarItem=r._editingContainer.querySelector(".e-gantt-childtaskbar"),r._progressbarItem=r._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),r._progressResizer=r._editingContainer.querySelector(".progressbarresizer-right"),r._rightResizer=r._editingContainer.querySelector(".taskbarresizer-right"),r.model.predecessorMapping&&r.model.enablePredecessorEditing&&(r._leftConnectorPoint=f.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=f.querySelector(".e-connectorpoint-right"),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover"))):n(f).hasClass("e-parentContainer")&&!u.isAutoSchedule&&(r._editingContainer=f,r._taskbarItem=r._editingContainer.querySelector(".e-gantt-manualparenttaskbar"),r._rightResizer=r._editingContainer.querySelector(".taskbarresizer-right"),r._manualRightResizer=r._editingContainer.querySelector(".e-gantt-manualparenttaskbar-right")),n(h).hasClass("e-editmode")&&(n(e[0]).closest("e-gantt-manualparenttaskbar")||n(f).hasClass("e-gantt-milestone-container")||n(f).hasClass("e-childContainer"))&&(r._leftResizing==!0?(r._enableLeftResizing(i,u),r._updateEditedItem(u,"leftResizing")):r._progressResizing==!0&&r.model.enableProgressBarResizing&&r.model.progressMapping?((r._editingTarget.hasClass("e-progresshandlerafter-element")||r._editingTarget.hasClass("progressbarhandler e-progresshandle")||r._editingTarget.hasClass("e-progresshandler-element")||r._editingTarget.hasClass("progressbarresizer-right"))&&r._editingTarget.prev(".e-gantt-childtaskbar").find(".e-tasklabel").text(""),r._enableProgressResizing(i,u),r._updateEditedItem(u,"progressResizing")):r._rightResizing==!0?(r._enableRightResizing(i,u),r._updateEditedItem(u,"rightResizing")):r._allowDragging==!0?(r._enableDragging(i,u),r._updateEditedItem(u,"dragging")):r._editPredecessor==!0&&r._drawFalseLine(i,u))),r._clearTooltip(),r._appendTooltip(e,l)));t.isNullOrUndefined(i.pageX)&&i.type=="touchmove"&&r._predecessorTooltip&&(t.isNullOrUndefined(i.pageX)?(x2=i.originalEvent.changedTouches[0].pageX,y2=i.originalEvent.changedTouches[0].pageY,i.target=document.elementFromPoint(x2,y2)):(x2=i.pageX,y2=i.pageY),n(i.target).hasClass("e-connectorpoint-left")||n(i.target).hasClass("e-connectortouchpoint")?r._dragLeftOver(i):n(i.target).hasClass("e-connectorpoint-right")?r._dragRightOver(i):(r._mouseLeave(),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")))},_editMilestone:function(i){var r=this,f=r._editingTarget,e=f.hasClass("milestone-top")||f.hasClass("milestone-bottom")?f[0].parentNode:f.closest(".e-gantt-milestone"),o=r.getGanttChartRows(),s=f.closest("tr.e-ganttrowcell"),h=o.index(s),u=r._editingItem;u!=null&&(i||(i=window.event),i.originalEvent.pageX||i.originalEvent.pageY?r._mousePosX=i.originalEvent.pageX:i.originalEvent.clientX||i.originalEvent.clientY?r._mousePosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft:(i.originalEvent.touches[0].pageX||i.originalEvent.touches[0].pageY)&&(r._mousePosX=i.originalEvent.targetTouches[0].pageX,posy=i.originalEvent.targetTouches[0].pageY),i.target.style.cursor="move",r.dragPosX>r._mousePosX?(r._mousePosX=r.dragPosX-r._mousePosX,u.left>0&&(u.left-=r._mousePosX)):(r._mousePosX-=r.dragPosX,u.left+=r._mousePosX),this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX,u.left=u.left<0?0:u.left,n(e).css({left:u.left+"px"}),n(r._leftConnectorPoint).css({left:u.left-r._connectorPointWidth+"px"}),n(r._rightConnectorPoint).css({left:u.left+r._milesStoneWidth+"px"}),r._updateEditedItem(u,"dragging"),r._appendTooltip(f,h))},_updateEditedItem:function(n,i){var l=this,r=l.model,f=r.scheduleHeaderSettings.scheduleHeaderType,o=t.Gantt.ScheduleHeaderType,it=t.Gantt.DurationUnit,a=n._getFormatedDate(r.projectStartDate,r.dateFormat,r.locale),a=n._getDateFromFormat(a,r.dateFormat,r.locale),rt=n.startDate.getHours(),ut=n.startDate.getMinutes(),s,h,u,c,v,y,nt,tt,k,d,g,e;switch(i){case"dragging":if(s=n.left%r.perDayWidth,h=(n.left-s)/r.perDayWidth,u=s/r.perDayWidth,(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c=f==o.Day||f==o.Hour?24:r.secondsPerDay/3600,c&&u!=1)var p=1/c,w=u/p,b=Math.round(w*60);a=n._startDateUpdate(a,h,b,r.workingTimeRanges,f);n.startDate=new Date(a);e={};e.startDate=n.startDate;e.duration=n.duration;e.durationUnit=n.durationUnit;e.record=n;l._calculateEndDate(e);n.endDate=l._currentEditedRecord.endDate;r.startDateMapping&&(n.item[r.startDateMapping]=n.startDate);r.endDateMapping&&(n.item[r.endDateMapping]=n.endDate);break;case"leftResizing":if(nt="Resizing",s=n.left%r.perDayWidth,h=(n.left-s)/r.perDayWidth,u=s/r.perDayWidth,(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c=f==o.Day||f==o.Hour?24:r.secondsPerDay/3600,c&&u>0)var p=1/c,w=u/p,b=Math.round(w*60);a=n._startDateUpdate(a,h,b,r.workingTimeRanges,f);n.startDate=new Date(a);n.startDate.getTime()==n.endDate.getTime()&&t.isNullOrUndefined(n.isMilestone)&&n.isMilestone==!1&&n.duration==0&&(n.duration=1);e={};e.startDate=n.startDate;e.endDate=n.endDate;e.durationUnit=n.durationUnit;e.record=n;l._calculateDuration(e);n.duration=l._currentEditedRecord.duration;r.startDateMapping&&(n.item[r.startDateMapping]=n.startDate);r.durationMapping&&(n.item[r.durationMapping]=n.duration);break;case"rightResizing":if(nt="Resizing",f==o.Day||f==o.Hour?(tt=new Date(n.startDate),k=new Date(n.startDate),k.setHours(0,0,0,0),d=tt.getTime()-k.getTime(),g=d>0?n.width+d/864e5*r.perDayWidth:n.width,s=g%r.perDayWidth,h=(g-s)/r.perDayWidth,c=24):(s=n.width%r.perDayWidth,h=(n.width-s)/r.perDayWidth,c=r.secondsPerDay/3600),u=s/r.perDayWidth,v=new Date(n.startDate),(f==o.Week||f==o.Month||f==o.Year)&&(u<=.25?u=0:u>.25&&u<=.75?u=.5:u>.75&&(h+=1,u=0)),c&&u>0)var p=1/c,w=u/p,b=Math.round(w*60);y=n._endDateUpdate(v,h-1,b,r.workingTimeRanges,f);n.endDate=new Date(y);e={};e.startDate=v;e.endDate=y;e.durationUnit=n.durationUnit;e.record=n;l._calculateDuration(e);n.duration=l._currentEditedRecord.duration;r.endDateMapping&&(n.item[r.endDateMapping]=n.endDate);r.durationMapping&&(n.item[r.durationMapping]=n.duration);break;case"progressResizing":n.status=l._getProgressPercent(n.width,n.progressWidth);r.progressMapping&&(n.item[r.progressMapping]=n.status)}},_calculateEndDate:function(n){var t=this;return t._trigger("calculateEndDate",n)},_calculateDuration:function(n){var t=this;return t._trigger("calculateDuration",n)},_drawFalseLine:function(n){var i=this,f=n.pageX,e=n.pageY,u=i._connectorPointX;y1=i._connectorPointY;t.isNullOrUndefined(n.pageX)?(x2=n.originalEvent.changedTouches[0].pageX-i._$bodyContent.offset().left,y2=n.originalEvent.changedTouches[0].pageY-i._$bodyContent.offset().top,f=Math.round(n.originalEvent.changedTouches[0].pageX),e=Math.round(n.originalEvent.changedTouches[0].pageY)):(x2=n.pageX-i._$bodyContent.offset().left,y2=n.pageY-i._$bodyContent.offset().top);var o=Math.sqrt((u-x2)*(u-x2)+(y1-y2)*(y1-y2)),s=Math.atan2(y2-y1,x2-u)*180/Math.PI,r="rotate("+s+"deg)";i._falseLine&&i._falseLine.remove();i._falseLine=t.buildTag("div.e-gantt-falseLine#ganttfalseline"+i._id,"",{},{});i._falseLine.css({"transform-origin":"0% 100%",right:"auto",position:"absolute",transform:r,"-ms-transform":r,"-moz-transform":r,"-webkit-transform":r,"-o-transform":r,"border-top-width":"2px","border-top-style":"dashed","z-index":"5"}).width(o-3).offset({left:u,top:y1});t.browserInfo().name=="msie"&&t.browserInfo().version<9||i._$bodyContent.append(i._falseLine);i._updateTooltipPosition(i._predecessorTooltip,f,e)},_mouseLeave:function(){var t=this;n(".progressbarresizer-right").css({"background-image":"none"});window.clearTimeout(t._tooltipTimer);t._clearTooltip();this._mouseDown==!1&&t._newXYPos?(n(t._leftResizerGripper).removeClass("gripper"),n(t._rightResizerGripper).removeClass("gripper"),t.model.progressMapping&&(n(t._progressHandle).removeClass("e-progresshandle"),n(t._progressHandleChild).removeClass("e-progresshandleafter")),t.model.predecessorMapping&&t.model.enablePredecessorEditing&&(n(t._leftConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(t._rightConnectorPoint).removeClass("e-connectorpoint-hover").removeClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),t._leftConnectorPoint=null,t._rightConnectorPoint=null)):t._mouseDown&&t._falseLine&&t.model.allowGanttChartEditing==!0&&t.model.enablePredecessorEditing&&t.model.readOnly==!1&&t._removeEditingElements()},_getMaxZIndex:function(){var t=1;return t=Math.max.apply(null,n.map(n("body *"),function(t){if(n(t).css("position")=="absolute")return parseInt(n(t).css("z-index"))||1})),(t==i||t==null)&&(t=1),t},_getOffsetRect:function(n){var r=n.getBoundingClientRect(),t=document.body,i=document.documentElement,u=window.pageYOffset||i.scrollTop||t.scrollTop,f=window.pageXOffset||i.scrollLeft||t.scrollLeft,e=i.clientTop||t.clientTop||0,o=i.clientLeft||t.clientLeft||0,s=r.top+u-e,h=r.left+f-o;return{top:Math.round(s),left:Math.round(h)}},_updateTooltipPosition:function(n,t,i,r){if(n&&n.length>0){var u=this,e=u._getOffsetRect(u._$bodyContainer[0]),o=e.top+u._$bodyContainer.height(),s=e.left+u._$bodyContainer.width(),h=u.model.rowHeight,f=0;t+n.width()+30>s?(f=t-n.width()-30,n.css("left",f+"px")):r?n.css("left",t+"px"):n.css("left",t+15+"px");r||i+n.height()+30>o?(f=r?i-n.height()-h:i-n.height()-30,n.css("top",f+"px")):n.css("top",i+10+"px")}},_mouseHover:function(i){var e=n(i.target),r=this,o=0,s=0,y=r.getGanttChartRows(),p=e.closest("tr.e-ganttrowcell"),f=e[0].parentNode,c,w=y.index(p),u=r.model.currentViewData[w],v,l,a,h;if(i.target.className=="e-parentContainer"||i.target.className=="e-gantt-milestone-container"||i.target.className=="e-childContainer")return!0;f=n(f).hasClass("e-gantt-childtaskbar-progress")?n(f).closest("div.e-childContainer")[0]:e.hasClass("e-tasklabel")?e.closest(".e-childContainer")[0]:n(f).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0];r._clearTooltip();r._newXYPos||(r._newXYPos=!0,r._mouseLeave());r._rightResizing==!1&&r._leftResizing==!1&&r._progressResizing==!1&&r._mouseDown==!1&&(r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(e.is(".e-gantt-childtaskbar,.e-tasklabel, .e-gantt-manualparenttaskbar")||e.closest(".e-gantt-childtaskbar").length)&&(i.target.style.cursor="move"),(i.type=="mouseenter"||i.type=="mousemove"||i.type=="touchstart")&&(i||(i=window.event),t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(o=i.originalEvent.pageX,s=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(o=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(o=i.originalEvent.changedTouches[0].pageX,s=i.originalEvent.changedTouches[0].pageY),r._posX1=o,r._posY1=s,n(f).hasClass("e-childContainer")&&r.model.allowGanttChartEditing&&r.model.readOnly==!1&&(r._leftResizerGripper=f.querySelector(".taskbarresizer-left"),r._rightResizerGripper=f.querySelector(".taskbarresizer-right"),c=f.querySelector(".progressbarresizer-right"),r._progressHandle=c&&c.firstChild,r._progressHandleChild=c&&c.childNodes[1],n(r._leftResizerGripper).addClass("gripper"),n(r._rightResizerGripper).addClass("gripper"),r.model.progressMapping&&(n(r._progressHandle).addClass("e-progresshandle"),n(r._progressHandleChild).addClass("e-progresshandleafter"))),(n(f).hasClass("e-childContainer")||n(f).hasClass("e-parentContainer"))&&r.model.predecessorMapping&&r.model.allowGanttChartEditing&&r.model.enablePredecessorEditing&&r.model.readOnly==!1?(r._leftConnectorPoint=f.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=f.querySelector(".e-connectorpoint-right"),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover"),n(f).hasClass("e-parentContainer")&&!u.isAutoSchedule&&(n(r._leftConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-gantt-manualparenttaskbar-connectorpoint-hover"))):(n(f).hasClass("e-gantt-milestone")||n(f).hasClass("e-gantt-milestone-container"))&&r.model.predecessorMapping&&r.model.allowGanttChartEditing&&r.model.enablePredecessorEditing&&r.model.readOnly==!1&&(a=f.parentNode,r._leftConnectorPoint=a.querySelector(".e-connectorpoint-left"),r._rightConnectorPoint=a.querySelector(".e-connectorpoint-right"),n(r._leftConnectorPoint).addClass("e-connectorpoint-hover"),n(r._rightConnectorPoint).addClass("e-connectorpoint-hover")),u&&r.model.enableTaskbarTooltip&&!t.isTouchDevice()&&!n(e).hasClass("e-connectorpoint-hover")&&(r._predecessorTooltip&&r._predecessorTooltip.remove(),r._predecessorTooltip=null,v=(n(e).hasClass("e-gantt-parenttaskbar-innerdiv")||n(e[0].parentNode).hasClass("e-gantt-parenttaskbar-innerdiv"))&&!u.isAutoSchedule?{ttipscheduleStartDate:this._getFormatedDate(u.manualStartDate,this.model.dateFormat,this.model.locale),ttipscheduleEndDate:this._getFormatedDate(u.manualEndDate,this.model.dateFormat,this.model.locale),ttipduration:u.manualDuration,ttipprogress:u.status.toString(),ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit}:n(e).hasClass("e-gantt-manualparenttaskbar")||n(e).hasClass("e-gantt-manualparenttaskbar-left")||n(e).hasClass("e-gantt-manualparenttaskbar-right")&&!u.isAutoSchedule?{ttipstartDate:this._getFormatedDate(u.startDate,this.model.dateFormat,this.model.locale),ttipsubtaskStartDate:this._getFormatedDate(u.manualStartDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(u.endDate,this.model.dateFormat,this.model.locale),ttipsubtaskEndDate:this._getFormatedDate(u.manualEndDate,this.model.dateFormat,this.model.locale),ttipduration:u.duration,ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit}:{ttipstartDate:this._getFormatedDate(u.startDate,this.model.dateFormat,this.model.locale),ttipendDate:this._getFormatedDate(u.endDate,this.model.dateFormat,this.model.locale),ttipduration:u.duration,ttipprogress:u.status.toString(),ttiptaskname:u.taskName,ttipdurationunit:u.durationUnit},l=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),r.model.tooltipTemplate||r.model.tooltipTemplateId?r.model.tooltipTemplate?(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="Template",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](u),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)):r.model.tooltipTemplateId&&(r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"","",{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r.tooltipState="TemplateID",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](u),{},{}),r._mouseHoverTooltip[0].innerHTML="<table>"+h[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)):(r.tooltipState="",h=t.buildTag("tbody",n.render[r._id+"tooltipTemplate"](v),{},{}),l.append(h),r._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+r._id+"",l,{position:"absolute","z-index":r._getMaxZIndex()+1,"border-radius":"5px"},{}),r._mouseHoverTooltip.innerHTML="<table>"+l[0].innerHTML+"<\/table>",r._tooltipTimer=setTimeout(function(){n(document.body).append(r._mouseHoverTooltip);r._updateTooltipPosition(r._mouseHoverTooltip,o,s)},700)),n(r._mouseHoverTooltip).addClass("customTooltip"))))},_createEditingTooltipTemplate:function(){var t=this,f,r=t.model.columnHeaderTexts,h=t.model.durationUnitTexts,e={_getStartDate:t._tooltipStartDate,_getEndDate:t._tooltipEndDate,_getTaskName:t._tooltipTaskName,_getProgress:t._tooltipProgress,_checkDuration:t._checkDuration},o=t.model.taskbarEditingTooltipTemplateId,s=t.model.taskbarEditingTooltipTemplate,i,u;e["_"+t._id+"getDuration"]=n.proxy(t._tooltipDuration,t);n.views.helpers(e);o?i=n("#"+o)[0].innerHTML:s?i=s:(i="<tr class='e-tooltip_rowcell'>",f="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='width:40px;text-align:left;' colspan='3';>{{:ttiptaskname}}<\/td>{{/if}}<\/tr><tr>{{if ~_getStartDate()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.startDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipstartDate}}<\/td> {{/if}}<\/tr><tr>{{if ~_getEndDate()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.endDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipendDate}}<\/td>{{/if}}<\/tr><tr>{{if ~_checkDuration()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.duration+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:~_"+t._id+"getDuration(#data)}}<\/td>{{/if}}<\/tr><tr>{{if ~_getProgress()}}<td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+r.status+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipprogress}}%<\/td>{{/if}}",i+=f,i+="<\/tr>");u={};u[t._id+"editingTooltipTemplate"]=i;n.templates(u)},_createProgressbarTooltipTemplate:function(){var t=this,u=t.model.progressbarTooltipTemplateId,f=t.model.progressbarTooltipTemplate,i,r;u?i=n("#"+t.model.progressbarTooltipTemplateId)[0].innerHTML:t.model.progressbarTooltipTemplate&&(i=t.model.progressbarTooltipTemplate);r={};r[t._id+"progressbarTooltipTemplate"]=i;n.templates(r)},_createTooltipTemplate:function(){var t=this,f,i=t.model.columnHeaderTexts,s=t.model.durationUnitTexts,e={_getStartDate:t._tooltipStartDate,_getSubtaskStartDate:t._tooltipSubtaskStartDate,_getScheduleStartDate:t._tooltipScheduleStartDate,_getEndDate:t._tooltipEndDate,_getSubtaskEndDate:t._tooltipSubtaskEndDate,_getScheduleEndDate:t._tooltipScheduleEndDate,_getTaskName:t._tooltipTaskName,_getProgress:t._tooltipProgress,_checkDuration:t._checkDuration},o=t.model.tooltipTemplateId,h=t.model.tooltipTemplate,r,u;e["_"+t._id+"getDuration"]=n.proxy(t._tooltipDuration,t);n.views.helpers(e);o?r=n("#"+t.model.tooltipTemplateId)[0].innerHTML:t.model.tooltipTemplate?r=t.model.tooltipTemplate:(r="<tr class='e-tooltip_rowcell'>",f="{{if ~_getTaskName()}}<td class='e-tooltiptaskname' style='width:40px;text-align:left;' colspan='3';>{{:ttiptaskname}}<\/td>{{/if}}<\/tr>{{if ~_getStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.startDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipstartDate}}<\/td> {{/if}}<\/tr>{{if ~_getSubtaskStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.subTasksStartDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipsubtaskStartDate}}<\/td><\/tr>{{/if}}{{if ~_getScheduleStartDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.scheduleStartDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipscheduleStartDate}}<\/td><\/tr>{{/if}}{{if ~_getEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.endDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipendDate}}<\/td>{{/if}}<\/tr>{{if ~_getSubtaskEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.subTasksEndDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipsubtaskEndDate}}<\/td><\/tr>{{/if}}{{if ~_getScheduleEndDate()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.scheduleEndDate+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipscheduleEndDate}}<\/td><\/tr>{{/if}}{{if ~_checkDuration()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.duration+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:~_"+t._id+"getDuration(#data)}}<\/td>{{/if}}<\/tr>{{if ~_getProgress()}}<tr><td class='e-tooltiptd-alignleft' style='width:30px;white-space:nowrap;'>"+i.status+"<\/td><td class='e-tooltiptd-aligncenter' style='width:10px;font-weight:bold;'>:<\/td><td class='e-tooltiptd-alignright' style='width:30px;white-space:nowrap;'>{{:ttipprogress}}%<\/td>{{/if}}",r+=f,r+="<\/tr>");u={};u[t._id+"tooltipTemplate"]=r;n.templates(u)},_checkDuration:function(){return this.data.ttipduration},_tooltipTaskName:function(){return this.data.ttiptaskname},_tooltipProgress:function(){return this.data.ttipprogress},_tooltipStartDate:function(){return this.data.ttipstartDate},_tooltipSubtaskStartDate:function(){return this.data.ttipsubtaskStartDate},_tooltipScheduleStartDate:function(){return this.data.ttipscheduleStartDate},_tooltipEndDate:function(){return this.data.ttipendDate},_tooltipSubtaskEndDate:function(){return this.data.ttipsubtaskEndDate},_tooltipScheduleEndDate:function(){return this.data.ttipscheduleEndDate},_tooltipDuration:function(n){var r="",t;return n.ttipduration!=null&&n.ttipduration!=i&&(r+=n.ttipduration+" "),n.ttipdurationunit!=null&&n.ttipdurationunit!=i&&(t=n.ttipduration!=1,r+=n.ttipdurationunit=="day"?t?this.model.durationUnitTexts.days:this.model.durationUnitTexts.day:n.ttipdurationunit=="hour"?t?this.model.durationUnitTexts.hours:this.model.durationUnitTexts.hour:t?this.model.durationUnitTexts.minutes:this.model.durationUnitTexts.minute),r},_getDurationUnits:function(){var n=this;return n.model.durationUnit==t.Gantt.DurationUnit.Hour?"hours":n.model.durationUnit==t.Gantt.DurationUnit.Minute?"minutes":"days"},_cellClickHandler:function(t){var f=n(t.target),v=f.closest("tr.e-ganttrowcell"),r=this,i=this.model,o={},u,s,y=f[0],h=r.getGanttChartRows(),c,e,l,a;if(s=u=h.index(f.parent()),u==-1&&(s=u=h.index(v)),!(n(y).hasClass("e-parentTask")||n(y).closest(".e-parentTask").length>0)||f.hasClass("e-connectorpoint-left")||f.hasClass("e-connectorpoint-right")){if(u!=-1&&i.allowSelection){if(e=i.currentViewData[u],u=i.updatedRecords.indexOf(e),i.selectionMode=="row"){if(r._rowSelectingEventTrigger(i.selectedRowIndex,u))return;r.selectRows(u);r.focusGanttElement();r._rowSelectedEventTrigger(u)}i.selectionMode=="cell"&&(r.model.selectedItem=e)}}else c=h.index(v),e=i.currentViewData[c],recordIndex=i.updatedRecords.indexOf(e),r._allowExpandCollapse&&e&&e.hasChildRecords&&(r._trigger("cancelEditCell"),i.selectedRowIndex!==recordIndex&&i.allowSelection&&recordIndex!==-1&&(r._rowSelectingEventTrigger(i.selectedRowIndex,recordIndex)||(r.selectRows(recordIndex),r._rowSelectedEventTrigger(recordIndex))),r._expandCollapse(c));i.taskbarClick&&(f.is(".e-childContainer,.e-gantt-milestone-container,.e-parentContainer")||(l=f.closest(".e-childContainer,.e-gantt-milestone-container,.e-parentContainer"),l.length&&(o={},a=i.currentViewData[s],s=i.updatedRecords.indexOf(a),o.data=a,o.index=s,o.taskbarElement=l[0],o.target=f[0],this._trigger("taskbarClick",o))))},getRowByIndex:function(i,r){var e,o;try{var u=this,f=u.getGanttChartRows(),s=n(f),h=n();return u.model.enableVirtualization&&(e=u.model.updatedRecords[i],i=u.model.currentViewData.indexOf(e)),t.isNullOrUndefined(r)?(u.model.enableVirtualization&&(o=u.model.updatedRecords[r],r=u.model.currentViewData.indexOf(o)),n(f[i])):n(s.slice(i,r))}catch(c){return n()}},selectRows:function(n){var t=this,r=this.model,f=t.getGanttChartRows(),i,u;r.allowSelection&&r.selectionMode!="cell"&&(t.prevSelectedItem&&(t.prevSelectedItem.isSelected=!1),f.removeClass("e-gantt-mouseclick"),u=t.getRowByIndex(n),t.model.allowSelection&&u.addClass("e-gantt-mouseclick"),t.model.selectedRowIndex=n,i=t.model.updatedRecords[n],i&&(i.isSelected=!0),t.model.selectedItem=i,t.prevSelectedItem=i)},updateSelectedItem:function(t){var i=this,r=n(i.getGanttChartRows());r.removeClass("e-gantt-mouseclick");i.model.updatedRecords[t].isSelected=!0;i.model.selectedItem=i.model.updatedRecords[t];this._refresh();i._rowSelectedEventTrigger(t)},ganttrowHover:function(t){var r=this,i;r.model.enableRowHover&&(i=r.getGanttChartRows(),i.removeClass("e-gantt_mousehover").addClass("e-gantt_mouseleave"),n(i[t]).addClass("e-gantt_mousehover").removeClass("e-gantt_mouseleave"))},_rowHover:function(t){var i=this,e=n(t.target),f,u={},r,o;return i.model.enableRowHover?(f=n(i.getGanttChartRows()),r=f.index(e.parent()),r==-1&&(o=e.closest("tr.e-ganttrowcell"),r=f.index(o)),u.index=r,t.type=="mouseenter"?(u.reason="mouseenter",i.addRowHover(r)):(u.reason="mouseleave",i.removeRowHover()),i._trigger("rowHover",u),!1):!1},addRowHover:function(t){var i=this.getGanttChartRows();t!=null&&t!=-1&&n(i[t]).addClass("e-enablerowhover")},removeRowHover:function(){var n=this.getGanttChartRows();n.removeClass("e-enablerowhover")},updateHeight:function(i){var r=this,f=r.model,u;r._setScrollTop();r._containerHeight=i;n("#ganttviewerbodyContent"+r._id+"").css({height:r._containerHeight+"px"});f.stripLines&&n(r.element).find(".e-stripline,.e-stripLines").css({height:i+"px"});f.holidays&&n(r.element).find(".e-holidays,.e-holiday").css({height:i+"px"});n(".e-secondary_canvas").css({height:i+"px"});n(r.element).find(".e-weekends").css({height:i+"px"});u=".e-holiday-label";t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(u=".e-holiday-label-ie8");i<r._viewportHeight?i<=f.rowHeight?n(r.element).find(u).css({top:-i-30}):n(r.element).find(u).css({top:i/2}):n(r.element).find(u).css({top:r._viewportHeight/2});i==0&&r._$bodyContent.css({height:"1px"});r._$bodyContainer.ejScroller("refresh");parseInt(r._$bodyContainer.css("height"))!=r._viewportHeight&&r._$bodyContainer.css("height",r._viewportHeight)},_completeAction:function(n){var t=this;return n.vscrollExsist=t._$bodyContainer.ejScroller("isVScroll"),t._trigger("actionComplete",n),n.requestType==="validatePredecessor"?n.predecessorValidation:void 0},_taskbarEditing:function(n){var t=this;t._trigger("taskbarEditing",n)},_taskbarEdited:function(n){var t=this;t._trigger("taskbarEdited",n)},_queryTaskbarinfo:function(n){this._trigger("queryTaskbarInfo",n);this._updateTaskbarItems(n)},_refreshRow:function(n){var t=this;t._trigger("refreshRow",n)},_enbleZooming:function(n){var t=this;t._trigger("zooming",n)},_updateManualTaskbarItem:function(n,i){var y=i.querySelector(".e-gantt-parenttaskbar-innerdiv"),o=i.querySelector(".e-gantt-parenttaskbar-progress"),s=i.querySelector(".e-gantt-manualparenttaskbar"),h=i.querySelector(".e-gantt-manualparenttaskbar-left"),c=i.querySelector(".e-gantt-manualparenttaskbar-right"),l=i.querySelector(".taskbarresizer-right"),u=y.style,e=o&&o.style,f=s&&s.style,p=h&&h.style,a=c&&c.style,w=l&&l.style,v,r;v=n.model.renderBaseline?model.taskbarHeight-9:model.taskbarHeight-10;r=v/5;t.isNullOrUndefined(n.manualParentTaskbarBackground)||f.backgroundColor==n.manualParentTaskbarBackground||(f.backgroundColor=n.manualParentTaskbarBackground,p.borderColor=n.manualParentTaskbarBackground,a.borderColor=n.manualParentTaskbarBackground);f.width=n.data.width+"px";f.left=n.data.left+"px";a.left=n.data.width-parseInt(r)+"px";w.left=n.data.width-parseInt(r)+"px";n.data.width==n.data.manualWidth&&n.data.left==n.data.manualLeft?(e.width=n.data.progressWidth-r*2+"px",u.width=n.data.manualWidth-r*2+"px",u.left=n.data.manualLeft+r+"px"):n.data.left==n.data.manualLeft?(u.left=n.data.manualLeft+r+"px",e.width=n.data.progressWidth-r+"px",u.width=n.data.manualWidth-r+"px"):(e.width=n.data.progressWidth+"px",u.width=n.data.manualWidth+"px",u.left=n.data.manualLeft+"px")},_updateTaskbarItems:function(t){var g=this.getGanttChartRows(),nt=this.model.currentViewData.indexOf(t.data),i=g[nt],f,e,c,a,v,y,p,w,b;if(i){if(n(i).find(".e-gantt-milestone-container").closest("div").length>0&&(e=n(i).find(".e-gantt-milestone-container").closest("div")[0]),n(i).find(".e-baselinebar").closest("div").length>0&&(c=n(i).find(".e-baselinebar").closest("div")[0]),n(i).find(".e-parentContainer").closest("div").length>0){var f=n(i).find(".e-parentContainer").closest("div")[0],tt=f.querySelector(".e-gantt-parenttaskbar-innerdiv"),k=f.querySelector(".e-gantt-parenttaskbar-progress"),o=tt.style,r=k&&k.style;o.backgroundColor!=t.parentTaskbarBackground&&(o.backgroundColor=t.parentTaskbarBackground);r&&r.backgroundColor!=t.parentProgressbarBackground&&(r.backgroundColor=t.parentProgressbarBackground);o.borderColor!=t.parentTaskbarBorder&&(o.borderColor=t.parentTaskbarBorder);r&&r.borderColor!=t.parentProgressbarBorder&&(r.borderColor=t.parentProgressbarBorder);!t.data.isAutoSchedule&&t.data.hasChildRecords&&this._updateManualTaskbarItem(t,f);r&&r.borderColor!=t.parentProgressbarBorder&&(r.borderColor=t.parentProgressbarBorder)}else if(n(i).find(".e-childContainer").closest("div").length>0){var f=n(i).find(".e-childContainer").closest("div")[0],it=f.querySelector(".e-gantt-childtaskbar"),u=f.querySelector(".e-gantt-childtaskbar-progress"),s=it.style,h=u&&u.style,d=u&&u.querySelector(".e-tasklabel"),l=d&&d.style;s.backgroundColor!=t.taskbarBackground&&(s.backgroundColor=t.taskbarBackground);u&&h.backgroundColor!=t.progressbarBackground&&(h.backgroundColor=t.progressbarBackground);s.borderColor!=t.taskbarBorder&&(s.borderColor=t.taskbarBorder);u&&h.borderColor!=t.progressbarBorder&&(h.borderColor=t.progressbarBorder);l&&l.color!=t.taskbarTextColor&&(l.color=t.taskbarTextColor)}n(e).length>0&&(a=e.querySelector(".e-gantt-milestone.milestone-top"),v=e.querySelector(".e-gantt-milestone.milestone-bottom"),a&&v?(y=a.style,p=v.style,p.borderBottomColor!=t.milestoneBackground&&y.borderTopColor!=t.milestoneBackground&&(p.borderTopColor=t.milestoneBackground,y.borderBottomColor=t.milestoneBackground)):this.model.milestoneTemplate&&(w=e.querySelector(".e-gantt-milestone"),w.style.backgroundColor!=t.milestoneBackground&&(w.style.backgroundColor=t.milestoneBackground)));n(c).hasClass("e-baselinebar")&&(b=c.style,b.backgroundColor!=t.baselineBackground&&(b.backgroundColor=t.baselineBackground))}},_expandCollapse:function(n){var i=this,t={},r=i.model.currentViewData[n];t.data=r;t.recordIndex=i.model.updatedRecords&&i.model.updatedRecords.indexOf(r);t.source="ganttChart";t.expanded=!r.expanded;r&&(t.expanded?i._trigger("expanding",t):i._trigger("collapsing",t))},_getExpandStatus:function(n){var t=n.parentItem;return t!=null?t.expanded===!1?!1:t.parentItem?t.parentItem.expanded===!1?!1:this._getExpandStatus(t.parentItem):!0:!0},onScrollHelper:function(t,i){var r=this,u,f,e;if(!r._$bodyContainer.ejScroller("isVScroll"))return!1;r._mouseLeave();i||r._$bodyContainer.ejScroller("option","scrollTop",t);u=model.rowHeight;n("#"+this._$ganttViewTablebody[0].id).find("tr:first")[0]&&(u=n("#"+this._$ganttViewTablebody[0].id).find("tr:first")[0].getBoundingClientRect().height);f=parseInt(r.model.updatedRecords.length*u)-(r._viewportHeight-18);t>f&&(t=f);t<0&&(t=0);e={scrollTop:t};r._handleScroll(e);this.model.isCriticalPathEnable==!0&&this.model.enableVirtualization==!0&&this.criticalConnectorLine(this.model.criticalPathCollection,this.model.detailPredecessorCollection,!0,this.collectionTaskId)},_handleScroll:function(n){var t=this,n=n||{},f=t._$headerContainer,o=t._$bodyContainer,r=t._prevLeft,u,e;n.scrollTop!==i&&(t._scrollTop=n.scrollTop);n.scrollLeft!==i&&(r=n.scrollLeft);u=r-t._prevLeft;e=t._scrollTop-t._prevScrollTop;u?f.scrollLeft(r):f.scrollLeft(t._prevLeft);t.model.enableVirtualization&&(t._vscrollDist=Math.abs(t._scrollTop-t._prevScrollTop),t._vscrollDist&&(t._vScrollDir=t._prevScrollTop<=t._scrollTop?1:-1,t._updateCurrentViewData(),t.renderGanttRecords(),t._prevScrollTop=t._scrollTop));n.requestType="scroll";n.delta=t._scrollTop;t._prevLeft=r;t._prevScrollTop=t._scrollTop;u===0&&e!==0&&t._completeAction(n)},refreshHelper:function(n,t,r){var u=this;u.model.currentViewData=n;u.model.updatedRecords=t;u._totalCollapsedRecordCount=r!=i?r:0;t&&(u._refresh(),u._setHeight(t.length*u.model.rowHeight),u.updateHeight((t.length-u._totalCollapsedRecordCount)*u.model.rowHeight))},_setScrollTop:function(){var n=this,r=this.model,i=n._scrollTop,t;r.enableVirtualization&&i!==0&&n.model.currentViewData.length*n.model.rowHeight<n._viewportHeight&&(t=i-(n._viewportHeight-n.model.currentViewData.length*n.model.rowHeight),t<0&&(t=0),n._$bodyContainer.ejScroller("scrollY",t,!0))},refreshGridLinesTable:function(n){var t=this;t._$gridLinesTablebody.empty().append(t._createGridLinesTableRow(n));t._$bodyContainer.ejScroller("refresh");parseInt(t._$bodyContainer.css("height"))!=t._viewportHeight&&t._$bodyContainer.css("height",t._viewportHeight)},_refresh:function(){var i=this,r=i.model,u=n.render[i._id+"_CustomTemplate2"](i.model.currentViewData);i._$ganttViewTablebody=n("#ganttViewTablebody"+i._id+"");i._$ganttViewTablebody.empty().append(u);r.enableVirtualization?i._$gridLinesTablebody.empty().append(i._createGridLinesTableRow(i.model.currentViewData.length)):i._$gridLinesTablebody.empty().append(i._createGridLinesTableRow(i.model.currentViewData.length-i._totalCollapsedRecordCount));i._$ganttViewTablebody[0]!=null?this._ganttChartRows=n(i._$ganttViewTablebody[0].childNodes):(i._$ganttViewTablebody=t.buildTag("tbody.e-gantt-viewer-ganttViewTablebody#ganttViewTablebody"+i._id+"",u,{},{}),i._ganttChartRows=n(i._$ganttViewTablebody[0].childNodes));r.queryTaskbarInfo&&i._eventBindings()},refreshRow:function(t){var i=this,u=this.model,f=n(i.getGanttChartRows()[t]),r=i.model.currentViewData[t];!u.allowSelection&&r&&(r.isSelected=!1);t!=-1&&r&&(f.replaceWith(n.render[i._id+"_CustomTemplate2"](r)),i._setGanttChartRows(n(i._$ganttViewTablebody[0].childNodes)));u.queryTaskbarInfo&&i._refreshedRowEventBinding(t)},_refreshedRowEventBinding:function(t){var a=n(this.getGanttChartRows()),r,i={},u,e,o,s,f,h,c,l;r=a[t];n(r).hasClass("e-ganttrowcell")&&(f=n(r).find("td.e-chartcell").has("div.e-childContainer,div.e-parentContainer,div.e-gantt-milestone")[0].firstChild,n(r).find(".e-gantt-milestone-container").closest("div").length>0&&(h=n(r).find(".e-gantt-milestone-container").closest("div")[0]),n(r).find(".e-baselinebar").closest("div").length>0&&(l=n(r).find(".e-baselinebar").closest("div")[0]),n(f).hasClass("e-parentContainer")?(s=f.querySelector(".e-gantt-parenttaskbar-innerdiv"),o=f.querySelector(".e-gantt-parenttaskbar-progress")):n(f).hasClass("e-childContainer")&&(e=f.querySelector(".e-gantt-childtaskbar"),u=f.querySelector(".e-gantt-childtaskbar-progress"),c=u&&u.querySelector(".e-tasklabel")),i.data=this.model.currentViewData[t],i.taskbar=r,i.taskbarBackground=e!=null?e.style.backgroundColor:null,i.progressbarBackground=u!=null?u.style.backgroundColor:null,i.parentTaskbarBackground=s!=null?s.style.backgroundColor:null,i.parentProgressbarBackground=o!=null?o.style.backgroundColor:null,i.parentProgressbarBorder=o!=null?o.style.border:null,i.progressbarBorder=u!=null?u.style.border:null,i.taskbarBorder=e!=null?e.style.border:null,i.parentTaskbarBorder=s!=null?s.style.border:null,i.taskbarTextColor=c!=null?c.style.color:null,i.baselineBackground=l!=null?l.style.backgroundColor:null,i.milestoneBackground=h!=null?h.style.backgroundColor:null,this._queryTaskbarinfo(i))},refreshScroller:function(n){var t=this,r,u,i,f,e;t._$bodyContainer.find("div.e-content").removeClass("e-borderbox");u=t._$bodyContainer.ejScroller("option","scrollTop");i=t._$bodyContainer.ejScroller("option","scrollLeft");t._$bodyContainer.ejScroller("option",{width:n});t._$bodyContainer.ejScroller("refresh");r=t.getMaxScrollWidth();i>r&&(i=r>0?r:0);f=t._$bodyContainer.ejScroller("isHScroll");f?t._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):t._$bodyContainer.find("div.e-content").addClass("e-borderbox");e=t._$bodyContainer.ejScroller("isVScroll");e&&t._$bodyContainer.ejScroller("scrollY",u,!0);t._$bodyContainer.ejScroller("option","scrollLeft",i);t._$headerContainer.scrollLeft(i)},getMaxScrollWidth:function(){var n=this;return n._$bodyContainer.children(".e-content").children().width()-n._$bodyContainer.children(".e-content").width()},refreshStripLines:function(n){var t=this;n&&(this.model.stripLines=n);t._$stripLineContainer.empty();this._renderStripLines(this.model.stripLines)},refreshHolidays:function(n){var t=this,r,i;if(n&&(t.model.holidays=n),t._$secondaryCanvas.empty(),t.model.holidays!=null)for(r=t.model.holidays.length,i=0;i<r;i++)t._renderHoliday(t.model.holidays[i])},renderNewAddedRow:function(t,i){var r=this,f=r.model,u=n.render[this._id+"_CustomTemplate2"](i);r._ganttChartRows.length!=0?r._ganttChartRows.length==t?r.getGanttChartRows().eq(t-1).after(u):r.getGanttChartRows().eq(t).before(u):r._refresh();r._setGanttChartRows(n(r._$ganttViewTablebody[0].childNodes));r._$gridLinesTablebody.empty().append(r._createGridLinesTableRow(r.model.updatedRecords.length-r._totalCollapsedRecordCount));f.enableVirtualization===!1?r._setHeight((r.model.updatedRecords.length-r._totalCollapsedRecordCount)*r.model.rowHeight):r._setHeight(r.model.updatedRecords.length*r.model.rowHeight);r.updateHeight(r._containerHeight)},_setGanttChartRows:function(n){this._ganttChartRows=n},refreshChartHeader:function(i,r){var u=this,s=u.model,f=s.scheduleHeaderSettings.scheduleHeaderType,l,v,h,e,c,a,o,y;u._updateScheduleWidth();f=="hour"?u._createScheduleTopHourTemplate():f=="day"?u._createScheduleTopDayTemplate():f=="week"?u._createScheduleWeekTemplate():f=="month"?u._createScheduleTopMonthTemplate():f=="year"&&u._createScheduleYearTemplate();i=i==null?new Date:i;r=r==null?new Date(null):r;u._$scheduleDiv.empty();o=t.buildTag("table.e-schedule-headerrow-week","",{display:"block"},{"cell-spacing":"0"});l=t.buildTag("colgroup","",{},{});v=n(document.createElement("col"));v.css("width",u._getScheduleLength(f)+"px");l.append(v);h=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});f=="week"?e=t.buildTag("tr",n.render[this._id+"ScheduleWeekTemplate"](s.scheduleWeeks),{},{}):f=="year"?e=t.buildTag("tr",n.render[this._id+"ScheduleYearTemplate"](s.scheduleYears),{},{}):f=="month"?e=t.buildTag("tr",n.render[this._id+"ScheduleTopMonthTemplate"](s.scheduleMonths),{},{}):f=="day"?e=t.buildTag("tr",n.render[this._id+"ScheduleTopDayTemplate"](s.scheduleDays),{},{}):f=="hour"&&(e=t.buildTag("tr",n.render[this._id+"ScheduleTopHourTemplate"](s.scheduleHours),{},{}));c=t.buildTag("th.schedule","",{},{});a=t.buildTag("div.schedule","",{width:"20px"},{});c.append(a);e.append(c);h.append(e);o.append(l);o.append(h);u._$scheduleDiv.append(o);e=null;f=="hour"?u._createMinuteTemplate():f=="day"?u._createScheduleHourTemplate():f=="week"?u._createScheduleDayTemplate():f=="month"?u._createScheduleBottomWeekTemplate():f=="year"&&u._createScheduleMonthTemplate();o=t.buildTag("table.e-schedule-headerrow-day","",{display:"block","border-collapse":"collapse"},{"cell-spacing":"0"});h=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});y=u._getScheduleMonth(new Date(s.scheduleYears[0]),r);f=="week"&&(e=t.buildTag("tr",n.render[this._id+"_CustomTemplate1"](u.model.scheduleWeeks),{},{}));f=="year"&&(e=t.buildTag("tr",n.render[this._id+"ScheduleMonthTemplate"](y),{},{}));f=="month"&&(u._numOfWeeks=u._getNumberOftWeeks(this.model.projectStartDate,this.model.projectEndDate),e=t.buildTag("tr",n.render[this._id+"ScheduleBottomWeekTemplate"](u._numOfWeeks),{},{}));f=="day"&&(e=t.buildTag("tr",n.render[this._id+"scheduleHourTemplate"](u._getScheduleHours()),{},{}));f=="hour"&&(e=t.buildTag("tr",n.render[this._id+"scheduleMinuteTemplate"](u._getScheduleMinutes()),{},{}));c=t.buildTag("th.schedule","",{},{});a=t.buildTag("div.schedule","",{width:"20px"},{});c.append(a);e.append(c);h.append(e);o.append(l);o.append(h);u._$scheduleDiv.append(o)},refreshContainersWidth:function(){var t=this,i,f=this.model,e=f.scheduleHeaderSettings.scheduleHeaderType,u,r;if(i=t._getScheduleLength(e),$gridLineContainerTable=n("#ganttgridLinesTable"+t._id),t._$bodyContent.width(i),t.refreshWeekEndContainer(),$gridLineContainerTable.width(i),$gridLineContainerTable.children("col").width(i),t._$ganttViewTable.width(i),t._$ganttViewTable.children("col").width(i),t._createTaskbarTemplate(),t._updateCurrentViewData(),t._$secondaryCanvas.empty(),t._$stripLineContainer.empty(),t.model.stripLines!=null&&this._renderStripLines(t.model.stripLines),t.model.holidays!=null)for(u=t.model.holidays.length,r=0;r<u;r++)t._renderHoliday(t.model.holidays[r])},refreshWeekEndContainer:function(){var n=this,l=n.model,i=0,o=n.model.perDayWidth+1,s=n.model.updatedRecords.length*this.model.rowHeight,a=n.model.scheduleWeeks.length,h,c,u=l.scheduleHeaderSettings.weekStartDay,v=u>=0&&u<7?u:0,f=6-v,y=f+1==7?0:f+1,r=n._$weekendsContainer.children(".e-secondary_canvas"),e;for(r.empty(),e=0;e<a;e++)h=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*y+"px",width:o+"px",height:s+"px","background-color":this.model.weekendBackground},{}),c=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*f+"px",width:o+"px",height:s+"px","background-color":this.model.weekendBackground},{}),r.append(h),r.append(c),i=i+this._scheduleWeekWidth;n._$weekendsContainer.append(r)},deleteChartRows:function(n,t){for(var r=this,u=r.getGanttChartRows(),i=n;i<n+t;i++)u.splice(i,1)},_eventBindings:function(){var v=n(this.getGanttChartRows()),y=v.length,i,t={},u,f,e,h,o,r,c,l,a,s;if(y!=0)for(s=0;s<y;s++)i=v[s],n(i).hasClass("e-ganttrowcell")&&(r=n(i).find("td.e-chartcell").has("div.e-childContainer,div.e-parentContainer,div.e-gantt-milestone")[0].firstChild,n(i).find(".e-gantt-milestone-container").closest("div").length>0&&(c=n(i).find(".e-gantt-milestone-container").closest("div")[0]),n(i).find(".e-baselinebar").closest("div").length>0&&(a=n(i).find(".e-baselinebar").closest("div")[0]),n(r).hasClass("e-parentContainer")?(o=r.querySelector(".e-gantt-parenttaskbar-innerdiv"),e=r.querySelector(".e-gantt-parenttaskbar-progress"),h=r.querySelector(".e-gantt-manualparenttaskbar")):n(r).hasClass("e-childContainer")&&(f=r.querySelector(".e-gantt-childtaskbar"),u=r.querySelector(".e-gantt-childtaskbar-progress"),l=u&&u.querySelector(".e-tasklabel")),t.data=this.model.currentViewData[s],t.taskbar=i,t.taskbarBackground=f!=null?f.style.backgroundColor:null,t.progressbarBackground=u!=null?u.style.backgroundColor:null,t.parentTaskbarBackground=o!=null?o.style.backgroundColor:null,t.parentProgressbarBackground=e!=null?e.style.backgroundColor:null,t.parentProgressbarBorder=e!=null?e.style.border:null,t.progressbarBorder=u!=null?u.style.border:null,t.taskbarBorder=f!=null?f.style.border:null,t.parentTaskbarBorder=o!=null?o.style.border:null,t.taskbarTextColor=l!=null?l.style.color:null,t.baselineBackground=a!=null?a.style.backgroundColor:null,t.milestoneBackground=c!=null?c.style.backgroundColor:null,t.data.hasChildRecords&&!t.data.isAutoSchedule&&(t.manualParentTaskbarBackground=h!=null?h.style.backgroundColor:null),this._queryTaskbarinfo(t))},_updateCurrentViewData:function(){var t=this,i=0;this.model.enableVirtualization?(this._getRenderedRowRange(),this.model.currentViewData=this.model.updatedRecords.slice(t._renderedRange.top,t._renderedRange.bottom),t._vscrollDist!==0&&(i=t._scrollTop,i-=t._rowMargin,n("#ganttViewTable"+t._id+"").css({top:i+"px"}),n("#ganttgridLinesTable"+t._id+"").css({top:i+"px"})),t._vTop=t._visibleRange.top,t._vBottom=t._visibleRange.bottom,t._rTop=t._renderedRange.top,t._rBottom=t._renderedRange.bottom):this.model.currentViewData=this.model.updatedRecords},renderGanttRecords:function(){var n=this;n._refresh();n._$ganttViewTable.append(n._$ganttViewTablebody);n._$bodyContent.append(n._$ganttViewTable)},_getRenderedRowRange:function(){var n=this,t,i;return n._getVisibleRowRange(),t=n._visibleRange.top,i=n._visibleRange.bottom,n._renderedRange={top:t,bottom:i},n._renderedRange},_getVisibleRowRange:function(){var n=this,r=n._scrollTop/n.model.rowHeight,f=r-Math.floor(r),t,i,u;n._rowMargin=f*n.model.rowHeight;t=Math.floor(r);u=n.model.updatedRecords.length;i=n._getrowposition(n._scrollTop+n._viewportHeight);t=Math.max(0,t);i=Math.min(u,i);n._visibleRange={top:t,bottom:i}},_getrowposition:function(n){return Math.ceil(n/this.model.rowHeight)},_getDateType:function(n){return n instanceof Date?n:n!=null?t.parseDate(n,this.model.dateFormat,this.model.locale):null},_getDateFromFormat:function(n){return typeof n=="object"?new Date(n):n?t.parseDate(n,this.model.dateFormat,this.model.locale)==null?new Date(n):t.parseDate(n,this.model.dateFormat,this.model.locale):void 0},_createScheduleTopDayTemplate:function(){var t=this,r=t.model,f=r.scheduleHeaderSettings.dayHeaderFormat==""&&r.scheduleHeaderSettings.scheduleHeaderType=="day"?"ddd":r.scheduleHeaderSettings.dayHeaderFormat,e={renderDayTop:n.proxy(t._getDaySplit,t)},i,u;n.views.helpers(e);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:"+t.model.perHourWidth*24+"px;'>";td="<div class='e-schedule-week-headercell-content'  style='width:"+(t.model.perHourWidth*24-1)+"px;box-sizing:border-box;margin:auto;white-space:nowrap;'>{{:~renderDayTop('"+f+"',#data)}}<\/div><\/div>";i+=td;i+="<\/th>";u={};u[t._id+"ScheduleTopDayTemplate"]=i;n.templates(u)},_getDaySplit:function(n,i){var r=new Date(i),f=this,u=f.model;switch(n){case"D":case"d":return r.getDate();case"DD":case"dd":return("0"+r.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(r,n,u.locale)}return t.format(r,n,u.locale)},_createScheduleTopMonthTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.monthHeaderFormat,o={renderMonthTop:n.proxy(t._getMonthsplit,t),setMonthWidth:n.proxy(t._setMonthWidth,t),isLastMonth:n.proxy(t._checkLastMonthWidth,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:{{:~setMonthWidth(#data)}}px;'>";u="<div class='e-schedule-week-headercell-content'  style=box-sizing:border-box;-moz-box-sizing:border-box;'margin:auto;white-space:nowrap;width:{{:~setMonthWidth(#data)-1}}px;'>{{:~renderMonthTop('"+e+"',#data)}}<\/div>{{if ~isLastMonth(#data)}}<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;'><div class='e-schedule-week-headercell-content' style='box-sizing:border-box;-moz-box-sizing:border-box;margin:auto;white-space:nowrap;width:"+(t._balanceWidth-1)+"px;'><\/div><\/th>{{/if}}";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleTopMonthTemplate"]=i;n.templates(r)},_setMonthWidth:function(n){var e=this,i,u,r,f;return(i=typeof n=="object"?new Date(n):t.parseDate(n,this.model.dateFormat,this.model.locale),u=new Date(i.getFullYear(),i.getMonth()+1,0),r=u.getDate(),i.getTime()===e.model.scheduleMonths[0].getTime())?(f=u.getDate()-i.getDate(),this.model.perDayWidth*(f+1)):r==31?this.model.perDayWidth*31:r==30?this.model.perDayWidth*30:r==28?this.model.perDayWidth*28:r==29?this.model.perDayWidth*29:void 0},_checkLastMonthWidth:function(n){var t=this;return n==t.model.scheduleMonths[t.model.scheduleMonths.length-1]&&t._balanceWidth>0?!0:!1},_getMonthsplit:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_createScheduleYearTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.yearHeaderFormat,o={renderYear:n.proxy(t._getYearsplit,t),getYearWidth:n.proxy(t._getTemplateYearWidth,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:{{:~getYearWidth(#data)}}px;'>";u="<div class='e-schedule-week-headercell-content' style='margin:auto;white-space:nowrap;width:{{:~getYearWidth(#data)-1}}px;box-sizing:border-box;-moz-box-sizing:border-box;'>{{:~renderYear('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleYearTemplate"]=i;n.templates(r)},_getYearsplit:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_getMonthWidthForYearMode:function(n){for(var u,o=this,e=o.model,n,i=0,f=n.getMonth();f<12;f++){u=n;n=typeof u=="object"?new Date(u):t.parseDate(u,e.dateFormat,e.locale);var s=new Date(n.getFullYear(),n.getMonth()+1,0),h=n.getDate(),r=s.getDate();h!=1?i+=r-n.getDate():r==31?i+=31:r==30?i+=30:r==28?i+=28:r==29&&(i+=29);n=new Date(n.getFullYear(),f+1,1)}return i},_getTemplateYearWidth:function(n){var i=n.getFullYear(),t=this._getMonthWidthForYearMode(n);return t*this.model.perDayWidth},_createScheduleWeekTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.weekHeaderFormat,o={renderWeek:n.proxy(t._getWeeksplit,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-week-headercell' style='box-sizing:border-box;-moz-box-sizing:border-box;width:"+t._scheduleWeekWidth+"px;'>";u="<div class='e-schedule-week-headercell-content'  style='width:"+(t._scheduleWeekWidth-1)+"px;box-sizing:border-box;margin:auto;white-space:nowrap;'>{{:~renderWeek('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleWeekTemplate"]=i;n.templates(r)},_getWeeksplit:function(n,i){var u=new Date(i),f=this,e=f.model,r;return r=t.format(u,n,e.locale),r.toLowerCase().replace(/(-(\w)|(^| )(\w)|:(\w)|,(\w)|\/(\w)|\.(\w))/g,function(n){return n.toUpperCase()})},_createScheduleHourTemplate:function(){var t=this,f=t.model,u,e=f.scheduleHeaderSettings.hourHeaderFormat,o={renderHour:n.proxy(t._getHourTemplate,t)},i,r;n.views.helpers(o);i="<th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perHourWidth+"px;'>";u="<div class='e-schedule-day-headercell-content' style='width:"+(t.model.perHourWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"scheduleHourTemplate"]=i;n.templates(r)},_createScheduleTopHourTemplate:function(){var t=this,e=t.model,r=e.minuteInterval,o,i,s=e.scheduleHeaderSettings.hourHeaderFormat,h={renderHour:n.proxy(t._getHourTemplate,t)},u,f;r==30&&(i=2);r==15&&(i=4);r==5&&(i=12);r==1&&(i=60);t._totalInterval=i;n.views.helpers(h);u="<th  class='e-schedule-hour-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perMinuteWidth*i+"px;'>";o="<div class='e-schedule-hour-headercell-content' style='width:"+(t.model.perMinuteWidth*i-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+s+"',#data)}}<\/div>";u+=o;u+="<\/th>";f={};f[t._id+"ScheduleTopHourTemplate"]=u;n.templates(f)},_createMinuteTemplate:function(){var t=this,f=t.model,u,e=f.scheduleHeaderSettings.minuteHeaderFormat,o={renderHour:n.proxy(t._getHourTemplate,t)},i,r;n.views.helpers(o);i="<th class='e-schedule-hour-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perMinuteWidth+"px;'>";u="<div class='e-schedule-hour-headercell-content' style='width:"+(t.model.perMinuteWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderHour('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"scheduleMinuteTemplate"]=i;n.templates(r)},_getHourTemplate:function(n,i){var r=new Date(i),u=this,f=u.model;return t.format(r,n,f.locale)},_createScheduleBottomWeekTemplate:function(){var t=this,u,f=t.model,e=f.scheduleHeaderSettings.weekHeaderFormat,o={renderWeek:n.proxy(t._getMonthWeekTemplate,t)},i,r;n.views.helpers(o);i="<th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perWeekWidth+"px;'>";u="<div class='e-schedule-day-headercell-content' style='position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;padding-left:2px;width:"+(t.model.perWeekWidth-1)+"px;'>{{:~renderWeek('"+e+"',#data)}}<\/div>";i+=u;i+="<\/th>";r={};r[t._id+"ScheduleBottomWeekTemplate"]=i;n.templates(r)},_getMonthWeekTemplate:function(n,i){var r=new Date(i),u=this,f=u.model;switch(n){case"d":case"dd":case"ddd":default:return t.format(r,n,f.locale)}},_createScheduleMonthTemplate:function(){var t=this,u=t.model,f=u.scheduleHeaderSettings.monthHeaderFormat,e={renderMonth:n.proxy(t._getMonthTemplate,t),getMonthWidth:n.proxy(t._setMonthWidthYearMode,t)},r,i;n.views.helpers(e);r="<th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:{{:~getMonthWidth(#data)}}px;'><div class='e-schedule-day-headercell-content' style='position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip;width:{{:~getMonthWidth(#data)-1}}px;'>{{:~renderMonth('"+f+"',#data)}}<\/div><\/th>";i={};i[t._id+"ScheduleMonthTemplate"]=r;n.templates(i)},_getMonthTemplate:function(n,i){var r=new Date(i),f=this,u=f.model;switch(n){case"M":case"m":return("0"+r.getDate()).slice(-2);case"MM":case"mm":return r.getDate();case"MMM":case"mmm":case"MMMM":case"mmmm":return t.format(r,n,u.locale);default:return t.format(r,n,u.locale)}},_setMonthWidthYearMode:function(n){var f=this,i=new Date(n),r=new Date(i.getFullYear(),i.getMonth()+1,0),u=i.getDate(),t=r.getDate();return u!=1?this.model.perDayWidth*(t-i.getDate()):t==31?this.model.perDayWidth*31:t==30?this.model.perDayWidth*30:t==28?this.model.perDayWidth*28:t==29?this.model.perDayWidth*29:void 0},_createScheduleDayTemplate:function(){var t=this,e,u=t.model,i=u.scheduleHeaderSettings.dayHeaderFormat==""&&u.scheduleHeaderSettings.scheduleHeaderType=="day"?"ddd":u.scheduleHeaderSettings.dayHeaderFormat,o={renderDay:n.proxy(t._getDayTemplate,t)},r,f;n.views.helpers(o);r="<th  class='e-schedule-day-headercell  e-headercell-weekend' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"'>";e="<div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderDay('"+i+"',0,#data)}}<\/div><th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderDay('"+i+"',1,#data)}}<\/div><th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderDay('"+i+"',2,#data)}}<\/div><th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderDay('"+i+"',3,#data)}}<\/div><th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderDay('"+i+"',4,#data)}}<\/div><th  class='e-schedule-day-headercell' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderDay('"+i+"',5,#data)}}<\/div><th  class='e-schedule-day-headercell  e-headercell-weekend' style='-moz-box-sizing:border-box;box-sizing:border-box;width:"+t.model.perDayWidth+"px;background-color:"+this.model.scheduleHeaderSettings.weekendBackground+"'><div class='e-schedule-day-headercell-content' style='width:"+(t.model.perDayWidth-1)+"px;position:static;box-sizing:border-box;overflow:hidden;text-overflow:clip'>{{:~renderDay('"+i+"',6,#data)}}<\/div>";r+=e;r+="<\/th>";f={};f[t._id+"_CustomTemplate1"]=r;n.templates(f)},_getDayTemplate:function(n,i,r){var u=new Date(r),e=this,f=e.model;u.setDate(u.getDate()+i);switch(n){case"D":case"d":return u.getDate();case"DD":case"dd":return("0"+u.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(u,n,f.locale);case"":return n="ddd",t.format(u,n,f.locale)[0].toUpperCase();default:return t.format(u,n,f.locale).toUpperCase()}},_getScheduleMonth:function(n,t){var f=this,i=f.model,r=[],u;for(t=t.getMonth()<11?new Date(t.getFullYear(),11,31):t,endMonth=new Date(n.getFullYear(),11,31)<new Date(i.scheduleEndDate)?12:new Date(i.scheduleEndDate).getMonth()+1,u=n.getMonth();n<t;u++)r.push(n),n=new Date(n.getFullYear(),n.getMonth()+1,1);return r},_createSchedule:function(i,r){var u=this,a=u.model,e=a.scheduleHeaderSettings.scheduleHeaderType,c,v,s,f,h,l,o,y;i=i==null?new Date:i;r=r==null?new Date(null):r;u._createScheduleWeekTemplate();u._createScheduleYearTemplate();u._createScheduleTopMonthTemplate();u._createScheduleTopDayTemplate();u._createScheduleTopHourTemplate();o=t.buildTag("table.e-schedule-headerrow-week","",{display:"block"},{"cell-spacing":"0"});c=t.buildTag("colgroup","",{},{});v=n(document.createElement("col"));v.css("width",u._getScheduleLength(e)+"px");c.append(v);s=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});e=="week"?f=t.buildTag("tr",n.render[this._id+"ScheduleWeekTemplate"](u.model.scheduleWeeks),{},{}):e=="year"?f=t.buildTag("tr",n.render[this._id+"ScheduleYearTemplate"](u.model.scheduleYears),{},{}):e=="month"?f=t.buildTag("tr",n.render[this._id+"ScheduleTopMonthTemplate"](u.model.scheduleMonths),{},{}):e=="day"?f=t.buildTag("tr",n.render[this._id+"ScheduleTopDayTemplate"](u.model.scheduleDays),{},{}):e=="hour"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleTopHourTemplate"](u.model.scheduleHours),{},{}));h=t.buildTag("th.schedule","",{},{});l=t.buildTag("div.schedule","",{width:"20px"},{});h.append(l);f.append(h);s.append(f);o.append(c);o.append(s);u._$scheduleDiv.append(o);f=null;u._createScheduleDayTemplate();u._createScheduleMonthTemplate();u._createScheduleBottomWeekTemplate();u._createMinuteTemplate();u._createScheduleHourTemplate();o=t.buildTag("table.e-schedule-headerrow-day","",{display:"block","border-collapse":"collapse"},{"cell-spacing":"0"});s=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{});y=u._getScheduleMonth(new Date(a.scheduleYears[0]),r);e=="week"&&(f=t.buildTag("tr",n.render[this._id+"_CustomTemplate1"](a.scheduleWeeks),{},{}));e=="year"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleMonthTemplate"](y),{},{}));e=="month"&&(f=t.buildTag("tr",n.render[this._id+"ScheduleBottomWeekTemplate"](u._numOfWeeks),{},{}));e=="day"&&(f=t.buildTag("tr",n.render[this._id+"scheduleHourTemplate"](u._getScheduleHours()),{},{}));e=="hour"&&(f=t.buildTag("tr",n.render[this._id+"scheduleMinuteTemplate"](u._getScheduleMinutes()),{},{}));h=t.buildTag("th.schedule","",{},{});l=t.buildTag("div.schedule","",{width:"20px"},{});h.append(l);f.append(h);s.append(f);o.append(c);o.append(s);u._$scheduleDiv.append(o);u._$headerContainer.append(u._$scheduleDiv);u._$ganttChartContainer.append(u._$headerContainer);n("#"+u._id).append(u._$ganttChartContainer)},_getScheduleHours:function(){var n=this,r=n.model,t=new Date(n.model.projectStartDate),i=new Date(r.projectEndDate);n._scheduleHours=[];i.setHours(24);do n._scheduleHours.push(new Date(t)),t.setHours(t.getHours()+1);while(!(t.getTime()>=i.getTime()));return n._scheduleHours},_getScheduleMinutes:function(){var n=this,i=n.model,t=new Date(n.model.projectStartDate),r=new Date(i.projectEndDate);r.setMinutes(60);t.setMinutes(00);n._scheduleMinutes=[];do n._scheduleMinutes.push(new Date(t)),t.setMinutes(t.getMinutes()+i.minuteInterval);while(!(t.getTime()>=r.getTime()));return n._scheduleMinutes},createGridLinesTable:function(){var i=this,f=i.model,u,c=f.scheduleHeaderSettings.scheduleHeaderType,r,s,o,e,h;u=t.buildTag("table.e-ganttgridLinesTable#ganttgridLinesTable"+i._id,"",{"z-index":"2",position:"absolute"},{cellspacing:"0px"});o=t.buildTag("colgroup","",{},{});e=n(document.createElement("col"));switch(c){case"week":r=f.scheduleWeeks.length;u.css("width",r*i._scheduleWeekWidth+"px");e.css("width",r*this._scheduleWeekWidth+"px");break;case"year":r=f.scheduleYears.length;u.css("width",i._scheduleYearWidth+"px");e.css("width",this._scheduleYearWidth+"px");break;case"month":r=f.scheduleMonths.length;u.css("width",i._scheduleMonthWidth+"px");e.css("width",this._scheduleMonthWidth+"px");break;case"day":r=f.scheduleDays.length;u.css("width",r*i.model.perHourWidth*24+"px");e.css("width",r*i.model.perHourWidth*24+"px");break;case"hour":r=f.scheduleHours.length;u.css("width",r*i.model.perMinuteWidth*i._totalInterval+"px");e.css("width",r*i.model.perMinuteWidth*i._totalInterval+"px")}o.append(e);u.append(o);s=i._createGridLinesTableRow(f.updatedRecords.length);h=t.buildTag("tbody.e-gantt-viewer-gridLinesTablebody#gridLinesTablebody"+i._id+"",s,{},{});i._$gridLinesTablebody=h;u.append(i._$gridLinesTablebody);i._$bodyContent.append(u)},_createGridLinesTableRow:function(n){for(var r=this,t="",i=0;i<n;i++)t+="<tr style='display:table-row;height:"+this.model.rowHeight+"px'><td class='e-ganttgridlines'><\/td><\/tr>";return t},_SelectState:function(){var t=this,n=this.model;return n.allowSelection?!0:!1},_getFontSize:function(){var i=this,r=i.model,u=r.taskbarHeight,n,t;return n=70*u/100,t=n%1,t==.5?n:t<.5?Math.floor(n):Math.ceil(n)},_getLeftTaskLabel:function(){var r=this,i=r.model,n="",u=i._columns.length,t;if(this.model.leftTaskLabelMapping==this.model.resourceNameMapping)n="{{:~_resources(#data)}}";else if(this.model.leftTaskLabelMapping==this.model.predecessorMapping)n="{{:predecessorsName}}";else for(t=0;t<u;t++)if(this.model.leftTaskLabelMapping==i._columns[t].mappingName){n="{{:"+i._columns[t].field+"}}";break}return n==""&&(n="{{:"+this.model.leftTaskLabelMapping+"}}"),n},_getRightTaskLabel:function(){var r=this,i=r.model,n="",u=i._columns.length,t;if(this.model.rightTaskLabelMapping==this.model.resourceNameMapping)n="{{:~_resources(#data)}}";else if(this.model.rightTaskLabelMapping==this.model.predecessorMapping)n="{{:predecessorsName}}";else for(t=0;t<u;t++)if(this.model.rightTaskLabelMapping==i._columns[t].mappingName){n="{{:"+i._columns[t].field+"}}";break}return n==""&&(n="{{:"+this.model.rightTaskLabelMapping+"}}"),n},_getMargin:function(){var t=this,i=this.model.taskbarHeight,n;return n=(i-t._fontSize-3)/2,Math.floor(n)},_getResizerLeftAdjust:function(){var t=this,r=this.model.taskbarHeight,u=t._fontSize,f=t._resizerMargin,n,i;return n=r/50,i=n%1,n=i<.5?Math.floor(n):Math.ceil(n),n<0?0:n},_createTaskbarTemplate:function(){var i=this,r=i.model,l,d=r.scheduleHeaderSettings.scheduleHeaderType,ii,g=4,u,ot,oi=0,f,o=0,s=0,nt=0,tt=0,e=0,a=!1,v=!1,st="",wt="",bt="",ht="",ct=r.baselineColor,h=r.taskbarTemplate,lt,kt=!1,ri=!1,at=r.parentTaskbarTemplate,vt,ui=!1,yt=r.milestoneTemplate,fi=!1,it="",y=r.leftTaskLabelTemplate,rt=!1,ut="",p=r.rightTaskLabelTemplate,ft=!1,et="",si={_SelectState:n.proxy(i._SelectState,i),_getType:i._getTypedata,_expander:i._addRecordExpandCollapse,_milestoneMapping:i._isMilestone,_resources:n.proxy(i._getResourceInfo,i),_rowClassName:t.TreeGrid._getrowClassName,_expandStatus:n.proxy(i._getExpandStatusRecord,i),_borderRadius:i._getBorderRadius},dt,b,ei,k,c,w,ti;i._fontSize=i._getFontSize();i._resizerRightAdjust=i._fontSize*.8;i._resizerMargin=i._getMargin();i._resizerLeftAdjust=i._getResizerLeftAdjust();d=="week"?l=r.scheduleWeeks.length*i._scheduleWeekWidth:d=="year"?l=i._scheduleYearWidth:d=="month"?l=i._scheduleMonthWidth:d=="day"?l=r.scheduleDays.length*r.perHourWidth*24:d=="hour"&&(l=r.scheduleHours.length*r.perMinuteWidth*i._totalInterval);r.renderBaseline?(r.taskbarHeight+g<=r.rowHeight?(dt=r.taskbarHeight,ot=0):(dt=r.taskbarHeight-g,ot=-4),u=dt,oi=0,f=r.rowHeight-g-5):(u=r.taskbarHeight,f=r.rowHeight-10);e=u/5;o=Math.floor(r.taskbarHeight/2);i._milesStoneWidth=o*2;i._connectorPointWidth=s=u/2;nt=s/2;tt=s-s/2;n.views.helpers(si);r.progressMapping||(this.model.showProgressStatus=!1);r.resourceInfoMapping||(r.showResourceNames=!1);h&&(c=t.buildTag("div","",{},{}),w=h.charAt(0),kt=!0,b="",lt=h.charAt(0)=="#"?n(h)[0].innerHTML:h,lt=lt.replace(/src/gi,i._id+"src"),n(c[0]).html(lt),n(c[0].childNodes).each(function(){var s,f,i,e,o;n(this).hasClass("e-gantt-template-taskbar")?(s="e-gantt-childtaskbar "+n(this).attr("class"),n(this).css({height:u+"px"}).attr("class",s),f="",n(this.childNodes).each(function(){var e,t,i;n(this).hasClass("e-gantt-template-progressbar")?(ri=!0,e="e-gantt-childtaskbar-progress  "+n(this).attr("class"),n(this).css({height:r.progressbarHeight*(u/100)+"px",position:"absolute",top:"-1px",left:"-1px"}).attr("class",e),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+t.substr(i+7),f+=t):f+=this.nodeName=="#comment"?"":this.nodeName=="#text"?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),i=n(this).clone().empty()[0].outerHTML,e=i.indexOf("style"),i=i.substr(0,e+7)+"left:{{:left}}px;width:{{:width}}px;"+i.substr(e+7),o=t.browserInfo().name=="msie"&&t.browserInfo().version<9?i.indexOf("<\/"+this.tagName+">"):i.indexOf("<\/"+this.tagName.toLowerCase()+">"),i=i.substr(0,o)+f+i.substr(o),b+=i):b+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),b=b.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));at&&(c=t.buildTag("div","",{},{}),ei=at.charAt(0),ui=!0,k="",vt=ei=="#"?n(at)[0].innerHTML:at,vt=vt.replace(/src/gi,i._id+"src"),n(c[0]).html(vt),n(c[0].childNodes).each(function(){var s,f,i,e,o;n(this).hasClass("e-gantt-template-taskbar")?(n(this).addClass("e-parentTask"),s="e-gantt-parenttaskbar-innerdiv e-parentTask"+n(this).attr("class"),n(this).css({height:u+"px"}).attr("class",s),f="",n(this.childNodes).each(function(){var e,t,i;n(this).hasClass("e-gantt-template-progressbar")?(e="e-gantt-parenttaskbar-progress e-parentTask "+n(this).attr("class"),n(this).css({height:r.progressbarHeight*(u/100)+"px",top:"-1px",left:"-1px",position:"absolute","z-index":"3"}).attr("class",e),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+t.substr(i+7),f+=t):f+=this.nodeName=="#comment"?"":this.nodeName=="#text"?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),i=n(this).clone().empty()[0].outerHTML,e=i.indexOf("style"),i=i.substr(0,e+7)+"left:{{:left}}px;width:{{:width}}px;"+i.substr(e+7),o=t.browserInfo().name=="msie"&&t.browserInfo().version<9?i.indexOf("<\/"+this.tagName+">"):i.indexOf("<\/"+this.tagName.toLowerCase()+">"),i=i.substr(0,o)+f+i.substr(o),k+=i):k+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),k=k.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));yt&&(c=t.buildTag("div","",{},{}),w=yt.charAt(0),fi=!0,h=w=="#"?n(yt)[0].innerHTML:yt,h=h.replace(/src/gi,i._id+"src"),n(c[0]).html(h),n(c[0].childNodes).each(function(){var u,t,i;n(this).hasClass("e-gantt-template-milestone")?(u="e-gantt-milestone "+n(this).attr("class"),n(this).css({width:r.taskbarHeight-3+"px",position:"absolute","z-index":"3"}).attr("class",u),t=this.outerHTML,i=t.indexOf("style"),t=t.substr(0,i+7)+"left:{{:left}}px;"+t.substr(i+7),it+=t):it+=this.nodeName=="#comment"?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),it=it.replace(RegExp((i._id+"src").toLowerCase(),"g"),"src"));y&&(w=y.charAt(0),w=="#"?n(y)[0]&&(ut=n(y)[0].innerHTML):ut=document.getElementById(y)?n("#"+y)[0].innerHTML:y,rt=!0);p&&(w=p.charAt(0),w=="#"?n(p)[0]&&(et=n(p)[0].innerHTML):et=document.getElementById(p)?n("#"+p)[0].innerHTML:p,ft=!0);this.model.leftTaskLabelMapping&&rt==!1&&(a=!0,st=i._getLeftTaskLabel());this.model.rightTaskLabelMapping&&ft==!1&&(v=!0,ht=i._getRightTaskLabel());this.model.taskbarHeight<45&&(wt="<div class='e-connectortouchpoint' style='right:0px;width:20px;margin-top:"+(s-20)/2+"px;height:20px;border-radius:10px'><\/div>",bt="<div class='e-connectortouchpoint' style='left:0px;width:20px;margin-top:"+(s-20)/2+"px;height:20px;border-radius:10px'><\/div>");var gt=Math.round(-((this.model.rowHeight-1)/2)),ni="<tr class='{{:~_rowClassName()}}  {{if isSelected && ~_SelectState()}}e-ganttrowcell {{:~_expander()}} e-gantt-mouseclick{{else}}e-ganttrowcell {{:~_expander()}}{{/if}}' id='chartrowcell"+i._id+"' style='display:{{:~_expandStatus(#data)}};background-color:{{if rowBGColor }}{{:rowBGColor}}{{else}} none{{/if}};height:"+r.rowHeight+"px;'>",pt="{{:~_borderRadius()}}";ii="{{if ~_getType()}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{if !isAutoSchedule}}{{if left<manualLeft}}{{:left-10}}{{else}}{{:manualLeft-10}}{{/if}}{{else}}{{:left-10}}{{/if}}px;overflow:hidden;text-overflow: ellipsis;'><div class='e-taskbarname'  style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;margin-right:30px;height:"+f+"px;font-weight:bold'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td  class='e-chartcell' vertical-align='middle' style='width:"+l+"px;'><div class='e-parentContainer{{if !isAutoSchedule}} e-manualParenttaskbar{{/if}}' style='height:"+(this.model.taskbarHeight-1)+"px;z-index:3;'>{{if !isAutoSchedule}}<div class='e-gantt-manualparenttaskbar {{:~_expander()}}' style='left: {{:left}}px;height:"+e+"px; width: {{:width}}px;'><div class='e-gantt-manualparenttaskbar-left' style='height:"+u+"px;border-left-width:"+e+"px;border-bottom:"+e+"px solid transparent;'><\/div><div class='e-gantt-manualparenttaskbar-right' style='left:{{:width - "+parseInt(e)+"}}px;height:"+u+"px;border-right-width:"+e+"px;border-bottom:"+e+"px solid transparent;'><\/div><div class='taskbarresizer-right' style='left:{{:width -"+e+"}}px;width:"+e+"px;height:"+u+"px;font-size:"+i._fontSize+"px;position:absolute;z-index:10;'><\/div><\/div>{{/if}}{{if "+ui+"}}"+k+"{{else}}<div class='e-gantt-parenttaskbar-innerdiv {{:~_expander()}} e-parentTask' style='margin-top:{{if !isAutoSchedule}}"+e*2+"{{/if}}px;background-color:{{if parentTaskbarBackground }}{{:parentTaskbarBackground}}{{else}} "+this.model.parentTaskbarBackground+"{{/if}}; left:{{if isAutoSchedule}}{{:left}}{{else}}{{:manualLeft}}{{/if}}px;width:{{if isAutoSchedule}}{{:width}}{{else}}{{:manualWidth}}{{/if}}px;height:{{if isAutoSchedule}}"+u+"{{else}}"+e*3+"{{/if}}px;'><div  class='e-gantt-parenttaskbar-progress {{:~_expander()}} e-parentTask progressbar' id='progressbar'  style='top:-1px;border-style:{{if progressWidth}}solid{{else}}none{{/if}}; left:-1px;width:{{:progressWidth}}px;position:absolute;background-color:{{if parentProgressbarBackground }}{{:parentProgressbarBackground}}{{else}} "+this.model.parentProgressbarBackground+"{{/if}};z-index:3;border-top-right-radius:{{if isAutoSchedule}}"+pt+"{{else}}"+e+"{{/if}}px;border-bottom-right-radius:{{if isAutoSchedule}}"+pt+"{{else}}"+e+"{{/if}}px;height:{{if isAutoSchedule}}"+u+"{{else}}"+e*3+"{{/if}}px;'><\/div><\/div>{{/if}}<\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}<div  class='e-baselinebar' style='margin-top:"+ot+"px;left:{{:baselineLeft}}px;width:{{:baselineWidth}}px;height:"+g+"px;background-color: "+ct+";position:absolute;z-index:3;box-sizing:border-box;-moz-box-sizing:border-box;'><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='left:{{if (left+width)>(manualLeft+manualWidth)}}{{:left+width+30}}{{else}}{{:manualLeft+manualWidth+30}}{{/if}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;position:absolute;background-color:transparent;font-weight:bold;height:"+(this.model.rowHeight-1)+"px;'><div class='e-resourcename'  style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;outline:none;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{else ~_milestoneMapping()}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{:left-10}}px;overflow:hidden;text-overflow:ellipsis;'><div class='e-taskbarname'  style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' style='width:"+l+"px;'><div class='e-gantt-milestone-container' style=height:"+(this.model.taskbarHeight-1)+"px;><div class='e-connectorpoint-left' style='left:{{:left-"+s+"}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px;'>"+wt+"<\/div>{{if "+fi+"}}"+it+"{{else}}<div class='e-gantt-milestone' style='position:absolute;left:{{:left}}px;'><div class='e-gantt-milestone milestone-top'  style='border-right-width:"+o+"px;border-left-width:"+o+"px;border-bottom-width:"+o+"px; border-right-color:transparent;border-left-color:transparent;border-style:none solid solid;border-top: none;'><\/div><div class='e-gantt-milestone milestone-bottom'  style='top:"+o+"px;border-right-width:"+o+"px; border-left-width:"+o+"px; border-top-width:"+o+"px; border-right-color:transparent;border-left-color:transparent;border-style:solid solid none; border-bottom: none;'><\/div><\/div>{{/if}}<div class='e-connectorpoint-right' style='left:{{:(left+"+o*2+")}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px;'>"+bt+"<\/div><\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate}}<div class='e-baseline-gantt-milestone-container' ><div class='e-baseline-gantt-milestone' style='position:absolute;left:{{:baselineRight}}px;z-index:2;'><div class='e-baseline-gantt-milestone baseline-milestone-top'  style='z-index:2;top:"+-this.model.taskbarHeight+"px;border:"+o+"px solid transparent;border-top: none;border-bottom-color: "+ct+";'><\/div><div class='e-baseline-gantt-milestone baseline-milestone-bottom'  style='z-index:2;top:"+(o-this.model.taskbarHeight)+"px;border:"+o+"px solid transparent;border-bottom: none;border-top-color: "+ct+";'><\/div><\/div><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='margin-top:5px;left:{{:left+56}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;height:"+(this.model.rowHeight-1)+"px;position:absolute;background-color:transparent;'><div class='e-resourcename'  style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{else}}<td class='e-chartcell'><div class='e-tasknameContainer' style='height:"+(this.model.rowHeight-1)+"px;width:{{:left-10}}px;overflow:hidden;text-overflow: ellipsis;'><div class='e-taskbarname'  style='overflow: hidden;text-overflow: ellipsis;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+rt+"}}"+ut+"{{else "+this.model.showTaskNames+" && left > 0 && !"+a+" }}<span style='line-height:"+f+"px;'>{{:taskName}}<\/span>{{else "+a+"}}<span style='line-height:"+f+"px;'>"+st+"<\/span>{{/if}}<\/div><\/div><\/td><td class='e-chartcell' style='width:"+l+"px;'><div  class='e-childContainer' style='height:"+(this.model.taskbarHeight-1)+"px;'><div class='e-connectorpoint-left' style='left:{{:left-"+s+"}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px'>"+wt+"<\/div><div class='taskbarresizer-left e-icon' style='left:{{:left+2-"+i._resizerLeftAdjust+"}}px;width:10px;margin-top:"+i._resizerMargin+"px;height:"+u+"px;font-size:"+i._fontSize+"px;'><\/div>{{if "+kt+"}}"+b+"{{else}}<div  class='e-gantt-childtaskbar {{if isCritical}} e-criticaltaskbar{{/if}} {{if !isAutoSchedule}} manualchildtaskbar{{/if}}' style='left:{{:left}}px;width:{{:width}}px;height:"+u+"px;background-color:{{if taskbarBackground }}{{:taskbarBackground}}{{else}} "+this.model.taskbarBackground+"{{/if}};'><div  class='e-gantt-childtaskbar-progress  {{if isAutoSchedule}} progressbar{{else}} manualprogressbar{{/if}} {{if isCritical}} e-criticalprogressbar{{/if}}' id='progressbar' style='border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;text-align:right;line-height:"+(u-1)+"px;height:"+this.model.progressbarHeight*(u/100)+"px; top:-1px;left:-1px;position:absolute;background-color:{{if progressbarBackground }}{{:progressbarBackground}}{{else}} "+this.model.progressbarBackground+"{{/if}};border-top-right-radius:"+pt+"px;border-bottom-right-radius:"+pt+"px;'>{{if "+this.model.showProgressStatus+"}}<span class='e-tasklabel' style='line-height:"+(u-1)+"px'>{{:status}}%<\/span>{{/if}}<\/div><\/div>{{/if}}{{if "+(!kt||ri)+"}}<div class='progressbarresizer-right' style='left:{{:left+progressWidth-10}}px;width:20px;margin-top:"+(u-5)+"px;height:15px;position:absolute;z-index:5;'><div class='progressbarhandler' style='top:10px;position:absolute;z-index:-1;'><div class='e-progresshandler-element'><\/div><\/div><div class='progressbarhandler' style='top:5px;position:absolute;z-index:-1;'><div class='e-progresshandlerafter-element'><\/div><\/div><\/div>{{/if}}<div class='taskbarresizer-right e-icon' style='left:{{:left+width-"+i._resizerRightAdjust+"}}px;width:10px;height:"+u+"px;font-size:"+i._fontSize+"px;position:absolute;z-index:2;margin-top:"+i._resizerMargin+"px;'><\/div><div class='e-connectorpoint-right' style='left:{{:left+width}}px;width:"+s+"px;margin-top:"+tt+"px;height:"+u/2+"px;border-radius:"+nt+"px'>"+bt+"<\/div><\/div>{{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}<div  class='e-baselinebar' style='margin-top:"+ot+"px;left:{{:baselineLeft}}px;width:{{:baselineWidth}}px;height:"+g+"px;background-color: "+ct+";position:absolute;z-index:3;box-sizing:border-box;-moz-box-sizing:border-box;'><\/div>{{/if}}<\/td><td class='e-chartcell' ><div class='e-resourceinfo' style='left:{{:left+width+30}}px;margin:0;margin-left:5px;margin-top:"+gt+"px;height:"+(this.model.rowHeight-1)+"px;position:absolute;text-align:left;background-color:transparent;'><div class='e-resourcename'  style='overflow-y:hidden;margin-top:5px;height:"+f+"px;margin-right:30px;'>{{if "+ft+"}}"+et+"{{else "+this.model.showResourceNames+" && left > 0 && !"+v+" }}<span style='line-height:"+f+"px;'>{{:~_resources(#data)}}<\/span>{{else "+v+"}}<span style='line-height:"+f+"px;'>"+ht+"<\/span>{{/if}}<\/div><\/div><\/td>{{/if}}";ni+=ii;ni+="<\/tr>";ti={};ti[this._id+"_CustomTemplate2"]=ni;n.templates(ti)},_getResourceInfo:function(n){var t=null,u,i,r;if(n.resourceInfo!=null){if(u=n.resourceInfo.length,u>0){for(i=0;i<u;i++)r=n.resourceInfo[i][this.model.resourceUnitMapping],t==null?(t=n.resourceInfo[i][this.model.resourceNameMapping],r!=100&&(t+="["+r+"%]")):(t+=" , "+n.resourceInfo[i][this.model.resourceNameMapping],r!=100&&(t+="["+r+"%]"));return t}return String.empty}return String.empty},_getrowClassName:function(){var n="gridrowtaskId",t=this;return t.data.parentItem&&(n+=t.data.parentItem.taskId.toString()),n+="level",n+t.data.level.toString()},_getExpandStatusRecord:function(n){var t=this;return t._getExpandStatus(n)?"table-row":"none"},_isMilestone:function(){return this.data.isMilestone?!0:!1},_addRecordExpandCollapse:function(){return this.data.expanded?"e-chartexpand":!this.data.expanded&&this.data.hasChildRecords?"e-chartcollapse":!1},_getTypedata:function(){return this.data.hasChildRecords},_getBorderRadius:function(){var n=this,t=n.data.width-n.data.progressWidth;return t<=4?4-t:0},_getHeightValue:function(){return this.data.ParentIndex*this.data.RowHeight>this.data.ChildIndex*this.data.RowHeight?this.data.ParentIndex*this.data.RowHeight-this.data.ChildIndex*this.data.RowHeight:this.data.ChildIndex*this.data.RowHeight-this.data.ParentIndex*this.data.RowHeight},_createConnectorLineTemplate:function(){var u=this,t=u.model.connectorlineWidth>4?4:u.model.connectorlineWidth,o,r,i=u.model.connectorLineBackground,h={_getWidthVal:u._getWidth,_getTop:u._getPredecessorTop,_getPosition:u._getParentPosition,_setContainerWidthSSType2:u._getContainerWidthSSType2,_setInnerChildWidthSSType2:u._getInnerChildWidthSSType2,_setInnerElementLeftSSType2:u._getInnerElementLeftSSType2,_setInnerElementWidthSSType2:u._getInnerElementWidthSSType2,_isMilestone:u._isTaskMilestone,_isMilestoneParent:u._isMilestoneParent,_getHeightValue:u._getHeightValue},f,s,e;u.model.renderBaseline?(o=0,r=u.model.rowHeight/2-o):r=u.model.rowHeight/2;n.views.helpers(h);f="<div  id='ConnectorLine{{:ConnectorLineId}}' style='background-color=black'>";s="{{if ~_getPosition()=='FSType1'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:(ChildLeft - (ParentLeft + ParentWidth + 20))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType1'><div class='e-line' style='left:{{if milestoneParent}}-7px{{else}}0px{{/if}};width:{{if milestoneParent}}{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-2}}px{{else}}{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px{{/if}};border-top:"+t+"px solid "+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px;width:0px;border-right:"+t+"px solid "+i+";border-top:{{:~_getHeightValue()-"+t+"}}px solid "+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft-(ParentLeft + ParentWidth + 10))+"+t+"-10}}px;width:10px;border-top:"+t+"px solid "+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth + 10))}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else  ~_getPosition()=='FSType2'}}<div style='left:{{:ParentLeft}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:~_getWidthVal()}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType2'><div class='e-line' style='left:{{if milestoneParent}}{{:ParentWidth-7}}px{{else}}{{:ParentWidth}}px{{/if}};width:{{if milestoneParent}}17px{{else}}10px{{/if}};border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:ParentWidth+10-"+t+"}}px;border-left:"+t+"px solid;width:0px;border-top:{{:~_getHeightValue()-14-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30 )}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:0px;border-top:{{:14-"+t+"}}px solid;border-left:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 20))}}px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:(ParentWidth - (((ParentLeft + ParentWidth) - ChildLeft) + 10))}}px;border-left: 10px solid "+i+";border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;top:{{:-6-"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FSType3'}}<div style='left:{{:ChildLeft-20}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ParentWidth+ChildWidth}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType3'><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;top:{{:-5-"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='width:"+t+"px;border-top:{{:~_getHeightValue()-14-"+t+"}}px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='width:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30)}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 30)}}px;width:0px;border-left:"+t+"px solid;height:{{:14-"+t+"}}px;border-color:"+i+";position:relative;top:-13px;'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 14)}}px;width:16px;{{else}}left:{{:(((ParentLeft + ParentWidth) - ChildLeft) + 20)}}px;width:10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative;top:-13px;'><\/div><\/div>{{else ~_getPosition()=='FSType4'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:(ChildLeft - (ParentLeft + ParentWidth + 20))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FSType4'><div class='connectorline-rightarrow' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth + 10))}}px;border-left: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='left:{{:(ChildLeft - (ParentLeft + ParentWidth) - 20)}}px;top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;left:{{:(ChildLeft - (ParentLeft + ParentWidth) - 20)}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;{{/if}}top:-13px;width:{{if ~_isMilestoneParent()}}{{:(ChildLeft-(ParentLeft + ParentWidth+20 )+ 6)+"+t+"}}px;{{else}}{{:(ChildLeft-(ParentLeft + ParentWidth + 20))+"+t+"}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType4'}}<div  style='left:{{:ParentLeft-10}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ChildLeft-ParentLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType4'><div class='connectorline-rightarrow' style='left:{{:ChildLeft-ParentLeft}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:ChildLeft-ParentLeft}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType3'}}<div  style='left:{{:ChildLeft-20}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:ParentLeft-ChildLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType3'><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:ParentLeft-ChildLeft+20}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType2'}}<div  style='left:{{:~_setInnerElementLeftSSType2()}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:~_setContainerWidthSSType2()}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType2'><div class='e-line' style='width:{{:~_setInnerChildWidthSSType2()}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:{{:~_setInnerElementWidthSSType2()}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:{{:~_setInnerElementWidthSSType2()}}px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='SSType1'}}<div  style='left:{{:ChildLeft-20}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:ParentLeft-ChildLeft}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SSType1'><div class='e-line' style='width:{{:ParentLeft-ChildLeft+20}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-rightarrow' style='left:10px;border-left: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType1'}}<div class='FFtype1' style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft + ChildWidth)-(ParentLeft + ParentWidth))+30}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType1'><div class='e-line' style='left:{{if ~_isMilestoneParent()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))-10}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))}}px;{{/if}}width:{{if ~_isMilestoneParent()}}30px;{{else}}20px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestoneParent()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;{{/if}}width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}4px;{{else}}10px;{{/if}}width:{{if ~_isMilestone()}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+16}}px;{{else}}{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+10}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType2'}}<div style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType2'><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;{{/if}}width:{{if ~_isMilestoneParent()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+26}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+4}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+10}}px;{{/if}}width:{{if ~_isMilestone()}}16px;{{else}}10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))-6}}px;{{else}}{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType3'}}<div  style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType3'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:4px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+16}}px;{{else}}left:10px;width:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+10}}px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))+20}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))-6}}px;width:26px;{{else}}left:{{:((ParentLeft + ParentWidth) - (ChildLeft + ChildWidth))}}px;width:20px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='FFType4'}}<div  style='left:{{:ParentLeft+ParentWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='FFType4'><div  class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))-6}}px;{{else}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+4}}px;width:16px;{{else}}left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+10}}px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestoneParent()}}left:-6px;width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+26}}px;{{else}}width:{{:((ChildLeft +ChildWidth)-(ParentLeft + ParentWidth))+20}}px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else  ~_getPosition()=='SFType4'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType4'><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+4}}px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+10}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+14}}px;width:16px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='top:-13px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType3'}}<div style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ChildIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft)-(ChildLeft + ChildWidth))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType3'><div class='connectorline-leftarrow' style='{{if ~_isMilestone()}}left:-6px;{{/if}}border-right: 10px solid "+i+";top:{{:-5-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:4px;width:16px;{{else}}left:10px;width:10px;{{/if}}top:-13px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:20px;top:-13px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:20px;top:-13px;width:{{:(ChildLeft-(ParentLeft + ParentWidth + 20))+"+t+"}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><\/div>{{else  ~_getPosition()=='SFType1'}}<div style='left:{{:ParentLeft-10}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:ChildLeft+ChildWidth+20}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType1'><div class='e-line' style='width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='width:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+30}}px;width:0px;border-left:"+t+"px solid;border-top:{{:15-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+(15-"+t+")}}px;width:16px;{{else}}left:{{:((ChildLeft + ChildWidth) - (ParentLeft ))+20}}px;width:10px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+4}}px;{{else}}{{:((ChildLeft + ChildWidth) - (ParentLeft ))+10}}px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{else ~_getPosition()=='SFType2'}}<div  style='left:{{:ChildLeft+ChildWidth}}px;top:{{:(ParentIndex * RowHeight) +"+r+"}}px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))}}px;height:{{:~_getHeightValue()}}px;position:absolute' connectortype='SFType2'><div class='e-line' style='left:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;width:10px;border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='left:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;width:0px;border-left:"+t+"px solid;border-top:{{:~_getHeightValue()-"+t+"}}px solid;border-color:"+i+";position:relative'><\/div><div class='e-line' style='{{if ~_isMilestone()}}left:0px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))-10}}px;{{else}}left:10px;width:{{:((ParentLeft) - (ChildLeft + ChildWidth))-20}}px;{{/if}}border-top:"+t+"px solid;border-color:"+i+";position:relative'><\/div><div class='connectorline-leftarrow' style='left:{{if ~_isMilestone()}}-6px;{{else}}0px;{{/if}}border-right: 10px solid "+i+";top:{{:-6-"+t+"}}px;border-bottom-width:{{:5+"+t+"}}px;border-top-width:{{:5+"+t+"}}px;width:0;height:0;position:relative'><\/div><\/div>{{/if}}";f+=s;f+="<\/div>";e={};e[this._id+"ConnectorLineTemplate"]=f;n.templates(e)},_isTaskMilestone:function(){return this.data.milestoneChild?!0:!1},_isMilestoneParent:function(){return this.data.milestoneParent?!0:!1},_getInnerChildWidthSSType2:function(){return this.data.ParentLeft+this.data.ParentWidth<this.data.ChildLeft?10:this.data.ParentLeft==this.data.ChildLeft?20:this.data.ParentLeft+this.data.ParentWidth>=this.data.ChildLeft?10:this.data.ChildLeft-this.data.ParentLeft},_getInnerElementLeftSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?this.data.ParentLeft-20:this.data.ParentLeft-10},_getInnerElementWidthSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?10:this.data.ChildLeft-this.data.ParentLeft},_getContainerWidthSSType2:function(){return this.data.ParentLeft==this.data.ChildLeft?20:this.data.ChildLeft-this.data.ParentLeft},_getPredecessorTop:function(){return this.data.ParentIndex>this.data.ChildIndex?!0:!1},_getParentPosition:function(){if(this.data.ParentIndex<this.data.ChildIndex){if(this.data.Type=="FF")return this.data.ChildLeft+this.data.ChildWidth>=this.data.ParentLeft+this.data.ParentWidth?"FFType2":"FFType1";if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft>this.data.ParentLeft+this.data.ParentWidth+25){if(this.data.Type=="FS")return"FSType1";if(this.data.Type=="SF")return"SFType1";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="FF")return"FFType2"}else if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft<this.data.ParentLeft+this.data.ParentWidth||this.data.ParentLeft==this.data.ChildLeft||this.data.ParentLeft>this.data.ChildLeft){if(this.data.ParentLeft>this.data.ChildLeft+this.data.ChildWidth+25&&this.data.Type=="SF")return"SFType2";if(this.data.ParentLeft>this.data.ChildLeft){if(this.data.Type=="SS")return"SSType1";if(this.data.Type=="SF")return"SFType1";if(this.data.Type=="FF")return"FFType1"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&this.data.Type=="FF")return"FFType2";if(this.data.Type=="FS")return"FSType2";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="FF")return"FFType1";if(this.data.Type=="SF")return"SFType1"}else if(this.data.ParentLeft<this.data.ChildLeft){if(this.data.Type=="FS")return"FSType2";if(this.data.Type=="FF")return"FFType2";if(this.data.Type=="SS")return"SSType2";if(this.data.Type=="SF")return"SFType1"}}else if(this.data.ParentIndex>this.data.ChildIndex)if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FS")return 30>=this.data.ChildLeft-(this.data.milestoneParent?this.data.ParentLeft+this.data.ParentWidth+4:this.data.ParentLeft+this.data.ParentWidth)?"FSType3":"FSType4";if(this.data.ParentLeft<this.data.ChildLeft||this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="SS")return"SSType4";if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&this.data.Type=="FF")return"FFType4"}else if(this.data.ParentLeft<this.data.ChildLeft&&this.data.ChildLeft<this.data.ParentLeft+this.data.ParentWidth||this.data.ParentLeft==this.data.ChildLeft||this.data.ParentLeft>this.data.ChildLeft){if(this.data.ChildLeft+this.data.ChildWidth<=this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FF")return"FFType3";if(this.data.Type=="SF")return this.data.ChildLeft+this.data.ChildWidth+25<this.data.ParentLeft?"SFType3":"SFType4";if(this.data.Type=="SS")return this.data.ChildLeft<=this.data.ParentLeft?"SSType3":"SSType4"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth){if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4";if(this.data.Type=="SS")return this.data.ChildLeft<=this.data.ParentLeft?"SSType3":"SSType4"}if(this.data.Type=="FS")return"FSType3"}else if(this.data.ParentLeft<this.data.ChildLeft){if(this.data.Type=="FS")return"FSType3";if(this.data.Type=="SS")return"SSType4";if(this.data.Type=="FF")return"FFType4";if(this.data.Type=="SF")return"SFType4"}return!1},_getWidth:function(){return this.data.ChildLeft+this.data.ChildWidth<this.data.ParentLeft+this.data.ParentWidth?this.data.ParentWidth:this.data.ChildWidth+this.data.ParentWidth},_renderWeekends:function(){for(var n=this,l=n.model,i=0,o=n.model.perDayWidth+1,r=n.model.updatedRecords.length*this.model.rowHeight,a=n.model.scheduleWeeks.length,s,h,u=t.buildTag("div.e-secondary_canvas","",{height:r+"px"},{}),f=l.scheduleHeaderSettings.weekStartDay,v=f>=0&&f<7?f:0,e=6-v,y=e+1==7?0:e+1,c=0;c<a;c++)s=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*y+"px",width:o+"px",height:r+"px","background-color":this.model.weekendBackground},{}),h=t.buildTag("div.e-weekends","",{left:i+n.model.perDayWidth*e+"px",width:o+"px",height:r+"px","background-color":this.model.weekendBackground},{}),u.append(s),u.append(h),i=i+this._scheduleWeekWidth;n._$weekendsContainer.html(u);n._$bodyContent.append(n._$weekendsContainer)},_renderStripLines:function(n){for(var u,h,r=this,f=r.model.updatedRecords.length*this.model.rowHeight,c=n.length,e,o,l=r.model.projectStartDate,a=this.model.perDayWidth,s=t.buildTag("div.e-stripLines","",{height:f+"px"},{}),i=0;i<c;i++)e=this._getDateFromFormat(n[i].day),o=(e-this._getDateFromFormat(l))/864e5*a,n[i].lineWidth=n[i].lineWidth>30?30:n[i].lineWidth,u=t.buildTag("div.e-stripline#stripline"+[i]+"","",{left:o+"px",width:"1px",height:f+"px","border-left-width":n[i].lineWidth+"px","border-left-color":n[i].lineColor,"border-left-style":n[i].lineStyle},{}),h=t.buildTag("span.e-striplinespan",n[i].label,{"background-color":n[i].lineColor},{}),n[i].day&&n[i].day.length>0&&(n[i].label&&n[i].label.length>0&&u.append(h),s.append(u));r._$stripLineContainer.append(s);r._$bodyContent.append(r._$stripLineContainer)},_getProgressWidth:function(n,t){return n*t/100},_getProgressPercent:function(n,t){return Math.ceil((t/n*100).toFixed(2))},_renderHoliday:function(n){var i=this,a=i.model.scheduleHeaderSettings.scheduleHeaderType,c=this._getDateFromFormat(n.day),v=i.model.scheduleWeeks.length,y=i.model.scheduleMonths.length,p=i.model.scheduleYears.length,w=i.model.scheduleDays.length,o=0,u,s,f,e,l=i.model.updatedRecords.length,h,r;o=(c-this._getDateFromFormat(i.model.projectStartDate))/864e5*this.model.perDayWidth;h=l*this.model.rowHeight;u=n.label!=null?n.label.length:0;n.background==null&&(n.background="white");r=".e-holiday-label";t.browserInfo().name=="msie"&&t.browserInfo().version<9&&(r=".e-holiday-label-ie8");s=i.model.scheduleHeaderSettings.scheduleHeaderType!="day"?t.buildTag("div"+r,n.label,{top:i._getHolidayLabelHeight(u)+"px"},{}):t.buildTag("div"+r,n.label,{bottom:i._getHolidayLabelHeight(u)+"px"},{});f=t.buildTag("div.e-secondary-canvas-holiday");e=t.buildTag("div.e-holidays","",{left:o+"px",width:i.model.perDayWidth+"px",height:h+"px","background-color":n.background},{});n.label!=null&&e.append(s);f.append(e);i._$secondaryCanvas.append(f);i._$bodyContent.append(i._$secondaryCanvas)},_getHolidayLabelHeight:function(){var n=this,r=n.model,t=n._getHeight(),i=r.updatedRecords.length*n.model.rowHeight;return t>0?t/2:n._viewportHeight<i?n._viewportHeight/2:i/2},_destroy:function(){var t=this;t.element.off();n(document.body).unbind("touchmove",n.proxy(t.handleMouseMove,t));n(document).unbind("mouseup",n.proxy(t._tooltipMouseup,t));n(document.body).bind("touchmove",n.proxy(t.handleMouseMove,t));t.element.empty().removeClass("e-ganttchart-core e-ganttchart"+t.model.cssClass)}});t.GanttChart.contextMenuItem={taskDetails:"Task Details....",add:"Add new task",indent:"Indent",outdent:"Outdent",Delete:"Delete"};jQuery.uaMatch=function(n){n=n.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||n.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];return{browser:t[1]||"",version:t[2]||"0"}}}(jQuery,Syncfusion),function(n,t){t.gridFeatures=t.gridFeatures||{};t.gridFeatures.gridResize=function(t){this.$headerTable=t.getHeaderTable();this.gridInstance=t;this._colMinWidth=15;this._$visualElement=n();this._currentCell=-1;this._allowStart=!1;this._oldWidth=null;this._orgX=null;this._orgY=null;this._extra=null;this._expand=!1;this._target=null;this._cellIndex=-1};t.gridFeatures.gridResize.prototype={_mouseHover:function(t){var r,h,o,c,s;if(!this._$visualElement.is(":visible")&&(this._allowStart=!1,n(t.target).is(".e-headercelldiv")&&(t.target=t.target.parentNode),r=n(t.target),n(t.target).hasClass("e-filtericon")&&(n(t.target).css("cursor")=="col-resize"||n(t.target).closest("tr").css("cursor")=="col-resize")&&(n(t.target).css("cursor","pointer"),n(t.target).closest("tr").css("cursor","pointer")),r.hasClass("e-headercell"))){var f=t.target,u=f.getBoundingClientRect(),i=0,e=0;(t.type="mousemove")?(i=t.clientX,e=t.clientY):(t.type="touchmove")?(i=evt.originalEvent.changedTouches[0].clientX,e=evt.originalEvent.changedTouches[0].clientY):(t.type="MSPointerMove")&&(i=t.originalEvent.clientX,e=t.originalEvent.clientY);h=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns?this.gridInstance.getHeaderContent().width()+this.gridInstance.element.children(".e-gridheader").find(".e-columnheader").offset().left:this.gridInstance.getHeaderTable().width()+this.gridInstance.element.children(".e-gridheader").find(".e-columnheader").offset().left;(i>=u.left+document.documentElement.scrollLeft+f.offsetWidth-5||i<=u.left+3)&&i<h&&i>=u.left&&e<=u.top+document.documentElement.scrollTop+t.target.offsetHeight?(o=i>u.left+3?n(t.target).find(".e-headercelldiv"):n(t.target).prevAll("th:visible:first").find(".e-headercelldiv"),c=window.pageXOffset||document.documentElement.scrollTop||document.body.scrollTop,s=this.gridInstance.element.find(".e-headercell").not(".e-detailheadercell").offset().left+10-c,(this.gridInstance.model.enableRTL&&i<=s||!this.gridInstance.model.enableRTL&&i>=s)&&((this.gridInstance.model.showStackedHeader||o.length)&&n.inArray(n(o).attr("ej-mappingname"),this.gridInstance._disabledResizingColumns)==-1?(this.gridInstance.model.showStackedHeader&&n(r.parents("thead")).find("tr").css("cursor","col-resize"),this.gridInstance.model.showStackedHeader||r.parent().css("cursor","col-resize"),this._currentCell=n(t.target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderContent().find(".e-headercell:visible").index(f):this.gridInstance.getHeaderContent().find(".e-headercell:visible").not(".e-stackedHeaderCell").index(f),this.gridInstance.model.enableRTL&&(this._currentCell=this._currentCell-1),this._allowStart=!0):(r.parent().css("cursor","pointer"),this._currentCell=-1))):(this.gridInstance.element.find(".e-columnheader").css("cursor","pointer"),this._currentCell=-1)}},_start:function(t,i){var o=this.gridInstance.getHeaderTable().find(".e-columnheader"),s,f,r,h,e,u;if(f=n(this._target).hasClass("e-stackedHeaderCell")?o.find(".e-headercell").not(".e-hide"):o.find(".e-headercell").not(".e-stackedHeaderCell,.e-hide"),this._currentCell!=-1&&this._currentCell<f.length&&(r=f[this._currentCell]),typeof r!="undefined")if(h=r.getBoundingClientRect(),s=this._tableY=h.top+parseInt(navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollTop:document.documentElement.scrollTop),this._allowStart){if(e=this._$visualElement=n(document.createElement("div")),_height=this.gridInstance.element.find(".e-gridcontent").first().height()+this.gridInstance.element.find(".e-gridheader").height(),this.gridInstance.model.showStackedHeader&&this.gridInstance.model.stackedHeaderRows.length>0){var c=this.gridInstance.getHeaderTable().find("tr.e-columnheader"),a=c.length,l=n(this._target).parent("tr")[0].rowIndex;for(u=0;u<l;u++)_height=_height-n(c[u]).height()}e.addClass("e-reSizeColbg").appendTo(this.gridInstance.element).attr("unselectable","on").css("visibility","hidden");this.gridInstance._resizeTimeOut=setTimeout(function(){e.css({visibility:"visible",height:_height+"px",cursor:"col-resize",left:t,top:s,position:"fixed"})},100);this._oldWidth=r.offsetWidth;this._orgX=t;this._orgY=i;this._extra=t-this._orgX;this._expand=!0}else this._currentCell=-1},_mouseMove:function(n){if(this._expand){var t=0,i=0;(n.type="mousemove")?(t=n.clientX,i=n.clientY):(n.type="touchmove")?(t=evt.originalEvent.changedTouches[0].clientX,i=evt.originalEvent.changedTouches[0].clientY):(n.type="MSPointerMove")&&(t=n.originalEvent.clientX,i=n.originalEvent.clientY);navigator.userAgent.indexOf("WebKit")!=-1&&(t=n.pageX,i=n.pageY);t+=document.documentElement.scrollLeft;n.preventDefault();this._moveVisual(t)}else this._mouseHover(n)},_getCellIndex:function(t){var o=n(t._target),i=t._target,f=i.getBoundingClientRect(),e=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft,r,u;return this._orgX<f.left+5+e&&(i=n(i).prevAll(":visible:first")[0]),r=i.cellIndex,u=r,t.gridInstance.model.groupSettings.groupedColumns.length&&(u=r-t.gridInstance.model.groupSettings.groupedColumns.length),u},_reSize:function(i){var ni=this,s,a,k,v,b,st,h,d,u,g,y,l,tt,w,e,et;if(this._initialTableWidth=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns?this.gridInstance.getHeaderTable().first().parent().width()+this.gridInstance.getHeaderTable().last().parent().width():this.gridInstance.getHeaderTable().parent().width(),this.gridInstance.model.enableRTL&&(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell=this._currentCell-1:this.gridInstance.model.enableRTL||this._getResizableCell(),a=this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns>0?this.gridInstance.getHeaderTable().find("thead"):n(this._target).parents("thead"),this._currentCell!=-1&&this._expand){this._expand=!1;var kt=n(this._target).hasClass("e-stackedHeaderCell")?a.find(".e-headercell:not(.e-detailheadercell)").filter(":visible"):a.find(".e-headercell:not(.e-detailheadercell,.e-stackedHeaderCell)").filter(":visible"),ot=kt[this._currentCell],c=ot.offsetWidth,r=i-this._orgX;if(this.gridInstance.model.enableRTL&&(r=-r),parseInt(r)+parseInt(c)>this._colMinWidth){if(r!=0&&a.css("cursor","default"),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"&&(k=this.gridInstance.getHeaderTable().find("colgroup").find("col"),t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),k=this.gridInstance._$headerCols),v=k.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length),b=v.width()),this._resizeColumnUsingDiff(c,r),s=this.gridInstance.element.find(".e-gridcontent").first(),st=s.find("div").hasClass("e-content"),h=!t.isIOSWebView()&&this.gridInstance.getBrowserDetails(),h&&h.browser=="msie"&&this.gridInstance.model.allowScrolling&&(d=this.gridInstance.getContentTable().width(),u=this.gridInstance._calculateWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns>0?(this.gridInstance.getHeaderTable().last().width(u-this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width()),this.gridInstance.getContentTable().last().width(u-this.gridInstance.getContent().find(".e-frozencontentdiv").width()),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().last().width(u-this.gridInstance.getFooterContent().find(".e-frozenfootertdiv").width())):u>d&&(this.gridInstance.getHeaderTable().width(u),this.gridInstance.getContentTable().width(u),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().width(u)),parseInt(h.version,10)>8&&this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length&&(u>d?(this.gridInstance.getContentTable().width(u),this.gridInstance.getContentTable().children("colgroup").find("col").first().css("width",2e3/s.find("table").first().width()+"%")):(this.gridInstance.getContentTable().css("width","100%"),this.gridInstance._groupingAction(!0),this.gridInstance.getContentTable().children("colgroup").find("col").first().css("width",(this.gridInstance.getHeaderTable().find("colgroup").find("col").first().width()/s.find("table").first().width()*100).toFixed(2)+"%"))),this.gridInstance.getHeaderTable().parent().scrollLeft(s.find(".e-content").scrollLeft()-1)),this.gridInstance._colgroupRefresh(),this.gridInstance.model.allowTextWrap&&this.gridInstance.rowHeightRefresh(),this.gridInstance.model.groupSettings.groupedColumns.length&&!this.gridInstance.model.isEdit&&this.gridInstance._recalculateIndentWidth(),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)!="normal")if(t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"){g=this.gridInstance.getHeaderTable().find("colgroup").find("col");y=this.gridInstance.getContentTable().find("colgroup").find("col");t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),g=this.gridInstance._$headerCols,y=this.gridInstance._$contentCols);var f=this._currentCell+1,ht=g.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)?f:f+this.gridInstance.model.groupSettings.groupedColumns.length),o=ht.width()+(b-v.width());if(o<this._colMinWidth&&(o=this._colMinWidth),ht.width(o),this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length){var ct=this.gridInstance.getContentTable().find(".e-recordtable"),p=ct.find("colgroup"),lt=this.gridInstance.getVisibleColumnNames().length;for(this.gridInstance.getContentTable().find(".e-detailrow").length&&(p=p.not(ct.find(".e-detailrow").find("colgroup")).get()),e=0;e<p.length;e++)l=n(p[e]).find("col").filter(this._diaplayFinder),l.length>lt&&l.splice(0,l.length-lt),n(l[f]).width(o)}if(this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns){if(f>=0&&f<this.gridInstance.model.scrollSettings.frozenColumns&&this._getFrozenResizeWidth()+r>this.gridInstance.element.find(".e-headercontent").first().width())return;$ContentCol=y.filter(this._diaplayFinder).eq(f)}else $ContentCol=y.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)?f:f+this.gridInstance.model.groupSettings.groupedColumns.length);if($ContentCol.width(o),this.gridInstance._findColumnsWidth(),this.gridInstance.model.scrollSettings.frozenColumns>0&&n(ot).is(":last-child")&&this.gridInstance.pluginName=="ejGrid"){var nt=v.width()-b,at=this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width()+nt,vt=this.gridInstance.getHeaderContent().find(".e-movableheaderdiv").width()-nt,yt=parseInt(this.gridInstance.getHeaderContent().find(".e-movableheader")[0].style["margin-left"])+nt;this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(at);this.gridInstance.getContent().find(".e-frozencontentdiv").width(at);this.gridInstance.getHeaderContent().find(".e-movableheaderdiv").width(vt);this.gridInstance.getContent().find(".e-movablecontentdiv").width(vt);this.gridInstance.getHeaderContent().find(".e-movableheader").css("margin-left",yt);this.gridInstance.getContent().find(".e-movablecontent").css("margin-left",yt)}this.gridInstance.model.scrollSettings.frozenColumns>0&&n(this._target).parent("tr").parents("div:first").hasClass("e-frozenheaderdiv")&&(this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(this._newWidth),this.gridInstance.getContent().find(".e-frozencontentdiv").width(this._newWidth))}else this.gridInstance.model.scrollSettings.frozenColumns||(tt=this.gridInstance.getHeaderTable().width(),this.gridInstance.getHeaderTable().css("width",tt+parseInt(r)),this.gridInstance.getContentTable().css("width",tt+parseInt(r)),this.gridInstance.model.scrollSettings.width+=parseInt(r),this.gridInstance.getContent().width()>this.gridInstance.getContentTable().width()?(this.gridInstance.getContentTable().addClass("e-tableLastCell"),this.gridInstance.getHeaderTable().addClass("e-tableLastCell")):(this.gridInstance.getContentTable().removeClass("e-tableLastCell"),this.gridInstance.getHeaderTable().removeClass("e-tableLastCell")));if(h.browser=="msie"||!h||!this.gridInstance.model.allowScrolling||this.gridInstance.model.scrollSettings.frozenColumns!=0||(this.gridInstance.getHeaderTable().width("100%"),this.gridInstance.getContentTable().width("100%"),w=this.gridInstance._calculateWidth(),(w<=this.gridInstance.getContentTable().width()||this.gridInstance.getHeaderTable().width()>this.gridInstance.getContentTable().width())&&(this.gridInstance.getHeaderTable().width(w),this.gridInstance.getContentTable().width(w))),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="default"){var pt=this._currentCell,it=n(this._target),wt=[],bt=[],o=c+r,rt={};if(this.gridInstance.model.showStackedHeader&&it.hasClass("e-stackedHeaderCell")){var dt=it.parent(".e-stackedHeaderRow").index(),gt=it.parent(".e-stackedHeaderRow").children()[this._cellIndex].cellIndex,ut=this.gridInstance.model.stackedHeaderRows[dt].stackedHeaderColumns[gt].column,ft=ut;for(ut instanceof Array||(ft=ut.split(",")),e=0;e<ft.length;e++)et=this.gridInstance.getColumnIndexByField(ft[e]),wt.push(et),bt.push(this.gridInstance.model.columns[et]);rt={columnIndex:wt,column:bt,oldWidth:c,newWidth:o}}else rt={columnIndex:pt,column:this.gridInstance.model.columns[pt],oldWidth:c,newWidth:o};this.gridInstance._trigger("resized",rt)}this.gridInstance.model.allowScrolling&&(this.gridInstance._scrollObject.refresh(this.gridInstance.model.scrollSettings.frozenColumns>0),this.gridInstance.model.isResponsive&&this.gridInstance.model.minWidth&&this.gridInstance.windowonresize(),!st&&s.find("div").hasClass("e-content")&&this.gridInstance.refreshScrollerEvent(),this.gridInstance._isHscrollcss())}}this._target=null;this._$visualElement.remove();this._expand=!1;this._currentCell=-1;this._allowStart=!1},_getFrozenResizeWidth:function(){for(var t=this.gridInstance.getHeaderTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings?this.gridInstance.model.scrollSettings.frozenColumns:0),i=0,n=0;n<t.length;n++)t.eq(n).css("display")!="none"&&(i+=parseInt(t[n].style.width.replace("px","")));return i},_diaplayFinder:function(){return n(this).css("display")!="none"},_resizeColumnUsingDiff:function(i,r){var vt=this,a,h,v,e,y,nt,r,c,p,o,w,b,tt,at,it,u,l,rt,st,ht,ct,k,f,ut;this._currntCe=this._currentCell;h=this.gridInstance.getHeaderTable().find("colgroup").find("col");v=this.gridInstance.getContentTable().find("colgroup").find("col");t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)||(this.gridInstance._detailColsRefresh(),h=this.gridInstance._$headerCols,v=this.gridInstance._$contentCols);var s=h.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length),d,ft,yt=h.slice(0,this.gridInstance.model.scrollSettings?this.gridInstance.model.scrollSettings.frozenColumns:0),g=s[0].style.width,et=g.indexOf("%")!=-1,ot=!g||et?n(this._target).outerWidth():g,lt=et?1:i/parseInt(ot);if(a=r=r/lt,e=this._newWidth=parseInt(r)+parseInt(ot),e>0&&r!=0){if(e<this._colMinWidth&&(e=this._colMinWidth),t.getObject("resizeSettings.resizeMode",this.gridInstance.model)=="nextcolumn"&&(y=s.next(),nt=this.gridInstance.model.scrollSettings.frozenColumns&&this._currentCell==this.gridInstance.model.scrollSettings.frozenColumns-1?!0:!1,nt&&(y=h.eq(this.gridInstance.model.scrollSettings.frozenColumns)),(nt||!s.is(":last-child"))&&y.width()+(s.width()-e)<=this._colMinWidth&&(e=s.width()+(y.width()-this._colMinWidth))),r=e-i,this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns){if(this._currentCell>=0&&this._currentCell<this.gridInstance.model.scrollSettings.frozenColumns&&this._getFrozenResizeWidth()+r>this.gridInstance.element.find(".e-headercontent").first().width())return;d=v.filter(this._diaplayFinder).eq(this._currentCell)}else d=v.filter(this._diaplayFinder).eq(!this.gridInstance.model.allowGrouping||!t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell:this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length);if(this.gridInstance.model.showSummary&&(this._$footerCols=this.gridInstance.getFooterTable().find("colgroup").find("col"),c=this.gridInstance.model.columns.length,this._$footerCols.length>c&&this._$footerCols.splice(0,this._$footerCols.length-c),$footerCols=this._$footerCols,ft=$footerCols.filter(this._diaplayFinder).eq(this._currentCell),ft.outerWidth(e)),n(this._target).parent("tr").hasClass("e-stackedHeaderRow")?this._resizeStackedHeaderColumn(n(this._target).parent("tr"),a,this._currntCe):s.outerWidth(e),n(this._target).parent("tr").hasClass("e-stackedHeaderRow")){if(this.gridInstance.model.groupSettings.groupedColumns.length)for(p=this.gridInstance.getContentTable().find(".e-recordtable"),o=p.find("colgroup"),u=0;u<this._changedcell.length;u++)for(w=this._changedcell[u],b=0;b<o.length;b++)tt=n(o[b]).children().filter(this._diaplayFinder),f=parseInt(a)+parseInt(tt[w].style.width),f<this._colMinWidth&&(f=this._colMinWidth),n(tt[w]).width(f);for(at=this.gridInstance.getContentTable().find("colgroup").find("col").filter(this._diaplayFinder).length,u=0;u<this._changedcell.length;u++)it=this.gridInstance.getContentTable().find("colgroup").find("col").filter(this._diaplayFinder)[this._changedcell[u]],f=parseInt(a)+parseInt(it.style.width),f<this._colMinWidth&&(f=this._colMinWidth),n(it).outerWidth(f),this.gridInstance.model.isEdit&&this.gridInstance.model.allowGrouping&&this.gridInstance.model.groupSettings.groupedColumns.length==0&&($sEditCol=this.gridInstance.getContentTable().find(".gridform").find("colgroup col").filter(this._diaplayFinder)[this._changedcell[u]],n($sEditCol).outerWidth(f))}else{if(this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length){var p=this.gridInstance.getContentTable().find(".e-recordtable"),o=p.find("colgroup"),w=this._currentCell,c=this.gridInstance.getVisibleColumnNames().length;for(this.gridInstance.getContentTable().find(".e-detailrow").length&&(o=o.not(p.find(".e-detailrow").find("colgroup")).get()),u=0;u<o.length;u++)l=n(o[u]).find("col").filter(this._diaplayFinder),l.length>c&&l.splice(0,l.length-c),n(l[w]).width(e)}d.outerWidth(e);this.gridInstance.model.isEdit&&(rt=this.gridInstance.getContentTable().find(".e-editedrow,.e-addedrow"),st=rt.find("table").find("colgroup col"),ht=rt.hasClass("e-addedrow")&&this.gridInstance.model.groupSettings.groupedColumns.length?this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length-1:this._currentCell,ct=st.filter(this._diaplayFinder).eq(ht),ct.outerWidth(e))}if(this.gridInstance._findColumnsWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns&&t.getObject("resizeSettings.resizeMode",this.gridInstance.model)!="nextcolumn"&&this.gridInstance.pluginName=="ejGrid"){for(k=this.gridInstance.getContentTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings.frozenColumns),f=0,u=0;u<k.length;u++)f+=k[u].style.display=="none"?0:parseInt(k[u].style.width.replace("px",""));this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(f);ut=this.gridInstance.model.enableRTL?"margin-right":"margin-left";this.gridInstance.getContent().find(".e-frozencontentdiv").width(f).next().css(ut,f+"px");this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width(f).next().css(ut,f+"px");this.gridInstance.model.showSummary&&this.gridInstance.getFooterContent().find(".e-frozenfooterdiv").width(f)}this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor","default")}},_resizeStackedHeaderColumn:function(t,i,r){var v,y,f,c,o;this._changedcell=[];var p=this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-detailheadercell"),u=0,e=0,s=p[r],l=n(s).attr("colspan"),w=i/l,a=n(s).parent("tr"),b=a.next(),h=s.cellIndex;for(this.gridInstance.model.groupSettings.showGroupedColumn&&(e=this.gridInstance.model.groupSettings.groupedColumns.length,u+=e);h>e;)h--,v=n(a).children("th").not(".e-detailheadercell")[h],u+=parseInt(n(v).attr("colspan"));for(this._currentCell=u,y=u+parseInt(l),f=u;f<y;f++)c=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder)[f],this._changedcell.push(f-e),o=parseInt(i)+parseInt(c.style.width),o<this._colMinWidth&&(o=this._colMinWidth),n(c).outerWidth(o)},_triggerResizeEvents:function(t,i){var y=this.gridInstance.getHeaderTable().find(".e-columnheader"),w=y.find(".e-headercell").filter(":visible"),e=this._cellIndex,r=n(this._target),h=[],o,u,s,a,f;if(col=[],t=="resizeStart"&&(this._orgX=i,e=this._cellIndex=this._getCellIndex(this,i)),o=w[this._currentCell],u=o.offsetWidth,this.gridInstance.model.showStackedHeader&&r.hasClass("e-stackedHeaderCell")){var b=r.parent(".e-stackedHeaderRow").index(),k=r.parent(".e-stackedHeaderRow").children()[this._cellIndex].cellIndex,c=this.gridInstance.model.stackedHeaderRows[b].stackedHeaderColumns[k].column,l=c;for(c instanceof Array||(l=c.split(",")),s=0;s<l.length;s++)a=this.gridInstance.getColumnIndexByField(l[s]),h.push(a),col.push(this.gridInstance.model.columns[a])}if(t=="resizeStart")return f={},f=this.gridInstance.model.showStackedHeader&&r.hasClass("e-stackedHeaderCell")?{columnIndex:h,column:col,target:r,oldWidth:u}:{columnIndex:e,column:this.gridInstance.model.columns[e],target:n(o),oldWidth:u},this.gridInstance._trigger("resizeStart",f);var d=y.find(".e-headercell").not(".e-detailheadercell").filter(":visible"),v=i-this._orgX,p=u+v;return this.gridInstance._colgroupRefresh(),f={},f=this.gridInstance.model.showStackedHeader&&r.hasClass("e-stackedHeaderCell")?{columnIndex:h,column:col,target:n(o),oldWidth:u,newWidth:p,extra:v}:{columnIndex:e,column:this.gridInstance.model.columns[e],target:n(o),oldWidth:u,newWidth:p,extra:v},this.gridInstance._trigger("resizeEnd",f)},_mouseUp:function(n){if(this.gridInstance._resizeTimeOut&&(clearTimeout(this.gridInstance._resizeTimeOut),this.gridInstance._resizeTimeOut=0),this._expand){var i=n.clientX,r=n.clientY;if(navigator.userAgent.indexOf("WebKit")!=-1&&(i=n.pageX,r=n.pageY),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="col-resize"&&this._triggerResizeEvents("resizeEnd",i)){this.gridInstance.element.find(".e-reSizeColbg").remove();return}i+=document.documentElement.scrollLeft;this._reSize(i,r);!t.isNullOrUndefined(this._currntCe)&&this._currntCe>=0&&(this.gridInstance.model.columns[this._currntCe].width=this.gridInstance.columnsWidthCollection[this._currntCe])}},_getResizableCell:function(){var r,i,u,t,f;if(r=n(this._target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderTable().find(".e-columnheader"):this.gridInstance.getHeaderTable().find(".e-columnheader").not(".e-stackedHeaderRow"),i=r.find(".e-headercell").not(".e-hide,.e-detailheadercell"),u=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft,!this.gridInstance.model.scrollSettings.frozenColumns||this._currentCell!=this.gridInstance.model.scrollSettings.frozenColumns-1)for(t=0;t<i.length;t++){if(point=i[t].getBoundingClientRect(),f=point.left+u+5,f>this._orgX&&n(i[t]).height()+point.top>=this._orgY){this._currentCell=t-1;return}if(t==i.length-1||this.gridInstance.model.showStackedHeader&&n(this._target).get(0)===i[t]){this._currentCell=t;return}}},_moveVisual:function(n){var t=this.gridInstance.getHeaderContent().find("div").first()[0].getBoundingClientRect();t.left+document.documentElement.scrollLeft+t.width<n||n<t.left+document.documentElement.scrollLeft?this._$visualElement.remove():this._currentCell!=-1&&this._$visualElement.css({left:n,top:this._tableY})},_mouseDown:function(t){var i,r,u;return this._allowStart&&n(t.target).closest("tr").css("cursor")=="col-resize"?(this._target=t.target,i=t.clientX,r=t.clientY,navigator.userAgent.indexOf("WebKit")!=-1&&(i=t.pageX,r=t.pageY-document.body.scrollTop),this.gridInstance.model.allowResizing&&this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")=="col-resize"&&(n(t.target).is(".e-headercelldiv")&&(t.target=t.target.parentNode),this._target=t.target,this._triggerResizeEvents("resizeStart",i)))?void 0:(u=this,i+=document.documentElement.scrollLeft,t.button!=2&&this._start(i,r),!1):!0},_columnResizeToFit:function(i){var lt=this.gridInstance.getHeaderTable().find(".e-columnheader").filter(function(){return n(this).css("cursor")=="col-resize"}),at,st,d,e,h,v,rt,ht,ct,ut,et,ft,ot,r;if(this.gridInstance.model.allowResizeToFit&&lt.length){n(i.target).is(".e-headercelldiv")&&(i.target=i.target.parentNode);var y=n(i.target),c,f=0,o=0;if(c=y.hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-detailheadercell"):this.gridInstance.getHeaderContent().find(".e-headercell").not(".e-stackedHeaderCell,.e-detailheadercell"),this._target=y,y.hasClass("e-headercell")){var b=i.target,p=n.inArray(b,c),w=p;this._orgX=i.pageX;this.gridInstance.model.enableRTL?this._currentCell=p:this._getResizableCell();p!=this._currentCell&&(p=w=this._currentCell,b=i.target.previousSibling);var l=c.filter(":visible")[w],s=[],a=[],k=[];if(o=this.gridInstance.model.groupSettings.groupedColumns.length,t.isNullOrUndefined(this.gridInstance.model.detailsTemplate)&&t.isNullOrUndefined(this.gridInstance.model.childGrid)||(o+=1),n(b).parent("tr").hasClass("e-stackedHeaderRow")){for(currentSpan=n(l).attr("colspan"),tr=n(l).parent("tr"),tHeadIndex=l.cellIndex,at=tr.next();tHeadIndex>o;)tHeadIndex--,st=n(tr).children("th")[tHeadIndex],f+=parseInt(n(st).attr("colspan"));d=f+parseInt(currentSpan)}else f=w,d=w+1;var u=0,g=0,nt=0,tt=[],it=[];if(f!=-1)for(e=c.slice(0,f+1).filter(".e-hide").length,h={columnIndex:f+e,column:this.gridInstance.model.columns[f+e],target:y,oldWidth:v},this.gridInstance._trigger("resizeStart",h),r=f;r<d;r++){if(e=c.slice(0,r+1).filter(".e-hide").length,nt=this._getContentWidth(r+e),$cellDiv=this.gridInstance.getHeaderTable().find(".e-headercell:not(.e-hide, .e-stackedHeaderCell)").children(".e-headercelldiv").eq(r),g=this._getHeaderContentWidth($cellDiv),u=g>nt?g:nt,u+=parseInt($cellDiv.css("padding-left"),10),v=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder).eq(r+o).width(),u=v>u?u:this._colMinWidth<u?u:this._colMinWidth,rt=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder),(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)&&rt.splice(0,1),rt.eq(r+o).width(u),this.gridInstance.model.groupSettings.groupedColumns.length&&(ht=this.gridInstance.getContentTable().find(".e-recordtable").find("colgroup"),ct=this,n.each(ht,function(t,i){n(i).find("col").filter(ct._diaplayFinder).eq(r).width(u)})),ut=this.gridInstance.getContentTable().find("col").filter(this._diaplayFinder),(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)&&ut.splice(0,1),ut.eq(r+o).width(u),this.gridInstance.model.isEdit)for(ft=this.gridInstance.getContentTable().find(".e-editedrow").find("col"),et=this.gridInstance.element.find(".gridform"),j=0;j<et.length;j++)ft=n(et[j]).find("col"),ft.eq(r+o).width(u);tt.push(this.gridInstance.model.columns[r+e]);it.push(Math.abs(u-v));s.push(r+e);a.push(u);k.push(v);(this.gridInstance.model.scrollSettings.frozenColumns>0||this.gridInstance.model.groupSettings.groupedColumns.length&&this.gridInstance.model.isEdit)&&(ot=r+e,this.gridInstance.columnsWidthCollection[ot]=u,this.gridInstance.setWidthToColumns(),this.gridInstance.model.scrollSettings.frozenColumns<=ot+1&&(this.gridInstance.getHeaderContent().find(".e-movableheader").css("margin-left",u),this.gridInstance.getContent().find(".e-movablecontent").css("margin-left",u)))}for(this.gridInstance._colgroupRefresh(),this.gridInstance._recalculateIndentWidth(),h={columnIndex:s,column:tt,target:l,oldWidth:k,newWidth:a,extra:it},this.gridInstance._trigger("resizeEnd",h),r=0;r<s.length;r++)this.gridInstance.columnsWidthCollection[s[r]]=a[r],this.gridInstance.model.columns[s[r]].width=a[r];h={columnIndex:s,column:tt,target:l,oldWidth:k,newWidth:a,extra:it};this.gridInstance._trigger("resized",h);this.gridInstance.model.summaryRows.length>0&&this.gridInstance._summaryColRrefresh();this.gridInstance._findColumnsWidth()}}},_getContentWidth:function(i){var e=0,r=t.buildTag("span",{},{}),u=this.gridInstance,o,f;return t.isNullOrUndefined(u._gridRows)||(f=u._gridRows,this.gridInstance.model.scrollSettings.frozenColumns&&i>=this.gridInstance.model.scrollSettings.frozenColumns&&(f=f[1],i=i-this.gridInstance.model.scrollSettings.frozenColumns),n.each(f,function(t,f){if(n(f).is(".e-row,.e-alt_row")&&!n(f).is(".e-editedrow")){var s=n(f).find("td.e-rowcell").eq(i),h=n(s).html();u.model.columns[i].commands?r.html(n(h).children()):s.hasClass("e-validError")?r.html(n(h).attr("value")):r.html(h);n(s).html(r);o=s.find("span:first").width();o>e&&(e=o);n(s).html(h)}})),u._refreshUnboundTemplate(this.gridInstance.getContentTable()),e},_getHeaderContentWidth:function(n){var i=0,r=t.buildTag("span",{},{}),u=n.html();return r.html(u),n.html(r),i=n.find("span:first").width(),(this.gridInstance.model.allowFiltering&&this.gridInstance.model.filterSettings.filterType=="menu"||this.gridInstance.model.filterSettings.filterType=="excel")&&(i=i+n.parent().find(".e-filtericon").width()+10),n.html(u),i}}}(jQuery,Syncfusion)});
  