<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="validar.jsp" %>
<!DOCTYPE html>
<html lang="es">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta charset="utf-8" />
        <title>:::SISTEMA DE HORARIOS:::</title>

        <meta name="description" content="overview &amp; stats" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />



        <link rel="stylesheet" href="../assets/css/bootstrap.css" />
        <link rel="stylesheet" href="../assets/css/font-awesome.css" />
        <link rel="stylesheet" href="../assets/css/jquery-ui.css" />
        <link rel="stylesheet" href="../assets/css/ace-fonts.css" />
        <link rel="stylesheet" href="../assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
        <link href="css/success.css" rel="stylesheet" type="text/css"/>
        <script src="../assets/js/ace-extra.js"></script>



        <!-- inline scripts related to this page -->
        <script type="text/javascript" language="javascript">

            /*$(document).ready( function() {
             jQuery("#registroEncuesta").validationEngine();
             });*/
        </script>
    </head>

    <body class="no-skin" onLoad="cargar();">
        <!-- #section:basics/navbar.layout -->
        <div id="navbar" class="navbar navbar-default">
            <script type="text/javascript">
                try {
                    ace.settings.check('navbar', 'fixed')
                } catch (e) {
                }
            </script>

            <div class="navbar-container" id="navbar-container">
                <%@ include file="banner.jsp" %>
            </div><!-- /.navbar-container -->
        </div>

        <!-- /section:basics/navbar.layout -->
        <div class="main-container" id="main-container">
            <script type="text/javascript">
                try {
                    ace.settings.check('main-container', 'fixed')
                } catch (e) {
                }
            </script>

            <!-- #section:basics/sidebar -->
            <div id="sidebar" class="sidebar                  responsive">
                <script type="text/javascript">
                    try {
                        ace.settings.check('sidebar', 'fixed')
                    } catch (e) {
                    }
                </script>
                <input id="codModulo" type="hidden" value="<%=menu!=null?menu.getCodModulo():""%>">
                <input id="codCategoria" type="hidden" value="<%=menu!=null?menu.getCodCategoria():""%>">
                <%@ include file="menu.jsp" %>
                <!-- #section:basics/sidebar.layout.minimize -->
                <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
                    <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
                </div>
                <!-- /section:basics/sidebar.layout.minimize -->
                <script type="text/javascript">
                    try {
                        ace.settings.check('sidebar', 'collapsed')
                    } catch (e) {
                    }
                </script>
            </div>

            <!-- /section:basics/sidebar -->
            <div class="main-content">
                <div class="main-content-inner">
                    <!-- #section:basics/content.breadcrumbs -->
                    <div class="breadcrumbs" id="breadcrumbs">
                        <script type="text/javascript">
                            try {
                                ace.settings.check('breadcrumbs', 'fixed')
                            } catch (e) {
                            }
                        </script>

                        <ul class="breadcrumb">
                            <li>
                                <i class="ace-icon fa fa-home home-icon"></i>
                                <a href="principal.jsp">INICIO</a>
                            </li>
                            <li class="active">REPORTE</li>
                        </ul><!-- /.breadcrumb -->
                    </div>

                    <!-- /section:basics/content.breadcrumbs -->
                    <div class="page-content">

                        <div class="page-header">
                            <h1>
                                Reporte
                                <small>
                                    <i class="ace-icon fa fa-angle-double-right"></i>
                                    Disponibilidad Docente
                                </small>
                            </h1>
                        </div><!-- /.page-header -->

                        <div class="row">





                            <!-- ----------- CONTENEDOR DE FORMULARIOS--------INI----- -->
                            <div class="col-sm-12" style="width:100%;">

                                <div  class="col-sm-4"></div>
                                <div  class="col-sm-4">
                                    <div class="widget-box widget-color-blue">
                                        <div class="widget-header">
                                            <h4 class="widget-title">Reporte de disponibilidad docente</h4>
                                        </div>

                                        <div class="widget-body">
                                            <div class="widget-main no-padding">
                                                <form id="formulario"  method="post">
                                                    <fieldset>
                                                        <div  class="col-sm-12">
                                                            <label>Periodo de Horario <span style="color: red;">*</span></label>
                                                            <div id="divPeriodoH">
                                                                <select class="form-control validate[required]" id="cmbArea" >
                                                                    <option value="">[Seleccione]</option>
                                                                </select>
                                                            </div> 
                                                        </div>
                                                        <div  class="col-sm-12" style="height: 10px"></div>
                                                        <div  class="col-sm-12">
                                                            <label>Tipo Reporte <span style="color: red;">*</span></label>
                                                            <div id="divTipoReporte">
                                                                <select class="form-control validate[required]" id="cbTipoReporte" onchange="mostrarDivPlana();">
                                                                    <option value="">[Seleccione]</option>
                                                                    <option value="1" selected>POR ÁREA</option>
                                                                    <option value="2">POR PLANA</option>
                                                                </select>
                                                            </div> 
                                                        </div>
                                                        <div  class="col-sm-12" style="height: 10px"></div>   
                                                        <div  id='divAreaHidden' class="col-sm-12 hidden">
                                                            <label>Área <span style="color: red;">*</span></label>
                                                            <div id="divArea">
                                                                <select class="form-control validate[required]" id="cbArea" >
                                                                    <option value="">[Seleccione]</option>
                                                                </select>
                                                            </div> 
                                                        </div>
                                                    </fieldset>

                                                    <div class="form-actions center">
                                                        <button  class="btn btn-sm btn-info" type="button" onclick="validar_reporte();">
                                                            <i class="ace-icon fa fa-file-excel-o icon-on-right bigger-110"></i>
                                                            Generar reporte
                                                        </button>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div  class="col-sm-4"></div>

                            </div>
                            <div class="col-sm-12" style="width:100%; height: 40px;"></div>
                            <div  class="col-sm-12" style="width:100%;">
                                <div  class="col-sm-12">
                                    <!-- -------------TABLA---INI------------ -->

                                    <div style="display: none;" id='divReporte'>

                                    </div>
                                    <!-- -------------TABLA---FIN------------ -->
                                </div>
                            </div>
                            <!-- ----------- CONTENEDOR DE FORMULARIOS--------FIN----- -->




                            <!-- ::::::::::-ALERTAS-::::::::::::::: -->

                            <input id='pagina' type='hidden'>
                            <div id="dialog-noti1" class="hide">
                                <br>
                                Se registró con éxito.
                                <br><br>
                            </div>

                            <div id="dialog-noti2" class="hide">
                                <br>
                                Se actualizó con éxito.
                                <br><br>
                            </div>

                            <div id="dialog-noti3" class="hide">
                                <br>
                                El cambio de estado fue exitoso.
                                <br><br>
                            </div>

                            <div id="dialog-confor1" class="hide">
                                <br>
                                ¿Está seguro de agregar un nuevo curso?
                                <br><br>
                            </div>

                            <div id="dialog-confor2" class="hide">
                                <br>
                                ¿Está seguro de actualizar el registro?
                                <br><br>
                            </div>

                            <div id="dialog-confor3" class="hide">
                                <br>
                                ¿Está seguro de inhabilitar el curso?  
                                <br><br>
                            </div>

                            <div id="dialog-confor4" class="hide">
                                <br>
                                ¿Está seguro de habilitar el curso?  
                                <br><br>
                            </div>

                            <div id="dialog-advertencia1" class="hide">
                                <br>
                                No se puede inhabilitar el curso porque está asignado en un horario.
                                <br><br>
                            </div>

                            <div id="dialog-armar" class="hide">
                                <br>
                                <form id="registrarCurso" class="formular" method="post">
                                    <div id="divFormularioRegistro" ></div>
                                </form>
                                <br><br>
                            </div>

                            <div id="dialog-armarEdit" class="hide">
                                <br>
                                <form id="actulizar" class="formular" method="post">
                                    <div id="divFormulario"  ></div>
                                </form>
                                <br><br>
                            </div>

                            <div id="dialog-cargando" class="hide">
                                <table cellpadding="0" cellspacing="0" width="100%">
                                    <tr><td align="center"><img src="imagenes/cargando.gif" border=0></td></tr>
                                </table>
                            </div>



                            <!-- ::::::::::-ALERTAS-::::::::::::::: -->


                        </div><!-- /.row -->
                    </div><!-- /.page-content -->
                </div>
            </div><!-- /.main-content -->

            <div class="footer">
                <%@ include file="footer.jsp" %>
            </div>

            <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
                <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
            </a>
        </div><!-- /.main-container -->

        <!-- basic scripts -->

        <!--[if !IE]> -->
        <script type="text/javascript">
            window.jQuery || document.write("<script src='../assets/js/jquery.js'>" + "<" + "/script>");
        </script>

        <!-- <![endif]-->

        <!--[if IE]>
