<?php
/* @var $this PreinscripcionController */
/* @var $model Preinscripcion */

$this->breadcrumbs = [
    'Preinscripcions' => ['index'],
    $model->id,
];

$this->menu = [
    ['label' => 'List Preinscripcion', 'url' => ['index']],
    ['label' => 'Create Preinscripcion', 'url' => ['create']],
    ['label' => 'Update Preinscripcion', 'url' => ['update', 'id' => $model->id]],
    ['label' => 'Delete Preinscripcion', 'url' => '#', 'linkOptions' => ['submit' => ['delete', 'id' => $model->id], 'confirm' => 'Are you sure you want to delete this item?']],
    ['label' => 'Manage Preinscripcion', 'url' => ['admin']],
];
?>
<script type="text/javascript">
// When the document is ready
$(document).ready(function () {
    $('#<?= CHtml::activeId($modelSeguimiento, 'fecha_registro_inscripcion'); ?>').datepicker({
        format: "dd-mm-yyyy",
        endDate: "0d",
        todayBtn: "linked",
        // clearBtn: true,
        // multidateSeparator: " ",
        forceParse: false,
        // daysOfWeekDisabled: "0,6",
        orientation: "top auto",
        todayHighlight: true,
        toggleActive: true,
        language:'es',
        autoclose: true
    });

});
</script>
<link rel="stylesheet" type="text/css" href="<?= Yii::app()->request->baseUrl; ?>/css/datepicker.min.css" />
<link rel="stylesheet" type="text/css" href="<?= Yii::app()->request->baseUrl; ?>/css/datepicker3.min.css" />

<script src="<?= Yii::app()->request->baseUrl; ?>/js/bootstrap-datepicker.min.js"></script>
<h3 class="text-center">Aprobar solicitud de preinscripci&oacute;n </h3>
<hr>
<?= CHtml::link('Ir a la bandeja de preinscripción', ['admin'], ['class' => 'btn btn-inverse']); ?>
  <br><br>

<fieldset>
    <legend>Datos del personales</legend>
    <table class="table table-bordered table-striped table-hover items table table-striped table-bordered table-condensed" >
      <tr>
        <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('cedula'); ?></b></td>
        <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('nombre'); ?></b></td>
        <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('apellidos'); ?></b></td>
      </tr> 
      <tr>
        <td style="text-align: justify;"><?= $model->nacionalidad.' '.$model->cedula; ?></td> 
        <td style="text-align: justify"><?= $model->nombre; ?></td>
        <td style="text-align: justify"><?= $model->apellidos; ?></td>
      </tr>
      <tr >
        <td style="text-align: justify; width: 20%;" colspan="2"><b><?= $model->getAttributeLabel('lugarnacimiento'); ?></b></td>
        <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('fechanacimiento'); ?></b></td>
      </tr>
      <tr >
        <td style="text-align: justify" colspan="2"><?= $model->apellidos; ?></td>
        <td style="text-align: justify"><?= date('d-m-Y', strtotime($model->fechanacimiento)); ?></td>
      </tr>
    </table>
</fieldset>
<fieldset>
    <legend>Datos de contacto</legend>
    <table class="table table-bordered table-striped table-hover items table table-striped table-bordered table-condensed" >
      <tr>
        <td style="text-align: justify; width: 20%;" colspan="3"><b><?= $model->getAttributeLabel('dirhabitacion'); ?></b></td>
      </tr>
      <tr>
        <td style="text-align: justify;"  colspan="3"><?= $model->dirhabitacion; ?></td> 
      </tr>
      <tr>
        <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('tlfhabitacion'); ?></b></td>
        <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('celular'); ?></b></td>
        <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('correoelectronico'); ?></b></td>
      </tr>
      <tr>
        <td style="text-align: justify"><?= $model->tlfhabitacion; ?></td>
        <td style="text-align: justify"><?= $model->celular; ?></td>
        <td style="text-align: justify"><?= $model->correoelectronico; ?></td> 
      </tr>
    </table>
