Ext.define("thinclientapplicationreports.controller.ThinclientApplicationReports",{extend:"Ext.app.Controller",gridColStateParam:"ASC",gridColIndexParam:-1,views:["Main"],refs:[{selector:"main",ref:"main"},{selector:"newUtilities",ref:"newUtilities"},{selector:"thinclientapplicationform",ref:"thinclientapplicationform"},{selector:"egcomponent",ref:"egcomponent"},{selector:"geofilter",ref:"geofilter"},{selector:"mainform",ref:"mainform"},{selector:"ReporterSettings",ref:"ReporterSettings"},{selector:"thinclientapplicationsettings",ref:"thinclientapplicationsettings"},{selector:"nomeasurepanel",ref:"nomeasurepanel"},{selector:"backGroundPanel",ref:"backGroundPanel"}],init:function(){this.control({"main":{"boxready":this.afterMainRender},"mainform":{"afterrender":this.loadFormElements},"thinclientapplicationsettings":{"afterrender":this.loadSettingsElements},"newUtilities":{"afterrender":this.loadTools},"newUtilities > #printTool > button":{"click":this.printReport},"newUtilities > #saveTool > button":{"click":this.saveReportAsPDF},"newUtilities > #mailTool > button":{"click":this.sendMail},"newUtilities > #csvTool > button":{"click":this.saveCsv},"newUtilities > #favoriteTool > button":{"click":this.saveFavorite},"newUtilities > #scheduleTool > button":{"click":this.saveSchedule},'timeline combo[name="er_mode"]':{"select":this.changeEr_mode},'mainform combo[name="select_farm"]':{"select":this.zoneOnChange},'mainform combo[name="er_type"]':{"select":this.reportTypeOnChange},'mainform multiselect[name="er_server"]':{"change":this.serverOnChange},'mainform button[id="expandAppln"]':{"click":this.expandAppln},'mainform combo[name="er_compType"]':{"select":this.compTypeOnChange},'thinclientapplicationsettings combo[name="er_excwe"]':{"select":this.weekendOnChange},'mainform combo[name="er_timeline"]':{},'thinclientapplicationsettings combo[name="reportGeneration"]':{"select":this.reportGenChange},'thinclientapplicationsettings button[id="moreOptionCloseId"]':{"click":this.validateAndCloseSettings},'thinclientapplicationsettings button[id="submitViaSetting"]':{"click":this.closeSettingAndSubmit},'mainform button[name="submit"]':{"click":this.showResult},'mainform button[name="save"]':{"click":this.goTo},'mainform button[id="panelinsidetoggle"]':{"click":this.toggleForm},'mainform button[id="expandSelectorActivity"]':{"click":this.expandMe},'mainform trigger[id="compSearch"]':{"change":this.filterMultiselect},'mainform trigger[id="appSearch"]':{"change":this.filterMultiselect},'geofilter trigger[id="compSearch_geo"]':{"change":this.filterMultiselect},'geofilter button[id="expandSelectorActivity_geo"]':{"click":this.expandMeGeo},'mainform combo[id="er_option"]':{"select":this.onSelectAnalysisBy},'mainform combo[id="er_site"]':{"select":this.er_siteOnChange}});
},onSelectAnalysisBy:function(c){var b=c.getValue();var d="er_option="+b+"&er_type="+Ext.getCmp("er_type").getValue()+"&application_user_details_report=true";var a="/final/reporter/ErCtxApplicationReportJson.jsp";Ext.Ajax.request({url:a,params:d,method:"POST",success:function(g){var i=Ext.decode(g.responseText);
var h;if(b=="Zone"){Ext.getCmp("er_site").hide();h=Ext.getCmp("select_farm");h.getStore().loadRawData(i.zoneCombo);h.setValue(i.selectedZone);h.show();}else{if(b=="Component"){Ext.getCmp("select_farm").hide();Ext.getCmp("er_site").hide();}else{Ext.getCmp("select_farm").hide();h=Ext.getCmp("er_site");
h.getStore().loadRawData(i.siteCombo);h.setFieldLabel(i.siteComboLabel);h.setValue(i.selectedSiteCombo);h.show();}}h=Ext.getCmp("er_compType");h.getStore().loadRawData(i.componentTypeCombo);h.setValue(i.selectedComponentType);var f=Ext.getCmp("er_type").getValue();if(f=="Yes"){h=Ext.getCmp("select_testmes");
h.getStore().loadRawData(i.measureCombo);h.setValue(i.selectedMeasure);h.show();Ext.getCmp("egcomponent").hide();}else{Ext.getCmp("select_testmes").hide();h=Ext.getCmp("er_server");h.getStore().loadRawData(i.serverCombo);h.setValue(i.selectedServer);h=Ext.getCmp("er_application");h.getStore().loadRawData(i.applnCombo);
h.setValue(i.selectedAppln);Ext.getCmp("egcomponent").show();}}});},er_siteOnChange:function(b){var d=b.getValue();var c="er_option="+Ext.getCmp("er_option").getValue()+"&er_site="+d+"&er_type="+Ext.getCmp("er_type").getValue()+"&application_user_details_report=true";var a="/final/reporter/ErCtxApplicationReportJson.jsp";
Ext.Ajax.request({url:a,params:c,method:"POST",success:function(g){var i=Ext.decode(g.responseText);var h;h=Ext.getCmp("er_compType");h.getStore().loadRawData(i.componentTypeCombo);h.setValue(i.selectedComponentType);var f=Ext.getCmp("er_type").getValue();if(f=="Yes"){h=Ext.getCmp("select_testmes");h.getStore().loadRawData(i.measureCombo);
h.setValue(i.selectedMeasure);h.show();Ext.getCmp("egcomponent").hide();}else{Ext.getCmp("select_testmes").hide();h=Ext.getCmp("er_server");h.getStore().loadRawData(i.serverCombo);h.setValue(i.selectedServer);h=Ext.getCmp("er_application");h.getStore().loadRawData(i.applnCombo);h.setValue(i.selectedAppln);
Ext.getCmp("egcomponent").show();}}});},filterMultiselect:function(b){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}var a=b.getId();if(a=="compSearch"){compStore=appConstants.rawDataForComponents;compName="er_server";}else{if(a=="appSearch"){compStore=appConstants.rawDataForApplication;
compName="er_application";}else{if(a=="compSearch_geo"){compStore=appConstants.geoFilterCombo;compName="er_geoFilter";}}}b.toggleTriggger();appConstants.erUtils.filterComboStore(b,Ext.getCmp(compName),compStore);},changeEr_mode:function(c){var b="";var a="";a=appConstants.publicjsonDataDetails["hiddenfields"]["favorite_id"];
b=appConstants.publicjsonDataDetails["hiddenfields"]["fromScheduleModify"];if(!(a=="undefined"||a==undefined)||!(b==null||b=="null")){return;}Ext.get("configMod").animate({duration:250,to:{y:-530}});this.showResult();},goTo:function(a){appConstants.formButtonId=a.getId();var b="";b=appConstants.publicjsonDataDetails["hiddenfields"];
var c=b["fromScheduleModify"];if((c!=null&&c=="Yes")){this.saveSchedule();}else{this.saveFavorite();}},compTypeOnChange:function(){console.log("<<<< compTypeOnChange >>>>>>>>>");Ext.getCmp("resultPanel").hide();var a;var b=Ext.getCmp("er_option").getValue();var c="er_option="+b+"&er_compType="+Ext.getCmp("er_compType").getValue();
if(b=="Zone"){c+="&select_farm="+Ext.getCmp("select_farm").getValue();}else{c+="&er_site="+Ext.getCmp("er_site").getValue();}a="/final/reporter/ErCtxApplicationReportJson.jsp";c+="&er_type="+Ext.getCmp("er_type").getValue();Ext.Ajax.request({url:a,params:c,scope:this,method:"POST",success:function(f){var h=f.responseText;
var g=Ext.decode(h);appConstants.publicjsonDataDe=g;var d=Ext.getCmp("mainform").getForm();if(d.findField("er_type").getValue()=="No"){if(appConstants.publicjsonDataDe.hasOwnProperty("workerGroupCombo")){comboRawData=appConstants.publicjsonDataDe.workerGroupCombo;selectedComboOption=appConstants.publicjsonDataDe.selectedWorkergroup;
comboObject=d.findField("er_workgrpname");comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.resumeEvents();comboObject.show();}else{comboObject=d.findField("er_workgrpname");
comboObject.hide();}comboRawData=appConstants.publicjsonDataDe.serverCombo;selectedComboOption=appConstants.publicjsonDataDe.selectedServer;comboObject=Ext.getCmp("er_server");comboObject.getStore().loadRawData(comboRawData);appConstants.rawDataForComponents=comboRawData;if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);
}else{comboObject.setValue(comboRawData[0].valueField);}comboRawData=appConstants.publicjsonDataDe.applnCombo;selectedComboOption=appConstants.publicjsonDataDe.selectedAppln;comboObject=Ext.getCmp("er_application");appConstants.rawDataForApplication=comboRawData;comboObject.getStore().loadRawData(comboRawData);
if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}console.log("<< i am comp change >>");}else{if(appConstants.publicjsonDataDe.hasOwnProperty("workerGroupCombo")){comboRawData=appConstants.publicjsonDataDe.workerGroupCombo;
selectedComboOption=appConstants.publicjsonDataDe.selectedWorkergroup;comboObject=d.findField("er_workgrpname");comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.resumeEvents();
comboObject.show();}else{comboObject=d.findField("er_workgrpname");comboObject.hide();}comboRawData=appConstants.publicjsonDataDe.measureCombo;selectedComboOption=appConstants.publicjsonDataDe.selectedMeasure;comboObject=d.findField("select_testmes");comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);
}else{comboObject.setValue(comboRawData[0].valueField);}}}});},zoneOnChange:function(){console.log("<<<< zoneOnChange >>>>>>>>>");Ext.getCmp("resultPanel").hide();var b=Ext.getCmp("mainform").getForm();var c;var d=b.findField("select_farm").getValue();var a=b.findField("er_option").getValue();if(d!="-1"){if(b.findField("er_type").getValue()!=null){c="/final/reporter/ErCtxApplicationReportJson.jsp?select_farm="+d+"&er_type="+b.findField("er_type").getValue()+"&er_option="+a+"&application_user_details_report=true";
}else{return;}Ext.Ajax.request({url:c,scope:this,method:"GET",success:function(f){var j=f.responseText;var h=Ext.decode(j);appConstants.publicjsonDataDe=h;var g=appConstants.publicjsonDataDe.screenLabels;comboRawData=appConstants.publicjsonDataDe.componentTypeCombo;selectedComboOption=appConstants.publicjsonDataDe.selectedComponentType;
comboObject=b.findField("er_compType");comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}var i=b.findField("er_type").getValue();if(i=="No"){comboRawData=appConstants.publicjsonDataDe.serverCombo;
selectedComboOption=appConstants.publicjsonDataDe.selectedServer;comboObject=Ext.getCmp("er_server");var k=Ext.getCmp("multiSelectLabel");k.setText(g["reporter.common.Server"]);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);
}else{comboObject.setValue(comboRawData[0].valueField);}comboRawData=appConstants.publicjsonDataDe.applnCombo;selectedComboOption=appConstants.publicjsonDataDe.selectedAppln;comboObject=Ext.getCmp("er_application");appConstants.rawDataForApplication=comboRawData;comboObject.getStore().loadRawData(comboRawData);
if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}}}});}},serverOnChange:function(g,f,d){if(d==undefined||d=="undefined"){return;}var a=Ext.getCmp("mainform").getForm();var b=Ext.getCmp("er_server").getValue();if(a.findField("er_type").getValue()==null||a.findField("er_type").getValue()==undefined){return;
}if(b==null||b==""||b.length==0){return;}var c="/final/reporter/ErCtxApplicationReportJson.jsp?select_farm="+Ext.getCmp("select_farm").getValue()+"&er_type="+Ext.getCmp("er_type").getValue();this.servereOnChangeQueryString();Ext.Ajax.request({url:c,params:appConstants.queryString,scope:this,method:"POST",success:function(h){var j=h.responseText;
var i=Ext.decode(j);comboRawData=i.applnCombo;selectedComboOption=i.selectedAppln;comboObject=Ext.getCmp("er_application");appConstants.rawDataForApplication=comboRawData;comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);
}}});},reportTypeOnChange:function(){console.log("<<<< reportTypeOnChange >>>>>>>>>");Ext.getCmp("resultPanel").hide();var a=Ext.getCmp("mainform").getForm();var c=a.findField("er_type").getValue();var b="/final/reporter/ErCtxApplicationReportJson.jsp?&er_type="+a.findField("er_type").getValue()+"&er_compType="+a.findField("er_compType").getValue();
var d=a.findField("er_option").getValue();b+="&er_option="+d;if(d=="Zone"){b+="&select_farm="+a.findField("select_farm").getValue();}else{b+="&er_site="+a.findField("er_site").getValue();}Ext.Ajax.request({url:b,scope:this,method:"GET",success:function(f){var h=f.responseText;var g=Ext.decode(h);var j=g.screenLabels;
appConstants.publicjsonDataDetails=g;if(c=="No"){a.findField("select_testmes").hide();a.findField("er_mode").hide();if(g.hasOwnProperty("componentTypeCombo")){comboRawData=g.componentTypeCombo;selectedComboOption=g.selectedComponentType;comboObject=a.findField("er_compType");comboObject.setFieldLabel(j["reporter.common.Component Type"]);
comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();}if(g.hasOwnProperty("workerGroupCombo")){comboRawData=g.workerGroupCombo;selectedComboOption=g.selectedWorkergroup;
comboObject=a.findField("er_workgrpname");comboObject.setFieldLabel(j["reporter.thin.Worker Group"]);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();
}else{a.findField("er_workgrpname").hide();}comboRawData=g.serverCombo;selectedComboOption=g.selectedServer;comboObject=Ext.getCmp("er_server");var i=Ext.getCmp("multiSelectLabel");i.setText(j["reporter.common.Server"]);appConstants.rawDataForComponents=comboRawData;comboObject.getStore().loadRawData(comboRawData);
if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboRawData=g.applnCombo;selectedComboOption=g.selectedAppln;comboObject=Ext.getCmp("er_application");appConstants.rawDataForApplication=comboRawData;comboObject.getStore().loadRawData(comboRawData);
if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();Ext.getCmp("egcomponent").show();}else{if(g.hasOwnProperty("componentTypeCombo")){comboRawData=g.componentTypeCombo;selectedComboOption=g.selectedComponentType;
comboObject=a.findField("er_compType");comboObject.setFieldLabel(j["reporter.common.Component Type"]);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();
}if(g.hasOwnProperty("workerGroupCombo")){comboRawData=g.workerGroupCombo;selectedComboOption=g.selectedWorkergroup;comboObject=a.findField("er_workgrpname");comboObject.setFieldLabel(j["reporter.thin.Worker Group"]);comboObject.getStore().loadRawData(comboRawData);if(!Ext.isEmpty(selectedComboOption)){comboObject.setValue(selectedComboOption);
}else{comboObject.setValue(comboRawData[0].valueField);}comboObject.show();}else{a.findField("er_workgrpname").hide();}Ext.getCmp("egcomponent").hide();a.findField("er_mode").hide();a.findField("select_testmes").show();}}});},LoadFieldsForActivity:function(){console.log("<<<<<<<< LoadFieldsForActivity >>>>>>>>>>>>>>");
var b="/final/reporter/ErCtxApplicationReportJson.jsp";var a=Ext.getCmp("mainform").getForm();Ext.Ajax.request({url:b,scope:this,method:"POST",success:function(c){var f=c.responseText;var d=Ext.decode(f);appConstants.publicjsonDataDetails=d;this.getMain().setTitle(d.reportTitle);this.fillFormFieldsForActivity(d);
a.findField("er_type").show();a.findField("select_testmes").show();a.findField("er_mode").show();if(Ext.getCmp("er_excwe")!=undefined){Ext.getCmp("er_excwe").show();}a.findField("er_type").setValue("Yes");a.findField("er_compType").show();if(d.hasOwnProperty("workerGroupCombo")){a.findField("er_workgrpname").show();
}else{a.findField("er_workgrpname").hide();}}});},saveReportAsPDF:function(){var c;c=appConstants.publicjsonDataDetails.saveQString;c+="&printGraph=yes&opt=chart";if(appConstants.publicjsonDataDetails.selectedreportType=="No"){c+="&pageWidthProces=1024&er_view=PRINT";}var b="../reporter/ErHtmlToSavePdf.jsp?"+c;
var a=false;if(Ext.getCmp("showLegend")!=undefined){var a=Ext.getCmp("showLegend").getValue();if(a!=null&&a!=undefined&&a!="undefined"){var d="&showLegend="+a;if(b.indexOf(d)==-1){if(b.indexOf("&showLegend=")>-1){if(a.toString()=="true"){b=b.replace("&showLegend=false",d);}else{b=b.replace("&showLegend=true",d);
}}else{b+=d;}}}}if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}b=this.getGridColSortParam(b);appConstants.erUtils.savePDF(b);},getGridColSortParam:function(d){var a=d.indexOf("er_sortby");if(a>-1){var c;var b=d.substring(a+10,a+12);if(b=="-1"){c="er_sortby="+b;}else{c="er_sortby="+parseInt(b);
}d=d.replace(c,"er_sortby="+this.gridColIndexParam);}else{d+="&er_sortby="+this.gridColIndexParam;}if(this.gridColStateParam=="ASC"){this.gridColStateParam="1";}else{this.gridColStateParam="0";}return d+"&orderBy="+this.gridColStateParam;},printReport:function(){var a;var b=appConstants.publicjsonDataDetails.saveQString;
a="../servlet/com.eg.ErCtxServerReportC?"+b+"printGraph=yes&pdfPrint=yes";if(appConstants.publicjsonDataDetails.selectedreportType=="No"){a+="&er_view=PRINT";}console.log("s_qryString:print:>>>"+a);parent.printWindowFn(a);},sendMail:function(){var b=Ext.getCmp("showLegend").getValue();if(b!=null&&b!=undefined&&b!="undefined"){drillDownParams="&showLegend="+b;
}var a=Ext.widget("sendmail");a.show();},saveCsv:function(){window.location="../servlet/egurkha.reporter.SaveInCSVFormat";},saveSchedule:function(){var a=Ext.getCmp("mainform").getForm();var f=this.validateMainForm(false);if(f&&a.findField("er_timeline").getValue()=="Any"){Ext.MessageBox.show({title:"Operation Reports",msg:"Chosen timeline not allowed",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
f=false;}if(f){var b;this.updateQueryString();var c=a.findField("er_type").getValue();if(c=="Yes"){b="/final/reporter/ErSaveSchedule.jsp?"+appConstants.queryString;b+="&er_server=-1&er_application=-1&er_sortby=-1&showTopusers="+appConstants.publicjsonDataDetails.showTopusers;}else{b="/final/reporter/ErSaveSchedule.jsp?"+appConstants.queryString+"&showTopusers="+appConstants.publicjsonDataDetails.showTopusers;
}var d=b+"&com.eg.CSRF_NONCE="+csrfToken;console.log("schedule::>>"+d);if(appConstants.formButtonId=="save"){document.location=d+"&showSchWindow=no";}else{parent.scheduleWindowFn(d);}}else{return;}},saveFavorite:function(){var f=this.validateMainForm(false);var a=Ext.getCmp("mainform").getForm();if(f){var b;
this.updateQueryString();var c=a.findField("er_type").getValue();if(c=="Yes"){b="/final/reporter/ErSaveFavorite.jsp?"+appConstants.queryString+"&er_sortby=-1&er_server=-1&er_application=-1&cmd=client";}else{b="/final/reporter/ErSaveFavorite.jsp?"+appConstants.queryString+"&cmd=client";}var d=b+"&er_RmDispName="+appConstants.er_RmDispName+"&com.eg.CSRF_NONCE="+csrfToken;
if(appConstants.formButtonId=="save"){document.location=d+"&showWindow=no"+"&FavoriteId="+appConstants.favorite_id;}else{parent.favouriteWindowFn(d);}}else{return;}},validateMainForm:function(s){var r=Ext.getCmp("mainform").getForm();var a=null;if(isSettingsEnabled){a=this.getThinclientapplicationsettings().getForm();
}var z=r.findField("er_type").getValue();if(z=="No"){var q=r.findField("er_server");var i=r.findField("er_application");if(q.getValue()=="-1"){Ext.MessageBox.show({title:"Thin Client Application",msg:q.getStore().getAt(0).get("displayField"),buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;
}var b=i.getStore().getAt(0).get("displayField");if(b=="Not Applicable"){Ext.MessageBox.show({title:"Thin Client Application",msg:b,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}}var d;d=appConstants.publicjsonDataDetails;var u=true;var l=d["hiddenfields"];var p=l["getMaxDaysInMonth"];
var v=this.getSettingsFieldValue(a,"reportGeneration",isSettingsEnabled,"reportGeneration");var A="";if(!Ext.isEmpty(l["userTimeline"])){A=l["userTimeline"];}var o=r.findField("er_timeline").getValue();var w=r.findField("er_stdate").getValue();var j=r.findField("er_enddate").getValue();var n=r.findField("er_sthr").getValue();
var c=r.findField("er_endhr").getValue();w.setHours(n);j.setHours(c);var m=this.getSettingsFieldValue(a,"timefrom",isSettingsEnabled,"selectedTimeFrom");var y=this.getSettingsFieldValue(a,"minfrom",isSettingsEnabled,"selectedMinsFrom");var h=this.getSettingsFieldValue(a,"timeto",isSettingsEnabled,"selectedTimeTo");
var x=this.getSettingsFieldValue(a,"minto",isSettingsEnabled,"selectedMinsTo");if(!checkTimePeriod(m,y,h,x)){u=false;}if(!checkDateTime(w,j)){u=false;}if(A!=null&&A!="-1"){var k=isUserTimelineLimitExceeded(A,p,w,j);if(!k){Ext.MessageBox.show({title:"Thin Client Application settings",msg:appConstants.userTimelineErrorMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
u=false;}}if(v!=null&&v=="foreground"){var g=l["limitforbg"];if(!Ext.isEmpty(g)){if(s){if(!checkTimeLineForBgLimit(g,p,w,j)){Ext.MessageBox.confirm("Confirm",appConstants.forGrdReportConfirmMsg,this.showConfirmResult,this);u=false;}}}}else{var t=a.findField("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(t,"Attachment",true)){u=false;
}}if(u){var f=Ext.getCmp("submit");f.setDisabled(false);return true;}else{return false;}},toggleForm:function(b){Ext.getCmp("panelinsidetoggle").show();var a=Ext.getCmp("mainform");if(a.isHidden()){a.show();Ext.getCmp("selectionDetails").hide();}else{a.hide();Ext.getCmp("selectionDetails").show();}},showResult:function(){var h=Ext.getCmp("resultPanel");
h.removeAll();var c=Ext.getCmp("mainform").getForm();var f=c.findField("er_stdate").getValue();var g=c.findField("er_sthr").getValue();f.setHours(g);var b=c.findField("er_enddate").getValue();var d=c.findField("er_endhr").getValue();b.setHours(d);var a=checkDateTime(f,b);if(!a){return;}var i=this.validateMainForm(true);
if(i){this.submitReport();}},validateSettings:function(){var a=true;var c=Ext.getCmp("reportGeneration").getValue();if(c!=null&&c=="background"){var f=Ext.getCmp("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(f,"Attachment",true)){a=false;}}else{if(c!=null&&c=="background-csv"){var f=Ext.getCmp("bgReportName").getValue();
if(!validateTextBoxWithSpecialChars(f,"Attachment",true)){a=false;}}}var d=Ext.getCmp("geofilter");if(d!=undefined&&!d.isHidden()){var b=Ext.getCmp("er_geoFilter").getValue();if(b==undefined||b.length==0){Ext.MessageBox.show({title:"Thin Client Application",msg:"Please choose "+Ext.getCmp("multiSelectLabel_geo").text,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
a=false;}else{if(b.length>1&&b.indexOf("all")>-1){Ext.MessageBox.show({title:"Thin Client Application",msg:"All and Individual selection should not be allowed",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});a=false;}}}return a;},showConfirmResult:function(d){if(d=="yes"){var b=Ext.getCmp("submit");
this.submitReport();}else{this.getReporterSettings().down("button").fireHandler();var c=this.getThinclientapplicationsettings().getForm();var a=c.findField("reportGeneration");var f=c.findField("bgReportName");a.setValue("background");f.setValue("");f.show();f.focus(false,1000);Ext.getCmp("submitViaSetting").show();
Ext.getCmp("moreOptionCloseId").hide();this.showResult();}},getXmlForUrl:function(b){try{var a;Ext.Ajax.request({url:b,method:"GET",async:false,success:function(d){var f=d.responseText;a=Ext.decode(f);},failure:function(){alert("I am not loading..."+b);}});return a;}catch(c){alert("[Exception] "+c);}},loadGrid:function(a){console.log("<<< i am load grid >>>>");
var C=Ext.getCmp("resultPanel");var s=Ext.getCmp("mainform").getForm();var G=new Array();var q=this;if(!Ext.isEmpty(a)){var p=null;if(isSettingsEnabled){p=q.getThinclientapplicationsettings().getForm();}for(var N in a){var m=a[N];var w=m.columns;var I=m.dataArray;var g=m.geoDataArray;var o=m.geoColumns;
var O=m.TOTAL_COLUMN_COUNT;var B={};var u=0;var P=new Array();var z=m.tableJson;if(z==undefined||z.length==0){for(var r in w){var K=r;var M="center";if(r=="Application"){M="left";}if(r=="Component"){M="left";}if(r=="User Name(s)"){M="left";}var H=1;B[u]=K;P.push({header:K,sortable:true,dataIndex:u,align:M,flex:H,renderer:function(T,S,i,U,R,Q){T=Ext.getCmp("gridId").getDecimalAlignFormat(T);
return'<div style="white-space:normal !important;">'+T+"</div>";},doSort:function(Q){var i=this.up("grid").store;var R=this.getSortParam();i.sort({property:R,direction:Q,sorterFn:function(T,S){T=T.get(R);S=S.get(R);T=Ext.isNumber(T)?T:parseFloat(String(T),10);T=isNaN(T)?0:T;S=Ext.isNumber(S)?S:parseFloat(String(S),10);
S=isNaN(S)?0:S;return T>S?1:(T<S?-1:0);}});},});u++;}var y=function(){this.data=null;this.total=0;};var v;if(I.length<gridPageSize){v=true;}else{v=false;}var b=[];var j=Object.keys(I[0]).length;if(g!=undefined&&g.length>0){var n="<thead><tr>";for(var r in o){n+='<th style="font-size:10px;border-bottom-width:1px;text-transform:capitalize;">'+o[r]+"</th>";
}n+="</tr></thead>";for(var r in g){var c='<div width="100%" align="center" class="plainTableReporter"><table width="100%" cellpadding="0" cellspacing="0" border="0px">';var f=g[r];c+=n;c+="<tbody>";for(var x in f){c+="<tr>";for(var F in o){c+='<td style="font-size:10px;">'+f[x][o[F]]+"</td>";}c+="</tr>";
}c+="</tbody>";c+="</table>";c+="</div>";I[r].app=c;}}for(var r in I[0]){b.push(r);}var D=Ext.create("Ext.data.Store",{fields:b,dataArraytoStore:I,proxy:{type:"pagingmemory",data:I,reader:{type:"json",root:"data",totalProperty:"total"},},pageSize:gridPageSize,autoLoad:true,listeners:{beforeload:function(S,R,T){var V=R.page;
var Q=R.limit;var U=this.dataArraytoStore.length;var W=(V-1)*Q;var i=V*Q;y.data=I;y.total=U;S.proxy.data=y;}}});var d;var E;var L=1;var k=Ext.create("Ext.grid.feature.Grouping",{groupHeaderTpl:'{application} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})'});G.push({xtype:"panel",ui:"newGraphPanel",margin:"5 10 10 10",items:[{xtype:"customgrid",store:D,id:"gridId",sortableColumns:true,columns:P,ui:"newGridPanel",margin:"10 10 10 10",scroll:true,features:[k],autoScroll:true,border:true,popUpData:"no",listeners:{sortchange:function(R,S,T,Q,i){q.gridColIndexParam=S.getIndex();
q.gridColStateParam=S.sortState;this.getStore().load();}},plugins:[{ptype:"rowexpander",selectRowOnExpand:true,expandOnDblClick:false,expandOnEnter:false,collapsible:true,animCollapse:false,rowBodyTpl:['<div style="padding:10px 10px 10px 0px;display:inline-block;position:relative;width:100%">{app}</div>',]}],viewConfig:{stripeRows:true,getRowClass:function(i,S,R,Q){if(i.data.app!=undefined&&i.data.app.length>0){return;
}else{return"hidePlus";}}},dockedItems:[{xtype:"pagingtoolbar",cls:"newPagination",dock:"bottom",displayInfo:true,store:D,hidden:v,displayInfo:true,displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No topics to display",listeners:{change:function(i,Q){d=Q.pageCount;E=Q.total;L=Q.currentPage;}}}]}]});
}else{var t=Ext.define("checkBoxDataModel",{extend:"Ext.data.Model",fields:[{name:"tableTitle",type:"string"},{name:"measureColumn",type:"auto"},{name:"measureTable",type:"auto"}]});var A=5;var J=new Ext.data.Store({fields:[{name:"tableTitle",type:"string"},{name:"measureColumn",type:"array"},{name:"measureTable",type:"array"}],proxy:{type:"pagingmemory",reader:{type:"json",root:"data",totalProperty:"total"}},pageSize:A,data:z,autoLoad:true,});
var h=true;if(z.length>A){h=false;}var l=Ext.widget("panel",{bodyPadding:"0",frame:false,titleAlign:"left",title:"Applications User Details",ui:"newGraphPanel",margin:"0 10 10 10",dockedItems:[{dock:"bottom",xtype:"pagingtoolbar",cls:"pagingtoolbar",hidden:h,dock:"bottom",store:J,displayInfo:false}],items:[{xtype:"dataview",autoScroll:true,store:J,padding:"10 10 0 10",tpl:new Ext.XTemplate('<div class="">','<tpl for=".">',"<div>",'<table width="100%">',"<tr>","<td>",'<tpl if="xindex===1">','<div class="newTable" style="margin-bottom:10px">',"<tpl else>",'<div class="newTable"  style="margin-bottom:10px">',"</tpl>",'<div style="padding:5px 0px 5px 10px;margin-bottom:-1px" class="x-table-border newFont_bold14">{tableTitle}</div>','<table cellspacing="0" cellpadding="0" border="0" width="100%">',"<thead>","<tr>",'<tpl for="measureColumn">','<th><div style="overflow:visible;text-align:left">{.}</div></th>',"</tpl>","</tr>","</thead>","<tbody>",'<tpl for="measureTable">',"<tr>",'<tpl for=".">','<td><div style="text-align: left">{.}</div</td>',"</tpl>","</tr>","</tpl>","</tbody>","</table>","</div>","</td>","</tr>","</table></div>","</tpl>","	</div>",'<div style="both:clear"></div>'),itemSelector:"x-grid-table"}]});
G.push(l);}}C.removeAll();C.add(G);C.show();C.doLayout();}},loadReportData:function(d){var g=Ext.getCmp("resultPanel");g.removeAll();var f=this;var b=d.reportData;var c=false;if(d.hasOwnProperty("reportData")){var a=d.selectedreportType;if(a=="No"){Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);
Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("csvTool").setDisabled(false);appConstants.publicGridData=b.gridArray;this.loadGrid(appConstants.publicGridData);Ext.getCmp("selectionDetails").setSelectionDetailsData(d.selectionDetails);}}else{this.disableTools();g.hide();this.getNomeasurepanel().doLayout();
this.getNomeasurepanel().show();}},submitReport:function(){if(!isSettingsEnabled){this.showConfigDropdown();}var f;var d;var m;var h=Ext.getCmp("reportGeneration").getValue();var b=Ext.getCmp("mainform").getForm();var o=b.findField("er_type").getValue();f="../servlet/com.eg.ErCtxServerReportC?isSubmit=true&responseType=json";
if(h=="background"){d="../servlet/com.eg.ErStartBackGroundReportC?isSubmit=true&responseType=json";}else{if(h=="background-csv"){d="../servlet/com.eg.ErStartBackGroundReportC?isSubmit=true&responseType=json&isSubmit=true&SaveFormat=CSV";}}appConstants.queryString+="&er_server="+b.findField("er_server").getValue();
this.updateQueryString();m=appConstants.queryString;var j=Ext.getCmp("resultPanel");var i=null;if(isSettingsEnabled){i=this.getThinclientapplicationsettings().getForm();}var a=this.getSettingsFieldValue(i,"reportGeneration",isSettingsEnabled,"reportGeneration");var l="";this.getNomeasurepanel().hide();
this.getBackGroundPanel().hide();m+="&er_RmDispName="+appConstants.er_RmDispName;m+="&application_user_details_report=true";var g=Ext.getCmp("groupByComponent").getValue();m+="&group_by_component="+g.groupByComponent;if(a=="foreground"){Ext.Ajax.request({url:f,params:m,method:"POST",scope:this,timout:320000,success:function(p){var r=p.responseText;
var q=Ext.decode(r);appConstants.publicjsonDataDetails=q;this.loadReportData(q);}});}else{if(a=="background"||a=="background-csv"){j.hide();var c="";var n=this;var k=Ext.getCmp("bgReportName").getValue();k=checkFileName(k);Ext.Ajax.request({url:d,params:m+"&bg_reportname="+k,success:function(p){var u=p.responseText;
var s=Ext.decode(u);publicjsonData=s;var t=s.backgroundReportStatus;if(t!="undefined"){if(t=="success"){var q=s.bgroundResponseTxt;var v=s.bgroundReportsURL;var r=s.backgroundAnchor;c='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconSuccess"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+q+".</br>"+'<a class="backgroundMsgLink" href='+v+">"+r+"</a></div></td></tr></table></td></tr></table>";
}else{if(t=="duplicate"){var q=s.bgroundResponseTxt;var v=s.bgroundReportsURL;var r=s.backgroundAnchor;c='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconExclamation"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+q+".</br>"+'<a class="backgroundMsgLink" href='+v+">"+r+"</a></div></td></tr></table></td></tr></table>";
}else{var q=s.bgroundResponseTxt;c='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="iconExclamation"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+q+"</div></td></tr></table></td></tr></table>";
}}}else{c="<span>ErroR In BackGround Generation</span>";}n.getBackGroundPanel().update(c);n.getBackGroundPanel().show();}});}}},reportGenChange:function(){Ext.getCmp("resultPanel").hide();this.disableTools();var b=this.getThinclientapplicationsettings().getForm();var a=b.findField("reportGeneration").getValue();
Ext.getCmp("submitViaSetting").show();Ext.getCmp("moreOptionCloseId").hide();if(a=="background"){b.findField("bgReportName").setValue("");Ext.getCmp("bgReportName").show();}else{if(a=="background-csv"){b.findField("bgReportName").setValue("");Ext.getCmp("bgReportName").show();}else{Ext.getCmp("bgReportName").hide();
Ext.getCmp("submitViaSetting").hide();Ext.getCmp("moreOptionCloseId").show();}}},timeLineOnChange:function(){Ext.getCmp("resultPanel").hide();this.disableTools();var a=Ext.getCmp("mainform").getForm();var c=a.findField("er_stdate");var f=a.findField("er_sthr");var b=a.findField("er_enddate");var d=a.findField("er_endhr");
var g=a.findField("er_timeline");if(g.getValue()=="Any"){c.setDisabled(false);f.setDisabled(false);b.setDisabled(false);d.setDisabled(false);}else{g.suspendEvents(true);this.updateQueryString();Ext.Ajax.request({url:"/final/reporter/ErCtxApplicationReportJson.jsp",params:appConstants.queryString,scope:this,success:function(i){var k=i.responseText;
var j=Ext.decode(k);appConstants.publicjsonDataDetails=j;var n=j.startHour;var l=j.endHour;var h=j.startDate;var m=j.endDate;c.setDisabled(true);f.setDisabled(true);b.setDisabled(true);d.setDisabled(true);c.setValue(h);f.setValue(n);b.setValue(m);d.setValue(l);}});g.resumeEvents();}},weekendOnChange:function(){var b=Ext.getCmp("er_excwe").getValue();
var a=Ext.getCmp("excludeDays");if(b=="Yes"){a.show();a.update(appConstants.publicjsonDataDetails.screenLabels["MappedExcludeDays"]);}else{a.hide();}},loadTools:function(){console.log("<< my -4 >>>");this.getNewUtilities().loadIcon(true,true,true,false,true,true,true,false,false,false,true);Ext.getCmp("favoriteTool").setDisabled(false);
Ext.getCmp("scheduleTool").setDisabled(false);},disableTools:function(){Ext.getCmp("saveTool").setDisabled(true);Ext.getCmp("printTool").setDisabled(true);Ext.getCmp("mailTool").setDisabled(true);Ext.getCmp("csvTool").setDisabled(true);},updateQueryString:function(){var r;var t="";var v;var b;var q=Ext.getCmp("mainform").getForm();
var a=null;if(isSettingsEnabled){a=this.getThinclientapplicationsettings().getForm();}var y=q.findField("er_type").getValue();r="select_farm="+q.findField("select_farm").getValue()+"&er_type="+y+"&er_excwe="+this.getSettingsFieldValue(a,"er_excwe",isSettingsEnabled,"excludeWeek")+"&er_reportgenration="+this.getSettingsFieldValue(a,"reportGeneration",isSettingsEnabled,"reportGeneration");
var l=Ext.getCmp("geofilter");if(l!=undefined&&!l.isHidden()){var g=Ext.getCmp("er_geoFilter").getValue();if(!isSettingsEnabled){g=appConstants.publicjsonDataDetails.selectedgeoFilter;}if(g!=null&&g!="undefined"&&g.length>0){for(var p=0;g.length>p;p++){r+="&filterValue="+g[p];}}else{r+="&filterValue=all";
}}var n=Ext.getCmp("er_option");if(n!=undefined){r+="&er_option="+n.getValue();if(n.getValue()=="Group"||n.getValue()=="Segment"||n.getValue()=="Service"){var i=Ext.getCmp("er_site");r+="&er_site="+i.getValue();}}if(y=="Yes"){r+="&select_testmes="+q.findField("select_testmes").getValue()+"&er_compType="+q.findField("er_compType").getValue()+"&er_mode="+q.findField("er_mode").getValue();
}else{var w=q.findField("er_server").getValue();var g=q.findField("er_server").getValue();var o=q.findField("er_application").getValue();if(g!=null&&g!="undefined"&&g.length>0){for(var p=0;g.length>p;p++){r+="&er_workgroupserver="+g[p];}}if(o!=null&&o!="undefined"&&o.length>0){for(var p=0;o.length>p;
p++){r+="&er_application="+o[p];}}r+="&er_compType="+q.findField("er_compType").getValue()+"&er_sortby=-1";if(g==undefined||g=="-1"||g.indexOf("All")>-1||g.length>0){r+="&er_server="+q.findField("er_server").getValue();}}var m=this.getSettingsFieldValue(a,"timefrom",isSettingsEnabled,"selectedTimeFrom");
var u=this.getSettingsFieldValue(a,"minfrom",isSettingsEnabled,"selectedMinsFrom");var c=this.getSettingsFieldValue(a,"timeto",isSettingsEnabled,"selectedTimeTo");var s=this.getSettingsFieldValue(a,"minto",isSettingsEnabled,"selectedMinsTo");var v="&er_timeline="+q.findField("er_timeline").getValue()+"&startdate="+q.findField("er_stdate").dataArray+"&enddate="+q.findField("er_enddate").dataArray+"&starthr="+q.findField("er_sthr").dataArray+"&endhr="+q.findField("er_endhr").dataArray+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;
var h="&timefrom="+m+"&minfrom="+u+"&timeto="+c+"&minto="+s;if(appConstants.publicjsonDataDetails.hasOwnProperty("hiddenfields")){var j=appConstants.publicjsonDataDetails.hiddenfields;for(var f in j){t+="&"+f+"="+j[f];}}var d;if(appConstants.publicjsonDataDetails.hasOwnProperty("selectedWorkergroup")){d="&er_workgrpname="+appConstants.publicjsonDataDetails.selectedWorkergroup;
appConstants.queryString=r+v+t+h+d;}else{appConstants.queryString=r+v+t+h;}appConstants.queryString+="&application_user_details_report=true";if(Ext.getCmp("groupByComponent")!=undefined){var x=Ext.getCmp("groupByComponent").getValue();appConstants.queryString+="&group_by_component="+x.groupByComponent;
}appConstants.queryString+="&csvNameByRow="+appConstants.csvNameByRow;},servereOnChangeQueryString:function(){var s;var m="";var q;var h;var a=Ext.getCmp("mainform").getForm();var g=null;if(isSettingsEnabled){g=this.getThinclientapplicationsettings().getForm();}var o=a.findField("er_type").getValue();
s="select_farm="+a.findField("select_farm").getValue()+"&er_type="+o+"&er_excwe="+this.getSettingsFieldValue(g,"er_excwe",isSettingsEnabled,"excludeWeek")+"&er_reportgenration="+this.getSettingsFieldValue(g,"reportGeneration",isSettingsEnabled,"reportGeneration");var n=Ext.getCmp("er_option");if(n!=undefined){s+="&er_option="+n.getValue();
if(n.getValue()=="Group"||n.getValue()=="Segment"||n.getValue()=="Service"){var p=Ext.getCmp("er_site");s+="&er_site="+p.getValue();}}if(o=="Yes"){s+="&select_testmes="+a.findField("select_testmes").getValue()+"&er_compType="+a.findField("er_compType").getValue()+"&er_mode="+a.findField("er_mode").getValue();
}else{var j=a.findField("er_server").getValue();var r=a.findField("er_server").getValue();var c=a.findField("er_application").getValue();if(r!=null&&r!="undefined"&&r.length>0){for(var l=0;r.length>l;l++){s+="&er_workgroupserver="+r[l];}}if(c!=null&&c!="undefined"&&c.length>0){for(var l=0;c.length>l;
l++){s+="&er_application="+c[l];}}s+="&er_compType="+a.findField("er_compType").getValue()+"&er_sortby=-1";if(r==undefined||r=="-1"||r.indexOf("All")>-1||r.length>0){s+="&er_server="+a.findField("er_server").getValue();}}if(appConstants.publicjsonDataDetails.hasOwnProperty("hiddenfields")){var f=appConstants.publicjsonDataDetails.hiddenfields;
for(var i in f){m+="&"+i+"="+f[i];}}var b;if(appConstants.publicjsonDataDetails.hasOwnProperty("selectedWorkergroup")){b="&er_workgrpname="+appConstants.publicjsonDataDetails.selectedWorkergroup;appConstants.queryString=s+m+b;}else{appConstants.queryString=s+m;}appConstants.queryString+="&application_user_details_report=true";
if(Ext.getCmp("groupByComponent")!=undefined){var d=Ext.getCmp("groupByComponent").getValue();appConstants.queryString+="&group_by_component="+d.groupByComponent;}appConstants.queryString+="&csvNameByRow="+appConstants.csvNameByRow;},afterMainRender:function(){console.log("<< my -1 >>>");var a=this;this.refreshReportData(appConstants.publicjsonDataDetails);
},loadFormElements:function(){console.log("<< my -2 >>>");Ext.getCmp("showLegend").hide();registerAjaxEvents();var a=Ext.getCmp("mainform").getForm();if(targetType=="Application User Details"){Ext.getCmp("showLegend").hide();}if(appConstants.er_RmDispName!=null&&appConstants.er_RmDispName!="null"&&appConstants.er_RmDispName!="undefined"){this.getMain().setTitle(appConstants.er_RmDispName);
}else{this.getMain().setTitle(appConstants.publicjsonDataDetails.reportTitle);}this.fillFormFieldsForActivity(appConstants.publicjsonDataDetails);if(!hideBackButton){Ext.getCmp("thinclientapplicationform").add({xtype:"hidden",id:"ID",name:"ID",value:appConstants.publicjsonDataDetails["ID"]});}var n=a.findField("er_type").getValue();
if(targetType=="Application User Details"||targetType=="Application Report"){if(n=="Yes"){Ext.getCmp("egcomponent").hide();}else{Ext.getCmp("egcomponent").show();}}else{}jsonData=appConstants.publicjsonDataDetails;var l=jsonData.screenLabels;var m=jsonData.timelineCombo;var p=jsonData.selectedTimeline;
var c=a.findField("er_timeline");c.setFieldLabel(l["reporter.common.Timeline"]);c.getStore().loadRawData(m);if(!Ext.isEmpty(m)){if(!Ext.isEmpty(p)){c.setValue(p);}else{c.setValue(m[0].valueField);}}var f=a.findField("er_option");f.getStore().loadRawData(jsonData.analysisByCombo);if(!Ext.isEmpty(jsonData.selectedAnalysisByCombo)){f.setValue(jsonData.selectedAnalysisByCombo);
}else{if(jsonData.analysisByCombo!=undefined){f.setValue(jsonData.analysisByCombo[0].valueField);}}var j=jsonData.startHour;var d=jsonData.endHour;var h=jsonData.startDate;var b=jsonData.endDate;var g=a.findField("er_stdate");g.setValue(jsonData.startDateForDisplay);g.dataArray=h;var o=a.findField("er_sthr");
o.setValue(jsonData.startHourForDisplay);o.dataArray=j;var k=a.findField("er_enddate");k.setValue(jsonData.endDateForDisplay);k.dataArray=b;var i=a.findField("er_endhr");i.setValue(jsonData.endHourForDisplay);i.dataArray=d;mgr_stmin=jsonData.startmin;mgr_enmin=jsonData.endmin;},refreshReportData:function(a){if(appConstants.isSubmit!=null&&appConstants.isSubmit=="true"){this.loadReportData(a);
}else{if(appConstants.isForceSubmit=="true"){appConstants.isForceSubmit="false";this.showResult();}}},fillFormFieldsForActivity:function(l){var f;var g;var m;var i="false";var b=Ext.getCmp("mainform").getForm();if(l.hasOwnProperty("isSubmit")){var i=l.isSubmit;}var c=appConstants.publicjsonDataDetails.hiddenfields;
var d=c["fromScheduleModify"];var j=c["fromFavoriteModify"];if(d!=null&&d=="Yes"||(j!=null&&j=="Yes")){Ext.getCmp("submit").hide();Ext.getCmp("save").show();Ext.getCmp("favoriteTool").setDisabled(true);Ext.getCmp("scheduleTool").setDisabled(true);}else{Ext.getCmp("submit").show();Ext.getCmp("save").hide();
}var k=l.screenLabels;appConstants.globalScreenLabels=l.screenLabels;var a="";if(l.hasOwnProperty("selectedAnalysisByCombo")){a=l.selectedAnalysisByCombo;}if(a=="Zone"){Ext.getCmp("er_site").hide();f=l.zoneCombo;g=l.selectedZone;m=b.findField("select_farm");m.setFieldLabel(k["reporter.consolidated.Zone"]);
m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue(f[0].valueField);}}else{if(a=="Segment"){Ext.getCmp("select_farm").hide();f=l.siteCombo;g=l.selectedSiteCombo;m=b.findField("er_site");m.setFieldLabel("Segment");m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);
}else{m.setValue(f[0].valueField);}m.show();}else{if(a=="Group"){Ext.getCmp("select_farm").hide();f=l.siteCombo;g=l.selectedSiteCombo;m=b.findField("er_site");m.setFieldLabel("Group");m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue(f[0].valueField);}m.show();}else{if(a=="Service"){Ext.getCmp("select_farm").hide();
f=l.siteCombo;g=l.selectedSiteCombo;m=b.findField("er_site");m.setFieldLabel("Service");m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue(f[0].valueField);}m.show();}else{if(a=="Component"){Ext.getCmp("select_farm").hide();Ext.getCmp("er_site").hide();}else{if(l.hasOwnProperty("zoneCombo")){f=l.zoneCombo;
var n=l.selectedZone;m=b.findField("select_farm");m.getStore().loadRawData(f);if(!Ext.isEmpty(n)){m.setValue(n);}else{m.setValue(f[0].valueField);}m.show();}}}}}}if(l.hasOwnProperty("componentTypeCombo")){f=l.componentTypeCombo;g=l.selectedComponentType;m=b.findField("er_compType");m.setFieldLabel(k["reporter.common.Component Type"]);
m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue(f[0].valueField);}m.show();}if(l.hasOwnProperty("workerGroupCombo")){f=l.workerGroupCombo;g=l.selectedWorkergroup;e=b.findField("er_workgrpname");e.setFieldLabel(k["reporter.thin.Worker Group"]);e.getStore().loadRawData(f);
if(!Ext.isEmpty(g)){e.setValue(g);}else{e.setValue(f[0].valueField);}e.show();}else{b.findField("er_workgrpname").hide();}f=l.reportTypeCombo;g="No";console.log("<<<<<< comboRawData>>>>>>>>"+f);console.log("<<<<<< selectedComboOption>>>>>>>>"+g);m=b.findField("er_type");m.setFieldLabel(k["reporter.thin.Report Type"]);
m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue("No");}m.hide();console.log("<<<<<< i am here 5555 66>>>>>>>>");if(g=="No"){Ext.getCmp("select_testmes").hide();Ext.getCmp("er_mode").hide();f=l.serverCombo;g=l.selectedServer;m=Ext.getCmp("er_server");var h=Ext.getCmp("egcomponent");
m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue(f[0].valueField);}h.show();if(g!=null&&g!="undefined"){}f=l.applnCombo;g=l.selectedAppln;m=Ext.getCmp("er_application");appConstants.rawDataForApplication=f;m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue(f[0].valueField);
}console.log("<<< i am fianl show >>>");m.show();this.getThinclientapplicationform().doLayout();}else{f=l.measureCombo;g=l.selectedMeasure;m=b.findField("select_testmes");m.setFieldLabel(k["reporter.thin.Measure"]);m.getStore().loadRawData(f);if(!Ext.isEmpty(g)){m.setValue(g);}else{m.setValue(f[0].valueField);
}}b.findField("er_option").show();},loadSettingsElements:function(){console.log("<< loadSettingsElements >>>>>>");var b="";var m="";b=appConstants.publicjsonDataDetails["hiddenfields"];m=b["favorite_id"];if(!Ext.isEmpty(m)){Ext.getCmp("reportGeneration").setDisabled(true);}Ext.getCmp("moreOptionCloseId").show();
var g;var h;var o;var c=this.getThinclientapplicationsettings().getForm();jsonData=appConstants.publicjsonDataDetails;var k=jsonData.screenLabels;Ext.getCmp("timeperiodLbl").setText(k["reporter.common.Time period"]);c.findField("timefrom").setValue(jsonData.selectedTimeFrom);c.findField("minfrom").setValue(jsonData.selectedMinsFrom);
c.findField("timeto").setValue(jsonData.selectedTimeTo);c.findField("minto").setValue(jsonData.selectedMinsTo);stmin=jsonData.startMinForDisplay;enmin=jsonData.endMinForDisplay;updatingAppSettings();if(targetType=="Application User Details"||targetType=="Application Report"){g=jsonData.excludeWeekCombo;
h=jsonData.excludeWeek;o=c.findField("er_excwe");o.setFieldLabel(k["reporter.common.Exclude weekends"]);o.getStore().loadRawData(g);if(!Ext.isEmpty(h)){o.setValue(h);}else{o.setValue(g[0].valueField);}g=jsonData.geoFilterCombo;if(g!=undefined){appConstants.geoFilterCombo=g;var l=Ext.getCmp("er_geoFilter");
l.getStore().loadRawData(g);h=jsonData.selectedgeoFilter;Ext.getCmp("multiSelectLabel_geo").setText(k["geoFilterLabel"]);if(!Ext.isEmpty(h)){l.setValue(h);}else{l.setValue(g[0].valueField);}Ext.getCmp("geofilter").show();}}var f=c.findField("groupByComponent");console.log("<<< groupComp >>>"+f);if(f!=undefined&&jsonData.group_by_component!=undefined){f.setValue({"groupByComponent":jsonData.group_by_component});
}else{f.setValue({"groupByComponent":"No"});}var p=jsonData.reportGenerationCombo;var n=jsonData.reportGeneration;var d=c.findField("reportGeneration");d.setFieldLabel(k["reporter.common.Report Generation"]);d.getStore().loadRawData(p);d.setValue(n);var j=this;Ext.EventManager.onWindowResize(function(){Ext.get("configMod").setStyle("left","");
});Ext.get("closeSettings").on("click",function(){j.validateAndCloseSettings();});if(targetType=="Application User Details"||targetType=="Application Report"){c.findField("er_excwe").show();var a=Ext.getCmp("mainform").getForm();var i=Ext.getCmp("er_server").getValue();if(a.findField("er_type").getValue()==null||a.findField("er_type").getValue()==undefined){return;
}if(i==null||i==""||i.length==0){return;}}else{c.findField("er_excwe").hide();}},validateAndCloseSettings:function(){var b=this.validateSettings();var a=Ext.getCmp("submit");a.setDisabled(true);if(b){a.setDisabled(false);Ext.get("configMod").animate({duration:500,to:{y:-500}});return true;}return false;
},closeSettingAndSubmit:function(){if(this.validateAndCloseSettings()){this.showResult();}},showConfigDropdown:function(){isSettingsEnabled=true;var a=new Ext.XTemplate('<div style="float:left;margin:0px 0px 0px 4px">More Options</div><div style="text-align:right;float:right;"><div class="iconCloseNew" id="closeSettings"></div></div>');
Ext.create("Ext.container.Container",{width:600,padding:5,id:"configMod",ui:"settingsWindowContainer",items:[{xtype:"container",cls:"configMode_popupArrow",style:{"top":"-14px","left":"390px"}},{xtype:"container",html:a.apply(),cls:"containerHeader",style:{"top":"0px","margin":"2px"}},{xtype:"thinclientapplicationsettings",parent:this}],renderTo:"thinclientapplication"});
},LoadDrillDownData:function(d){var c=d.substring(d.indexOf("?")+1);var b=d.substring(0,d.indexOf("?"));var f=Ext.getCmp("resultPanel");var a=this;console.log(b+"  np");Ext.Ajax.request({url:b,params:c,method:"POST",scope:this,success:function(o){var i=o.responseText;var r=Ext.decode(i);if(r.hasOwnProperty("DrillDownData")){f.removeAll();
var n=r["DrillDownData"];var h=n["columnDetails"];var t=n["dataArray"];if(!Ext.isEmpty(t)){var s='<div class="x-table" >'+'<table cellspacing="0" cellpadding="0" border="0" class="x-grid-table x-grid-table-resizer">'+"<thead>"+'<tr class="x-grid-row">';for(var p in h){s+='<th class="x-grid-cell">'+'<div class="x-grid-cell-inner">'+h[p]+"</div>"+"</th>";
}s+="</tr>"+"</thead>"+"<tbody>"+'<tpl for=".">';for(var q in t){var g=t[q];s+='<tr class="x-grid-row">';for(var m in g){s+='<td class=" x-grid-cell x-grid-cell-first">'+'<div class="x-grid-cell-inner" >'+g[m]+"</div>"+"</td>";}s+="</tr>";}s+="</tpl>"+"</tbody>"+"</table>"+"</div>";}f.add({xtype:"panel",title:n.title,tools:[{xtype:"button",text:backText,cls:"backbutton",iconCls:"iconBack",id:"thiClientbckButton",name:"thiClientbckButton",listeners:{"click":function(){a.submitReport();
}}}],html:s});}}});},expandAppln:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_application"),Ext.getCmp("appLabel").text,a);},expandMe:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");
}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_server"),Ext.getCmp("multiSelectLabel").text,a);},expandMeGeo:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_geoFilter"),Ext.getCmp("multiSelectLabel_geo").text,a);
},getSettingsFieldValue:function(a,h,d,f){var b=null;b=appConstants.publicjsonDataDetails;var g="";if(d){var c=a.findField(h);if(!Ext.isEmpty(c)){g=c.getValue();}}else{if(b!=null){g=b[f];}}return g;}});