<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<?php $this->load->view('template/head.php'); ?>
<?php $this->load->view('template/header_admin.php'); ?>
<style>
    body {background: #ffffff !important;}
    .profile-header-img > img.img-circle {
        width: 113px;
        height: 124PX;
        border: 2px solid #FC873A;
    }
    .profile-header-container-asign {
        background-color: rgb(252, 135, 58);
    }
</style>
<section class="row contenedor-titulo">
    <h3 class="titulo"><?= $titulo ?></h3> 
</section>
<section class="row contenedor">
    <?php
     $form_data         = [
       'name'       => 'asign_form',
       'id'         => 'asign-form',
       'class'      => 'asign-form',
       'novalidate' => '',
     ];
     $attributes_labels = ['class' => 'control-label'];
    ?>
    <?= form_open(base_url('listas/asignar_candidatos'), $form_data); ?>
    <?= form_hidden('ID_LISTA', $id_lista) ?>
    <?= form_hidden('TEXT_TIPLIST', $tipo_lista) ?>
    <fieldset>
        <?php if (isset($asignados)): ?>
             <h4 class="text-success">Candidatos que tiene asignados</h4>
             <?php foreach ($asignados as $asignado): ?>
                 <div class="candidato-grid" style="display: inline-block">
                     <label class="voto-area">
                         <div id="foto-candidato" class="candidatos-contenedor" data-toggle="tooltip" 
                              data-placement="bottom" title="<?= $asignado->TEX_PERCAN ?>">
                             <div class="profile-header-container-asign">
                                 <div class="profile-header-img">
                                     <input type="hidden" name="ID_ASIGN[]" value="<?= $asignado->ID_CANDID ?>" disabled="">
                                     <input type="checkbox" value="1" name="IS_ASIGN[]" id="<?= $asignado->ID_CANDID ?>" class="check-candidato check-asign" checked="">
                                     <?= img($asignado->TEX_FOTO, '', ['class' => 'img-responsive img-circle']) ?>
                                     <!-- badge -->
                                     <div class="rank-label-container">
                                         <span class="label label-default rank-label"><?= $asignado->TEX_NOMCAN . ' ' . $asignado->TEX_APECAN ?></span>
                                     </div>
                                 </div>
                             </div> 
                         </div>
                     </label>
                 </div>

             <?php endforeach; ?>
         <?php endif; ?>
    </fieldset>
    <fieldset style="margin-top: 20px;">
        <?php if (@$candidatos): ?>
             <h4 class="text-success">Candidatos Disponibles para asignar</h4>
             <?php foreach ($candidatos as $candidato): ?>
                 <div class="candidato-grid" style="display: inline-block">
                     <label class="voto-area">
                         <div id="foto-candidato" class="candidatos-contenedor" data-toggle="tooltip" 
                              data-placement="bottom" title="<?= $candidato->TEX_PERCAN ?>">
                             <div class="profile-header-container">
                                 <div class="profile-header-img">
                                     <input type="checkbox" value="<?= $candidato->ID_CANDID ?>" name="ID_CANDID[]" id="<?= $candidato->ID_CANDID ?>" class="check-candidato">
                                     <?= img($candidato->TEX_FOTO, '', ['class' => 'img-responsive img-circle']) ?>
                                     <!-- badge -->
                                     <div class="rank-label-container">
                                         <span class="label label-default rank-label"><?= $candidato->TEX_NOMCAN . ' ' . $candidato->TEX_APECAN ?></span>
                                     </div>
                                 </div>
                             </div> 
                         </div>
                     </label>
                 </div>

             <?php endforeach; ?>
         <?php else: ?>
             <h4 class="text-danger">No hay candidatos disponibles para asignar</h4>
        <?php endif; ?>
    </fieldset>
    <div class="boton-submit">
        <div class="input-group">
            <a href="<?php echo base_url('listas') ?>" class="btn btn-danger" style="margin-right: 10px;">Regresar</a>
            <input type="submit" value="Guardar" class="btn btn-default"> 
        </div>  
    </div>
    <?= form_close(); ?>
</section>
<?php
 $data_view['loajs'] = $load_js;
 $this->load->view('template/footer.php', $data_view);
?>