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

creaci[on de tableros y cambio en las tareas

parent 5f6c1dcb
Loading
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -147,3 +147,36 @@ p.tittle-board {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8); /* Ajusta los valores según sea necesario */
}

.add-sprint-button{
    border: none;
    background: #d4d4d4;
    margin: 0;
}
.add-sprint-button:hover{
    border: none;
    background: #c4c4c4;
    
}
.delete{
    text-decoration: none;
    display: inline-block;
    background: red;
    border-radius: 5px;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    width: 45px;
    height: 30px;
    color: white;
    margin-left: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.element{
    font-size: 1.2em;
    margin: 2px 0px 2px 0px;
    
}
 No newline at end of file
+78 −21
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ 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) {
@@ -11,10 +12,12 @@ lists.forEach(function (list) {
    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;
      });
    });
@@ -22,8 +25,22 @@ lists.forEach(function (list) {
});

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";
@@ -44,22 +61,62 @@ 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, " "));
}

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 {

      }
    }
  });
}
+11 −0
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@ session_start();
include "../../php/sessionestado.php";
include "../../php/agregarAlumnoProy.php";
include "../../php/eliminarMiemProy.php";

include "../../php/editarInc.php";
//echo"antes";

require "../../php/conexion.php";
@@ -218,10 +220,19 @@ require "../../php/conexion.php";
            </div>
        </div>
    </div>
     <!-- Modal editar incidencia -->
     <?php
    include "../../php/modalEditarInc.php";
    ?>

</body>

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

<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>
<script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
<!--My script-->

php/tablero.php

0 → 100644
+81 −0
Original line number Diff line number Diff line
<?php
require './conexion.php';

$Respuesta = array();
$Respuesta["estado"] = 0;
$accion = $_POST["accion"];

switch ($accion) {
    case "create":
        accionCReatePHP($con);
        break;
    case "actualizarInsEst":
        actualizarInsEst($con);
        break;
    case "update":
        accionUpdatePHP($con);
        break;
    case "read":
        accionReadPHP($con);
        break;
    case "id_read":
        accionReadIdPHP($con);
        break;
    case "mostrarP":
        mostrarProyectos($con);
        break;
    case "ver":
        ver($con);
        break;
    default:
        accionError();

}

function accionCreatePHP($con)
{

    $proyecto = $_POST['proy'];
    //$Revisor = $_POST["revisor"];
    //$iden = $_POST['identrega'];
    $Select = "SELECT * FROM `estadoAl` WHERE `estAl_idproyect` = '$proyecto' ORDER BY `idestadoAl` ASC";
    $res = $con->query($Select);
    if ($res->num_rows > 0) {
        while ($row = $res->fetch_assoc()) {
            $idestAl = ($row["idestadoAl"]) + 1;
        }
    } else {
        $idestAl = '1';
    }
    $Insertar = "INSERT INTO estadoAl (idestadoAl,estadoAl,estAl_idproyect) VALUES ($idestAl,'Nuevo título','$proyecto')";
    if ($con->query($Insertar) == true) {
        $Respuesta["estado"] = 1;
        $Respuesta["id"] = $idestAl;
        $Respuesta["mensaje"] = "Tablero agregado";
    } else {
        $Respuesta["estado"] = 0;
        $Respuesta["mensaje"] = "Ocurrio un error desconocido";
    }
    //$Respuesta["estado"] = 1;
    $con->close();
    echo json_encode($Respuesta);

}

function actualizarInsEst ($con){

    $incidenia = $_POST['incidenciaId'];
    $tablero = $_POST['estadoId'];
    $sqlCrearInc = "UPDATE `tarea` SET estadoAl_idestadoAl = '$tablero'  
    WHERE `idtarea` = '$incidenia'";
    if ($con->query($sqlCrearInc)) {
        $Respuesta["estado"] = 1;
        //$Respuesta["sql"] = $sqlCrearInc;
    }else{
        $Respuesta["estado"] = 0;
    }
    //$Respuesta["estado"] = 1;
    $Respuesta["sql"] = $sqlCrearInc;
    $con->close();
    echo json_encode($Respuesta);
}
 No newline at end of file
+7 −7
Original line number Diff line number Diff line
@@ -9,26 +9,26 @@ $res =$con->query($sqEstadosAlumn);
if($res->num_rows>0){
    $i=1;
    while($row = $res->fetch_assoc()){
        echo'
            <div class="box cajas" id="'.$row["idestadoAl"].'">';
        if($i<=3){
            echo'
            <div class="box cajas">
                <input type="text" id="'.$row["idestadoAl"].'" class="nuevoTitulo" value="'.$row["estadoAl"].'" readonly>';
                <input type="text" name="'.$row["idestadoAl"].'" class="nuevoTitulo" value="'.$row["estadoAl"].'" readonly>';
        }else{
            echo'
            <div class="box cajas">
                <input type="text" id="'.$row["idestadoAl"].'" class="nuevoTitulo" placeholder="'.$row["estadoAl"].'">';
                <input type="text" name="'.$row["idestadoAl"].'" class="nuevoTitulo" placeholder="'.$row["estadoAl"].'">';
        } 

            $sqlVerInci = "SELECT * FROM `tarea` ta JOIN `sprint` sp ON(ta.sprint_idsprint=sp.`idsprint`) 
            WHERE ta.estadoAl_idestadoAl = '".$row["idestadoAl"]."' AND sp.estado = 'activo' AND 
            `sp`.`spr_idproyect` = '$proyecto' AND ta.tarea_idtarea IS NULL ORDER BY `tarea_idtarea` ASC";
            `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){
                $i=1;
                
                while($rowVerInci = $resVerInci->fetch_assoc()){
                    echo'
                    <div class="list" id="'.$rowVerInci["idtarea"].'" draggable="true">
                    <div class="list" id="'.$rowVerInci["idtarea"].'" draggable="true" data-bs-toggle="modal" data-bs-target="#incidenciaEditar'.$rowVerInci["idtarea"].'">
                        '.$rowVerInci["tarea"].'
                    </div>';
                }