diff --git a/curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java b/curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java index 219922f..6b366df 100644 --- a/curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java +++ b/curriculumsearch/src/main/java/com/roshka/configuration/WebSecurityConfig.java @@ -53,6 +53,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .mvcMatchers("/home").authenticated() .mvcMatchers("/cargo*").authenticated() .mvcMatchers("/convocatoria*").authenticated() + .mvcMatchers("/convocatoria/crear/*").authenticated() .mvcMatchers("/tecnologia*").authenticated() .mvcMatchers("/postulantes","/postulantes/**").authenticated() .mvcMatchers("/edit-user-data").authenticated() diff --git a/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java b/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java index 110aabb..12f324e 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java @@ -62,12 +62,6 @@ public class ConvocatoriaController { //model.addAttribute("convocatorias",cargoId==null? convoRepo.findAll() : convoRepo.findByCargoId(cargoId)); return "convocatorias"; } - @RequestMapping("/convocatoria") - public String formConvocatoria(Model model) { - model.addAttribute("cargos", cargoRepo.findAll()); - model.addAttribute("convocatoria", new ConvocatoriaCargo()); - return "convocatoria-form"; - } @PostMapping("/convocatoria") public String guardarConvocatoria(@ModelAttribute ConvocatoriaCargo convocatoria, BindingResult result,RedirectAttributes redirectAttributes) { @@ -84,7 +78,20 @@ public class ConvocatoriaController { System.out.println(convocatoria.getFechaInicio()); return "redirect:/convocatorias"; } - + @RequestMapping("/convocatoria/crear/{id}") + public String guardarConvocatoriaa(@PathVariable(required = false) Long id) { + ConvocatoriaCargo convocatoria=new ConvocatoriaCargo(); + convocatoria.setCargo(cargoRepo.findByIdCargo(id)); + convocatoria.setCargoId(cargoRepo.findByIdCargo(id).getId()); + System.out.println(cargoRepo.findByIdCargo(id).getNombre()); + convocatoria.setFechaInicio(new Date()); + convocatoria.setEstado(EstadoConvocatoria.abierto); + convocatoria.getCargo().setExisteConvocatoria(true); + convoRepo.save(convocatoria); + System.out.println(convocatoria.getFechaInicio()); + + return "redirect:/convocatorias"; + } /* @RequestMapping("/convocatoria/{id}") public String formConvocatoria(Model model,@PathVariable(required = false) Long id) { @@ -111,6 +118,7 @@ public class ConvocatoriaController { convocatoria=convoRepo.findByIdConvocatoriaCargo(id); convocatoria.setEstado(EstadoConvocatoria.cerrado); convocatoria.setFechaFin(new Date()); + convocatoria.getCargo().setExisteConvocatoria(false); convoRepo.save(convocatoria); /*if(id != null) convocatoria.setId(id); //System.out.println(convoRepo.filtrarConvocatoriasPorCargo(convocatoria.getCargoId())); diff --git a/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java b/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java index ff93814..287a41e 100644 --- a/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java +++ b/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java @@ -30,6 +30,9 @@ public class Cargo { @JsonManagedReference private List convocatorias; + @Column(name = "existe_convocatoria") + boolean existeConvocatoria=false; + public List getConvocatorias() { return convocatorias; } @@ -39,4 +42,13 @@ public class Cargo { public static Object values() { return null; } + + public boolean isExisteConvocatoria() { + return this.existeConvocatoria; + } + + public void setExisteConvocatoria(boolean existeConvocatoria) { + this.existeConvocatoria = existeConvocatoria; + } + } diff --git a/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java b/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java index 30734d1..7cd119d 100644 --- a/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java +++ b/curriculumsearch/src/main/java/com/roshka/repositorio/CargoRepository.java @@ -11,9 +11,10 @@ import org.springframework.data.jpa.repository.Query; public interface CargoRepository extends JpaRepository{ public Page findByNombreContainingIgnoreCase(String nombre, Pageable pageable); - + @Query(value = "SELECT c FROM Cargo c WHERE c.id=?1") + public Cargo findByIdCargo(Long id); public boolean existsByNombreIgnoreCase(String nombre); - + public List findByexisteConvocatoriaFalse(); @Query(value = "SELECT * FROM cargo",nativeQuery = true) public Page findAllCargo(Pageable pageable ); } diff --git a/curriculumsearch/src/main/resources/json/cargo.json b/curriculumsearch/src/main/resources/json/cargo.json index 09246dd..0735c98 100644 --- a/curriculumsearch/src/main/resources/json/cargo.json +++ b/curriculumsearch/src/main/resources/json/cargo.json @@ -1,22 +1,27 @@ [ { "id": 1, - "nombre": "dev java" + "nombre": "dev java", + "existeConvocatoria":true }, { "id": 2, - "nombre": "dev php" + "nombre": "dev php", + "existeConvocatoria":true }, { "id": 3, - "nombre": "dev python" + "nombre": "dev python", + "existeConvocatoria":true }, { "id": 4, - "nombre": "dev c" + "nombre": "dev c", + "existeConvocatoria":true }, { "id": 5, - "nombre": "dev android" + "nombre": "dev android", + "existeConvocatoria":true } ] \ No newline at end of file diff --git a/curriculumsearch/src/main/webapp/jsp/cargos.jsp b/curriculumsearch/src/main/webapp/jsp/cargos.jsp index 5d9754a..b6ed957 100644 --- a/curriculumsearch/src/main/webapp/jsp/cargos.jsp +++ b/curriculumsearch/src/main/webapp/jsp/cargos.jsp @@ -51,6 +51,11 @@ contentType="text/html;charset=UTF-8" language="java" %> > Editar cargo + + + abrirConvocatoria + + diff --git a/curriculumsearch/src/main/webapp/jsp/convocatoria-form.jsp b/curriculumsearch/src/main/webapp/jsp/convocatoria-form.jsp deleted file mode 100644 index bea8210..0000000 --- a/curriculumsearch/src/main/webapp/jsp/convocatoria-form.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ 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"%> - - - -

${convocatoria.id == null ? "Agregar" : "Modificar"} Convocatoria

-
- -
- Cargo - - - ${cargo.nombre} - - -
- -
-
-
- - - -
diff --git a/curriculumsearch/src/main/webapp/jsp/detallepostulante2.jsp b/curriculumsearch/src/main/webapp/jsp/detallepostulante2.jsp deleted file mode 100644 index 898022f..0000000 --- a/curriculumsearch/src/main/webapp/jsp/detallepostulante2.jsp +++ /dev/null @@ -1,397 +0,0 @@ -<%@ 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" %> -<%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> - - - - -
-

- DETALLE POSTULANTE -

-
-
-
-
-
-
-
Nombre
-
-
- ${postulante.nombre} ${postulante.apellido} -
-
-
-
-
-
Email
-
-
- ${postulante.correo} -
-
-
-
-
-
Vive en
-
-
- ${postulante.getCiudad().getNombre()}, ${postulante.getCiudad().getDepartamento().getNombre()} -
-
-
-
-
-
Nro de Documento
-
-
- ${postulante.tipoDocumento}: ${postulante.nroDocument} -
-
-
-
-
-
Telefono
-
-
- ${postulante.telefono} -
-
-
-
-
-
Edad
-
-
- -
-
-
-
-
Direccion
-
-
- ${postulante.direccion} -
-
-
-
-
-
Nivel de Ingles
-
-
- ${postulante.nivelIngles} -
-
-
-
-
-
Estado Civil
-
-
- ${postulante.estadoCivil.getDescripcion()} -
-
-
-
-
-
Nacionalidad
-
-
- ${postulante.nacionalidad.getDescripcion()} -
-
-
-
-
-
Disponbilidad
-
-
- ${postulante.disponibilidad.getDescripcion()} -
-
-
-
-
-
Estado
-
-
- ${postulante.estadoPostulante.getEstado()} -
-
-
-
-
-
ComentarioRRHH
-
-
- ${postulante.getComentarioRRHH()} -
-
-
-
-
- -
-
-
-
-
-
-
Tecnologias
- - ${detalle_tecnologia.getTecnologia().getNombre()} -
-
-
-
-
-
Cargos al que postula
-
    - - -
  • -
    ${convocatoria.getCargo().getNombre()}
    - -
  • -
    - -
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
Referencias Personales
-
    - - -
  • -
    ${referencia.nombre}, ${referencia.relacion}, ${referencia.telefono}
    - -
  • -
    -
-
-
-
-
- - - -
- - - -
- - - - - - - - - - - - -
-
diff --git a/curriculumsearch/src/main/webapp/jsp/header.jsp b/curriculumsearch/src/main/webapp/jsp/header.jsp index d47e825..e0c2aa4 100644 --- a/curriculumsearch/src/main/webapp/jsp/header.jsp +++ b/curriculumsearch/src/main/webapp/jsp/header.jsp @@ -25,7 +25,6 @@ diff --git a/curriculumsearch/src/main/webapp/jsp/layouts/base.jsp b/curriculumsearch/src/main/webapp/jsp/layouts/base.jsp index 5493334..e84fd93 100644 --- a/curriculumsearch/src/main/webapp/jsp/layouts/base.jsp +++ b/curriculumsearch/src/main/webapp/jsp/layouts/base.jsp @@ -39,7 +39,6 @@