Ext.ns("feyaSoft.oilAccount.account.home");feyaSoft.oilAccount.account.home.CreateEditTechnology=function(config){Ext.QuickTips.init();Ext.form.Field.prototype.msgTarget="side";this.myOwner=config.myOwner;var TechnologyTitle=new Ext.form.TextField({fieldLabel:"Title",allowBlank:false,name:"title",anchor:"95%"});var url=new Ext.form.TextField({fieldLabel:"URL",name:"url",anchor:"95%"});this.photoUpload=new Ext.form.TriggerField({fieldLabel:"Photo",name:"photo",editable:false,anchor:"95%",blankText:"Select one of image from your photo folder"});this.photoUpload.owner=this;this.photoUpload.onTriggerClick=function(){new feyaSoft.oilAccount.share.image.ImageWin({whoPopMe:this.owner})};var expireDate=new Ext.form.DateField({fieldLabel:"Expire Date",name:"expireDate",minValue:Ext.util.Format.date(new Date(),"m/d/Y"),anchor:"95%"});var description=new Ext.form.TextArea({fieldLabel:"description",name:"description",height:150,anchor:"95%"});var formPanel=new Ext.form.FormPanel({id:"formPanel",baseCls:"x-plain",labelWidth:100,url:"accountTechnology/createUpdate",defaultType:"textfield",items:[TechnologyTitle,url,this.photoUpload,expireDate,description]});var title="Add Technology";if(config.rd){title="Edit Existing Technology"}feyaSoft.oilAccount.account.home.CreateEditTechnology.superclass.constructor.call(this,{title:title,width:550,height:340,minWidth:400,minHeight:200,layout:"fit",bodyStyle:"padding:5px;",buttonAlign:"center",shim:false,animCollapse:false,constrainHeader:true,modal:true,items:formPanel,resizable:false,buttons:[{text:"Save/Close",handler:function(){if(!feyaSoft.util.common.validateURL(url.getValue())){Ext.MessageBox.alert("Errors","URL should be in correct format: http://www.google.com")}else{if(formPanel.form.isValid()){var params={};if(config.rd){params={id:config.rd.data.id}}formPanel.form.submit({waitMsg:"Processing",params:params,failure:function(form,action){Ext.MessageBox.alert("Error Message",action.result.errorInfo)},success:function(form,action){Ext.Message.msgStay("Confirm",action.result.info,2000);this.myOwner.reload();this.close()},scope:this})}else{Ext.MessageBox.alert("Errors","Please fix the errors noted.")}}},scope:this},{text:"Cancel",handler:function(){this.close()},scope:this}]});this.on("afterlayout",function(){if(config.rd){var data=config.rd.data;TechnologyTitle.setValue(data.title);if(data.description){description.setValue(data.description.replace("\\n","\n"))}expireDate.setValue(data.expireDate);url.setValue(data.url)}},this,{single:true});this.show()};Ext.extend(feyaSoft.oilAccount.account.home.CreateEditTechnology,Ext.Window,{doAssignImage:function(imageInfo){this.photoUpload.setValue(imageInfo)}});
