diff --git a/.gitignore b/.gitignore index b3a52f7..2936e6b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ target/ *.iws *.iml *.ipr - +/encodings.xml ### Eclipse ### .apt_generated .classpath diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index aa00ffa..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java b/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java index 75e1d60..1f70deb 100644 --- a/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java +++ b/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java @@ -3,6 +3,7 @@ package com.roshka.proyectofinal.Postulante; import com.roshka.proyectofinal.DataBase; import com.roshka.proyectofinal.entity.Postulante; import com.roshka.proyectofinal.entity.Bootcamp; +import com.roshka.proyectofinal.entity.PostulanteLenguaje; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; @@ -15,7 +16,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; - @WebServlet("/SaveServlet") public class SaveServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) @@ -24,14 +24,12 @@ public class SaveServlet extends HttpServlet { response.setContentType("text/html"); PrintWriter out=response.getWriter(); boolean rechazarDatos = false; - int bootcampActual = 3; + int bootcampActual = 2; try { Connection con = DataBase.getConnection(); - // Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT correo,bootcamp_id FROM postulante WHERE postulante.bootcamp_id =" + bootcampActual); - // String nombre=request.getParameter("nombre"); String apellido=request.getParameter("apellido"); int cedula=Integer.parseInt(request.getParameter("cedula")); @@ -44,6 +42,17 @@ public class SaveServlet extends HttpServlet { rechazarDatos = true; } } + rs = stmt.executeQuery("SELECT * FROM lenguaje"); + int contador = 0; + while (rs.next()){ + String nombreLenguaje = rs.getString("nombre_lenguaje"); + if (request.getParameter(nombreLenguaje) != null){ + contador++; + } + } + if (contador == 0){ + rechazarDatos = true; + } String telefono=request.getParameter("telefono"); String direccion=request.getParameter("direccion"); boolean experienciaProgramando = false; @@ -53,9 +62,6 @@ public class SaveServlet extends HttpServlet { if (request.getParameter("experiencia_laboral") != null){ experienciaLaboral = true; } - if (request.getParameter("experiencia_programando") != null) { - experienciaProgramando = true; - } if (request.getParameter("notebook") != null){ notebook = true; } @@ -64,6 +70,9 @@ public class SaveServlet extends HttpServlet { } Bootcamp bootcamp = new Bootcamp(); Postulante postulante=new Postulante(); + PostulanteLenguaje cargarLenguaje = new PostulanteLenguaje(); + int status = 0; + int statusLenguaje = 0; //SI LOS DATOS SON CORRECTOS NO SE RECHAZAN ENTONCES CARGA A LA BASE if (!rechazarDatos){ postulante.setNombre(nombre); @@ -77,15 +86,36 @@ public class SaveServlet extends HttpServlet { postulante.setNotebook(notebook); postulante.setBootcampId(bootcampActual); postulante.setAceptado(false); + status=PostulanteDao.save(postulante); + + rs = stmt.executeQuery("SELECT id FROM postulante WHERE postulante.nro_cedula="+cedula+" AND postulante.bootcamp_id="+bootcampActual+" ORDER BY id DESC LIMIT 1"); + int idUltimoPostulante=0; + while (rs.next()) { + idUltimoPostulante = rs.getInt("id"); + } + rs = stmt.executeQuery("SELECT * FROM lenguaje"); + while (rs.next()){ + int idLenguaje = rs.getInt("id"); + String nombreLenguaje = rs.getString("nombre_lenguaje"); + if (request.getParameter(nombreLenguaje) != null){ + cargarLenguaje.setIdLenguaje(idLenguaje); + cargarLenguaje.setIdPostulante(idUltimoPostulante); + statusLenguaje = PostulanteLenguajeDao.save(cargarLenguaje); + } + } } - int status=PostulanteDao.save(postulante); - if(status>0){ + if(status >0 && statusLenguaje > 0){ out.print("

Record saved successfully!

"); request.getRequestDispatcher("index.html").include(request, response); }else{ if (rechazarDatos){ - out.println("El correo ingresado ya esta registrado para el bootcamp actual"); - }else { + if (contador == 0){ + out.println("Debe seleccionar al menos una opcion de lenguaje que conoce para postularse"); + out.println("Volver al cuestionario"); + }else { + out.println("El correo ingresado ya esta registrado para el bootcamp actual"); + } + }else{ out.println("Sorry! unable to save record"); } } diff --git a/src/main/webapp/Javascript.js b/src/main/webapp/Javascript.js index e69de29..b125cd2 100644 --- a/src/main/webapp/Javascript.js +++ b/src/main/webapp/Javascript.js @@ -0,0 +1,30 @@ +(function() { + const form = document.querySelector('#sectionForm'); + const checkboxes = form.querySelectorAll('input[type=checkbox]'); + const checkboxLength = checkboxes.length; + const firstCheckbox = checkboxLength > 0 ? checkboxes[0] : null; + + function init() { + if (firstCheckbox) { + for (let i = 0; i < checkboxLength; i++) { + checkboxes[i].addEventListener('change', checkValidity); + } + + checkValidity(); + } + } + + function isChecked() { + for (let i = 0; i < checkboxLength; i++) { + if (checkboxes[i].checked) return true; + } + return false; + } + + function checkValidity() { + const errorMessage = !isChecked() ? 'Debe de selecionar al menos un lenguaje' : ''; + firstCheckbox.setCustomValidity(errorMessage); + } + + init(); +})(); \ No newline at end of file diff --git a/src/main/webapp/bootcamp.html b/src/main/webapp/bootcamp.html index c05df6a..0d08989 100644 --- a/src/main/webapp/bootcamp.html +++ b/src/main/webapp/bootcamp.html @@ -1,177 +1,545 @@ + - - + + Bootcamp - - - - - - - - + + + + + + + + - + -
-

