<?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 | Cadastro de Cor Compra</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.255.15.1">
    <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.255.15.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.15.1" />
    <link href='../dist/css/bootstrap.min.css?versao=3.255.15.1'>
    <link rel="stylesheet" href="../dist/css/custom.css?versao=3.255.15.1">
    <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.255.15.1">
    <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.255.15.1">
    <link rel="stylesheet" type="text/css" href="../dist/css/responsive.bootstrap.min.css?versao=3.255.15.1">
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../dist/css/cadastro.css?versao=3.255.15.1">

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

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

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

        .border-Field {
            border: 1px solid var(--font-color) !important;
            padding: 0 1.0em 0 1.0em !important;
            margin: 0 0 0 0 !important;
            -webkit-box-shadow: 0px 0px 0px 0px #000;
            box-shadow: 0px 0px 0px 0px #000;
            border-radius: 3px !important;
        }

        .card {
            padding: 1.5rem;
            border-top: 2px outset #ddd;
            box-shadow: none !important;
            margin-top: 20px;
            padding-top: 20px;
        }

        #tabelaCorCompra tbody td {
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            padding: 0.1rem !important;
            padding-left: 10px !important;
        }

        .main-header,
        .main-sidebar,
        footer {
            display: none;
        }

        .content-wrapper {
            margin-left: 0px !important;
        }

        #btnConfirmar {
            border-radius: 0 .25rem .25rem 0;
        }

        #btnConsultar {
            border-radius: .25rem;
        }

        .theme-dark {
            --corLinha: rgba(40, 167, 69, 1);
        }

        .theme-light {
            --corLinha: rgba(125, 233, 150, 1);
        }

        .btn-desabilitado {
            opacity: 0.5;
            pointer-events: none;
        }

        .table.dataTable tbody td,
        .table.dataTable thead {
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }

        .table.dataTable tr td,
        .table.dataTable tr td,
        .table.dataTable th {
            padding: 4px 12px;
        }
    </style>
