Ext.namespace('CadastroCartaoComum'); CadastroCartaoComum.formPanel = new Ext.form.FormPanel({ id : 'idCadastroCartaoComumForm' ,formId : 'frmAlteraGaragemEmp' ,frame : true ,region: 'center' ,bodyStyle:'padding:5px' ,border : true ,labelWidth: 120 ,onSubmit: Ext.emptyFn ,items: [ new Ext.form.FieldSet({ title: 'Cadastro de cartão comum', autoHeight: true ,layoutConfig : { labelSeparator: '' } ,items: [ { xtype: 'panel', layout:'column', items: [{ columnWidth: .5, layout: 'form', bodyStyle: 'padding:0px 25px 0px 0px', labelAlign: 'left', labelWidth: 120, items:[ { xtype : 'numberfield', name : 'cadastroCartaoComum.cpf', fieldLabel : 'CPF', id : 'campoCPF', allowDecimals: false, allowBlank : false, allowNegative: false, maxValue: 99999999999, tabIndex : 1, anchor:'99%' //width :200 ,listeners:{ specialkey: function(f,e){ if (e.getKey() == e.ENTER || e.getKey() == Ext.EventObject.TAB ) { validaCpf() } } } } ] }, { columnWidth: .5, layout: 'form', labelAlign: 'left', labelWidth: 63, items:[ { xtype : 'numberfield', labelSeparator: '', name : 'cadastroCartaoComum.idCartao', fieldLabel : 'Número do Cartão', allowBlank : false, tabIndex : 2, maxValue: 99999999999, anchor:'99%' //width :200 ,listeners:{ specialkey: function(f,e){ if (e.getKey() == e.ENTER || e.getKey() == Ext.EventObject.TAB ) { validaCartao() } } } } ] } ] }, { xtype : 'textfield', labelSeparator: '', name : 'cadastroCartaoComum.nome', fieldLabel : 'Nome', disabledClass: 'customDisabledClass', allowBlank : false, tabIndex : 3, maxLength : 35, anchor:'99%' },{ xtype : 'textfield', labelSeparator: '', name : 'cadastroCartaoComum.rg', fieldLabel : 'RG', disabledClass: 'customDisabledClass', allowBlank : false, tabIndex : 4, maxLength : 35, //anchor:'99%' width :200 }, { xtype : 'textfield', labelSeparator: '', name : 'cadastroCartaoComum.endereco', fieldLabel : 'Endereço', allowBlank : false, tabIndex : 5, maxLength : 35, anchor:'99%' },{ xtype : 'textfield', labelSeparator: '', name : 'cadastroCartaoComum.enderecoCompl', fieldLabel : 'Complemento', allowBlank : true, tabIndex : 6, maxLength : 35, anchor:'99%' }, { xtype: 'panel', layout:'column', items: [{ columnWidth: .5, layout: 'form', bodyStyle: 'padding:0px 25px 0px 0px', labelAlign: 'left', labelWidth: 120, items:[ { xtype : 'textfield', labelSeparator: '', name : 'cadastroCartaoComum.cidade', fieldLabel : 'Cidade', allowBlank : false, maxLength : 35, tabIndex : 7, anchor:'99%' //width :200 },{ xtype : 'textfield', id: '_idCEP333', labelSeparator: '', name : 'cadastroCartaoComum.cep', fieldLabel : 'C.E.P', anchor:'99%', allowBlank : false, tabIndex : 9, maxLength : 9 //width :200 }, { xtype : 'textfield', id: '_idFone333', labelSeparator: '', name : 'cadastroCartaoComum.telefone', fieldLabel : 'Telefone', allowBlank : false, maxLength : 20, tabIndex : 8, anchor:'99%' //width :200 } ] }, { columnWidth: .5, layout: 'form', labelAlign: 'left', labelWidth: 63, items:[ { xtype : 'textfield', labelSeparator: '', name : 'cadastroCartaoComum.bairro', fieldLabel : 'Bairro', allowBlank : false, tabIndex : 8, maxLength : 25, anchor:'99%' //width :200 },{ xtype : 'combo', name : 'empresa.estado', hiddenName : 'cadastroCartaoComum.estado', fieldLabel : 'Estado', store : storeUF, displayField : 'nome', valueField : 'sigla', typeAhead : true, mode : 'local', forceSelection : true, triggerAction : 'all', selectOnFocus : true, allowBlank : false, editable: false, tabIndex : 10, anchor:'99%' }, { xtype : 'textfield', id: '_idFone222', labelSeparator: '', name : 'cadastroCartaoComum.celular', fieldLabel : 'Celular', allowBlank : true, maxLength : 20, tabIndex : 11, anchor:'99%' //width :200 } ] } ] }, { xtype: 'radiogroup', fieldLabel: 'Sexo', anchor:'60%', items: [ {boxLabel: 'Masculino', name: 'cadastroCartaoComum.sexo', inputValue: 'M', checked: true}, {boxLabel: 'Feminino', name: 'cadastroCartaoComum.sexo', inputValue: 'F'} ] },{ xtype: 'panel', layout:'column', items: [{ columnWidth: .5, layout: 'form', bodyStyle: 'padding:0px 25px 0px 0px', labelAlign: 'left', labelWidth: 120, items:[ { xtype: 'datefield', name : 'cadastroCartaoComum.nascimento', fieldLabel : 'Data de Nascimento', allowBlank : false, tabIndex : 13, anchor:'99%' //width :200 } ] }, { columnWidth: .5, layout: 'form', labelAlign: 'left', labelWidth: 63, items:[ { xtype : 'textfield', labelSeparator: '', name : 'cadastroCartaoComum.email', fieldLabel : 'Email', allowBlank : true, maxLength : 50, vtype: 'email', tabIndex : 14, anchor:'99%' } ] } ] } ]}) ] ,buttons : [{ text : 'Salvar', iconCls : 'add-icon', id : 'salvarCartao', handler : function() { var form = Ext.getCmp('idCadastroCartaoComumForm').getForm(); form.findField('cadastroCartaoComum.cpf').allowBlank = false; form.findField('cadastroCartaoComum.idCartao').allowBlank = false; form.findField('cadastroCartaoComum.nome').allowBlank = false; form.findField('cadastroCartaoComum.rg').allowBlank = false; form.findField('cadastroCartaoComum.endereco').allowBlank = false; form.findField('cadastroCartaoComum.bairro').allowBlank = false; form.findField('cadastroCartaoComum.cep').allowBlank = false; form.findField('cadastroCartaoComum.telefone').allowBlank = false; form.findField('cadastroCartaoComum.cidade').allowBlank = false; form.findField('cadastroCartaoComum.estado').allowBlank = false; form.findField('cadastroCartaoComum.nascimento').allowBlank = false; form.submit({ method : 'POST' ,url : '/dig-sca/cadastroCartaoComum/cadastroCartaoComum!incluir.dig' ,waitTitle : 'Aguarde...' ,waitMsg : 'Aguarde incluindo registro...' ,success : function(form, action) { if(action.result.success) { var funcResult = function() { window.location.href = '/dig-sca/cadastroCartaoComum/sucesso.jsp'; } msgInfo('Registro incluído com sucesso', funcResult); } else { msg(ret.msg); } } ,failure : function(form, action) { trataErroSubmitForm(form, action); } }); } },{ text : 'Cancelar', iconCls : 'cancel-icon', handler : function() { window.location.href = '/dig-sca/cadastroCartaoComum/cadastroCartaoComum.jsp'; } }] }); // create and show window CadastroCartaoComum.win = new Ext.Window({ id:'idCadastroCartaoComum.win', iconCls : 'edit', height:400, width:700, maximized: false, resizable: false, closable:false, draggable : false, // minWidth:300, // minHeight:200, plain:true, title:'Cadastro de cartão comum', layout:'fit', region: 'north', border:false, items: CadastroCartaoComum.formPanel }); function validaCpf() { var form = Ext.getCmp('idCadastroCartaoComumForm').getForm(); desabilitaCampos(); form.submit({ method : 'POST' ,url : '/dig-sca/cadastroCartaoComum/cadastroCartaoComum!consultarCpf.dig' ,waitTitle : 'Aguarde...' ,waitMsg : 'Aguarde pesquisando CPF...' ,success : function(form, action) { if(action.result.success) { var funcResult = function() { } } } ,failure : function(form, action) { trataErroSubmitForm(form, action); } }); } function validaCartao() { var form = Ext.getCmp('idCadastroCartaoComumForm').getForm(); desabilitaCampos(); form.submit({ method : 'POST' ,url : '/dig-sca/cadastroCartaoComum/cadastroCartaoComum!consultarCartao.dig' ,waitTitle : 'Aguarde...' ,waitMsg : 'Aguarde pesquisando cartao...' ,success : function(form, action) { if(action.result.success) { var funcResult = function() { } } } ,failure : function(form, action) { trataErroSubmitForm(form, action); } }); } function desabilitaCampos() { var form = Ext.getCmp('idCadastroCartaoComumForm').getForm(); form.findField('cadastroCartaoComum.cpf').allowBlank = true; form.findField('cadastroCartaoComum.idCartao').allowBlank = true; form.findField('cadastroCartaoComum.nome').allowBlank = true; form.findField('cadastroCartaoComum.rg').allowBlank = true; form.findField('cadastroCartaoComum.endereco').allowBlank = true; form.findField('cadastroCartaoComum.enderecoCompl').allowBlank = true; form.findField('cadastroCartaoComum.bairro').allowBlank = true; form.findField('cadastroCartaoComum.cep').allowBlank = true; form.findField('cadastroCartaoComum.telefone').allowBlank = true; form.findField('cadastroCartaoComum.cidade').allowBlank = true; form.findField('cadastroCartaoComum.estado').allowBlank = true; form.findField('cadastroCartaoComum.celular').allowBlank = true; form.findField('cadastroCartaoComum.email').allowBlank = true; form.findField('cadastroCartaoComum.nascimento').allowBlank = true; }