¿QUE ES UN BOOTCAMP?

-
-
ES UN CAMPO DE ENTRENAMIENTO INTENSIVO Y GRATUITO PARA PRINCIPIANTES QUE YA PROGRAMAN Y QUIEREN SER PARTE DE LA EMPRESA
-
-

¿CUANTOS MESES DURA EL ENTRENAMIENTO Y CUAL ES SU HORARIO?

-
-
AL SER INTENSIVO Y TENIENDO EN CUENTA QUE LOS ASPIRANTES DEBEN FINALIZARLO CON UN CONOCIMIENTO APTO PARA REALIZAR UN PROYECTO DEL ÁREA, SE DA COMO LAPSO DE TIEMPO UN MES CON UN HORARIO DE 8:00 A 18:00 HS
+
+

¿QUE ES UN BOOTCAMP?

+
+
ES UN CAMPO DE ENTRENAMIENTO INTENSIVO Y GRATUITO PARA PRINCIPIANTES QUE YA PROGRAMAN Y QUIEREN SER PARTE DE LA EMPRESA
+
+

¿CUANTOS MESES DURA EL ENTRENAMIENTO Y CUAL ES SU HORARIO?

+
+
AL SER INTENSIVO Y TENIENDO EN CUENTA QUE LOS ASPIRANTES DEBEN FINALIZARLO CON UN CONOCIMIENTO APTO PARA REALIZAR UN PROYECTO DEL ÁREA, SE DA COMO LAPSO DE TIEMPO UN MES CON UN HORARIO DE 8:00 A 18:00 HS
-
-
- + + + + + -
-

REQUISITOS

-
-
- -
-
-

1. DISPOSICION DE TIEMPO

-
-
-
- -
-
-

2. DISPONER DE UNA NOTEBOOK

-
-
-
- -
-
-

3. APROBAR EXAMENES

-
-
-
- -
-
-

4. FIRMAR CARTA DE COMPROMISO

-
-
- - - - - +
+

REQUISITOS

+
+
+ +
+
+

1. DISPOSICION DE TIEMPO

+
+
+
+ +
+
+

2. DISPONER DE UNA NOTEBOOK

+
+
+
+ +
+
+

3. APROBAR EXAMENES

+
+
+
+ +
+
+

4. FIRMAR CARTA DE COMPROMISO

+
+
+ + + + + + -
-

EDICIONES DE BOOTCAMP

-
- +
+

EDICIONES DE BOOTCAMP

+ +
+ + -
+
-
-
- -
-

BOOTCAMP JAVA

-

Inicio: 18/04/2023

-

Fin: 18/05/2023

-
- +
+
+  +
+

BOOTCAMP JAVA

+

Inicio: 18/04/2023

+

Fin: 18/05/2023

+ +
-
-
-Learning Web Design: A Beginner's Guide to HTML, CSS, JavaScript, and Web Graphics +
+
+Learning Web Design: A Beginner 's Guide to HTML, CSS, JavaScript, and Web Graphics

BOOTCAMP ANDROID

Inicio: 18/06/2023

Fin: 18/07/2023

-
+
@@ -184,7 +552,7 @@ lite-youtube{background-color:white;position:relative;display:block;contain:cont

BOOTCAMP iOS

Inicio: 18/08/2023

Fin: 18/09/2023

-
+
@@ -199,6 +567,4 @@ lite-youtube{background-color:white;position:relative;display:block;contain:cont - - - + \ No newline at end of file diff --git a/src/main/webapp/formulario.jsp b/src/main/webapp/formulario.jsp index 9d8a3cf..447e7ed 100644 --- a/src/main/webapp/formulario.jsp +++ b/src/main/webapp/formulario.jsp @@ -6,6 +6,7 @@ pageEncoding="UTF-8"%> + JSP Page @@ -15,7 +16,7 @@ pageEncoding="UTF-8"%>

Si sigues interesado y cumples con los requisitos, completa el siguiente formulario:

-
+
@@ -41,38 +42,33 @@ pageEncoding="UTF-8"%>

Lenguajes de programacion que conoces:

<%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator" %> - <% LenguajeDao lenDao = new LenguajeDao(); List listLenguaje = lenDao.listar(); Iterator iter = listLenguaje.iterator(); Lenguaje len = null; - - %> -
    +
      <% while(iter.hasNext()){ len = iter.next(); - %>
    • - id= + + id= <%=len.getNombre_lenguaje() %> name= - <%=len.getNombre_lenguaje() %> type="checkbox">
      + <%=len.getNombre_lenguaje() %> type="checkbox" >
    • - <% } %> -

    -
    +
    - - + +
diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index a5665bd..abe047c 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -24,7 +24,7 @@