Creacion de iconos al lado de los nombres para editar y borar. Otro icono para crear empresa. Creacion de formulario de crear una empresa nueva con comprobacion de que si ya existe ete empresa en la lista(basica, por nombre), con un aviso al usuario y devolucion a la lista.

master
vicsash 5 months ago
parent 89b8d8d427
commit 47bfe9c8e0

@ -1,30 +1,81 @@
package com.example.proyectofinal.controllers.modelControllers;
import com.example.proyectofinal.models.empresas.Contacto;
import com.example.proyectofinal.models.empresas.Empresa;
import com.example.proyectofinal.models.empresas.Sector;
import com.example.proyectofinal.repositories.empresas.ContactoRepository;
import com.example.proyectofinal.repositories.empresas.EmpressaRepository;
import com.example.proyectofinal.servicios.EmpresaService;
import com.example.proyectofinal.servicios.SectorService;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@Controller
@RequestMapping("/empresas")
public class EmpressaController {
@Autowired
private ContactoRepository contactoRepository;
@Autowired
private EmpressaRepository empressaRepository;
EmpresaService empresaService;
@GetMapping("/{id}")
public String getEmpressaBySector(@PathVariable Long id, Model model) {
@Autowired
SectorService sectorService;
@GetMapping("/empresas/{id}")
public String getEmpressaContacts(@PathVariable Long id, Model model) {
Set<Contacto> contactoSet = new HashSet<>(contactoRepository.findBySector(id));
model.addAttribute("contactos", contactoSet);
return "contactos";
}
@GetMapping("/admin/empresa/create")
public String showCreateForm(Model model) {
Empresa empresa = new Empresa();
Sector sector = new Sector();
List<Sector> sectores = sectorService.findAll();
model.addAttribute("empresa", empresa);
model.addAttribute("sector", sector);
model.addAttribute("sectores", sectores);
return "admin/empresa/create";
}
@PostMapping("/empresa/save")
public String guardarCurso(Empresa empresa, @RequestParam("sector.id") Long sectorId, RedirectAttributes redirectAttributes){
try{
Sector existingSector = sectorService.findById(sectorId);
if(existingSector != null) {
empresa.setSector(existingSector);
} else {
redirectAttributes.addFlashAttribute("message", "Sector no encontrado");
return "redirect:/admin/empresa/create";
}
if(empresaService.exists(empresa) != null){
redirectAttributes.addFlashAttribute("message", "Este empresa ya existe en la base de datos");
return "redirect:/admin/empresa/create";
}else {
empresaService.save(empresa);
redirectAttributes.addFlashAttribute("message", "La empresa fue guardado con exito");
return "redirect:/admin/empresa/create";
}
}catch (Exception e) {
redirectAttributes.addFlashAttribute("message", e.getMessage());
return "redirect:/admin/empresa/create";
}
}
}

@ -2,7 +2,7 @@ package com.example.proyectofinal.controllers.modelControllers;
import com.example.proyectofinal.models.empresas.Ciclo;
import com.example.proyectofinal.repositories.empresas.CicloRepository;
import com.example.proyectofinal.servicios.FamiliaService;
import com.example.proyectofinal.servicios.implemetations.FamiliaServImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@ -18,7 +18,7 @@ public class FamiliaController {
private CicloRepository cicloRepository;
@Autowired
private FamiliaService familiaService;
private FamiliaServImp familiaService;
@PostMapping("/crearFamilia")
@ResponseBody

@ -64,7 +64,7 @@ public class Alumno {
private String keywords;
@ManyToMany(cascade = {CascadeType.MERGE, CascadeType.REFRESH},fetch = FetchType.EAGER)
@ManyToMany(cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
@JoinTable(
name = "Alumno_Skill",
joinColumns = @JoinColumn(name = "fk_alumno",referencedColumnName = "id"),
@ -72,7 +72,7 @@ public class Alumno {
)
private Set<Skill> skills;
@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH,CascadeType.REMOVE},fetch = FetchType.EAGER)
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
@JoinColumn(name = "Ciclo_id",referencedColumnName = "id")
private Ciclo ciclo;

@ -26,7 +26,7 @@ public class Ciclo {
@Column(length = 70)
private String codigo;
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE,CascadeType.REFRESH},fetch = FetchType.EAGER)
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
@JoinColumn(name = "Familia_id",referencedColumnName = "id")
private Familia familia;

@ -35,7 +35,7 @@ public class Contacto {
@Column(length = 70)
private String telefono;
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE, CascadeType.REMOVE})
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.LAZY)
@JoinColumn(name = "Empresa_id",referencedColumnName = "id")
private Empresa empresa;

