From 314fdab96c57383b5391d28890851c6d7eb85e8e Mon Sep 17 00:00:00 2001 From: vicsash Date: Thu, 23 May 2024 18:14:22 +0200 Subject: [PATCH] La problema de empresa esta resuleta, parece que esta causada por error de hibernate que esta confindiendo id de empresa y sector por algun razon --- .../modelControllers/EmpressaController.java | 14 +++---- src/main/resources/static/style.css | 41 ++++++++++--------- .../templates/admin/empresa/update.html | 2 +- .../resources/templates/list/alumnos.html | 5 +-- .../resources/templates/list/empresas.html | 4 +- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/example/proyectofinal/controllers/modelControllers/EmpressaController.java b/src/main/java/com/example/proyectofinal/controllers/modelControllers/EmpressaController.java index b95d075..8e699f2 100644 --- a/src/main/java/com/example/proyectofinal/controllers/modelControllers/EmpressaController.java +++ b/src/main/java/com/example/proyectofinal/controllers/modelControllers/EmpressaController.java @@ -6,6 +6,7 @@ import com.example.proyectofinal.models.empresas.Sector; import com.example.proyectofinal.repositories.empresas.ContactoRepository; import com.example.proyectofinal.servicios.implemetations.empresas.IEmpresa; import com.example.proyectofinal.servicios.implemetations.empresas.ISector; +import jakarta.persistence.EntityManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -26,6 +27,8 @@ public class EmpressaController { @Autowired private ContactoRepository contactoRepository; + @Autowired + private EntityManager entityManager; @Autowired IEmpresa empresaService; @@ -103,23 +106,18 @@ public class EmpressaController { @PostMapping("/empresa/update") - public ResponseEntity updateEmpresa(Empresa empresa, @RequestParam("sector.id") Long sectorId, @RequestParam("joinedKeywords") String keywords){ + public ResponseEntity updateEmpresa(Empresa empresa, @RequestParam("sectorId") Long sectorId, @RequestParam("joinedKeywords") String keywords){ try{ if (keywords != null && !keywords.isEmpty() && keywords.charAt(0) == ',') { keywords = keywords.substring(1); } assert keywords != null; empresa.setKeywords(keywords); + entityManager.detach(empresa); Sector existingSector = sectorService.findById(sectorId); if(existingSector != null) { - System.out.println("TEST UPDATE: EX-SEC " + existingSector.getNombre()); - System.out.println("TEST UPDATE: EX-SEC " + existingSector.getId()); empresa.setSector(existingSector); - System.out.println("TEST UPDATE: EMPRESA-NOMBRE " + empresa.getNombre()); - System.out.println("TEST UPDATE: EMPRESA-ID " + empresa.getId()); - System.out.println("TEST UPDATE: EMPRESA-SEC " + empresa.getSector().getNombre()); - System.out.println("TEST UPDATE: EMPRESA-SEC-ID " + empresa.getSector().getId()); - } else { + } else { return new ResponseEntity<>("Sector no encontrado", HttpStatus.BAD_REQUEST); } diff --git a/src/main/resources/static/style.css b/src/main/resources/static/style.css index 1fa357f..7310381 100644 --- a/src/main/resources/static/style.css +++ b/src/main/resources/static/style.css @@ -40,36 +40,37 @@ h1 { } .table { width: 100%; -} -.table th, .table td.keywords-cell { - width: 200px; /* Adjust this value to your needs */ + table-layout: auto!important; + } .table thead th { position: sticky; top: 0; background: #fff; z-index: 10; - width: 200px; /* Set a specific width */ - overflow: auto; /* Add overflow */ + width: 300px !important; /* Set a specific width */ } -.table td.keywords-cell { - display: inline-block !important; - overflow-x: auto !important; - text-overflow: clip !important; +.table td{ border: 1px solid #ddd; } -.table-header, .keywords-cell { - width: 200px; /* Adjust this value as needed */ +.table td.keywords-cell { + 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 */ } .table tr td:first-child { - width: 50px; - overflow: hidden; - text-overflow: ellipsis; + 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 { } } + @media screen and (max-width: 600px) { .table td, .table th { font-size: 14px; @@ -84,7 +85,7 @@ h1 { @media screen and (max-width: 400px) { .table td, .table th { font-size: 12px; - padding: 3px; + padding: 2px; } #edit-icon, #delete-icon { @@ -138,18 +139,18 @@ html, body { } .edit-icon { color: #ffa600; - margin-right: 10px; - margin-left: 10px; - font-size: 24px; + margin-right: 5px; + margin-left: 5px; + font-size: 20px; } .delete-icon { color: red; margin-left: 5px; - font-size: 24px; + font-size: 20px; } #create-icon { color: green; - font-size: 24px; + font-size: 20px; margin-left: 10px; } .inactive { diff --git a/src/main/resources/templates/admin/empresa/update.html b/src/main/resources/templates/admin/empresa/update.html index 1259988..0c19be5 100644 --- a/src/main/resources/templates/admin/empresa/update.html +++ b/src/main/resources/templates/admin/empresa/update.html @@ -113,7 +113,7 @@
-
diff --git a/src/main/resources/templates/list/alumnos.html b/src/main/resources/templates/list/alumnos.html index 874df95..b41c2b4 100644 --- a/src/main/resources/templates/list/alumnos.html +++ b/src/main/resources/templates/list/alumnos.html @@ -2,13 +2,12 @@ - + Lista: Alumnos @@ -93,7 +92,7 @@ - + [[${alumno.nombre}]] diff --git a/src/main/resources/templates/list/empresas.html b/src/main/resources/templates/list/empresas.html index 9ba1f42..9e6218e 100644 --- a/src/main/resources/templates/list/empresas.html +++ b/src/main/resources/templates/list/empresas.html @@ -299,7 +299,7 @@ } }); }); - +/* /////////////////MOUSE SROLL FOR KEYWORD AND SKILLS////////////////////// const cells = document.querySelectorAll('.keywords-cell'); cells.forEach(cell => { @@ -307,7 +307,7 @@ e.preventDefault(); this.scrollLeft += e.deltaY; }, { passive: false }); - }); + });*/ \ No newline at end of file