busqueda por zonas

parent 1592fc22
......@@ -2550,66 +2550,65 @@ public class MySqlHorarioDAO implements HorarioDAO {
try {
cn = MySqlDAOFactory.obtenerConexion("horario");
String sql = ""
+ "SELECT "
+ "pr.codprofesor, "
+ "CONCAT(pr.apellido, ', ', pr.nombre) nombreDoc, "
+ "IFNULL(dat.cel_dat_per,'No registrado') as cel_dat_per, "
+ "IFNULL(dat.nom_dir,'No registrado') as nom_dir, "
+ "IFNULL(dat.cor_dat_per,'No registrado') as cor_dat_per, "
+ "IFNULL(u.nom_dis_ubi,'No registrado')as nom_dis_ubi,"
+ " dd.diaDis, "
+ " te.pro_pla, "
+ " te.exa, "
+ " te.not_enc, "
+ " te.prom,dd.bloqueo,dd.diasSin,IF(te.puesto = \"\",'No registrado',IFNULL(te.puesto,'No Registrado')) as puesto "
+ "FROM "
+ " plana_docente pd "
+ "INNER JOIN sacoolive3.profesor pr ON pr.codprofesor = pd.cod_doc "
+ "LEFT JOIN ( "
+ " SELECT "
+ " codDoc, "
+ " diaDis,bloqueo,diasSin "
+ " FROM "
+ " disponibilidad_docente "
+ " WHERE "
+ " estDis = 1 "
+ " AND cod_per = ? "
+ ") dd ON dd.codDoc = pd.cod_doc "
+ "LEFT JOIN datos_docente dat ON dat.cod_doc = pr.codprofesor " // aqui no hay relacion
+ "LEFT JOIN ubigeo u ON u.cod_dep_ubi = dat.cod_dep "
+ "AND u.cod_pro_ubi = dat.cod_prov "
+ "AND u.cod_dis_ubi = dat.cod_dis "
+ "LEFT JOIN ( "
+ "SELECT "
+ "te.cod_doc , "
+ "te.pro_pla, "
+ " te.exa, "
+ " te.not_enc, "
+ " te.prom,te.puesto "
+ "FROM tabla_evaluacion te "
+ "INNER JOIN encuesta_docente.encuesta enc "
+ "ON enc.cod_enc = te.cod_enc "
+ "where enc.cod_per = ? and te.cod_pla = ? "
+ " ) te ON te.cod_doc = pr.codprofesor "
+ "WHERE "
+ " pr.estadoprofe = 'Y' "
+ "AND pd.cod_pla = ? AND pd.cod_per=? "
+ "GROUP BY "
+ " pr.codprofesor, "
+ " CONCAT(pr.apellido, ', ', pr.nombre), "
+ " dd.diaDis, "
+ " dat.cel_dat_per, "
+ " dat.nom_dir, "
+ " dat.cor_dat_per, "
+ " u.nom_dis_ubi, "
+ " te.pro_pla, "
+ " te.exa, "
+ " te.not_enc, "
+ " te.prom "
+ "ORDER BY "
+ " nombreDoc ASC ";
String sql = "SELECT \n" +
" pr.codprofesor, \n" +
" CONCAT(pr.apellido, ', ', pr.nombre) nombreDoc, \n" +
" IFNULL(dat.cel_dat_per,'No registrado') as cel_dat_per, \n" +
" IFNULL(dat.nom_dir,'No registrado') as nom_dir, \n" +
" IFNULL(dat.cor_dat_per,'No registrado') as cor_dat_per, \n" +
" IFNULL(u.nom_dis_ubi,'No registrado')as nom_dis_ubi, \n" +
" \n" +
" dd.diaDis, \n" +
" te.pro_pla, \n" +
" te.exa, \n" +
" te.not_enc, \n" +
" te.prom,dd.bloqueo,dd.diasSin,IF(te.puesto = \"\" ,'No registrado',IFNULL(te.puesto,'No Registrado')) as puesto,zona.nom_zon \n" +
" FROM \n" +
" plana_docente pd \n" +
" INNER JOIN sacoolive3.profesor pr ON pr.codprofesor = pd.cod_doc \n" +
" LEFT JOIN ( \n" +
" SELECT \n" +
" codDoc, \n" +
" diaDis,bloqueo,diasSin \n" +
" FROM \n" +
" disponibilidad_docente \n" +
" WHERE \n" +
" estDis = 1 \n" +
" AND cod_per = ? \n" +
" ) dd ON dd.codDoc = pd.cod_doc \n" +
" LEFT JOIN datos_docente dat ON dat.cod_doc = pr.codprofesor \n" +
" LEFT JOIN ubigeo u ON u.cod_dep_ubi = dat.cod_dep \n" +
" AND u.cod_pro_ubi = dat.cod_prov \n" +
" AND u.cod_dis_ubi = dat.cod_dis LEFT JOIN zona_docente ON dat.cod_doc=zona_docente.cod_doc AND zona_docente.est_zon_doc = '1' LEFT JOIN zona ON zona_docente.cod_zon = zona.cod_zon\n" +
" LEFT JOIN ( \n" +
" SELECT \n" +
" te.cod_doc , \n" +
" te.pro_pla, \n" +
" te.exa, \n" +
" te.not_enc, \n" +
" te.prom,te.puesto \n" +
" FROM tabla_evaluacion te \n" +
" INNER JOIN encuesta_docente.encuesta enc \n" +
" ON enc.cod_enc = te.cod_enc \n" +
" where enc.cod_per = ? and te.cod_pla = ? \n" +
" ) te ON te.cod_doc = pr.codprofesor \n" +
" WHERE \n" +
" pr.estadoprofe = 'Y' \n" +
" AND pd.cod_pla = ? AND pd.cod_per=? and zona.cod_zon=?\n" +
" GROUP BY \n" +
" pr.codprofesor, \n" +
" CONCAT(pr.apellido, ', ', pr.nombre), \n" +
" dd.diaDis, \n" +
" dat.cel_dat_per, \n" +
" dat.nom_dir, \n" +
" dat.cor_dat_per, \n" +
" u.nom_dis_ubi, \n" +
" te.pro_pla, \n" +
" te.exa, \n" +
" te.not_enc, \n" +
" te.prom \n" +
" ORDER BY \n" +
" nombreDoc ASC";
pst = cn.prepareStatement(sql);
System.out.println(sql);
......@@ -2618,6 +2617,7 @@ public class MySqlHorarioDAO implements HorarioDAO {
pst.setString(3, json.getString("codigoPlana"));
pst.setString(4, json.getString("codigoPlana"));
pst.setString(5, json.getString("codigoPeriodo"));
pst.setString(6, json.getString("codigoZona"));
rs = pst.executeQuery();
......@@ -2638,7 +2638,8 @@ public class MySqlHorarioDAO implements HorarioDAO {
.put("distrito", rs.getString("nom_dis_ubi"))
.put("bloqueo", rs.getString("bloqueo"))
.put("diasin", rs.getString("diasSin"))
.put("puesto", rs.getString("puesto"));
.put("puesto", rs.getString("puesto"))
.put("zona", rs.getString("nom_zon"));
arrayDocente.put(obj);
......
......@@ -12,10 +12,13 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONArray;
import pe.siso.horario.Beans.Area;
import pe.siso.horario.Beans.Docente;
import pe.siso.horario.Beans.Zona;
import pe.siso.horario.Beans.ZonaDistrito;
import pe.siso.horario.Beans.ZonaSede;
import pe.siso.horario.Services.AreaServices;
import pe.siso.horario.Services.DocenteServices;
import pe.siso.horario.Services.ZonaDistritoServices;
import pe.siso.horario.Services.ZonaSedeServices;
......@@ -69,7 +72,9 @@ public class ServletZona extends HttpServlet {
eliminarDocentesAsignadosZona(request,response);
}else if("listarDocente".equals(param)){
listarDocente(request,response);
}
}else if("cargarZonaJson".equals(param)){
cargarZonaJson(request,response);
}
}
......@@ -1176,5 +1181,18 @@ public class ServletZona extends HttpServlet {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void cargarZonaJson(HttpServletRequest request, HttpServletResponse response) throws IOException {
ZonaServices servicios = new ZonaServices();
ArrayList<Zona> lista = null;
lista = servicios.listarZonasActivas();
response.setContentType("application/json");
PrintWriter pw = response.getWriter();
JSONArray jArray = new JSONArray(lista);
pw.print(jArray);
}
}
......@@ -24,6 +24,34 @@
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
/* The snackbar - position it at the bottom and in the middle of the screen */
#snackbar2 {
visibility: hidden; /* Hidden by default. Visible on click */
min-width: 250px; /* Set a default minimum width */
margin-left: -125px; /* Divide value of min-width by 2 */
background-color: #333; /* Black background color */
color: #fff; /* White text color */
text-align: center; /* Centered text */
border-radius: 2px; /* Rounded borders */
padding: 16px; /* Padding */
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
left: 50%; /* Center the snackbar */
bottom: 30px; /* 30px from the bottom */
}
/* Show the snackbar when clicking on a button (class added with JavaScript) */
#snackbar2.show {
visibility: visible; /* Show the snackbar */
/* Add animation: Take 0.5 seconds to fade in and out the snackbar.
However, delay the fade out process for 2.5 seconds */
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
/* Animations to fade the snackbar in and out */
@-webkit-keyframes fadein {
from {bottom: 0; opacity: 0;}
......
......@@ -17,7 +17,7 @@
<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>
......@@ -99,19 +99,12 @@
<a class="waves-effect waves-light btn blue" id="btnBuscar" onclick="activarPrint();"><i class="material-icons left">search</i>buscar</a>
<i class="ace-icon fa fa-print bigger-160"><a class="waves-effect waves-light btn grey" id="btnImprimir" onclick="pintarTDRed();window.print();">IMPRIMIR</a></i>
<i class="ace-icon fa fa-print bigger-160"><a class="waves-effect waves-light btn grey" id="btnImprimir" onclick="pintarTDRed();window.print();">IMPRIMIR</a></i><br><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>-->
<select onchange="doSearchZona();" id="cmbZonas">
<option value="NORTE">NORTE</option>
<option value="ESTE">ESTE</option>
<option value="LIMA">LIMA</option>
<option value="CALLAO">CALLAO</option>
<option value="HUANCAYO">HUANCAYO</option>
<option value="ICA">ICA</option>
</select>
<label>Zona:</label>
<select id="cmbZonas" onchange="listarDisponibilidad();">
</select>
</div>
</div>
......@@ -137,6 +130,7 @@
</div>
<!-- The actual snackbar -->
<div id="snackbar">Se bloqueo el dia correctamente..</div>
<div id="snackbar2">Desbloqueado.</div>
<script>
// $("#btnBuscar").attr('disabled','disabled');
......@@ -153,6 +147,7 @@
var instances = M.FormSelect;
document.addEventListener('DOMContentLoaded', function () {
listarArea()
listarZona()
document.querySelector('#btnBuscar').addEventListener('click', function () {
listarDisponibilidad()
......@@ -171,43 +166,19 @@
})
}
function doSearchZona(){
debugger
var tableReg = document.getElementById('tablaDispo');
var searchText = document.querySelector('#cmbZonas').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++) {
console.log(tableReg.rows.length)
cellsOfRow = tableReg.rows[i].getElementsByTagName('td');
found = false;
// Recorremos todas las celdas
for (var j = 0; j < cellsOfRow.length && !found; j++) {
compareWith = cellsOfRow[j].innerHTML.toLowerCase();
//console.log(cellsOfRow);
// Buscamos el texto en el contenido de la celda
if (searchText.length == 0 || (compareWith.indexOf(searchText) > -1))
{
found = true;
}
}
if (found) {
//mostar todo el thead y tbody
tableReg.rows[i].style.display = '';
} else {
// si no ha encontrado ninguna coincidencia, esconde la
// fila de la tabla
tableReg.rows[i].style.display = 'none';
}
}
function listarZona(){
axios.get('../ServletZona?Accion=cargarZonaJson')
.then(data => {
let option = '<option value="">[SELECCIONE]</option>'
data.data.forEach(v => {
option += '<option value="' + v.codigoZona + '">' + v.nombreZona + '</option>'
})
document.querySelector('#cmbZonas').innerHTML = option
instances.init(elems)
})
}
function listarDisponibilidad() {
......@@ -215,12 +186,14 @@
let codigoPlana = document.querySelector('#cbPlana').value
let codigoPeriodo = '<%= periodo!=null?periodo.getCodigoPeriodo():""%>'
let codigoZona = document.querySelector('#cmbZonas').value
// let distritos=new ZonaDistritoServices();
if (codigoPlana && codigoPeriodo) {
if (codigoPlana && codigoPeriodo && codigoZona) {
let json = {
codigoPlana,
codigoPeriodo
codigoPeriodo,
codigoZona
}
$.ajax({
......@@ -238,17 +211,22 @@
let nDia=[]
let mensaje='No registrado'
data.data.forEach(function (docente) {
if(typeof(docente.celular && docente.distrito) == "undefined"){
if(typeof(docente.celular && docente.distrito && docente.zona) == "undefined"){
html += '<div class="divider"></div>'
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 += '<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 += '<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>'
......@@ -422,12 +400,13 @@
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>'+docente.puesto+'</strong></span></h6>'
html +='<h6 id="nombreDocente" style="font-weight:bold;">' + docente.nombre + '<span></span><span></span><span style="margin-left:650px;font-size:25px;color:#6C7807"><img src="../assets/images/puesto_image.png" alt="" height="42" width="42"/><strong>'+docente.puesto+'</strong></span></h6>'
html += '<label id="codDocente" style="visibility:hidden;">' + docente.codDocente + '</label>'
html += '<p>Celular: '+ docente.celular +'</p>'
html += '<p>Distrito: '+ docente.distrito +'</p>'
html += '<p>Direccion: '+ docente.direccion +'</p>'
html += '<p>Correo: '+ docente.correo +'</p>'
html += '<p>Zona: '+ docente.zona +'</p>'
html += '<br>'
......@@ -605,7 +584,7 @@
}
function colorChange(obj){
debugger
let periodo = '<%= periodo!=null?periodo.getCodigoPeriodo():""%>'
......@@ -649,7 +628,7 @@
$(obj).removeClass('blue');
$(obj).addClass('red');
mostrarSnackBar();
mostrarSnackBarDesbloqueo();
}
}else if(data.trim() == 3){
......@@ -658,7 +637,7 @@
$(obj).removeClass('blue');
$(obj).addClass('green');
mostrarSnackBar();
mostrarSnackBarDesbloqueo();
}
}
......@@ -758,6 +737,16 @@
// 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);
}
......
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