<?php


$this->widget('bootstrap.widgets.TbGridView', array(
    'id'=>'sip-header-grid',
    'dataProvider'=>$this->getSipHeaderDataprovider($model),
    'summaryText'=>false,
    'selectableRows'=>0,
    'type'=>'striped bordered condensed',
//     'rowCssClassExpression'=>'!$data->id?"hideRow":""',
    'itemsCssClass'=>'plTable items',
    'columns'=>array(
	array(
	  'name'=>'header',
	  'type'=>'raw',
	  'header'=>__('NUMBER_TRANSLATION_SIP_HEADER_GRID_HEADER'),
	  'headerHtmlOptions' => array('data-translation-id'=>'NUMBER_TRANSLATION_SIP_HEADER_GRID_HEADER'),
	  'value'=>array($this,'renderSipHeaderInput')
	),
	array(
	  'name'=>'value',
	  'type'=>'raw',
	  'header'=>__('NUMBER_TRANSLATION_SIP_HEADER_GRID_VALUE'),
	  'headerHtmlOptions' => array('data-translation-id'=>'NUMBER_TRANSLATION_SIP_HEADER_GRID_VALUE'),
	  'value'=>array($this,'renderSipHeaderInput')
	),
	array(
	  'name'=>'new_value',
	  'type'=>'raw',
	  'header'=>__('NUMBER_TRANSLATION_SIP_HEADER_GRID_NEW_VALUE'),
	  'headerHtmlOptions' => array('data-translation-id'=>'NUMBER_TRANSLATION_SIP_HEADER_GRID_NEW_VALUE'),
	  'value'=>array($this,'renderSipHeaderInput'),
	),
	array(
                'class'=>'bootstrap.widgets.TbButtonColumn',                
                'htmlOptions'=>array(
                    'class'=>'buttonColumnIcons',
                    'style'=>'width:55px;cursor: pointer;',
                    'title'=>__("GRID_DELETE_TOOLTIP"),
                    'data-translation-id'=>"GRID_DELETE_TOOLTIP"
                ),
                'template'=>'{delete}',
                'buttons'=>array(
                    'delete'=>array(
                        'url'=>'',
                        'label'=>"",
                        'click'=>'js:function() {
                                    $(this).parent().find(".tooltip-inner").remove();
                                    $(this).parent().find(".tooltip-arrow").remove();
                                    removeSipHeader(this);
                                    return false;
                        }',
                    ),
                ),
            'footer'=>'<span class="icon-plus addMember" style="cursor: pointer;"
                    id="add_sipheader"
                    data-toggle="tooltip" title="'.__("NUMBER_TRANSLATION_ADD_NEW_RULE").'"
                    data-translation-id="NUMBER_TRANSLATION_ADD_NEW_RULE">
                    </span>',
            ),
    )
  )
);
?>
<style>
.hideRow {
  display:none;
}
</style>
<script>
var firstRule = $('#sip-header-grid tbody tr').first();
$('#add_sipheader').click(function(){
  
  $('#sip-header-grid > table').append(firstRule.clone().addClass('new-item-animated'));
  updateSipGridInputFields();
})
</script>