//>>built
define("dojox/gantt/contextMenuTab","./GanttTaskControl,dijit/Menu,dijit/Dialog,dijit/form/NumberSpinner,dijit/form/Button,dijit/form/CheckBox,dijit/form/DateTextBox,dijit/form/TimeTextBox,dijit/form/TextBox,dijit/form/Form,dijit/registry,dojo/_base/declare,dojo/_base/array,dojo/_base/lang,dojo/_base/html,dojo/date/locale,dojo/request,dojo/dom,dojo/dom-class,dojo/domReady!".split(","),function(j,r,l,k,s,t,m,u,n,v,o,p,q,g,w,x,y,z,f){return p("dojox.gantt.contextMenuTab",[],{constructor:function(a,
b,c,e,d,h){this.id=a;this.arrItems=[];this.TabItemContainer=null;this.Description=b;this.tabMenu=d;this.type=c;this.object=null;this.showObjectInfo=e;this.withDefaultValue=h},preValueValidation:function(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.required&&!c.control.textbox.value)return!1}return!0},encodeDate:function(a){return a.getFullYear()+"."+(a.getMonth()+1)+"."+a.getDate()},decodeDate:function(a){a=a.split(".");return 3>a.length?"":new Date(a[0],parseInt(a[1])-1,a[2])},renameTaskAction:function(){var a=
this.arrItems[0].control.textbox.value;!(0>=g.trim(a).length)&&this.preValueValidation(this.arrItems)&&(this.object.setName(a),this.hide())},deleteAction:function(){this.preValueValidation(this.arrItems)&&(this.object.project.deleteTask(this.object.taskItem.id),this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct())},durationUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setDuration(a)?
(this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.refresh()):alert("Duration out of Range"))},cpUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setPercentCompleted(a)?this.hide():alert("Complete Percentage out of Range"))},ownerUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setTaskOwner(a)?(this.hide(),this.tabMenu.ganttChart.resource&&
this.tabMenu.ganttChart.resource.reConstruct()):alert("Task owner not Valid"))},ptUpdateAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setPreviousTask(a)?this.hide():alert("Please verify the Previous Task ("+a+")  and adjust its Time Range"))},renameProjectAction:function(){var a=this.arrItems[0].control.textbox.value;!(0>=g.trim(a).length)&&this.preValueValidation(this.arrItems)&&(this.object.setName(a),this.hide())},deleteProjectAction:function(){this.preValueValidation(this.arrItems)&&
(this.object.ganttChart.deleteProject(this.object.project.id),this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct())},cpProjectAction:function(){var a=this.arrItems[0].control.textbox.value;this.preValueValidation(this.arrItems)&&(this.object.setPercentCompleted(a)?this.hide():alert("Percentage not Acceptable"))},addTaskAction:function(){if(this.preValueValidation(this.arrItems)){var a=this.arrItems[0].control.textbox.value,b=this.arrItems[1].control.textbox.value,
c=this.decodeDate(this.arrItems[2].control.textbox.value),e=this.arrItems[3].control.textbox.value,d=this.arrItems[4].control.textbox.value,h=this.arrItems[5].control.textbox.value,f=this.arrItems[6].control.textbox.value,i=this.arrItems[7].control.textbox.value;0>=g.trim(a).length||(this.object.insertTask(a,b,c,e,d,i,h,f)?(this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct()):alert("Please adjust your Customization"))}},addSuccessorTaskAction:function(){if(this.preValueValidation(this.arrItems)){var a=
this.object.project,b=this.arrItems[0].control.textbox.value,c=this.arrItems[1].control.textbox.value,e=this.decodeDate(this.arrItems[2].control.textbox.value),d=this.arrItems[3].control.textbox.value,h=this.arrItems[4].control.textbox.value,f=this.arrItems[5].control.textbox.value;0>=g.trim(b).length||(a.insertTask(b,c,e,d,h,this.object.taskItem.id,f,!this.object.parentTask?"":this.object.parentTask.taskItem.id)?(this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct()):
alert("Please adjust your Customization"))}},addChildTaskAction:function(){if(this.preValueValidation(this.arrItems)){var a=this.object.project,b=this.arrItems[0].control.textbox.value,c=this.arrItems[1].control.textbox.value,e=this.decodeDate(this.arrItems[2].control.textbox.value),d=this.arrItems[3].control.textbox.value,h=this.arrItems[4].control.textbox.value,f=this.arrItems[5].control.textbox.value,i=this.object.taskItem.id;0>=g.trim(b).length||(a.insertTask(b,c,e,d,h,"",f,i)?(this.hide(),this.tabMenu.ganttChart.resource&&
this.tabMenu.ganttChart.resource.reConstruct()):alert("Please adjust your Customization"))}},addProjectAction:function(){if(this.preValueValidation(this.arrItems)){var a=this.arrItems[0].control.textbox.value,b=this.arrItems[1].control.textbox.value,c=this.decodeDate(this.arrItems[2].control.textbox.value);0>=g.trim(a).length||0>=g.trim(b).length||(this.tabMenu.ganttChart.insertProject(a,b,c)?(this.hide(),this.tabMenu.ganttChart.resource&&this.tabMenu.ganttChart.resource.reConstruct()):alert("Please adjust your Customization"))}},
addAction:function(a){this.actionFunc=this[a]},addItem:function(a,b,c,e){var d;d="startTime"==c||"startDate"==c?new m({type:"text",constraints:{datePattern:"yyyy.M.d",strict:!0}}):"percentage"==c?new k({constraints:{max:100,min:0}}):"duration"==c?new k({constraints:{min:0}}):new n;this.arrItems.push({id:a,name:b,control:d,tab:this,key:c,required:e})},show:function(){this.tabMenu.tabPanelDlg=this.tabMenu.tabPanelDlg||o.byId(this.tabMenu.tabPanelDlgId)||new l({title:"Settings"});try{this.tabMenu.tabPanelDlg.show()}catch(a){return}this.tabMenu.tabPanelDlg.titleNode.innerHTML=
this.Description;var b=this.tabMenu.paneContentArea.firstChild.rows[1].cells[0].firstChild,c,e,d=null;this.showObjectInfo&&this.object&&(this.object.constructor==j?(this.insertData(b,"Id",this.object.taskItem.id),this.insertData(b,"Name",this.object.taskItem.name),this.insertData(b,"Start Time",this.encodeDate(this.object.taskItem.startTime)),this.insertData(b,"Duration (hours)",this.object.taskItem.duration+" hours"),this.insertData(b,"Percent Complete (%)",this.object.taskItem.percentage+"%"),this.insertData(b,
"Task Assignee",this.object.taskItem.taskOwner),this.insertData(b,"Previous Task Id",this.object.taskItem.previousTaskId)):(this.insertData(b,"Id",this.object.project.id),this.insertData(b,"Name",this.object.project.name),this.insertData(b,"Start date",this.encodeDate(this.object.project.startDate))));d=b.insertRow(b.rows.length);c=d.insertCell(d.cells.length);c.colSpan=2;c.innerHTML="<hr/>";d=b.insertRow(b.rows.length);c=d.insertCell(d.cells.length);c.colSpan=2;f.add(c,"ganttMenuDialogInputCellHeader");
c.innerHTML="Customization: "+this.Description;q.forEach(this.arrItems,function(a){d=b.insertRow(b.rows.length);c=d.insertCell(d.cells.length);f.add(c,"ganttMenuDialogInputCell");e=d.insertCell(d.cells.length);f.add(e,"ganttMenuDialogInputCellValue");c.innerHTML=a.name;e.appendChild(a.control.domNode);this.withDefaultValue&&this.object?a.control.textbox.value=this.object.constructor==j?"startTime"==a.key?this.encodeDate(this.object.taskItem.startTime):a.key?this.object.taskItem[a.key]:"":"startDate"==
a.key?this.encodeDate(this.object.project.startDate):a.key?this.object.project[a.key]||this.object[a.key]||"":"":a.control.textbox.placeholder=a.required?"---required---":"---optional---"},this);this.tabMenu.ok.onClick=g.hitch(this,this.actionFunc);this.tabMenu.cancel.onClick=g.hitch(this,this.hide)},hide:function(){try{this.tabMenu.tabPanelDlg.hide()}catch(a){this.tabMenu.tabPanelDlg.destroy()}var b=this.tabMenu.paneContentArea.firstChild.rows[1].cells[0];b.firstChild.parentNode.removeChild(b.firstChild);
b.innerHTML="<table></table>";f.add(b.firstChild,"ganttDialogContentCell")},insertData:function(a,b,c){var a=a.insertRow(a.rows.length),e=a.insertCell(a.cells.length);f.add(e,"ganttMenuDialogDescCell");e.innerHTML=b;b=a.insertCell(a.cells.length);f.add(b,"ganttMenuDialogDescCellValue");b.innerHTML=c}})});