Commit 82736823 authored by Axel Tomas Baltierra Hernandez's avatar Axel Tomas Baltierra Hernandez
Browse files

configurando tablero de administradores

parent 9e6a9b48
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -27,7 +27,18 @@ p.tittle-board {
    margin-left: 15px;
    margin-right: 15px;
    padding-bottom: 70px;
    overflow-x: scroll;
    /* Permite el desplazamiento horizontal */
    white-space: nowrap;
    /* Evita que los elementos se envuelvan a la siguiente línea */
    text-align: left;
    /* Alinea los elementos a la izquierda */
}

.container-board2 {
    display: flex;
    margin-left: 15px;
    margin-right: 15px;
    padding-bottom: 70px;
    /* Permite el desplazamiento horizontal */
    white-space: nowrap;
    /* Evita que los elementos se envuelvan a la siguiente línea */
@@ -95,7 +106,11 @@ p.tittle-board {
    margin-bottom: 10px;
    color: white;
}

.container-addCaja2 {
    margin-left: 35px;
    margin-bottom: 10px;
    color: white;
}
.btn-blanco {
    display: flex;
    align-items: center;

js/tablero2.js

0 → 100644
+122 −0
Original line number Diff line number Diff line
let lists = document.querySelectorAll(".list");
let boxes = document.querySelectorAll(".box");
let agregarCajaBtn = document.getElementById("agregarCaja2");
let containerBoard = document.querySelector(".container-board2");
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();
        
      });

      box.addEventListener("drop", function (e) {
        box.appendChild(selected);
        actulizarInstEstado(list.id,box.id);
        selected = null;
      });
    });
  });
});

agregarCajaBtn.addEventListener("click", function () {
  let proyecto = getParameterByName('proy');
  $.ajax({
    method: "POST",
    url: "../../php/tablero.php",
    data: {//temporal
      accion: "create",
      proy: proyecto
    },
    success: function (Respuesta) {
      //alert(Respuesta);
      let miObjetoJSON = JSON.parse(Respuesta);
      if (miObjetoJSON.estado == 1) {

        let newBox = document.createElement("div");
        newBox.className = "box cajas";
        newBox.id = miObjetoJSON.id;

        let newInput = document.createElement("input");
        newInput.type = "text";
        newInput.className = "nuevoTitulo";
        newInput.placeholder = "Nuevo título";
        newInput.value = "";

        newBox.appendChild(newInput);
        containerBoard.appendChild(newBox);

        newBox.addEventListener("dragover", function (e) {
          e.preventDefault();
        });

        newBox.addEventListener("drop", function (e) {
          let selected = document.querySelector(".list.dragging");
          if (selected) {
            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, " "));
}

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 {

      }
    }
  });
}
+24 −14
Original line number Diff line number Diff line
@@ -146,6 +146,17 @@ require "../../php/conexion.php";
        include "../../php/verEstadosInc.php"
            ?>
    </div>
    <div class="container-addCaja2">
        <button type="button" id="agregarCaja2" class="btn btn-blanco">
            <ion-icon id="plus" name="add-circle-outline"></ion-icon>
        </button>
    </div>

    <div class="container-board2">
        <?php
        include "../../php/verEstadosIncAdm.php"
            ?>
    </div>

    <!-- Modal agregar alumno -->
    <div class="modal fade" id="AgregarMiembro" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
@@ -229,8 +240,7 @@ require "../../php/conexion.php";

<!-- Scripts de iconos 'ionicons' -->

<script src="https://code.jquery.com/jquery-3.7.1.js" 
integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
    crossorigin="anonymous"></script>
<script src="../../js/subincidencias.js"></script>
<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
+44 −0
Original line number Diff line number Diff line
<?php
require "../../php/conexion.php";

$proyecto = $_GET['proy'];
$sqEstadosAlumn="SELECT * FROM `estadoAdm` WHERE `estAdm_idproyect` = '$proyecto' ORDER BY `idestadoAdm` ASC";                               
                
$res =$con->query($sqEstadosAlumn);
     
if($res->num_rows>0){
    $i=1;
    while($row = $res->fetch_assoc()){
        echo'
            <div class="box cajas" id="'.$row["idestadoAdm"].'">';
        if($i<=2){
            echo'
                <input type="text" name="'.$row["idestadoAdm"].'" class="nuevoTitulo" value="'.$row["estadoAd"].'" readonly>';
        }else{
            echo'
                <input type="text" name="'.$row["idestadoAdm"].'" class="nuevoTitulo" placeholder="'.$row["estadoAd"].'">';
        } 

            $sqlVerInci = "SELECT * FROM `tarea` ta JOIN `sprint` sp ON(ta.sprint_idsprint=sp.`idsprint`) 
            WHERE ta.estadoAdm_idestadoAdm = '".$row["idestadoAdm"]."' AND sp.estado = 'activo' AND 
            `sp`.`spr_idproyect` = '$proyecto' AND ta.ta_spr_idproyect = '$proyecto' AND ta.tarea_idtarea IS NULL ORDER BY `tarea_idtarea` ASC";

            $resVerInci =$con->query($sqlVerInci);
            if($resVerInci->num_rows>0){
                
                while($rowVerInci = $resVerInci->fetch_assoc()){
                    echo'
                    <div class="list" id="'.$rowVerInci["idtarea"].'" draggable="true" data-bs-toggle="modal" data-bs-target="#incidenciaEditar'.$rowVerInci["idtarea"].'">
                        '.$rowVerInci["tarea"].'
                    </div>';
                }
            }

            echo '</div>';
            $i++;       
    }
    
}
else{
    echo "<br><p style='color: red;'>Error no se encontraron datos</p>";
}