
<?php $__env->startSection('title', 'Registrar Avaluo'); ?>
<?php $__env->startSection('style'); ?>
<style type="text/css" media="screen">
    .chosen-container{
        width: 100% !important;
        font-size: 10px !important;

    }

    .chosen-container-single .chosen-search input[type="text"]{
        width: 80%;
        font-size: 10px !important;
    }

    .chosen-search-input{
        font-size: 10px !important;
    }

    table .form-control, table .chosen-container, table .select{
        font-size: 10px !important;
        line-height: 1.25 !important;
    }

    .chosen-container-single .chosen-single div:after{
        left: -0.1rem !important;
        height: 1.5rem !important;
    }
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="col-sm-12 col-md-7 col-lg-10 col-xl-10">
    <h3 class="text-center titulo">Avaluo</h3>
    <div class="form-group row sin-salto">
        <div class="col-sm-2 col-md-2 col-lg-1 col-xl-1 superior">
            <a class="btn-sm btn-primary cursor" href="<?php echo e(route('infoPredio', encrypt($predio->id_unico))); ?>" title="Volver"><i class="fa fa-arrow-left"></i></a>
        </div>
        <div class="col-sm-9 col-md-9 col-lg-10 col-xl-10">
            <h6 class="text-center marca-pagina"><?php echo e("Predio: ".ucwords(mb_strtolower($predio->nombre))); ?></h6>
        </div>
    </div>
    <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 superior2 tamaño-letra">
        <table class="table table-striped table-condensed table-bordered" id="table" data-toggle="dataTable" data-form="deleteForm">
            <thead>
                <tr>
                    <th>Año</th>
                    <th>Tarifa</th>
                    <th>Indicador</th>
                    <th>Valor</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <form id="form-table" method="post" accept-charset="utf-8" action="<?php echo e(route('GuardarAvaluo')); ?>" novalidate="">
                        <?php echo e(csrf_field()); ?>

                        <input type="hidden" name="txtPredio" value="<?php echo e(encrypt($predio->id_unico)); ?>">
                        <td>
                            <input class="form-control" type="text" name="txtAnno" id="txtAnno" placeholder="Año" title="Ingrese año" style="width: 80%;" onkeypress="return txtValida(event,'num')" readonly="" required="">
                        </td>
                        <td>
                            <select name="sltTarifa" id="sltTarifa" class="form-control select" title="Tarifa" required="">
                                <option value="">Tarifa</option>
                                <?php $__currentLoopData = $tarifas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($row->id_unico); ?>"><?php echo e("$row->codigotarifa $row->nombre ($row->anio)"); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </td>
                        <td>
                            <div class="form-check form-check-inline">
                                <label for="optInd1" class="form-check-label" id="lblOpt1">
                                    <input type="radio" name="optIndicador" id="optInd1" value="0" required="">Si
                                </label>
                            </div>
                            <div class="form-check form-check-inline">
                                <label for="optInd2" class="form-check-label" id="lblOpt2">
                                    <input type="radio" name="optIndicador" id="optInd2" value="1">No
                                </label>
                            </div>
                        </td>
                        <td>
                            <input class="form-control" type="text" id="txtValor" name="txtValor" title="Ingrese valor" placeholder="Valor" onkeypress="return txtValida(event, 'num')" required="" style="width: 80%;">
                        </td>
                        <td>
                            <button type="submit" id="submit" class="btn-sin icons cursor fa fa-save"></button>
                        </td>
                    </form>
                </tr>
                <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($row->anno); ?></td>
                        <td><?php echo e($row->anio." - ".$row->nombre); ?></th>
                        <td>
                            <?php if($row->indicador == 0): ?>
                                <?php echo e("Si"); ?>

                            <?php else: ?>
                                <?php echo e("No"); ?>

                            <?php endif; ?>
                        </td>
                        <td><?php echo e(number_format($row->valor,2, '.', ',')); ?></th>
                        <td></td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
    $("#form-table").on('submit', function(e){
        var anno  = $("#txtAnno").val();
        var tarf  = $("#sltTarifa").val();
        var indc  = $("input[name='optIndicador']").val();
        var valr  = $("#txtValor").val();

        if(anno.length > 0){
            $("#txtAnno").removeClass('is-invalid');
        }else{
            e.preventDefault();
            $("#txtAnno").addClass('is-invalid').removeClass('is-valid');
        }

        if(tarf.length > 0){
            $("#sltTarifa_chosen").removeClass('borde-error');
        }else{
            e.preventDefault();
            $("#sltTarifa_chosen").addClass('borde-error');
        }

        if($("input[name='optIndicador']").is(':checked')){
            $("#lblOpt1").removeClass("text-danger");
            $("#lblOpt2").removeClass("text-danger");
        }else{
            e.preventDefault();
            $("#lblOpt1").addClass("text-danger");
            $("#lblOpt2").addClass("text-danger");
        }

        if(valr.length > 0){
            $("#txtValor").removeClass('is-invalid');
        }else{
            e.preventDefault();
            $("#txtValor").addClass('is-invalid').removeClass('is-valid');
        }
    });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout_forms', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>