Spaces:
Running
Running
quita lo de dibujar linea entre materias y quiero que las materias no cursadas salgan a manera de lista del lado izquierdo abajo de los sliders y el boton de autoplanear
Browse files- app.js +0 -64
- index.html +4 -2
- style.css +8 -8
app.js
CHANGED
|
@@ -356,7 +356,6 @@ function agregarSemestre() {
|
|
| 356 |
creditos: 0
|
| 357 |
});
|
| 358 |
feather.replace();
|
| 359 |
-
dibujarConexiones();
|
| 360 |
}
|
| 361 |
|
| 362 |
// Llamar a dibujar conexiones cuando se mueve una materia
|
|
@@ -530,8 +529,6 @@ function verificarRestricciones(materiaEl, semestreIndex) {
|
|
| 530 |
}
|
| 531 |
}
|
| 532 |
function autoPlanear() {
|
| 533 |
-
// Limpiar conexiones anteriores
|
| 534 |
-
document.querySelectorAll('.prereq-line').forEach(el => el.remove());
|
| 535 |
// Limpiar todos los semestres primero
|
| 536 |
document.querySelectorAll('.materias-semestre').forEach(container => {
|
| 537 |
container.innerHTML = '';
|
|
@@ -631,64 +628,3 @@ function fijarSemestre(materiaId) {
|
|
| 631 |
actualizarCreditosSemestre(index);
|
| 632 |
verificarRestricciones(materiaEl, index);
|
| 633 |
}
|
| 634 |
-
|
| 635 |
-
function dibujarConexiones() {
|
| 636 |
-
// Limpiar conexiones anteriores
|
| 637 |
-
document.querySelectorAll('.prereq-line').forEach(el => el.remove());
|
| 638 |
-
|
| 639 |
-
// Dibujar l铆neas entre prerrequisitos
|
| 640 |
-
materias.forEach(materia => {
|
| 641 |
-
const materiaEl = document.querySelector(`[data-materia-id="${materia.clave}"]`);
|
| 642 |
-
if (!materiaEl || materiaEl.closest('.materias-no-asignadas')) return;
|
| 643 |
-
|
| 644 |
-
materia.prerrequisitos.forEach(prereq => {
|
| 645 |
-
const prereqEl = document.querySelector(`[data-materia-id="${prereq}"]`);
|
| 646 |
-
if (prereqEl && !prereqEl.closest('.materias-no-asignadas')) {
|
| 647 |
-
dibujarLinea(prereqEl, materiaEl);
|
| 648 |
-
}
|
| 649 |
-
});
|
| 650 |
-
});
|
| 651 |
-
}
|
| 652 |
-
|
| 653 |
-
function dibujarLinea(origen, destino) {
|
| 654 |
-
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
| 655 |
-
svg.classList.add('prereq-line');
|
| 656 |
-
svg.style.position = 'absolute';
|
| 657 |
-
svg.style.width = '100%';
|
| 658 |
-
svg.style.height = '100%';
|
| 659 |
-
svg.style.top = '0';
|
| 660 |
-
svg.style.left = '0';
|
| 661 |
-
svg.style.pointerEvents = 'none';
|
| 662 |
-
svg.style.zIndex = '-1';
|
| 663 |
-
|
| 664 |
-
const rectOrigen = origen.getBoundingClientRect();
|
| 665 |
-
const rectDestino = destino.getBoundingClientRect();
|
| 666 |
-
const rectContenedor = document.getElementById('app').getBoundingClientRect();
|
| 667 |
-
|
| 668 |
-
const x1 = rectOrigen.left + rectOrigen.width/2 - rectContenedor.left;
|
| 669 |
-
const y1 = rectOrigen.top + rectOrigen.height - rectContenedor.top;
|
| 670 |
-
const x2 = rectDestino.left + rectDestino.width/2 - rectContenedor.left;
|
| 671 |
-
const y2 = rectDestino.top - rectContenedor.top;
|
| 672 |
-
|
| 673 |
-
const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
| 674 |
-
line.setAttribute('x1', x1);
|
| 675 |
-
line.setAttribute('y1', y1);
|
| 676 |
-
line.setAttribute('x2', x2);
|
| 677 |
-
line.setAttribute('y2', y2);
|
| 678 |
-
line.setAttribute('stroke', '#3B82F6');
|
| 679 |
-
line.setAttribute('stroke-width', '2');
|
| 680 |
-
line.setAttribute('stroke-dasharray', '5,5');
|
| 681 |
-
line.setAttribute('marker-end', 'url(#arrowhead)');
|
| 682 |
-
|
| 683 |
-
svg.innerHTML = `
|
| 684 |
-
<defs>
|
| 685 |
-
<marker id="arrowhead" markerWidth="10" markerHeight="7"
|
| 686 |
-
refX="0" refY="3.5" orient="auto">
|
| 687 |
-
<polygon points="0 0, 10 3.5, 0 7" fill="#3B82F6"/>
|
| 688 |
-
</marker>
|
| 689 |
-
</defs>
|
| 690 |
-
`;
|
| 691 |
-
svg.appendChild(line);
|
| 692 |
-
|
| 693 |
-
document.getElementById('app').appendChild(svg);
|
| 694 |
-
}
|
|
|
|
| 356 |
creditos: 0
|
| 357 |
});
|
| 358 |
feather.replace();
|
|
|
|
| 359 |
}
|
| 360 |
|
| 361 |
// Llamar a dibujar conexiones cuando se mueve una materia
|
|
|
|
| 529 |
}
|
| 530 |
}
|
| 531 |
function autoPlanear() {
|
|
|
|
|
|
|
| 532 |
// Limpiar todos los semestres primero
|
| 533 |
document.querySelectorAll('.materias-semestre').forEach(container => {
|
| 534 |
container.innerHTML = '';
|
|
|
|
| 628 |
actualizarCreditosSemestre(index);
|
| 629 |
verificarRestricciones(materiaEl, index);
|
| 630 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.html
CHANGED
|
@@ -106,9 +106,11 @@
|
|
| 106 |
</div>
|
| 107 |
</div>
|
| 108 |
<button id="autoPlanBtn" class="mt-4 w-full bg-primary-500 hover:bg-primary-600 text-white font-medium py-2 px-4 rounded-md transition-colors">Auto-planear</button>
|
| 109 |
-
</div>
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
| 112 |
<div class="md:w-2/3 lg:w-3/4">
|
| 113 |
<div id="semestresContainer" class="space-y-4">
|
| 114 |
<!-- Semestres se generar谩n aqu铆 -->
|
|
|
|
| 106 |
</div>
|
| 107 |
</div>
|
| 108 |
<button id="autoPlanBtn" class="mt-4 w-full bg-primary-500 hover:bg-primary-600 text-white font-medium py-2 px-4 rounded-md transition-colors">Auto-planear</button>
|
|
|
|
| 109 |
|
| 110 |
+
<h2 class="text-lg font-semibold text-primary-500 mt-6 mb-3">Materias pendientes</h2>
|
| 111 |
+
<div class="materias-no-asignadas space-y-2 max-h-96 overflow-y-auto"></div>
|
| 112 |
+
</div>
|
| 113 |
+
<!-- Panel derecho -->
|
| 114 |
<div class="md:w-2/3 lg:w-3/4">
|
| 115 |
<div id="semestresContainer" class="space-y-4">
|
| 116 |
<!-- Semestres se generar谩n aqu铆 -->
|
style.css
CHANGED
|
@@ -52,17 +52,17 @@ body {
|
|
| 52 |
opacity: 0.5;
|
| 53 |
background: #c8ebfb;
|
| 54 |
}
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
| 59 |
}
|
| 60 |
|
| 61 |
-
.materia-card {
|
| 62 |
-
|
| 63 |
-
|
| 64 |
}
|
| 65 |
-
|
| 66 |
/* Estilo para el bot贸n de anclar */
|
| 67 |
button[onclick^="fijarSemestre"] {
|
| 68 |
cursor: pointer;
|
|
|
|
| 52 |
opacity: 0.5;
|
| 53 |
background: #c8ebfb;
|
| 54 |
}
|
| 55 |
+
.materias-no-asignadas {
|
| 56 |
+
border: 1px solid #e5e7eb;
|
| 57 |
+
border-radius: 0.5rem;
|
| 58 |
+
padding: 0.5rem;
|
| 59 |
+
background-color: #f9fafb;
|
| 60 |
}
|
| 61 |
|
| 62 |
+
.materias-no-asignadas .materia-card {
|
| 63 |
+
background-color: white;
|
| 64 |
+
margin-bottom: 0.5rem;
|
| 65 |
}
|
|
|
|
| 66 |
/* Estilo para el bot贸n de anclar */
|
| 67 |
button[onclick^="fijarSemestre"] {
|
| 68 |
cursor: pointer;
|