Ext.ns('ES');

ES.waterCounterInfos = Ext.extend(Ext.Panel,{
   url:'/process/extjs/site/consumption/water/watercounter.php'
   ,tpl:new Ext.XTemplate('<div class="type-1">'
      +'<fieldset class="type-2">'
      +'<legend class="type-2">Compteur eau</legend>'
      +'<table cellspacing="0" cellpadding="0" class="type-1"><tr class="row-c10">'
      +'<td class="label">Nom ou numéro du compteur : </td>'
      +'<td class="data">{watercountername}</td>'
      +'</tr></table>'
      +'</fieldset>'
      +'</div>'
    )
   ,width:436
   ,frame:false
   ,height:130
   ,border:false
   ,initComponent:function() {
      var config = {
      }; // eo config object

    // apply config
    Ext.apply(this, Ext.apply(this.initialConfig, config));
    // call parent initComponent
    ES.waterCounterInfos.superclass.initComponent.apply(this, arguments);

  } // end of function initComponent
  ,onRender:function() {
    ES.waterCounterInfos.superclass.onRender.apply(this, arguments);
  } // eo function onRender
  ,refresh:function(counter_id) {
    this.show();
    this.load({
         url:this.url
        ,waitMsg:'Loading...'
        ,scope:this
        ,method:'GET'
        ,params:{cmd:'read',counter_id:counter_id}
        ,callback:function(var1,var2,response,var3) {
          var result = Ext.util.JSON.decode(response.responseText);
          switch(result.success){
            case 1:
              this.tpl.overwrite(this.body, result.data);
              break;
            default:
              Ext.MessageBox.alert('Attention',result.error);
              break;
          }
        }
    });
  }
});

Ext.reg('ESwatercounterinfos', ES.waterCounterInfos);

