EVOLUTION-MANAGER
Edit File: fadbb6b2d7c4c510eac10475040cba526ef4c613.php
<?php $__env->startSection('style'); ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <style> body { /* background-color: #6b6b6b !important; */ font-family: sans-serif !important; } .contact { padding: 4%; } .col-md-3 { /* background: #ff9b00; */ color: #ffff; background: #005393; padding: 10px 20px; border-top-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem; } .contact-info { margin-top: 10%; text-align: center; } .contact-info img { margin-bottom: 15%; } .contact-info h2 { margin-bottom: 10%; } .mr-auto, .mx-auto { margin-right: inherit !important; } .col-md-9 { /* background: #fff; */ /* background-color: #1d67a3; */ background-color: #158bba; padding: 3%; border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem; } .contact-form label { font-weight: 600; } .contact-form button { background: #005393; color: #fff; font-weight: 600; width: max-content; } .contact-form button:focus { box-shadow: none; color: #fff; } .select2-container--default .select2-selection--single { height: 38px; padding: 5px; } .select2-selection__rendered { line-height: 28px !important; } .select2-container .select2-selection--single .select2-selection__rendered { display: block; padding-left: 10px; padding-right: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .modal-de-carga { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background-color: rgba(0, 0, 0, 0.5); } .modal-content-de-carga { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 20px; background-color: white; border-radius: 10px; text-align: center; } .spinner-de-carga { border: 4px solid rgba(0, 0, 0, 0.1); border-left-color: #000; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 20px auto; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style> <?php $__env->stopSection(); ?> <?php $__env->startSection('contenido'); ?> <div class="container contact"> <div class="row"> <div class="col-md-3"> <div class="contact-info"> <img src="https://i.ibb.co/FJNkFjT/sucrense-corazon.png" alt="sucrense-corazon" style="width: 100%;"> <h2>Resgistro</h2> <h4>Ingrese su información correctamente!</h4> </div> </div> <div class="col-md-9"> <div class="contact-form"> <form action="nuevo-registro" method="POST" id="envio_formulario" style="color: #ffff;"> <?php echo csrf_field(); ?> <div class="form-group"> <label class="control-label col-sm-4" for="nombres_apellidos">Nombres y Apellidos</label> <div class="col-sm-10"> <input type="text" class="form-control" id="nombres_apellidos" required placeholder="Ingrese sus nombres" name="nombres_apellidos" value="<?php echo e(old('nombres_apellidos')); ?>"> </div> <?php if($errors->has('nombres_apellidos')): ?> <div class="alert alert-danger" role="alert"> <?php echo e($errors->first('nombres_apellidos')); ?> </div> <?php endif; ?> </div> <div class="form-group"> <label class="control-label col-sm-2" for="cedula">Cédula</label> <div class="col-sm-10"> <input type="text" class="form-control" id="cedula" required placeholder="Ingrese sus cédula" name="cedula" value="<?php echo e(old('cedula', $campo)); ?>"> </div> <?php if($errors->has('cedula')): ?> <div class="alert alert-danger" role="alert"> <?php echo e($errors->first('cedula')); ?> </div> <?php endif; ?> </div> <div class="form-group"> <label class="control-label col-sm-2" for="canton">Cantón</label> <div class="col-sm-10"> <select required class="form-control" id="canton" name="canton"> <option selected>Sucre</option> </select> </div> <?php if($errors->has('canton')): ?> <div class="alert alert-danger" role="alert"> <?php echo e($errors->first('canton')); ?> </div> <?php endif; ?> </div> <div class="form-group"> <label class="control-label col-sm-2" for="parroquia">Parroquia</label> <div class="col-sm-10"> <select required class="form-control" id="parroquia" name="parroquia"> <option selected disabled>Seleccione</option> <?php $__currentLoopData = $parroquias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dato): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option><?php echo e($dato->nombre); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <?php if($errors->has('parroquia')): ?> <div class="alert alert-danger" role="alert"> <?php echo e($errors->first('parroquia')); ?> </div> <?php endif; ?> </div> <div class="form-group"> <label class="control-label col-sm-2" for="barrio">Barrio</label> <div class="col-sm-10"> <select class="form-control" id="barrio" name="barrio"> <option selected disabled>Seleccione</option> </select> </div> <?php if($errors->has('barrio')): ?> <div class="alert alert-danger" role="alert"> <?php echo e($errors->first('barrio')); ?> </div> <?php endif; ?> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">Registrarse</button> </div> </div> </form> </div> </div> </div> </div> <div id="loadingModal" class="modal-de-carga"> <div class="modal-content-de-carga"> <div class="spinner-de-carga"></div> <p>Por favor, espere...</p> </div> </div> <script> function mensaje_alerta(icono, titulo, texto) { Swal.fire({ icon: icono, title: titulo, text: texto, }); } $(document).ready(function() { $('#barrio').select2({ width: '100%' }); }); </script> <?php if(session('status')): ?> <script> mensaje_alerta("success", "<?php echo e(session('status')); ?>", "Creación exitosa"); </script> <?php endif; ?> <?php if($errors->has('error')): ?> <script> mensaje_alerta("error", "Error", "Hubo un error inesperado, intentelo despues"); </script> <?php endif; ?> <?php if($errors->has('barrio') || $errors->has('parroquia') || $errors->has('canton') || $errors->has('cedula') || $errors->has('nombres_apellidos')): ?> <script> mensaje_alerta("error", "Error en la validación", "Revise que los datos que esta enviando sean correctos, recuerde que solo se puede registrar una vez"); </script> <?php endif; ?> <script> $('#parroquia').change(function() { var selectedId = $(this).val(); if (selectedId) { var procesodecargar = document.getElementById('loadingModal'); procesodecargar.style.display = 'block'; $.ajax({ url: 'get-options/' + selectedId, type: 'GET', dataType: 'json', success: function(data) { procesodecargar.style.display = 'none'; $('#barrio').empty(); $('#barrio').append('<option selected disabled>Seleccione</option>'); $.each(data, function(key, value) { $('#barrio').append('<option value="' + value + '">' + value + '</option>'); }); } }); } else { $('#barrio').empty(); $('#barrio').append('<option value="">Seleccione</option>'); } }); document.getElementById('envio_formulario').addEventListener('submit', function(event) { event.preventDefault(); var cedula = document.getElementById('cedula').value; var nombres = document.getElementById('nombres_apellidos').value; var canton = document.getElementById('canton').value; var parroquia = document.getElementById('parroquia').value; var barrio = document.getElementById('barrio').value; if (isValidCI(cedula)) { if (nombres != "" && canton != "" && parroquia != "" && barrio != "") { Swal.fire({ title: "Verifique que su información sea la correcta", html: ` <p><strong>Nombres y Apellidos:</strong> ${nombres}</p> <p><strong>Cédula:</strong> ${cedula}</p> <p><strong>Cantón:</strong> ${canton}</p> <p><strong>Parroquia:</strong> ${parroquia}</p> <p><strong>Barrio:</strong> ${barrio}</p> <p style="color: red">¡Una vez registrada la información no podra volver a registrarse!</p> `, // showDenyButton: true, showCancelButton: true, confirmButtonText: "Guardar", denyButtonText: `No, Guardar` }).then((result) => { if (result.isConfirmed) { this.submit(); } else if (result.isDenied) { Swal.fire("No se ha guardado ninguna información", "", "info"); } }); } } else mensaje_alerta("error", "Número de cedula incorrecto", "Por favor ingrese un número de cédula válido"); }); function isValidCI(ci) { var isNumeric = true; var total = 0, individual; for (var position = 0; position < 10; position++) { // Obtiene cada posición del número de cédula // Se convierte a string en caso de que 'ci' sea un valor numérico individual = ci.toString().substring(position, position + 1) if (isNaN(individual)) { console.log(ci, position, individual, isNaN(individual)) isNumeric = false; break; } else { // Si la posición es menor a 9 if (position < 9) { // Si la posición es par, osea 0, 2, 4, 6, 8. if (position % 2 == 0) { // Si el número individual de la cédula es mayor a 5 if (parseInt(individual) * 2 > 9) { // Se duplica el valor, se obtiene la parte decimal y se aumenta uno // y se lo suma al total total += 1 + ((parseInt(individual) * 2) % 10); } else { // Si el número individual de la cédula es menor que 5 solo se lo duplica // y se lo suma al total total += parseInt(individual) * 2; } // Si la posición es impar (1, 3, 5, 7) } else { // Se suma el número individual de la cédula al total total += parseInt(individual); } } } } if ((total % 10) != 0) { total = (total - (total % 10) + 10) - total; } else { total = 0; } if (isNumeric) { // La cédula debe contener al menos 10 dígitos if (ci.toString().length != 10) return false; // El número de cédula no debe ser cero if (parseInt(ci, 10) == 0) return false; // El total debe ser igual al último número de la cédula if (total != parseInt(individual)) return false; return true; } // Si no es un número return false; } </script> <?php $__env->stopSection(); ?> <?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>