<?php
/* @var $this PrestamoController */
/* @var $model Prestamo */

?>

            
            
            <div class="row">
    <div class="col-12 ">
        <?php
        $pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
        echo
        'Ver ' .
         CHtml::dropDownList('pageSize', $pageSize, Utility::listaPageSize(), array(
            'onchange' => "$.fn.yiiGridView.update('prestamo-grid',{ data:{pageSize: $(this).val() }})",
        ))
         . ' Prestamos';
        ?>
    </div> 
</div>


<script>
    
    function app(elem){
        
        var url = $(elem).attr("href");
        var div = url.split("/");
        url = url + '?apk=' + div[3];
        $(elem).attr("href",url);
        return false;
    }
    
</script>



<div class='table-responsive'>   


<?php if(!empty($_SESSION['id_perfil']) and ($_SESSION['id_perfil'] != '1') ): ?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'prestamo-grid',
	'dataProvider'=>$model->searchEstadoscuenta(),
        'pager' => array('cssFile' => Yii::app()->baseUrl.'/public/css/tablas.css'),
	'filter'=>$model,
	'columns'=>array(
                array(
                    'filter' =>false,
                    'value' => '$data->id_prestamo',
                    'type' => 'text',
                    'name' => 'id_prestamo',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
                array(
                    'value' => '$data->num',
                    'type' => 'text',
                    'name' => 'num',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            
                array(
                    'filter' =>  Gestor::lista(),
                    'value' => '$data->gestor',
                    'type' => 'text',
                    'name' => 'id_gestor',
                    'htmlOptions'=>array('class'=>"text-center")
                ),




               array(
                    'header'=>'DNI',
                    'value' => '$data->dni',
                    'type' => 'text',
                    'name' => 'dni',
                     'htmlOptions'=>array('class'=>"text-center")
                ),
            array(
                    'header'=>'NOMBRES',
                    'value' => '$data->nombre',
                    'type' => 'text',
                    'name' => 'nombre',
                     'htmlOptions'=>array('class'=>"text-center")
                ),
    
            array(
                    'header'=>'APELLIDOS',
                    'value' => '$data->apellido',
                    'type' => 'text',
                    'name' => 'apellido',
                     'htmlOptions'=>array('class'=>"text-center")
                ),
 array(
                    'filter'=>  Prestamo::listaEstatus(),
                    'name' => 'estatus',
                    'value' => '$data->estatus',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
            
      array(
            'header' => 'ESTADO',
            'class' => 'CButtonColumn',
        'htmlOptions' => array( 'class' => 'text-center'),
            'template' => '{pdf}',
            'buttons' => array(
               'pdf' => array(
                    'label' => '',
                    'url' => 'Yii::app()->controller->createUrl("Pdfestados",array("id"=>$data->id_prestamo))',
                    'options' => array(
                        'data-toggle' => 'tooltip',
                        'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                        'data-original-title' => 'GENERAR ESTADO DE CUENTA',
    
                        'target'=>'_black'
                    ),
                    'visible' => 'true',
                ),

            ),
        ),
        
     
      array(
            'header' => 'ESTADO ANDROID',
            'class' => 'CButtonColumn',
        'htmlOptions' => array( 'class' => 'text-center'),
            'template' => '{pdf}',
            'buttons' => array(
               'pdf' => array(
                    'label' => '',
                    'url' => 'Yii::app()->controller->createUrl("Pdfestados",array("id"=>$data->id_prestamo))',
                    'options' => array(
                        'data-toggle' => 'tooltip',
                        'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                        'data-original-title' => 'GENERAR ESTADO DE CUENTA',
                        'onclick' => 'app(this)',
                        'target'=>'_black'
                    ),
                    'visible' => 'true',
                ),

            ),
        ),
        
        
array(
            'header' => 'ADMINISTRACION',
            'class' => 'CButtonColumn',
        'htmlOptions' => array( 'class' => 'text-center'),
            'template' => '{pdf}',
            'buttons' => array(
               'pdf' => array(
                    'label' => '',
                    'url' => 'Yii::app()->controller->createUrl("Pdfestado",array("id"=>$data->id_prestamo))',
                    'options' => array(
                        'data-toggle' => 'tooltip',
                        'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                        'data-original-title' => 'GENERAR ESTADO DE CUENTA',
    
                        'target'=>'_black'
                    ),
                    'visible' => 'true',
                ),

            ),
        ),
	),
)); ?>

<?php else: ?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'prestamo-grid',
	'dataProvider'=>$model->searchEstadoscuenta(),
        'pager' => array('cssFile' => Yii::app()->baseUrl.'/public/css/tablas.css'),
	'filter'=>$model,
	'columns'=>array(
                array(
                    'filter' =>false,
                    'value' => '$data->id_prestamo',
                    'type' => 'text',
                    'name' => 'id_prestamo',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
                array(
                    'value' => '$data->num',
                    'type' => 'text',
                    'name' => 'num',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            
                array(
                    'filter' =>  Gestor::lista(),
                    'value' => '$data->gestor',
                    'type' => 'text',
                    'name' => 'id_gestor',
                    'htmlOptions'=>array('class'=>"text-center")
                ),




               array(
                    'header'=>'DNI',
                    'value' => '$data->dni',
                    'type' => 'text',
                    'name' => 'dni',
                     'htmlOptions'=>array('class'=>"text-center")
                ),
            array(
                    'header'=>'NOMBRES',
                    'value' => '$data->nombre',
                    'type' => 'text',
                    'name' => 'nombre',
                     'htmlOptions'=>array('class'=>"text-center")
                ),
    
            array(
                    'header'=>'APELLIDOS',
                    'value' => '$data->apellido',
                    'type' => 'text',
                    'name' => 'apellido',
                     'htmlOptions'=>array('class'=>"text-center")
                ),
 array(
                    'filter'=>  Prestamo::listaEstatus(),
                    'name' => 'estatus',
                    'value' => '$data->estatus',
                    'type' => 'text',
                    'htmlOptions' => array('class' => 'text-center'),
                ),
            
      array(
            'header' => 'ESTADO',
            'class' => 'CButtonColumn',
        'htmlOptions' => array( 'class' => 'text-center'),
            'template' => '{pdf}',
            'buttons' => array(
               'pdf' => array(
                    'label' => '',
                    'url' => 'Yii::app()->controller->createUrl("Pdfestados",array("id"=>$data->id_prestamo))',
                    'options' => array(
                        'data-toggle' => 'tooltip',
                        'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                        'data-original-title' => 'GENERAR ESTADO DE CUENTA',
    
                        'target'=>'_black'
                    ),
                    'visible' => 'true',
                ),

            ),
        ),
        
     
      array(
            'header' => 'ESTADO ANDROID',
            'class' => 'CButtonColumn',
        'htmlOptions' => array( 'class' => 'text-center'),
            'template' => '{pdf}',
            'buttons' => array(
               'pdf' => array(
                    'label' => '',
                    'url' => 'Yii::app()->controller->createUrl("Pdfestados",array("id"=>$data->id_prestamo))',
                    'options' => array(
                        'data-toggle' => 'tooltip',
                        'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                        'data-original-title' => 'GENERAR ESTADO DE CUENTA',
                        'onclick' => 'app(this)',
                        'target'=>'_black'
                    ),
                    'visible' => 'true',
                ),

            ),
        ),
        
                array(
            'header' => 'TARJETA',
            'class' => 'CButtonColumn',
            'htmlOptions' => array( 'class' => 'text-center'),
            'template' => '{pdf}',
            'buttons' => array(
               'pdf' => array(
                    'label' => '',
                    'url' => 'Yii::app()->controller->createUrl("tarjeta",array("id"=>$data->id_prestamo))',
                    'options' => array(
                        'data-toggle' => 'tooltip',
                        'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                        'data-original-title' => 'TARJETA DE PAGOS',
    
                        'target'=>'_black'
                    ),
                    'visible' => 'true',
                ),

            ),
        ),
        
        
array(
            'header' => 'ADMINISTRACION',
            'class' => 'CButtonColumn',
        'htmlOptions' => array( 'class' => 'text-center'),
            'template' => '{pdf}',
            'buttons' => array(
               'pdf' => array(
                    'label' => '',
                    'url' => 'Yii::app()->controller->createUrl("Pdfestado",array("id"=>$data->id_prestamo))',
                    'options' => array(
                        'data-toggle' => 'tooltip',
                        'class' => ' fa fa-file-pdf fa-lg mr-3 text-danger',
                        'data-original-title' => 'GENERAR ESTADO DE CUENTA',
    
                        'target'=>'_black'
                    ),
                    'visible' => 'true',
                ),

            ),
        ),
	),
)); ?>

<?php endif; ?> 

</div>








        
