//>>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(l,v,n,m,w,x,p,y,q,z,r,t,u,g,A,B,C,D,f){return t("dojox.gantt.contextMenuTab",[],{constructor:function(a,
b,d,e,c,g){this.id=a;this.arrItems=[];this.TabItemContainer=null;this.Description=b;this.tabMenu=c;this.type=d;this.object=null;this.showObjectInfo=e;this.withDefaultValue=g},preValueValidation:function(a){for(var b=0;b<a.length;b++){var d=a[b];if(d.required&&!d.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,
d=this.decodeDate(this.arrItems[2].control.textbox.value),e=this.arrItems[3].control.textbox.value,c=this.arrItems[4].control.textbox.value,f=this.arrItems[5].control.textbox.value,h=this.arrItems[6].control.textbox.value,k=this.arrItems[7].control.textbox.value;0>=g.trim(a).length||(this.object.insertTask(a,b,d,e,c,k,f,h)?(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,d=this.arrItems[1].control.textbox.value,e=this.decodeDate(this.arrItems[2].control.textbox.value),c=this.arrItems[3].control.textbox.value,f=this.arrItems[4].control.textbox.value,h=this.arrItems[5].control.textbox.value;0>=g.trim(b).length||(a.insertTask(b,d,e,c,f,this.object.taskItem.id,h,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,d=this.arrItems[1].control.textbox.value,e=this.decodeDate(this.arrItems[2].control.textbox.value),c=this.arrItems[3].control.textbox.value,f=this.arrItems[4].control.textbox.value,h=this.arrItems[5].control.textbox.value,k=this.object.taskItem.id;0>=g.trim(b).length||(a.insertTask(b,d,e,c,f,"",h,k)?(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,d=this.decodeDate(this.arrItems[2].control.textbox.value);0>=g.trim(a).length||0>=g.trim(b).length||(this.tabMenu.ganttChart.insertProject(a,b,d)?(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,d,e){var c;c="startTime"==d||"startDate"==d?new p({type:"text",constraints:{datePattern:"yyyy.M.d",strict:!0}}):"percentage"==d?new m({constraints:{max:100,min:0}}):"duration"==d?new m({constraints:{min:0}}):new q;this.arrItems.push({id:a,name:b,control:c,tab:this,key:d,required:e})},show:function(){this.tabMenu.tabPanelDlg=this.tabMenu.tabPanelDlg||r.byId(this.tabMenu.tabPanelDlgId)||new n({title:"Settings"});try{this.tabMenu.tabPanelDlg.show()}catch(c){console.log("dialog show exception: "+
c.message);return}this.tabMenu.tabPanelDlg.titleNode.innerHTML=this.Description;var a=this.tabMenu.paneContentArea.firstChild.rows[1].cells[0].firstChild,b,d,e=null;this.showObjectInfo&&this.object&&(this.object.constructor==l?(this.insertData(a,"Id",this.object.taskItem.id),this.insertData(a,"Name",this.object.taskItem.name),this.insertData(a,"Start Time",this.encodeDate(this.object.taskItem.startTime)),this.insertData(a,"Duration (hours)",this.object.taskItem.duration+" hours"),this.insertData(a,
"Percent Complete (%)",this.object.taskItem.percentage+"%"),this.insertData(a,"Task Assignee",this.object.taskItem.taskOwner),this.insertData(a,"Previous Task Id",this.object.taskItem.previousTaskId)):(this.insertData(a,"Id",this.object.project.id),this.insertData(a,"Name",this.object.project.name),this.insertData(a,"Start date",this.encodeDate(this.object.project.startDate))));e=a.insertRow(a.rows.length);b=e.insertCell(e.cells.length);b.colSpan=2;b.innerHTML="\x3chr/\x3e";e=a.insertRow(a.rows.length);
b=e.insertCell(e.cells.length);b.colSpan=2;f.add(b,"ganttMenuDialogInputCellHeader");b.innerHTML="Customization: "+this.Description;u.forEach(this.arrItems,function(c){e=a.insertRow(a.rows.length);b=e.insertCell(e.cells.length);f.add(b,"ganttMenuDialogInputCell");d=e.insertCell(e.cells.length);f.add(d,"ganttMenuDialogInputCellValue");b.innerHTML=c.name;d.appendChild(c.control.domNode);this.withDefaultValue&&this.object?c.control.textbox.value=this.object.constructor==l?"startTime"==c.key?this.encodeDate(this.object.taskItem.startTime):
c.key?this.object.taskItem[c.key]:"":"startDate"==c.key?this.encodeDate(this.object.project.startDate):c.key?this.object.project[c.key]||this.object[c.key]||"":"":c.control.textbox.placeholder=c.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(b){console.log("dialog show exception: "+b.message),this.tabMenu.tabPanelDlg.destroy()}var a=
this.tabMenu.paneContentArea.firstChild.rows[1].cells[0];a.firstChild.parentNode.removeChild(a.firstChild);a.innerHTML="\x3ctable\x3e\x3c/table\x3e";f.add(a.firstChild,"ganttDialogContentCell")},insertData:function(a,b,d){a=a.insertRow(a.rows.length);var 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=d}})});