var tip;var j=0;Ext.define("MyDashBoard.view.KpiConfigListWidget",{extend:"Ext.container.Container",requires:["MyDashBoard.view.WidgetOptionsWindow"],alias:"widget.Kpiconfiglistwidget",flex:1,height:140,innerWidgetId:"",id:"Kpiconfiglistwidget",baseCls:"newLineRight kpiListing",isConfigured:false,chatTypeName:"",kpiBlckId:null,data:null,margin:0,padding:0,bodyPadding:0,header:{margin:"0 0 0 0"},overCls:"kpiListingOver",style:{"overflow":"initial"},defaultState:function(){var a=this;
a.removeCls("kpilistingOver");},layout:{type:"vbox",pack:"center",align:"center",},items:[],isExternalDataSourceWidget:false,listeners:{afterrender:function(i){var h=i.innerWidgetId;var f=i.kpiBlckId;var g=i.data;var b=i.isExternalDataSourceWidget;if(i.isConfigured==false){i.add({xtype:"button",region:"center",layout:{align:"center",pack:"center"},buttonAlign:"center",innerWidgetId:i.innerWidgetId,width:40,height:40,toggleGroup:true,enableToggle:true,showLoadingMsg:false,iconCls:"kpiWidgetAddIcon",style:{background:"none",border:"0px"},handler:function(m){if(!m.isPressed){if(tip){tip.destroy();
tip=null;}Ext.get(m.id).getXY();tip=window.Ext.create("Ext.tip.ToolTip",{target:m.id,cls:"kpi_toolBoxTip",id:"kpi_toolBox",bodyPadding:0,html:'<div style="float:left;width:131px;height:65px;"> <div class="kpiToolTip_LeftBox" onclick="loadConfigurationWindow('+f+","+h+","+b+',\'dialChart\')"><div  style="display:block;text-align:center;"><img src="/final/images/'+strSkin+'/guage.png" /><div class="newFont_normal11 kpiTooltipTextColor" style="position:relative;top:-4px;">Gauge</div></div></div> <div class="kpiToolTip_Seperator"></div> <div class="kpiToolTip_RightBox" onclick="loadConfigurationWindow('+f+","+h+","+b+',\'digitalChart\')"><div style="display:block;text-align:center;"><img src="/final/images/'+strSkin+'/digital.png" /><div class="newFont_normal11 kpiTooltipTextColor"  style="position:relative;top:-1px;">Digital</div></div></div> </div>',autoShow:true,autoScroll:true,dismissDelay:10000,focusOnToFront:true,autoHide:false,closable:false,autoHide:false,stateful:false,width:133,onDocMouseDown:function(p){var o=this;
if(o.autoHide!==true&&!o.closable&&!p.within(o.el.dom)){m.toggle(false,false);o.destroy();o=null;}},listeners:{hide:function(){tip.destroy();tip=null;},show:function(){}}});var l=Ext.get(m.id).getX();var n=Ext.getCmp("kpi_toolBox");if(l>1000){tip.showAt([Ext.get(m.id).getX()-140,Ext.get(m.id).getY()-((80/2)-28)]);
n.addClass("kpiRight");}else{tip.showAt([Ext.get(m.id).getX()+45,Ext.get(m.id).getY()-((80/2)-28)]);}}else{}}});}if(i.isConfigured==true){var e=this;var a=this.getWidth();var k=this.getHeight();var d=g.chartType;var c=Ext.getCmp("Kpiconfiglistwidget");i.add({xtype:"container",margin:"0 0 0 0",flex:1,padding:0,isConfigured:false,items:[{xtype:"portlet",width:180,height:140,id:d+"_"+h+"_previewImage",title:"",ui:"",flex:1,padding:0,bodyPadding:0,cls:"Kpiwidgets",style:{"overflow":"visible"},margin:"0 0 0 0",isChart:false,isTopNChart:false,showMoreDataOption:false,isPreviewMode:true,listeners:{afterrender:function(n){var m=Ext.create("Ext.Button",{icon:"../images/"+strSkin+"/kpiEdit.png",width:20,height:20,margin:0,padding:0,cls:"kpieditIcon",bodyStyle:{"background":"none"},style:{"position":"absolute","right":0,"bottom":0,"background":"none","border":"none"},renderTo:e.id,handler:function(){loadConfigurationWindow(f,h,b,d,"editWidget");
}});if(!Ext.isEmpty(g)){var l=g.chartType;Ext.defer(function(p){previewImageContainer=Ext.getCmp(l+"_"+h+"_previewImage");var o=g["useExternalData"];if(o!=null&&o=="yes"){myDashApp.getController("ExternalIntegrationController").showExternalDataForBlock(g,previewImageContainer,l+"_"+h+"_previewImage");
}else{myDashApp.getController("Main").showLiveDataForBlock(g,previewImageContainer,l+"_"+h+"_previewImage");}Ext.defer(function(r){var q=Ext.getCmp("kpiNumberSelection");if(!Ext.isEmpty(q)){q.setDisabled(false);}},2000);},600);}}},hideLoadingMask:function(){if(this.showLoadingMsg){this.disablePanelToolBar(false);
this.showLoadingMsg=false;this.setLoading(false);}},resizeChart:function(){},destoryChart:function(){var q=this;try{var t="ChartArea_"+q.id;var s=$("#"+t);if(!Ext.isEmpty(s)){var p=$("#"+t).find("div.highcharts-container");var l=$(p).parent().attr("id");var o=$("#"+l).highcharts();if(!Ext.isEmpty(o)){if(o){$("#"+l).highcharts().destroy();
}else{$(l).unbind();}$("#"+t>"svg").unbind();l=null;o=null;delete l;delete o;}Ext.getCmp(t).removeAll();for(var u in Ext.getCmp(t)){if(!Ext.getCmp(t)[u]){delete Ext.getCmp(t)[u];}}}else{var p=$("#"+q.id).find("div.highcharts-container");var r=Ext.getCmp(q.id);if(r.items.length!=0){if(r.down("grid")){Ext.destroy(r.down("grid").store);
}for(var n=0;n<r.items.length;n++){Ext.destroy(r.items[n]);}}if(!Ext.isEmpty(p)){l=$(p).parent().attr("id");o=$("#"+l).highcharts();if(o){$("#"+l).highcharts().destroy();}else{$(l).unbind();}$("#"+q.id>"svg").unbind();l=null;o=null;delete l;delete o;}r.removeAll();for(var u in Ext.getCmp(q.id)){if(!Ext.getCmp(q.id)[u]){delete Ext.getCmp(q.id)[u];
}}}}catch(m){console.log("error "+m);}}}]});}},}});function loadConfigurationWindow(i,k,a,g,b){var l=i;var n=g+"_"+k;var h=Ext.getCmp("kpi_toolBox");if(!Ext.isEmpty(h)){h.close();}if(Ext.isEmpty(b)){b="addWidget";}var m=Ext.getCmp("kpiConfigurationWindow");var d=Ext.getCmp("kpiNumberSelection");var f="";
if(!Ext.isEmpty(d)){f=d.getValue();}var c="";if(!Ext.isEmpty(m)&&m.hasOwnProperty("defaultArrayData")){c=m.defaultArrayData;m.close();}i=i.id;if(i==undefined||i==""||i==null){i=l;}var e=Ext.getCmp("widgetOptionsWindow");if(!Ext.isEmpty(e)){e.reLoadConfigurationWindow(g,n,k);}else{myDashApp.getController("WidgetConfigurationController").showWidgetOptionsWindow("btn",n,b,true,k,c,i,f,a);
}}