Commit 488c141e by Joel Florentin

template inheritance jsp. validacion de nombre duplicado en tecnologia y cargo

parent b18ad9e9
{
"java.configuration.updateBuildConfiguration": "interactive"
}
\ No newline at end of file
......@@ -74,6 +74,13 @@
<!-- <version>1.18.22</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>kr.pe.kwonnam.jsp</groupId>
<artifactId>jsp-template-inheritance</artifactId>
<version>0.3.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
......
package com.roshka.controller;
import javax.validation.Valid;
import com.roshka.modelo.Cargo;
import com.roshka.repositorio.CargoRepository;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -42,8 +44,11 @@ public class CargoController {
}
@PostMapping(path = {"/cargo","/cargo/{id}"})
public String guardarCargo(@ModelAttribute Cargo cargo, BindingResult result, @PathVariable(required = false) Long id) {
if(result.hasErrors());
public String guardarCargo(@Valid @ModelAttribute Cargo cargo, BindingResult result, @PathVariable(required = false) Long id, Model model) {
if(result.hasErrors() || (id==null && cargoRepo.existsByNombreIgnoreCase(cargo.getNombre()) )){
model.addAttribute("mismoNombre", true);
return "cargo-form";
};
if(id != null ) cargo.setId(id);
cargoRepo.save(cargo);
System.out.println(cargo.getNombre());
......
package com.roshka.controller;
import javax.validation.Valid;
import com.roshka.modelo.Tecnologia;
import com.roshka.repositorio.TecnologiaRepository;
......@@ -45,8 +47,11 @@ public String addtecnologiaView(Model model,@PathVariable(required = false) Long
}
@PostMapping(path = {"/tecnologia","/tecnologia/{id}"})
public String addtecnologia(@ModelAttribute Tecnologia tecnologia, BindingResult result, @PathVariable(required = false) Long id) {
if(result.hasErrors());
public String addtecnologia(@Valid @ModelAttribute Tecnologia tecnologia, BindingResult result, @PathVariable(required = false) Long id, Model model) {
if(result.hasErrors() || (id==null && tecRepo.existsByNombreIgnoreCase(tecnologia.getNombre()))){
model.addAttribute("mismoNombre", true);
return "tecnologia-form";
}
if(id != null ) tecnologia.setId(id);
tecRepo.save(tecnologia);
System.out.println(tecnologia.getNombre());
......
......@@ -15,17 +15,17 @@ public class Tecnologia {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name="id")
private long id;
private Long id;
@Column(name="nombre")
@NotBlank(message = "Este campo no puede estar vacio")
private String nombre;
public long getId() {
public Long getId() {
return id;
}
public void setId(long id) {
public void setId(Long id) {
this.id = id;
}
public String getNombre() {
......
......@@ -8,4 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
public interface CargoRepository extends JpaRepository<Cargo,Long>{
public List<Cargo> findByNombreContainingIgnoreCase(String nombre);
public boolean existsByNombreIgnoreCase(String nombre);
}
......@@ -9,4 +9,6 @@ import com.roshka.modelo.Tecnologia;
public interface TecnologiaRepository extends JpaRepository<Tecnologia,Long> {
public List<Tecnologia> findByNombreContainingIgnoreCase(String nombre);
public boolean existsByNombreIgnoreCase(String nombre);
}
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
#spring.jpa.show-sql=true
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
#logging.level.org.hibernate.SQL=DEBUG
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.sql.init.mode=always
spring.sql.init.platform=postgres
......@@ -16,3 +16,5 @@ spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
#server.port=8888
spring.mvc.view.prefix=/jsp/
spring.mvc.view.suffix=.jsp
jsp-inheritance-prefix=/jsp/layouts/
jsp-inheritance-suffix=.jsp
\ No newline at end of file
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib
prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ page
contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cargo</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"
></script>
</head>
<body>
<jsp:include page="header.jsp" />
<jsp:include page="alerts.jsp" />
<div class="container-xxl my-md-4 bd-layout">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<div class="card d-flex flex-column justify-content-center align-items-center mx-auto mt-2 p-3" style="width: 20rem;">
<h5 class="card-title">${cargo.id == null ? "Agregar" : "Modificar"} Cargo</h5>
<form:form
action="/cargo/${cargo.id == null ? '' : cargo.id}"
method="post"
modelAttribute="cargo"
class="card-body d-flex flex-column"
>
<div class="">
<form:label class="form-label visually-hidden" path="nombre"
>Nombre del cargo
</form:label>
<form:input
type="text"
path="nombre"
class="form-control"
placeholder="Nombre del cargo" required="true"
/>
</div>
<div class="mt-2 align-self-end">
<input type="submit" value="Guardar" class="btn btn-primary" />
</div>
</form:form>
</div>
</div>
</body>
</html>
<h5 class="card-title">${cargo.id == null ? "Agregar" : "Modificar"} Cargo</h5>
<form:form
action="/cargo/${cargo.id == null ? '' : cargo.id}"
method="post"
modelAttribute="cargo"
class="card-body d-flex flex-column"
>
<div class="">
<form:label class="form-label visually-hidden" path="nombre"
>Nombre del cargo
</form:label>
<form:input
type="text"
path="nombre"
class="form-control ${ mismoNombre ? 'is-invalid' : ''}"
placeholder="Nombre del cargo" required="true"
/>
<div id="validationServerUsernameFeedback" class="invalid-feedback">
Este nombre ya existe
</div>
</div>
<div class="mt-2 align-self-end">
<input type="submit" value="Guardar" class="btn btn-primary" />
</div>
</form:form>
</div>
</layout:put>
<layout:put block="scripts" type="APPEND">
</layout:put>
</layout:extends>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib
prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ page
contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cargo</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"
></script>
</head>
<body>
<jsp:include page="header.jsp" />
<jsp:include page="alerts.jsp" />
<div class="container-xxl my-md-4 bd-layout">
<h2>Lista de cargos</h2>
<div>
<form>
<label for="cargos">Nombre:</label>
<input
type="text"
name="nombre"
id="nombre"
value="${param.nombre}"
/>
<input type="submit" value="Buscar" />
</form>
<a href="/cargo">Agregar Nuevo Cargo</a>
</div>
<div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Cargo</th>
</tr>
</thead>
<tbody>
<c:forEach items="${cargos}" var="cargo" varStatus="sta">
<tr>
<th scope="row">${sta.index+1}</th>
<td>${cargo.getNombre()}</td>
<td>
<a href="/convocatorias?cargoId=${cargo.id}"
>Ver Convocatorias</a
>
</td>
<td><a href="/cargo/${cargo.id}">Editar cargo</a></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</body>
</html>
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<div class="container-xxl my-md-4 bd-layout">
<h2>Lista de cargos</h2>
<div>
<form>
<label for="cargos">Nombre:</label>
<input
type="text"
name="nombre"
id="nombre"
value="${param.nombre}"
/>
<input type="submit" value="Buscar" />
</form>
<a href="/cargo">Agregar Nuevo Cargo</a>
</div>
<div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Cargo</th>
</tr>
</thead>
<tbody>
<c:forEach items="${cargos}" var="cargo" varStatus="sta">
<tr>
<th scope="row">${sta.index+1}</th>
<td>${cargo.getNombre()}</td>
<td>
<a href="/convocatorias?cargoId=${cargo.id}"
>Ver Convocatorias</a
>
</td>
<td><a href="/cargo/${cargo.id}">Editar cargo</a></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</layout:put>
<layout:put block="scripts" type="APPEND">
</layout:put>
</layout:extends>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Convocatoria</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>
<body>
<jsp:include page="header.jsp"/>
<jsp:include page="alerts.jsp"/>
<div class="container-xxl my-md-4 bd-layout">
<h2>Agregar Convocatoria</h2>
<div class="p-3 mb-2 bg-light text-dark border border-light ">
<form:form action="/convocatoria/${convocatoria.id == null ? '' : convocatoria.id}" method="post" modelAttribute="convocatoria">
<div class="mb-3 col-3">
<form:label path="fechaInicioS" class="form-label">Fecha inicial</form:label>
<form:input type="date" class="form-control" path="fechaInicioS" required="true"/>
</div>
<div class="mb-3 col-3">
<form:label path="fechaFinS" class="form-label">Fecha Fin</form:label>
<form:input type="date" class="form-control" path="fechaFinS" required="true"/>
</div>
<div class="mb-3 col-3">
<form:label path="cupos" class="form-label">Cupos:</form:label>
<form:input type="number" class="form-control" path="cupos" required="true"/>
</div>
<div class="mb-3 col-3">
<form:label path="cargoId" class="form-label">Cargo</form:label>
<form:select class="form-select" path="cargoId" required="true">
<c:forEach items="${cargos}" var="cargo">
<form:option value="${cargo.id}">${cargo.nombre} </form:option>
</c:forEach>
</form:select>
</div>
<button type="submit" class="btn btn-primary">Guardar</button>
</form:form>
</div>
</div>
</body>
</html>
\ No newline at end of file
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<h2>${convocatoria.id == null ? "Agregar" : "Modificar"} Convocatoria</h2>
<div class="p-3 mb-2 bg-light text-dark border border-light ">
<form:form action="/convocatoria/${convocatoria.id == null ? '' : convocatoria.id}" method="post" modelAttribute="convocatoria">
<div class="mb-3 col-3">
<form:label path="fechaInicioS" class="form-label">Fecha inicial</form:label>
<form:input type="date" class="form-control" path="fechaInicioS" required="true"/>
</div>
<div class="mb-3 col-3">
<form:label path="fechaFinS" class="form-label">Fecha Fin</form:label>
<form:input type="date" class="form-control" path="fechaFinS" required="true"/>
</div>
<div class="mb-3 col-3">
<form:label path="cupos" class="form-label">Cupos:</form:label>
<form:input type="number" class="form-control" path="cupos" required="true"/>
</div>
<div class="mb-3 col-3">
<form:label path="cargoId" class="form-label">Cargo</form:label>
<form:select class="form-select" path="cargoId" required="true">
<c:forEach items="${cargos}" var="cargo">
<form:option value="${cargo.id}">${cargo.nombre} </form:option>
</c:forEach>
</form:select>
</div>
<button type="submit" class="btn btn-primary">Guardar</button>
</form:form>
</div>
</layout:put>
<layout:put block="scripts" type="APPEND">
</layout:put>
</layout:extends>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cargo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>
<body >
<jsp:include page="header.jsp"/>
<jsp:include page="alerts.jsp"/>
<div class="container-xxl my-md-4 bd-layout">
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<h2>Lista de convocatorias</h2>
<div>
<form>
......@@ -67,7 +56,8 @@
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
</layout:put>
<layout:put block="scripts" type="APPEND">
</layout:put>
</layout:extends>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tecnologia</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>
<body>
<jsp:include page="header.jsp"/>
<jsp:include page="alerts.jsp"/>
<div class="container-xxl my-md-4 bd-layout">
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<h2 style="text-align: center;">DETALLE POSTULANTE</h2>
<div style="padding: 10px;margin: 3px;border: 1px solid black;">
......@@ -107,13 +95,7 @@
</div>
<input type="submit" value="submit"/>
</form:form>
</div>
</layout:put>
</layout:extends>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>Document</title>
<title>RRHH</title>
</head>
<body>
<jsp:include page="header.jsp"/>
......
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>RRHH</title>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">ROSHKA</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/home">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Cargos
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/cargo">Agregar Cargo</a></li>
<li><a class="dropdown-item" href="/convocatoria">Agregar Convocatoria</a></li>
<li><a class="dropdown-item" href="/cargos">Listar cargos</a></li>
<li><a class="dropdown-item" href="/convocatorias">Listar convocatorias</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Tecnologias
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/tecnologia">Agregar</a></li>
<li><a class="dropdown-item" href="/tecnologias">Listar</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Postulantes
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/postulante">Agregar</a></li>
<li><a class="dropdown-item" href="/postulantes">Listar</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="/logout">Salir</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container-xxl my-md-4 bd-layout">
<layout:block name="contents">
</layout:block>
</div>
<layout:block name="scripts">
</layout:block>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<title>Lista de postulantes</title>
</head>
<body>
<jsp:include page="header.jsp"/>
<jsp:include page="alerts.jsp"/>
<div class="container-xxl my-md-4 bd-layout">
<h2>Lista de Postulantes</h2>
<div id="buscador">
<form name="buscador">
<label for="nombre">Nombre</label>
<input type="text" name="nombre" id="nombre" value="${param.nombre}">
<button>Buscar</button>
<br>
<label for="estado">Estado</label>
<select name="estado" id="estado">
<option value="">Seleccione una opcion</option>
<c:forEach items="${estadoP}" var="estados">
<option value="${estados}" ${param.estado == estados ? "selected" : ""}>${estados.getEstado()}</option>
</c:forEach>
</select>
<label for="dispo">Disponbilidad</label>
<select name="dispo" id="dispo">
<option value="">Seleccione una opcion</option>
<c:forEach items="${disponibilidades}" var="disponibilidad">
<option value="${disponibilidad}" ${param.dispo == disponibilidad ? "selected" : ""}>${disponibilidad.getDescripcion()}</option>
</c:forEach>
</select>
<label for="tecId">Tecnologias</label>
<select name="tecId" id="tecId">
<option value="">Seleccione una opcion</option>
<c:forEach items="${tecnologias}" var="tecnologia">
<option value="${tecnologia.id}" ${param.tecId == tecnologia.id ? "selected" : ""}>${tecnologia.nombre}</option>
</c:forEach>
</select>
<label for="instId">Institucion Educativa</label>
<select name="instId" id="instId">
<option value="">Seleccione una opcion</option>
<c:forEach items="${institucionesEducativas}" var="inst">
<option value="${inst.id}" ${param.instId == inst.id ? "selected" : ""}>${inst.nombre}</option>
</c:forEach>
</select>
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<h2>Lista de Postulantes</h2>
<div id="buscador">
<form name="buscador">
<label for="nombre">Nombre</label>
<input type="text" name="nombre" id="nombre" value="${param.nombre}">
<button>Buscar</button>
<br>
<label for="lvlEng">Nivel de Ingles</label>
<select name="lvlEng" id="lvlEng">
<option value="">Seleccione una opcion</option>
<c:forEach var = "lvl" begin = "1" end = "5">
<option value="${lvl}" ${param.lvlEng == lvl ? "selected" : ""}>${lvl}</option>
</c:forEach>
</select>
<label for="lvlTec">Nivel de Tecnologia</label>
<select name="lvlTec" id="lvlTec">
<option value="">Seleccione una opcion</option>
<c:forEach var = "lvl" begin = "1" end = "5">
<option value="${lvl}" ${param.lvlTec == lvl ? "selected" : ""}>${lvl}</option>
<label for="estado">Estado</label>
<select name="estado" id="estado">
<option value="">Seleccione una opcion</option>
<c:forEach items="${estadoP}" var="estados">
<option value="${estados}" ${param.estado == estados ? "selected" : ""}>${estados.getEstado()}</option>
</c:forEach>
</select>
<label for="dispo">Disponbilidad</label>
<select name="dispo" id="dispo">
<option value="">Seleccione una opcion</option>
<c:forEach items="${disponibilidades}" var="disponibilidad">
<option value="${disponibilidad}" ${param.dispo == disponibilidad ? "selected" : ""}>${disponibilidad.getDescripcion()}</option>
</c:forEach>
</select>
<label for="tecId">Tecnologias</label>
<select name="tecId" id="tecId">
<option value="">Seleccione una opcion</option>
<c:forEach items="${tecnologias}" var="tecnologia">
<option value="${tecnologia.id}" ${param.tecId == tecnologia.id ? "selected" : ""}>${tecnologia.nombre}</option>
</c:forEach>
</select>
<label for="instId">Institucion Educativa</label>
<select name="instId" id="instId">
<option value="">Seleccione una opcion</option>
<c:forEach items="${institucionesEducativas}" var="inst">
<option value="${inst.id}" ${param.instId == inst.id ? "selected" : ""}>${inst.nombre}</option>
</c:forEach>
</select>
<br>
<label for="lvlEng">Nivel de Ingles</label>
<select name="lvlEng" id="lvlEng">
<option value="">Seleccione una opcion</option>
<c:forEach var = "lvl" begin = "1" end = "5">
<option value="${lvl}" ${param.lvlEng == lvl ? "selected" : ""}>${lvl}</option>
</c:forEach>
</select>
<label for="lvlTec">Nivel de Tecnologia</label>
<select name="lvlTec" id="lvlTec">
<option value="">Seleccione una opcion</option>
<c:forEach var = "lvl" begin = "1" end = "5">
<option value="${lvl}" ${param.lvlTec == lvl ? "selected" : ""}>${lvl}</option>
</c:forEach>
</select>
<label for="expInMonths">Experiencia en general</label>
<select name="expInMonths" id="expInMonths">
<option value="">Seleccione una opcion</option>
<option value="6">Mayor a 6 meses</option>
<option value="12">Mayor a 1 año</option>
<option value="36">Mayor a 3 años</option>
<option value="60">Mayor a 5 años</option>
</select>
</form>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Nombre</th>
<th scope="col">Disponibilidad</th>
<th scope="col">Nivel de Ingles</th>
<th scope="col">Experiencia</th>
<th scope="col">Tecnologias</th>
<th scope="col">Estado</th>
</tr>
</thead>
<tbody>
<c:forEach items="${postulantes}" var="postulante" varStatus="staPost">
<tr>
<th scope="row">${staPost.index + 1}</th>
<td>${postulante.nombre} ${postulante.apellido}</td>
<td>${postulante.disponibilidad.getDescripcion()}</td>
<td>${postulante.nivelIngles}</td>
<td>${postulante.experienciaMeses}<op></td>
<td>
<c:forEach items="${postulante.tecnologias}" var="detalle_tecnologia" varStatus="staTec">
${detalle_tecnologia.getTecnologia().getNombre()}${not staTec.last ? "," : ""}
</c:forEach>
</td>
<td>${postulante.estado.getEstado()}</td>
<td><a href="/postulante/${postulante.id}">Ver</a></td>
</tr>
</c:forEach>
</tbody>
</table>
<div>
<nav aria-label="Page navigation example">
<ul class="pagination">
<c:forEach begin="1" end="${pages}" var="nro">
<li class="page-item ${(param.nroPagina == null and nro == 1) or param.nroPagina == nro-1 ? 'active' : ''}"><a class="page-link" href="javascript:buscarPagina(${nro})">${nro}</a></li>
</c:forEach>
</select>
<label for="expInMonths">Experiencia en general</label>
<select name="expInMonths" id="expInMonths">
<option value="">Seleccione una opcion</option>
<option value="6">Mayor a 6 meses</option>
<option value="12">Mayor a 1 año</option>
<option value="36">Mayor a 3 años</option>
<option value="60">Mayor a 5 años</option>
</select>
</ul>
</nav>
</div>
</layout:put>
<layout:put block="scripts" type="APPEND">
<script>
function habilitarLvlTec(){
//si se selecciono una tecnologia entonces permitir seleccionar un nivel
lvlTec.disabled = tecId.value == false
if(lvlTec.disabled){
lvlTec.firstElementChild.selected=true;
}
</form>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Nombre</th>
<th scope="col">Disponibilidad</th>
<th scope="col">Nivel de Ingles</th>
<th scope="col">Experiencia</th>
<th scope="col">Tecnologias</th>
<th scope="col">Estado</th>
</tr>
</thead>
<tbody>
<c:forEach items="${postulantes}" var="postulante" varStatus="staPost">
<tr>
<th scope="row">${staPost.index + 1}</th>
<td>${postulante.nombre} ${postulante.apellido}</td>
<td>${postulante.disponibilidad.getDescripcion()}</td>
<td>${postulante.nivelIngles}</td>
<td>${postulante.experienciaMeses}<op></td>
<td>
<c:forEach items="${postulante.tecnologias}" var="detalle_tecnologia" varStatus="staTec">
${detalle_tecnologia.getTecnologia().getNombre()}${not staTec.last ? "," : ""}
</c:forEach>
</td>
<td>${postulante.estado.getEstado()}</td>
<td><a href="/postulante/${postulante.id}">Ver</a></td>
</tr>
</c:forEach>
</tbody>
</table>
<div>
<nav aria-label="Page navigation example">
<ul class="pagination">
<c:forEach begin="1" end="${pages}" var="nro">
<li class="page-item ${(param.nroPagina == null and nro == 1) or param.nroPagina == nro-1 ? 'active' : ''}"><a class="page-link" href="javascript:buscarPagina(${nro})">${nro}</a></li>
</c:forEach>
</ul>
</nav>
</div>
</div>
<script>
function habilitarLvlTec(){
//si se selecciono una tecnologia entonces permitir seleccionar un nivel
lvlTec.disabled = tecId.value == false
if(lvlTec.disabled){
lvlTec.firstElementChild.selected=true;
}
}
function buscarPagina(nro){
nro--
const aBuscar = 'nroPagina='+nro
if(!location.search) location.search = "?"+aBuscar
const inicial = location.search.search(aBuscar);
if(inicial==-1){//si no se encuentra y hay otros queries
location.search = "&"+aBuscar
}
location.search.replace('nroPagina=',aBuscar)
}
const tecId = document.querySelector("#tecId");
const lvlTec = document.querySelector("#lvlTec");
tecId.addEventListener('change',habilitarLvlTec);
habilitarLvlTec()
</script>
</body>
</html>
\ No newline at end of file
}
function buscarPagina(nro){
nro--
const aBuscar = 'nroPagina='+nro
if(!location.search) location.search = "?"+aBuscar
const inicial = location.search.search(aBuscar);
if(inicial==-1){//si no se encuentra y hay otros queries
location.search = "&"+aBuscar
}
location.search.replace('nroPagina=',aBuscar)
}
const tecId = document.querySelector("#tecId");
const lvlTec = document.querySelector("#lvlTec");
tecId.addEventListener('change',habilitarLvlTec);
habilitarLvlTec()
</script>
</layout:put>
</layout:extends>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<title>Agregar Tecnologia</title>
</head>
<body>
<jsp:include page="header.jsp"/>
<jsp:include page="alerts.jsp"/>
<div class="container-xxl my-md-4 bd-layout">
<h2>Agregar Tecnologia</h2>
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<h2>${tecnologia.id == null ? "Agregar" : "Modificar"} Tecnologia</h2>
<div class="p-3 mb-2 bg-light text-dark border border-light">
<form:form action="/tecnologia/${tecnologia.id == null ? '' : tecnologia.id}" method="post" modelAttribute="tecnologia" class="row row-cols-lg-auto g-3 align-items-center">
<div class="col-12">
<form:label class="form-label visually-hidden" path="nombre">Nombre: </form:label> <form:input type="text" path="nombre" class="form-control" required="true" placeholder="Nombre de la tecnologia"/>
<form:label class="form-label visually-hidden" path="nombre">Nombre: </form:label>
<form:input type="text" path="nombre" class="form-control ${ mismoNombre ? 'is-invalid' : ''}" required="true" placeholder="Nombre de la tecnologia"/>
<div id="validationServerUsernameFeedback" class="invalid-feedback">
Este nombre ya existe
</div>
</div>
<div class="col-12">
<input type="submit" value="Guardar" class="btn btn-primary"/>
</div>
</form:form>
</div>
</div>
</body>
</html>
\ No newline at end of file
</layout:put>
</layout:extends>
\ No newline at end of file
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tecnologia</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</head>
<body>
<jsp:include page="header.jsp"/>
<jsp:include page="alerts.jsp"/>
<div class="container-xxl my-md-4 bd-layout">
<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%>
<layout:extends name="layouts/base.jsp">
<layout:put block="contents" type="REPLACE">
<h2>Lista de Tecnologias</h2>
<div>
......@@ -49,7 +38,5 @@
</tbody>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
</layout:put>
</layout:extends>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment