<%-- 
    Document   : mantenimientoMenu
    Created on : 09-jul-2018, 11:42:42
    Author     : Felipe Escala
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
    <head>
        <link href="../css/lib/jquery-editable-select.min.css" rel="stylesheet" type="text/css"/>
        <%@include file="templates/header.jsp" %>
        <!--template-core-->

        <!--css-->
        <link href="../css/general.css" rel="stylesheet" type="text/css"/>
        <!--css-->
        <style>
            .switch{
              position: relative;
              width: 65px;
              height: 27px;
              margin: 0px;
              appearance: none;
              outline: none;
              cursor: pointer;
              background-color: green;
              border-radius: 25px;
              transition: all 0.5s;
            }
            .switch:before{
              content: "";
              width: 23px;
              height: 23px;
              border-radius: 50%;
              background-color: #fff;
              position: absolute;
              transition: all .5s;
              transform: translate(2px, 2px);
              transition-timing-function: cubic-bezier(0.81, -0.02, 0, 2.13);
              transition-delay: .1s;
              box-shadow: inset 2px 0px 4px rgba(0,0,0,.5),
              -2px 0px 2px rgba(0,0,0,.5);
              animation: off 0.5s forwards;
            }
            .switch:checked{
              background-color: #e70000;
              transition: all 0.5s;
            }
            .switch:checked:before{
              transition: all .5s;
              transform: translate(40px, 2px);
              transition-timing-function: cubic-bezier(0.81, -0.02, 0, 2.13);
              box-shadow: inset -2px 0px 4px rgba(0,0,0,.5),
              2px 0px 2px rgba(0,0,0,.5);
              transition-delay: .1s;
              right: 43px;
              animation: on 0.5s forwards;
            }

            @keyframes on{
              0%, 50%, 100%{
                width: 23px;
              }
              25%{
                width: 33px;
              }
            }
            @keyframes off{
              0%, 50%, 100%{
                width: 23px;
              }
              25%{
                width: 33px;
              }
            }
        </style>
    </head>
    <body onload="segundaCarga();">
        <%@include file="templates/header-body.jsp" %>
        <!--  content -->
        <div class="row  animated fadeIn">
            <div class="col-sm-12 col-md-12 col-lg-5 col-centered">
                <div class="panel panel-primary card-3 fadeInUpBig" style="margin-top: 30px"> 
                    <div class="panel-heading" style="padding: 8px 15px">
                        <h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; Búsqueda de Menús</h6>
                        <div class="heading-elements">
                            <div class="checkbox checkbox-switchery">
                                <label>
                                    <span id="txtEstado"></span>
                                    <input type="checkbox" id="cbkEstado">
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="panel-body" id="panelSearch">
                        <form id="formProyecto" onsubmit="return false" autocomplete="off">
                            <div class="row">
                                <div class='col-md-6'>
                                    <div class="form-group">
                                        <label> Proyecto: </label>
                                        <span class="asterisk">(*)</span>
                                        <select id="cboProyecto" class="form-control">
                                            <option value="">SELECCIONE PROYECTO</option>
                                        </select>
                                    </div>
                                </div>
                                <div class='col-md-6'>
                                    <div class="form-group">
                                        <label>Tipo de Usuario: </label>
                                        <span class="asterisk">(*)</span>
                                        <select id="cboTipoUsuario" class="form-control">
                                            <option value="">SELECCIONE TIPO DE USUARIO</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <div class="row">
                            <div class="col-md-12" style="display: flex; justify-content: space-between">
                                <div class="form-group">
                                    <div class="text-left" style="display: flex; justify-content: center; align-items: center; gap: 1rem;">
                                        <div>
                                        No visibles :
                                        </div>
                                        <div style="background: #e0f8ff; width: 1.5rem; height: 1.5rem; border: 1px solid black; display: block"></div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="text-right"> 
                                        <span class="text-danger">(*) </span>  Campo obligatorio
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="text-right">
                                    <button class="btn bg-primary border-primary-600 btn-xs" type="button" id="btnBuscar"><i class="fa fa-search"></i> Buscar</button>
                                    <button class="btn bg-orange border-orange-600 btn-xs" type="button" id="btnLimpiar"><i class="fa fa-refresh"></i> Limpiar</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> 
            </div> 

            <div class="col-sm-12 col-md-12 col-lg-11 col-centered">
                <div class="panel panel-primary card-3 hide" style="margin-top: 30px"  id="panelTabla"> 
                    <div class="panel-heading" style="padding: 8px 15px">
                        <h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; Listado del Menu</h6>
                        <div class="heading-elements">
                            <div class="checkbox checkbox-switchery">
                                <label>
                                    <span>MOSTRAR PERMISOS</span>
                                    <input type="checkbox" id="cbkPermisos">
                                </label>
                            </div>
                            <button type="button" id="btnNuevoTitulo" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp; Nuevo Titulo</button>
                        </div>                        
                    </div>
                    <div class="table-responsive">
                        <table class="table dataTable table-striped table-hover table-sm table-bordered display" id="tblMenu">                                                 
                            <thead>
                                <tr>
                                    <th class="text-center">JERARQUÍA</th>
                                    <th class="text-center">ICONO</th>                                                     
                                    <th class="text-center">TIPO</th>                                                     
                                    <th class="text-center">URL</th>                                                     
                                    <th class="text-center">ACCIONES</th>                                                     
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div> 
        </div>

        <%@include file="templates/footer-body.jsp" %>
        <script src="../js/lib/jquery-editable-select.min.js" type="text/javascript"></script>
        <script src="../js/pages/MantenimientoMenu.js" type="text/javascript"></script>
        <script>
            let switchery = new Switchery(document.querySelector('#cbkEstado'), {color: 'red', secondaryColor: 'green'});
            let switchery2 = new Switchery(document.querySelector('#cbkPermisos'), {color: 'red', secondaryColor: 'green'});
            $('.heading-elements').css('display','flex');
            $('.heading-elements').css('gap','2rem');
            document.querySelector('#txtEstado').innerText = 'MOSTRANDO ACTIVOS';
            document.querySelector('#cbkEstado').checked = false;
            document.querySelector('#cbkEstado').onchange = function () {
                if (document.querySelector('#cbkEstado').checked) {
                    document.querySelector('#txtEstado').innerText = 'MOSTRANDO INACTIVOS';
                } else {
                    document.querySelector('#txtEstado').innerText = 'MOSTRANDO ACTIVOS';
                }
                listarProyectos();
                document.querySelector('#btnLimpiar').click();
            };
            document.querySelector('#cbkPermisos').addEventListener('click',() =>  {
                $('#btnBuscar').trigger('click');
            });
        </script>
    </body> 
</html>