diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5f3f6b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/curriculumsearch/pom.xml b/curriculumsearch/pom.xml index 0068dd8..eea26ac 100644 --- a/curriculumsearch/pom.xml +++ b/curriculumsearch/pom.xml @@ -74,6 +74,13 @@ + + kr.pe.kwonnam.jsp + jsp-template-inheritance + 0.3.RELEASE + compile + + diff --git a/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java b/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java index 342dfaf..d1f6a84 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java @@ -1,6 +1,8 @@ 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()); diff --git a/curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java b/curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java index e7a5333..b8649b2 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java @@ -1,5 +1,7 @@ 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()); diff --git a/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java b/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java index 5b5ece5..e2181d6 100644 --- a/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java +++ b/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java @@ -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() { diff --git a/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java b/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java index 556bc1c..c78b922 100644 --- a/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java +++ b/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java @@ -8,4 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository; public interface CargoRepository extends JpaRepository{ public List findByNombreContainingIgnoreCase(String nombre); + public boolean existsByNombreIgnoreCase(String nombre); } diff --git a/curriculumsearch/src/main/java/com/roshka/repositorio/TecnologiaRepository.java b/curriculumsearch/src/main/java/com/roshka/repositorio/TecnologiaRepository.java index fed1587..b1cbba7 100644 --- a/curriculumsearch/src/main/java/com/roshka/repositorio/TecnologiaRepository.java +++ b/curriculumsearch/src/main/java/com/roshka/repositorio/TecnologiaRepository.java @@ -9,4 +9,6 @@ import com.roshka.modelo.Tecnologia; public interface TecnologiaRepository extends JpaRepository { public List findByNombreContainingIgnoreCase(String nombre); + + public boolean existsByNombreIgnoreCase(String nombre); } diff --git a/curriculumsearch/src/main/resources/application.properties b/curriculumsearch/src/main/resources/application.properties index 031335f..db9e3ea 100644 --- a/curriculumsearch/src/main/resources/application.properties +++ b/curriculumsearch/src/main/resources/application.properties @@ -1,10 +1,10 @@ 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 diff --git a/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp b/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp index 1b88d76..c8b48cb 100644 --- a/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp +++ b/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp @@ -1,54 +1,39 @@ -<%@ 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" %> - - - - - - - Cargo - - - - - - - +<%@ 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"%> + + - ${cargo.id == null ? "Agregar" : "Modificar"} Cargo - - - Nombre del cargo - - - - - - - - - - - + ${cargo.id == null ? "Agregar" : "Modificar"} Cargo + + + Nombre del cargo + + + + Este nombre ya existe + + + + + + + + + + + + diff --git a/curriculumsearch/src/main/webapp/jsp/cargos.jsp b/curriculumsearch/src/main/webapp/jsp/cargos.jsp index acda338..9e4aeb2 100644 --- a/curriculumsearch/src/main/webapp/jsp/cargos.jsp +++ b/curriculumsearch/src/main/webapp/jsp/cargos.jsp @@ -1,67 +1,51 @@ <%@ 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" %> - - - - - - - Cargo - - - - - - - - Lista de cargos - - - Nombre: - - - - Agregar Nuevo Cargo - - - - - - # - Cargo - - - - - - ${sta.index+1} - ${cargo.getNombre()} - - Ver Convocatorias - - Editar cargo - - - - - - - - +<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> + + + + Lista de cargos + + + Nombre: + + + + Agregar Nuevo Cargo + + + + + + # + Cargo + + + + + + ${sta.index+1} + ${cargo.getNombre()} + + Ver Convocatorias + + Editar cargo + + + + + + + + + + + diff --git a/curriculumsearch/src/main/webapp/jsp/convocatoria-form.jsp b/curriculumsearch/src/main/webapp/jsp/convocatoria-form.jsp index 6653ffd..d922034 100644 --- a/curriculumsearch/src/main/webapp/jsp/convocatoria-form.jsp +++ b/curriculumsearch/src/main/webapp/jsp/convocatoria-form.jsp @@ -1,47 +1,38 @@ <%@ 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" %> - - - - - - - Convocatoria - - - - - - - - Agregar Convocatoria - - - - Fecha inicial - - - - - Fecha Fin - - - - Cupos: - - - - Cargo - - - ${cargo.nombre} - - - - Guardar - - - - - \ No newline at end of file +<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> + + + ${convocatoria.id == null ? "Agregar" : "Modificar"} Convocatoria + + + + Fecha inicial + + + + + Fecha Fin + + + + Cupos: + + + + Cargo + + + ${cargo.nombre} + + + + Guardar + + + + + + + diff --git a/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp b/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp index cdec6d8..8d9df9b 100644 --- a/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp +++ b/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp @@ -1,20 +1,9 @@ <%@ 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" %> - - - - - - - Cargo - - - - - - - +<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> + + Lista de convocatorias @@ -67,7 +56,8 @@ - - - - \ No newline at end of file + + + + + diff --git a/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp b/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp index 3eeaffc..42bc193 100644 --- a/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp +++ b/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp @@ -1,21 +1,9 @@ <%@ 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" %> - - - - - - - - Tecnologia - - - - - - - +<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> + + DETALLE POSTULANTE @@ -107,13 +95,7 @@ + + + - - - - - - - - - \ No newline at end of file diff --git a/curriculumsearch/src/main/webapp/jsp/index.jsp b/curriculumsearch/src/main/webapp/jsp/index.jsp index 6112019..f3e56ce 100644 --- a/curriculumsearch/src/main/webapp/jsp/index.jsp +++ b/curriculumsearch/src/main/webapp/jsp/index.jsp @@ -8,7 +8,7 @@ - Document + RRHH diff --git a/curriculumsearch/src/main/webapp/jsp/layouts/base.jsp b/curriculumsearch/src/main/webapp/jsp/layouts/base.jsp new file mode 100644 index 0000000..9c97b2a --- /dev/null +++ b/curriculumsearch/src/main/webapp/jsp/layouts/base.jsp @@ -0,0 +1,79 @@ +<%@ 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" %> + + + + + + + + RRHH + + + + + + + + ROSHKA + + + + + + + Home + + + + + Cargos + + + Agregar Cargo + Agregar Convocatoria + Listar cargos + Listar convocatorias + + + + + Tecnologias + + + Agregar + Listar + + + + + Postulantes + + + Agregar + Listar + + + + Salir + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp index 2920166..6fbd783 100644 --- a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp +++ b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp @@ -1,147 +1,136 @@ <%@ 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" %> - - - - - - - - - Lista de postulantes - - - - - - Lista de Postulantes - - - Nombre - - Buscar - - Estado - - Seleccione una opcion - - ${estados.getEstado()} - - - Disponbilidad - - Seleccione una opcion - - ${disponibilidad.getDescripcion()} - - - Tecnologias - - Seleccione una opcion - - ${tecnologia.nombre} - - - Institucion Educativa - - Seleccione una opcion - - ${inst.nombre} - - +<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> + + + Lista de Postulantes + + + Nombre + + Buscar - Nivel de Ingles - - Seleccione una opcion - - ${lvl} - - - Nivel de Tecnologia - - Seleccione una opcion - - ${lvl} + Estado + + Seleccione una opcion + + ${estados.getEstado()} + + + Disponbilidad + + Seleccione una opcion + + ${disponibilidad.getDescripcion()} + + + Tecnologias + + Seleccione una opcion + + ${tecnologia.nombre} + + + Institucion Educativa + + Seleccione una opcion + + ${inst.nombre} + + + + Nivel de Ingles + + Seleccione una opcion + + ${lvl} + + + Nivel de Tecnologia + + Seleccione una opcion + + ${lvl} + + + Experiencia en general + + Seleccione una opcion + Mayor a 6 meses + Mayor a 1 año + Mayor a 3 años + Mayor a 5 años + + + + + + + + # + Nombre + Disponibilidad + Nivel de Ingles + Experiencia + Tecnologias + Estado + + + + + + ${staPost.index + 1} + ${postulante.nombre} ${postulante.apellido} + ${postulante.disponibilidad.getDescripcion()} + ${postulante.nivelIngles} + ${postulante.experienciaMeses} + + + ${detalle_tecnologia.getTecnologia().getNombre()}${not staTec.last ? "," : ""} + + + ${postulante.estado.getEstado()} + Ver + + + + + + + + + + ${nro} - - Experiencia en general - - Seleccione una opcion - Mayor a 6 meses - Mayor a 1 año - Mayor a 3 años - Mayor a 5 años - + + + + + + - - - \ 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() + + + diff --git a/curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp b/curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp index 0470123..5fb19f9 100644 --- a/curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp +++ b/curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp @@ -1,45 +1,24 @@ <%@ 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" %> - - - - - - - - - - - - Agregar Tecnologia - - - - - - - - Agregar Tecnologia +<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> + + + ${tecnologia.id == null ? "Agregar" : "Modificar"} Tecnologia - Nombre: + Nombre: + + + Este nombre ya existe + - - - - - - - - - - - \ No newline at end of file + + \ No newline at end of file diff --git a/curriculumsearch/src/main/webapp/jsp/tecnologias.jsp b/curriculumsearch/src/main/webapp/jsp/tecnologias.jsp index b0f6899..3570908 100644 --- a/curriculumsearch/src/main/webapp/jsp/tecnologias.jsp +++ b/curriculumsearch/src/main/webapp/jsp/tecnologias.jsp @@ -1,20 +1,9 @@ <%@ 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" %> - - - - - - - Tecnologia - - - - - - - +<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> + + Lista de Tecnologias @@ -49,7 +38,5 @@ - - - - \ No newline at end of file + +