Ext.define("UserProfile.view.dailyEmailSettings",{extend:"Ext.panel.Panel",alias:"widget.dailyemailsettings",id:"dailyemailsettings",bodyPadding:0,requires:["utilities.CommonPanel","Ext.ux.form.MultiSelectSI","Ext.ux.form.ItemSelectorSI","utilities.ScrollCombo","utilities.ErUtils","utilities.Multiselector","utilities.CustomTrigger",],cls:"userProfileOuter",layout:"vbox",margin:8,scroll:true,autoScroll:true,data:"",listeners:{"beforerender":function(){editSuspend=false;
}},items:[{xtype:"panel",columnWidth:1,margin:8,id:"dms_panel",layout:"vbox",border:true,items:[{xtype:"container",layout:"vbox",items:[{xtype:"textfield",id:"schedName",name:"schedName",width:"auto",labelAlign:"top",fieldLabel:'<span class="font_bold">Report Name</span>',cls:"textbox",allowBlank:false,maxLength:50,enforceMaxLength:true,width:190,listeners:{"blur":function(){if(!editSuspend){if(Ext.isEmpty(this.value)){return;
}var a=validateChar(this.value);if(a==null){Ext.MessageBox.show({title:"Alert",msg:"Schedule Already Exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING,});return;}else{if(!a){Ext.MessageBox.show({title:"Alert",msg:"Special characters not Allowed",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING,});
return;}}Ext.getCmp("sc_hr").setValue("00");Ext.getCmp("sc_min").setValue("00");}}}}]},{xtype:"container",id:"dms_container_in",layout:{type:"table",columns:3},height:"auto",items:[{xtype:"scrollcombo",labelAlign:"top",fieldLabel:'<span class="font_bold">Report for</span>',cls:"dropdown",labelSeparator:"",id:"appliesTo",name:"appliesTo",margin:"0 40 10 0",forceSelection:false,displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),listeners:{"change":function(){var g=this.getValue();
var f=this.getRawValue();if(g!="-1"){var c;try{c=Ext.getCmp("dailyemailsettings").data.data;}catch(d){}if(g=="ComponentType"||g=="Components"){Ext.getCmp("email_type").setVisible(false);}else{Ext.getCmp("email_type").setVisible(true);}if(c!=null&&c!=undefined&&c[g]!=undefined){var b=c[g];if(g=="Components"){Ext.getCmp("comp_container").setVisible(true);
Ext.getCmp("applied_by").setVisible(false);Ext.getCmp("comp_type_for").getStore().loadRawData(c["ComponentType"]);}else{Ext.getCmp("comp_container").setVisible(false);Ext.getCmp("applied_by").setVisible(true);Ext.getCmp("applied_by").getStore().loadRawData(b);var a=Ext.getCmp("applied_by").getStore().getAt(0).get("valueField");
Ext.getCmp("applied_by").setValue(a);Ext.getCmp("applied_by").setFieldLabel('<span class="font_bold"> '+f+" </span>");}}}else{Ext.getCmp("applied_by").getStore().loadRawData();}Ext.getCmp("temp_name").getStore().loadRawData("");Ext.getCmp("temp_name").setRawValue("Select a template");Ext.getCmp("email_type").getStore().loadRawData("");
Ext.getCmp("email_type").setRawValue("Select a email type");Ext.getCmp("email_type").setDisabled(false);try{}catch(d){}}}},{xtype:"container",layout:"hbox",margin:"0 40 10 0",id:"comp_container",hidden:true,items:[{xtype:"container",width:220,margin:0,items:[{xtype:"scrollcombo",margin:"0 40 10 0",labelAlign:"top",fieldLabel:'<span class="font_bold"> Components </span>',cls:"dropdown",labelSeparator:"",id:"comp_type_for",name:"comp_type_for",width:220,forceSelection:false,value:"Please select",displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),listeners:{"select":function(){var a=this.getValue();
Ext.Ajax.request({url:"/final/admin/UserProfile/data/userProfileDailyMail.jsp?getComponents=true&comp_type="+a,scope:this,success:function(b){if(b.status==200&&!Ext.isEmpty(b.responseText)){var d=b.responseText;var c=Ext.decode(d);compRawData=c["data"];Ext.getCmp("el_component").getStore().loadRawData(c["data"]);
}}});}}},{xype:"container",cls:"multisearchlist",items:[{xtype:"customtrigger",emptyText:"Search Components",id:"compSearch",cls:"whitedropdown_search",listeners:{"change":function(a){if(Ext.isEmpty(this.erUtils)){this.erUtils=Ext.widget("erutils");}this.erUtils.filterComboStore(a,Ext.getCmp("el_component"),compRawData);
}}}]},{width:220,xtype:"multiselectfield",autoScroll:false,scroll:false,height:90,labelAlign:"left",allowBlank:false,id:"el_component",name:"el_component",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),displayField:"displayField",valueField:"valueField",queryMode:"local"}]},{xtype:"container",margin:"50 0 0 5",items:[{xtype:"button",iconCls:"iconMultiselectExpand",id:"expandSelector",name:"expandSelector",listeners:{afterrender:function(){Ext.create("Ext.tip.ToolTip",{target:this.id,anchor:"top",cls:"yellowTip",trackMouse:true,html:"Expand"});
},"click":function(a){if(Ext.isEmpty(this.erUtils)){this.erUtils=Ext.widget("erutils");}this.erUtils.expandMultiComboButton(Ext.getCmp("el_component"),"Components List",a);}},style:{background:"none",border:"0px"}}]}]},{xtype:"scrollcombo",margin:"0 40 10 0",labelAlign:"top",fieldLabel:'<span class="font_bold"> All </span>',cls:"dropdown",labelSeparator:"",id:"applied_by",name:"applied_by",forceSelection:false,value:"Please select",displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),},{xtype:"scrollcombo",margin:"0 40 10 0",labelAlign:"top",fieldLabel:'<a class="font_bold" >Template Name</a><div border="0" style="border:none !important;vertical-align:middle;display:none;margin-right:10px;margin-top:-2px;margin-left:5px;" onclick="viewTemplate()" id="view_temp_id" class="iconDetailedList"></div>',cls:"dropdown",labelSeparator:"",id:"temp_name",name:"temp_name",forceSelection:false,value:"Select a template",displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),listeners:{"change":function(){}}},{xtype:"scrollcombo",margin:"0 40 10 0",labelAlign:"top",fieldLabel:'<span class="font_bold"> Component Type </span>',cls:"dropdown",labelSeparator:"",id:"email_type",name:"email_type",forceSelection:false,hidden:true,value:"Select a email type",displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),},{xtype:"scrollcombo",margin:"0 40 10 0",labelAlign:"top",fieldLabel:'<span class="font_bold">Hr</span>',cls:"dropdown",labelSeparator:"",id:"sc_hr",name:"sc_hr",forceSelection:false,displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),},{xtype:"scrollcombo",margin:"0 40 10 0",labelAlign:"top",fieldLabel:'<span class="font_bold">Min</span>',cls:"dropdown",labelSeparator:"",id:"sc_min",name:"sc_min",forceSelection:false,displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),},{xtype:"scrollcombo",margin:"0 40 10 0",labelAlign:"top",fieldLabel:'<span class="font_bold">Type</span>',cls:"dropdown",labelSeparator:"",id:"mail_type",name:"mail_type",forceSelection:false,displayField:"displayField",valueField:"valueField",queryMode:"local",store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),},{xtype:"textfield",id:"mailId",name:"mailId",width:190,labelAlign:"top",fieldLabel:'<span class="font_bold">Email</span>',cls:"textbox",}]},{xtype:"container",height:"auto",width:"auto",align:"center",margin:"15 0 0 330",items:[{xtype:"button",margin:"auto",align:"center",id:"sm_button",name:"sm_button",text:'<span class="font_bold">Add</span>',cls:"button20",width:"auto",}]},]},{xtype:"container",height:10,width:"auto"},{xtype:"grid",margin:8,columns:[{}],store:Ext.create("Ext.data.ArrayStore",{}),title:"Configured Reports",stateful:true,layout:"fit",width:"100%",minHeight:155,flex:1,autoScroll:"true",id:"listGrid",itemId:"listGrid",cls:"gridSkin",listeners:{"afterrender":function(){try{}catch(a){}}}}]});
function viewTemplate(){try{var c=Ext.getCmp("temp_name").getValue();var a=Ext.getCmp("email_type").getValue();var b=Ext.getCmp("appliesTo").getValue();var f=Ext.getCmp("applied_by").getValue();if(!Ext.isEmpty(c)&&c.indexOf("-select-")==-1){Ext.Ajax.request({url:"/final/admin/UserProfile/data/userProfileDailyMail.jsp?viewTemplateConfig=true&template="+c+"&email_type="+a+"&appliesTo="+b+"&applied_by="+f,scope:this,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var h=e.responseText;
var g=Ext.decode(h);if(!Ext.isEmpty(g)){if(!Ext.isEmpty(Ext.getCmp("panelConfigWin"))){Ext.getCmp("panelConfigWin").destroy();}Ext.create("UserProfile.view.panelConfigWin",{data:g}).show();}}}});}}catch(d){alert(d);}}function viewGridTemplate(c,a,b,f){try{if(!Ext.isEmpty(c)&&c.indexOf("-select-")==-1){Ext.Ajax.request({url:"/final/admin/UserProfile/data/userProfileDailyMail.jsp?viewTemplateConfig=true&template="+c+"&email_type="+a+"&appliesTo="+b+"&applied_by="+f,scope:this,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var h=e.responseText;
var g=Ext.decode(h);if(!Ext.isEmpty(g)){if(!Ext.isEmpty(Ext.getCmp("panelConfigWin"))){Ext.getCmp("panelConfigWin").destroy();}Ext.create("UserProfile.view.panelConfigWin",{data:g}).show();}}}});}}catch(d){alert(d);}}