diff --git a/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java b/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java index 502fad7..c45afb1 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/CargoController.java @@ -34,7 +34,7 @@ public class CargoController { @RequestMapping("/cargos") public String menuCargos(Model model,@RequestParam(required = false) String nombre,@RequestParam(defaultValue = "0")Integer nroPagina) { - final Integer CANTIDAD_POR_PAGINA = 1; + final Integer CANTIDAD_POR_PAGINA = 10; Pageable page = PageRequest.of(nroPagina,CANTIDAD_POR_PAGINA,Sort.by("id")); if(nombre == null || nombre.trim().isEmpty()) { Page CargoPag=cargoRepo.findAll(page); diff --git a/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java b/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java index 1650aac..110aabb 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/ConvocatoriaController.java @@ -47,16 +47,17 @@ public class ConvocatoriaController { @RequestMapping("/convocatorias") public String menuConvocatorias(Model model,RedirectAttributes redirectAttrs, @RequestParam(required = false) Long cargoId, - @RequestParam(required = false) Integer isOpen,//1: true, 0: false + @RequestParam(required = false) EstadoConvocatoria estado,//1: true, 0: false @RequestParam(defaultValue = "0")Integer nroPagina ) { - final Integer CANTIDAD_POR_PAGINA = 1; + final Integer CANTIDAD_POR_PAGINA = 10; Pageable page = PageRequest.of(nroPagina,CANTIDAD_POR_PAGINA,Sort.by("id")); model.addAttribute("cargos", cargoRepo.findAll()); - Page convoPag=convoRepo.f1ndByCargoAndEstado(new TypedParameterValue(LongType.INSTANCE, cargoId), new Date(), new TypedParameterValue(IntegerType.INSTANCE, isOpen),page); + Page convoPag=convoRepo.findByCargoAndEstado(cargoId,estado,page); model.addAttribute("convocatorias", convoPag.getContent()); model.addAttribute("pages", convoPag.getTotalPages()); + model.addAttribute("estados", EstadoConvocatoria.values()); //model.addAttribute("convocatorias",cargoId==null? convoRepo.findAll() : convoRepo.findByCargoId(cargoId)); return "convocatorias"; diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java index 8b4b7aa..c9bf2bb 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java @@ -29,6 +29,8 @@ import org.hibernate.jpa.TypedParameterValue; import org.hibernate.type.IntegerType; import org.hibernate.type.LongType; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; @@ -83,7 +85,8 @@ public class PostulanteController { model.addAttribute("estadosCiviles", EstadoCivil.values()); model.addAttribute("nacionalidades", Nacionalidad.values()); model.addAttribute("tiposExperencia", TipoExperiencia.values()); - model.addAttribute("CargosDisponibles", convoRepo.f1ndByCargoAndEstado(new TypedParameterValue(LongType.INSTANCE, null), new Date(), new TypedParameterValue(IntegerType.INSTANCE, 1))); + model.addAttribute("CargosDisponibles", + convoRepo.findByCargoAndEstado(null, EstadoConvocatoria.abierto, PageRequest.of(0,Integer.MAX_VALUE,Sort.by("id"))).getContent()); try { model.addAttribute("ciudades", new ObjectMapper().writeValueAsString(ciuRepo.findAll())); } catch (JsonProcessingException er) { diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java index 35ba87e..0a01a98 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java @@ -100,7 +100,7 @@ public class PostulanteRRHHController { @RequestParam(required = false)Long convId, @RequestParam(defaultValue = "0")Integer nroPagina ) throws IOException { - final Integer CANTIDAD_POR_PAGINA = 1; + final Integer CANTIDAD_POR_PAGINA = 10; Pageable page = PageRequest.of(nroPagina,CANTIDAD_POR_PAGINA,Sort.by("id")); model.addAttribute("tecnologias", tecRepo.findAll()); model.addAttribute("disponibilidades", Disponibilidad.values()); diff --git a/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java b/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java index 932a344..ff93814 100644 --- a/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java +++ b/curriculumsearch/src/main/java/com/roshka/modelo/Cargo.java @@ -26,22 +26,6 @@ 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/java/com/roshka/repositorio/ConvocatoriaRepository.java b/curriculumsearch/src/main/java/com/roshka/repositorio/ConvocatoriaRepository.java index 21caf6f..09d3f37 100644 --- a/curriculumsearch/src/main/java/com/roshka/repositorio/ConvocatoriaRepository.java +++ b/curriculumsearch/src/main/java/com/roshka/repositorio/ConvocatoriaRepository.java @@ -4,6 +4,7 @@ import java.util.Date; import java.util.List; import com.roshka.modelo.ConvocatoriaCargo; +import com.roshka.modelo.EstadoConvocatoria; import org.hibernate.jpa.TypedParameterValue; import org.springframework.data.domain.Page; @@ -17,8 +18,13 @@ public interface ConvocatoriaRepository extends JpaRepository findByCargoId(Long cargoId); //@Query(value="selec x from ConvocatoriaCargo x where (x.fechaFinal > ?1)",nativeQuery = true) //public List findConvocatoriaCargoByCargo(Date fechaFinal); - @Query("select c from ConvocatoriaCargo c where ( ?1 is null and ?3 is null) or ( ( ( ((c.fechaFin > ?2 or c.fechaFin=null) and ?3 = 1) or ((c.fechaFin < ?2 ) and ?3 = 0)) or ?3 is null ) and (c.cargoId = ?1 or ?1 is null) )") - public Page f1ndByCargoAndEstado(TypedParameterValue cargoId, Date fecha, TypedParameterValue isOpen, Pageable page); + /* @Query("select c from ConvocatoriaCargo c where ( ?1 is null and ?3 is null) or ( ( ( ((c.fechaFin > ?2 or c.fechaFin=null) and ?3 = 1) or ((c.fechaFin < ?2 ) and ?3 = 0)) or ?3 is null ) and (c.cargoId = ?1 or ?1 is null) )") + public Page f1ndByCargoAndEstado(TypedParameterValue cargoId, Date fecha, TypedParameterValue isOpen, Pageable page); */ + + @Query("select c from ConvocatoriaCargo c "+ + "where (c.cargoId = ?1 or ?1 is null) and "+ + "(c.estado = ?2 or ?2 is null)") + public Page findByCargoAndEstado(Long cargoId, EstadoConvocatoria estado, Pageable page); @Query("SELECT c FROM ConvocatoriaCargo c WHERE (cargoId=?1)") public List filtrarConvocatoriasPorCargo(Long cargoId); diff --git a/curriculumsearch/src/main/resources/static/main.js b/curriculumsearch/src/main/resources/static/main.js index 091b1d1..dbbf158 100644 --- a/curriculumsearch/src/main/resources/static/main.js +++ b/curriculumsearch/src/main/resources/static/main.js @@ -108,7 +108,7 @@ function validarfecha(fechaDesde, fechaHasta){ return "la fecha desde no puede ser mayor a la fecha actual" ; } - if(fechaHasta =! null && fechaDesde>fechaHasta){ + if(fechaHasta =! null && fechaHasta.trim().length >0 && fechaDesde>fechaHasta){ return "la fecha desde no puede ser mayor a la fecha hasta"; } @@ -223,7 +223,7 @@ function agregarFieldExpierncia(event){ let pos_rec; let returnFlag = false; - let requiredValues = ["institucion", "cargo", "fechaDesde", "descripcion"] + let requiredValues = ["institucion", "cargo", "fechaDesde", "descripcion","nombreReferencia","telefonoReferencia"] formData.forEach((value, key)=>{ if(requiredValues.includes(key) diff --git a/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp b/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp index fba5078..946d677 100644 --- a/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp +++ b/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp @@ -40,19 +40,18 @@
- +
-
- - -
-
-
- - -
-
+ + +
+ + +
+
+
+
@@ -91,7 +90,11 @@ Ver postulantes - Cerrar convocatoria + + + Cerrar convocatoria + + diff --git a/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp b/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp index 7d0ddcd..301ab86 100644 --- a/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp +++ b/curriculumsearch/src/main/webapp/jsp/postulante-form.jsp @@ -358,11 +358,11 @@
- +
- +