<?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'); ?>
<section>
    <div id="container">
        <h3 class="text-center"><?= $titulo ?></h3>
    </div>
    <div class="row contenedor-form caja-forms">
        <?php
         $form_data         = ['name'       => 'crear_form',
           'id'         => 'crear-form',
           'class'      => 'create-form',
           'novalidate' => '',
         ];
         $attributes_labels = ['class' => 'control-label'];
        ?>
        <?php echo form_open(base_url('participantes/create'), $form_data); ?>
        <?php if (isset($participante)): ?>
             <?= form_hidden('edit', 1) ?>
             <?= form_hidden('NUM_IDETER', $participante->NUM_IDETER) ?>
         <?php endif; ?>
        <div class="col-lg-4 col-md-4">
            <div class="form-group input-type"> 
                <?php echo form_label('Identificación', 'NUM_IDETER', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-key"></i>
                    </div>
                    <?=
                     form_input(['name'     => 'NUM_IDETER', 'type'     => 'number','min'     => 0,
                       'id'       => 'NUM_IDETER', 'class'    => 'form-control',
                       'required' => '', 'value'    => (isset($participante->NUM_IDETER)) ? $participante->NUM_IDETER : ''])
                    ?>   
                </div>
            </div> 
            <div class="form-group input-type"> 
                <?php echo form_label('Nombre del Participante', 'TEX_NOMPAR', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-user"></i>
                    </div>
                    <?=
                     form_input(['name'     => 'TEX_NOMPAR',
                       'id'       => 'TEX_NOMPAR', 'class'    => 'form-control uppercase',
                       'required' => '', 'onkeyup'  => 'uppercase(this.id);',
                       'value'    => (isset($participante->TEX_NOMPAR)) ? $participante->TEX_NOMPAR : ''])
                    ?>   
                </div>
            </div>
            <div class="form-group input-type"> 
                <?php echo form_label('Email', 'TEX_MAIL', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-inbox"></i>
                    </div>
                    <?=
                     form_input(['name'  => 'TEX_MAIL',
                       'id'    => 'TEX_MAIL', 'class' => 'form-control',
                       'type'  => 'email',
                       'value' => (isset($participante->TEX_MAIL)) ? $participante->TEX_MAIL : ''])
                    ?>   
                </div>
            </div>
        </div>

        <div class="col-lg-4 col-md-4">
            <div class="form-group input-type" style="width: 100%;"> 
                <?php echo form_label('Seleccione la Ciudad', 'COD_CIUDAD', $attributes_labels); ?>
                <div class="input-group" style="width: 100%;">
                    <select name="COD_CIUDAD"  id="COD_CIUDAD" class="form-control" required="required">
                        <option value=" ">Seleccione</option>
                        <?php foreach ($ciudades as $ciudad): ?>
                             <option style="font-weight: bold;"
                                     value="<?= $ciudad->COD_CIUDAD ?>"
                                     <?= ($ciudad->COD_CIUDAD === @$participante->COD_CIUDAD) ? 'selected' : '' ?>>
                                 <?= $ciudad->TEX_NOMCIU ?></option>
                         <?php endforeach; ?>
                    </select> 
                </div>
            </div>
            <!--            <div class="form-group input-type"> 
            <?php // echo form_label('Ciudad', 'TEX_CIUDAD', $attributes_labels); ?>
                            <div class="input-group">
                                <div class="input-group-addon">
                                    <i class="fa fa-map-marker"></i>
                                </div>
                                <input type="hidden" name="COD_CIUDAD"id="COD_CIUDAD" 
            value="<?php // (isset($participante->COD_CIUDAD)) ? $participante->COD_CIUDAD : ''                  ?>">
            <?php
             //form_input(['name'     => 'TEX_CIUDAD',
             // 'id'       => 'TEX_CIUDAD', 'class'    => 'form-control',
             // 'required' => '', 
             // 'value'    => (isset($participante->TEX_NOMCIU)) ? $participante->TEX_NOMCIU : ''])
            ?>  
                            </div>
                        </div> -->


            <div class="form-group input-type">     
                <?php echo form_label('Apellido del Participante', 'TEX_APEPAR', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-user"></i>
                    </div>
                    <?=
                     form_input(['name'     => 'TEX_APEPAR',
                       'id'       => 'TEX_APEPAR', 'class'    => 'form-control uppercase',
                       'required' => '', 'onkeyup'  => 'uppercase(this.id);',
                       'value'    => (isset($participante->TEX_APEPAR)) ? $participante->TEX_APEPAR : ''])
                    ?>   
                </div>
            </div>


            <div class="form-group input-type" style="width: 100%;"> 
                <?php echo form_label('Seleccione la '.$this->session->userdata('NOMBRE_SEGMENTO'), 'COD_AGENCIA', $attributes_labels); ?>
                <div class="input-group" style="width: 100%;">
                    <div class="input-group-addon">
                        <i class="fa fa-map-marker"></i>
                    </div>
                    <select name="COD_AGENCIA"  id="COD_AGENCIA" class="form-control" required="">
                        <option value="">Seleccione</option>
                        <?php foreach ($agencias as $agencia): ?>
                             <option style="font-weight: bold;" value="<?= $agencia->COD_AGENCIA ?>"
                                     <?= ($agencia->COD_AGENCIA === @$participante->COD_AGENCIA) ? 'selected' : '' ?>>
                                 <?= $agencia->TEX_NOMAGE ?></option>
                         <?php endforeach; ?>
                    </select> 
                </div>
            </div> 

        </div>
        <div class="col-lg-4 col-md-4">
            <div class="form-group input-type"> 
                <?php echo form_label('Celular del Participante', 'NUM_TELCEL', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-phone"></i>
                    </div>
                    <?=
                     form_input(['name'  => 'NUM_TELCEL',
                       'id'    => 'NUM_TELCEL', 'class' => 'form-control',
                       'type'  => 'number',
                       'min'     => 0,
                       'value' => (isset($participante->NUM_TELCEL)) ? $participante->NUM_TELCEL : ''])
                    ?>   
                </div>
            </div>
            <div class="form-group input-type"> 
                <?php echo form_label('Contraseña', 'TEX_CLAVE', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-key"></i>
                    </div>
                    <?=
                     form_password([
                       'name'                                        => 'TEX_CLAVE',
                       'id'                                          => 'TEX_CLAVE',
                       'class'                                       => 'form-control',
                       (true) ? '' : 'required' => ''
                     ])
                    ?>    
                    <span class="fa fa-times fa-2x form-control-feedback error-icon" aria-hidden="true"></span>
                </div>
            </div> 

            <div class="form-group input-type"> 
                <?php echo form_label('Confirmación Contraseña', 'RE_TEX_CLAVE', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-key"></i>
                    </div>
                    <?=
                     form_password([
                       'name'                                        => 'RE_TEX_CLAVE',
                       'id'                                          => 'RE_TEX_CLAVE',
                       'class'                                       => 'form-control',
                       (true) ? '' : 'required' => ''
                     ])
                    ?>    
                    <span class="fa fa-times fa-2x form-control-feedback error-icon" aria-hidden="true"></span>
                </div>
            </div> 

           

        </div>
  
    
    
            <div class="col-lg-4 col-md-4">
            <div class="form-group input-type"> 
                <?php echo form_label('Peso voto Participante', 'NUM_PESO', $attributes_labels); ?>
                <div class="input-group">
                    <div class="input-group-addon">
                        <i class="fa fa-user"></i>
                    </div>
                    <?=
                     form_input([
                       'name'  => 'NUM_PESO',
                       'id'    => 'NUM_PESO', 'class' => 'form-control',
                       'type'  => 'number',
                       'min'     => 0,
                       'value' => (isset($participante->NUM_PESO)) ? $participante->NUM_PESO : '1'])
                    ?>   
                </div>
            </div>   
            
            <div class="boton-submit">
                <div class="input-group">
                    <a href="<?php echo base_url($route) ?>" class="btn btn-danger" style="margin-right: 10px;">Regresar</a>
                    <input type="submit" value="Guardar" class="btn btn-default">
                </div>
            </div>
          </div>
          </div>




    <div class="row">
        <div class="col-lg-12 col-md-12 cajas contenedor-enlace-return">
            <a href="<?php echo base_url('participantes') ?>" class="back-link">Regresar a lista de participantes</a>
        </div>
    </div>
    <?php echo form_close(); ?>
</section>
<?php
 $data_view['loajs'] = $load_js;
 $this->load->view('template/footer.php', $data_view);
?>

