HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux Bradford-Sitios 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/plan-b.bradford/storage/framework/views/4da55b2e899b6e6aee66b8456efc15316d660c65.php
<?php $__env->startSection('contenido'); ?>
    <div class="page-header d-flex align-items-center justify-content-between border-bottom mb-4">
        <h1 class="page-title"><?php echo e(isset($title) ? $title : 'SIN TITULO'); ?></h1>
        <div>
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="<?php echo e(route('parents')); ?>">Gestión de Apoderados</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page"><?php echo e(isset($title) ? $title : 'SIN TITULO'); ?></li>
            </ol>
        </div>
    </div>
    <!-- PAGE-HEADER END -->
    <!-- CONTAINER -->
    <div class="main-container container-fluid">
        <div class="row">
            <div class="col-xl-12 col-sm-12">
                <div class="card p-3 border-20">
                    <div class="card-header bg-light">
                        <h5 class="text-center text-uppercase fs-14" style="margin: 0 auto;">
                            <b><?php echo e(isset($title_form) ? $title_form : 'Formulario de Registro'); ?></b>
                        </h5>
                    </div>
                    <div class="card-body">
                        <form action="<?php echo e(route('parent-store')); ?>" method="POST" id="form">
                            <?php echo e(csrf_field()); ?>

                            <div>
                                <?php if(session()->has('warning_message') || session()->has('danger_message')): ?>
                                    <div class="msg-error alert alert-danger py-2 px-3 mb-3 fs-14 text-center">
                                        <i class="fa fa-exclamation-circle me-2"></i>
                                        <?php echo session()->get('warning_message'); ?><?php echo session()->get('danger_message'); ?>

                                    </div>
                                <?php endif; ?>
                            </div>
                            <div class="row g-3">
                                <div class="col-md-12">
                                    <h6 class="card-header font-12 text-left mt-3 mb-3 p-1" style="border-radius: 0px;">
                                        <b>INFORMACIÓN PERSONAL</b>
                                    </h6>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1" style="margin-bottom: -15px">
                                    <div class="form-group">
                                        <label for="rut">
                                            RUT <span class="text-danger">*</span>
                                        </label>
                                        <input type="text" id="rut" name="rut"
                                            value="<?php echo e(old('rut')); ?>" class="form-control"
                                            placeholder="Ingrese Rut de estudiante...">
                                        <small id="invalid_rut" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-9"></div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="first_name">
                                            PRIMER NOMBRE <span class="text-danger">*</span>
                                        </label>
                                        <input type="text" id="first_name" name="first_name"
                                            value="<?php echo e(old('first_name')); ?>" class="form-control"
                                            placeholder="Ingrese Primer Nombre...">
                                        <small id="invalid_first_name" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="second_name">
                                            SEGUNDO NOMBRE <span class="text-danger"></span>
                                        </label>
                                        <input type="text" id="second_name" name="second_name"
                                            value="<?php echo e(old('second_name')); ?>" class="form-control"
                                            placeholder="Ingrese Segundo Nombre...">
                                        <small id="invalid_second_name" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="last_name">
                                            PRIMER APELLIDO <span class="text-danger">*</span>
                                        </label>
                                        <input type="text" id="last_name" name="last_name"
                                            value="<?php echo e(old('last_name')); ?>" class="form-control"
                                            placeholder="Ingrese Primer Apellido...">
                                        <small id="invalid_last_name" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="second_last_name">
                                            SEGUNDO APELLIDO <span class="text-danger"></span>
                                        </label>
                                        <input type="text" id="second_last_name"
                                            name="second_last_name" value="<?php echo e(old('second_last_name')); ?>"
                                            class="form-control" placeholder="Ingrese Segundo Apellido...">
                                        <small id="invalid_second_last_name" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="relationship">
                                            RELACIÓN CON ALUMNO <span class="text-danger">*</span>
                                        </label>
                                        <select class="form-control select2" id="relationship" name="relationship">
                                            <option value="">Seleccione relación...</option>
                                            <?php $__currentLoopData = $relationships_data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($key->id); ?>"
                                                    <?php echo e(old('relationship') != null && old('relationship') == $key->id ? 'selected' : ''); ?>>
                                                    <?php echo e($key->relationship); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                        <small id="invalid_relationship" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="birth_date" class="font-14">FECHA NACIMIENTO <span
                                                class="text-danger"></span></label>
                                        <input type="date" class="form-control" id="birth_date" autocomplete="off"
                                            name="birth_date" value="<?php echo e(old('birth_date')); ?>">
                                        <small id="invalid_birth_date" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="country" class="font-14">PAÍS NACIMIENTO <span
                                                class="text-danger"></span></label>
                                        <div class="input-group">
                                            <select class="form-control select2" name="country" id="country">
                                                <option value="" class="font-14">Seleccione país...</option>
                                                <?php $__currentLoopData = $countries_data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($key->id); ?>"
                                                        <?php echo e(old('country') != null && old('country') == $key->id ? 'selected' : ''); ?>>
                                                        <?php echo e($key->country); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                        <small id="invalid_country" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="gender" class="font-14">GÉNERO <span
                                                class="text-danger"></span></label>
                                        <div class="input-group">
                                            <select class="form-control select2" name="gender" id="gender">
                                                <option value="" class="font-14">Seleccione género...</option>
                                                <?php $__currentLoopData = $genders_data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($key->id); ?>"
                                                        <?php echo e(old('gender') != null && old('gender') == $key->id ? 'selected' : ''); ?>>
                                                        <?php echo e($key->gender); ?>

                                                    </option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                        <small id="invalid_gender" class="text-danger fs-12"></small>
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <h6 class="card-header font-12 text-left mt-3 mb-3 p-1" style="border-radius: 0px;">
                                        <b>INFORMACIÓN ADICIONAL</b>
                                    </h6>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="email" class="">CORREO ELECTRÓNICO <span
                                                class="text-danger">*</span></label>
                                        <input type="email" id="email" name="email" value="<?php echo e(old('email')); ?>"
                                            class="form-control" placeholder="Ingrese Correo electrónico...">
                                        <small id="invalid_email" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="mobile" class="">CELULAR <span
                                                class="text-danger"></span></label>
                                        <input type="tel" id="mobile" name="mobile" value="<?php echo e(old('mobile')); ?>"
                                            class="form-control" placeholder="Ingrese Celular...">
                                        <small id="invalid_mobile" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="region">REGIÓN <span class="text-danger"></span></label>
                                        <select class="form-control select2" id="region" name="region">
                                            <option value="">Seleccione región...</option>
                                            <?php $__currentLoopData = $regions_data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($key->id); ?>"
                                                    <?php echo e(old('region') != null && old('region') == $key->id ? 'selected' : ''); ?>>
                                                    <?php echo e($key->code); ?> - <?php echo e($key->region); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                        <small id="invalid_region" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="commune">COMUNA <span class="text-danger"></span></label>
                                        <select class="form-control select2" id="commune" name="commune">
                                            <option value="">Seleccione comuna...</option>
                                            <?php $__currentLoopData = $communes_data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($key->id); ?>"
                                                    class="comunas-opt region-id-<?php echo e($key->region_id); ?>"
                                                    <?php echo e(old('commune') != null && old('commune') == $key->id ? 'selected' : ''); ?>>
                                                    <?php echo e($key->commune); ?> - <?php echo e($key->code); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                        <small id="invalid_commune" class="text-danger fs-12"></small>
                                    </div>
                                </div>
                                <div class="col-md-6 col-lg-3 font-14 p-1">
                                    <div class="form-group">
                                        <label for="address">DIRECCIÓN <span class="text-danger"></span></label>
                                        <input type="text" name="address" id="address" class="form-control "
                                            placeholder="Ingrese Direccion. Ej. Rancagua 1234 "
                                            value="<?php echo e(old('address')); ?>">
                                        <small id="invalid_address" class="text-danger fs-12"></small>
                                    </div>
                                </div>

                                <div class="col-12 d-flex justify-content-center border-top">
                                    <div class="btn-box mt-3">
                                        <a href="<?php echo e(route('parents')); ?>" class="btn btn-md btn-secondary">
                                            <i class="fa fa-reply"></i>
                                            Volver
                                        </a>
                                        <button class="btn btn-primary" type="submit" id="btn_submit">
                                            <i class="fa fa-save"></i> Guardar
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('js_content'); ?>
    <?php echo $__env->make('validator-rut', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('validator', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <script nonce="<?php echo e(app('csp_nonce')); ?>">
        const region_id = <?php echo e(old('region') > 0 ? old('region') : 0); ?>;
        const commune_id = <?php echo e(old('commune') > 0 ? old('commune') : 0); ?>;

        // Función para filtrar las comunas basadas en la región seleccionada
        function filterCommunes(regionId) {
            $('#commune').empty(); // Limpia las opciones actuales
            // Agrega la opción predeterminada
            $('#commune').append('<option value="">Seleccione comuna...</option>');
            // Recorre todas las comunas y muestra solo las de la región seleccionada
            let selected = '';
            <?php $__currentLoopData = $communes_data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                if (<?php echo e($key->region_id); ?> == regionId) {
                    selected = <?php echo e($key->id); ?> == commune_id ? 'selected' : '';
                    $('#commune').append(
                        `<option value="<?php echo e($key->id); ?>" ${selected} ><?php echo e($key->commune); ?> - <?php echo e($key->code); ?></option>`
                    );
                }
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            // Recarga select2 después de modificar las opciones
            $('#commune').select2();
        }

        $(document).ready(function() {
            // Inicializa select2
            $('#region').select2();
            $('#commune').select2();
            $('#commune').empty().append('<option value="">Seleccione región para desbloquear...</option>')
                .select2();

            if (region_id > 0) {
                filterCommunes(region_id)
            }
        });
        $('#rut').keyup(function() {
            validateField($('#rut').val(), 'rut', 'rut');
        });

        $('#first_name').keyup(function() {
            validateField($('#first_name').val(), 'first_name', 'names', true);
        });
        $('#second_name').keyup(function() {
            validateField($('#second_name').val(), 'second_name', 'names', false);
        });
        $('#last_name').keyup(function() {
            validateField($('#last_name').val(), 'last_name', 'names', true);
        });
        $('#second_last_name').keyup(function() {
            validateField($('#second_last_name').val(), 'second_last_name', 'names', false);
        });

        $('#relationship').change(function() {
            validateField($('#relationship').val(), 'relationship', 'select', true,
                'Seleccione relación con alumno...');
        });

        $('#birth_date').blur(function() {
            validateField($('#birth_date').val(), 'birth_date', 'date', false, 'ingrese fecha válida');
        });

        $('#country').change(function() {
            validateField($('#country').val(), 'country', 'select', false,
                'Seleccione país de nacimiento...');
        });

        $('#gender').change(function() {
            validateField($('#gender').val(), 'gender', 'select', false,
                'Seleccione genero...');
        });

        $('#email').keyup(function() {
            validateEmail($('#email').val(), 'email', 'Ingrese un Correo Válido')
        });
        $('#mobile').keyup(function() {
            validateField($('#mobile').val(), 'mobile', 'mobile', false);
        });

        // Validación del campo commune
        $('#commune').change(function() {
            validateField($('#commune').val(), 'commune', 'select', true, 'Seleccione comuna...');
        });

        // Cambia las opciones visibles de comuna según la región seleccionada
        $('#region').change(function() {
            var regionId = $(this).val();

            // Si se selecciona una región válida
            if (regionId > 0) {
                filterCommunes(regionId);
                $('#commune').focus();
                validateField($('#commune').val(), 'commune', 'select', true, 'Seleccione comuna...');
            } else {
                // Si no se selecciona una región válida, muestra solo la opción predeterminada
                $('#commune').empty().append('<option value="">Seleccione región para desbloquear...</option>')
                    .select2();
                validateField($('#commune').val(), 'commune', 'select', false, 'Seleccione comuna...');
            }
        });

        $('#address').keyup(function() {
            validateField($('#address').val(), 'address', 'text_min', false);
        });




        $("#form").submit(function(e) {
            e.preventDefault();
            let rut = validateField($('#rut').val(), 'rut', 'rut');
            let first_name = validateField($('#first_name').val(), 'first_name', 'names', true);
            let second_name = validateField($('#second_name').val(), 'second_name', 'names', false);
            let last_name = validateField($('#last_name').val(), 'last_name', 'names', true);
            let second_last_name = validateField($('#second_last_name').val(), 'second_last_name', 'names', false);
            let relationship =  validateField($('#relationship').val(), 'relationship', 'select', true,
            'Seleccione relación con alumno...');
            let birth_date = validateField($('#birth_date').val(), 'birth_date', 'date', false,
                'ingrese fecha válida');
            let country = validateField($('#country').val(), 'country', 'select', false,
                'Seleccione país de nacimiento...');
            let gender = validateField($('#gender').val(), 'gender', 'select', false, 'Seleccione genero...');
            let region = validateField($('#region').val(), 'region', 'select', false, 'Seleccione region...');
            let commune = 1;
            if ($("#region").val() > 0) {
                commune = validateField($('#commune').val(), 'commune', 'select', true, 'Seleccione comuna...');
            }
            let address = validateField($('#address').val(), 'address', 'text_min', false);
            let email = validateEmail($('#email').val(), 'email', 'Ingrese un Correo Válido')
            let mobile = validateField($('#mobile').val(), 'mobile', 'mobile', false);
            if (rut && first_name && second_name && last_name && second_last_name && relationship &&
                birth_date && country && gender && region && commune && address &&
                email && mobile) {
                $("#btn_submit").attr('disabled', true);
                $("#btn_submit").html(
                    `<span class="spinner-border spinner-border-sm" id="sign_spinner"></span> Validando...`);
                setTimeout(function() {
                    document.getElementById("form").submit();
                }, 400);
            } else {
                toastr["error"](`Se encontraron 1 o más Campos con Problemas. Corrija e Intente nuevamente`,
                    "Error de Validación")
            }
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.layout_admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/plan-b.bradford/resources/views/admin/parents/parents_new.blade.php ENDPATH**/ ?>