</fieldset>
<fieldset>
    <legend>Datos laborales</legend>
        <table class="table table-bordered table-striped table-hover items table table-striped table-bordered table-condensed" >
            <tr>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('lugartrabajo'); ?></b></td>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('estado'); ?></b></td>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('ciudad'); ?></b></td>
            </tr>
            <tr>
                <td style="text-align: justify"><?= $model->lugartrabajo; ?></td>
                <td style="text-align: justify"><?= $model->idEstado ? $model->idEstado->DescripcionEstado : ''; ?></td>
                <td style="text-align: justify"><?= $model->ciudad; ?></td>
            </tr>
            <tr>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('cargo'); ?></b></td>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('tlfoficina'); ?></b></td>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('porcentaje'); ?></b></td>
            </tr>
            <tr>
                <td style="text-align: justify"><?= $model->cargo; ?></td>
                <td style="text-align: justify"><?= $model->tlfoficina; ?></td>
                <td style="text-align: justify"><?= $model->idPorcentaje ? $model->idPorcentaje->descripcion : ''; ?></td>
            </tr>
            <tr>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('oficina'); ?></b></td>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('idunidad'); ?></b></td>
                <td style="text-align: justify; width: 20%;"><b><?= $model->getAttributeLabel('idtipotrabajador'); ?></b></td>
            </tr>
            <tr>
                <td style="text-align: justify"><?= $model->idOficina ? $model->idOficina->descripcion : ''; ?></td>
                <td style="text-align: justify"><?= $model->idUnidad ? $model->idUnidad->descripcion : ''; ?></td>
                <td style="text-align: justify"><?= $model->idTipoTrabajador ? $model->idTipoTrabajador->descripcion : ''; ?></td>
            </tr>
            <tr>
                <td style="text-align: justify; width: 20%;" colspan="3"><b><?= $model->getAttributeLabel('idcategoria'); ?></b></td>
            </tr>
            <tr>
                <td style="text-align: justify"><?= $model->idCategoria ? $model->idCategoria->descripcion : ''; ?></td>
            </tr>
        </table>
</fieldset>
<fieldset>
    <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', [
        'id' => 'preinscripcion-form',
        'enableClientValidation' => false,
    ]) ?>
    <?= $form->errorSummary($modelSeguimiento); ?>
    <div class="alert alert-success">
        <?= $form->textFieldRow($modelSeguimiento, 'fecha_registro_inscripcion', ['readOnly' => 'readOnly']); ?>
        <?= $form->textAreaRow($modelSeguimiento, 'observacion', ['rows' => 6, 'cols' => 50, 'style' => 'width: 100%']); ?>
        <hr />

    <input type="hidden" id="px">
    <div class="text-center">   
        <?php $this->widget('bootstrap.widgets.TbButton', [
            'type' => 'success',
            'buttonType' => 'submit',
            'icon' => 'icon-ok',
            'label' => 'Aprobar solicitud',
            'htmlOptions' => [
                'name' => 'yt0',
                'id' => 'btn_aprobar',
                'onClick' => 'seleccionar("btn_aprobar")',
            ],
        ]); ?>
        <?php $this->widget('bootstrap.widgets.TbButton', [
            'type' => 'danger',
            'buttonType' => 'submit',
            'label' => 'Denegar solicitud',
            'icon' => 'icon-remove',
            'htmlOptions' => [
                'name' => 'yt1',
                'id' => 'btn_denegar',
                'onClick' => 'seleccionar("btn_denegar")',
            ],
        ]); ?>
    </div>
    </div>
</fieldset>
<?php $this->endWidget(); ?>

<script type="text/javascript">
    function seleccionar(ele) {
        var name = $(`#${ele}`).attr('name')
        $('#px').attr('name', name);
    }

    $("#preinscripcion-form").submit(function (e) {
        $("#btn_aprobar").attr("disabled", true);
        $("#btn_denegar").attr("disabled", true);
        return true;
    });
</script>
