Ext.define("optionsscheduleconfigreports.view.ScheduleConfig",{extend:"utilities.CustomGrid",requires:["Ext.ux.grid.FiltersFeature","Ext.ux.data.PagingMemoryProxy","utilities.CustomGrid"],alias:"widget.scheduleconfiggrid",id:"scheduleConfigGrid",ui:"newGridPanel withShade",border:true,screenLabels:null,dataArray:null,dummyArray:null,pageLimit:2,activePage:1,margin:10,viewConfig:{emptyText:'<table width="100%" border="0px" height="95%"><tr><td align="center" valign="middle"><div class="iconExclamation" ></div><div class="font_normal11">No records found<div></td></tr></table>'},initComponent:function(){var b={ftype:"filters",encode:false,local:true,filters:[{dataIndex:"scheduleName",type:"string"},{dataIndex:"reportName",type:"string"},{dataIndex:"mailFrequency",type:"string"},{dataIndex:"printFrequency",type:"string"},{dataIndex:"creationTime",type:"string"}]};
this.features=[b];this.selModel=new Ext.selection.CheckboxModel({checkOnly:true,headerWidth:26,injectCheckbox:"first",listeners:{selectionchange:function(){var d=Ext.getCmp("scheduleConfigGrid").getSelectionModel();var c=d.getSelection().length;if(c>0){Ext.getCmp("GroupItContainer").update('<div data-qtip="Combine schedules" data-qclass="yellowTip" id="circleId" class="scheduleCircle">'+c+'</div><div data-qtip="Combine schedules" data-qclass="yellowTip"  id="GroupIt" style="cursor:pointer;margin:2px 0px 0px 10px" class="iconReportNotBinded"></div>',true,true);
}else{if(c==0){Ext.getCmp("GroupItContainer").update('<div data-qtip="Combine schedules" data-qclass="yellowTip" id="GroupIt" style="cursor:pointer;margin:2px 0px 0px 10px" class="iconReportNotBinded"></div>',true,true);}}}}});this.dummyArray=this.dataArray.slice();this.store=Ext.create("Ext.data.Store",{fields:["sch_id","scheduleName","scheduleUrl","reportName","mailFrequency","printFrequency","creationTime","needToMerge"],proxy:{type:"pagingmemory",reader:{type:"json"}},pageSize:this.pageLimit,autoLoad:true,data:this.dataArray,id:"tmpStore"});
this.columns=[{dataIndex:"scheduleName",header:this.screenLabels["reporter.common.SCHEDULE NAME"],sortable:true,flex:1,renderer:function(i,d,h,k,f,j,c){var g=i;d.tdAttr='data-qclass=yellowTip data-qtip="'+g+'"';d.style="cursor: pointer;";var e=h.get("scheduleUrl");if(e.indexOf("ErScheduleBookletView.jsp")>-1){g='<table cellpadding="0" cellspacing="0" border="0"><tr><td class="font_normal11" style="padding-top:0px;">'+g+'</td><td style="float:left;margin-left:5px;margin-top:0px;" class="iconReportBinded"></td></tr></table>';
}return g;},listeners:{"click":function(d,f,h,i,c,g){var e=g.get("scheduleUrl");var k=appConstants.appObj.getController(appConstants.appController);e=e+"&com.eg.CSRF_NONCE="+csrfToken;console.log(e);if(e.indexOf("ErScheduleBookletView.jsp")>-1){e=e.substring(e.indexOf("?")+1,e.length);var l=e.split("&");
appConstants.scheduleBookletID=l[0].substring(l[0].indexOf("=")+1,l[0].length);appConstants.sbNme=l[1].substring(l[1].indexOf("=")+1,l[1].length);Ext.widget("customwindow");k.getCustomwindow().show();var j=Ext.getCmp("merge_type_pop");if(g.get("needToMerge")=="yes"||g.get("needToMerge")=="Yes"){j.setValue("yes");
}Ext.getCmp("windowInnerPanel").setTitle(g.data["scheduleName"]);windowRec=g;}else{window.location=e;}}}},{dataIndex:"reportName",header:this.screenLabels["reporter.common.REPORT TYPE"],flex:1,sortable:true,renderer:function(g,d,c,i,f,e,h){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");
}g=appConstants.erUtils.specialCharDecode(g);d.tdAttr='data-qclass=yellowTip data-qtip="'+g+'"';return g;}},{dataIndex:"mailFrequency",header:this.screenLabels["reporter.common.MAIL"],width:90,sortable:false,align:"center",renderer:function(g,d,c,i,f,e,h){d.tdAttr='data-qclass=yellowTip data-qtip="'+g+'"';
return g;}},{dataIndex:"printFrequency",header:this.screenLabels["reporter.common.PRINT"],width:90,sortable:false,align:"center",renderer:function(g,d,c,i,f,e,h){d.tdAttr='data-qclass=yellowTip data-qtip="'+g+'"';return g;}},{dataIndex:"creationTime",header:this.screenLabels["reporter.common.CREATION TIME"],width:150,sortable:false,align:"center",renderer:function(g,d,c,i,f,e,h){d.tdAttr='data-qclass=yellowTip data-qtip="'+g+'"';
return g;}},{header:'<div style="cursor:pointer" id="editSchedule" class="" data-qclass="yellowTip" data-qtip="Remove All"></div>',xtype:"actioncolumn",sortable:false,height:20,width:35,renderer:function(i,d,h,k,f,j,c){var g=i;var e=h.get("scheduleUrl");if(e.indexOf("ErScheduleBookletView.jsp")>-1){g='<div  data-qtip="Edit Booklet Schedule" data-qclass="yellowTip" style="cursor:pointer;" class="iconReportBinded"></div>';
}else{g='<div  data-qtip="Edit Schedule" data-qclass="yellowTip" style="cursor:pointer;" class="iconModify"></div>';}return g;},listeners:{"click":function(d,f,h,i,c,g){var e=g.get("scheduleUrl");var k=appConstants.appObj.getController(appConstants.appController);e=e+"&com.eg.CSRF_NONCE="+csrfToken;console.log(e);
if(e.indexOf("ErScheduleBookletView.jsp")>-1){e=e.substring(e.indexOf("?")+1,e.length);var l=e.split("&");appConstants.scheduleBookletID=l[0].substring(l[0].indexOf("=")+1,l[0].length);appConstants.sbNme=l[1].substring(l[1].indexOf("=")+1,l[1].length);Ext.widget("customwindow");k.getCustomwindow().show();
var j=Ext.getCmp("merge_type_pop");if(g.get("needToMerge")=="yes"||g.get("needToMerge")=="Yes"){j.setValue("yes");}Ext.getCmp("windowInnerPanel").setTitle(g.data["scheduleName"]);windowRec=g;}else{window.location=e;}}}},{header:'<div style="cursor:pointer" id="removeAll" class="iconDeleteAll" data-qclass="yellowTip" data-qtip="Remove All"></div>',xtype:"actioncolumn",sortable:false,height:20,width:35,dataIndex:"remove",renderer:function(g,d,c,i,f,e,h){d.tdAttr='data-qclass=yellowTip data-qtip="'+g+'"';
g='<div  data-qtip="Remove" data-qclass="yellowTip" style="cursor:pointer;position:relative;height:18px;margin: 0px auto;top:2px;" class="iconDelete"   ></div>';return g;},listeners:{"click":function(e,h,d,f,g,c){Ext.Msg.show({title:"Alert",msg:"Are you sure you want to remove the schedule?",buttons:Ext.Msg.YESNO,icon:Ext.Msg.QUESTION,fn:function(j){if(j=="yes"){var i="&mid="+encodeURIComponent(c.data.sch_id);
document.location="/final/servlet/com.eg.ErSchedulerC?fromNavLink="+fromNavLink+"&cmd=Delete&id="+encodeURIComponent(c.data.sch_id)+"&sch_name="+encodeURIComponent(c.data.scheduleName)+i;}}});}}}];var a=this;this.dockedItems=[{xtype:"pagingtoolbar",cls:"newPagination",dock:"bottom",displayInfo:true,id:"schedulePaging",name:"schedulePaging",pageSize:this.pageLimit,store:this.store,displayInfo:true,displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No topics to display",listeners:{change:function(c,d){if(!Ext.isEmpty(d)){a.activePage=d.currentPage;
}else{a.activePage=0;}}}},{xtype:"toolbar",cls:"toolbar",height:30,padding:"0 0 7 0",items:["->",{xtype:"container",html:'<div data-qtip="Combine schedules" data-qclass="yellowTip" id="GroupIt" style="cursor:pointer;margin-left:10px;margin-top:2px;" class="iconReportNotBinded"></div>',id:"GroupItContainer",listeners:{click:{element:"el",fn:function(){appConstants.appObj.getController(appConstants.appController).groupIt();
}}}},{xtype:"tbseparator",margin:"0 10 0 5",height:25},{xtype:"customtrigger",id:"livesearch",name:"livesearch",width:180,dock:"top",enableKeyEvents:true}]}];this.callParent();},listeners:{sortchange:function(c,d,f,b,a){this.getStore().loadPage(this.activePage);}}});