Commit 5db120a6 by Joel Florentin

merge con william. validacion fecha nacimiento front

parents 139b7976 835f589a
...@@ -90,22 +90,31 @@ function agregarFieldExpierncia(event){ ...@@ -90,22 +90,31 @@ function agregarFieldExpierncia(event){
//imprimir lista actualizada //imprimir lista actualizada
const div = document.querySelector("#experiencias") const div = document.querySelector("#experiencias")
const div1 = document.createElement('div'); const div1 = document.createElement('div');
let content='<ul>'
let content='';
for (let index = 0; index < experiencias.length; index++) { for (let index = 0; index < experiencias.length; index++) {
const exp = experiencias[index]; const exp = experiencias[index];
if(exp==null) continue; if(exp==null) continue;
content += ` content += `
<li id="exp-${index}"> <div class="col border border-3" id="exp-${index}">
${exp.institucion} <h4><center>Experiencia</center></h4>
<button type="button" class="btn btn-primary" onclick="eliminarExperiencia(event)"> <span class="glyphicon glyphicon-trash"></span> Eliminar</button> <label><b>Institucion:</b> ${exp.institucion}</label><br>
</li> <label><b>Fecha Inicio:</b> ${exp.fechaDesde}</label><br>
<label><b>Fecha Fin:</b> ${exp.fechaHasta}</label><br>
<label><b>Referencia:</b> ${exp.nombreReferencia}</label><br>
<label><b>Telefono de la referencia:</b> ${exp.telefonoReferencia}</label><br>
<label><b>Cargo:</b> ${exp.cargo}</label><br>
<label><b>Motivo de salida:</b> ${exp.motivoSalida}</label><br>
<button type="button" class="btn btn-primary" onclick="eliminarExperiencia(event)"> <span class="glyphicon glyphicon-trash"></span>Eliminar</button>
</div>
` `
} }
content += "</ul>" //content += "</ul>"
div1.innerHTML = content div.innerHTML = content
div.innerHTML = ''; //div.innerHTML = '';
div.appendChild(div1); //div.appendChild(div1);
cont_experiencia++; cont_experiencia++;
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
...@@ -152,24 +161,26 @@ function agregarFieldTecnologia(){ ...@@ -152,24 +161,26 @@ function agregarFieldTecnologia(){
const div1 = document.createElement('div'); const div1 = document.createElement('div');
console.log(tecnologias[0]) console.log(tecnologias[0])
let content1='<ul>' let content1=''
for (let index = 0; index < tecnologias.length; index++) { for (let index = 0; index < tecnologias.length; index++) {
const tecn = tecnologias[index]; const tecn = tecnologias[index];
if(tecn==null) continue; if(tecn==null) continue;
content1 += ` content1 += `
<li id="tecn-${index}"> <div class="col border border-3" id="tecn-${index}">
${tecn.tecnologia.nombre} <label>${tecn.tecnologia.nombre}</label><br>
<label><progress value="${tecn.nivel}" max="5"></progress></label> <br>
<button type="button" class="btn btn-primary" onclick="eliminarTecnologia(event)">Eliminar</button> <button type="button" class="btn btn-primary" onclick="eliminarTecnologia(event)">Eliminar</button>
<br> <br>
</li> </div>
` `
} }
content1 += "</ul>" //content1 += "</ul>"
div1.innerHTML = content1 div.innerHTML = content1
div.innerHTML = ''; //div.innerHTML = '';
div.appendChild(div1); //div.appendChild(div1);
cont_tecnologia++; cont_tecnologia++;
document.querySelector("#no-valid-tecno").style.display = "none";
} }
...@@ -192,6 +203,16 @@ function serializeJSON (form) { ...@@ -192,6 +203,16 @@ function serializeJSON (form) {
// Create a new FormData object // Create a new FormData object
const formData = new FormData(form); const formData = new FormData(form);
if(formData.get('fechaNacimiento')>=new Date().toISOString().slice(0,10)){
form['fechaNacimiento'].setCustomValidity('Fecha de nacimiento debe ser menor que actual')
noValidateFlag = true;
return;
}
else{
form['fechaNacimiento'].setCustomValidity('')
}
// Create an object to hold the name/value pairs // Create an object to hold the name/value pairs
const pairs = {}; const pairs = {};
...@@ -274,8 +295,11 @@ form.addEventListener("submit",(evt)=>{ ...@@ -274,8 +295,11 @@ form.addEventListener("submit",(evt)=>{
// evt.stopPropagation() // evt.stopPropagation()
// } // }
// form.classList.add('was-validated') // form.classList.add('was-validated')
evt.preventDefault();
let formSerialized = serializeJSON(form);
let fileCV = obtenerCV();
if(!noValidateFlag){ if(!noValidateFlag){
postData('work-with-us', formatearJsonWithFile(serializeJSON(form),obtenerCV())) postData('work-with-us', formatearJsonWithFile(formSerialized,fileCV))
.then(response => { .then(response => {
if(response.status==200 || response.status==302){ if(response.status==200 || response.status==302){
location.replace(response.url); location.replace(response.url);
...@@ -283,7 +307,6 @@ form.addEventListener("submit",(evt)=>{ ...@@ -283,7 +307,6 @@ form.addEventListener("submit",(evt)=>{
console.log(response.text().then(value => console.log(value))) console.log(response.text().then(value => console.log(value)))
} }
}); });
evt.preventDefault();
} }
noValidateFlag = false noValidateFlag = false
} ); } );
...@@ -348,23 +371,29 @@ function agregarFieldEstudio(){ ...@@ -348,23 +371,29 @@ function agregarFieldEstudio(){
//imprimir lista actualizada //imprimir lista actualizada
const div = document.querySelector("#estudios") const div = document.querySelector("#estudios")
const div1 = document.createElement('div'); const div1 = document.createElement('div');
let content='<ul>' let content='';
for (let index = 0; index < estudios.length; index++) { for (let index = 0; index < estudios.length; index++) {
const est = estudios[index]; const est = estudios[index];
if(est==null) continue; if(est==null) continue;
content += ` content += `
<li id="est-${index}"> <div class="col border border-3" id="est-${index}">
${est.institucion.nombre} <h4><center>Estudio</center></h4>
<label><b>Institucion:</b> ${est.institucion.nombre}</label><br>
<label><b>Tipo de estudio:</b> ${est.tipoDeEstudio}</label><br>
<label><b>Carrera:</b> ${est.temaDeEstudio}</label><br>
<label><b>Fecha Inicio:</b> ${est.fechaDesde}</label><br>
<label><b>Fecha Fin:</b> ${est.fechaHasta}</label><br>
<label><b>Estado:</b> ${est.estado}</label><br>
<button type="button" class="btn btn-primary" onclick="eliminarEstudio(event)">Eliminar</button> <button type="button" class="btn btn-primary" onclick="eliminarEstudio(event)">Eliminar</button>
</li> </div>
` `
} }
content += "</ul>"
div1.innerHTML = content div.innerHTML = content
div.innerHTML = ''; //div.innerHTML = '';
div.appendChild(div1); //div.appendChild(div1);
cont_estudios++; cont_estudios++;
} }
...@@ -431,23 +460,24 @@ function agregarFieldCargo(){ ...@@ -431,23 +460,24 @@ function agregarFieldCargo(){
const div = document.querySelector("#cargos") const div = document.querySelector("#cargos")
const div1 = document.createElement('div'); const div1 = document.createElement('div');
let content1='<ul>' let content1=''
for (let index = 0; index < postulaciones.length; index++) { for (let index = 0; index < postulaciones.length; index++) {
const car = postulaciones[index]; const car = postulaciones[index];
if(car==null) continue; if(car==null) continue;
content1 += ` content1 += `
<li id="car-${index}"> <div class="col border border-3" id="car-${index}" style="text-transform: uppercase;">
${document.querySelector('[name=cargo-id] > option[value="'+car.id+'"]').innerHTML}<br> <label>${document.querySelector('[name=cargo-id] > option[value="'+car.id+'"]').innerHTML}</label><br>
<button type="button" class="btn btn-primary" onclick="eliminarCargoPostulante(event)">Eliminar</button> <button type="button" class="btn btn-primary" onclick="eliminarCargoPostulante(event)">Eliminar</button><br>
</li> </div>
` `
} }
content1 += "</ul>" //content1 += "</ul>"
div1.innerHTML = content1 div.innerHTML = content1
div.innerHTML = ''; //div.innerHTML = '';
div.appendChild(div1); //div.appendChild(div1);
cont_cargo++; cont_cargo++;
document.querySelector("#no-valid-cargo").style.display = "none";
} }
/*---------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------*/
...@@ -532,22 +562,25 @@ function agregarFieldReferencia(event){ ...@@ -532,22 +562,25 @@ function agregarFieldReferencia(event){
//imprimir lista actualizada //imprimir lista actualizada
const div = document.querySelector("#referencia") const div = document.querySelector("#referencia")
const div1 = document.createElement('div'); const div1 = document.createElement('div');
let content='<ul>' let content=''
for (let index = 0; index < referencias.length; index++) { for (let index = 0; index < referencias.length; index++) {
const exp = referencias[index]; const exp = referencias[index];
if(exp==null) continue; if(exp==null) continue;
content += ` content += `
<li id="exp-${index}"> <div class="col border border-3" id="exp-${index}">
${exp.nombre} <h4><center>Referencia Personal</center></h4>
<button type="button" class="btn btn-primary" onclick="eliminarReferencia(event)"> <span class="glyphicon glyphicon-trash"></span> Tras</button> <label><b>Nombre:</b> ${exp.nombre}</label><br>
</li> <label><b>Telefono:</b> ${exp.telefono}</label><br>
<label><b>Relacion:</b> ${exp.relacion}</label><br>
<button type="button" class="btn btn-primary" onclick="eliminarReferencia(event)"> <span class="glyphicon glyphicon-trash"></span>Eliminar</button>
</div>
` `
} }
content += "</ul>" //content += "</ul>"
div1.innerHTML = content div.innerHTML = content
div.innerHTML = ''; //div.innerHTML = '';
div.appendChild(div1); //div.appendChild(div1);
cont_referencias++; cont_referencias++;
} }
......
body { body {
/* background-color: #506BEE; */ background-color: #baebd8;
background-image:url(/img/fondo.png); /* background-image:url(/img/fondo2.png); */
/*background-size:cover;*/ /*background-size:cover;*/
background-repeat:repeat; background-repeat:repeat;
height:100vh;width:100vw; height:100vh;width:100vw;
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div id="carouselExampleIndicators" class="carousel carousel-dark slide" data-bs-ride="carousel"> <div id="carouselExampleIndicators1" class="carousel carousel-dark slide" data-bs-ride="carousel">
<div class="carousel-inner"> <div class="carousel-inner">
...@@ -287,11 +287,11 @@ ...@@ -287,11 +287,11 @@
</div> </div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev"> <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators1" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span> <span class="visually-hidden">Previous</span>
</button> </button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="next"> <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators1" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span> <span class="visually-hidden">Next</span>
</button> </button>
...@@ -354,7 +354,7 @@ ...@@ -354,7 +354,7 @@
</form:form> </form:form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancelar</button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -142,76 +142,40 @@ ...@@ -142,76 +142,40 @@
<c:forEach items="${estadosCiviles}" var="estadoCivil"> <c:forEach items="${estadosCiviles}" var="estadoCivil">
<option value="${estadoCivil.getDescripcion()}">${estadoCivil.getDescripcion()}</option> <option value="${estadoCivil.getDescripcion()}">${estadoCivil.getDescripcion()}</option>
</c:forEach> </c:forEach>
</select>
</div>
</select> </div>
<div class="inputs mb-3 col-md-4"> <div class="inputs mb-3 col-md-4">
<label for="formFile" class="form-label">Cargar cv</label> <label for="formFile" class="form-label">Cargar cv</label>
<input class="form-control" type="file" id="cvFile"> <input class="form-control" type="file" id="cvFile">
</div> </div>
<!-- Button Agregar Cargo al que postulas -->
<div class="inputs p-3 py-5"> <button type="button" class="btn btn-primary"><span class="add-experience" class="btn btn-primary" data-toggle="modal" data-target="#cargoForm"><i class="fa fa-plus"></i>&nbsp;Agregar Cargo al que postulas</span></button><br>
<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>
</div>
<p id="no-valid-cargo" style="display: none; color: darkred; border: solid 1px darkred; border-radius: 25px; width: 75%" class="m-3"> <p id="no-valid-cargo" style="display: none; color: darkred; border: solid 1px darkred; border-radius: 25px; width: 75%" class="m-3">
*Agrega por lo menos un cargo</p> *Agrega por lo menos un cargo
</p>
<div class="mt-3 gap-2 d-flex justify-content-between" id="cargos"> <div class="mt-3 gap-2 row row-cols-4" style="display: flex;" id="cargos"></div>
</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 class="mt-3 gap-2 d-flex justify-content-between" id="experiencias">
</div>
<!-- Button Agregar Experiencia -->
<button type="button" class="btn btn-primary"><span class="add-experience" data-toggle="modal" data-target="#experienciaForm"><i class="fa fa-plus"></i>&nbsp;Agregar Experiencia</span></button><br>
<div class="mt-3 gap-2 row row-cols-4" id="experiencias"></div>
<div class=" p-3 py-5"> <!-- Button Agregar Estudio -->
<div class=" d-flex justify-content-between align-items-center experience"> <button type="button" class="btn btn-primary"><span class="add-experience" data-toggle="modal" data-target="#estudioForm"><i class="fa fa-plus"></i>&nbsp;Agregar Estudio</span></button><br>
<span class="border px-3 p-1 add-experience" data-toggle="modal" data-target="#estudioForm"> <div class="mt-3 gap-2 row row-cols-4" id="estudios"></div>
<i class="fa fa-plus"></i>&nbsp;Agregar Estudio
</span>
</div><br>
</div>
<div class="mt-3 gap-2 d-flex justify-content-between" id="estudios">
</div>
<!-- Button Agregar Tecnologia -->
<button type="button" class="btn btn-primary"><span class="add-experience" data-toggle="modal" data-target="#tecnologiaForm"><i class="fa fa-plus"></i>&nbsp;Agregar Tecnologia</span></button><br>
<div class=" p-3 py-5">
<div class=" d-flex justify-content-between align-items-center experience">
<span class="border px-3 p-1 add-experience" data-toggle="modal" data-target="#tecnologiaForm">
<i class="fa fa-plus"></i>&nbsp;Agregar Tecnologia
</span>
</div><br>
</div>
<p id="no-valid-tecno" style="display: none; color: darkred; border: solid 1px darkred; border-radius: 25px; width: 75%" class="m-3"> <p id="no-valid-tecno" style="display: none; color: darkred; border: solid 1px darkred; border-radius: 25px; width: 75%" class="m-3">
*Agrega por lo menos una tecnologia</p> *Agrega por lo menos una tecnologia
</p>
<div class="mt-3 gap-2 row row-cols-5" style="display: flex;" id="tecnologias">
<div class="mt-3 gap-2 d-flex justify-content-between" id="tecnologias">
</div> </div>
<!-- Button Agregar Refencia personal -->
<div class=" p-3 py-5"> <button type="button" class="btn btn-primary"><span class="add-experience" data-toggle="modal" data-target="#referenciaForm"><i class="fa fa-plus"></i>&nbsp;Agregar Referencia Personal</span></button><br>
<div class=" d-flex justify-content-between align-items-center experience"> <div class="mt-3 gap-2 row row-cols-4" id="referencia"></div>
<span class="border px-3 p-1 add-experience" data-toggle="modal" data-target="#referenciaForm">
<i class="fa fa-plus"></i>&nbsp;Referencias Personales
</span>
</div><br>
</div>
<div class="mt-3 gap-2 d-flex justify-content-between" id="referencia">
</div>
...@@ -495,9 +459,13 @@ ...@@ -495,9 +459,13 @@
let fechaDesdeExperiencia = document.querySelector("#fechaDesdeExperiencia"); let fechaDesdeExperiencia = document.querySelector("#fechaDesdeExperiencia");
let fechaHastaEstudio = document.querySelector("#fechaHastaEstudio"); let fechaHastaEstudio = document.querySelector("#fechaHastaEstudio");
let fechaHastaExperiencia = document.querySelector("#fechaHastaExperiencia"); let fechaHastaExperiencia = document.querySelector("#fechaHastaExperiencia");
let fechaNacimiento = document.querySelector("#fechaNacimiento");
let fechas = [fechaDesdeEstudio,fechaDesdeExperiencia,fechaHastaEstudio,fechaHastaExperiencia,fechaNacimiento]
fechas.forEach(fch => fch.addEventListener('keydown',()=>false))//no dejar cargar manualmente fechas
fechaDesdeEstudio.setAttribute("max", today); fechaDesdeEstudio.setAttribute("max", today);
fechaDesdeExperiencia.setAttribute("max", today); fechaDesdeExperiencia.setAttribute("max", today);
fechaNacimiento.setAttribute("max", today);
fechaDesdeExperiencia.addEventListener("change", ()=>{ fechaDesdeExperiencia.addEventListener("change", ()=>{
fechaHastaExperiencia.setAttribute("min", fechaDesdeExperiencia.value) fechaHastaExperiencia.setAttribute("min", fechaDesdeExperiencia.value)
......
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