Commit 3c757138 by sistem26user

Merge branches 'canchivilca' and 'tonyid' of…

Merge branches 'canchivilca' and 'tonyid' of http://version.sacooliveros.edu.pe/jguevara/horario into canchivilca

 Conflicts:
	src/java/pe/siso/horario/MySqlDAO/MySqlDocenteDAO.java
	src/java/pe/siso/horario/Servlets/ServletDocente.java
	web/vista/registroTablaEvaluacionDocente.jsp
parents b22a6525 82e939a4
......@@ -10,5 +10,6 @@ nbdist/
.nb-gradle/
web/assets/
web/html/
.idea/
# End of https://www.gitignore.io/api/netbeans
\ No newline at end of file
......@@ -6,7 +6,6 @@
package pe.siso.horario.Beans;
public class Area {
private int codigoArea;
private String nombreArea;
......
......@@ -13,6 +13,7 @@ import java.io.Serializable;
* @author fcelestino
*/
public class Usuario implements Serializable{
private int codarea;
private int codigoUsuario;
private int codigoTipoUsuario;
private int codigoSede;
......@@ -34,6 +35,14 @@ public class Usuario implements Serializable{
this.dni = dni;
}
public int getCodarea() {
return codarea;
}
public void setCodarea(int codarea) {
this.codarea = codarea;
}
public String getNombreTipoUsuario() {
return nombreTipoUsuario;
}
......
......@@ -20,7 +20,7 @@ public interface AreaDAO {
public void Actualizar(String codigo,String nombreArea) throws Exception;
public int registrarAreas(String nombreArea) throws Exception;
public void cambiarEstado(String dato, String codigoArea) throws Exception;
public ArrayList<Area> cargarArea() throws Exception;
public ArrayList<Area> cargarArea(int cod) throws Exception;
public int cantidadAreaUso(String codigoArea) throws Exception;
public Area datosArea(String codDocente) throws Exception;
public int registrarAreaDocente(String codigoArea, String codigoDocente) throws Exception;
......
......@@ -94,15 +94,19 @@ public class MySqlAreaDAO implements AreaDAO {
}
@Override
public ArrayList<Area> cargarArea() throws Exception {
public ArrayList<Area> cargarArea(int cod) throws Exception {
ArrayList<Area> lista = new ArrayList<Area>();
Connection cnx = null;
try {
String base = "horario";
cnx = MySqlDAOFactory.obtenerConexion(base);
String codarea="";
cnx = MySqlDAOFactory.obtenerConexion(base);
Statement st = cnx.createStatement();
String query = "SELECT cod_are,nom_are,est_are from area WHERE est_are = '1'";
if(cod!=0){
codarea=" and cod_are ="+cod;
}
String query = "SELECT cod_are,nom_are,est_are from area WHERE est_are = '1'"+codarea;
ResultSet rs = st.executeQuery(query);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -52,15 +52,17 @@ public class MySqlUsuarioDAO implements UsuarioDAO {
cnx = MySqlDAOFactory.obtenerConexion(base);
Statement st = cnx.createStatement();
String query = "SELECT usuario.cod_usu,usuario.cod_tip_usu, usuario.ani_usu, usuario.usu_usu, usuario.cla_usu, usuario.cod_loc, usuario.est_usu, tipo_usuario.nom_tip_usu, sede.des_loc "
String query = "SELECT area.cod_are,usuario.cod_usu,usuario.cod_tip_usu,usuario.ani_usu, usuario.usu_usu, usuario.cla_usu, usuario.cod_loc, usuario.est_usu, tipo_usuario.nom_tip_usu, sede.des_loc "
+ "FROM usuario "
+ "LEFT JOIN sede ON sede.cod_loc = usuario.cod_loc "
+ "LEFT JOIN area ON usuario.cod_usu=area.cod_usuario "
+ "INNER JOIN tipo_usuario ON tipo_usuario.cod_tip_usu = usuario.cod_tip_usu "
+ "WHERE usuario.usu_usu='" + usuario + "' and usuario.cla_usu='" + clave + "' and usuario.est_usu='1'";
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
usuario1.setCodarea(rs.getInt("cod_are"));
usuario1.setCodigoUsuario(rs.getInt("cod_usu"));
usuario1.setCodigoTipoUsuario(rs.getInt("cod_tip_usu"));
usuario1.setCodigoSede(rs.getInt("cod_loc"));
......
......@@ -62,10 +62,10 @@ public class AreaServices {
}
public ArrayList<Area> cargarArea() {
public ArrayList<Area> cargarArea(int cod) {
ArrayList<Area> lista = null;
try {
lista = objAreaDAO.cargarArea();
lista = objAreaDAO.cargarArea(cod);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
......
......@@ -12,8 +12,10 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.JSONArray;
import pe.siso.horario.Beans.Area;
import pe.siso.horario.Beans.Usuario;
import pe.siso.horario.Services.AreaServices;
/**
......@@ -22,346 +24,350 @@ import pe.siso.horario.Services.AreaServices;
*/
public class ServletArea extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String param = request.getParameter("Accion");
if ("listarAreas".equals(param)) {
listarAreas(request, response);
} else if ("cambiarEstado".equals(param)) {
cambiarEstado(request, response);
} else if ("registrarAreas".equals(param)) {
registrarAreas(request, response);
} else if ("armarEdicion".equals(param)) {
armarEdicion(request, response);
} else if ("cargarArea".equals(param)) {
cargarArea(request, response);
} else if ("Actualizar".equals(param)) {
Actualizar(request, response);
} else if ("cantidadUsoArea".equals(param)) {
cantidadUsoArea(request, response);
} else if ("consultarAreas".equals(param)) {
consultarAreas(request, response);
} else if ("registraAreaDocente".equals(param)) {
registraAreaDocente(request, response);
} else if ("cargarAreaJson".equals(param)) {
cargarAreaJson(request, response);
}else if("cargarAreaEditar".equals(param)){
cargarAreaEditar(request,response);
}
}
private void listarAreas(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
lista = servicios.listarAreas();
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<div style=\"border: 1px solid #CCCCCC;\"> "
+ " <div class=\"table-header\"> "
+ " Listado de Áreas "
+ " </div> "
+ " <div> "
+ " <div class=\"dataTables_wrapper form-inline no-footer\" id=\"sample-table-2_wrapper\"> "
+ " <table class=\"table table-striped table-bordered table-hover dataTable no-footer\" id=\"sample-table-2\" role=\"grid\" aria-describedby=\"sample-table-2_info\" > "
+ " <thead> "
+ " <tr role=\"row\"> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\" >N°</th> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\">ÁREA</th> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\">EDICIÓN</th> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\">ESTADO</th> "
+ " </tr> "
+ " </thead> "
+ " <tbody>");
int cont = 1;
for (int i = 0; i < lista.size(); i++) {
if (cont % 2 == 0) {
pw.println("<tr class=\"alt\" >");
} else {
pw.println("<tr >");
}
String estado = "";
if (lista.get(i).getEstaArea() == 1) {
estado = "<a id='btnValidarEstado' href=\"javascript:validar_estado(0," + lista.get(i).getCodigoArea() + ");\" class=\"regular\" > "
+ "<img src=\"imagenes/icons/lightbulb.png\" /> "
+ "</a>";
} else {
estado = "<a id='btnValidarEstado2' href=\"javascript:validar_estado(1," + lista.get(i).getCodigoArea() + ");\" class=\"regular\" > "
+ "<img src=\"imagenes/icons/lightbulb_off.png\" /> "
+ "</a>";
}
pw.println(" <td align='center'>" + cont + "</td>"
+ " <td>" + lista.get(i).getNombreArea() + "</td>"
+ " <td align='center'><a id='btnEditar' href=\"javascript:armarEdicion(" + lista.get(i).getCodigoArea() + ");\" class=\"regular\" > "
+ " <img src=\"imagenes/icons/page_edit.png\" /> "
+ " </a>"
+ " </td>"
+ " <td align='center' valign='middle'>" + estado + "</td>"
+ " </tr>");
cont++;
}
if (cont == 1) {
pw.println("<tr><td colspan='4' align='center'>No hay Áreas registradas</td></tr>");
}
pw.println(" </tbody> "
+ " </table> "
+ " </div>"
+ " </div>"
+ " </div>");
}
private void cambiarEstado(HttpServletRequest request, HttpServletResponse response) throws IOException {
//String codArea=request.getParameter("codArea");
String cod_area = request.getParameter("cod_area");
AreaServices servicios = new AreaServices();
int cantidad = servicios.cantidadAreaUso(cod_area);
String dato = request.getParameter("dato");
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (cantidad == 0) {
servicios.cambiarEstado(dato, cod_area);
pw.println("0");
} else {
pw.println("1");
}
}
private void registrarAreas(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
String nombreArea = request.getParameter("Tcentro");
int dato = servicios.registrarAreas(nombreArea);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (dato == 0) {
pw.println("1");
} else if (dato > 0) {
pw.println("0");
} else {
pw.println("2");
}
}
private void armarEdicion(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
Area area = new Area();
String cod_area = request.getParameter("codarea");
area = servicios.NombreAreas(cod_area);
//String dato = request.getParameter("dato");
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<center>"
+ " <table border='0'>"
+ " <tr>"
+ " <td colspan='4' height='30'></td>"
+ " </tr>"
+ " <tr>"
+ " <td><b>Nombre de Área: </b> <font color=\"#FF0000\">*</font></td>"
+ " <td width='10'></td>"
+ " <td><input id='txt_nom' type='text' class='form-control validate[required,custom[onlyLetterSp]]' value='" + area.getNombreArea() + "' onChange='conMayusculas(this);' > </td>"
+ " <td width='20'></td>"
+ " </tr>"
+ " </table>"
+ "</center>");
}
private void cargarArea(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
String accion = request.getParameter("accion");
String nombreId = request.getParameter("nombre");
lista = servicios.cargarArea();
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<select id='"+nombreId+"' class='chosen-select form-control validate[required]' onChange='" + accion + "'>");
pw.println("<option value=''>[Seleccione]</option>");
for (int i = 0; i < lista.size(); i++) {
pw.println("<option value='" + lista.get(i).getCodigoArea() + "'>" + lista.get(i).getNombreArea() + "</option>");
}
pw.println("</select>");
}
private void cargarAreaEditar(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
String accion = request.getParameter("accion");
String nombreId = request.getParameter("nombre");
String codDocente = request.getParameter("codDocente");
lista = servicios.listarAreasDocente(codDocente);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<select id='"+nombreId+"' class='chosen-select form-control validate[required]' onChange='" + accion + "'>");
pw.println("<option value=''>[SELECCIONE]</option>");
for (int i = 0; i < lista.size(); i++) {
pw.println("<option value='" + lista.get(i).getCodigoArea() + "' selected>" + lista.get(i).getNombreArea() + "</option>");
}
pw.println("</select>");
}
private void Actualizar(HttpServletRequest request, HttpServletResponse response) {
AreaServices servicios = new AreaServices();
String nombre = request.getParameter("nombre");
String cod_area = request.getParameter("cod_area");
servicios.Actualizar(cod_area, nombre);
}
private void cantidadUsoArea(HttpServletRequest request, HttpServletResponse response) throws IOException {
String cod_area = request.getParameter("cod_area");
AreaServices servicios = new AreaServices();
int cantidad = servicios.cantidadAreaUso(cod_area);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (cantidad == 0) {
pw.println("0");
} else {
pw.println("1");
}
}
private void consultarAreas(HttpServletRequest request, HttpServletResponse response) throws IOException {
String codDoc = request.getParameter("codDoc");
AreaServices servicios = new AreaServices();
Area area = new Area();
area = servicios.datosArea(codDoc);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (area.getCodigoArea() > 0) {
pw.println("<input id='idAreasDocente' type='hidden' value='1' >");
pw.println("<input id='idAreasSelect' type='hidden' value='" + area.getCodigoArea() + "' >");
pw.println("<div class='widget-box widget-color-dark'> "
+ " <div class='widget-header'> "
+ " <h4 class='widget-title'>ÁREA</h4> "
+ " </div> "
+ " <div class='widget-body'> "
+ " <div class='widget-main no-padding'> "
+ " <form id='registroAreaFormulario' class='formular' method='post'> "
+ " <fieldset> "
+ " <div class='col-sm-6'> "
+ " <br> "
+ " <div class='alert alert-block alert-success'> "
+ " <button type='button' class='close' data-dismiss='alert'> "
+ " <i class='ace-icon fa fa-times'></i> "
+ " </button> "
+ " <strong>ÁREA!</strong> <br> "
+ " " + area.getNombreArea() + " "
+ " <br> "
+ " </div> "
+ " </div> "
+ " <div class='col-sm-6'> "
+ " <br> "
+ " <div class='alert alert-warning'> "
+ " <button type='button' class='close' data-dismiss='alert'> "
+ " <i class='ace-icon fa fa-times'></i> "
+ " </button> "
+ " <strong>NOTA!</strong> "
+ " Seleccione su area perteneciente para poder registrar su disponibilidad horaria. "
+ " <br> "
+ " </div> "
+ " </div> "
+ " </fieldset> "
+ " "
+ " </form> "
+ " </div> "
+ " </div> "
+ " </div>");
} else {
pw.println("<input id='idAreasDocente' type='hidden' value='0' >");
pw.println("<input id='idAreasSelect' type='hidden' value='0' >");
pw.println("<div class='widget-box widget-color-dark'> "
+ " <div class='widget-header'> "
+ " <h4 class='widget-title'>ÁREA</h4> "
+ " </div> "
+ " <div class='widget-body'> "
+ " <div class='widget-main no-padding'> "
+ " <form id='registroAreaFormulario' class='formular' method='post'> "
+ " <fieldset> "
+ " <div class='col-sm-6'> "
+ " <label for='form-field-select-3'>¿A qué área asiste? <span style='color: red;'>(*)</span></label> "
+ " <br> "
+ " <span > "
+ " <select id='cmbAreaSelect' class='form-control validate[required]'> "
+ " <option value=''>[Seleccione]</option> ");
pw.println("<option value='1'>MATEMÁTICA</option>");
pw.println("<option value='2'>COMUNICACIÓN</option>");
pw.println("<option value='3'>CIENCIAS SOCIALES</option>");
pw.println("<option value='4'>C.T.A.</option>");
pw.println("<option value='5'>C.E.F.</option>");
pw.println(" </select> "
+ " </span> "
+ " <br> "
+ " </div> "
+ " <div class='col-sm-6'> "
+ " <br> "
+ " <div class='alert alert-warning'> "
+ " <button type='button' class='close' data-dismiss='alert'> "
+ " <i class='ace-icon fa fa-times'></i> "
+ " </button> "
+ " <strong>NOTA!</strong> "
+ " Seleccione su area perteneciente para poder registrar su disponibilidad horaria. "
+ " <br> "
+ " </div> "
+ " </div> "
+ " </fieldset> "
+ " <div class='form-actions center'> "
+ " <button class='btn btn-sm btn-primary' type='button' onclick='validar_seleccion();'> "
+ " <i class='ace-icon fa fa-save icon-on-right bigger-110'></i> "
+ " Seleccionar "
+ " </button> "
+ " </div> "
+ " "
+ " </form> "
+ " </div> "
+ " </div> "
+ " </div>");
}
}
private void registraAreaDocente(HttpServletRequest request, HttpServletResponse response) {
String codArea = request.getParameter("cmbAreaSelect");
String codDocente = request.getParameter("codDocente");
AreaServices servicios = new AreaServices();
int dato = 0;
dato = servicios.registrarAreaDocente(codArea, codDocente);
}
private void cargarAreaJson(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
lista = servicios.cargarArea();
response.setContentType("application/json");
PrintWriter pw = response.getWriter();
JSONArray jArray = new JSONArray(lista);
pw.print(jArray);
}
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String param = request.getParameter("Accion");
if ("listarAreas".equals(param)) {
listarAreas(request, response);
} else if ("cambiarEstado".equals(param)) {
cambiarEstado(request, response);
} else if ("registrarAreas".equals(param)) {
registrarAreas(request, response);
} else if ("armarEdicion".equals(param)) {
armarEdicion(request, response);
} else if ("cargarArea".equals(param)) {
cargarArea(request, response);
} else if ("Actualizar".equals(param)) {
Actualizar(request, response);
} else if ("cantidadUsoArea".equals(param)) {
cantidadUsoArea(request, response);
} else if ("consultarAreas".equals(param)) {
consultarAreas(request, response);
} else if ("registraAreaDocente".equals(param)) {
registraAreaDocente(request, response);
} else if ("cargarAreaJson".equals(param)) {
cargarAreaJson(request, response);
} else if ("cargarAreaEditar".equals(param)) {
cargarAreaEditar(request, response);
}
}
private void listarAreas(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
lista = servicios.listarAreas();
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<div style=\"border: 1px solid #CCCCCC;\"> "
+ " <div class=\"table-header\"> "
+ " Listado de Áreas "
+ " </div> "
+ " <div> "
+ " <div class=\"dataTables_wrapper form-inline no-footer\" id=\"sample-table-2_wrapper\"> "
+ " <table class=\"table table-striped table-bordered table-hover dataTable no-footer\" id=\"sample-table-2\" role=\"grid\" aria-describedby=\"sample-table-2_info\" > "
+ " <thead> "
+ " <tr role=\"row\"> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\" >N°</th> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\">ÁREA</th> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\">EDICIÓN</th> "
+ " <th tabindex=\"0\" class=\"center\" rowspan=\"1\" colspan=\"1\">ESTADO</th> "
+ " </tr> "
+ " </thead> "
+ " <tbody>");
int cont = 1;
for (int i = 0; i < lista.size(); i++) {
if (cont % 2 == 0) {
pw.println("<tr class=\"alt\" >");
} else {
pw.println("<tr >");
}
String estado = "";
if (lista.get(i).getEstaArea() == 1) {
estado = "<a id='btnValidarEstado' href=\"javascript:validar_estado(0," + lista.get(i).getCodigoArea() + ");\" class=\"regular\" > "
+ "<img src=\"imagenes/icons/lightbulb.png\" /> "
+ "</a>";
} else {
estado = "<a id='btnValidarEstado2' href=\"javascript:validar_estado(1," + lista.get(i).getCodigoArea() + ");\" class=\"regular\" > "
+ "<img src=\"imagenes/icons/lightbulb_off.png\" /> "
+ "</a>";
}
pw.println(" <td align='center'>" + cont + "</td>"
+ " <td>" + lista.get(i).getNombreArea() + "</td>"
+ " <td align='center'><a id='btnEditar' href=\"javascript:armarEdicion(" + lista.get(i).getCodigoArea() + ");\" class=\"regular\" > "
+ " <img src=\"imagenes/icons/page_edit.png\" /> "
+ " </a>"
+ " </td>"
+ " <td align='center' valign='middle'>" + estado + "</td>"
+ " </tr>");
cont++;
}
if (cont == 1) {
pw.println("<tr><td colspan='4' align='center'>No hay Áreas registradas</td></tr>");
}
pw.println(" </tbody> "
+ " </table> "
+ " </div>"
+ " </div>"
+ " </div>");
}
private void cambiarEstado(HttpServletRequest request, HttpServletResponse response) throws IOException {
//String codArea=request.getParameter("codArea");
String cod_area = request.getParameter("cod_area");
AreaServices servicios = new AreaServices();
int cantidad = servicios.cantidadAreaUso(cod_area);
String dato = request.getParameter("dato");
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (cantidad == 0) {
servicios.cambiarEstado(dato, cod_area);
pw.println("0");
} else {
pw.println("1");
}
}
private void registrarAreas(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
String nombreArea = request.getParameter("Tcentro");
int dato = servicios.registrarAreas(nombreArea);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (dato == 0) {
pw.println("1");
} else if (dato > 0) {
pw.println("0");
} else {
pw.println("2");
}
}
private void armarEdicion(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
Area area = new Area();
String cod_area = request.getParameter("codarea");
area = servicios.NombreAreas(cod_area);
//String dato = request.getParameter("dato");
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<center>"
+ " <table border='0'>"
+ " <tr>"
+ " <td colspan='4' height='30'></td>"
+ " </tr>"
+ " <tr>"
+ " <td><b>Nombre de Área: </b> <font color=\"#FF0000\">*</font></td>"
+ " <td width='10'></td>"
+ " <td><input id='txt_nom' type='text' class='form-control validate[required,custom[onlyLetterSp]]' value='" + area.getNombreArea() + "' onChange='conMayusculas(this);' > </td>"
+ " <td width='20'></td>"
+ " </tr>"
+ " </table>"
+ "</center>");
}
private void cargarArea(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
String accion = request.getParameter("accion");
String nombreId = request.getParameter("nombre");
lista = servicios.cargarArea(0);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<select id='" + nombreId + "' class='chosen-select form-control validate[required]' onChange='" + accion + "'>");
pw.println("<option value=''>[Seleccione]</option>");
for (int i = 0; i < lista.size(); i++) {
pw.println("<option value='" + lista.get(i).getCodigoArea() + "'>" + lista.get(i).getNombreArea() + "</option>");
}
pw.println("</select>");
}
private void cargarAreaEditar(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
String accion = request.getParameter("accion");
String nombreId = request.getParameter("nombre");
String codDocente = request.getParameter("codDocente");
lista = servicios.listarAreasDocente(codDocente);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.println("<select id='" + nombreId + "' class='chosen-select form-control validate[required]' onChange='" + accion + "'>");
pw.println("<option value=''>[SELECCIONE]</option>");
for (int i = 0; i < lista.size(); i++) {
pw.println("<option value='" + lista.get(i).getCodigoArea() + "' selected>" + lista.get(i).getNombreArea() + "</option>");
}
pw.println("</select>");
}
private void Actualizar(HttpServletRequest request, HttpServletResponse response) {
AreaServices servicios = new AreaServices();
String nombre = request.getParameter("nombre");
String cod_area = request.getParameter("cod_area");
servicios.Actualizar(cod_area, nombre);
}
private void cantidadUsoArea(HttpServletRequest request, HttpServletResponse response) throws IOException {
String cod_area = request.getParameter("cod_area");
AreaServices servicios = new AreaServices();
int cantidad = servicios.cantidadAreaUso(cod_area);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (cantidad == 0) {
pw.println("0");
} else {
pw.println("1");
}
}
private void consultarAreas(HttpServletRequest request, HttpServletResponse response) throws IOException {
String codDoc = request.getParameter("codDoc");
AreaServices servicios = new AreaServices();
Area area = new Area();
area = servicios.datosArea(codDoc);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
if (area.getCodigoArea() > 0) {
pw.println("<input id='idAreasDocente' type='hidden' value='1' >");
pw.println("<input id='idAreasSelect' type='hidden' value='" + area.getCodigoArea() + "' >");
pw.println("<div class='widget-box widget-color-dark'> "
+ " <div class='widget-header'> "
+ " <h4 class='widget-title'>ÁREA</h4> "
+ " </div> "
+ " <div class='widget-body'> "
+ " <div class='widget-main no-padding'> "
+ " <form id='registroAreaFormulario' class='formular' method='post'> "
+ " <fieldset> "
+ " <div class='col-sm-6'> "
+ " <br> "
+ " <div class='alert alert-block alert-success'> "
+ " <button type='button' class='close' data-dismiss='alert'> "
+ " <i class='ace-icon fa fa-times'></i> "
+ " </button> "
+ " <strong>ÁREA!</strong> <br> "
+ " " + area.getNombreArea() + " "
+ " <br> "
+ " </div> "
+ " </div> "
+ " <div class='col-sm-6'> "
+ " <br> "
+ " <div class='alert alert-warning'> "
+ " <button type='button' class='close' data-dismiss='alert'> "
+ " <i class='ace-icon fa fa-times'></i> "
+ " </button> "
+ " <strong>NOTA!</strong> "
+ " Seleccione su area perteneciente para poder registrar su disponibilidad horaria. "
+ " <br> "
+ " </div> "
+ " </div> "
+ " </fieldset> "
+ " "
+ " </form> "
+ " </div> "
+ " </div> "
+ " </div>");
} else {
pw.println("<input id='idAreasDocente' type='hidden' value='0' >");
pw.println("<input id='idAreasSelect' type='hidden' value='0' >");
pw.println("<div class='widget-box widget-color-dark'> "
+ " <div class='widget-header'> "
+ " <h4 class='widget-title'>ÁREA</h4> "
+ " </div> "
+ " <div class='widget-body'> "
+ " <div class='widget-main no-padding'> "
+ " <form id='registroAreaFormulario' class='formular' method='post'> "
+ " <fieldset> "
+ " <div class='col-sm-6'> "
+ " <label for='form-field-select-3'>¿A qué área asiste? <span style='color: red;'>(*)</span></label> "
+ " <br> "
+ " <span > "
+ " <select id='cmbAreaSelect' class='form-control validate[required]'> "
+ " <option value=''>[Seleccione]</option> ");
pw.println("<option value='1'>MATEMÁTICA</option>");
pw.println("<option value='2'>COMUNICACIÓN</option>");
pw.println("<option value='3'>CIENCIAS SOCIALES</option>");
pw.println("<option value='4'>C.T.A.</option>");
pw.println("<option value='5'>C.E.F.</option>");
pw.println(" </select> "
+ " </span> "
+ " <br> "
+ " </div> "
+ " <div class='col-sm-6'> "
+ " <br> "
+ " <div class='alert alert-warning'> "
+ " <button type='button' class='close' data-dismiss='alert'> "
+ " <i class='ace-icon fa fa-times'></i> "
+ " </button> "
+ " <strong>NOTA!</strong> "
+ " Seleccione su area perteneciente para poder registrar su disponibilidad horaria. "
+ " <br> "
+ " </div> "
+ " </div> "
+ " </fieldset> "
+ " <div class='form-actions center'> "
+ " <button class='btn btn-sm btn-primary' type='button' onclick='validar_seleccion();'> "
+ " <i class='ace-icon fa fa-save icon-on-right bigger-110'></i> "
+ " Seleccionar "
+ " </button> "
+ " </div> "
+ " "
+ " </form> "
+ " </div> "
+ " </div> "
+ " </div>");
}
}
private void registraAreaDocente(HttpServletRequest request, HttpServletResponse response) {
String codArea = request.getParameter("cmbAreaSelect");
String codDocente = request.getParameter("codDocente");
AreaServices servicios = new AreaServices();
int dato = 0;
dato = servicios.registrarAreaDocente(codArea, codDocente);
}
private void cargarAreaJson(HttpServletRequest request, HttpServletResponse response) throws IOException {
AreaServices servicios = new AreaServices();
ArrayList<Area> lista = null;
HttpSession session_actual = request.getSession(true);
Usuario usuario = (Usuario) session_actual.getAttribute("usuario");
int codarea=usuario.getCodarea();
System.out.println("***********************************");
System.out.println(codarea);
lista = servicios.cargarArea(codarea);
response.setContentType("application/json");
PrintWriter pw = response.getWriter();
JSONArray jArray = new JSONArray(lista);
pw.print(jArray);
}
}
......@@ -282,7 +282,7 @@ public class ServletCurso extends HttpServlet {
ArrayList<Area> listaArea = null;
ArrayList<Plana> listaPlana = null;
ArrayList<Curso> listaCurso= null;
listaArea = serviciosArea.cargarArea();
listaArea = serviciosArea.cargarArea(0);
listaPlana=serviciosPlana.cargarPlana(codArea);
listaCurso=servicios.cargarFamilia();
//String dato = request.getParameter("dato");
......@@ -488,7 +488,7 @@ public class ServletCurso extends HttpServlet {
ArrayList<Area> listaArea = null;
ArrayList<Plana> listaPlana = null;
ArrayList<Curso> listaCurso= null;
listaArea = serviciosArea.cargarArea();
listaArea = serviciosArea.cargarArea(0);
listaPlana=serviciosPlana.cargarPlana(codArea);
listaCurso=servicios.cargarFamilia();
//String dato = request.getParameter("dato");
......
......@@ -304,7 +304,7 @@ public class ServletPlana extends HttpServlet {
ArrayList<Area> listaArea = null;
listaArea = serviciosArea.cargarArea();
listaArea = serviciosArea.cargarArea(0);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
......@@ -399,7 +399,7 @@ public class ServletPlana extends HttpServlet {
AreaServices serviciosArea = new AreaServices();
ArrayList<Area> listaArea = null;
int codigoArea = Integer.parseInt(request.getParameter("codigoArea"));
listaArea = serviciosArea.cargarArea();
listaArea = serviciosArea.cargarArea(0);
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
......
......@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import pe.siso.horario.Beans.Area;
import pe.siso.horario.Beans.PeriodoAcademico;
import pe.siso.horario.Beans.Usuario;
import pe.siso.horario.Beans.UsuarioDocente;
......@@ -111,7 +112,7 @@ public class ServletUsuario extends HttpServlet {
String SessionId = session_actual.getId();
//System.out.println(SessionId);
usuarioConsul.setIdentificadorSesion(SessionId);
session_actual.setAttribute("usuario", usuarioConsul);
periodo.setCodigoPeriodo(periodoAcademico);
periodo.setNombrePeriodo(nombrePeriodo);
......
......@@ -20,7 +20,7 @@
<link href="css/snackbar.css" rel="stylesheet" type="text/css"/>
<!-- inline scripts related to this page -->
<script type="text/javascript" language="javascript">
/*$(document).ready( function() {
jQuery("#registroEncuesta").validationEngine();
});*/
......@@ -40,9 +40,9 @@
<div class="navbar-container" id="navbar-container">
<%@ include file="banner.jsp" %>
</div><!-- /.navbar-container -->
<p id="lblUsuario"><%=usuario!=null?usuario.getCodigoTipoUsuario():""%></p>
<p id="lblUsuario"><%=usuario!=null?usuario.getCodigoTipoUsuario():""%></p>
</div>
<div id="snackbar">Se registro correctamente..</div>
<div id="snackbar">Se registro correctamente..</div>
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
<script type="text/javascript">
......@@ -53,7 +53,7 @@
</script>
<!-- #section:basics/sidebar -->
<div id="sidebar" class="sidebar responsive">
<div id="sidebar" class="sidebar responsive">
<script type="text/javascript">
try {
ace.settings.check('sidebar', 'fixed')
......@@ -326,24 +326,24 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
<!-- inline scripts related to this page -->
<script type="text/javascript">
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$(document).ready(function () {
jQuery("#formulario").validationEngine();
jQuery("#listado").validationEngine();
});
function conMayuscula(field) {
field.value = field.value.toUpperCase();
}
function cargando() {
$.blockUI({
message: '<div class="thecube"> <div class="cube c1"></div> <div class="cube c2"></div> <div class="cube c4"></div> <div class="cube c3"></div> </div>',
// message: '<div class="loading" id="g-spinner" style="zoom: 1;"><div class="circle c1"></div><div class="circle c2"></div><div class="circle c3"></div><div class="circle c4"></div></div>',
// message: '<div class="js-loading-indicator triple" style="width: 192px; height: 192px; top: 64px; left: 208px;"></div>',
baseZ: 9000,
overlayCSS: {
backgroundColor: '#1b2024',
......@@ -359,22 +359,22 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
}
});
}
function cerrar_cargando() {
$.unblockUI();
}
function segundaCarga() {
cargarArea();
}
function cargarArea() {
var accion = "cargarPlana();";
var nombre = "cmbArea";
$.ajax({
type: 'POST',
url: '../ServletArea?Accion=cargarArea',
data: 'accion=' + accion+'&nombre='+nombre,
data: 'accion=' + accion + '&nombre=' + nombre,
beforeSend: function () {
cargando();
}, success: function (resultado) {
......@@ -384,12 +384,12 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
}
});
}
function cargarPlana() {
var codArea = $("#cmbArea").val();
var accion = "";
var nombre = "cmbPlana";
$.ajax({
type: 'POST',
url: '../ServletPlana?Accion=cargarPlana',
......@@ -402,18 +402,18 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
}, complete: function () {
}
});
}
function validar() {
var estado = $("#formulario").validationEngine();
if (estado) {
listarRegistros();
}
}
function listarRegistros() {
let name=''
let name = ''
var nombrePlana = $("#cmbPlana option:selected").text();
var codigoPlana = $("#cmbPlana").val();
var codigoPeriodo = "<%=periodo!=null?periodo.getCodigoPeriodo():""%>";
......@@ -426,46 +426,48 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
}, success: function (resultado) {
cerrar_cargando();
$("#divListado").html(resultado);
name=$("#lblUsuario").text();
if(name === "6"){
$("#divListado #btnRegistrar").hide();
}
let periodoEnc=$("#divListado #codEnc").val();
name = $("#lblUsuario").text();
if (name === "6") {
$("#divListado #btnRegistrar").hide();
}
let periodoEnc = $("#divListado #codEnc").val();
// $("#divListado #txtPuesto").keypress(function (e) {
// if (e.which == 13 || e.keyCode == 13) {
//// alert('enter key is pressed');
// registrarPuesto(periodoEnc);
// }
// });
}, complete: function () {
}
});
}
function mostrarSnackBar() {
// Get the snackbar DIV
var x = document.getElementById("snackbar");
// Add the "show" class to DIV
x.className = "show";
// After 3 seconds, remove the show class from DIV
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 2000);
}
function mostrarSnackBar() {
// Get the snackbar DIV
var x = document.getElementById("snackbar");
// Add the "show" class to DIV
x.className = "show";
// After 3 seconds, remove the show class from DIV
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 2000);
}
// $("#search").on('click',function(){
// alert('You press enter');
// });
function conformidadRegistrarNota() {
function conformidadRegistrarNota() {
bootbox.dialog({
headerClass: "modal-bg-primary",
title: "<i class='ace-icon fa fa-check-circle white'></i> <span class='white'>Conformidad</span>",
......@@ -482,17 +484,17 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
label: "<i class='fa fa-times bigger-110'></i>&nbsp; No",
className: "btn-danger btn-sm",
callback: function () {
}
}
}
});
}
function armarDatos() {
var cantidad = $("#cantidad").val();
var datos = "";
let datos = "";
for (var i = 0; i < cantidad; i++) {
var codigoDocente = $("#codDoc_" + i + "").val();
var nombreDocente = $("#nomDoc_" + i + "").val();
......@@ -501,79 +503,90 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
var notaEncuesta = $("#notaEncuesta_" + i + "").val();
var txtPuesto = $("#txtPuesto_" + i + "").val();
var txtObservacion = $("#txtObservacion_" + i + "").val();
if (notaPlana != "" && notaExa != "" && txtPuesto !="" && txtObservacion != "") {
if (notaPlana != "" && notaExa != "" && txtPuesto != "" && txtObservacion != "") {
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
} else {
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
}
} else if (notaPlana == "" && notaExa != "" && txtPuesto !="" && txtObservacion != "") {
} else if (notaPlana == "" && notaExa != "" && txtPuesto != "" && txtObservacion != "") {
notaPlana = "vacio";
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
} else {
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
}
} else if (notaExa == "" && notaPlana != "" && txtPuesto !="" && txtObservacion != "") {
} else if (notaExa == "" && notaPlana != "" && txtPuesto != "" && txtObservacion != "") {
notaExa = "vacio";
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
} else {
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
}
}
else if(txtPuesto == "" && txtObservacion != "" && notaExa != "" && notaPlana != ""){
} else if (txtPuesto == "" && txtObservacion != "" && notaExa != "" && notaPlana != "") {
txtPuesto = "vacio";
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
} else {
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
}
}else if(txtObservacion == "" && txtPuesto != "" && notaExa != "" && notaPlana != ""){
txtObservacion = "vacio";
}else if (txtPuesto == "" && txtObservacion == "" && notaExa != "" && notaPlana != "") {
txtPuesto = "vacio";
txtObservacion = "vacio";
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
} else {
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
}
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
} else if (txtObservacion == "" && txtPuesto != "" && notaExa != "" && notaPlana != "") {
txtObservacion = "vacio";
if (datos == "") {
datos = codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
} else {
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta+"#"+txtPuesto+"#"+txtObservacion;
datos += "!" + codigoDocente + "#" + nombreDocente + "#" + notaPlana + "#" + notaExa + "#" + notaEncuesta + "#" + txtPuesto + "#" + txtObservacion;
}
}
}
registrarMerito(datos);
}
function registrarMerito(datos) {
var codigoPeriodo = "<%=periodo!=null?periodo.getCodigoPeriodo():""%>";
var codigoPlana = $("#cmbPlana").val();
var codigoEncuesta = $("#codEnc").val();
$.ajax({
type: 'POST',
url: '../ServletTablaMerito?Accion=registrarNotaTablaEvaluacion',
......@@ -582,13 +595,13 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
cargando();
}, success: function (resultado) {
cerrar_cargando();
}, complete: function () {
notificarRegistroNota();
}
});
}
function notificarRegistroNota() {
bootbox.dialog({
headerClass: "modal-bg-success",
......@@ -609,31 +622,31 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
function validaSoloNumericos(e) {
let tecla = (document.all) ? e.keyCode : e.which;
//Tecla de retroceso para borrar, siempre la permite
if (tecla == 8) {
return true;
}
patron = /[0-9]/;
tecla_final = String.fromCharCode(tecla);
return patron.test(tecla_final);
}
let tecla = (document.all) ? e.keyCode : e.which;
//Tecla de retroceso para borrar, siempre la permite
if (tecla == 8) {
return true;
}
patron = /[0-9]/;
tecla_final = String.fromCharCode(tecla);
return patron.test(tecla_final);
}
// -----------------------------------------------------------------
function doSearch() {
var tableReg = document.getElementById('datos');
var searchText = document.getElementById('searchTerm').value.toLowerCase();
var cellsOfRow = "";
var found = false;
var compareWith = "";
// Recorremos todas las filas con contenido de la tabla
for (var i = 1; i < tableReg.rows.length; i++) {
cellsOfRow = tableReg.rows[i].getElementsByTagName('td');
found = false;
// Recorremos todas las celdas
for (var j = 0; j < cellsOfRow.length && !found; j++) {
......@@ -652,27 +665,27 @@ window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/
tableReg.rows[i].style.display = 'none';
}
}
}
$('[data-rel=tooltip]').tooltip();
$('[data-rel=tooltip]').tooltip();
function conMayusculas(field) {
field.value = field.value.toUpperCase();
}
$('input').keypress(function (e) {
if (e.which == 13) {
return false;
}
});
function validarIngreso(event, id, condicion) {
$(id).mask('00.00', {reverse: true});
}
</script>
<!-- the following scripts are used in demo only for onpage help and you don't need them -->
......
......@@ -19,7 +19,6 @@ Menu menu=(Menu)session_actual.getAttribute("menu");
Sede SedeCod=(Sede)session_actual.getAttribute("sedeSessionCod");
PeriodoAcademico periodo=(PeriodoAcademico)session_actual.getAttribute("periodo");
Horario armandoHorario=(Horario)session_actual.getAttribute("armandoHorario");
Grupo CadenaGrupo=(Grupo)session_actual.getAttribute("sessionGrupoHorario");
if(usuario == null || periodo== null){
......
<%--
Document : vistaDobleDisponibilidad
Created on : 17-nov-2018, 8:48:37
Author : sistem20user
--%>
<%@page import="pe.siso.horario.Beans.Usuario"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="pe.siso.horario.Beans.PeriodoAcademico"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>VISTA DOBLE DISPONIBILIDAD</title>
<link rel="stylesheet" href="../assets/css/jquery-ui.css" />
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="css/snackbar.css" rel="stylesheet" type="text/css"/>
<link href="css/alert.css" rel="stylesheet" type="text/css"/>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<!--jquery-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--axios-->
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<%
HttpSession session_actual = request.getSession(true);
PeriodoAcademico periodo=(PeriodoAcademico)session_actual.getAttribute("periodo");
%>
<style type="text/css">
@media print {
#divBusqueda {display:none}
#lblTitulo{text-align: center;font-size: 40px;font-weight: bold}
}
td{
border : 3px solid;
text-align : center;
}
body{
background-image: url(../assets/images/fondo-trismegisto.png);
height: 500px;
max-width: 100%;
background-repeat: no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
}
body::after {
content: "";
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.9);
z-index: -1;
position: fixed;
}
.colorVerde{
background-color: #96d089;
}
.colorRojo{
background-color: #d0766f;
}
.colorAzul{
background-color: #59a1da;
}
</style>
<script type="text/javascript" language="javascript">
function alertDGC(mensaje)
{
var dgcTiempo = 500
var ventanaCS = '<div class="dgcAlert"><div class="dgcVentana"><div class="dgcCerrar"></div><div class="dgcMensaje">' + mensaje + '<br><div class="dgcAceptar">Aceptar</div></div></div></div>';
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>VISTA DOBLE DISPONIBILIDAD</title>
<link rel="stylesheet" href="../assets/css/jquery-ui.css" />
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="css/snackbar.css" rel="stylesheet" type="text/css"/>
<link href="css/alert.css" rel="stylesheet" type="text/css"/>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<!--jquery-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--axios-->
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<%
HttpSession session_actual = request.getSession(true);
PeriodoAcademico periodo = (PeriodoAcademico) session_actual.getAttribute("periodo");
%>
<style type="text/css">
@media print {
#divBusqueda {display:none}
#lblTitulo{text-align: center;font-size: 40px;font-weight: bold}
}
td{
border : 3px solid;
text-align : center;
}
body{
background-image: url(../assets/images/fondo-trismegisto.png);
height: 500px;
max-width: 100%;
background-repeat: no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
}
body::after {
content: "";
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.9);
z-index: -1;
position: fixed;
}
.colorVerde{
background-color: #96d089;
}
.colorRojo{
background-color: #d0766f;
}
.colorAzul{
background-color: #59a1da;
}
</style>
<script type="text/javascript" language="javascript">
function alertDGC(mensaje)
{
var dgcTiempo = 500
var ventanaCS = '<div class="dgcAlert"><div class="dgcVentana"><div class="dgcCerrar"></div><div class="dgcMensaje">' + mensaje + '<br><div class="dgcAceptar">Aceptar</div></div></div></div>';
// var bodyCS='<input type="text" value="prueba">';
$('body').append(ventanaCS);
$('body').append(ventanaCS);
// $('body').append(bodyCS);
var alVentana = $('.dgcVentana').height();
var alNav = $(window).height();
var supNav = $(window).scrollTop();
$('.dgcAlert').css('height', $(document).height());
$('.dgcVentana').css('top', ((alNav - alVentana) / 2 + supNav - 100) + 'px');
$('.dgcAlert').css('display', 'block');
$('.dgcAlert').animate({opacity: 1}, dgcTiempo);
$('.dgcCerrar,.dgcAceptar').click(function (e) {
$('.dgcAlert').animate({opacity: 0}, dgcTiempo);
setTimeout("$('.dgcAlert').remove()", dgcTiempo);
});
}
</script>
</head>
<body>
<script>
window.alert = function (message) {
alertDGC(message);
};
</script>
<div class="container">
<div class="row" id="divBusqueda">
<div class="col s8 offset-s2">
<div class="card">
<div class="card-content">
<span class="card-title" style="font-weight: bold">Buscar disponibilidad</span>
<div class="row">
<div class="input-field col s6">
<select id="cbArea" onchange="listarPlana(this);desactivarBuscar();desactivarPrint();">
</select>
<label>Area:</label>
</div>
<div class="input-field col s6">
<select id="cbPlana" onchange="activarBuscar();">
</select>
<label>Plana:</label>
</div>
</div>
</div>
<div class="card-action center">
<a class="waves-effect waves-light btn blue" id="btnBuscar" onclick="activarPrint();"><i class="material-icons left">search</i>BUSCAR</a>
<a class="waves-effect waves-light btn" id="btnImprimir" onclick="pintarTDRed();window.print();" style="background-color: #5478a2;"><i class="material-icons dp48 left">print</i>IMPRIMIR</a><br>
<!-- <a class="btn btn-app btn-light btn-xs align-left" onclick="window.print();" target="_blank" id="iconoImprimir">
<i class="ace-icon fa fa-print bigger-160"></i>-->
<label>Zona:</label>
<select id="cmbZonas" onchange="listarDisponibilidad();activarPrint();">
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<span class="card-title" id="lblTitulo">Lista de docentes y disponibilidad</span>
<div class="row">
<div id="divListaDisponibilidad">
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Structure -->
</div>
</div>
<!-- The actual snackbar -->
<div id="snackbar">Se bloqueo el dia correctamente..</div>
<div id="snackbar2">Desbloqueado.</div>
<script>
var alVentana = $('.dgcVentana').height();
var alNav = $(window).height();
var supNav = $(window).scrollTop();
$('.dgcAlert').css('height', $(document).height());
$('.dgcVentana').css('top', ((alNav - alVentana) / 2 + supNav - 100) + 'px');
$('.dgcAlert').css('display', 'block');
$('.dgcAlert').animate({opacity: 1}, dgcTiempo);
$('.dgcCerrar,.dgcAceptar').click(function (e) {
$('.dgcAlert').animate({opacity: 0}, dgcTiempo);
setTimeout("$('.dgcAlert').remove()", dgcTiempo);
});
}
</script>
</head>
<body>
<script>
window.alert = function (message) {
alertDGC(message);
};
</script>
<div class="container">
<div class="row" id="divBusqueda">
<div class="col s8 offset-s2">
<div class="card">
<div class="card-content">
<span class="card-title" style="font-weight: bold">Buscar disponibilidad</span>
<div class="row">
<div class="input-field col s6">
<select id="cbArea" onchange="listarPlana(this);desactivarBuscar();desactivarPrint();">
</select>
<label>Area:</label>
</div>
<div class="input-field col s6">
<select id="cbPlana" onchange="activarBuscar();">
</select>
<label>Plana:</label>
</div>
</div>
</div>
<div class="card-action center">
<a class="waves-effect waves-light btn blue" id="btnBuscar" onclick="activarPrint();"><i class="material-icons left">search</i>BUSCAR</a>
<a class="waves-effect waves-light btn" id="btnImprimir" onclick="pintarTDRed();window.print();" style="background-color: #5478a2;"><i class="material-icons dp48 left">print</i>IMPRIMIR</a><br>
<!-- <a class="btn btn-app btn-light btn-xs align-left" onclick="window.print();" target="_blank" id="iconoImprimir">
<i class="ace-icon fa fa-print bigger-160"></i>-->
<label>Zona:</label>
<select id="cmbZonas" onchange="listarDisponibilidad();
activarPrint();">
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<span class="card-title" id="lblTitulo">Lista de docentes y disponibilidad</span>
<div class="row">
<div id="divListaDisponibilidad">
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Structure -->
</div>
</div>
<!-- The actual snackbar -->
<div id="snackbar">Se bloqueo el dia correctamente..</div>
<div id="snackbar2">Desbloqueado.</div>
<script>
// $("#btnBuscar").attr('disabled','disabled');
function desactivarBuscar() {
$("#btnBuscar").attr('disabled', 'disabled');
}
function activarBuscar() {
$("#btnBuscar").attr('disabled', false);
}
function desactivarBuscar() {
$("#btnBuscar").attr('disabled', 'disabled');
}
function activarBuscar() {
$("#btnBuscar").attr('disabled', false);
}
var elems = document.querySelectorAll('select');
var instances = M.FormSelect;
document.addEventListener('DOMContentLoaded', function () {
listarArea()
listarZona()
var elems = document.querySelectorAll('select');
var instances = M.FormSelect;
document.addEventListener('DOMContentLoaded', function () {
listarArea()
listarZona()
// setTimeout(function(){ alert("HOLA MASCOTA"); }, 5000);
document.querySelector('#btnBuscar').addEventListener('click', function () {
document.querySelector('#btnBuscar').addEventListener('click', function () {
let cmbZonas = $("#cmbZonas option:selected").text();
if (cmbZonas === "[SELECCIONE]") {
listarDisponibilidad()
} else {
listarDisponibilidad()
}
let cmbZonas = $("#cmbZonas option:selected").text();
if (cmbZonas === "[SELECCIONE]") {
listarDisponibilidad()
} else {
listarDisponibilidad()
}
})
})
});
function listarArea() {
axios.get('../ServletArea?Accion=cargarAreaJson')
.then(data => {
});
function listarArea() {
axios.get('../ServletArea?Accion=cargarAreaJson')
.then(data => {
let option = '<option value="">[SELECCIONE]</option>'
data.data.forEach(v => {
option += '<option value="' + v.codigoArea + '">' + v.nombreArea + '</option>'
})
let option = '<option value="">[SELECCIONE]</option>'
data.data.forEach(v => {
option += '<option value="' + v.codigoArea + '">' + v.nombreArea + '</option>'
})
document.querySelector('#cbArea').innerHTML = option
instances.init(elems)
})
}
document.querySelector('#cbArea').innerHTML = option
instances.init(elems)
})
}
function listarZona() {
axios.get('../ServletZona?Accion=cargarZonaJson')
.then(data => {
let option = '<option value="">[SIN ZONA]</option><option value="T">TODAS LAS ZONAS</option>'
function listarZona() {
axios.get('../ServletZona?Accion=cargarZonaJson')
.then(data => {
let option = '<option value="">[SIN ZONA]</option><option value="T">TODAS LAS ZONAS</option>'
data.data.forEach(v => {
option += '<option value="' + v.codigoZona + '">' + v.nombreZona + '</option>'
})
document.querySelector('#cmbZonas').innerHTML = option
instances.init(elems)
})
data.data.forEach(v => {
option += '<option value="' + v.codigoZona + '">' + v.nombreZona + '</option>'
})
document.querySelector('#cmbZonas').innerHTML = option
instances.init(elems)
})
}
}
function listarDisponibilidad() {
function listarDisponibilidad() {
let codigoPlana = document.querySelector('#cbPlana').value
let codigoPeriodo = '<%= periodo!=null?periodo.getCodigoPeriodo():""%>'
console.log(codigoPeriodo)
let codigoZona = document.querySelector('#cmbZonas').value
let codigoPlana = document.querySelector('#cbPlana').value
let codigoPeriodo = '<%= periodo != null ? periodo.getCodigoPeriodo() : ""%>'
console.log(codigoPeriodo)
let codigoZona = document.querySelector('#cmbZonas').value
// let distritos=new ZonaDistritoServices();
if (codigoPlana && codigoPeriodo && codigoZona) {
if (codigoPlana && codigoPeriodo && codigoZona) {
let json = {
codigoPlana,
codigoPeriodo,
codigoZona
}
let json = {
codigoPlana,
codigoPeriodo,
codigoZona
}
peticionWith3Parameters(json);
} else {
peticionWith3Parameters(json);
let codigoPeriodo2 = '<%= periodo!=null?periodo.getCodigoPeriodo():""%>'
} else {
let codigoPeriodo2 = '<%= periodo != null ? periodo.getCodigoPeriodo() : ""%>'
// let codigoPlana2 = document.querySelector('#cbPlana').value
let json2 = {
codigoPlana,
codigoPeriodo2
}
let json2 = {
codigoPlana,
codigoPeriodo2
}
peticionSimple(json2);
}
}
function peticionSimple(json) {
$.ajax({
url: '../ServletHorario?Accion=listarVistaDobleDisponibilidadSinZona',
type: 'POST',
dataType: 'json',
data: {
json: JSON.stringify(json)
},
success: function (data, textStatus, jqXHR) {
let html = ''
let nTurno = []
let nDia = []
let mensaje = 'No registrado'
data.data.forEach(function (docente) {
if (typeof (docente.celular && docente.distrito) == "undefined") {
html += '<table>'
html += '<div class="divider"></div>'
html += '<div class="section">'
html += '<h6 id="nombreDocente">' + docente.nombre + '<span></span><span></span><span style="margin-left:650px;font-size:20px;color:#6C7807"><i class="small material-icons" title="Puesto" style="color:black;">grade</i><strong>No registrado</strong></span></h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
html += '<tr>'
html += '<p>Celular: No registrado</p>'
html += '<p>Distrito: No registrado</p>'
html += '<p>Direccion: No registrado</p>'
html += '<p>Correo: No registrado</p>'
html += '</tr>'
html += '<br>'
peticionSimple(json2);
}
}
function peticionSimple(json) {
if (docente.disponibilidad) {
$.ajax({
url: '../ServletHorario?Accion=listarVistaDobleDisponibilidadSinZona',
type: 'POST',
dataType: 'json',
data: {
json: JSON.stringify(json)
},
success: function (data, textStatus, jqXHR) {
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
let html = ''
let nTurno = []
let nDia = []
let mensaje = 'No registrado'
data.data.forEach(function (docente) {
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
if (typeof (docente.celular && docente.distrito) == "undefined") {
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
html += '<table>'
html += '<div class="divider"></div>'
html += '<div class="section">'
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
html += '<h6 id="nombreDocente">' + docente.nombre + '<span></span><span></span><span style="margin-left:650px;font-size:20px;color:#6C7807"><i class="small material-icons" title="Puesto" style="color:black;">grade</i><strong>No registrado</strong></span></h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
})
html += '<tr>'
html += '<p>Celular: No registrado</p>'
html += '<p>Distrito: No registrado</p>'
html += '<p>Direccion: No registrado</p>'
html += '<p>Correo: No registrado</p>'
html += '</tr>'
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
html += '<br>'
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
})
if (docente.disponibilidad) {
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
html += '<p class="col s12">'
html += '<table class="centered" id="tableDisponibilidad">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
html += '<tr>'
html += '<td id="turno">M</td>'
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
})
if (diasM.some(d => d == (i + 1))) {
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
} else if (diasMB.some(t => t == (i + 1))) {
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
} else if (diasMS.some(r => r == (i + 1))) {
})
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
} else {
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
}
}
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
html += '<p class="col s12">'
html += '<table class="centered" id="tableDisponibilidad">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
html += '</tr>'
html += '<tr>'
html += '<td id="turno">T</td>'
html += '<tr>'
html += '<td id="turno">M</td>'
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
if (diasM.some(d => d == (i + 1))) {
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
} else if (diasTB.some(t => t == (i + 1))) {
} else if (diasMB.some(t => t == (i + 1))) {
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
} else if (diasTS.some(q => q == (i + 1))) {
} else if (diasMS.some(r => r == (i + 1))) {
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
} else {
} else {
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
}
}
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
}
}
html += '</tr>'
html += '</tr>'
html += '<tr>'
html += '<td id="turno">T</td>'
html += '</tbody>'
html += '</table>'
html += '</p>'
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
} else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
html += `</div>`
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
} else {
} else if (diasTB.some(t => t == (i + 1))) {
html += '<div class="divider"></div>'
html += '<div class="section">'
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += '<h6 id="nombreDocente" style="font-weight:bold;">' + docente.nombre + '</h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
} else if (diasTS.some(q => q == (i + 1))) {
html += `<td class="blue" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += '<div class="form-control">'
html += '<div class="card grey lighten-2">'
html += '<div class="card-content black-text">'
//PRIMERA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">local_phone</i> <strong>' + docente.celular + '</strong></div>'
html += '<div class="input-field col s3"><i class="material-icons dp48">school</i><strong> Puesto Nro: ' + docente.puesto + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_weak</i> <strong>Exa. Encuesta: ' + docente.notaEncuesta + '</strong></div>'
html += '</div>'
} else {
//SEGUNDA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">room</i> <strong>' + docente.distrito + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_strong</i> <strong> Exa. Academico: ' + docente.examenNota + '</strong></div>'
html += '</div>'
//TERCERA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">email</i> <strong>' + docente.correo + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">home</i> <strong>' + docente.direccion + '</strong></div>'
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += '</div>'
}
}
html += '</div>'
html += '</div>'
html += '</tr>'
html += '</div>'
html += '</tbody>'
html += '</table>'
html += '</p>'
html += '<p></p>'
html += '<br>'
} else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
html += `</div>`
}
else {
html += '<div class="divider"></div>'
html += '<div class="section">'
html += '<h6 id="nombreDocente" style="font-weight:bold;">' + docente.nombre + '</h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
html +='<div class="form-control">'
html +='<div class="card grey lighten-2">'
html += '<div class="card-content black-text">'
//PRIMERA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">local_phone</i> <strong>' + docente.celular + '</strong></div>'
html += '<div class="input-field col s3"><i class="material-icons dp48">school</i><strong> Puesto Nro: '+docente.puesto+'</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_weak</i> <strong>Exa. Encuesta: '+docente.notaEncuesta+'</strong></div>'
html += '</div>'
if (docente.disponibilidad) {
//SEGUNDA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">room</i> <strong>' + docente.distrito + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_strong</i> <strong> Exa. Academico: '+docente.examenNota+'</strong></div>'
html += '</div>'
//TERCERA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">email</i> <strong>' + docente.correo + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">home</i> <strong>' + docente.direccion + '</strong></div>'
html += '</div>'
html += '</div>'
html += '</div>'
html += '</div>'
html += '<p></p>'
html += '<br>'
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
if (docente.disponibilidad) {
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
})
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
})
})
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
html += '<p class="col s12">'
html += '<table class="centered">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
})
html += '<tr>'
html += '<td id="turno">M</td>'
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
if (diasM.some(d => d == (i + 1))) {
html += '<p class="col s12">'
html += '<table class="centered">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
} else if (diasMB.some(t => t == (i + 1))) {
html += '<tr>'
html += '<td id="turno">M</td>'
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
} else if (diasMS.some(r => r == (i + 1))) {
if (diasM.some(d => d == (i + 1))) {
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
} else {
} else if (diasMB.some(t => t == (i + 1))) {
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
}
}
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
} else if (diasMS.some(r => r == (i + 1))) {
html += '</tr>'
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += '<tr>'
html += '<td id="turno">T</td>'
} else {
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
}
}
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
html += '</tr>'
html += '<tr>'
html += '<td id="turno">T</td>'
} else if (diasTB.some(t => t == (i + 1))) {
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
} else if (diasTS.some(q => q == (i + 1))) {
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td>'
} else {
} else if (diasTB.some(t => t == (i + 1))) {
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
} else if (diasTS.some(q => q == (i + 1))) {
}
}
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td>'
html += '</tr>'
} else {
html += '</tbody>'
html += '</table>'
html += '</p>'
} else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += `</div>`
}
})
document.querySelector('#divListaDisponibilidad').innerHTML = html
}
})
}
}
}
html += '</tr>'
html += '</tbody>'
html += '</table>'
html += '</p>'
function peticionWith3Parameters(json) {
}
else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
$.ajax({
url: '../ServletHorario?Accion=listarVistaDobleDisponibilidad',
type: 'POST',
dataType: 'json',
data: {
json: JSON.stringify(json)
},
success: function (data, textStatus, jqXHR) {
html += `</div>`
}
})
document.querySelector('#divListaDisponibilidad').innerHTML = html
}
})
}
let html = ''
let nTurno = []
let nDia = []
let mensaje = 'No registrado'
data.data.forEach(function (docente) {
if (typeof (docente.celular && docente.distrito) == "undefined") {
html += '<table>'
html += '<div class="divider"></div>'
html += '<div class="section">'
function peticionWith3Parameters(json) {
html += '<h6 id="nombreDocente">' + docente.nombre + '<span></span><span></span><span style="margin-left:650px;font-size:20px;color:#6C7807"><i class="small material-icons" title="Puesto" style="color:black;">grade</i><strong>No registrado</strong></span></h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
$.ajax({
url: '../ServletHorario?Accion=listarVistaDobleDisponibilidad',
type: 'POST',
dataType: 'json',
data: {
json: JSON.stringify(json)
},
success: function (data, textStatus, jqXHR) {
html += '<tr>'
html += '<p>Celular: No registrado</p>'
html += '<p>Distrito: No registrado</p>'
html += '<p>Direccion: No registrado</p>'
html += '<p>Correo: No registrado</p>'
html += '<p>Zona: No registrado</p>'
html += '</tr>'
html += '<br>'
let html = ''
let nTurno = []
let nDia = []
let mensaje = 'No registrado'
data.data.forEach(function (docente) {
if (typeof (docente.celular && docente.distrito) == "undefined") {
html += '<table>'
html += '<div class="divider"></div>'
html += '<div class="section">'
html += '<h6 id="nombreDocente">' + docente.nombre + '<span></span><span></span><span style="margin-left:650px;font-size:20px;color:#6C7807"><i class="small material-icons" title="Puesto" style="color:black;">grade</i><strong>No registrado</strong></span></h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
html += '<tr>'
html += '<p>Celular: No registrado</p>'
html += '<p>Distrito: No registrado</p>'
html += '<p>Direccion: No registrado</p>'
html += '<p>Correo: No registrado</p>'
html += '<p>Zona: No registrado</p>'
html += '</tr>'
if (docente.disponibilidad) {
html += '<br>'
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
if (docente.disponibilidad) {
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
})
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
})
})
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
html += '<p class="col s12">'
html += '<table class="centered" id="tableDisponibilidad">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
})
html += '<tr>'
html += '<td id="turno">M</td>'
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
if (diasM.some(d => d == (i + 1))) {
html += '<p class="col s12">'
html += '<table class="centered" id="tableDisponibilidad">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
} else if (diasMB.some(t => t == (i + 1))) {
html += '<tr>'
html += '<td id="turno">M</td>'
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
} else if (diasMS.some(r => r == (i + 1))) {
if (diasM.some(d => d == (i + 1))) {
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
} else {
} else if (diasMB.some(t => t == (i + 1))) {
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
}
}
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
} else if (diasMS.some(r => r == (i + 1))) {
html += '</tr>'
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += '<tr>'
html += '<td id="turno">T</td>'
} else {
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
}
}
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
html += '</tr>'
} else if (diasTB.some(t => t == (i + 1))) {
html += '<tr>'
html += '<td id="turno">T</td>'
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
} else if (diasTS.some(q => q == (i + 1))) {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += `<td class="colorVerde" onclick="colorChange(this);">` + aulas.join(' \n ') + `</td>`
} else {
} else if (diasTB.some(t => t == (i + 1))) {
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
} else if (diasTS.some(q => q == (i + 1))) {
}
}
html += `<td class="colorAzul" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
html += '</tr>'
html += '</tbody>'
html += '</table>'
html += '</p>'
} else {
} else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
html += `</div>`
html += `<td class="colorRojo" onclick="colorChange(this);" id="changed">` + aulas.join(' \n ') + `</td>`
} else {
}
}
html += '<div class="divider"></div>'
html += '<div class="section">'
html += '</tr>'
html += '</tbody>'
html += '</table>'
html += '</p>'
html += '<h6 id="nombreDocente" style="font-weight:bold;">' + docente.nombre + '<span></span><span></span> <span> </span>&nbsp;&nbsp; <a href="javascript:updateObservacion(this.value);" value=' + docente.observacion + '>' + docente.observacion + '</a></span></h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
html += '<div class="form-control">'
html += '<div class="card grey lighten-2">'
html += '<div class="card-content black-text">'
//PRIMERA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">local_phone</i> <strong>' + docente.celular + '</strong></div>'
html += '<div class="input-field col s3"><i class="material-icons dp48">school</i><strong> Puesto Nro: ' + docente.puesto + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_weak</i> <strong>Exa. Encuesta ' + docente.notaEncuesta + '</strong></div>'
html += '</div>'
} else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
html += `</div>`
//SEGUNDA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">room</i> <strong>' + docente.distrito + '</strong></div>'
html += '<div class="input-field col s3"><i class="material-icons dp48">room</i> <strong>' + docente.zona + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_strong</i> <strong> Exa. Academico ' + docente.examen + '</strong></div>'
html += '</div>'
//TERCERA FILA
}
else {
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">email</i> <strong>' + docente.correo + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">home</i> <strong>' + docente.direccion + '</strong></div>'
html += '<div class="divider"></div>'
html += '<div class="section">'
html += '</div>'
html += '</div>'
html += '</div>'
html += '</div>'
html += '<h6 id="nombreDocente" style="font-weight:bold;">' + docente.nombre + '<span></span><span></span> <span> </span>&nbsp;&nbsp; <a href="javascript:updateObservacion(this.value);" value=' + docente.observacion + '>' + docente.observacion + '</a></span></h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
html +='<div class="form-control">'
html +='<div class="card grey lighten-2">'
html += '<div class="card-content black-text">'
//PRIMERA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">local_phone</i> <strong>' + docente.celular + '</strong></div>'
html += '<div class="input-field col s3"><i class="material-icons dp48">school</i><strong> Puesto Nro: '+docente.puesto+'</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_weak</i> <strong>Exa. Encuesta '+docente.notaEncuesta+'</strong></div>'
html += '</div>'
//SEGUNDA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">room</i> <strong>' + docente.distrito + '</strong></div>'
html += '<div class="input-field col s3"><i class="material-icons dp48">room</i> <strong>' + docente.zona + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">hdr_strong</i> <strong> Exa. Academico '+docente.examen+'</strong></div>'
html += '</div>'
//TERCERA FILA
html += '<div class="row" style="margin-bottom:0px">'
html += '<div class="input-field col s3"><i class="material-icons dp48">email</i> <strong>' + docente.correo + '</strong></div>'
html += '<div class="input-field col s6"><i class="material-icons dp48">home</i> <strong>' + docente.direccion + '</strong></div>'
html += '</div>'
html += '</div>'
html += '</div>'
html += '</div>'
html += '<p></p>'
html += '<br>'
html += '<p></p>'
html += '<br>'
if (docente.disponibilidad) {
if (docente.disponibilidad) {
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
let disponibilidad = docente.disponibilidad.split('-') || []
let diasM = []
let diasT = []
let aulasM = []
let aulasT = []
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
if (docente.arrayAulas) {
docente.arrayAulas.forEach(v => {
if (v.turno == '1') {
aulasM.push(v)
} else if (v.turno == '2') {
aulasT.push(v)
}
})
}
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
let diasin = docente.diasin.split('-') || []
let diasMS = []
let diasTS = []
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
diasin.forEach(function (b) {
let nTurnoS = b.split('#')[0]
let nDiaS = b.split('#')[1]
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
if (nTurnoS == '1') {
diasMS.push(nDiaS)
} else if (nTurno == '2') {
diasTS.push(nDiaS)
}
})
})
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
let bloqueo = docente.bloqueo.split('-') || []
let diasMB = []
let diasTB = []
let aulasMB = []
let aulasTB = []
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
bloqueo.forEach(function (b) {
let nTurno = b.split('#')[0]
let nDia = b.split('#')[1]
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
if (nTurno == '1') {
diasMB.push(nDia)
} else if (nTurno == '2') {
diasTB.push(nDia)
}
})
})
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
disponibilidad.forEach(function (d) {
let turno = d.split('#')[0]
let dia = d.split('#')[1]
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
if (turno == '1') {
diasM.push(dia)
} else if (turno == '2') {
diasT.push(dia)
}
})
html += '<p class="col s12">'
html += '<table class="centered">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
html += '<p class="col s12">'
html += '<table class="centered">'
html += '<thead>'
html += '<tr>'
html += '<td>TURNO</td>'
html += '<td id="dia">LUNES</td>'
html += '<td id="dia">MARTES</td>'
html += '<td id="dia">MIERCOLES</td>'
html += '<td id="dia">JUEVES</td>'
html += '<td id="dia">VIERNES</td>'
html += '<td id="dia">SABADO</td>'
html += '</tr>'
html += '</thead>'
html += '<tbody>'
html += '<tr>'
html += '<td id="turno">M</td>'
html += '<tr>'
html += '<td id="turno">M</td>'
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
for (let i = 0; i < 6; i++) {
let aulas = aulasM.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasM.some(d => d == (i + 1))) {
if (diasM.some(d => d == (i + 1))) {
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
} else if (diasMB.some(t => t == (i + 1))) {
} else if (diasMB.some(t => t == (i + 1))) {
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
} else if (diasMS.some(r => r == (i + 1))) {
} else if (diasMS.some(r => r == (i + 1))) {
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
} else {
} else {
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
}
}
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
}
}
html += '</tr>'
html += '</tr>'
html += '<tr>'
html += '<td id="turno">T</td>'
html += '<tr>'
html += '<td id="turno">T</td>'
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
for (let i = 0; i < 6; i++) {
let aulas = aulasT.map(a => {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
if (a.dia == i + 1) {
return a.sede + ' - ' + a.aulas
}
})
if (diasT.some(d => d == (i + 1))) {
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
html += `<td class="colorVerde" onclick="colorChange(this);"> ` + aulas.join(' \n ') + `</td> `
} else if (diasTB.some(t => t == (i + 1))) {
} else if (diasTB.some(t => t == (i + 1))) {
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
} else if (diasTS.some(q => q == (i + 1))) {
} else if (diasTS.some(q => q == (i + 1))) {
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td>'
html += '<td class="colorAzul" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td>'
} else {
} else {
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
html += '<td class="colorRojo" onclick="colorChange(this);" id="changed"> ' + aulas.join(' \n ') + '</td> '
}
}
}
}
html += '</tr>'
html += '</tr>'
html += '</tbody>'
html += '</table>'
html += '</p>'
html += '</tbody>'
html += '</table>'
html += '</p>'
} else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
} else {
html += '<p>EL DOCENTE NO TIENE DISPONIBILIDAD REGISTRADA</p>'
}
html += `
</div>
`
html += `
</div>
`
}
}
})
document.querySelector('#divListaDisponibilidad').innerHTML = html
}
})
})
document.querySelector('#divListaDisponibilidad').innerHTML = html
}
})
}
}
function btnDesactivarHorario(codDocente) {
function btnDesactivarHorario(codDocente) {
let question = confirm("¿Esta seguro de eliminar su horario ?");
if (question) {
console.log(codDocente)
var periodo = "<%=periodo!=null?periodo.getCodigoPeriodo():""%>";
let question = confirm("¿Esta seguro de eliminar su horario ?");
if (question) {
console.log(codDocente)
var periodo = "<%=periodo != null ? periodo.getCodigoPeriodo() : ""%>";
desactivarHorario(codDocente, periodo)
desactivarHorario(codDocente, periodo)
} else {
console.log("cancel")
}
} else {
console.log("cancel")
}
}
}
function desactivarHorario() {
function desactivarHorario() {
}
}
function colorChange(obj){
function colorChange(obj) {
let periodo = '<%= periodo!=null?periodo.getCodigoPeriodo():""%>'
let periodo = '<%= periodo != null ? periodo.getCodigoPeriodo() : ""%>'
let codigoDoc = $(obj).parents('div.section').find('#codDocente').text();
let nombreDoc = $(obj).parents('div.section').find('#nombreDocente').text();
let codigoDoc = $(obj).parents('div.section').find('#codDocente').text();
let nombreDoc = $(obj).parents('div.section').find('#nombreDocente').text();
let turno = $(obj).parents('tr').find('#turno').text();
let turno = $(obj).parents('tr').find('#turno').text();
let numeroTurno = 0;
if (turno === "T") {
numeroTurno = 2
} else if (turno === "M") {
numeroTurno = 1
}
let numeroTurno = 0;
if (turno === "T") {
numeroTurno = 2
} else if (turno === "M") {
numeroTurno = 1
}
let dia = $(obj).parent().children().index(obj);
let dia = $(obj).parent().children().index(obj);
if ($(obj).hasClass('colorAzul')) {
if ($(obj).hasClass('colorAzul')) {
let question = confirm("¿Esta seguro de querer desbloquear el dia " + convertirDia(dia) + " ?");
if (question) {
let question = confirm("¿Esta seguro de querer desbloquear el dia " + convertirDia(dia) + " ?");
if (question) {
$.ajax({
url: '../ServletHorario?Accion=rollbackDisponibilidad',
type: 'POST',
data: {
codDocente: codigoDoc,
diaBloquear: dia,
periodo: periodo,
turno: numeroTurno
$.ajax({
url: '../ServletHorario?Accion=rollbackDisponibilidad',
type: 'POST',
data: {
codDocente: codigoDoc,
diaBloquear: dia,
periodo: periodo,
turno: numeroTurno
},
success: function (data, textStatus, jqXHR) {
},
success: function (data, textStatus, jqXHR) {
if (data.trim() == 2) {
if (data.trim() == 2) {
if ($(obj).hasClass('colorAzul')) {
$(obj).removeClass('colorAzul');
$(obj).addClass('colorRojo');
mostrarSnackBarDesbloqueo();
}
if ($(obj).hasClass('colorAzul')) {
$(obj).removeClass('colorAzul');
$(obj).addClass('colorRojo');
mostrarSnackBarDesbloqueo();
}
} else if (data.trim() == 3) {
if ($(obj).hasClass('colorAzul')) {
} else if (data.trim() == 3) {
if ($(obj).hasClass('colorAzul')) {
$(obj).removeClass('colorAzul');
$(obj).removeClass('colorAzul');
$(obj).addClass('colorVerde');
mostrarSnackBarDesbloqueo();
}
$(obj).addClass('colorVerde');
mostrarSnackBarDesbloqueo();
}
}
}
}
})
}
}
})
}
} else {
} else {
let question = confirm("¿Esta seguro de querer bloquear el dia " + convertirDia(dia) + " ?");
let question = confirm("¿Esta seguro de querer bloquear el dia " + convertirDia(dia) + " ?");
if (question) {
if (question) {
//aqui realizar peticion AJAX
$.ajax({
url: '../ServletHorario?Accion=updateDisponibilidad',
type: 'POST',
data: {
codDocente: codigoDoc,
diaBloquear: dia,
periodo: periodo,
turno: numeroTurno
//aqui realizar peticion AJAX
$.ajax({
url: '../ServletHorario?Accion=updateDisponibilidad',
type: 'POST',
data: {
codDocente: codigoDoc,
diaBloquear: dia,
periodo: periodo,
turno: numeroTurno
},
success: function (data, textStatus, jqXHR) {
},
success: function (data, textStatus, jqXHR) {
if (data.trim() == 1) {
if (data.trim() == 1) {
if ($(obj).hasClass('colorVerde')) {
if ($(obj).hasClass('colorVerde')) {
$(obj).removeClass('colorVerde');
$(obj).addClass('colorAzul');
mostrarSnackBar();
} else {
$(obj).removeClass('colorRojo');
$(obj).addClass('colorAzul');
mostrarSnackBar();
}
$(obj).removeClass('colorVerde');
$(obj).addClass('colorAzul');
mostrarSnackBar();
} else {
$(obj).removeClass('colorRojo');
$(obj).addClass('colorAzul');
mostrarSnackBar();
}
} else {
console.log("error");
}
} else {
console.log("error");
}
}
})
}
})
} else {
window.exit();
}
}
} else {
window.exit();
}
}
// $(obj).parents('tr').find('#changed').removeClass('red');
// $(obj).parents('tr').find('#changed').addClass('blue');
}
function convertirDia(dia) {
let diaLetras = "";
switch (dia) {
case 1:
diaLetras = "Lunes";
break;
case 2:
diaLetras = "Martes";
break;
case 3:
diaLetras = "Miercoles";
break;
case 4:
diaLetras = "Jueves";
break;
case 5:
diaLetras = "Viernes";
break;
case 6:
diaLetras = "Sabado";
break;
default :
break;
}
return diaLetras;
}
function mostrarSnackBar() {
// Get the snackbar DIV
var x = document.getElementById("snackbar");
// Add the "show" class to DIV
x.className = "show";
// After 3 seconds, remove the show class from DIV
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
}
function mostrarSnackBarDesbloqueo() {
// Get the snackbar DIV
var x = document.getElementById("snackbar2");
// Add the "show" class to DIV
x.className = "show";
// After 3 seconds, remove the show class from DIV
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
}
function listarPlana(select) {
let codigoArea = select.value
axios.get('../ServletPlana?Accion=cargarPlanaJson&codigoArea=' + codigoArea)
.then(data => {
let option = '<option value="">[SELECCIONE]</option>'
data.data.forEach(v => {
option += '<option value="' + v.cod_pla + '">' + v.nom_pla + '</option>'
})
document.querySelector('#cbPlana').innerHTML = option
instances.init(elems)
$("#btnBuscar").attr('enabled', 'enabled');
})
}
function pintarTDRed() {
//alert("holii");
$(".red").text("X");
}
function desactivarPrint() {
$("#btnImprimir").attr('disabled', 'disabled');
}
function activarPrint() {
$("#btnImprimir").attr('disabled', false);
}
function updateObservacion(obs) {
let textObs = prompt("Ingresar Observación");
if (textObs != null) {
$.ajax({
type: 'POST',
url: '../ServletHorario?accion=updateObservacion',
data: {
observacion: textObs
}, success: function (data, textStatus, jqXHR) {
alert("Actualizado exitosamente !")
}
})
}
}
</script>
<script src="js/pages/webSocketHorario.js" type="text/javascript"></script>
}
function convertirDia(dia) {
let diaLetras = "";
switch (dia) {
case 1:
diaLetras = "Lunes";
break;
case 2:
diaLetras = "Martes";
break;
case 3:
diaLetras = "Miercoles";
break;
case 4:
diaLetras = "Jueves";
break;
case 5:
diaLetras = "Viernes";
break;
case 6:
diaLetras = "Sabado";
break;
default :
break;
}
return diaLetras;
}
function mostrarSnackBar() {
// Get the snackbar DIV
var x = document.getElementById("snackbar");
// Add the "show" class to DIV
x.className = "show";
// After 3 seconds, remove the show class from DIV
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
}
function mostrarSnackBarDesbloqueo() {
// Get the snackbar DIV
var x = document.getElementById("snackbar2");
// Add the "show" class to DIV
x.className = "show";
// After 3 seconds, remove the show class from DIV
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
}
function listarPlana(select) {
let codigoArea = select.value
axios.get('../ServletPlana?Accion=cargarPlanaJson&codigoArea=' + codigoArea)
.then(data => {
let option = '<option value="">[SELECCIONE]</option>'
data.data.forEach(v => {
option += '<option value="' + v.cod_pla + '">' + v.nom_pla + '</option>'
})
document.querySelector('#cbPlana').innerHTML = option
instances.init(elems)
$("#btnBuscar").attr('enabled', 'enabled');
})
}
function pintarTDRed() {
//alert("holii");
$(".red").text("X");
}
function desactivarPrint() {
$("#btnImprimir").attr('disabled', 'disabled');
}
function activarPrint() {
$("#btnImprimir").attr('disabled', false);
}
function updateObservacion(obs) {
let textObs = prompt("Ingresar Observación");
if (textObs != null) {
$.ajax({
type: 'POST',
url: '../ServletHorario?accion=updateObservacion',
data: {
observacion: textObs
}, success: function (data, textStatus, jqXHR) {
alert("Actualizado exitosamente !")
}
})
}
}
</script>
<script src="js/pages/webSocketHorario.js" type="text/javascript"></script>
......
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