Commit e7f75029 by Nelson Ruiz

se agrego query para obtener postulantes por carrera

parents 2868948b b2a47f91
...@@ -63,6 +63,17 @@ ...@@ -63,6 +63,17 @@
<artifactId>jstl</artifactId> <artifactId>jstl</artifactId>
<version>1.2</version> <version>1.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- <version>1.18.22</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
</dependencies> </dependencies>
<build> <build>
......
...@@ -2,26 +2,23 @@ package com.roshka; ...@@ -2,26 +2,23 @@ package com.roshka;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.roshka.modelo.Ciudad; import com.roshka.modelo.*;
import com.roshka.modelo.Departamento; import com.roshka.repositorio.*;
import com.roshka.modelo.Postulante;
import com.roshka.modelo.PostulanteTecnologia;
import com.roshka.modelo.Tecnologia;
import com.roshka.repositorio.CiudadRepository;
import com.roshka.repositorio.DepartamentoRepository;
import com.roshka.repositorio.PostulanteRepository;
import com.roshka.repositorio.TecnologiaRepository;
import org.hibernate.PersistentObjectException;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@SpringBootApplication @SpringBootApplication
@EnableJpaRepositories("com.roshka.repositorio") @EnableJpaRepositories("com.roshka.repositorio")
...@@ -33,7 +30,8 @@ public class CurriculumsearchApplication { ...@@ -33,7 +30,8 @@ public class CurriculumsearchApplication {
} }
@Bean @Bean
CommandLineRunner runner(PostulanteRepository postRepo,TecnologiaRepository tecRepo,DepartamentoRepository depR, CiudadRepository ciudR) { CommandLineRunner runner(PostulanteRepository postRepo, TecnologiaRepository tecRepo, DepartamentoRepository depR,
CiudadRepository ciudR, RRHHUserRepository rrhhUserRepository, CargoRepository cargoR, ConvocatoriaRepository convR) {
return args -> { return args -> {
try { try {
// read json and write to db // read json and write to db
...@@ -48,14 +46,58 @@ public class CurriculumsearchApplication { ...@@ -48,14 +46,58 @@ public class CurriculumsearchApplication {
List<Ciudad> ciudades= mapper.readValue(inputStream,typeReference2); List<Ciudad> ciudades= mapper.readValue(inputStream,typeReference2);
ciudR.saveAll(ciudades); ciudR.saveAll(ciudades);
System.out.println("Cuidad Saved!"); System.out.println("Cuidad Saved!");
TypeReference<List<Cargo>> typeReference3 = new TypeReference<List<Cargo>>(){};
inputStream = TypeReference.class.getResourceAsStream("/json/cargo.json");
List<Cargo> cargos= mapper.readValue(inputStream,typeReference3);
cargoR.saveAll(cargos);
cargoR.flush();
System.out.println("Cargos Saved!");
/* TypeReference<List<Tecnologia>> typeReference5 = new TypeReference<List<Tecnologia>>(){};
inputStream = TypeReference.class.getResourceAsStream("/json/tecnologia.json");
List<Tecnologia> tecnologias= mapper.readValue(inputStream,typeReference5);
tecRepo.saveAll(tecnologias);
tecRepo.flush();
System.out.println("Cargos Saved!"); */
TypeReference<List<ConvocatoriaCargo>> typeReference4 = new TypeReference<List<ConvocatoriaCargo>>(){};
inputStream = TypeReference.class.getResourceAsStream("/json/convocatoria.json");
List<ConvocatoriaCargo> convocatorias= mapper.readValue(inputStream,typeReference4);
convocatorias = convR.saveAll(convocatorias);
convR.flush();
System.out.println("convocatorias Saved!");
TypeReference<List<Postulante>> typeReference = new TypeReference<List<Postulante>>(){}; TypeReference<List<Postulante>> typeReference = new TypeReference<List<Postulante>>(){};
inputStream = TypeReference.class.getResourceAsStream("/json/postulante.json"); inputStream = TypeReference.class.getResourceAsStream("/json/postulante.json");
List<Postulante> postulantes = mapper.readValue(inputStream,typeReference); List<Postulante> postulantes = mapper.readValue(inputStream,typeReference);
/* for (Postulante postulante : postulantes) {
for (int i = 0; i < postulante.getPostulaciones().size(); i++) {
postulante.getPostulaciones().set(i, convR.getById(postulante.getPostulaciones().get(i).getId()));
}
} */
postRepo.saveAll(postulantes); postRepo.saveAll(postulantes);
System.out.println("postulantes Saved!"); System.out.println("postulantes Saved!");
String password = new BCryptPasswordEncoder().encode("test");
RRHHUser testuser = new RRHHUser();
testuser.setEmail("test@test.com");
testuser.setFirstName("test");
testuser.setLastName("test");
testuser.setPassword(password);
rrhhUserRepository.save(testuser);
System.out.println("Usuario Test: \nEmail: test@test.com\nPassword: test");
} catch (IOException e){ } catch (IOException e){
System.out.println("Unable to save tecnologias: " + e.getMessage()); System.out.println("Unable to save: " + e.getMessage());
}
catch(PersistentObjectException ex){
System.out.println("Unable to save: " + ex.getMessage());
ex.printStackTrace();
}
catch(Exception ex){
System.out.println("Unable to save: " + ex.getMessage());
ex.printStackTrace();
} }
...@@ -64,5 +106,21 @@ public class CurriculumsearchApplication { ...@@ -64,5 +106,21 @@ public class CurriculumsearchApplication {
}; };
} }
public static <Q,T extends JpaRepository<Q,Long>> void guardarJson(T repo,String srcJson ) {
ObjectMapper mapper = new ObjectMapper();
TypeReference<List<Q>> typeReference1 = new TypeReference<List<Q>>(){};
InputStream inputStream = TypeReference.class.getResourceAsStream(srcJson);
List<Q> listaAguardar;
try {
listaAguardar = mapper.readValue(inputStream,typeReference1);
repo.saveAll(listaAguardar);
repo.flush();
System.out.println(srcJson+" Saved!");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
package com.roshka.DTO;
import java.util.List;
import com.roshka.modelo.Disponibilidad;
import com.roshka.modelo.PostulanteTecnologia;
public class PostulanteListaDTO {
private Long id;
private String nombre;
private String apellido;
private Disponibilidad disponibilidad;
private Long nivelIngles;
private Long experienciaMeses;
private List<PostulanteTecnologia> tecnologias;
public PostulanteListaDTO(Long id, String nombre, String apellido, Disponibilidad disponibilidad,
Long nivelIngles, Long experienciaMeses, List<PostulanteTecnologia> tecnologias) {
this.id = id;
this.nombre = nombre;
this.apellido = apellido;
this.disponibilidad = disponibilidad;
this.nivelIngles = nivelIngles;
this.experienciaMeses = experienciaMeses;
this.tecnologias = tecnologias;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public Disponibilidad getDisponibilidad() {
return disponibilidad;
}
public void setDisponibilidad(Disponibilidad disponibilidad) {
this.disponibilidad = disponibilidad;
}
public Long getNivelIngles() {
return nivelIngles;
}
public void setNivelIngles(Long nivelIngles) {
this.nivelIngles = nivelIngles;
}
public Long getExperienciaMeses() {
return experienciaMeses;
}
public void setExperienciaMeses(Long experienciaMeses) {
this.experienciaMeses = experienciaMeses;
}
public List<PostulanteTecnologia> getTecnologias() {
return tecnologias;
}
public void setTecnologias(List<PostulanteTecnologia> tecnologias) {
this.tecnologias = tecnologias;
}
}
package com.roshka.configuration;
import java.util.Collection;
import com.roshka.modelo.RRHHUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
public class CustomUserDetails implements UserDetails {
private RRHHUser user;
public CustomUserDetails(RRHHUser user) {
this.user = user;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return null;
}
@Override
public String getPassword() {
return user.getPassword();
}
@Override
public String getUsername() {
return user.getEmail();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
public String getFullName() {
return user.getFirstName() + " " + user.getLastName();
}
}
\ No newline at end of file
package com.roshka.configuration;
import com.roshka.modelo.RRHHUser;
import com.roshka.repositorio.RRHHUserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
public class CustomUserDetailsService implements UserDetailsService {
@Autowired
private RRHHUserRepository userRepo;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
RRHHUser user = userRepo.findByEmail(username);
if (user == null) {
throw new UsernameNotFoundException("User not found");
}
return new CustomUserDetails(user);
}
}
package com.roshka.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import javax.sql.DataSource;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private DataSource dataSource;
@Bean
public UserDetailsService userDetailsService() {
return new CustomUserDetailsService();
}
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public DaoAuthenticationProvider authenticationProvider() {
DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
authProvider.setUserDetailsService(userDetailsService());
authProvider.setPasswordEncoder(passwordEncoder());
return authProvider;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authenticationProvider());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
// .csrf().disable()
.authorizeRequests()
.antMatchers("/").authenticated()
.antMatchers("/home").authenticated()
.antMatchers("/cargo*").authenticated()
.antMatchers("/convocatoria*").authenticated()
.antMatchers("/tecnologia*").authenticated()
.antMatchers("/postulantes").authenticated()
.anyRequest().permitAll()
.and()
.formLogin()
.loginPage("/login")
.usernameParameter("email")
.defaultSuccessUrl("/home")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutRequestMatcher(new AntPathRequestMatcher("/logout", "GET"))
.clearAuthentication(true)
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID", "remember-me")
.logoutSuccessUrl("/login");
}
}
\ No newline at end of file
package com.roshka.controller; package com.roshka.controller;
import java.util.Date;
import com.roshka.modelo.Cargo; import com.roshka.modelo.Cargo;
import com.roshka.modelo.ConvocatoriaCargo;
import com.roshka.repositorio.CargoRepository; import com.roshka.repositorio.CargoRepository;
import com.roshka.repositorio.ConvocatoriaRepository;
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@Controller @Controller
public class CargoController { public class CargoController {
CargoRepository cargoRepo; CargoRepository cargoRepo;
ConvocatoriaRepository convoRepo;
@Autowired @Autowired
public CargoController(CargoRepository cargoRepo, ConvocatoriaRepository convoRepo) { public CargoController(CargoRepository cargoRepo) {
this.cargoRepo = cargoRepo; this.cargoRepo = cargoRepo;
this.convoRepo = convoRepo;
} }
@RequestMapping("/convocatorias") @RequestMapping("/cargos")
public String menuCargos(Model model, public String menuCargos(Model model,
@RequestParam(required = false) Long cargoId, @RequestParam(required = false) String nombre
@RequestParam(required = false) Integer isOpen//1: true, 0: false
) { ) {
if(nombre == null || nombre.trim().isEmpty()) model.addAttribute("cargos", cargoRepo.findAll());
model.addAttribute("cargos", cargoRepo.findAll()); else model.addAttribute("cargos", cargoRepo.findByNombreContainingIgnoreCase(nombre));
return "cargos";
model.addAttribute("convocatorias", convoRepo.f1ndByCargoAndEstado(new TypedParameterValue(LongType.INSTANCE, cargoId), new Date(), new TypedParameterValue(IntegerType.INSTANCE, isOpen)));
//model.addAttribute("convocatorias",cargoId==null? convoRepo.findAll() : convoRepo.findByCargoId(cargoId));
return "convocatorias";
} }
@RequestMapping("/cargo") @RequestMapping(path = {"/cargo","/cargo/{id}"}, method = RequestMethod.GET)
public String formCargo(Model model) { public String formCargo(Model model,@PathVariable(required = false) Long id) {
model.addAttribute("cargo", new Cargo());
if(id == null) model.addAttribute("cargo", new Cargo());
else model.addAttribute("cargo", cargoRepo.getById(id));
return "cargo-form"; return "cargo-form";
} }
@PostMapping("/cargo") @PostMapping(path = {"/cargo","/cargo/{id}"})
public String guardarCargo(@ModelAttribute Cargo cargo, BindingResult result) { public String guardarCargo(@ModelAttribute Cargo cargo, BindingResult result, @PathVariable(required = false) Long id) {
if(result.hasErrors()); if(result.hasErrors());
if(id != null ) cargo.setId(id);
cargoRepo.save(cargo); cargoRepo.save(cargo);
System.out.println(cargo.getNombre()); System.out.println(cargo.getNombre());
return "redirect:/cargos"; return "redirect:/cargos";
} }
@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) {
if(result.hasErrors());
convoRepo.save(convocatoria);
System.out.println(convocatoria.getFechaInicio());
return "redirect:/cargos";
}
} }
package com.roshka.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.roshka.modelo.ConvocatoriaCargo;
import com.roshka.repositorio.CargoRepository;
import com.roshka.repositorio.ConvocatoriaRepository;
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.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class ConvocatoriaController {
CargoRepository cargoRepo;
ConvocatoriaRepository convoRepo;
@Autowired
public ConvocatoriaController(CargoRepository cargoRepo, ConvocatoriaRepository convoRepo) {
this.cargoRepo = cargoRepo;
this.convoRepo = convoRepo;
}
@RequestMapping("/convocatorias")
public String menuConvocatorias(Model model,
@RequestParam(required = false) Long cargoId,
@RequestParam(required = false) Integer isOpen//1: true, 0: false
) {
model.addAttribute("cargos", cargoRepo.findAll());
model.addAttribute("convocatorias", convoRepo.f1ndByCargoAndEstado(new TypedParameterValue(LongType.INSTANCE, cargoId), new Date(), new TypedParameterValue(IntegerType.INSTANCE, isOpen)));
//model.addAttribute("convocatorias",cargoId==null? convoRepo.findAll() : convoRepo.findByCargoId(cargoId));
return "convocatorias";
}
@RequestMapping(path = {"/convocatoria","/convocatoria/{id}"})
public String formConvocatoria(Model model,@PathVariable(required = false) Long id) {
model.addAttribute("cargos", cargoRepo.findAll());
if(id == null) model.addAttribute("convocatoria", new ConvocatoriaCargo());
else {
ConvocatoriaCargo cc = convoRepo.getById(id);
cc.setFechaFinS(new SimpleDateFormat("yyyy-MM-dd").format((cc.getFechaFin())));
cc.setFechaInicioS(new SimpleDateFormat("yyyy-MM-dd").format((cc.getFechaInicio())));
model.addAttribute("convocatoria", cc);
}
return "convocatoria-form";
}
@PostMapping(path = {"/convocatoria","/convocatoria/{id}"})
public String guardarConvocatoria(@ModelAttribute ConvocatoriaCargo convocatoria, BindingResult result, @PathVariable(required = false) Long id) {
if(result.hasErrors());
if(id != null) convocatoria.setId(id);
convoRepo.save(convocatoria);
System.out.println(convocatoria.getFechaInicio());
return "redirect:/convocatorias";
}
}
package com.roshka.controller; package com.roshka.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import com.roshka.DTO.PostulanteListaDTO;
import com.roshka.modelo.*; import com.roshka.modelo.*;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
...@@ -13,14 +18,26 @@ import com.roshka.modelo.EstadoCivil; ...@@ -13,14 +18,26 @@ import com.roshka.modelo.EstadoCivil;
import com.roshka.modelo.Nacionalidad; import com.roshka.modelo.Nacionalidad;
import com.roshka.modelo.Postulante; import com.roshka.modelo.Postulante;
import com.roshka.modelo.TipoExperiencia; import com.roshka.modelo.TipoExperiencia;
import com.roshka.repositorio.*;
import com.roshka.repositorio.CiudadRepository; import com.roshka.repositorio.CiudadRepository;
import com.roshka.repositorio.ConvocatoriaRepository;
import com.roshka.repositorio.DepartamentoRepository; import com.roshka.repositorio.DepartamentoRepository;
import com.roshka.repositorio.ExperienciaRepository; import com.roshka.repositorio.ExperienciaRepository;
import com.roshka.repositorio.InstitucionRepository; import com.roshka.repositorio.InstitucionRepository;
import com.roshka.repositorio.PostulanteRepository; import com.roshka.repositorio.PostulanteRepository;
import com.roshka.repositorio.TecnologiaRepository; import com.roshka.repositorio.TecnologiaRepository;
import com.roshka.utils.Helper;
import org.hibernate.jpa.TypedParameterValue;
import org.hibernate.type.StringType;
import org.hibernate.type.IntegerType;
import org.hibernate.type.LongType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -38,19 +55,31 @@ public class PostulanteController { ...@@ -38,19 +55,31 @@ public class PostulanteController {
InstitucionRepository institucionRepository; InstitucionRepository institucionRepository;
DepartamentoRepository depRepo; DepartamentoRepository depRepo;
CiudadRepository ciuRepo; CiudadRepository ciuRepo;
EstudioRepository estudioRepository;
PostulanteTecnologiaRepository postulanteTecnologiaRepository;
ConvocatoriaRepository cargoRepo;
CargoRepository carRepo;
@Autowired @Autowired
public PostulanteController(PostulanteRepository post, TecnologiaRepository tecRepo, ExperienciaRepository expRepo, InstitucionRepository institucionRepository, DepartamentoRepository depRepo, CiudadRepository ciuRepo) { public PostulanteController(
PostulanteRepository post, TecnologiaRepository tecRepo, ExperienciaRepository expRepo,
InstitucionRepository institucionRepository, DepartamentoRepository depRepo,
CiudadRepository ciuRepo, EstudioRepository estudioRepository,
PostulanteTecnologiaRepository postulanteTecnologiaRepository,
ConvocatoriaRepository cargoRepo, CargoRepository carRepo) {
this.post = post; this.post = post;
this.tecRepo = tecRepo; this.tecRepo = tecRepo;
this.expRepo = expRepo; this.expRepo = expRepo;
this.institucionRepository = institucionRepository; this.institucionRepository = institucionRepository;
this.depRepo = depRepo; this.depRepo = depRepo;
this.ciuRepo = ciuRepo; this.ciuRepo = ciuRepo;
this.estudioRepository = estudioRepository;
this.postulanteTecnologiaRepository = postulanteTecnologiaRepository;
this.cargoRepo =cargoRepo;
this.carRepo=carRepo;
} }
@RequestMapping("home")
@RequestMapping("/")
public String index() { public String index() {
...@@ -59,10 +88,38 @@ public class PostulanteController { ...@@ -59,10 +88,38 @@ public class PostulanteController {
@RequestMapping("/postulantes") @RequestMapping("/postulantes")
public String postulantes(Model model, public String postulantes(Model model,
@RequestParam(required = false,name = "tec")Long tecnologidaId) { @RequestParam(required = false)Long tecId,
@RequestParam(required = false)String nombre,
@RequestParam(required = false)Disponibilidad dispo,
@RequestParam(required = false)Long lvlEng,
@RequestParam(required = false)Long lvlTec,
@RequestParam(required = false)Long instId,
@RequestParam(required = false)Long expInMonths,
@RequestParam(required = false)Long cargoId,
@RequestParam(defaultValue = "0")Integer nroPagina
) {
final Integer CANTIDAD_POR_PAGINA = 5;
Pageable page = PageRequest.of(nroPagina,CANTIDAD_POR_PAGINA,Sort.by("id"));
model.addAttribute("tecnologias", tecRepo.findAll()); model.addAttribute("tecnologias", tecRepo.findAll());
if(tecnologidaId==null) model.addAttribute("postulantes", post.findAll()); model.addAttribute("disponibilidades", Disponibilidad.values());
else model.addAttribute("postulantes", post.buscarPostulantesPorTecnologia(tecnologidaId)); model.addAttribute("institucionesEducativas", institucionRepository.findAll());
Page<Postulante> 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);
List<Postulante> postulantes = postulantesPag.getContent();
List<PostulanteListaDTO> postulantesDTO = new ArrayList<>();
for (Postulante postulante : postulantes) {
long expTotal = 0;
//Sumamos el tiempo de experiencia total en meses de cada postulante
//expTotal = postulante.getExperiencias().stream().mapToLong(e -> Helper.getMonthsDifference(e.getFechaDesde(), e.getFechaHasta())).sum();
for (Experiencia experiencia : postulante.getExperiencias()) {
expTotal += Helper.getMonthsDifference(experiencia.getFechaDesde(), experiencia.getFechaHasta());
}
if(expInMonths != null && expInMonths > expTotal) continue;
postulantesDTO.add(new PostulanteListaDTO(postulante.getId(), postulante.getNombre(), postulante.getApellido(), postulante.getDisponibilidad(), postulante.getNivelIngles(), expTotal, postulante.getTecnologias()));
}
model.addAttribute("pages", postulantesPag.getTotalPages());
model.addAttribute("postulantes", postulantesDTO);
return "postulantes"; return "postulantes";
} }
...@@ -75,11 +132,12 @@ public class PostulanteController { ...@@ -75,11 +132,12 @@ public class PostulanteController {
model.addAttribute("estadosCiviles", EstadoCivil.values()); model.addAttribute("estadosCiviles", EstadoCivil.values());
model.addAttribute("nacionalidades", Nacionalidad.values()); model.addAttribute("nacionalidades", Nacionalidad.values());
model.addAttribute("tiposExperencia", TipoExperiencia.values()); model.addAttribute("tiposExperencia", TipoExperiencia.values());
model.addAttribute("CargosDisponibles", cargoRepo.f1ndByCargoAndEstado(new TypedParameterValue(LongType.INSTANCE, null), new Date(), new TypedParameterValue(IntegerType.INSTANCE, 1)));
try { try {
model.addAttribute("ciudades", new ObjectMapper().writeValueAsString(ciuRepo.findAll())); model.addAttribute("ciudades", new ObjectMapper().writeValueAsString(ciuRepo.findAll()));
} catch (JsonProcessingException e) { } catch (JsonProcessingException er) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); er.printStackTrace();
} }
model.addAttribute("departamentos", depRepo.findAll()); model.addAttribute("departamentos", depRepo.findAll());
...@@ -88,23 +146,43 @@ public class PostulanteController { ...@@ -88,23 +146,43 @@ public class PostulanteController {
@PostMapping(value = "/postulante",consumes = "application/json") @PostMapping(value = "/postulante",consumes = "application/json")
public String guardarPostulante(@RequestBody Postulante postulante){ public String guardarPostulante(@RequestBody Postulante postulante){
System.out.println("hola"); //Codigo encargado de modificar postulacion si se envia mismo CI
Postulante postulantex = post.findByNroDocument(postulante.getnroDocument());
if(postulantex != null){
estudioRepository.findByPostulante(postulantex).forEach(x -> estudioRepository.delete(x));
expRepo.findByPostulante(postulantex).forEach(x -> expRepo.delete(x));
postulanteTecnologiaRepository.findByPostulante(postulantex).forEach(x -> postulanteTecnologiaRepository.delete(x));
postulante.setId(postulantex.getId());
}
postulante.getTecnologias().stream().filter( postulante.getTecnologias().stream().filter(
tec -> tec.getTecnologia().getId() != 0 tec -> tec.getTecnologia().getId() != 0
).forEach( ).forEach(
tec -> tec.setTecnologia(tecRepo.getById(tec.getTecnologia().getId())) tec -> tec.setTecnologia(tecRepo.getById(tec.getTecnologia().getId()))
); );
/* for (int i = 0; i < postulante.getPostulaciones().size(); i++) {
postulante.getPostulaciones().set(i, cargoRepo.getById(postulante.getPostulaciones().get(i).getId()));
}
*/
for(Estudio estudio: postulante.getEstudios()){ for(Estudio estudio: postulante.getEstudios()){
Institucion institucion = institucionRepository.findByNombre(estudio.getInstitucion().getNombre()); String nombreIns = "";
nombreIns = estudio.getInstitucion().getNombre().toLowerCase();
Institucion institucion = institucionRepository.findByNombre(nombreIns);
if(institucion==null){ if(institucion==null){
institucionRepository.save(estudio.getInstitucion()); institucionRepository.save(estudio.getInstitucion());
}else{ }else{
estudio.setInstitucion(institucion); estudio.setInstitucion(institucion);
} }
} }
System.out.println("hola");
post.save(postulante); post.save(postulante);
return "redirect:/"; return "redirect:/postulacion-correcta";
}
@GetMapping("/postulacion-correcta")
public String successPostulation(Model model){
model.addAttribute("mensaje1", "Tu informacion se ha recibido correctamente!");
model.addAttribute("mensaje2", " espera por que nos pongamos en contacto!");
return "exitoRegistro";
} }
@ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseStatus(HttpStatus.BAD_REQUEST)
...@@ -125,5 +203,11 @@ public class PostulanteController { ...@@ -125,5 +203,11 @@ public class PostulanteController {
@GetMapping({"/postulante/{postulanteId}"})
} public String getPostulanteDetalle(Model model, @PathVariable("postulanteId") Long postulanteId) {
Postulante p = post.findById(postulanteId).orElse(null);
model.addAttribute("postulante",p);
return "detallepostulante";
}
}
package com.roshka.controller;
import com.roshka.modelo.RRHHUser;
import com.roshka.repositorio.RRHHUserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import javax.servlet.http.HttpServletRequest;
@Controller
public class RRHHUserController {
private static final long REGISTER_CODE = 1234;
RRHHUserRepository rrhhUserRepository;
@Autowired
public RRHHUserController(RRHHUserRepository rrhhUserRepository){
this.rrhhUserRepository = rrhhUserRepository;
}
@GetMapping("/")
public String redirectOnHome(){
return "redirect:/home";
}
@GetMapping("/register")
public String showRegistrationForm(Model model) {
model.addAttribute("user", new RRHHUser());
return "registration";
}
@GetMapping("/login")
public String getLogin(Model model, HttpServletRequest request) {
if(request.getParameter("error")!=null){
model.addAttribute("error", "Credenciales Incorrectas");
}
return "login";
}
@PostMapping("/process_register")
public String processRegister(HttpServletRequest request, RRHHUser user) {
if(Long.parseLong(request.getParameter("registrationCode")) != REGISTER_CODE){
return "redirect:/register";
}
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
String encodedPassword = passwordEncoder.encode(user.getPassword());
user.setPassword(encodedPassword);
rrhhUserRepository.save(user);
return "register_success";
}
}
package com.roshka.controller;
import com.roshka.modelo.Tecnologia;
import com.roshka.repositorio.TecnologiaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class TecnologiaController {
TecnologiaRepository tecRepo;
@Autowired
public TecnologiaController(TecnologiaRepository tecRepo){
this.tecRepo = tecRepo;
}
@GetMapping(path = {"/tecnologia","/tecnologia/{id}"})
public String addtecnologiaView(Model model,@PathVariable(required = false) Long id) {
if(id == null) model.addAttribute("tecnologia", new Tecnologia());
else model.addAttribute("tecnologia", tecRepo.getById(id));
return "tecnologia-form";
}
@RequestMapping("/tecnologias")
public String menuTecnologias(Model model,
@RequestParam(required = false) String nombre
) {
if(nombre == null || nombre.trim().isEmpty()) model.addAttribute("tecnologias", tecRepo.findAll());
else model.addAttribute("tecnologias", tecRepo.findByNombreContainingIgnoreCase(nombre));
return "tecnologias";
}
@PostMapping(path = {"/tecnologia","/tecnologia/{id}"})
public String addtecnologia(@ModelAttribute Tecnologia tecnologia, BindingResult result, @PathVariable(required = false) Long id) {
if(result.hasErrors());
if(id != null ) tecnologia.setId(id);
tecRepo.save(tecnologia);
System.out.println(tecnologia.getNombre());
return "redirect:/tecnologias";
}
}
...@@ -17,8 +17,8 @@ import com.fasterxml.jackson.annotation.JsonManagedReference; ...@@ -17,8 +17,8 @@ import com.fasterxml.jackson.annotation.JsonManagedReference;
@Table(name = "cargo") @Table(name = "cargo")
public class Cargo { public class Cargo {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private long id; private Long id;
@NotBlank @NotBlank
@Column(name = "nombre") @Column(name = "nombre")
...@@ -28,13 +28,13 @@ public class Cargo { ...@@ -28,13 +28,13 @@ public class Cargo {
@JsonManagedReference @JsonManagedReference
private List<ConvocatoriaCargo> convocatorias; private List<ConvocatoriaCargo> convocatorias;
public long getId() { public Long getId() {
return id; return id;
} }
public String getNombre() { public String getNombre() {
return nombre; return nombre;
} }
public void setId(long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
public void setNombre(String nombre) { public void setNombre(String nombre) {
...@@ -47,4 +47,7 @@ public class Cargo { ...@@ -47,4 +47,7 @@ public class Cargo {
public void setConvocatorias(List<ConvocatoriaCargo> convocatorias) { public void setConvocatorias(List<ConvocatoriaCargo> convocatorias) {
this.convocatorias = convocatorias; this.convocatorias = convocatorias;
} }
public static Object values() {
return null;
}
} }
...@@ -14,6 +14,7 @@ import javax.persistence.Table; ...@@ -14,6 +14,7 @@ import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonBackReference;
@Entity @Entity
@Table(name="ciudad") @Table(name="ciudad")
public class Ciudad{ public class Ciudad{
...@@ -66,6 +67,6 @@ public class Ciudad{ ...@@ -66,6 +67,6 @@ public class Ciudad{
} }
...@@ -15,14 +15,17 @@ import javax.persistence.Table; ...@@ -15,14 +15,17 @@ import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.roshka.utils.Helper; import com.roshka.utils.Helper;
@Entity @Entity
@Table(name = "convocatoria_cargo") @Table(name = "convocatoria_cargo")
@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property="@UUID")
public class ConvocatoriaCargo { public class ConvocatoriaCargo {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private long id; private Long id;
@ManyToOne() @ManyToOne()
@JoinColumn(name = "cargo_id",insertable = false, updatable = false) @JoinColumn(name = "cargo_id",insertable = false, updatable = false)
...@@ -52,7 +55,7 @@ public class ConvocatoriaCargo { ...@@ -52,7 +55,7 @@ public class ConvocatoriaCargo {
@ManyToMany(mappedBy = "postulaciones") @ManyToMany(mappedBy = "postulaciones")
private List<Postulante> postulantes; private List<Postulante> postulantes;
public long getId() { public Long getId() {
return id; return id;
} }
public Cargo getCargo() { public Cargo getCargo() {
...@@ -67,7 +70,7 @@ public class ConvocatoriaCargo { ...@@ -67,7 +70,7 @@ public class ConvocatoriaCargo {
public Date getFechaInicio() { public Date getFechaInicio() {
return fechaInicio; return fechaInicio;
} }
public void setId(long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
public void setCargo(Cargo cargo) { public void setCargo(Cargo cargo) {
......
...@@ -16,6 +16,7 @@ import com.fasterxml.jackson.annotation.JsonManagedReference; ...@@ -16,6 +16,7 @@ import com.fasterxml.jackson.annotation.JsonManagedReference;
public class Departamento { public class Departamento {
@Id @Id
private Long id; private Long id;
@Column(name="nombre") @Column(name="nombre")
private String nombre; private String nombre;
......
...@@ -6,7 +6,7 @@ import javax.persistence.AttributeConverter; ...@@ -6,7 +6,7 @@ import javax.persistence.AttributeConverter;
import javax.persistence.Converter; import javax.persistence.Converter;
@Converter(autoApply = true) @Converter(autoApply = true)
public class DisponibilidadConverter implements AttributeConverter<Disponibilidad, String> { public class DisponibilidadConverter implements AttributeConverter<Disponibilidad, String>, org.springframework.core.convert.converter.Converter<String,Disponibilidad> {
@Override @Override
public String convertToDatabaseColumn(Disponibilidad modalidad) { public String convertToDatabaseColumn(Disponibilidad modalidad) {
...@@ -27,4 +27,9 @@ public class DisponibilidadConverter implements AttributeConverter<Disponibilida ...@@ -27,4 +27,9 @@ public class DisponibilidadConverter implements AttributeConverter<Disponibilida
.findFirst() .findFirst()
.orElseThrow(IllegalArgumentException::new); .orElseThrow(IllegalArgumentException::new);
} }
@Override
public Disponibilidad convert(String arg0) {
return convertToEntityAttribute(arg0);
}
} }
...@@ -15,7 +15,7 @@ import com.roshka.utils.Helper; ...@@ -15,7 +15,7 @@ import com.roshka.utils.Helper;
@Table(name="estudio") @Table(name="estudio")
public class Estudio { public class Estudio {
@Id @Id
@GeneratedValue(strategy=GenerationType.AUTO) @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id") @Column(name="id")
private long id; private long id;
......
...@@ -23,7 +23,7 @@ import javax.validation.constraints.Past; ...@@ -23,7 +23,7 @@ import javax.validation.constraints.Past;
@Table(name = "experiencia") @Table(name = "experiencia")
public class Experiencia { public class Experiencia {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private long id; private long id;
@Column(name = "institucion") @Column(name = "institucion")
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
@Table(name = "institucion") @Table(name = "institucion")
public class Institucion { public class Institucion {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id") @Column(name = "id")
private long id; private long id;
......
...@@ -3,8 +3,10 @@ package com.roshka.modelo; ...@@ -3,8 +3,10 @@ package com.roshka.modelo;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference; import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.roshka.utils.Helper; import com.roshka.utils.Helper;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -14,9 +16,10 @@ import java.util.List; ...@@ -14,9 +16,10 @@ import java.util.List;
@Entity @Entity
@Table(name="postulante") @Table(name="postulante")
@JsonIdentityInfo(generator = ObjectIdGenerators.UUIDGenerator.class, property="@UUID")
public class Postulante { public class Postulante {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id") @Column(name="id")
private long id; private long id;
...@@ -30,10 +33,10 @@ public class Postulante { ...@@ -30,10 +33,10 @@ public class Postulante {
@Size(max = 255) @Size(max = 255)
private String apellido; private String apellido;
@Column(name = "ci") @Column(name = "nro_document")
@NotBlank(message = "Este campo no puede estar vacio") @NotBlank(message = "Este campo no puede estar vacio")
@Size(max = 120) @Size(max = 120)
private String ci; private String nroDocument;
@Column(name = "correo") @Column(name = "correo")
@NotBlank(message = "Este campo no puede estar vacio") @NotBlank(message = "Este campo no puede estar vacio")
...@@ -61,7 +64,7 @@ public class Postulante { ...@@ -61,7 +64,7 @@ public class Postulante {
@Column(name = "nivel_ingles") @Column(name = "nivel_ingles")
@Min(value = 1) @Min(value = 1)
@Max(value = 5) @Max(value = 5)
private long nivelIngles; private Long nivelIngles;
@Column(name = "curriculum") @Column(name = "curriculum")
private String curriculum; private String curriculum;
...@@ -74,9 +77,9 @@ public class Postulante { ...@@ -74,9 +77,9 @@ public class Postulante {
@NotNull @NotNull
private Nacionalidad nacionalidad; private Nacionalidad nacionalidad;
@Column(name = "tipo_documento", length = 2) @Column(name = "tipo_documento",length = 3)
@NotBlank(message = "este campo debe estar completo") @NotNull
private String tipoDocumento; private TipoDocumento tipoDocumento;
@Column(name = "disponibilidad", length = 2) @Column(name = "disponibilidad", length = 2)
...@@ -98,12 +101,11 @@ public class Postulante { ...@@ -98,12 +101,11 @@ public class Postulante {
@OneToMany(mappedBy = "postulante",cascade = CascadeType.ALL) @OneToMany(mappedBy = "postulante",cascade = CascadeType.ALL)
private List<ReferenciaPersonal> referencias; private List<ReferenciaPersonal> referencias;
@ManyToMany(cascade = CascadeType.ALL) @ManyToMany()
@JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {"postulante_id","convocatoria_cargo_id"}), @JoinTable(uniqueConstraints = @UniqueConstraint(columnNames = {"postulante_id","convocatoria_cargo_id"}),
joinColumns = @JoinColumn(name="postulante_id", referencedColumnName="id"), joinColumns = @JoinColumn(name="postulante_id", referencedColumnName="id"),
inverseJoinColumns= @JoinColumn(name="convocatoria_cargo_id", referencedColumnName="id") inverseJoinColumns= @JoinColumn(name="convocatoria_cargo_id", referencedColumnName="id")
) )
@JsonIgnore
private List<ConvocatoriaCargo> postulaciones; private List<ConvocatoriaCargo> postulaciones;
...@@ -131,12 +133,12 @@ public class Postulante { ...@@ -131,12 +133,12 @@ public class Postulante {
this.apellido = apellido; this.apellido = apellido;
} }
public String getCi() { public String getnroDocument() {
return ci; return nroDocument;
} }
public void setCi(String ci) { public void setnroDocument(String nroDocument) {
this.ci = ci; this.nroDocument = nroDocument;
} }
public String getCorreo() { public String getCorreo() {
...@@ -175,11 +177,11 @@ public class Postulante { ...@@ -175,11 +177,11 @@ public class Postulante {
this.resumen = resumen; this.resumen = resumen;
} }
public long getNivelIngles() { public Long getNivelIngles() {
return nivelIngles; return nivelIngles;
} }
public void setNivelIngles(long nivelIngles) { public void setNivelIngles(Long nivelIngles) {
this.nivelIngles = nivelIngles; this.nivelIngles = nivelIngles;
} }
...@@ -215,13 +217,13 @@ public class Postulante { ...@@ -215,13 +217,13 @@ public class Postulante {
public void setEstadoCivil(EstadoCivil estadoCivil) { public void setEstadoCivil(EstadoCivil estadoCivil) {
this.estadoCivil = estadoCivil; this.estadoCivil = estadoCivil;
} }
public void setTipoDocumento(String tipoDocumento) { public void setTipoDocumento(TipoDocumento tipoDocumento) {
this.tipoDocumento = tipoDocumento; this.tipoDocumento = tipoDocumento;
} }
public EstadoCivil getEstadoCivil() { public EstadoCivil getEstadoCivil() {
return estadoCivil; return estadoCivil;
} }
public String getTipoDocumento() { public TipoDocumento getTipoDocumento() {
return tipoDocumento; return tipoDocumento;
} }
public Nacionalidad getNacionalidad() { public Nacionalidad getNacionalidad() {
......
...@@ -21,7 +21,7 @@ uniqueConstraints=@UniqueConstraint(columnNames={"postulante_id", "tecnologia_id ...@@ -21,7 +21,7 @@ uniqueConstraints=@UniqueConstraint(columnNames={"postulante_id", "tecnologia_id
public class PostulanteTecnologia { public class PostulanteTecnologia {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id") @Column(name="id")
private long id ; private long id ;
...@@ -29,12 +29,13 @@ public class PostulanteTecnologia { ...@@ -29,12 +29,13 @@ public class PostulanteTecnologia {
@Min(value = 1) @Min(value = 1)
@Max(value = 5) @Max(value = 5)
private Long nivel; private Long nivel;
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},optional = false) @ManyToOne(cascade = {CascadeType.PERSIST},optional = false)
@JoinColumn @JoinColumn
private Tecnologia tecnologia; private Tecnologia tecnologia;
@ManyToOne() @ManyToOne()
@JoinColumn @JoinColumn
@JsonBackReference(value = "postulantetecnologia-postulante") @JsonBackReference(value = "postulantetecnologia-postulante")
private Postulante postulante; private Postulante postulante;
......
package com.roshka.modelo;
import javax.persistence.*;
@Entity
@Table(name = "recursos_humanos_user")
public class RRHHUser {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true, length = 45)
private String email;
@Column(nullable = false, length = 64)
private String password;
@Column(name = "first_name", nullable = false, length = 20)
private String firstName;
@Column(name = "last_name", nullable = false, length = 20)
private String lastName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
package com.roshka.modelo; package com.roshka.modelo;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonBackReference;
...@@ -16,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; ...@@ -16,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference;
@Table(name = "referencia_personal") @Table(name = "referencia_personal")
public class ReferenciaPersonal { public class ReferenciaPersonal {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; private Long id;
@NotBlank @NotBlank
...@@ -31,7 +24,7 @@ public class ReferenciaPersonal { ...@@ -31,7 +24,7 @@ public class ReferenciaPersonal {
@Column(name = "relacion") @Column(name = "relacion")
private String relacion; private String relacion;
@ManyToOne(optional = false) @ManyToOne(cascade = CascadeType.ALL, optional = false)
@JoinColumn @JoinColumn
@JsonBackReference @JsonBackReference
private Postulante postulante; private Postulante postulante;
......
...@@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank; ...@@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank;
@Entity @Entity
@Table(name="tecnologia") @Table(name="tecnologia")
public class Tecnologia { public class Tecnologia {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Id @Id
@Column(name="id") @Column(name="id")
private long id; private long id;
...@@ -29,7 +29,7 @@ public class Tecnologia { ...@@ -29,7 +29,7 @@ public class Tecnologia {
this.id = id; this.id = id;
} }
public String getNombre() { public String getNombre() {
return nombre.toLowerCase(); return nombre;
} }
public void setNombre(String nombre) { public void setNombre(String nombre) {
this.nombre = nombre; this.nombre = nombre;
......
package com.roshka.modelo;
import com.fasterxml.jackson.annotation.JsonValue;
public enum TipoDocumento {
CI("CI","Cedula de identidad"),
DNI("PAS","Pasaporte"),
Otro("Otro","Otro");
private String code;
private String descripcion;
private TipoDocumento(String code, String descripcion) {
this.code = code;
this.descripcion = descripcion;
}
public void setDescripcion(String descripcion){
this.descripcion = descripcion;
}
@JsonValue
public String getCode() {
return code;
}
public String getDescripcion() {
return descripcion;
}
}
package com.roshka.modelo;
import java.util.Arrays;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter(autoApply = true)
public class TipoDocumentoConverter implements AttributeConverter<TipoDocumento, String> {
@Override
public String convertToDatabaseColumn(TipoDocumento modalidad) {
if (modalidad == null) {
return null;
}
return modalidad.getCode();
}
@Override
public TipoDocumento convertToEntityAttribute(String code) {
if (code == null) {
return null;
}
return Arrays.stream(TipoDocumento.values())
.filter(c -> c.getCode().equals(code))
.findFirst()
.orElseThrow(IllegalArgumentException::new);
}
}
package com.roshka.repositorio; package com.roshka.repositorio;
import java.util.List;
import com.roshka.modelo.Cargo; import com.roshka.modelo.Cargo;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
public interface CargoRepository extends JpaRepository<Cargo,Long>{ public interface CargoRepository extends JpaRepository<Cargo,Long>{
public List<Cargo> findByNombreContainingIgnoreCase(String nombre);
} }
...@@ -11,7 +11,8 @@ import org.springframework.data.jpa.repository.Query; ...@@ -11,7 +11,8 @@ import org.springframework.data.jpa.repository.Query;
public interface ConvocatoriaRepository extends JpaRepository<ConvocatoriaCargo,Long> { public interface ConvocatoriaRepository extends JpaRepository<ConvocatoriaCargo,Long> {
public List<ConvocatoriaCargo> findByCargoId(Long cargoId); public List<ConvocatoriaCargo> findByCargoId(Long cargoId);
//@Query(value="selec x from ConvocatoriaCargo x where (x.fechaFinal > ?1)",nativeQuery = true)
//public List<ConvocatoriaCargo> findConvocatoriaCargoByCargo(Date fechaFinal);
@Query("select c from ConvocatoriaCargo c where ( ?1 is null and ?3 is null) or ( ( ( (c.fechaFin > ?2 and ?3 = 1) or (c.fechaFin < ?2 and ?3 = 0)) or ?3 is null ) and (c.cargoId = ?1 or ?1 is null) )") @Query("select c from ConvocatoriaCargo c where ( ?1 is null and ?3 is null) or ( ( ( (c.fechaFin > ?2 and ?3 = 1) or (c.fechaFin < ?2 and ?3 = 0)) or ?3 is null ) and (c.cargoId = ?1 or ?1 is null) )")
public List<ConvocatoriaCargo> f1ndByCargoAndEstado(TypedParameterValue cargoId, Date fecha, TypedParameterValue isOpen); public List<ConvocatoriaCargo> f1ndByCargoAndEstado(TypedParameterValue cargoId, Date fecha, TypedParameterValue isOpen);
} }
package com.roshka.repositorio; package com.roshka.repositorio;
import com.roshka.modelo.Postulante;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import com.roshka.modelo.Estudio; import com.roshka.modelo.Estudio;
import java.util.List;
public interface EstudioRepository extends JpaRepository<Estudio,Long>{ public interface EstudioRepository extends JpaRepository<Estudio,Long>{
public List<Estudio> findByPostulante(Postulante postulante);
} }
package com.roshka.repositorio; package com.roshka.repositorio;
import com.roshka.modelo.Postulante;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
...@@ -9,4 +10,6 @@ import com.roshka.modelo.Experiencia; ...@@ -9,4 +10,6 @@ import com.roshka.modelo.Experiencia;
public interface ExperienciaRepository extends JpaRepository<Experiencia,Long> { public interface ExperienciaRepository extends JpaRepository<Experiencia,Long> {
public List<Experiencia> findByCargoLike(String cargo); public List<Experiencia> findByCargoLike(String cargo);
public List<Experiencia> findByPostulante(Postulante postulante);
} }
...@@ -2,15 +2,21 @@ package com.roshka.repositorio; ...@@ -2,15 +2,21 @@ package com.roshka.repositorio;
import java.util.List; import java.util.List;
import org.hibernate.jpa.TypedParameterValue;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import com.roshka.modelo.Disponibilidad;
import com.roshka.modelo.Postulante; import com.roshka.modelo.Postulante;
public interface PostulanteRepository extends JpaRepository<Postulante,Long> { public interface PostulanteRepository extends JpaRepository<Postulante,Long> {
@Query("select p from Postulante p join p.estudios e on e.institucion LIKE %?1%") public Postulante findByNroDocument(String ci);
@Query("select p from Postulante p join p.estudios e on e.institucion.nombre LIKE %?1%")
public List<Postulante> findByInstitucionEstudio(String institucion); public List<Postulante> findByInstitucionEstudio(String institucion);
@Query("select p from Postulante p " + @Query("select p from Postulante p " +
...@@ -31,8 +37,29 @@ public interface PostulanteRepository extends JpaRepository<Postulante,Long> { ...@@ -31,8 +37,29 @@ public interface PostulanteRepository extends JpaRepository<Postulante,Long> {
"having sum(fecha_hasta-fecha_desde)>?1 * INTERVAL '1' month", "having sum(fecha_hasta-fecha_desde)>?1 * INTERVAL '1' month",
nativeQuery = true ) nativeQuery = true )
public List<Postulante> personasConExperienciaMayor(long meses); public List<Postulante> personasConExperienciaMayor(long meses);
@Query("select pos from Postulante pos join PostulanteTecnologia pt on pt.postulante.id=pos.id "+ @Query("select pos from Postulante pos join PostulanteTecnologia pt on pt.postulante.id=pos.id "+
"join Tecnologia tec on pt.tecnologia.id=tec.id "+ "join Tecnologia tec on pt.tecnologia.id=tec.id "+
"where tec.nombre=?1 and pt.nivel=?2") "where tec.nombre=?1 and pt.nivel=?2")
public List<Postulante> findByPostulanteTecnologiaM(String tecno,long idt); public List<Postulante> findByPostulanteTecnologiaM(String tecno,long idt);
@Query(value = "select DISTINCT p " +
"from Postulante p left join p.experiencias x " +
"left join p.estudios e " +
"left join p.tecnologias pt " +
"left join p.postulaciones conv " +
"where (?1 is null or lower(p.nombre) LIKE lower(?1) or lower(p.apellido) LIKE lower(?1) ) " +
"and (p.disponibilidad = ?2 or ?2 is null) " +
"and (p.nivelIngles >= ?3 or ?3 is null) "+
"and (pt.nivel >= ?4 or ?4 is null) "+
"and (pt.tecnologia.id = ?5 or ?5 is null) "+
" and (e.institucion.id = ?6 or ?6 is null ) "+
" and (conv.cargoId = ?7 or ?7 is null ) ")
public Page<Postulante> postulantesMultiFiltro(TypedParameterValue nombre, Disponibilidad disponibilidad, Long nivelInges, Long nivel, Long tecnoId, Long instId,Long cargoId, Pageable pageable);
@Query("SELECT p FROM Postulante p JOIN Estudio e ON p.id=e.postulante.id "+
"where e.temaDeEstudio=?1")
public List<Postulante> obtenerPostulantesPorCarrera(String carrera);
} }
package com.roshka.repositorio; package com.roshka.repositorio;
import com.roshka.modelo.Postulante;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import com.roshka.modelo.PostulanteTecnologia; import com.roshka.modelo.PostulanteTecnologia;
public interface PostulanteTecnologiaRepository extends JpaRepository<PostulanteTecnologia,Long>{ import java.util.List;
public interface PostulanteTecnologiaRepository extends JpaRepository<PostulanteTecnologia,Long>{
public List<PostulanteTecnologia> findByPostulante(Postulante postulante);
} }
package com.roshka.repositorio;
import com.roshka.modelo.RRHHUser;
import org.springframework.data.jpa.repository.JpaRepository;
public interface RRHHUserRepository extends JpaRepository<RRHHUser, Long> {
RRHHUser findByEmail(String username);
}
...@@ -2,9 +2,11 @@ package com.roshka.repositorio; ...@@ -2,9 +2,11 @@ package com.roshka.repositorio;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import com.roshka.modelo.Tecnologia; import com.roshka.modelo.Tecnologia;
public interface TecnologiaRepository extends JpaRepository<Tecnologia,Long> { public interface TecnologiaRepository extends JpaRepository<Tecnologia,Long> {
public List<Tecnologia> findByNombreContainingIgnoreCase(String nombre);
} }
...@@ -2,6 +2,9 @@ package com.roshka.utils; ...@@ -2,6 +2,9 @@ package com.roshka.utils;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.YearMonth;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import java.util.Date; import java.util.Date;
public class Helper { public class Helper {
...@@ -12,7 +15,7 @@ public class Helper { ...@@ -12,7 +15,7 @@ public class Helper {
*/ */
public static Date convertirFecha(String fecha) { public static Date convertirFecha(String fecha) {
try { try {
if(fecha == null || fecha.trim().equals("")) return null;
return new SimpleDateFormat("yyyy-MM-dd").parse(fecha); return new SimpleDateFormat("yyyy-MM-dd").parse(fecha);
} catch (ParseException e) { } catch (ParseException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -21,4 +24,11 @@ public class Helper { ...@@ -21,4 +24,11 @@ public class Helper {
return null; return null;
} }
} }
public static final long getMonthsDifference(Date date1, Date date2) {
YearMonth m1 = YearMonth.from(date1.toInstant().atZone(ZoneOffset.UTC));
YearMonth m2 = YearMonth.from(date2.toInstant().atZone(ZoneOffset.UTC));
return m1.until(m2, ChronoUnit.MONTHS) + 1;
}
} }
spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect 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 spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG #logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE #logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.sql.init.mode=always spring.sql.init.mode=always
spring.sql.init.platform=postgres spring.sql.init.platform=postgres
......
[
{
"id": 1,
"nombre": "dev java"
},
{
"id": 2,
"nombre": "dev php"
}
]
\ No newline at end of file
[
{
"id": 1,
"cargoId": 1,
"fechaInicio": "2021-11-01",
"fechaFin": "2021-11-30",
"cupos": 20
},
{
"id": 2,
"cargoId": 2,
"fechaInicio": "2021-11-01",
"fechaFin": "2021-11-30",
"cupos": 20
}
]
\ No newline at end of file
[ [
{ {
"resumen": "In irure aliquip qui cillum veniam sint amet amet sint ex proident anim mollit.", "resumen": "In irure aliquip qui cillum veniam sint amet amet sint ex proident anim mollit.",
"nacionalidad":"Paraguayo", "nacionalidad": "Paraguayo",
"estadoCivil":"Soltero", "postulaciones": [{ "id": 1 }],
"tipoDocumento":"ci", "estadoCivil": "Soltero",
"tipoDocumento": "CI",
"nombre": "Taylor", "nombre": "Taylor",
"apellido": "Obrien", "apellido": "Obrien",
"correo": "gladysalexander@dadabase.com", "correo": "gladysalexander@dadabase.com",
"ci": 5821432, "nroDocument": 5821432,
"ciudadId": 238, "ciudadId": 238,
"telefono": "(950) 417-3681", "telefono": "(950) 417-3681",
"fechaNacimiento": "2021-08-16", "fechaNacimiento": "2021-08-16",
"nivelIngles": 1, "nivelIngles": 1,
"disponibilidad": "C", "disponibilidad": "C",
"experiencias": [ "experiencias": [
{ {
"institucion": "Fanfare", "institucion": "Fanfare",
"fechaDesde": "2014-09-10", "fechaDesde": "2014-09-10",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"tipoExperiencia":"Trabajo Normal", "tipoExperiencia": "Trabajo Normal",
"cargo": "dba", "cargo": "dba",
"descripcion": "Enim qui Lorem ut magna.", "descripcion": "Enim qui Lorem ut magna.",
"nombreReferencia": "Marissa", "nombreReferencia": "Marissa",
...@@ -29,8 +30,8 @@ ...@@ -29,8 +30,8 @@
"estudios": [ "estudios": [
{ {
"tipoDeEstudio": "TERCIARIO", "tipoDeEstudio": "TERCIARIO",
"estado": "SUSPENDIDO", "estado": "SUSPENDIDO",
"institucion": {"nombre":"UNA"}, "institucion": { "nombre": "UNA" },
"fechaDesde": "2014-08-28", "fechaDesde": "2014-08-28",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"temaDeEstudio": "analista" "temaDeEstudio": "analista"
...@@ -59,13 +60,14 @@ ...@@ -59,13 +60,14 @@
}, },
{ {
"resumen": "Do nostrud aliqua adipisicing in sunt aute id do elit ut dolor ad aliquip.", "resumen": "Do nostrud aliqua adipisicing in sunt aute id do elit ut dolor ad aliquip.",
"nacionalidad":"Paraguayo", "nacionalidad": "Paraguayo",
"estadoCivil":"Soltero", "postulaciones": [{ "id": 1 }],
"tipoDocumento":"ci", "estadoCivil": "Soltero",
"tipoDocumento": "CI",
"nombre": "Hopkins", "nombre": "Hopkins",
"apellido": "Parks", "apellido": "Parks",
"correo": "grahamgriffith@zilidium.com", "correo": "grahamgriffith@zilidium.com",
"ci": 4213361, "nroDocument": 4213361,
"ciudadId": 96, "ciudadId": 96,
"telefono": "(866) 560-2541", "telefono": "(866) 560-2541",
"fechaNacimiento": "2021-09-04", "fechaNacimiento": "2021-09-04",
...@@ -80,15 +82,15 @@ ...@@ -80,15 +82,15 @@
"cargo": "developer frontend", "cargo": "developer frontend",
"descripcion": "Consequat fugiat qui sint deserunt ullamco.", "descripcion": "Consequat fugiat qui sint deserunt ullamco.",
"nombreReferencia": "Iva", "nombreReferencia": "Iva",
"tipoExperiencia":"Trabajo Normal", "tipoExperiencia": "Trabajo Normal",
"telefonoReferencia": "(947) 580-2363" "telefonoReferencia": "(947) 580-2363"
} }
], ],
"estudios": [ "estudios": [
{ {
"tipoDeEstudio": "TERCIARIO", "tipoDeEstudio": "TERCIARIO",
"estado": "SUSPENDIDO", "estado": "SUSPENDIDO",
"institucion": {"nombre":"UNA"}, "institucion": { "nombre": "UNA" },
"fechaDesde": "2014-07-08", "fechaDesde": "2014-07-08",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"temaDeEstudio": "lic inf" "temaDeEstudio": "lic inf"
...@@ -105,13 +107,14 @@ ...@@ -105,13 +107,14 @@
}, },
{ {
"resumen": "Occaecat non cupidatat amet reprehenderit consectetur ullamco et.", "resumen": "Occaecat non cupidatat amet reprehenderit consectetur ullamco et.",
"nacionalidad":"Paraguayo", "nacionalidad": "Paraguayo",
"estadoCivil":"Soltero", "postulaciones": [{ "id": 1 }],
"tipoDocumento":"ci", "estadoCivil": "Soltero",
"tipoDocumento": "CI",
"nombre": "Alejandra", "nombre": "Alejandra",
"apellido": "Riggs", "apellido": "Riggs",
"correo": "ruthrobertson@homelux.com", "correo": "ruthrobertson@homelux.com",
"ci": 4605787, "nroDocument": 4605787,
"ciudadId": 30, "ciudadId": 30,
"telefono": "(876) 580-2411", "telefono": "(876) 580-2411",
"fechaNacimiento": "2021-01-28", "fechaNacimiento": "2021-01-28",
...@@ -124,7 +127,7 @@ ...@@ -124,7 +127,7 @@
"fechaDesde": "2014-08-26", "fechaDesde": "2014-08-26",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"cargo": "dba", "cargo": "dba",
"tipoExperiencia":"Trabajo Normal", "tipoExperiencia": "Trabajo Normal",
"descripcion": "Aute culpa ea mollit adipisicing dolore dolore amet adipisicing occaecat commodo enim cillum.", "descripcion": "Aute culpa ea mollit adipisicing dolore dolore amet adipisicing occaecat commodo enim cillum.",
"nombreReferencia": "Rose", "nombreReferencia": "Rose",
"telefonoReferencia": "(853) 471-2006" "telefonoReferencia": "(853) 471-2006"
...@@ -133,8 +136,8 @@ ...@@ -133,8 +136,8 @@
"estudios": [ "estudios": [
{ {
"tipoDeEstudio": "TERCIARIO", "tipoDeEstudio": "TERCIARIO",
"estado": "SUSPENDIDO", "estado": "SUSPENDIDO",
"institucion": {"nombre":"UNA"}, "institucion": { "nombre": "UNA" },
"fechaDesde": "2014-02-13", "fechaDesde": "2014-02-13",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"temaDeEstudio": "lic inf" "temaDeEstudio": "lic inf"
...@@ -151,13 +154,14 @@ ...@@ -151,13 +154,14 @@
}, },
{ {
"resumen": "Qui ullamco excepteur velit ad ullamco id id nisi irure dolore cupidatat mollit ullamco veniam.", "resumen": "Qui ullamco excepteur velit ad ullamco id id nisi irure dolore cupidatat mollit ullamco veniam.",
"nacionalidad":"Paraguayo", "nacionalidad": "Paraguayo",
"estadoCivil":"Soltero", "postulaciones": [{ "id": 1 }],
"tipoDocumento":"ci", "estadoCivil": "Soltero",
"tipoDocumento": "CI",
"nombre": "Angelina", "nombre": "Angelina",
"apellido": "Wallace", "apellido": "Wallace",
"correo": "christiwalls@capscreen.com", "correo": "christiwalls@capscreen.com",
"ci": 4591352, "nroDocument": 4591352,
"ciudadId": 65, "ciudadId": 65,
"telefono": "(931) 499-3122", "telefono": "(931) 499-3122",
"fechaNacimiento": "2021-06-05", "fechaNacimiento": "2021-06-05",
...@@ -173,14 +177,14 @@ ...@@ -173,14 +177,14 @@
"descripcion": "Aliquip occaecat minim dolor enim commodo.", "descripcion": "Aliquip occaecat minim dolor enim commodo.",
"nombreReferencia": "Elba", "nombreReferencia": "Elba",
"telefonoReferencia": "(881) 568-2597", "telefonoReferencia": "(881) 568-2597",
"tipoExperiencia":"Trabajo Normal" "tipoExperiencia": "Trabajo Normal"
} }
], ],
"estudios": [ "estudios": [
{ {
"tipoDeEstudio": "TERCIARIO", "tipoDeEstudio": "TERCIARIO",
"estado": "SUSPENDIDO", "estado": "SUSPENDIDO",
"institucion": {"nombre":"UNA"}, "institucion": { "nombre": "UNA" },
"fechaDesde": "2014-12-22", "fechaDesde": "2014-12-22",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"temaDeEstudio": "ing inf" "temaDeEstudio": "ing inf"
...@@ -197,13 +201,14 @@ ...@@ -197,13 +201,14 @@
}, },
{ {
"resumen": "Deserunt tempor ut et eiusmod et labore Lorem.", "resumen": "Deserunt tempor ut et eiusmod et labore Lorem.",
"nacionalidad":"Paraguayo", "nacionalidad": "Paraguayo",
"estadoCivil":"Soltero", "postulaciones": [{ "id": 1 }],
"tipoDocumento":"ci", "estadoCivil": "Soltero",
"tipoDocumento": "CI",
"nombre": "Rivas", "nombre": "Rivas",
"apellido": "Owens", "apellido": "Owens",
"correo": "shirleyguzman@equitox.com", "correo": "shirleyguzman@equitox.com",
"ci": 3969318, "nroDocument": 3969318,
"ciudadId": 143, "ciudadId": 143,
"telefono": "(972) 524-2610", "telefono": "(972) 524-2610",
"fechaNacimiento": "2021-09-09", "fechaNacimiento": "2021-09-09",
...@@ -219,14 +224,14 @@ ...@@ -219,14 +224,14 @@
"descripcion": "Dolore nulla deserunt fugiat est reprehenderit tempor qui excepteur.", "descripcion": "Dolore nulla deserunt fugiat est reprehenderit tempor qui excepteur.",
"nombreReferencia": "Crawford", "nombreReferencia": "Crawford",
"telefonoReferencia": "(903) 568-2045", "telefonoReferencia": "(903) 568-2045",
"tipoExperiencia":"Trabajo Normal" "tipoExperiencia": "Trabajo Normal"
} }
], ],
"estudios": [ "estudios": [
{ {
"tipoDeEstudio": "TERCIARIO", "tipoDeEstudio": "TERCIARIO",
"estado": "SUSPENDIDO", "estado": "SUSPENDIDO",
"institucion": {"nombre":"UNA"}, "institucion": { "nombre": "UNA" },
"fechaDesde": "2014-08-03", "fechaDesde": "2014-08-03",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"temaDeEstudio": "lic inf" "temaDeEstudio": "lic inf"
...@@ -243,13 +248,14 @@ ...@@ -243,13 +248,14 @@
}, },
{ {
"resumen": "Aliqua est adipisicing do exercitation sit laborum aliquip aliqua adipisicing enim aute.", "resumen": "Aliqua est adipisicing do exercitation sit laborum aliquip aliqua adipisicing enim aute.",
"nacionalidad":"Paraguayo", "nacionalidad": "Paraguayo",
"estadoCivil":"Soltero", "postulaciones": [{ "id": 1 }],
"tipoDocumento":"ci", "estadoCivil": "Soltero",
"tipoDocumento": "CI",
"nombre": "Estelle", "nombre": "Estelle",
"apellido": "Gamble", "apellido": "Gamble",
"correo": "mclaughlinpate@enomen.com", "correo": "mclaughlinpate@enomen.com",
"ci": 2329745, "nroDocument": 2329745,
"ciudadId": 248, "ciudadId": 248,
"telefono": "(933) 501-3525", "telefono": "(933) 501-3525",
"fechaNacimiento": "2021-03-24", "fechaNacimiento": "2021-03-24",
...@@ -265,14 +271,14 @@ ...@@ -265,14 +271,14 @@
"descripcion": "Do do est ad ea pariatur aliquip sit ipsum in duis laborum velit magna.", "descripcion": "Do do est ad ea pariatur aliquip sit ipsum in duis laborum velit magna.",
"nombreReferencia": "Schultz", "nombreReferencia": "Schultz",
"telefonoReferencia": "(903) 420-3902", "telefonoReferencia": "(903) 420-3902",
"tipoExperiencia":"Trabajo Normal" "tipoExperiencia": "Trabajo Normal"
} }
], ],
"estudios": [ "estudios": [
{ {
"tipoDeEstudio": "TERCIARIO", "tipoDeEstudio": "TERCIARIO",
"estado": "SUSPENDIDO", "estado": "SUSPENDIDO",
"institucion": {"nombre":"UNA"}, "institucion": { "nombre": "UNA" },
"fechaDesde": "2014-07-13", "fechaDesde": "2014-07-13",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"temaDeEstudio": "ing inf" "temaDeEstudio": "ing inf"
...@@ -289,13 +295,14 @@ ...@@ -289,13 +295,14 @@
}, },
{ {
"resumen": "Officia eiusmod ut reprehenderit tempor consequat elit amet ex voluptate aute anim do.", "resumen": "Officia eiusmod ut reprehenderit tempor consequat elit amet ex voluptate aute anim do.",
"nacionalidad":"Paraguayo", "nacionalidad": "Paraguayo",
"estadoCivil":"Soltero", "postulaciones": [{ "id": 1 }],
"tipoDocumento":"ci", "estadoCivil": "Soltero",
"tipoDocumento": "CI",
"nombre": "Mariana", "nombre": "Mariana",
"apellido": "Ratliff", "apellido": "Ratliff",
"correo": "loramiddleton@musanpoly.com", "correo": "loramiddleton@musanpoly.com",
"ci": 4519594, "nroDocument": 4519594,
"ciudadId": 104, "ciudadId": 104,
"telefono": "(817) 492-2493", "telefono": "(817) 492-2493",
"fechaNacimiento": "2021-07-30", "fechaNacimiento": "2021-07-30",
...@@ -311,15 +318,14 @@ ...@@ -311,15 +318,14 @@
"descripcion": "Anim labore anim veniam deserunt ex aute.", "descripcion": "Anim labore anim veniam deserunt ex aute.",
"nombreReferencia": "Francesca", "nombreReferencia": "Francesca",
"telefonoReferencia": "(961) 420-2150", "telefonoReferencia": "(961) 420-2150",
"tipoExperiencia":"Trabajo Normal" "tipoExperiencia": "Trabajo Normal"
} }
], ],
"estudios": [ "estudios": [
{ {
"tipoDeEstudio": "TERCIARIO", "tipoDeEstudio": "TERCIARIO",
"estado": "SUSPENDIDO", "estado": "SUSPENDIDO",
"institucion": {"nombre":"UNA"}, "institucion": { "nombre": "UNA" },
"fechaDesde": "2014-10-03", "fechaDesde": "2014-10-03",
"fechaHasta": "2016-01-01", "fechaHasta": "2016-01-01",
"temaDeEstudio": "ing inf" "temaDeEstudio": "ing inf"
...@@ -334,4 +340,4 @@ ...@@ -334,4 +340,4 @@
} }
] ]
} }
] ]
\ No newline at end of file
var cont_experiencia = 0; var cont_experiencia = 0;
let cont_estudios = 0; let cont_estudios = 0;
let cont_tecnologia = 0; let cont_tecnologia = 0;
var cont_referencias=0 ;
let cont_cargo = 0;
const experiencias = []; const experiencias = [];
const estudios = []; const estudios = [];
const tecnologias = []; const tecnologias = [];
let noValidateFlag = false;
const postulaciones = [];
var cont_referencias=0 ;
const referencias= []; const referencias= [];
const formValidator = function () { const formValidator = function () {
'use strict' 'use strict'
...@@ -23,13 +30,21 @@ const formValidator = function () { ...@@ -23,13 +30,21 @@ const formValidator = function () {
if (!form.checkValidity()) { if (!form.checkValidity()) {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
noValidateFlag = true;
} }
form.classList.add('was-validated') form.classList.add('was-validated')
}, false) }, false)
}) })
} }
function carg(elemento) {
var element = document.getElementById('descripcion');
if(elemento == "otro"){
element.style.display='block';
}else{
element.style.display='none';
}
}
function agregarFieldExpierncia(event){ function agregarFieldExpierncia(event){
//recoger del form //recoger del form
const pairs = {}; const pairs = {};
...@@ -82,7 +97,7 @@ function agregarFieldExpierncia(event){ ...@@ -82,7 +97,7 @@ function agregarFieldExpierncia(event){
content += ` content += `
<li id="exp-${index}"> <li id="exp-${index}">
${exp.institucion} ${exp.institucion}
<button type="button" onclick="eliminarExperiencia(event)"> <span class="glyphicon glyphicon-trash"></span> Tras</button> <button type="button" onclick="eliminarExperiencia(event)"> <span class="glyphicon glyphicon-trash"></span> Eliminar</button>
</li> </li>
` `
...@@ -176,6 +191,7 @@ function serializeJSON (form) { ...@@ -176,6 +191,7 @@ function serializeJSON (form) {
// Create a new FormData object // Create a new FormData object
const formData = new FormData(form); const formData = new FormData(form);
// Create an object to hold the name/value pairs // Create an object to hold the name/value pairs
const pairs = {}; const pairs = {};
...@@ -186,27 +202,33 @@ function serializeJSON (form) { ...@@ -186,27 +202,33 @@ function serializeJSON (form) {
pairs["experiencias"] = experiencias.filter(exp => exp)//eliminacion de nulos pairs["experiencias"] = experiencias.filter(exp => exp)//eliminacion de nulos
pairs["estudios"] = estudios.filter(est => est)//eliminacion de nulos pairs["estudios"] = estudios.filter(est => est)//eliminacion de nulos
pairs["tecnologias"] = tecnologias.filter(tec => tec)//eliminacion de nulos pairs["tecnologias"] = tecnologias.filter(tec => tec)//eliminacion de nulos
pairs["postulaciones"] = postulaciones.filter(car => car)//eliminacion de nulos
pairs["referencias"] = referencias.filter(tec => tec) pairs["referencias"] = referencias.filter(tec => tec)
// Return the JSON string // Return the JSON string
return JSON.stringify(pairs, null, 2); return JSON.stringify(pairs, null, 2);
} }
async function postData(url = '', data = {}) { async function postData(url = '', data = {}) {
var token = document.querySelector("meta[name='_csrf']").content;
var headerxs = document.querySelector("meta[name='_csrf_header']").content;
// Default options are marked with * // Default options are marked with *
const response = await fetch(url, { let senddata = {
method: 'POST', // *GET, POST, PUT, DELETE, etc. method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit credentials: 'same-origin', // include, *same-origin, omit
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
// 'Content-Type': 'application/x-www-form-urlencoded', // 'Content-Type': 'application/x-www-form-urlencoded',
}, },
redirect: 'follow', // manual, *follow, error redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
body: data // body data type must match "Content-Type" header body: data // body data type must match "Content-Type" header
}); }
senddata["headers"][headerxs] = token;
const response = await fetch(url, senddata);
return response; // parses JSON response into native JavaScript objects return response; // parses JSON response into native JavaScript objects
} }
formValidator() formValidator()
...@@ -217,15 +239,18 @@ form.addEventListener("submit",(evt)=>{ ...@@ -217,15 +239,18 @@ form.addEventListener("submit",(evt)=>{
// evt.stopPropagation() // evt.stopPropagation()
// } // }
// form.classList.add('was-validated') // form.classList.add('was-validated')
postData('postulante', serializeJSON(form)) if(!noValidateFlag){
.then(response => { postData('postulante', serializeJSON(form))
if(response.status==200 || response.status==302){ .then(response => {
location.replace(response.url); if(response.status==200 || response.status==302){
}else{ location.replace(response.url);
console.log(response.text().then(value => console.log(value))) }else{
} console.log(response.text().then(value => console.log(value)))
}); }
evt.preventDefault(); });
evt.preventDefault();
}
noValidateFlag = false
} ); } );
document.querySelector("#btn-new-tech").addEventListener('click',()=>{document.querySelector("#tecnologia-nombre").classList.remove('d-none')}) document.querySelector("#btn-new-tech").addEventListener('click',()=>{document.querySelector("#tecnologia-nombre").classList.remove('d-none')})
...@@ -320,7 +345,85 @@ function eliminarEstudio(event) { ...@@ -320,7 +345,85 @@ function eliminarEstudio(event) {
//eliminar en html //eliminar en html
event.target.parentElement.remove() event.target.parentElement.remove()
} }
/*--------------------------------------------------------------------*/
function agregarFieldCargo(){
//recoger del form
const pairs = {};
const formcar = document.querySelector("[name=cargo-form]");
const formData = new FormData(formcar);
//Validacion
let returnFlag = false;
let requiredValues = ["nombre"]
formData.forEach((value, key)=>{
if(requiredValues.includes(key)
&& value==="" && returnFlag == false){
console.log(key, value)
returnFlag = true;
}
});
if(returnFlag===true){
let message = "Rellene "
for(let i=0;i<requiredValues.length;i++){
message+=", "+requiredValues[i];
}
message += " como minimo."
alert(message);
return;
}
for (const [name, value] of formData){
pairs[name] = value
}
console.log(pairs)
for(let i=0;i<cont_cargo;i++){
if(postulaciones[i]!==null){
if(postulaciones[i]["id"]===pairs["cargo-id"]){
alert("Ya has agregado ese cargo!")
cont_cargo--;
return;
}
}
}
postulaciones[cont_cargo]={}
postulaciones[cont_cargo]["id"]=pairs["cargo-id"]
//postulaciones[cont_cargo]["cargo"]=pairs["cargo-id"]=="-1"?{nombre: pairs["cargo-nombre"]}:{id: pairs["cargo-id"],nombre:document.querySelector('[name=cargo-id] > option[value="'+pairs["cargo-id"]+'"]').innerHTML}
console.log(postulaciones)
formcar.reset();
//imprimir lista actualizada
const div = document.querySelector("#cargos")
const div1 = document.createElement('div');
let content1='<ul>'
for (let index = 0; index < postulaciones.length; index++) {
const car = postulaciones[index];
if(car==null) continue;
content1 += `
<li id="car-${index}">
${document.querySelector('[name=cargo-id] > option[value="'+car.id+'"]').innerHTML}
<button type="button" onclick="eliminarCargoPostulante(event)">Eliminar</button>
</li>
`
}
content1 += "</ul>"
div1.innerHTML = content1
div.innerHTML = '';
div.appendChild(div1);
cont_cargo++;
}
/*---------------------------------------------------------------------------------------------------*/
function eliminarCargoPostulante(event) {
//eliminar del array
postulaciones[event.target.parentElement.id.split("-")[1]]=null
//eliminar en html
event.target.parentElement.remove()
}
/*--------------------------------------------------------------------*/
//evento para cambio de ciudad segun departamento //evento para cambio de ciudad segun departamento
......
<%@ 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" %>
<div class="container">
<c:if test="${not empty error}">
<div class="alert alert-danger alert-dismissible fade show" role="alert">
${error}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</c:if>
<c:if test="${not empty success}">
<div class="alert alert-success alert-dismissible fade show" role="alert">
${success}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</c:if>
</div>
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<form:form action="/cargo" method="post" modelAttribute="cargo" class="row row-cols-lg-auto g-3 align-items-center"> <form:form action="/cargo/${cargo.id == null ? '' : cargo.id}" method="post" modelAttribute="cargo" class="row row-cols-lg-auto g-3 align-items-center">
<div class="col-12"> <div class="col-12">
<form:label class="form-label visually-hidden" path="nombre">Nombre del cargo </form:label> <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"/> <form:input type="text" path="nombre" class="form-control" placeholder="Nombre del 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" %>
<!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 class="container">
<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>
</body>
</html>
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<form:form action="/convocatoria" method="post" modelAttribute="convocatoria"> <form:form action="/convocatoria/${convocatoria.id == null ? '' : convocatoria.id}" method="post" modelAttribute="convocatoria">
<div class="mb-3"> <div class="mb-3">
<form:label path="fechaInicioS" class="form-label">Fecha inicial</form:label> <form:label path="fechaInicioS" class="form-label">Fecha inicial</form:label>
<form:input type="date" class="form-control" path="fechaInicioS"/> <form:input type="date" class="form-control" path="fechaInicioS"/>
...@@ -37,9 +37,6 @@ ...@@ -37,9 +37,6 @@
</div> </div>
<button type="submit" class="btn btn-primary">Guardar</button> <button type="submit" class="btn btn-primary">Guardar</button>
</form:form> </form:form>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
<label for="cerrado">Cerrado</label><br> <label for="cerrado">Cerrado</label><br>
<input type="submit" value="Buscar"> <input type="submit" value="Buscar">
</form> </form>
<a href="/cargo">Agregar Nuevo Cargo</a>
</div> </div>
<div> <div>
<a href="/convocatoria">Agregar Nueva Convocatoria</a> <a href="/convocatoria">Agregar Nueva Convocatoria</a>
...@@ -54,6 +53,7 @@ ...@@ -54,6 +53,7 @@
<td>${convocatoria.getFechaFin().toString().split(" ")[0]}</td> <td>${convocatoria.getFechaFin().toString().split(" ")[0]}</td>
<td>${convocatoria.getCupos()}</td> <td>${convocatoria.getCupos()}</td>
<td>Ver Postulantes</td> <td>Ver Postulantes</td>
<td><a href="/convocatoria/${convocatoria.id}">Editar</a></td>
</tr> </tr>
</c:forEach> </c:forEach>
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</body> </body>
......
<%@ 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" %>
<html>
<head>
</head>
<body>
<h2 style="text-align: center;">DETALLE POSTULANTE</h2>
<div style="padding: 10px;margin: 3px;border: 1px solid black;">
<br><label>INFORMACION GENERAL</label><br>
<label>Id: ${postulante.id}</label><br>
<label>Nombre: ${postulante.nombre}</label><br>
<label>Apellido ${postulante.apellido}</label><br>
<label>Tipo de documento: ${postulante.tipoDocumento}</label><br>
<label>Cedula: ${postulante.nroDocument}</label><br>
<label>Correo: ${postulante.correo}</label><br>
<label>Departamento: ${postulante.getCiudad().getDepartamento().getNombre()}</label><br>
<label>Ciudad: ${postulante.getCiudad().getNombre()}</label><br>
<label>Telefono: ${postulante.telefono}</label><br><label>
<label>Fecha de nacimiento: ${postulante.fechaNacimiento}</label><br>
<label>Resumen: ${postulante.resumen}</label><br>
<label>Nivel de ingles: ${postulante.nivelIngles}</label><br>
<label>Curriculum: ${postulante.curriculum}</label><br>
<label>Estado civil: ${postulante.estadoCivil}</label><br>
<label>Nacionalidad: ${postulante.nacionalidad}</label><br>
<label>Disponibilidad: ${postulante.disponibilidad}</label><br>
<br><label>TECNOLOGIAS</label><br>
<c:forEach items="${postulante.tecnologias}" var="detalle_tecnologia">
<label>Tecnologias: ${detalle_tecnologia.getTecnologia().getNombre()} -</label>
<label>Nivel de Tecnologia: ${detalle_tecnologia.getNivel()}</label><br>
</c:forEach>
<br><label>EXPERIENCIAS</label><br>
<c:forEach items="${postulante.experiencias}" var="detalle_experiencia">
<label>Institucion: ${detalle_experiencia.getInstitucion()}</label><br>
<label>Fecha Inicio: ${detalle_experiencia.getFechaDesde()}</label><br>
<label>Fecha Fin: ${detalle_experiencia.getFechaHasta()}</label><br>
<label>Referencia: ${detalle_experiencia.getNombreReferencia()}</label><br>
<label>Telefono de la referencia: ${detalle_experiencia.getTelefonoReferencia()}</label><br>
<label>Cargo: ${detalle_experiencia.getCargo()}</label><br>
<label>Motivo de salida: ${detalle_experiencia.getMotivoSalida()}</label><br>
</c:forEach>
<br><label>ESTUDIOS</label><br>
<c:forEach items="${postulante.estudios}" var="detalle_estudios">
<label>Institucion: ${detalle_estudios.getInstitucion().getNombre()}</label><br>
<label>SubNombre: ${detalle_estudios.getInstitucion().getSubNombre()}</label><br>
<label>Tipo de estudio: ${detalle_estudios.getTipoDeEstudio()}</label><br>
<label>Tema de estudio: ${detalle_estudios.getTemaDeEstudio()}</label><br>
<label>Fecha Inicio: ${detalle_estudios.getFechaDesde()}</label><br>
<label>Fecha Fin: ${detalle_estudios.getFechaHasta()}</label><br>
<label>Estado: ${detalle_estudios.getEstado()}</label><br>
</c:forEach>
<br><label>REFERENCIA PERSONAL</label><br>
<c:forEach items="${postulante.referencias}" var="detalle_referencias">
<label>Nombre: ${detalle_referencias.getNombre()}</label>
<label>Relacion: ${detalle_referencias.getRelacion()}</label><br>
<label>Telefono: ${detalle_referencias.getTelefono()}</label><br>
</c:forEach>
<br><label>CARGOS AL CUAL POSTULA</label><br>
<c:forEach items="${postulante.postulaciones}" var="convocatoria">
<label>Nombre: ${convocatoria.getCargo().getNombre()}</label><br>
</c:forEach>
</div>
</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" %>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,400i,700,900&display=swap" rel="stylesheet">
</head>
<style>
body {
text-align: center;
padding: 40px 0;
background: #EBF0F5;
}
h1 {
color: #506BEE;
font-family: "Nunito Sans", "Helvetica Neue", sans-serif;
font-weight: 900;
font-size: 40px;
margin-bottom: 10px;
}
p {
color: #404F5E;
font-family: "Nunito Sans", "Helvetica Neue", sans-serif;
font-size:20px;
margin: 0;
}
i {
color: #506BEE;
font-size: 100px;
line-height: 200px;
margin-left:-15px;
}
.card {
background: white;
padding: 60px;
border-radius: 4px;
box-shadow: 0 2px 3px #C8D0D8;
display: inline-block;
margin: 0 auto;
}
</style>
<body>
<div class="card">
<div style="border-radius:200px; height:200px; width:200px; background: #F8FAF5; margin:0 auto;">
<i class="checkmark"></i>
</div>
<h1>Genial!</h1>
<p>${mensaje1}<br/>${mensaje2}</p>
</div>
</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" %>
<header>
<div class="d-flex">
<div class="ml-auto">
<a href="/logout" class="btn btn-dark">Salir</a></div>
</div>
</header>
\ 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> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link href="https://getbootstrap.com/docs/4.0/examples/signin/signin.css" rel="stylesheet" crossorigin="anonymous">
<title>Document</title> <title>Document</title>
</head> </head>
<body> <body>
<a href="postulante">Form postulante</a> <div class="container">
<a href="postulantes">Lista de postulantes</a> <jsp:include page="header.jsp"/>
<a href="#">Tecnologias</a> <jsp:include page="alerts.jsp"/>
<a href="convocatorias">Lista de convocatorias</a> <a href="postulante">Form postulante</a>
<a href="postulantes">Lista de postulantes</a>
<a href="/tecnologias">Tecnologias</a>
<a href="convocatorias">Lista de convocatorias</a>
<a href="cargos">Lista de cargos</a>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
<%@ 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" %>
<html>
<head>
</head>
<body>
<div>
${postulante.id}<br>
${postulante.nombre}<br>
${postulante.apellido}<br>
${postulante.ci}<br>
${postulante.correo}<br>
${postulante.ciudadId}<br>
${postulante.telefono}<br>
${postulante.fechaNacimiento}<br>
${postulante.resumen}<br>
${postulante.nivelIngles}<br>
${postulante.curriculum}<br>
${postulante.estadoCivil}<br>
${postulante.nacionalidad}<br>
${postulante.tipoDocumento}<br>
${postulante.disponibilidad}<br><br><br>
${postulante.getCiudad().getNombre()}<br>
<c:forEach items="${postulante.tecnologias}" var="detalle_tecnologia" >
${detalle_tecnologia.getTecnologia().getNombre()}
</c:forEach>
</div>
</body>
</html>
\ No newline at end of file
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Login</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="https://getbootstrap.com/docs/4.0/examples/signin/signin.css" rel="stylesheet" crossorigin="anonymous">
</head>
<body>
<jsp:include page="alerts.jsp"/>
<section class="vh-100" style="background-color: #508bfc;">
<div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-8 col-lg-6 col-xl-5">
<div class="card shadow-2-strong" style="border-radius: 1rem;">
<div class="card-body p-5 text-center">
<form:form method="post" action="/login">
<h3 class="mb-5">Ingresar</h3>
<div class="form-outline mb-4">
<input type="email" id="typeEmailX-2" class="form-control form-control-lg" name="email" placeholder="example@example.com"/>
<label class="form-label" for="typeEmailX-2">Email</label>
</div>
<div class="form-outline mb-4">
<input type="password" id="typePasswordX-2" class="form-control form-control-lg" name="password" />
<label class="form-label" for="typePasswordX-2">Password</label>
</div>
<button class="btn btn-primary btn-lg btn-block" type="submit">Ingresar</button>
</form:form>
<hr class="my-4">
</div>
</div>
</div>
</div>
</div>
</section>
<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>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<style type="text/css" media="screen"> <style type="text/css" media="screen">
body { body {
background-color: blue background-color: #506BEE
} }
.card { .card {
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
} }
.image span { .image span {
background-color: blue; background-color: #506BEE;
color: #fff; color: #fff;
padding: 6px; padding: 6px;
height: 30px; height: 30px;
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
} }
.user-details h4 { .user-details h4 {
color: blue color: #506BEE
} }
.ratings { .ratings {
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
.inputs input:focus { .inputs input:focus {
box-shadow: none; box-shadow: none;
border: 2px solid blue border: 2px solid #506BEE
} }
.about-inputs label { .about-inputs label {
...@@ -119,14 +119,12 @@ ...@@ -119,14 +119,12 @@
} }
.add-experience:hover { .add-experience:hover {
background: blue; background: #506BEE;
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
border: solid 1px blue; border: solid 1px #506BEE
display:inline-block;
} }
#outer #outer
{ {
...@@ -193,18 +191,19 @@ ...@@ -193,18 +191,19 @@
</c:forEach> </c:forEach>
</select> </div> </select> </div>
<div class="inputs mb-3 col-md-6"> <div class="inputs mb-3 col-md-6">
<label for="tipoDocumento" class="form-label">Tipo de documento</label> <label for="tipoDocumento" class="form-label"> Tipo de documento</label>
<input type="text" name="tipoDocumento" class="form-control " id="tipoDocumento" required> <select name="tipoDocumento" id="tipoDocumento" class="bg-light" required onchange='carg(this.value);'>
<div class="valid-feedback"> <option value='CI' selected>C.I</option>
Luce Bien! <option value='PAS'>Pasport</option>
</div> <option value='Otro'>Otro</option>
</select>
</div> </div>
<div class="inputs mb-3 col-md-6"> <div class="inputs mb-3 col-md-6">
<label for="ci" class="form-label">Cedula de identidad</label> <label for="nroDocument" class="form-label">Numero de Documento</label>
<input type="number" name="ci" class="form-control " id="ci" required> <input type="number" name="nroDocument" class="form-control " id="nroDocument" required>
<div class="valid-feedback"> <div class="valid-feedback">
Luce Bien! Luce Bien!
</div> </div>
...@@ -246,11 +245,11 @@ ...@@ -246,11 +245,11 @@
<div class="inputs col-md-6"> <label for="nivelIngles" class="form-label"> Nivel de ingles</label> <div class="inputs col-md-6"> <label for="nivelIngles" class="form-label"> Nivel de ingles</label>
<select name="nivelIngles" id="nivelIngles" class="bg-light"> <select name="nivelIngles" id="nivelIngles" class="bg-light">
<option value="1" selected>1</option> <option value="1" selected>Ingles muy basico</option>
<option value="2" >2</option> <option value="2" >Comprendo algunas cosas y puedo leer con la ayuda del traductor</option>
<option value="3" >3</option> <option value="3" >Puedo leer tranquilamente</option>
<option value="4" >4</option> <option value="4" >Puedo escribir documentacion</option>
<option value="5" >5</option> <option value="5" >Puedo escribir y hablar tranquilamente</option>
</select> </select>
</div> </div>
...@@ -272,12 +271,17 @@ ...@@ -272,12 +271,17 @@
</select> </div> </select> </div>
<div class=" p-3 py-5"> <div class="inputs p-3 py-5">
<div class=" d-flex justify-content-between align-items-center experience"> <div class=" inputs d-flex justify-content-between align-items-center experience"><span class="border px-3 p-1 add-experience" data-toggle="modal" data-target="#cargoForm"><i class="fa fa-plus"></i>&nbsp;Cargo al que postulas</span></div><br>
<span class="border px-3 p-1 add-experience" data-toggle="modal" data-target="#experienciaForm"> </div>
<i class="fa fa-plus"></i>&nbsp;Agregar Experiencia</span>
</div><br> <div class="mt-3 gap-2 d-flex justify-content-between" id="cargos">
</div>
<div class="inputs p-3 py-5">
<div class=" inputs d-flex justify-content-between align-items-center experience"><span class="border px-3 p-1 add-experience" data-toggle="modal" data-target="#experienciaForm"><i class="fa fa-plus"></i>&nbsp;Agregar Experiencia</span></div><br>
</div> </div>
<div class="mt-3 gap-2 d-flex justify-content-between" id="experiencias"> <div class="mt-3 gap-2 d-flex justify-content-between" id="experiencias">
...@@ -310,14 +314,44 @@ ...@@ -310,14 +314,44 @@
<div class="mt-3 gap-2 d-flex justify-content-end"> <div class="mt-3 gap-2 d-flex justify-content-end">
<button class="px-3 btn btn-sm btn-outline-primary">Cancelar</button> <a class="px-3 btn btn-sm btn-outline-primary" href="/postulante">Cancelar</a>
<button class="px-3 btn btn-sm btn-primary" type="submit">Guardar</button> <button class="px-3 btn btn-sm btn-primary" type="submit">Guardar</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<!---------------------------------------Modal de Cargos disponibles---------------------------------------------------------------->
<div class="modal fade" id="cargoForm" tabindex="-2" role="dialog" aria-labelledby="cargoForm" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel" >CargosDisponibles</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form name="cargo-form" class="needs-validation" novalidate>
<label for="cargo-nombre" class="form-label">Cargo</label>
<div class="input-group mb-3">
<select class="form-select" name="cargo-id" aria-label="Default select example" required>
<option value="-1" selected>Open this select menu</option>
<c:forEach items="${CargosDisponibles}" var="convocatoria">
<option value="${convocatoria.getId()}">${convocatoria.getCargo().getNombre()}</option>
</c:forEach>>
</select>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="agregarFieldCargo()" data-dismiss="modal">Agregar</button>
</div>
</div>
</div>
</div>
<!-------------------------------------------------------------------------------------------------------------------------->
<!--Modal de Experiencia--> <!--Modal de Experiencia-->
<div class="modal fade" id="experienciaForm" tabindex="-1" role="dialog" aria-labelledby="experienciaForm" aria-hidden="true"> <div class="modal fade" id="experienciaForm" tabindex="-1" role="dialog" aria-labelledby="experienciaForm" aria-hidden="true">
...@@ -333,22 +367,22 @@ ...@@ -333,22 +367,22 @@
<form name="experiencia-form" class="needs-validation" novalidate> <form name="experiencia-form" class="needs-validation" novalidate>
<div class="inputs"> <div class="inputs">
<label for="institucion" class="inputs form-label">Institucion</label> <label for="institucionExperiencia" class="inputs form-label">Institucion</label>
<input type="text" class="inputs form-control " name="institucion" id="institucion" required> <input type="text" class="inputs form-control " name="institucion" id="institucionExperiencia" required>
</div> </div>
<div class="inputs"> <div class="inputs">
<label for="fechaDesde" class="form-label">Fecha Desde</label> <label for="fechaDesdeExperiencia" class="form-label">Fecha Desde</label>
<input type="date" class="form-control " name="fechaDesde" id="fechaDesde" required> <input type="date" class="form-control" name="fechaDesde" id="fechaDesdeExperiencia" required>
</div> </div>
<div class="inputs"> <div class="inputs">
<label for="fechaHasta" class="form-label">Fecha Hasta</label> <label for="fechaHastaExperiencia" class="form-label">Fecha Hasta</label>
<input type="date" class="form-control " name="fechaHasta" id="fechaHasta" > <input type="date" class="form-control" name="fechaHasta" id="fechaHastaExperiencia" >
</div> </div>
<div class="inputs"> <div class="inputs">
<label for="cargo" class="form-label">Cargo</label> <label for="cargo" class="form-label">Cargo</label>
<input type="text" class="form-control " name="cargo" id="cargo" required> <input type="text" class="form-control " name="cargo" id="cargo" required>
</div> </div>
<div class="inputs"> <div class="inputs">
...@@ -416,7 +450,7 @@ ...@@ -416,7 +450,7 @@
<input type="text" class="form-control d-none" name="tecnologia-nombre" id="tecnologia-nombre" > <input type="text" class="form-control d-none" name="tecnologia-nombre" id="tecnologia-nombre" >
<label for="nivel" class="form-label">Nivel</label> <label for="nivel" class="form-label">Nivel</label>
<input type="number" class="form-control" name="nivel" id="nivel" required> <input type="range" class="form-range" name="nivel" id="nivel" min="1" max="5" required>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
...@@ -455,8 +489,8 @@ ...@@ -455,8 +489,8 @@
<%-- <label for="tipoDeEstudio" class="form-label">Tipo De Estudio</label>--%> <%-- <label for="tipoDeEstudio" class="form-label">Tipo De Estudio</label>--%>
<%-- <input type="text" class="form-control " name="tipoDeEstudio" id="tipoDeEstudio">--%> <%-- <input type="text" class="form-control " name="tipoDeEstudio" id="tipoDeEstudio">--%>
<div class="form-group"> <div class="form-group">
<label for="institucion" class="form-label">Institucion</label> <label for="institucionEstudio" class="form-label">Institucion</label>
<input type="text" class="form-control" name="institucion" id="institucion" required> <input type="text" class="form-control" name="institucion" id="institucionEstudio" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="temaDeEstudio" class="form-label">Carrera/Bachiller/Tema de Curso</label> <label for="temaDeEstudio" class="form-label">Carrera/Bachiller/Tema de Curso</label>
...@@ -472,12 +506,12 @@ ...@@ -472,12 +506,12 @@
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="fechaDesde" class="form-label">Fecha Desde</label> <label for="fechaDesdeEstudio" class="form-label">Fecha Desde</label>
<input type="date" class="form-control " name="fechaDesde" id="fechaDesde" required> <input type="date" class="form-control " name="fechaDesde" id="fechaDesdeEstudio" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="fechaHasta" class="form-label">Fecha Hasta</label> <label for="fechaHastaEstudio" class="form-label">Fecha Hasta</label>
<input type="date" class="form-control " name="fechaHasta" id="fechaHasta" > <input type="date" class="form-control " name="fechaHasta" id="fechaHastaEstudio" >
</div> </div>
...@@ -490,6 +524,8 @@ ...@@ -490,6 +524,8 @@
</div> </div>
</div> </div>
</div> </div>
<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>
<!--Modal de referencias--> <!--Modal de referencias-->
<div class="modal fade" id="referenciaForm" tabindex="-1" role="dialog" aria-labelledby="referenciaForm" aria-hidden="true"> <div class="modal fade" id="referenciaForm" tabindex="-1" role="dialog" aria-labelledby="referenciaForm" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
...@@ -530,7 +566,6 @@ ...@@ -530,7 +566,6 @@
</div> </div>
<!-- Optional JavaScript; choose one of the two! --> <!-- Optional JavaScript; choose one of the two! -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
...@@ -538,7 +573,38 @@ ...@@ -538,7 +573,38 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script> <script>
var ciudades = ${ciudades}; var ciudades = ${ciudades};
(function(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd;
}
if (mm < 10) {
mm = '0' + mm;
}
today = yyyy + '-' + mm + '-' + dd;
let fechaDesdeEstudio = document.querySelector("#fechaDesdeEstudio");
let fechaDesdeExperiencia = document.querySelector("#fechaDesdeExperiencia");
let fechaHastaEstudio = document.querySelector("#fechaHastaEstudio");
let fechaHastaExperiencia = document.querySelector("#fechaHastaExperiencia");
fechaDesdeEstudio.setAttribute("max", today);
fechaDesdeExperiencia.setAttribute("max", today);
fechaDesdeExperiencia.addEventListener("change", ()=>{
fechaHastaExperiencia.setAttribute("min", fechaDesdeExperiencia.value)
})
fechaDesdeEstudio.addEventListener("change", ()=>{
fechaHastaEstudio.setAttribute("min", fechaDesdeEstudio.value)
})
})()
</script> </script>
<script src="./main.js"></script> <script src="./main.js"></script>
</body> </body>
......
...@@ -13,28 +13,57 @@ ...@@ -13,28 +13,57 @@
</head> </head>
<body class="container"> <body class="container">
<div id="buscador"> <div id="buscador">
<div class="dropdown" id="experiencia"> <form name="buscador">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <label for="nombre">Nombre</label>
Experiencia <input type="text" name="nombre" id="nombre" value="${param.nombre}">
</a> <button>Buscar</button>
<br>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> <label for="dispo">Disponbilidad</label>
<li><a class="dropdown-item" href="#">Junior</a></li> <select name="dispo" id="dispo">
<li><a class="dropdown-item" href="#">Semisenior</a></li> <option value="">Seleccione una opcion</option>
<li><a class="dropdown-item" href="#">Senior</a></li> <c:forEach items="${disponibilidades}" var="disponibilidad">
</ul> <option value="${disponibilidad}" ${param.dispo == disponibilidad ? "selected" : ""}>${disponibilidad.getDescripcion()}</option>
</div> </c:forEach>
<div class="dropdown" id="tecnologia"> </select>
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false"> <label for="tecId">Tecnologias</label>
Tecnologia <select name="tecId" id="tecId">
</a> <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>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink"> </form>
<c:forEach items="${tecnologias}" var="tecnologia">
<li><a class="dropdown-item" href="?tec=${tecnologia.id}">${tecnologia.nombre}</a></li>
</c:forEach>
</ul>
</div>
</div> </div>
<table class="table"> <table class="table">
<thead> <thead>
...@@ -54,21 +83,51 @@ ...@@ -54,21 +83,51 @@
<td>${postulante.nombre} ${postulante.apellido}</td> <td>${postulante.nombre} ${postulante.apellido}</td>
<td>${postulante.disponibilidad.getDescripcion()}</td> <td>${postulante.disponibilidad.getDescripcion()}</td>
<td>${postulante.nivelIngles}</td> <td>${postulante.nivelIngles}</td>
<td>0</td> <td>${postulante.experienciaMeses}</td>
<td> <td>
<c:forEach items="${postulante.tecnologias}" var="detalle_tecnologia" varStatus="staTec"> <c:forEach items="${postulante.tecnologias}" var="detalle_tecnologia" varStatus="staTec">
${detalle_tecnologia.getTecnologia().getNombre()}${not staTec.last ? "," : ""} ${detalle_tecnologia.getTecnologia().getNombre()}${not staTec.last ? "," : ""}
</c:forEach> </c:forEach>
</td> </td>
</tr> <td><a href="/postulante/${postulante.id}">Ver</a></td>
</tr>
</c:forEach> </c:forEach>
</tbody>
</tbody>
</table>
<div id="paginator">
</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> </body>
</html> </html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Registration Success</title>
<link rel="stylesheet" type="text/css" href="/webjars/bootstrap/css/bootstrap.min.css" />
</head>
<body>
<div class="container text-center">
<h3>You have signed up successfully!</h3>
<h4><a href="${pageContext.request.contextPath}/login">Click here to Login</a></h4>
</div>
</body>
</html>
\ No newline at end of file
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Registration Success</title>
<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>
</head>
<style>
@media (min-width: 1025px) {
.h-custom {
height: 100vh !important;
}
}
</style>
<body>
<section class="h-100 h-custom">
<div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-lg-8 col-xl-6">
<div class="card rounded-3">
<img src="https://cdn.pixabay.com/photo/2013/08/09/05/54/layer-170971_960_720.jpg" class="w-100" style="border-top-left-radius: .3rem; border-top-right-radius: .3rem;height: 250px;" alt="Sample photo";>
<div class="card-body p-4 p-md-5">
<h3 class="mb-4 pb-2 pb-md-0 mb-md-5 px-md-2">Informacion de Registro</h3>
<form:form action="/process_register" class="px-md-2" method="POST" modelAttribute="user">
<div class="form-outline mb-4">
<form:label path="email" class="form-label">Email</form:label>
<form:input path="email" type="email" class="form-control" required="required"></form:input>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<form:label path="firstName" class="form-label">Nombre </form:label>
<form:input path="firstName" class="form-control"></form:input>
</div>
</div>
<div class="col-md-6 mb-4">
<div class="form-outline">
<form:label path="lastName" class="form-label">Apellido </form:label>
<form:input path="lastName" class="form-control"></form:input>
</div>
</div>
</div>
<div class="mb-4">
<form:label path="password" class="form-label">Contrasena</form:label>
<form:input type="password" path="password" class="form-control" required="required"></form:input>
</div>
<div class="row mb-4 pb-2 pb-md-0 mb-md-5">
<div class="col-md-6">
<div class="form-outline">
<input type="text" id="form3Example1w" class="form-control" name="registrationCode" required/>
<label class="form-label" for="form3Example1w">Registration code</label>
</div>
</div>
</div>
<button type="submit" class="btn btn-success btn-lg mb-1">Submit</button>
</form:form>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>
<%@ 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">
<title>Hello, world!</title>
<style type="text/css" media="screen">
body {
background-color: rgba(98, 0, 255, 0)
} </style>
</head>
<body>
<form:form action="/tecnologia/${tecnologia.id == null ? '' : tecnologia.id}" method="post" modelAttribute="tecnologia">
<form:label path="nombre">name: </form:label> <form:input type="text" path="nombre"/>
<input type="submit" value="submit"/>
</form:form>
</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">
<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 class="container">
<div>
<form>
<label for="tecnologias">Nombre:</label>
<input type="text" name="nombre" id="nombre" value="${param.nombre}"/>
<input type="submit" value="Buscar">
</form>
<a href="/tecnologia">Agregar Nueva Tecnologia</a>
</div>
<div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Tecnologia</th>
</tr>
</thead>
<tbody>
<c:forEach items="${tecnologias}" var="tecnologia" varStatus="sta">
<tr>
<th scope="row">${sta.index+1}</th>
<td>${tecnologia.getNombre()}</td>
<td><a href="/tecnologia/${tecnologia.id}">Editar tecnologia</a></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</body>
</html>
\ No newline at end of file
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