diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java index d7e00c5..87df216 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java @@ -5,9 +5,8 @@ import java.util.ArrayList; import java.util.List; - - - +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.roshka.DTO.PostulanteListaDTO; import com.roshka.modelo.*; import com.roshka.modelo.Disponibilidad; @@ -97,7 +96,15 @@ public class PostulanteRRHHController { model.addAttribute("disponibilidades", Disponibilidad.values()); model.addAttribute("institucionesEducativas", institucionRepository.findAll()); model.addAttribute("estadoP", EstadoPostulante.values()); - model.addAttribute("convocatoriaC", cargoRepo.findAll()); + model.addAttribute("cargos", carRepo.findAll()); + model.addAttribute("cargoRepo", cargoRepo); + //model.addAttribute("convocatoriaC", cargoRepo.findAll()); + try { + model.addAttribute("convocatoriaC", new ObjectMapper().writeValueAsString(cargoRepo.findAll())); + } catch (JsonProcessingException er) { + // TODO Auto-generated catch block + er.printStackTrace(); + } Page postulantesPag = post.postulantesMultiFiltro(nombre == null || nombre.trim().isEmpty() ? new TypedParameterValue(StringType.INSTANCE,null) : new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"),dispo, lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId); List postulantes = postulantesPag.getContent(); List postulantesDTO = new ArrayList<>(); diff --git a/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java b/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java index ff93814..932a344 100644 --- a/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java +++ b/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java @@ -26,6 +26,22 @@ public class Cargo { @Column(name = "nombre") private String nombre; + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getNombre() { + return this.nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + @OneToMany(mappedBy = "cargo") @JsonManagedReference private List convocatorias; diff --git a/curriculumsearch/src/main/resources/static/Convo.js b/curriculumsearch/src/main/resources/static/Convo.js new file mode 100644 index 0000000..f0f0491 --- /dev/null +++ b/curriculumsearch/src/main/resources/static/Convo.js @@ -0,0 +1,22 @@ +const cargoSelect = document.querySelector("#cargoId"); + +function listarConvocatorias(id){ + const ConvocatoriaAmostrar = convocatorias.filter(c=>c.cargoId==id); + const convocatoria = document.querySelector("select[name=convId]"); + const frag = document.createDocumentFragment(); + for (const conv of ConvocatoriaAmostrar) { + const opt = document.createElement("option"); + opt.value = conv.id; + if(conv.fechaFin!=null){ + opt.innerHTML ="Desde :"+new Date(conv.fechaInicio)+"-"+" Hasta :"+new Date(conv.fechaFin); + }else{ + opt.innerHTML ="Desde :"+new Date(conv.fechaInicio) + } + opt.setAttribute("data-CargoId",conv.cargoId); + frag.appendChild(opt) + } + convocatoria.replaceChildren(frag); + +} +listarConvocatorias(cargoSelect.value); +cargoSelect.addEventListener("change",evt => listarConvocatorias(evt.target.value)) diff --git a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp index 3de212c..8ecef17 100644 --- a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp +++ b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp @@ -151,20 +151,33 @@
- +
- - - + +
- - + +
+
+
+ +
+
+ +
+
+
+ +
@@ -219,10 +232,15 @@
+ + +