| 1 |
- MWF.xDesktop.requireApp("Template","Explorer",null,false);MWF.xDesktop.requireApp("Attendance","Explorer",null,false);MWF.xDesktop.requireApp("Selector","package",null,false);MWF.xApplication.Attendance.ScheduleExplorer=new Class({Extends:MWF.xApplication.Attendance.Explorer,Implements:[Options,Events],initialize:function(e,t,i,l){this.setOptions(l);this.app=t;this.path="/x_component_Attendance/$ScheduleExplorer/";this.cssPath="/x_component_Attendance/$ScheduleExplorer/"+this.options.style+"/css.wcss";this._loadCss();this.actions=i;this.node=$(e);this.initData();if(!this.personActions)this.personActions=new MWF.xAction.org.express.RestActions},loadView:function(){this.view=new MWF.xApplication.Attendance.ScheduleExplorer.View(this.elementContentNode,this.app,this,this.viewData,this.options.searchKey);this.view.load();this.setContentSize()},createDocument:function(){if(this.view)this.view._createDocument()}});MWF.xApplication.Attendance.ScheduleExplorer.View=new Class({Extends:MWF.xApplication.Attendance.Explorer.View,_createItem:function(e){return new MWF.xApplication.Attendance.ScheduleExplorer.Document(this.table,e,this.explorer,this)},_getCurrentPageData:function(t,e){this.actions.listSchedule(function(e){if(t)t(e)})},_removeDocument:function(e,t){this.actions.deleteSchedule(e.id,function(e){this.explorer.view.reload();this.app.notice(this.app.lp.deleteDocumentOK,"success")}.bind(this))},_createDocument:function(){var e=new MWF.xApplication.Attendance.ScheduleExplorer.Schedule(this.explorer);e.create()},_openDocument:function(e){var t=new MWF.xApplication.Attendance.ScheduleExplorer.Schedule(this.explorer,e);t.edit()}});MWF.xApplication.Attendance.ScheduleExplorer.Document=new Class({Extends:MWF.xApplication.Attendance.Explorer.Document});MWF.xApplication.Attendance.ScheduleExplorer.Schedule=new Class({Extends:MWF.xApplication.Attendance.Explorer.PopupForm,options:{width:600,height:450,hasTop:true,hasBottom:true,title:"",draggable:true,closeAction:true},_createTableContent:function(){var e=this.app.lp.schedule;var t="<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+"<tr><td colspan='2' styles='formTableHead'>"+e.setSchedule+"</td></tr>"+"<tr><td styles='formTabelTitle' lable='unitName'></td>"+" <td styles='formTableValue' item='unitName'></td></tr>"+"<tr><td styles='formTabelTitle' lable='onDutyTime'></td>"+" <td styles='formTableValue' item='onDutyTime'></td></tr>"+"<tr><td styles='formTabelTitle' lable='offDutyTime'></td>"+" <td styles='formTableValue' item='offDutyTime'></td></tr>"+"<tr><td styles='formTabelTitle' lable='lateStartTime'></td>"+" <td styles='formTableValue' item='lateStartTime'></td></tr>"+"<tr><td styles='formTabelTitle' lable='leaveEarlyStartTime'></td>"+" <td styles='formTableValue' item='leaveEarlyStartTime'></td></tr>"+"<tr><td styles='formTabelTitle' lable='absenceStartTime'></td>"+" <td styles='formTableValue' item='absenceStartTime'></td></tr>"+"</table>";this.formTableArea.set("html",t);MWF.xDesktop.requireApp("Template","MForm",function(){this.form=new MForm(this.formTableArea,this.data,{isEdited:this.isEdited||this.isNew,itemTemplate:{unitName:{text:e.unit,type:"org",orgType:"unit"},onDutyTime:{text:e.workTime,tType:"time",notEmpty:true},offDutyTime:{text:e.offTime,tType:"time",notEmpty:true},lateStartTime:{text:e.lateTime,tType:"time",notEmpty:true},leaveEarlyTime:{text:e.leaveEarlyTime,tType:"time"},absenceStartTime:{text:e.absenteeismTime,tType:"time"}}},this.app);this.form.load()}.bind(this),true)},_ok:function(e,t){this.app.restActions.saveSchedule(e,function(e){if(t)t(e)}.bind(this))}});
|