Code:
function AbrirChamadoShow(QTD_Chamado){
var WI_AbrirChamado = Ext.getCmp('AbrirChamado');
if (!WI_AbrirChamado){
var FP_AbrirChamado = new Ext.FormPanel({
labelAlign: 'top',
frame:true,
title: 'Multi Column, Nested Layouts and Anchoring',
bodyStyle:'padding:5px 5px 0',
width: 600,
items: [{
layout:'column',
items:[{
columnWidth:.5,
layout: 'form',
items: [{
xtype:'hidden',
name: 'codigo_chamado',
id: 'codigo_chamado',
},
new Ext.form.TriggerField({
fieldLabel: 'Nome Empresa',
name: 'fantasia_nome',
id: 'fantasia_nome',
readOnly: true,
width: 320,
triggerClass: 'lookup',
onTriggerClick : function(){
LookupEmpresaShow();
},
anchor:'95%',
}),{
xtype:'textfield',
fieldLabel: 'Data Inicial do Chamado',
name: 'data_abertura',
id: 'data_abertura',
readOnly: true,
value: getData(),
anchor:'95%',
},{
xtype: 'checkbox',
fieldLabel: 'Agendar Visita',
align: 'left',
name: 'agendar_visita',
id: 'agendar_visita',
}]
},{
columnWidth:.5,
layout: 'form',
items: [{
xtype:'hidden',
name: 'codigo_cliente',
id: 'codigo_cliente',
},{
xtype:'textfield',
fieldLabel: 'Nome Funcionà rio',
name: 'nome_funcionario',
id: 'nome_funcionario',
readOnly: true,
value: '<?php echo $_SESSION["nome_funcionario"];?>',
anchor:'95%',
},{
xtype:'textfield',
fieldLabel: 'Hora Inicial do Chamado',
name: 'hora_abertura',
id: 'hora_abertura',
readOnly: true,
value: getHora(),
anchor:'95%',
},{
xtype: 'checkbox',
labelAlign: 'left',
fieldLabel: 'Finalizar Chamado',
name: 'finalizar_chamado',
id: 'finalizar_chamado',
listeners: {
check: function( cb, state ) {
if( state == true ) {
Ext.getCmp("observacao").setValue(Ext.getCmp("observacao").getValue() + "<br><center><b>Solução</b></center><br>");
}else{
Ext.getCmp("observacao").setValue(Solucao(Ext.getCmp("observacao").getValue()));
}
}
},
}]
}]
},{
xtype: 'htmleditor',
//xtype: 'textarea',
id:'observacao',
fieldLabel:'Observacao',
height:300,
anchor:'98%',
}],
buttons: [{
text:'Salvar',
formBind: true,
id: 'btn_salvar_chamado',
/*---------------- CADASTRA O CHAMADO NO BANCO DE DADOS -----------------*/
handler: function(){
//if( FP_AbrirChamado.getForm().isValid() ){
var dados_chamado = [];
dados_chamado.push( FP_AbrirChamado.getForm().getValues());
Ext.Ajax.request({
url: 'insert.php',
method:'POST',
params: { parametro: 'Chamado',
dados_chamado: Ext.util.JSON.encode(dados_chamado),
},
waitMsg: 'Salvando...',
success: function(response) {
var cod_retorno = Ext.decode(response.responseText);
Ext.MessageBox.alert('Status', 'Chamado Cadastrado com Sucesso!!!');
dsChamado.reload();
if( Ext.getCmp('agendar_visita').getValue() == 1 ) {
alert(cod_retorno.codigo_chamado); Agenda(Ext.getCmp("codigo_cliente").getValue(), Ext.getCmp("fantasia_nome").getValue(), cod_retorno.codigo_chamado);
}
else {
WI_AbrirChamado.close();
WI_AbrirChamado = null;
}
},
failure: function() {
Ext.MessageBox.alert('Status','Save failed');
}
});
}
},{
text: 'Atualizar',
id: 'btn_atualizar_chamado',
handler: function(){
var dados_chamado = [];
dados_chamado.push(FP_AbrirChamado.getForm().getValues());
Ext.Ajax.request({
url: 'update.php',
method:'POST',
params:{
parametro: 'Atualizar_Chamado',
codigo_chamado: Ext.getCmp("codigo_chamado").getValue(),
agendar_visita: Ext.getCmp("agendar_visita").getValue(),
finalizar_chamado: Ext.getCmp("finalizar_chamado").getValue(),
dados_chamado: Ext.util.JSON.encode(dados_chamado),
observacao: Ext.getCmp("observacao").getValue(),
},
success:function(response)
{
var msg_retorno = Ext.decode(response.responseText);
if( msg_retorno.success == true ){
if( Ext.getCmp('agendar_visita').getValue() == 1 ) {
Agenda(Ext.getCmp("codigo_cliente").getValue(), Ext.getCmp("fantasia_nome").getValue(), Ext.getCmp("codigo_chamado").getValue());
}
dsChamado.reload();
WI_AbrirChamado.close();
WI_AbrirChamado = null;
}
else {
alert("Erro");
}
}
});
},
},{
text: 'Cancelar',
id: 'btn_cancelar_chamado',
listeners: {
click: function() {
WI_AbrirChamado.close();
WI_AbrirChamado = null;
}
},
},{
text: 'Agenda',
id: 'btn_agenda',
handler: function(){
MostraAgenda(Ext.getCmp('codigo_chamado').getValue());
}
}],
});
var WI_AbrirChamado = new Ext.Window({
modal: true,
id: 'AbrirChamado',
title: "Abrir Chamado",
maximizable: true,
border: false,
layout: 'fit',
closeAction: 'close',
listeners:{
close: function(){
WI_AbrirChamado.destroy();
}
},
width: 700,
height: 520,
listeners: { close: function() { WI_AbrirChamado = null; } },
items: FP_AbrirChamado,
});
}
WI_AbrirChamado.show();
}
For test , i change htmleditor for textarea and work , but i need to use htmleditor.