Ext.define("optionsscheduleviewreports.view.ScheduleView",{extend:"utilities.CustomGrid",requires:["Ext.ux.grid.FiltersFeature","Ext.ux.data.PagingMemoryProxy","utilities.CustomTrigger"],alias:"widget.scheduleviewgrid",id:"scheduleViewGrid",ui:"newGridPanel withShade",border:true,screenLabels:null,dataArray:null,pageLimit:2,activePage:1,flex:1,margin:10,padding:10,hideDateColumn:false,viewConfig:{emptyText:'<table width="100%"><tr><td align="center" valign="middle"><div class="iconExclamation" style="margin:18% auto 0% auto"></div><div style="font-size:12px">No records<div></td></tr></table>'},initComponent:function(){var b={ftype:"filters",encode:false,local:true,filters:[{dataIndex:"generationDate",type:"string"},{dataIndex:"scheduleName",type:"string"},{dataIndex:"reportName",type:"string"}]};
this.features=[b];this.selModel=new Ext.selection.CheckboxModel({checkOnly:true,headerWidth:26,injectCheckbox:"first"});this.store=Ext.create("Ext.data.Store",{fields:["sch_id","generationDate","scheduleName","reportName"],proxy:{type:"pagingmemory",reader:{type:"json"}},pageSize:this.pageLimit,autoLoad:true,data:this.dataArray,id:"tmpStore"});
this.columns=[{dataIndex:"generationDate",header:this.screenLabels["reporter.common.GENERATION DATE"],sortable:true,flex:0.5,hidden:this.hideDateColumn,renderer:function(i,d,h,k,f,j,c){var g=i;var e=h.get("scheduleUrl");if(!Ext.isEmpty(e)&&e!="-"){g='<a href="'+e+'">'+i+"</a>";}return g;}},{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;
var e=h.get("scheduleUrl");if(!Ext.isEmpty(e)&&e!="-"){g='<a href="'+e+'">'+i+"</a>";}return g;}},{dataIndex:"reportName",header:this.screenLabels["reporter.common.REPORT NAME"],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);return g;}},{sortable:false,menuDisabled:true,flex:0.1,xtype:"actioncolumn",align:"center",tooltip:"View",dataIndex:"",header:this.screenLabels["reporter.common.VIEW"],renderer:function(i,e,h,k,g,j,c){var d=h.get("sch_id");var f="../servlet/com.eg.ErSavedScheduleReportC?op=open&fileId="+h.get("sch_id");
if(d!=undefined&&(d.indexOf("CSV")!=-1||d.indexOf("XLS")!=-1||d.indexOf("XLSX")!=-1)){dispVal='<div data-qtip="view" data-qclass="yellowTip" style="cursor:pointer;position:relative;margin: 0px auto;" class="iconCSV" onclick="javascript:saveToPdf(\''+d+"');\" ></div>";}else{dispVal='<div data-qtip="view" data-qclass="yellowTip" style="cursor:pointer;position:relative;margin: 0px auto;" class="iconPdf" onclick="javascript:saveToPdf(\''+d+"');\" ></div>";
}return dispVal;}},{header:'<div style="cursor:pointer" class="iconDeleteAll2" data-qclass="yellowTip" data-qtip="Delete all Schedule Reports"></div>',xtype:"actioncolumn",height:20,width:35,sortable:false,menuDisabled:true,renderer:function(h,e,g,k,f,i,c){var d=g.get("sch_id");var j='<img src="/final/images/spacer.gif" class="iconDelete2" style="cursor:pointer" data-qtip="Delete Schedule Reports" data-qclass="yellowTip"  onclick="deleteScheduleReport(\''+d+"');\"/>";
return j;}}];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",items:[{xtype:"customtrigger",id:"livesearch",name:"livesearch",labelWidth:100,padding:"5 5 5 0",width:320,dock:"top",enableKeyEvents:true},"->",{xtype:"button",id:"DeleteAll",ui:"newButtonSmall",name:"DeleteAll",text:"Delete",style:{"text-align":"right"}}]}];
this.callParent();},listeners:{sortchange:function(c,d,f,b,a){this.getStore().loadPage(this.activePage);},}});