EVOLUTION-MANAGER
Edit File: crear-rendicion.js
function agregar_anio() { const select = document.getElementById('sel1'); const anio = select.value; document.getElementById('anio').value = anio; } //resetear inputs const anio = document.getElementById('anio'); anio.addEventListener('input', function () { anio.value = ""; }); // Función para actualizar el contador de caracteres function actualizarContador() { var maximo = 260; var textarea = document.getElementById('titulo'); if (textarea.value.length >= maximo) { textarea.value = textarea.value.substring(0, maximo); } var caracteresRestantes = maximo - textarea.value.length; document.getElementById('caracteres-restantes').textContent = caracteresRestantes; } // Llama a la función al cargar la página para establecer el contador inicial window.onload = function() { actualizarContador(); }; document.getElementById('formulario-crear-rendicion').addEventListener('submit', function (e) { e.preventDefault(); var formulario = document.getElementById('formulario-crear-rendicion'); var fecha = document.getElementById('anio').value; var titulo = document.getElementById('titulo').value; var documento = document.getElementById('cargar'); // if (fecha != "" && documento.files.length > 0 && titulo != "") { formulario.submit(); const loadingModal = document.getElementById('loadingModal'); loadingModal.style.display = 'block'; // } else { // mensaje_de_alerta("error", "Llene todos los campos solicitados",); // } }); function cambios_id(e, i) { var input = document.getElementById("cargar" + i); var show_archivos = document.getElementById("documentos-cargados" + i); const fileshow = (filename, filetype) => { let container = document.createElement('div'); container.className = 'mostrar-archivos'; let leftdiv = document.createElement('div'); leftdiv.className = 'left'; let filespan = document.createElement('span'); filespan.className = 'tipo-archivo'; filespan.textContent = filetype; let fileh3 = document.createElement('h3'); fileh3.textContent = filename; leftdiv.appendChild(filespan); leftdiv.appendChild(fileh3); let rightdiv = document.createElement('div'); rightdiv.className = 'right'; rightdiv.id = 'borrar' + i; let filespan2 = document.createElement('span'); filespan2.innerHTML = '×'; rightdiv.appendChild(filespan2); container.appendChild(leftdiv); container.appendChild(rightdiv); show_archivos.innerHTML = ''; show_archivos.appendChild(container); var borrar = document.getElementById("borrar" + i) borrar.addEventListener("click", () => { }); } if (e.files) { let filename = e.files[0].name; let filetype = e.value.split(".").pop(); fileshow(filename, filetype); } else { input.value = ""; Swal.fire({ icon: "error", title: "Oops...", text: "Debes subir 1 archivo" }); } } var input = document.getElementById("cargar"); var show_archivos = document.getElementById("documentos-cargados"); input.addEventListener("change", (e) => { const fileshow = (filename, filetype) => { let container = document.createElement('div'); container.className = 'mostrar-archivos'; let leftdiv = document.createElement('div'); leftdiv.className = 'left'; let filespan = document.createElement('span'); filespan.className = 'tipo-archivo'; filespan.textContent = filetype; let fileh3 = document.createElement('h3'); fileh3.textContent = filename; leftdiv.appendChild(filespan); leftdiv.appendChild(fileh3); let rightdiv = document.createElement('div'); rightdiv.className = 'right'; rightdiv.id = 'borrar'; let filespan2 = document.createElement('span'); filespan2.innerHTML = '×'; rightdiv.appendChild(filespan2); container.appendChild(leftdiv); container.appendChild(rightdiv); show_archivos.innerHTML = ''; show_archivos.appendChild(container); var borrar = document.getElementById("borrar") borrar.addEventListener("click", () => { show_archivos.innerHTML = ''; e.target.value = ""; }); } if (e.target.files) { let filename = e.target.files[0].name; let filetype = e.target.value.split(".").pop(); fileshow(filename, filetype); } else { input.value = ""; Swal.fire({ icon: "error", title: "Oops...", text: "Debes subir 1 archivo pdf" }); } }); function mensaje_de_alerta(icon, title) { Swal.fire({ icon: icon, title: title, showConfirmButton: true, }); }