Code:
var win = new Ext.Window({
modal:true,
closeAction:'hide',
title:'Soporte',
buttons:[{id:'btn-newIdSoporte',text:'Nuevo',handler:function(){
Ext.getCmp('formSoporte').getForm().reset();
Ext.getCmp('formSoporte').enable();
//verificar que el id del tipo activo sea el de maquinaria
if(Ext.getCmp('_idTipoActivo').getValue() == 2) {
Ext.getCmp('detalleHoras').enable();
} else {
Ext.getCmp('detalleHoras').disable();
}
Ext.getCmp('detalleHoras').getForm().reset();
id_action_soporte = 1;
newIdSoporte();
Ext.getCmp('btn-saveSoporte').enable();
Ext.getCmp('btn-newIdSoporte').disable();
}},{id:'btn-saveSoporte',text:'Guardar',handler:function(){
var url = '../action/SoporteAction.php?';
//url += formSoporte.getForm().getValues(true);
Ext.getCmp('formSoporte').getForm().submit({
url:url,
method:'POST',
params: {
'accion': id_action_soporte,
'idDetalleHora': id_detalle_hora,
'id': var_idSoporte,
'id_activo':var_idActivo,
'horasUltimoServicio':Ext.getCmp('horasUltimoServicio').getValue(),
'horasUso':Ext.getCmp('horasUso').getValue(),
'horasProximoServicio':Ext.getCmp('horasProximoServicio').getValue()
},
success: function(form, action){
Ext.Msg.alert("Success", action.result.msg);
store.load({
params: {
start: 0,
limit: 20
}
});
storeMultiselect.load({
params: {
'id_activo':var_idActivo
}
});
Ext.getCmp('formSoporte').getForm().reset();
Ext.getCmp('btn-newIdSoporte').enable();
Ext.getCmp('formSoporte').disable();
Ext.getCmp('detalleHoras').disable();
Ext.getCmp('detalleHoras').getForm().reset();
win.hide();
},
failure: function(form, action){
showError(action.failureType,action);
}
});
}}],
items:[
new Ext.form.FormPanel({
width: 540,
frame:true,
id:'formSoporte',
autoHeight:true,
items:[
new Ext.form.DateField({
width: 400,
readOnly:true,
fieldLabel:'<b>fecha</b>',
id:'fechaSoporte',
format:dateFormat// utilities.js
})
,new Ext.form.TextField({
fieldLabel:'<b>Codigo</b>',
width:400,
maxLength:12,
id:'codSoporte',
blankText:'el campo es requerido',
allowBlank:false
})
,new Ext.form.TextField({
fieldLabel:'<b>Proveedor</b>',
width:400,
maxLength:50,
id:'proveedorSoporte',
allowBlank:true
})
,new Ext.form.TextField({
fieldLabel:'<b>Descripcion</b>',
width:400,
maxLength:100,
id:'descSoporte',
allowBlank:true
})
,new Ext.form.TextField({
fieldLabel:'<b>Observaciones</b>',
width:400,
maxLength:250,
id:'observacionesSoporte',
allowBlank:true
}),new Ext.form.NumberField({
fieldLabel:'<b>Monto Soporte</b>',
width:400,
maxLength:250,
id:'montoSoporte',
allowBlank:true
}),new Ext.form.NumberField({
fieldLabel:'<b>Monto Activo</b>',
width:400,
maxLength:250,
id:'montoActivo',
blankText:'el campo es requerido',
allowBlank:false
})
]
}), new Ext.form.FormPanel({
id:'detalleHoras',
height:80,
layout:'absolute',
frame:true,
items:[
new Ext.form.Label({
text:'Hora ultimo servicio',
style:'font-weight: bolder;font-size:12px;',
x:10,y:10
}),
new Ext.form.NumberField({
width:60,
x:135,y:10,
maxLength:5,
id:'horasUltimoServicio',
allowBlank:true
}),
new Ext.form.Label({
text:'Horas de uso',
style:'font-weight: bolder;font-size:12px;',
x:205,y:10
}),
new Ext.form.NumberField({
width:55,
x:290,y:10,
maxLength:5,
id:'horasUso',
allowBlank:true
}),
new Ext.form.Label({
text:'Proximo servicio',
style:'font-weight: bolder;font-size:12px;',
x:350,y:10
}),
new Ext.form.NumberField({
width:55,
x:460,y:10,
maxLength:5,
id:'horasProximoServicio',
allowBlank:true
})
],
title:'Detalle de Horas'
})],
listeners:{
'hide':function(){
Ext.getCmp('formSoporte').getForm().reset();
Ext.getCmp('btn-newIdSoporte').enable();
Ext.getCmp('formSoporte').disable();
Ext.getCmp('detalleHoras').disable();
Ext.getCmp('detalleHoras').getForm().reset();
}
}
});
thanks for your help