Loading js/tablero-archivos.js +35 −81 Original line number Diff line number Diff line let lists = document.querySelectorAll(".list"); let boxes = document.querySelectorAll(".box"); let agregarCajaBtn = document.getElementById("agregarCaja"); let containerBoard = document.querySelector(".container-board"); var idList; lists.forEach(function (list) { list.addEventListener("dragstart", function (e) { let selected = e.target; // Agrega eventos de arrastre a las cajas para permitir soltar en ellas boxes.forEach(function (box) { box.addEventListener("dragover", function (e) { e.preventDefault(); $(document).ready(function() { $('#agregarCaja').click(function() { $.ajax({ url: 'crear_registro.php', type: 'POST', data: { titulo: 'Nuevo Título' }, // Datos enviados a PHP success: function(response) { let nuevoId = response.id; // Supongamos que PHP devuelve el ID en formato JSON let nuevaCaja = `<div class="box cajas" id="box-${nuevoId}"> <input type="text" class="nuevoTitulo" value="Segundo Reporte" readonly> <div class="contenedor-pdf"> <div class="icon"> <i class="fas fa-cloud-upload-alt"></i> </div> <div class="text" id="file-name-${nuevoId}"> Ningún archivo elegido, todavía! </div> <iframe id="pdf-preview-${nuevoId}" style="display: none; width: 100%; height: 350px;" frameborder="0"> </iframe> </div> <div class="btn-subirDoc"> <button type="button" id="custom-btn" onclick="document.getElementById('file-input-${nuevoId}').click();"> Selecciona tu documento .pdf </button> <input type="file" id="file-input-${nuevoId}" accept=".pdf" style="display: none;" onchange="updateFileName(this)"> </div> </div>`; $('#container-board').append(nuevaCaja); } }); box.addEventListener("drop", function (e) { box.appendChild(selected); actulizarInstEstado(list.id, box.id); selected = null; }); }); }); Loading Loading @@ -113,63 +117,13 @@ agregarCajaBtn.addEventListener("click", function () { newBox.appendChild(selected); selected.classList.remove("dragging"); } //console.log("idlist"+idList) //actulizarInstEstado(list.id,newBox.id); }); newInput.addEventListener("click", function () { console.log("Contenido guardado:", newInput.value); }); // } else { // } // } // }); }); lists.forEach(function (list) { list.addEventListener("dragstart", function (e) { e.dataTransfer.setData("text/plain", ""); // necesario para que funcione en Firefox list.classList.add("dragging"); //console.log("idlist"+idList) }); list.addEventListener("dragend", function () { lists.forEach(function (list) { list.classList.remove("dragging"); idList = list.id; }); }); }); function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } else { resetUpload(); } function resetUpload() { fileNameDisplay.textContent = "Ningún archivo elegido, todavía!"; pdfPreview.style.display = 'none'; uploadIcon.style.display = 'block'; uploadText.style.display = 'block'; contenedorPdf.classList.remove('mostrar-pdf'); } function actulizarInstEstado(incid, tabid) { //console.log(incid); //console.log(tabid); // $.ajax({ // method: "POST", // url: "../../php/tablero.php", // data: {//temporal // accion: "actualizarInsEst", // incidenciaId: incid, // estadoId: tabid // }, // success: function (Respuesta) { // //alert(Respuesta); // let miObjetoJSON = JSON.parse(Respuesta); // if (miObjetoJSON.estado == 1) { // console.log(miObjetoJSON.sql) // } else { // } // } // }); } No newline at end of file Loading
js/tablero-archivos.js +35 −81 Original line number Diff line number Diff line let lists = document.querySelectorAll(".list"); let boxes = document.querySelectorAll(".box"); let agregarCajaBtn = document.getElementById("agregarCaja"); let containerBoard = document.querySelector(".container-board"); var idList; lists.forEach(function (list) { list.addEventListener("dragstart", function (e) { let selected = e.target; // Agrega eventos de arrastre a las cajas para permitir soltar en ellas boxes.forEach(function (box) { box.addEventListener("dragover", function (e) { e.preventDefault(); $(document).ready(function() { $('#agregarCaja').click(function() { $.ajax({ url: 'crear_registro.php', type: 'POST', data: { titulo: 'Nuevo Título' }, // Datos enviados a PHP success: function(response) { let nuevoId = response.id; // Supongamos que PHP devuelve el ID en formato JSON let nuevaCaja = `<div class="box cajas" id="box-${nuevoId}"> <input type="text" class="nuevoTitulo" value="Segundo Reporte" readonly> <div class="contenedor-pdf"> <div class="icon"> <i class="fas fa-cloud-upload-alt"></i> </div> <div class="text" id="file-name-${nuevoId}"> Ningún archivo elegido, todavía! </div> <iframe id="pdf-preview-${nuevoId}" style="display: none; width: 100%; height: 350px;" frameborder="0"> </iframe> </div> <div class="btn-subirDoc"> <button type="button" id="custom-btn" onclick="document.getElementById('file-input-${nuevoId}').click();"> Selecciona tu documento .pdf </button> <input type="file" id="file-input-${nuevoId}" accept=".pdf" style="display: none;" onchange="updateFileName(this)"> </div> </div>`; $('#container-board').append(nuevaCaja); } }); box.addEventListener("drop", function (e) { box.appendChild(selected); actulizarInstEstado(list.id, box.id); selected = null; }); }); }); Loading Loading @@ -113,63 +117,13 @@ agregarCajaBtn.addEventListener("click", function () { newBox.appendChild(selected); selected.classList.remove("dragging"); } //console.log("idlist"+idList) //actulizarInstEstado(list.id,newBox.id); }); newInput.addEventListener("click", function () { console.log("Contenido guardado:", newInput.value); }); // } else { // } // } // }); }); lists.forEach(function (list) { list.addEventListener("dragstart", function (e) { e.dataTransfer.setData("text/plain", ""); // necesario para que funcione en Firefox list.classList.add("dragging"); //console.log("idlist"+idList) }); list.addEventListener("dragend", function () { lists.forEach(function (list) { list.classList.remove("dragging"); idList = list.id; }); }); }); function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } else { resetUpload(); } function resetUpload() { fileNameDisplay.textContent = "Ningún archivo elegido, todavía!"; pdfPreview.style.display = 'none'; uploadIcon.style.display = 'block'; uploadText.style.display = 'block'; contenedorPdf.classList.remove('mostrar-pdf'); } function actulizarInstEstado(incid, tabid) { //console.log(incid); //console.log(tabid); // $.ajax({ // method: "POST", // url: "../../php/tablero.php", // data: {//temporal // accion: "actualizarInsEst", // incidenciaId: incid, // estadoId: tabid // }, // success: function (Respuesta) { // //alert(Respuesta); // let miObjetoJSON = JSON.parse(Respuesta); // if (miObjetoJSON.estado == 1) { // console.log(miObjetoJSON.sql) // } else { // } // } // }); } No newline at end of file