<?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 | Conciliação Bancária</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.251.16.1">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.251.16.1">

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

        .form-group {
            margin-bottom: 0;
        }

        .bordaCampos {
            border: solid #e0e4e6;
            border-radius: 4px;
            border-width: 2px;
            padding-top: 2%;
            padding-bottom: 0%;
        }

        .bordaCampos:first-child {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: flex-end;
            align-items: center;
        }

        .border-Field .textoBorda {
            font-size: 1.0em !important;
            text-align: left !important;
            width: auto;
            padding: 0 10px;
            border-bottom: none;
        }

        .border-Field {
            border: 1.0px solid var(--font-color) !important;
            padding: 0 1.0em 1.0em 1.0em !important;
            margin: 0 0 1.0em 0 !important;
            -webkit-box-shadow: 0px 0px 0px 0px #000;
            box-shadow: 0px 0px 0px 0px #000;
            padding-bottom: 0px !important;
        }
    </style>

</head>

<body class="hold-transition sidebar-mini layout-fixed">
    <div class="wrapper">
        <?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">Conciliação Bancária</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">

                        </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>
                                    <button class="btn btn-danger btn-sisp" id="btnConciliar" data-toggle="modal"><i class="fas fa-plus"></i> Conciliar</button>
                                    <button class="btn btn-secondary btn-sisp" id="btnImprimir" data-toggle="modal"><i class="fas fa-print"></i> Imprimir</button>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12 table-responsive">
                                    <table id="tabelaMovimento" class="table table-sm table-select table-hover" width="100%" style="white-space: nowrap;">
                                        <thead>
                                            <tr></tr>
                                        </thead>
                                        <tbody>
                                            <tr></tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="row">
                                <h4 class="ml-3 mt-2 d-none" id="titleExtrato">Extrato</h4>
                                <div class="col-sm-12 table-responsive">
                                    <table id="tabelaConcilia" class="table table-sm table-select table-hover" width="100%" style="white-space: nowrap;">
                                        <thead>
                                            <tr></tr>
                                        </thead>
                                        <tbody>
                                            <tr></tr>
                                        </tbody>
                                    </table>
                                </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-xl-4 col-12 form-group">
                                <label data-error="wrong" data-success="right" for="dtPeriodode">Período de/até: </label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control" id="dtPeriodoDe" name="dtPeriodode" class="form-control">
                                        <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control" id="dtPeriodoAte" name="dtPeriodoAte" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-4 col-12 form-group mt-3">
                                <fieldset class="form border-Field p-0">
                                    <legend class="textoBorda pb-0 mb-0">Conciliado</legend>
                                    <div class="d-flex">
                                        <div class="icheck-primary mr-3"><input type="radio" id="rdConciliarConciliado" name="rdConciliar" value="1"><label class="labelCheck" for="rdConciliarConciliado">Conciliado</label></div>
                                        <div class="icheck-primary mr-3"><input type="radio" id="rdConciliarConciliar" name="rdConciliar" value="2"><label class="labelCheck" for="rdConciliarConciliar">A Conciliar</label></div>
                                        <div class="icheck-primary mr-3"><input type="radio" id="rdConciliarTodos" checked name="rdConciliar" value="0"><label class="labelCheck" for="rdConciliarTodos">Todos</label></div>
                                    </div>
                                </fieldset>
                            </div>
                            <div class="col-xl-4 col-12 form-group mt-3">
                                <fieldset class="form border-Field p-0">
                                    <legend class="textoBorda pb-0 mb-0">Tipo</legend>
                                    <div class="d-flex">
                                        <div class="icheck-primary mr-3"><input type="radio" id="rdTipoPagamento" name="rdTipo" value="2"><label class="labelCheck" for="rdTipoPagamento">Pagamento</label></div>
                                        <div class="icheck-primary mr-3"><input type="radio" id="rdTipoRecebimento" name="rdTipo" value="1"><label class="labelCheck" for="rdTipoRecebimento">Recebimento</label></div>
                                        <div class="icheck-primary mr-3"><input type="radio" id="rdTipoTodos" checked name="rdTipo" value="0"><label class="labelCheck" for="rdTipoTodos">Todos</label></div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xl-4 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtConta">Conta:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtConta" name="txtConta" class="form-control" placeholder="Conta">
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btn-ContaConsulta" name="btn-ContaConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btn-limpa-Conta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-4 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtBanco">Banco:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" disabled id="txtBanco" name="txtBanco" class="form-control" placeholder="Banco">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-2 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtDocumento">Documento:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtDocumento" name="txtDocumento" class="form-control" placeholder="Documento">
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-2 col-12 form-group">
                                <label style="padding-left: 0 !important;" data-error="wrong" data-success="right" for="txtConciliacao">Conciliação:</label>
                                <div class="relative">
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtConciliacao" name="txtConciliacao" class="form-control" placeholder="Conciliação">
                                    </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="btnConsultar"><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('../../../modais.php');
        ?>
        <!-- /.control-sidebar -->
    </div>
    <!-- ./wrapper -->

    <!-- jQuery -->
    <script src="plugins/jquery/jquery.min.js?versao=3.251.16.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.251.16.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.251.16.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.251.16.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.251.16.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.251.16.1"></script>
    <script src="dist/js/sisplan.js?versao=3.251.16.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.251.16.1"></script>
    <script src="utils/cookies.js?versao=3.251.16.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.251.16.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.251.16.1"></script>
    <script src="dist/js/driver.min.js?versao=3.251.16.1"></script>
    <script src="plugins/moment/moment.min.js?versao=3.251.16.1"></script>
    <script type="text/javascript" src="dist/js/sum().js?versao=3.251.16.1"></script>
    <script type="text/javascript" src="config.js?versao=3.251.16.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.251.16.1"></script>
    <script src="dist/js/jquery.mask.min.js?versao=3.251.16.1"></script>
    <script type="text/javascript" src="plugins/select2/js/select2.full.min.js?versao=3.251.16.1"></script>
    <script src="utils/funcoes.js?versao=3.251.16.1"></script>
    <script type="text/javascript" src="config.js?versao=3.251.16.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('CONCILIA');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            sArquivo = `${BASE_URI}/pages/concilia/acesso_concilia/acesso_concilia.js?versao=3.251.16.1`;
            insereJavaScriptPagina(sArquivo);

        });
    </script>
</body>

</html>