</head>

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

        <div class="content-wrapper">
            <section class="content">
                <div class="content-header">
                    <div class="container-fluid">
                        <div class="row mb-2">
                            <div class="col-sm-6 flex">
                            </div>
                            <div class="col-sm-6">
                            </div><!-- /.col -->
                            <div class="container-fluid" id="grad1">
                                <div class="row justify-content-center mt-0">
                                    <div class="col-12">
                                        <div class="card mb-0">
                                            <div class="card-header" style="border: none!important;box-shadow:none!important;">
                                                <h2 class="m-0">Cadastro de Cor Compra
                                                    <button title="Tutorial" type="button" class="btn btn-info btn-sm ml-2" style="color: white;" id="tutorial">
                                                        <i class="fas fa-question-circle"></i>
                                                    </button>
                                                </h2>
                                            </div>
                                            <div class="container-fluid">
                                                <div class="row card-body" id="abaGeral">
                                                    <div id="tutorialFiltros" class="row card-body">

                                                        <div class="row col-12">
                                                            <div class="col-sm-auto form-group d-flex" id="divTipoItem">
                                                                <fieldset class="w-100 form border-Field mb-0 pb-0">
                                                                    <legend class="textoBorda mb-0 pb-0">Tipo Item</legend>
                                                                    <div class="d-flex">
                                                                        <div class="icheck-primary"><input type="radio" checked id="rdMaterial" name="tipoItem"><label class="container p-0 m-0" for="rdMaterial">Material </label></div>
                                                                        <div class="icheck-primary ml-3"><input type="radio" id="rdProduto" name="tipoItem"><label class="container p-0 m-0" for="rdProduto">Produto</label></div>
                                                                    </div>
                                                                </fieldset>
                                                            </div>
                                                        </div>

                                                        <div class="row col-12" id="divDadosGerais">
                                                            <div class="col-lg form-group">
                                                                <label data-error="wrong" data-success="right" for="txtFornecedor">Fornecedor: </label>
                                                                <div class="input-group">
                                                                    <input type="text" class="input-default focus form-control" id="txtFornecedor" name="txtFornecedor" class="form-control" placeholder="Fornecedor">
                                                                    <div class="input-group-append">
                                                                        <button class="btn bg-danger" id="btnFornecedor" name="btnFornecedor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                                        <button class="btn bg-danger" id="btnLimpaFornecedor" name="btnLimpaFornecedor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                                    </div>
                                                                </div>
                                                            </div>



                                                            <div class="col-lg form-group" id="divMaterial">
                                                                <label data-error="wrong" data-success="right" for="txtMaterial">Material: </label>
                                                                <div class="input-group">
                                                                    <input type="text" class="input-default focus form-control" id="txtMaterial" name="txtMaterial" class="form-control" placeholder="Material">
                                                                    <div class="input-group-append">
                                                                        <button class="btn bg-danger" id="btnMaterial" name="btnMaterial" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                                        <button class="btn bg-danger" id="btnLimpaMaterial" name="btnLimpaMaterial" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="col-lg form-group d-none" id="divProduto">
                                                                <label data-error="wrong" data-success="right" for="txtProduto">Produto: </label>
                                                                <div class="input-group">
                                                                    <input type="text" class="input-default focus form-control" id="txtProduto" name="txtProduto" class="form-control" placeholder="Produto">
                                                                    <div class="input-group-append">
                                                                        <button class="btn bg-danger" id="btnProduto" name="btnProduto" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                                                        <button class="btn bg-danger" id="btnLimpaProduto" name="btnLimpaProduto" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="col-lg-auto form-group">
                                                                <label data-error="wrong" data-success="right" for="">  </label>
                                                                <div class="input-group">
                                                                    <div class="input-group-append">
                                                                        <button class="btn btn-primary btn-sisp" id="btnConsultar"><span class="fas fa-search mr-2"></span>Consultar</button>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                        </div>

                                                        <div class="row col-12 justify-content-end">

                                                            <div class="col-auto  form-group">
                                                                <label data-error="wrong" data-success="right" for="txtValor">Valor:</label>
                                                                <div class="input-group">
                                                                    <input type="text" min="0" class="input-default focus form-control" id="txtValor" name="txtValor" placeholder="0.00" maxlength="8">
                                                                    <button class="btn btn-danger btn-sisp" id="btnConfirmar">Confirmar</button>
                                                                </div>
                                                            </div>
                                                        </div>

                                                    </div>


                                                    <div class="card col-sm-12 table-responsive card-body" id="tutorialTabelaSolicitacoes">
                                                        <div class="d-flex justify-content-between">
                                                            <h5 class="col-12 col-lg-3">Tabela Cor Compra</h5>
                                                            <div class="d-flex col-12" style="max-width: 283px;">
                                                                <span style="display: inline-block; min-width: 25px; height: 25px; background-color:var(--corLinha);margin-top: .3rem;"></span>
                                                                <p class="ml-2 mb-0">Registros do Cadastro de Cor que serão gravados no Cadastro de cor Tinturaria. </p>

                                                            </div>
                                                        </div>
                                                        <table id="tabelaCorCompra" class="table table-select table-hover" width="100%" style="min-height: 60px">
                                                        </table>
                                                    </div>

                                                    <div class="col-sm-12 d-flex justify-content-end">
                                                        <button id="btnVoltar" class="btn btn-secondary btn-sisp mr-2">Voltar</button>
                                                        <button id="btnGravar" class="btn btn-danger btn-sisp">Gravar</button>
                                                    </div>

                                                </div>

                                            </div>
                                        </div>


                                    </div>
                                </div>
                            </div>
                        </div>
            </section>
        </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.15.1"></script>
    <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.255.15.1"></script>
    <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.255.15.1"></script>
    <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.255.15.1"></script>
    <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.255.15.1"></script>
    <script src="../plugins/toastr/toastr.min.js?versao=3.255.15.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.255.15.1"></script>
    <script src="../dist/js/adminlte.min.js?versao=3.255.15.1"></script>
    <script src="../dist/js/requisicoes.js?versao=3.255.15.1"></script>
    <script src="../dist/js/cliente/entidade.js?versao=3.255.15.1"></script>
    <script src="../dist/js/loadingoverlay.min.js?versao=3.255.15.1"></script>
    <script src="../dist/js/valida_cpf_cnpj.js?versao=3.255.15.1"></script>
    <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.255.15.1"></script>
    <script src="../dist/js/sisplan.js?versao=3.255.15.1"></script>
    <script src="../utils/funcoes.js?versao=3.255.15.1"></script>
    <script src="../dist/js/driver.min.js?versao=3.255.15.1"></script>
    <script src="../dist/js/jquery.maskMoney.min.js?versao=3.255.15.1"></script>
    <script src="../utils/cookies.js?versao=3.255.15.1"></script>
    <script src="../dist/js/dataTables.keyTable2.js?versao=3.255.15.1"></script>
    <script type="text/javascript" src="../config.js?versao=3.255.15.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('CORCOMPRA');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            const permissaoUsuarioLogado = await permissaoAcessos("CORCOMPRA");

            if (permissaoUsuarioLogado.INCLUI == 'N') {
                await criaMensagemErro("Sem permissão para incluir!", () => {
                    window.location.href = `${BASE_URI}/corcompra`
                });
                return;
            }

            const queryString = window.location.href;
            const parametros = queryString.split("/");
            const situacao = parametros[parametros.length - 1];

            $(window).on("beforeunload", function(e) {
                // e.preventDefault();
                e.stopPropagation();
                deletaRegistro("CORCOMPRA", getCookie("usuario"), situacao);
                return undefined;
            });

            sArquivo = `${BASE_URI}/pages/corcompra/cadastro_corcompra/corcompra.js?versao=3.255.15.1`;
            insereJavaScriptPagina(sArquivo);

            const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');
            habilitaCamposObrigatoriosTela(nomeTela);
        });
    </script>
</body>

</html>