<?php

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});

$('.search-form form').submit(function(){
	$('#pagos-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
        
     
});
");


Yii::app()->clientScript->registerScript('re-install-date-picker', "
$.datepicker(jQuery.extend());
$.datepicker.setDefaults($.datepicker.regional['es']);

");
Yii::app()->clientScript->registerScript('re-install-date-picker', "
function reinstallDatePicker(id, data) {
    $('#desde').datepicker(jQuery.extend({showMonthAfterYear:true},jQuery.datepicker.regional['es']));

}
");

 


?>

<div class="row">
  
    <div class="col-12  col-sm-12 col-md-3"  style="margin-left: 23px;">
        <?php
        $pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
        echo
        'Ver ' .
         CHtml::dropDownList('pageSize', $pageSize, Utility::listaPageSize(), array(
            'class'=>'p-2 border-primary text-primary',
            'onchange' => "$.fn.yiiGridView.update('pagos-grid',{ data:{pageSize: $(this).val() }})",
        ))
         . ' Registros';
        ?>
    </div> 
    
    
    <div class="col-12  col-sm-12 col-md-8 text-right"  style="margin-right: 25px;" >
    
        

     <?php echo CHtml::link('<i class="fas fa-sync fa-lg"></i>', 
             '#', 
             array('class'=>'btn btn-danger',
                 'onClick' => 'window.location="' . Yii::app()->createUrl('pagos/borrado') . '"; ',
                 'data-toggle' => "tooltip",
                 'data-original-title' => 'REFRESCAR LISTA'
                 )); 
     ?>   
    </div>
</div>





<div class='table-responsive'>   
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'pagos-grid',
	'dataProvider'=>$model->borrado(),
        'pager' => array('cssFile' => Yii::app()->baseUrl.'/public/css/tablas.css'),
	'afterAjaxUpdate' => 'reinstallDatePicker',  
        'filter'=>$model,
	'columns'=>array(
               array(
                    'header'=>'ID',
                    'name' => 'id_pago',
                    'value' => '$data->id_pago',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
             array(
                    'header'=>'NUM.OPE',
                    'name' => 'num_operacion',
                    'value' => '$data->num_operacion',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
            
            array(
			'name' => 'fecha',
                        'value'=>  'Utility::fecha($data->fecha)',
			'filter' => $this->widget(
                                'zii.widgets.jui.CJuiDatePicker', array(
				'model'=>$model, 
				'attribute'=>'fecha', 
				'language' => 'es',
				'htmlOptions' => array(
					'id' => 'desde',
					'size' => '10',
                                  'autocomplete'=>"off" 
				),
				'defaultOptions' => array(  
					'showOn' => 'focus', 
					'dateFormat'=>'yy-mm-dd',
					'showOtherMonths' => true,
					'selectOtherMonths' => true,
					'changeMonth' => true,
					'changeYear' => true,
					'showButtonPanel' => true,
				)
			), 
			true), 
		),
            
             array(
                    'header'=>'HORA',
                    'name' => 'hora',
                    'value' => '$data->hora',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
              
                array(
                   'header' =>'FOTO',
                    'filter' =>false,
                    'value' => 'CHtml::link(CHtml::image(Yii::app()->request->baseUrl."/upload/".$data->imagen,"", array("width" =>"25")),Yii::app()->request->baseUrl."/upload/".$data->imagen, array("target"=>"_blank"))  ',
                    'type' => 'raw',
                    'name' => 'imagen',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            
            array(
                'header' => 'IMPRIMIR',
                'class' => 'CButtonColumn',
                'htmlOptions' => array('width' => '100', 'class' => 'text-center'),
                    'template' => '{pdf}',
                    'buttons' => array(
                       'pdf' => array(
                            'label' => '',
                            'url' => 'Yii::app()->controller->createUrl("Recibo",array("id"=>$data->id_pago))',
                            'options' => array(
                                'data-toggle' => 'tooltip',
                                'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                                'data-original-title' => 'IMPRIMIR RECIBO',
                                'target'=>'_black',
                            ),
                            'visible' => 'true',
                        ),
                    ),
                ),
            
            
                array(  
                'header'=>'USUARIO ELIMINO',
                'filter'=> Usuario::lista2(),
                'value' => 'Usuario::Descripcion($data->id_usuario_eliminador)',
                'type' => 'text',
                'name' => 'id_usuario_eliminador',
                ),
          
            array(   'header'=>'FECHA ELIMINO',
                    'name' => 'fecha_eliminaacion',
                    'value' => '$data->fecha_eliminaacion',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
            
            array(
                    'name' => 'dni',
                    'value' => '$data->dni',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
                array(
                    'name' => 'nombre',
                    'value' => '$data->nombre',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
                array(
       
                    'name' => 'apellido',
                    'value' => '$data->apellido',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
            
             
            
            
          
            
            
            
            
                 
       
               
            
         
            
            
           
            

	),
)); ?>
</div> 


             
      