<script type="text/javascript">
window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/script>");
</script>
<![endif]-->
        <script type="text/javascript">
            if ('ontouchstart' in document.documentElement)
                document.write("<script src='../assets/js/jquery.mobile.custom.js'>" + "<" + "/script>");
        </script>
        <script src="../assets/js/bootstrap.js"></script>

        <!-- page specific plugin scripts -->
        <script src="../assets/js/jquery-ui.js"></script>
        <script src="../assets/js/jquery.ui.touch-punch.js"></script>

        <!--[if lte IE 8]>
          <script src="../assets/js/excanvas.js"></script>
        <![endif]-->
        <script src="../assets/js/jquery-ui.custom.js"></script>
        <script src="../assets/js/jquery.ui.touch-punch.js"></script>
        <script src="../assets/js/jquery.easypiechart.js"></script>
        <script src="../assets/js/jquery.sparkline.js"></script>
        <script src="../assets/js/flot/jquery.flot.js"></script>
        <script src="../assets/js/flot/jquery.flot.pie.js"></script>
        <script src="../assets/js/flot/jquery.flot.resize.js"></script>

        <!-- ace scripts -->
        <script src="../assets/js/ace/elements.scroller.js"></script>
        <script src="../assets/js/ace/elements.colorpicker.js"></script>
        <script src="../assets/js/ace/elements.fileinput.js"></script>
        <script src="../assets/js/ace/elements.typeahead.js"></script>
        <script src="../assets/js/ace/elements.wysiwyg.js"></script>
        <script src="../assets/js/ace/elements.spinner.js"></script>
        <script src="../assets/js/ace/elements.treeview.js"></script>
        <script src="../assets/js/ace/elements.wizard.js"></script>
        <script src="../assets/js/ace/elements.aside.js"></script>
        <script src="../assets/js/ace/ace.js"></script>
        <script src="../assets/js/ace/ace.ajax-content.js"></script>
        <script src="../assets/js/ace/ace.touch-drag.js"></script>
        <script src="../assets/js/ace/ace.sidebar.js"></script>
        <script src="../assets/js/ace/ace.sidebar-scroll-1.js"></script>
        <script src="../assets/js/ace/ace.submenu-hover.js"></script>
        <script src="../assets/js/ace/ace.widget-box.js"></script>
        <script src="../assets/js/ace/ace.settings.js"></script>
        <script src="../assets/js/ace/ace.settings-rtl.js"></script>
        <script src="../assets/js/ace/ace.settings-skin.js"></script>
        <script src="../assets/js/ace/ace.widget-on-reload.js"></script>
        <script src="../assets/js/ace/ace.searchbox-autocomplete.js"></script>
        <script src="../assets/js/ace/ace.searchbox-autocomplete.js"></script>

        <script src="js/blockui.min.js" type="text/javascript"></script>
        <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
        <!--<link rel="stylesheet" href="css/template.css" type="text/css"/>-->


        <!-- inline scripts related to this page -->
        <script type="text/javascript">



            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

            $(document).ready(function () {
                jQuery("#formulario").validationEngine();
            });



            //-------------------------------

            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',
                        opacity: 0.8,
                        cursor: 'wait'
                    },
                    css: {
                        zindex: '9999',
                        border: 0,
                        color: '#fff',
                        padding: 0,
                        backgroundColor: 'transparent'
                    }
                });
            }

            function cerrar_cargando() {
                $.unblockUI();
            }

            function conMayusculas(field) {
                field.value = field.value.toUpperCase()
            }

            function segundaCarga() {
                cargarPeriodoHorario();
            }

            function cargarPeriodoHorario() {
                var periodo = "<%=periodo!=null?periodo.getCodigoPeriodo():""%>";
                var accion = "cargarPeriodoEncuesta(); ";
                var nombre = "cmbPeriodoH";
                $.ajax({
                    type: 'POST',
                    url: '../ServletReporteEncuesta?Accion=listarPeriodoHorario',
                    data: 'accion=' + accion + '&nombre=' + nombre + '&periodo=' + periodo,
                    beforeSend: function () {
                        cargando();
                    }, success: function (resultado) {
                        cerrar_cargando();
                        $("#divPeriodoH").html(resultado);
                    }, complete: function () {

                    }
                });

            }

            function mostrarDivPlana() {
                var tipoReporte = $('#cbTipoReporte').val();
                if (tipoReporte == "1" || tipoReporte == "" ) {
                    $("#divAreaHidden").addClass("hidden");
                } else if (tipoReporte == "2") {
                    cargarArea();
                    
                }
            }

            function cargarArea() {
                $.ajax({
                    type: 'POST',
                    url: '../ServletArea?Accion=cargarAreaJson',
                    data: null,
                    datatype: 'application/json',
                    beforeSend: function () {

                    }, success: function (resultado) {
                        var datos = resultado;
                        var cb = "<select class=\"form-control validate[required]\" name=\"cbArea\" onchange=\"limpiar()\" id=\"cbArea\" >";
                        cb += "<option value=\"\">[Seleccione]</option>";
                        for (var i = 0; i < datos.length; i++) {
                            cb += "<option value=\"" + datos[i].codigoArea + "\">" + datos[i].nombreArea + "</option>";
                        }
                        cb += "</select>";
                        $("#divArea").html(cb);
                    }, complete: function () {
                        $("#divAreaHidden").removeClass("hidden");
                    }
                });
            }

            function validar_reporte() {
                var estado = $('#formulario').validationEngine('validate');
                if (estado) {
                    var tipoReporte = $('#cbTipoReporte').val();
                    if (tipoReporte == "1") {
                        exportarReporteDisponibilidadPorArea();
                    } else if (tipoReporte == "2") {
                        exportarReporteDisponibilidadPorPlana();
                    }
                }

            }

            function exportarReporteDisponibilidadPorPlana() {
                var codPeriodoH = $("#cmbPeriodoH").val();
                var nombrePeriodo = $("#cmbPeriodoH option:selected").text();
                var codigoArea = $("#cbArea").val();
                var nombreArea = $("#cbArea option:selected").text();
                window.location = "exportarReporteDisponibilidadPorPlana.jsp?codPeriodoH=" + codPeriodoH + '&nombrePeriodo=' + nombrePeriodo+'&codigoArea='+codigoArea+'&nombreArea='+nombreArea;
                
            }

            function exportarReporteDisponibilidadPorArea() {
                var codPeriodoH = $("#cmbPeriodoH").val();
                var nombrePeriodo = $("#cmbPeriodoH option:selected").text();
                window.location = "exportarReporteDisponibilidadPorArea.jsp?codPeriodoH=" + codPeriodoH + '&nombrePeriodo=' + nombrePeriodo;
            }


            function limpiar() {
                $("#divReporte").fadeOut();

            }





            function ver(opcion, puntajeReducido, puntaje, pos) {
                if (opcion == 1) {
                    //detallado
                    $("#puntaje" + pos + "").html("<a title='Ver resumido' href='javascript:ver(2,\"" + puntajeReducido + "\",\"" + puntaje + "\",\"" + pos + "\")'>" + puntaje + "</a>");
                } else {
                    //reducido
                    $("#puntaje" + pos + "").html("<a title='Ver completo' href='javascript:ver(1,\"" + puntajeReducido + "\",\"" + puntaje + "\",\"" + pos + "\")'>" + puntajeReducido + "</a>");
                }
            }


            /*
             function cargarDias(){
             var codPeriodoH = $("#cmbPeriodoH").val();
             var Docente = $("#cmbDocente").val();
             var accion = "cargarD()";
             var nombre = "cmbDia";
             
             $.ajax({
             type:'POST',
             url:'../ServletReporteEncuesta?Accion=listarDias',
             data: 'accion='+accion+'&codPeriodoH='+codPeriodoH+'&Docente='+Docente+'&nombre='+nombre,
             beforeSend: function() {
             cargando();
             },success:function(resultado){
             close_carga();
             $("#divDia").html(resultado);
             },complete:function(){ 
             
             }
             });
             }*/

        </script>


        <!-- the following scripts are used in demo only for onpage help and you don't need them -->

        <link rel="stylesheet" href="../assets/css/ace.onpage-help.css" />
        <link rel="stylesheet" href="../docs/assets/js/themes/sunburst.css" />

        <script type="text/javascript"> ace.vars['base'] = '..';</script>
        <script src="../assets/js/ace/elements.onpage-help.js"></script>
        <script src="../assets/js/ace/ace.onpage-help.js"></script>
        <script src="../docs/assets/js/rainbow.js"></script>
        <script src="../docs/assets/js/language/generic.js"></script>
        <script src="../docs/assets/js/language/html.js"></script>
        <script src="../docs/assets/js/language/css.js"></script>
        <script src="../docs/assets/js/language/javascript.js"></script>

        <script src="js/bootbox.min.js" type="text/javascript"></script>

        <script src="js/languages/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>

        <!--<script src="style/jquery.kolorpicker.js" type="text/javascript"></script>
        <link rel="stylesheet" href="style/kolorpicker.css" type="text/css" media="screen, tv, projection, print" />
        -->

        <script type="text/javascript" language="javascript" src="js/colorPicker.js"></script>

</html>
