Fallo de busqueda dinamica en alumnos encontrado y resualto, cambios a css generales y mas especificos. CAmbios mas especificos eran a alumnos.html a tamaños de los td para que comparten mejor. Tambian cambios a ofertas y empresas como tienen campos similares al alumno( campos keywords y skills)

master
vicsash 6 months ago
parent f6cc4e402c
commit 8749e4646a

@ -460,7 +460,7 @@ public class BuscadorController {
} else {
alumnos = alumnoService.searchCustom(querySearchBar,query, secondaryOption);
}
//printTest(alumnos);
for (Alumno alumno : alumnos) {
List<Object[]> skillsData = alumnoRepository.findSkillsByAlumnoId(alumno.getId());
Set<Skill> skills = new HashSet<>();
@ -472,9 +472,21 @@ public class BuscadorController {
}
alumno.setSkills(skills);
}
//printTest(alumnos);
return ResponseEntity.ok(alumnos);
}
private void printTest (List<Alumno> alumnos){
for (Alumno alumno : alumnos) {
System.out.println("----------------------------");
System.out.println(alumno.getNombre());
for(Skill skill : alumno.getSkills()) {
System.out.println(skill.getNombre());
}
System.out.println("----------------------------");
}
}
@GetMapping("/ofertas/search")
public ResponseEntity<List<Oferta>> searchOfertas(@RequestParam String querySearchBar, @RequestParam String query, @RequestParam String secondaryOption) {

@ -12,11 +12,10 @@ import java.util.Date;
import java.util.Set;
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
//@Getter
//@Setter
@Data
@Table(name = "alumnos")
public class Alumno {
@Id

@ -28,16 +28,17 @@ public interface AlumnoRepository extends JpaRepository<Alumno, Long> {
void deleteSkillByAlumnoId(Long id);
@Query(value = "Select s.* from skills s " +
"inner join oferta_skill os on s.id = os.fk_skills " +
"where os.fk_oferta =?1", nativeQuery = true)
List<Object[]> findSkillsByAlumnoId(long id);
"inner join alumno_skill os on s.id = os.fk_skills " +
"where os.fk_alumno =?1", nativeQuery = true)
List<Object[]> findSkillsByAlumnoId(Long id);
@Query("SELECT a FROM Alumno a JOIN a.skills s WHERE a.nombre LIKE %:query% OR a.apellido " +
"LIKE %:query% OR a.apellido2 LIKE %:query% OR a.correo LIKE %:query% OR a.correo2 " +
"LIKE %:query% OR a.nacionalidad LIKE %:query% OR a.genero LIKE %:query% OR a.dni " +
"LIKE %:query% OR a.nia LIKE %:query% OR s.nombre LIKE %:query%")
List<Alumno> search(String query);
"LIKE %:query% OR a.nia LIKE %:query% OR s.nombre LIKE %:query% OR a.ciclo.nombre " +
"LIKE %:query% OR a.keywords LIKE %:query% OR s.nombre LIKE %:query%")
List<Alumno> search(@Param("query") String query);
@Query("SELECT a FROM Alumno a WHERE a.nia = ?1")

@ -32,7 +32,7 @@ public interface OfertaRepository extends JpaRepository<Oferta, Long> {
@Query(value = "SELECT s.* FROM skills s INNER JOIN " +
"oferta_skill os ON s.id = os.fk_skills " +
"WHERE os.fk_oferta = ?1", nativeQuery = true)
public List<Object[]> findSkillsByOfertaId(Long id);
List<Object[]> findSkillsByOfertaId(Long id);
@Query("SELECT o FROM Oferta o JOIN o.skills s " +
"WHERE o.nombre LIKE %:query% OR o.descripcion " +

@ -140,20 +140,14 @@ public class AlumnoService implements IAlumno{
query = query.trim().toLowerCase();
if (secondaryOption.equals("Nombre")) {
listEmpPrime.addAll(alumnoRepository.alumnosByNombreCust(query));
} else if (secondaryOption.equals("Apellido")) {
listEmpPrime.addAll(alumnoRepository.alumnosByApellidoCust(query));
} else if (secondaryOption.equals("Ciclo")) {
System.out.println("TEST QUERY: " + query);
listEmpPrime.addAll(alumnoRepository.alumnosByCicloCust(query));
} else if (secondaryOption.equals("Keywords")) {
listEmpPrime.addAll(alumnoRepository.alumnosByKeywordsCust(query));
} else if (secondaryOption.equals("Nia")) {
listEmpPrime.addAll(alumnoRepository.alumnosByNiaCust(query));
} else if (secondaryOption.equals("Dni")) {
listEmpPrime.addAll(alumnoRepository.alumnosByDniCust(query));
}

@ -20,7 +20,7 @@ th {
background-color: #f2f2f2;
color: black;
padding: 10px;
border: 1px solid #ddd;
border: 2px solid #ddd;
}
h1 {
@ -51,21 +51,16 @@ h1 {
width: 300px !important; /* Set a specific width */
}
.table td{
border: 1px solid #ddd;
border: 2px solid #ddd;
}
.table td.keywords-cell {
.table td.scrollable-cell .scrollable-content {
overflow-y: auto !important; /* Enables vertical scrollbar if content exceeds cell height */
text-overflow: clip !important;
white-space: normal; /* Allows text to wrap to next line */
max-height: 25px !important;/* Set a specific height */
max-height: 25px !important; /* Set a specific height */
}
.table tr td:first-child {
min-width: 150px !important;
}
.table td.nombre-cell {
min-width: 225px !important; /* Adjust this value to your needs */
text-align: left; /* Aligns the content to the left */
}
@media screen and (max-width: 600px) {
.table {
}

@ -8,6 +8,13 @@
<meta charset="UTF-8">
<title>Lista: Alumnos</title>
<style>
.table td.scrollable-cell .skill-cell {
width: 150px;
min-height: 50px;
}
.nombre-cell{
width: 200px;
}
</style>
</head>
<body>
@ -56,7 +63,7 @@
</th>
<th class="table-header">
<a th:href="@{'/buscador/alumnos/page/' + ${currentPage} + '?sortField=dni&sortDir=' + ${reverseSortDir}+ '&secondaryOption=' + ${secondaryOption}}">
Numero de documento
Num Doc
</a>
</th>
<th class="table-header">
@ -92,10 +99,12 @@
</thead>
<tbody>
<tr class="cell" th:each="alumno :${alumnos}" th:data-id="${alumno.id}">
<td class="nombre-cell">
<i class="edit-icon fas fa-pen-square"></i>
<i class="delete-icon fas fa-ban hide-icon"></i>
[[${alumno.nombre}]]
<td>
<div class ="nombre-cell">
<i class="edit-icon fas fa-pen-square"></i>
<i class="delete-icon fas fa-ban hide-icon"></i>
[[${alumno.nombre}]]
</div>
</td>
<td>[[${alumno.apellido}]]</td>
<td>[[${alumno.apellido2}]]</td>
@ -106,10 +115,20 @@
<td>[[${alumno.correo}]]</td>
<td>[[${alumno.correo2}]]</td>
<td>[[${alumno.nacionalidad}]]</td>
<td class="keywords-cell">[[${alumno.keywords}]]</td>
<td>[[${alumno.ciclo.nombre}]]</td>
<td class="keywords-cell">
<td class="keywords-cell">
<div class="scrollable-content">
[[${alumno.keywords}]]
</div>
</td>
<td class="scrollable-cell">
<div class="scrollable-content skill-cell">
[[${alumno.ciclo.nombre}]]
</div>
</td>
<td class="scrollable-cell">
<div class="scrollable-content skill-cell">
<span th:each="skill : ${alumno.skills}" th:text="${skill.nombre} + ' '"></span>
</div>
</td>
</tr>
@ -283,10 +302,16 @@
<td>${alumno.correo}</td>
<td>${alumno.correo2}</td>
<td>${alumno.nacionalidad}</td>
<td class="keywords-cell">${alumno.keywords}</td>
<td>${alumno.ciclo.nombre}</td>
<td class="keywords-cell">
<div class="scrollable-content">
${alumno.keywords}
</div>
</td>
<td>${alumno.ciclo.nombre}</td>
<td class="keywords-cell">
<div class="scrollable-content">
${alumno.skills.map(skill => skill.nombre).join(', ')}
</div>
</td>
`;
tableBody.appendChild(row);
@ -346,19 +371,6 @@
}
});
});
/////////////////MOUSE SROLL FOR KEYWORD AND SKILLS//////////////////////
// Select all elements with the 'keywords-cell' class
const cells = document.querySelectorAll('.keywords-cell');
// Add a 'wheel' event listener to each cell
cells.forEach(cell => {
cell.addEventListener('wheel', function(e) {
// Prevent the default behavior (vertical scroll)
e.preventDefault();
// Scroll horizontally instead
this.scrollLeft += e.deltaY;
}, { passive: false }); // Use passive: false to make preventDefault() work
});
</script>
</body>
</html>

@ -68,7 +68,11 @@
<td>[[${empresa.cif}]]</td>
<td>[[${empresa.correo}]]</td>
<td>[[${empresa.telefono}]]</td>
<td class="keywords-cell">[[${empresa.keywords}]]</td>
<td class="keywords-cell">
<div class="scrollable-content">
[[${empresa.keywords}]]
</div>
</td>
<td>[[${empresa.sector.nombre}]]</td>
</tr>
</tbody>
@ -242,7 +246,11 @@
<td>${empresa.cif}</td>
<td>${empresa.correo}</td>
<td>${empresa.telefono}</td>
<td class="keywords-cell">${empresa.keywords}</td>
<td class="keywords-cell">
<div class="scrollable-content">
${empresa.keywords}
</div>
</td>
<td>${empresa.sector.nombre}</td>
`;
tableBody.appendChild(row);

@ -67,7 +67,9 @@
<td>[[${oferta.sucursal.nombre}]]</td>
<td>[[${oferta.ciclo.nombre}]]</td>
<td class="keywords-cell">
<div class="scrollable-content">
<span th:each="skill : ${oferta.skills}" th:text="${skill.nombre} + ' '"></span>
</div>
</td>
</tr>
</tbody>
@ -242,8 +244,10 @@
<td>${oferta.descripcion}</td>
<td>${oferta.sucursal.nombre}</td>
<td>${oferta.ciclo.nombre}</td>
<td class="keywords-cell">
<td class="keywords-cell">
<div class="scrollable-content">
${oferta.skills.map(skill => skill.nombre).join(', ')}
</div>
</td>
`;
tableBody.appendChild(row);

Loading…
Cancel
Save

Powered by INFORMATICA.FP.EDU.ES.