<?php include_once('../../config.php') ?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Atribuir Limite de Crédito</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.255.7.1">
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.255.7.1">
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.255.7.1" />

    <link href='dist/css/bootstrap.min.css?versao=3.255.7.1'>
    <link rel="stylesheet" href="dist/css/custom.css?versao=3.255.7.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.255.7.1">
    <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.255.7.1">
    <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.255.7.1">
    <link rel="stylesheet" type="text/css" href="dist/css/responsive.bootstrap.min.css?versao=3.255.7.1">
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="dist/css/cadastro.css?versao=3.255.7.1">
    <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.255.7.1">
    <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.255.7.1">

    <!-- Toastr -->
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.255.7.1">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.255.7.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.255.7.1">
    <!-- Google Font: Source Sans Pro -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
    <style>
        .radioStyle {
            border: solid #e0e4e6;
            border-radius: 4px;
            border-width: 2px;
            padding: 6px;
        }

        .campoSel {
            display: inline-block;
            position: absolute;
            width: 22px;
            height: 22px;
            border: 1px solid #D3CFC8;
            border-radius: 0;
        }

        #tabelaApuracao_filter {
            display: none;
        }
    </style>
</head>

<body class="hold-transition sidebar-mini layout-fixed">
    <div class="wrapper">

        <div class="content-wrapper">
            <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">Atribuir Limite de Crédito</h1>
                            <button type="button" class="btn btn-info btn-sm ml-2" title="Tutorial" style="color: white;" id="tutorial">
                                <i class="fas fa-question-circle"></i></button>
                        </div>
                        <div class="col-sm-6">
                        </div>
                    </div>
                </div>
                <div class="container-fluid card">
                    <div class="row card-body" id="abaGeral">
                        <div class="col-lg-12 form-group">
                            <button class="btn btn-success btn-sisp" id="btnFiltros"><span class="fas fa-search"></span> Filtros</button>
                            <button id="btnImprimir" class="btn-sisp btn btn-danger ml-2"><i class="fas fa-print"></i> Imprimir</button>
                        </div>

                        <div class="col-lg-12 col-sm-12 col-md-12 card-body pt-0 pb-0">
                            <div class="row">
                                <div class="col-4" id="TipoInfoTour">
                                    <label data-error="wrong" data-success="right" for="txtClienteConsulta">Cliente: </label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" readonly disabled id="txtClienteConsulta" name="txtClienteConsulta" placeholder="Cliente">
                                    </div>
                                </div>
                                <div class="col-8">
                                    <div class="row">
                                        <div class="col-2" id="TipoInfoTour">
                                            <label data-error="wrong" data-success="right" for="txtRendaBruta">Renda Bruta: </label>
                                            <div class="input-group">
                                                <input type="text" class="input-default focus form-control inputValor" readonly disabled id="txtRendaBruta" name="txtRendaBruta" placeholder="Renda Bruta">
                                            </div>
                                        </div>
                                        <div class="col-2" id="TipoInfoTour">
                                            <label data-error="wrong" data-success="right" for="txtLimiteMaxUsuario">Limite Max. Usuário: </label>
                                            <div class="input-group">
                                                <input type="text" class="input-default focus form-control inputValor" readonly disabled id="txtLimiteMaxUsuario" name="txtLimiteMaxUsuario" placeholder="Limite Max. Usuário">
                                            </div>
                                        </div>
                                        <div class="col-2" id="TipoInfoTour">
                                            <label data-error="wrong" data-success="right" for="txtNota">Nota: </label>
                                            <div class="input-group">
                                                <input type="text" class="input-default focus form-control inputValor" readonly disabled id="txtNota" name="txtNota" placeholder="Nota">
                                            </div>
                                        </div>
                                        <div class="col-2" id="TipoInfoTour">
                                            <label data-error="wrong" data-success="right" for="txtLimiteAnterior">Limite Anterior: </label>
                                            <div class="input-group">
                                                <input type="text" class="input-default focus form-control inputValor" readonly disabled id="txtLimiteAnterior" name="txtLimiteAnterior" placeholder="Limite Anterior">
                                            </div>
                                        </div>
                                        <div class="col-2" id="TipoInfoTour">
                                            <label data-error="wrong" data-success="right" for="txtLimiteCalculado">Limite Calculado: </label>
                                            <div class="input-group">
                                                <input type="text" class="input-default focus form-control inputValor" readonly disabled id="txtLimiteCalculado" name="txtLimiteCalculado" placeholder="Limite Calculado">
                                            </div>
                                        </div>
                                        <div class="col-2" id="TipoInfoTour">
                                            <label data-error="wrong" data-success="right" for="txtLimiteNovo">Limite Novo: </label>
                                            <div class="input-group">
                                                <input type="text" class="input-default focus form-control inputValor" id="txtLimiteNovo" name="txtLimiteNovo" placeholder="Limite Novo">
                                                <input type="text" class="input-default focus form-control d-none " id="txtRowIndex" name="txtRowIndex">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row mt-2">
                                <div class="col-xl-12 col-12 from-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtObs">Observação:</label>
                                    <div class="input-group">
                                        <textarea class="input-default focus form-control create" id="txtObs" name="txtObs" placeholder="Observação" rows="3" cols="50" style="resize: none;"></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="col-sm-6 table-responsive card-body">
                            <h5>Clientes</h5>
                            <table id="tabelaCliente" class="table table-sm table-select table-hover" width="100%" style="white-space: nowrap;">
                                <thead>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                        </div>

                        <div class="col-sm-6 table-responsive card-body">
                            <h5>Apuração Fatores</h5>
                            <table id="tabelaApuracao" class="table table-sm table-select table-hover" width="100%" style="white-space: nowrap;">
                                <thead>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                        </div>

                        <div class="col-sm-12 d-flex justify-content-end mt-2">
                            <button id="btnConfirmar" class="btn btn-danger btn-sisp">Confirmar</button>
                        </div>

                    </div>
                </div>
            </div>
            <!-- modal  -->
        </div>
    </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-4" id="TipoInfoTour">
                            <label data-error="wrong" data-success="right" for="txtUsuario">Usuário: </label>
                            <div class="input-group">
                                <input type="text" class="input-default focus form-control" id="txtUsuario" name="txtUsuario" placeholder="Usuário">
                                <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnUsuario" name="btnUsuario" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaUsuario" name="btnLimpaUsuario" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                            </div>
                        </div>

                        <div class="col-4" id="TipoInfoTour">
                            <label data-error="wrong" data-success="right" for="txtCliente">Cliente: </label>
                            <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtCliente" name="txtCliente" multiple="multiple"></select>
                                <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnCliente" name="btnCliente" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaCliente" name="btnLimpaCliente" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                            </div>
                        </div>
                        <div class="col-4" id="TipoInfoTour">
                            <label data-error="wrong" data-success="right" for="txtTabuf">Uf: </label>
                            <div class="input-group">
                                <select class="js-example-programmatic js-states form-control" id="txtTabuf" name="txtTabuf" multiple="multiple"></select>
                                <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnTabuf" name="btnTabuf" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaTabuf" name="btnLimpaTabuf" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-xl-4 col-12 form-group">
                            <label data-error="wrong" data-success="right" for="txtRendaDe">Renda de/até: </label>
                            <div class="relative">
                                <div class="input-group">
                                    <input type="text" class="input-default focus form-control inputValor" id="txtRendaDe" name="txtRendaDe" class="form-control">
                                    <input type="text" class="input-default focus form-control inputValor" id="txtRendaAte" name="txtRendaAte" class="form-control">
                                </div>
                            </div>
                        </div>
                        <div class="col-xl-4 col-12 form-group">
                            <label data-error="wrong" data-success="right" for="txtLimiteDe">Limite de/até: </label>
                            <div class="relative">
                                <div class="input-group">
                                    <input type="text" class="input-default focus form-control inputValor" id="txtLimiteDe" name="txtLimiteDe" class="form-control">
                                    <input type="text" class="input-default focus form-control inputValor" id="txtLimiteAte" name="txtLimiteAte" class="form-control">
                                </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>
    <?php
    include_once('../../modais.php');
    ?>
    <aside class="control-sidebar control-sidebar-dark">
    </aside>
    </div>
    <script src="plugins/jquery/jquery.min.js?versao=3.255.7.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.255.7.1"></script>
    <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.255.7.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.255.7.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.255.7.1"></script>
    <script src="dist/js/cliente/entidade.js?versao=3.255.7.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/valida_cpf_cnpj.js?versao=3.255.7.1"></script>
    <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/sisplan.js?versao=3.255.7.1"></script>
    <script src="utils/funcoes.js?versao=3.255.7.1"></script>
    <script src="utils/cookies.js?versao=3.255.7.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/driver.min.js?versao=3.255.7.1"></script>
    <script src="dist/js/dataTables.keyTable2.js?versao=3.255.7.1"></script>
    <script type="text/javascript" src="config.js?versao=3.255.7.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('ATRIBUILIMITECRED');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            sArquivo = `${BASE_URI}/pages/atribuilimitecred/atribuilimitecred.js?versao=3.255.7.1`;
            insereJavaScriptPagina(sArquivo);

        });
    </script>
</body>

</html>