<?php include_once('../../../config.php') ?>
<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
?>


<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Liberar Registro</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.238.28.1">
    <!-- Ionicons -->
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.238.28.1">
    <!-- overlayScrollbars -->
    <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css?versao=3.238.28.1">
    <!-- Daterange picker -->
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" href="dist/css/custom.css?versao=3.238.28.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.238.28.1">
    <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.238.28.1" />
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.238.28.1" />
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.238.28.1">
    <!-- Google Font: Source Sans Pro -->
    <style>
        .info-box-text {
            font-size: 20px;
            font-weight: bold;
            color: grey;
        }

        .form-group {
            margin-bottom: 0;
        }
    </style>

</head>

<body class="hold-transition sidebar-mini layout-fixed">
    <div class="wrapper">
        <?php
        include_once('../../../menu.php');
        ?>

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <div class="content-header">
                <div class="container-fluid">
                    <div class="row mb-2">
                        <div class="col-sm-6 flex">
                            <h1 class="m-0 text-dark">Liberação de Registro</h1>
                            <button type="button" class="btn btn-info btn-sm ml-2" style="color: white;" id="tutorial">
                                <i class="fas fa-question-circle"></i>
                            </button>
                        </div><!-- /.col -->
                        <div class="col-sm-6">
                            <ol class="breadcrumb float-sm-right">
                                <li class="breadcrumb-item"><a href="index.php">Início</a></li>
                                <li class="breadcrumb-item active">Sistema</li>
                                <li class="breadcrumb-item active">Liberação de Registro</li>
                            </ol>
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.container-fluid -->
            </div>
            <!-- /.content-header -->

            <!-- Main content -->
            <section class="content">

                <div class="card">
                    <div class="card-body">
                        <div class="container-fluid p-4">
                            <div class="row pb-4">
                                <div class="col-sm-6">
                                    <button id="btn-filtros" class="btn btn-success btn-sisp" type="button" data-toggle="modal" data-target="#modal-filtros">
                                        <span class="fas fa-filter"></span> Filtros
                                    </button>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="d-inline pb-2">
                                        <h5>Selecionar todos os Acessos: </h5>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12 table-responsive">
                                    <table id="tabelaRegistros" class="table table-sm table-select table-hover" width="100%">
                                        <thead>
                                            <th>Sel</th>
                                            <th>Tela</th>
                                            <th>Usuário</th>
                                            <th>Valor</th>
                                            <th>Hora</th>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="col-sm-12">
                                    <button id="btn-liberar" class="btn btn-danger">Liberar Registros</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
            <!-- /.content -->
        </div>
        <div id="modal-filtros" class="modal" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-xl" role="document">
                <div class="modal-content" id="modalBody">
                    <div class="modal-header">
                        <h4 class="modal-title">Filtros</h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-sm-4 col-12">
                                <div class="group-default form-group">
                                    <label data-error="wrong" data-success="right" for="txtTela">Tela</label>
                                    <div class="relative">
                                        <input type="text" placeholder="Tela" class="input-default focus form-control validate" id="txtTela" name="txtTela">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-4 col-12">
                                <div class="group-default form-group">
                                    <label data-error="wrong" data-success="right" for="txtUsuario">Usuário</label>
                                    <div class="relative">
                                        <input type="text" placeholder="Usuário" class="input-default focus form-control validate" id="txtUsuario" name="txtUsuario">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-4 col-12">
                                <div class="group-default form-group">
                                    <label data-error="wrong" data-success="right" for="txtValor">Valor</label>
                                    <div class="relative">
                                        <input type="text" placeholder="Valor" class="input-default focus form-control validate" id="txtValor" name="txtValor">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <div class="row">
                            <button class="btn btn-primary btn-sisp" id="btnLimparFiltros" style="background-color: #B22222; border-color: #B22222"><span class="fas fa-trash"></span> Limpar Filtros</button>     
                            <button class="btn btn-primary btn-sisp" id="btn-consultar"><span class="fas fa-search"></span> Consultar</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Control Sidebar -->
        <aside class="control-sidebar control-sidebar-dark">
            <!-- Control sidebar content goes here -->
        </aside>
        <!-- /.content-wrapper -->
        <?php
        include_once('../../../footer.php');
        ?>
        <!-- /.control-sidebar -->
    </div>
    <!-- ./wrapper -->

    <!-- jQuery -->
    <script src="plugins/jquery/jquery.min.js?versao=3.238.28.1"></script>
    <!-- jQuery UI 1.11.4 -->
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.238.28.1"></script>
    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <script>
        if ($('[type="date"]').prop('type') != 'date') {
            $('[type="date"]').datepicker();
        }
        $.widget.bridge('uibutton', $.ui.button);
    </script>

    <!-- Bootstrap 4 -->
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.238.28.1"></script>
    <script src="dist/js/sisplan.js?versao=3.238.28.1"></script>
    <script type="text/javascript" src="utils/funcoes.js?versao=3.238.28.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.238.28.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.min.js?versao=3.238.28.1"></script>
    <script type="text/javascript" src="dist/js/loadingoverlay.min.js?versao=3.238.28.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.238.28.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.238.28.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.238.28.1"></script>
    <script src="dist/js/dataTables.keyTable.js?versao=3.238.28.1"></script>
    <script src="utils/cookies.js?versao=3.238.28.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.238.28.1"></script>
    <script src="dist/js/driver.min.js?versao=3.238.28.1"></script>
    <script type="text/javascript" src="config.js?versao=3.238.28.1"></script>
    <script>
        $(document).ready(async function() {
            if (getCookie('usuario') == "") {
                window.location.href = `${BASE_URI}/login`;
                return;
            }

            let usuario = getCookie('usuario');
            let empresa = getCookie('empresa');

            ipInterno = IP_INTERNO;
            ipExterno = IP_EXTERNO;
            basicAuth = BASIC_AUTH;

            const temAcesso = await temAcessoTela('LIBERA_REGISTRO');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            sArquivo = `${BASE_URI}/pages/sistema/liberar_registros/liberar_registros.js?versao=3.238.28.1`;
            insereJavaScriptPagina(sArquivo);

        });
    </script>
</body>

</html>