<?php
/* @var $this PrestamoController */
/* @var $model Prestamo */
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#prestamo-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<style>
    #titulo{
    font-size: 1.4rem;
    }

@media screen and (max-width:780px) and (min-width:300px) {  
    
    #titulo{
    font-size: 1.0rem;
    }

    .table-responsive{
    width: 132%;
    margin-left: -40px;
    }
    
    #a{
        overflow-x: auto;
    }
    
}   
    


</style>








    
  <div class="row justify-content-end">
 
    <div class="col-12  col-sm-12 col-md-8 text-right"  style="margin-right: 25px;" >
     
         <?php
                         $this->widget('booster.widgets.TbButton', array(
                        'context'=>'info',
                  
                          'label' => 'BUSCAR',
                                            'icon' => 'fa fa-search',
                                            'htmlOptions' => array(
                                                'class' => 'search-button ',
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'BUSCAR',
                                        
                                            ),
                                            'url' => '#',
                     ));
                     ?>     
        
        
 <?php echo CHtml::link('<i class="fa fa-file-pdf fa-lg"></i>  PDF', 
             Yii::app()->createUrl('prestamo/Carterapdfc'), 
             array('class'=>'btn btn-danger',
                 'data-toggle' => "tooltip",
                 'data-original-title' => 'PDF',
                   "target"=>"_blank"
                 )); 
     ?>     

    <?php echo CHtml::link('<i class="fa fa-file-pdf fa-lg"></i> EXCEL', 
             Yii::app()->createUrl('prestamo/Carteraexcelc'), 
             array('class'=>'btn btn-success',
                 'data-toggle' => "tooltip",
                 'data-original-title' => 'EXPORTAR A EXCEL',
                 'style'=>'background-color:#066100;'
                 
                 )); 
     ?> 

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

                


   </div>

 

<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() }})",
        ))
         . ' Cartera';
        ?>
    </div> 
</div>

<div class="search-form" style="display:none">
<?php $this->renderPartial('_cancelados',array(
	'model'=>$model,
)); ?>
</div>    
    
    
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'prestamo-grid',
	'dataProvider'=>$model->searchCarteracancelados(),
        '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(
                    'filter' =>Gestor::lista3(),
                    'value' => '$data->gestor',
                    'type' => 'text',
                    'name' => 'gestor',
                    'htmlOptions' => array( 'class' => 'text-center    '),
                ),
          /*
             array(

                    'value' => '$data->dia_prestamo',
                    'type' => 'text',
                    'name' => 'dia_prestamo',
                    'htmlOptions' => array( 'class' => 'text-center    '),
                ),
            */
            array(
                   'header'=>'ZONA',
                    'filter' => Zona::lista2(),
                    'value' => '$data->zona',
                    'type' => 'text',
                    'name' => 'zona',
                    'htmlOptions' => array( 'class' => 'text-center    '),
                ),
            array(
                   'header'=>'ESTATUS',
                    'filter' =>Prestamo::listaEstatus(),
                    'value' => 'Prestamo::estatusClass($data->estatus)',
                    'type' => 'html',
                    'name' => 'estatus',
                    '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(
                   'header'=>'CELULAR',
                    'value' => '$data->celular',
                    'type' => 'text',
                    'name' => 'celular',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
      /*
            array(
                   'header'=>'DURACION',
                    'filter'=>Duracion::lista(),  
                    'value' => '$data->id_duracion',
                    'type' => 'text',
                    'name' => 'id_duracion',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            */
            
            
            array(
                   'header'=>'NrºPAGOS',
                    'value' => '$data->cuotas_pagadas',
                    'type' => 'text',
                    'name' => 'cuotas_pagadas',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            /*
            array(
                   'header'=>'SOLES',
                    'value' => '$data->total',
                    'type' => 'text',
                    'name' => 'total',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),*/
            array(
                   'header'=>'NrºATRAZOS',
                    'value' => '$data->atrasos',
                    'type' => 'text',
                    'name' => 'atrasos',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            array(
                   'header'=>'CREDITO',
                    'value' => '$data->id_monto',
                    'type' => 'text',
                    'name' => 'id_monto',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            
                array(
                   'header'=>'CUOTA',
                    'value' => '$data->cuota',
                    'type' => 'text',
                    'name' => 'cuota',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
                /*
            array(
                   'header'=>'PAGAR',
                    'value' => '$data->pagar',
                    'type' => 'text',
                    'name' => 'pagar',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            */
            array(
                   'header'=>'DEBE',
                    'value' => '$data->debe',
                    'type' => 'text',
                    'name' => 'debe',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            
            
              array(
                   'header'=>'FECHA',
                    'value' => '$data->cuotas_pagadas=="0"?null:Utility::fecha($data->fecha_ultimo_pago)',
                    'type' => 'text',
                    'name' => 'fecha_ultimo_pago',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            
                array(
                   'header'=>'SALDO',
                    'value' => '$data->monto_ultimo_pago',
                    'type' => 'text',
                    'name' => 'monto_ultimo_pago',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            

       
            
            
            array(
                   'header'=>'DIRECCION',
                    'value' => '$data->direccion',
                    'type' => 'text',
                    'name' => 'direccion',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            
            array(
                   'header'=>'MZ',
                    'value' => '$data->mz',
                    'type' => 'text',
                    'name' => 'mz',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
            array(
                   'header'=>'LT',
                    'value' => '$data->lt',
                    'type' => 'text',
                    'name' => 'lt',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
       /*
                array(
                   'header'=>'Num.Renovacion',
                    'value' => '$data->num',
                    'type' => 'text',
                    'name' => 'num',
                    'htmlOptions' => array( 'class' => 'text-center'),
                ),
                */
            
		
	),

)); 

?>





         
    