@ -37,7 +37,7 @@ public class Empresa {
@Column(length = 2500)
private String keywords;
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE, CascadeType.REMOVE,CascadeType.REFRESH},fetch = FetchType.EAGER)
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
@JoinColumn(name = "Sector_id",referencedColumnName = "id")
private Sector sector;

@ -32,11 +32,11 @@ public class Oferta {
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.PERSIST,CascadeType.MERGE, CascadeType.REMOVE,CascadeType.REFRESH})
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
@JoinColumn(name = "Sucursal_id")
private Sucursal sucursal;
@ManyToMany(cascade = {CascadeType.MERGE, CascadeType.REMOVE,CascadeType.REFRESH},fetch = FetchType.EAGER)
@ManyToMany(cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
@JoinTable(
name = "Oferta_Skill",
joinColumns = @JoinColumn(name = "fk_oferta",referencedColumnName = "id"),

@ -33,7 +33,7 @@ public class Sucursal {
@Name("sede_central")
private boolean sedeCentral;
@ManyToOne(cascade = {/*CascadeType.PERSIST,*/CascadeType.MERGE, CascadeType.REMOVE,CascadeType.REFRESH})
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.LAZY)
@JoinColumn(name = "Empresa_id")
private Empresa empresa;

@ -27,6 +27,8 @@ public interface EmpressaRepository extends JpaRepository<Empresa, Long>, JpaSpe
@Query("SELECT e FROM Empresa e WHERE e.nombre LIKE %:query% OR e.cif LIKE %:query% OR e.correo LIKE %:query% OR e.telefono LIKE %:query% OR e.keywords LIKE %:query% OR e.sector.nombre LIKE %:query%")
List<Empresa> search(@Param("query") String query);
@Query("SELECT e FROM Empresa e WHERE e.nombre = :nombre")
Empresa existsName(@Param("nombre") String empresaName);

@ -11,4 +11,5 @@ public interface SectorRepository extends JpaRepository<Sector, Long> {
@Query(value = "SELECT * FROM sectores u WHERE MATCH(u.nombre) AGAINST(?1 IN BOOLEAN MODE)", nativeQuery = true)
public Sector getSectorFullTextSeach(String word);
}

@ -18,4 +18,7 @@ public interface EmpresaService {
void deleteById(Long id);
List<Empresa> search(String query);
Empresa exists(Empresa empresa);
}

@ -0,0 +1,23 @@
package com.example.proyectofinal.servicios;
import com.example.proyectofinal.models.empresas.Empresa;
import com.example.proyectofinal.models.empresas.Sector;
import org.springframework.data.domain.Page;
import java.util.List;
public interface SectorService {
List<Sector> findAll();
Page<Sector> finadAllpaginated(int pageNum, int pageSize, String sortField, String sortDir);
Sector findById(Long id);
Sector findByName(String name);
Sector save(Sector sector);
void deleteById(Long id);
List<Sector> search(String query);
}

@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class EmpresaServiceImplementation implements EmpresaService {
public class EmpresaServImp implements EmpresaService {
@Autowired
private EmpressaRepository empressaRepository;
@ -52,7 +52,11 @@ public class EmpresaServiceImplementation implements EmpresaService {
return empressaRepository.search(query);
}
@Override
public Empresa exists(Empresa empresa) {
String nombre = empresa.getNombre();
return empressaRepository.existsName(nombre);
}
}

@ -1,4 +1,4 @@
package com.example.proyectofinal.servicios;
package com.example.proyectofinal.servicios.implemetations;
import com.example.proyectofinal.models.empresas.Familia;
import com.example.proyectofinal.repositories.empresas.FamiliaRepository;
@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class FamiliaService {
public class FamiliaServImp {
@Autowired
private FamiliaRepository familiaRepository;

@ -0,0 +1,52 @@
package com.example.proyectofinal.servicios.implemetations;
import com.example.proyectofinal.models.empresas.Empresa;
import com.example.proyectofinal.models.empresas.Sector;
import com.example.proyectofinal.repositories.empresas.SectorRepository;
import com.example.proyectofinal.servicios.SectorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SectorSerImp implements SectorService {
@Autowired
private SectorRepository sectorRepository;
@Override
public List<Sector> findAll() {
return sectorRepository.findAll();
}
@Override
public Page<Sector> finadAllpaginated(int pageNum, int pageSize, String sortField, String sortDir) {
return null;
}
@Override
public Sector findById(Long id) {
return sectorRepository.findById(id).orElse(null);
}
@Override
public Sector findByName(String name) {
return sectorRepository.findByNombre(name);
}
@Override
public Sector save(Sector sector) {
return sectorRepository.save(sector);
}
@Override
public void deleteById(Long id) {
sectorRepository.deleteById(id);
}
@Override
public List<Sector> search(String query) {
return List.of();
}
}

@ -1,23 +1,34 @@
function dynamicSearch() {
var input, filter, table, tbody, tr, td, i, j, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("table");
tbody = table.getElementsByTagName("tbody")[0];
tr = tbody.getElementsByTagName("tr");
$(document).ready(function() {
$("#modal-container").load("/empresas/createEmpresaModal");
});
for (i = 0; i < tr.length; i++) {
for (j = 0; j < tr[i].cells.length; j++) {
td = tr[i].cells[j];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
break;
} else {
tr[i].style.display = "none";
$(document).ready(function() {
// Load the modal HTML into #modal-container
$("#modal-container").load("/empresas/createEmpresaModal", function() {
// Get the modal
var modal = document.getElementById("empresaCreateModal");
// Get the button that opens the modal
var btn = document.getElementById("create-icon");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
}
});
});

@ -16,12 +16,11 @@
width: 40px;
height: 40px;
}
th {
background-color: #f2f2f2; /* Change this to your preferred color */
color: black; /* Change this to your preferred color */
background-color: #f2f2f2;
color: black;
padding: 10px;
border: 1px solid #ddd; /* Adds border to the table headers */
border: 1px solid #ddd;
}
h1 {
@ -40,31 +39,50 @@ h1 {
width: 100%;
position: relative;
}
.table {
padding-top: 5px;
table-layout: fixed;
width: 100%;
height: 90vh;
overflow-y: auto;
}
.cell{
height: 10px;
.table td, .table th {
width: 150px;
height: 50px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.table thead th {
position: sticky;
top: 0;
background: #fff;
z-index: 10;
}
.table td {
width: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.table tr td:first-child {
width: 50px;
overflow: hidden;
text-overflow: ellipsis;
}
.table tr th:first-child {
width: 50px;
overflow: hidden;
text-overflow: ellipsis;
}
@media screen and (max-width: 600px) {
.table {
}
}
.table tr {
height: 10%;
}
body {
margin: 0;
padding: 0px;
}
.header {
display: flex;
align-items: center;
@ -73,19 +91,15 @@ body {
padding: 0;
box-sizing: border-box;
}
.header h1 {
margin: 0;
}
.header button {
margin-right: auto;
}
.logout-button {
position: relative;
}
.logout-button {
position: relative;
}
@ -93,5 +107,36 @@ html, body {
margin: 0;
padding: 0;
}
.page{
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
}
.page a{
padding:10px;
}
#edit-icon {
color: #ffa600;
margin-right: 10px;
margin-left: 10px;
font-size: 24px;
}
#delete-icon {
color: red;
margin-left: 5px;
font-size: 24px;
}
#create-icon {
color: green;
font-size: 24px;
margin-left: 10px;
}
.inactive {
pointer-events: none;
color: grey;
}
.no-link-style {
color: inherit;
text-decoration: none;
}

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Creacion: Familia</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" th:href="@{/top.css}">
<style>
form {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
width: 100%;
max-width: none;
margin: auto;
padding: 25px;
margin-top: 100px;
}
.btn {
margin-top: 25px;
margin-right: 5px;
width: 120px;
height: 40px;
font-family: Verdana;
}
form input[type="submit"], form input[type="button"] {
width: 100px;
}
form input[type="text"]{
width: 75%;
}
form label{
font-size: 20px;
margin-bottom: 10px;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
body, h1 {
margin: 0;
padding: 0;
width: 100%;
box-sizing: border-box;
}
</style>
</head>
<body>
<h1>Añadir Empresa<a href="/logout" class="logout-button"><i class="fas fa-door-open"></i></a></h1>
<form th:action="@{/empresa/save}" method="post" enctype="multipart/form-data" th:object="${empresa}">
<input type="hidden" th:field="*{id}"/>
<div class="p-3">
<div class ="form-group row">
<label class="col-sm-3 col-form-label" for="nombre">Nombre</label>
<div class = "col-sm-9">
<input type="text" th:field="*{nombre}" required minlength="2" maxlength="128" class="form-control" id="nombre">
</div>
</div>
<div class ="form-group row">
<label class="col-sm-3 col-form-label" for="cif">Cif</label>
<div class = "col-sm-9">
<input type="text" th:field="*{cif}" required minlength="2" maxlength="128" class="form-control" id="cif">
</div>
</div>
<div class ="form-group row">
<label class="col-sm-3 col-form-label" for="correo">Correo</label>
<div class = "col-sm-9">
<input type="text" th:field="*{correo}" required min="2" class="form-control" id="correo">
</div>
</div>
<div class ="form-group row">
<label class="col-sm-3 col-form-label" for="telefono">Telefono</label>
<div class = "col-sm-9">
<input type="text" th:field="*{telefono}" required min="2" class="form-control" id="telefono">
</div>
</div>
<div class ="form-group row">
<label class="col-sm-3 col-form-label" for="keywords">Keywords</label>
<div class = "col-sm-9">
<input type="text" th:field="*{keywords}" required min="2" class="form-control" id="keywords">
</div>
</div>
<div class ="form-group row">
<label class="col-sm-3 col-form-label" for="sector">Sector</label>
<div class = "col-sm-9">
<select th:field="*{sector.id}" class="form-control" id="sector">
<option th:each="sector : ${sectores}" th:value="${sector.id}" th:text="${sector.nombre}"></option>
</select>
</div>
</div>
<div class="text-center">
<input type="submit" value="Guardar" class="btn"/>
<input type="button" value="Cancelar" id="btnCancelar" class="btn" onclick="goBack()"/>
</div>
</div>
</form>
<script>
function goBack() {
console.log("goBack function called");
window.history.back();
}
$(document).ready(function () {
$("form").on("submit", function (event) {
event.preventDefault();
var formData = $(this).serialize();
var sectorId = $('#sector').val();
formData += '&sector=' + encodeURIComponent(sectorId);
$(document).ready(function () {
$("form").on("submit", function (event) {
event.preventDefault();
var formData = $(this).serialize();
var sectorId = $('#sector').val();
formData += '&sector=' + encodeURIComponent(sectorId);
$.ajax({
url: '/empresa/save',
type: 'post',
data: formData,
success: function (response) {
if(response === "La empresa fue guardado con exito") {
window.history.go(-2); // Go back two pages
} else {
alert("Hubo un error al guardar la empresa");
window.history.go(-2);
}
},
error: function () {
alert("Hubo un error al guardar la empresa");
window.history.back();
}
});
});
});
});
});
</script>
</body>
</html>

@ -46,7 +46,7 @@
<h1>CREAR FAMILIA<a href="/logout" class="logout-button"><i class="fas fa-door-open"></i></a></h1>
<!--<form action="/familia/crearFamilia" method="post">-->
<!--TODO: Ask why this doesnt work and if it has to do with the jumping from editcontroler to familia controler-->
<form th:action="@{/familia/crearFamilia}" method="post">
<form th:action="@{/templates/admin/familia/crearFamilia}" method="post">
<label for="name">Nombre de Familia de Ciclos:</label><br>
<input type="text" id="name" name="name"><br>
<input type="submit" value="Crear">

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

@ -2,128 +2,13 @@
<html lang="en">
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
<!--<link rel="stylesheet" type="text/css" th:href="@{/style.css}">-->
<link rel="stylesheet" type="text/css" th:href="@{/style.css}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<meta charset="UTF-8">
<title>Title</title>
<style>
.logout-button {
position: fixed;
top: 0px;
right: 0px;
background-color: red;
color: white;
border: none;
text-decoration: none;
font-size: 20px;
padding: 0px;
margin: 0px;
border-radius: 0;
display: flex;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
}
th {
background-color: #f2f2f2;
color: black;
padding: 10px;
border: 1px solid #ddd;
}
h1 {
text-align: center;
text-decoration: underline;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-size: 50px;
color: white;
margin-top: 0;
margin-left: 0;
margin-right: 0;
margin-bottom: 50px;
padding-top: 0;
padding-left: 0;
padding-right: 0;
width: 100%;
position: relative;
}
.table {
table-layout: fixed; /* This will create a fixed layout for the table */
width: 100%; /* This will set the table width to 100% */
}
.table td, .table th {
width: 150px; /* Adjust this value according to your needs */
height: 50px; /* Adjust this value according to your needs */
overflow: hidden; /* This will hide any content that exceeds the cell size */
text-overflow: ellipsis; /* This will add '...' at the end if the content is too long */
white-space: nowrap; /* This will prevent the content from wrapping to the next line */
}
.table thead th {
position: sticky;
top: 0;
background: #fff;
z-index: 10;
}
.table td {
width: 150px; /* Adjust this value according to your needs */
overflow: hidden; /* This will hide any content that exceeds the cell size */
text-overflow: ellipsis; /* This will add '...' at the end if the content is too long */
white-space: nowrap; /* This will prevent the content from wrapping to the next line */
}
@media screen and (max-width: 600px) {
.table {
}
}
.table tr {
height: 10%;
}
body {
margin: 0;
padding: 0px;
}
.header {
display: flex;
align-items: center;
background-color: #007BFF;
justify-content: space-between;
padding: 0;
box-sizing: border-box;
}
.header h1 {
margin: 0;
}
.header button {
margin-right: auto;
}
.logout-button {
position: relative;
}
.logout-button {
position: relative;
}
html, body {
margin: 0;
padding: 0;
}
.page{
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
}
.page a{
padding:10px;
}
.inactive {
pointer-events: none;
color: grey;
}
.no-link-style {
color: inherit;
text-decoration: none;
}
</style>
</head>
<body>
@ -134,7 +19,7 @@
</div>
<input type="text" id="myInput" placeholder="Buscar por....">
<input type="text" id="myInput" placeholder="Buscar por...."> <i class="fas fa-plus" id="create-icon"></i>
<div class="table-container">
<table class="table" id="table">
@ -180,7 +65,11 @@
<tbody>
<tr class="cell" th:each="empresa :${empresas}">
<td>[[${empresa.id}]]</td>
<td><a th:href="@{/empresa/{id}(id=${empresa.id})}">[[${empresa.nombre}]] <i class="fa-solid fa-pen-to-square"></i></a></td>
<td>
<a th:href="@{/templates/admin/empresa/{id}(id=${empresa.id})}">[[${empresa.nombre}]]</a>
<i id="edit-icon" class="fas fa-pen-square"></i>
<i id="delete-icon" class="fas fa-ban"></i>
</td>
<td>[[${empresa.cif}]]</td>
<td>[[${empresa.correo}]]</td>
<td>[[${empresa.telefono}]]</td>
@ -253,7 +142,11 @@
var row = document.createElement('tr');
row.innerHTML = `
<td>${empresa.id}</td>
<td>${empresa.nombre}</td>
<td>
<a href="/templates/admin/empresa/${empresa.id}">${empresa.nombre}</a>
<i id="edit-icon" class="fas fa-pen-square"></i>
<i id="delete-icon" class="fas fa-ban"></i>
</td>
<td>${empresa.cif}</td>
<td>${empresa.correo}</td>
<td>${empresa.telefono}</td>
@ -265,6 +158,12 @@
});
}
});
document.getElementById('create-icon').addEventListener('click', function() {
window.location = "/admin/empresa/create";
});
</script>
</body>
</html>

@ -25,7 +25,7 @@
<tbody>
<tr class="cell" th:each="familia :${familias}">
<td>[[${familia.id}]]</td>
<td><a th:href="@{/familia/{id}(id=${familia.id})}">[[${familia.nombre}]]</a></td>
<td><a th:href="@{/templates/admin/familia/{id}(id=${familia.id})}">[[${familia.nombre}]]</a></td>
</tr>
</tbody>

Loading…
Cancel
Save

Powered by INFORMATICA.FP.EDU.ES.