<?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 Cotação de Moeda</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.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" 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/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">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <style>
    .bordaRadio,
    .bordaCheckbox {
      border: 2px solid #e0e4e6;
      border-radius: 4px;
      padding: 10px 15px 0 10px;
    }

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

    .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;
    }

    #progressbar li {
      list-style-type: none;
      font-size: 12px;
      width: 100%;
      float: left;
      position: relative;
    }

    #tabelaCadastroCotacao td div button {
      padding: .0rem .5rem;
      margin-top: .1rem;
      margin-bottom: .2rem;
    }

    #tabelaCadastroCotacao td {
      padding: 0 !important;
      padding-left: 10px !important;
    }

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

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

    #defineMes {
      color: red;
      font-size: 1.2em;
      margin-top: 2.9rem;
      cursor: pointer;
    }

    #defineMes:hover {
      color: #731212;
    }

    .btnAzul {
      width: 100px;
      background: var(--blue);
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px;
    }

    .btnAzul:hover {
      box-shadow: 0 0 0 2px white, 0 0 0 3px var(--blue);
    }

    .btnVermelho {
      width: 100px;
      background: var(--primary-color);
      font-weight: bold;
      color: white;
      border: 0 none;
      border-radius: 0px;
      cursor: pointer;
      padding: 10px 5px;
      margin: 10px 5px;
    }

    .btnVermelho:hover {
      box-shadow: 0 0 0 2px white, 0 0 0 3px var(--primary-color);
    }
    .infoValor {
      padding: 0.15rem .25rem;
      font-size: .575rem;
      line-height: 0.1;
      border-radius: .2rem;
    }
  </style>
</head>

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


    <div id="myModal" class="modal" tabindex="-1" role="dialog">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 id="myModalLabel" class="modal-title"></h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <p id="myModalText"></p>
          </div>
          <div class="modal-footer">
            <button id="btnYes" type="button" class="btn btn-primary">Sim</button>
            <button id="btnNo" type="button" class="btn btn-secondary" data-dismiss="modal">Não</button>
          </div>
        </div>
      </div>
    </div>
    <div class="wrapper">
      <div id="myModal" class="modal" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 id="myModalLabel" class="modal-title"></h5>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body">
              <p id="myModalText"></p>
            </div>
            <div class="modal-footer">
              <button id="btnYes" type="button" class="btn btn-primary">Sim</button>
              <button id="btnNo" type="button" class="btn btn-secondary" data-dismiss="modal">Não</button>
            </div>
          </div>
        </div>
      </div>
      <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"></h1>
              </div>
              <div class="col-sm-6">
              </div>
            </div>
          </div>
          <div class="row justify-content-center mt-0">
            <div class="col-10 text-center p-0 mt-3 mb-2">
              <div class="card px-0 pt-4 pb-0 mt-3 mb-3" style="border-top:0">
                <div class="card-header text-center flex" style="border: none!important;box-shadow:none!important;">
                  <h2> Cotação de Moeda
                    <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>
                  </h2>
                </div>
                <div class="row">
                  <div class="col-md-12 mx-0 mb-3">
                    <form id="msform">
                      <ul id="progressbar">
                        <li class="active" id="account"><strong>Geral</strong></li>
                      </ul>
                      <p>Preencha os dados e clique em gravar para realizar o cadastro ou alteração da Cotação de Moeda.</p>
                      <fieldset class="row justify-content-center mt-5">
                        <div class="col-10 text-left">

                          <div class="row">
                            <div class="col-xl-4 col-lg  col-12 mt-2">
                              <label data-error="wrong" data-success="right" for="txtDataIni">Data da Cotação de/até: </label>
                              <div class="relative">
                                <div class="input-group">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control mr-1" id="txtDataIni" value="<?php echo date('Y-m-d') ?>" name="txtDataIni" class="form-control">
                                  <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDataFim" value="<?php echo date('Y-m-d'); ?>" name="txtDataFim" class="form-control">
                                </div>
                              </div>
                            </div>

                            <div class="col-xl-2 col-lg col-sm-11  col-10 mt-2">
                              <label data-error="wrong" data-success="right" for="txtDataIni">Definir por Mês: </label>
                              <div class="input-group">
                                <select style="width:100%;" class="form-control select2 select2-danger focus" data-dropdown-css-class="select2-danger" id="slMes" class="custom-select focus">
                                  <option value="" selected hidden disabled>- Selecione -</option>
                                  <option value="1" id="slJaneiro">JANEIRO</option>
                                  <option value="2" id="slFevereiro">FEVEREIRO</option>
                                  <option value="3" id="slMarco">MARÇO</option>
                                  <option value="4" id="slAbril">ABRIL</option>
                                  <option value="5" id="slMaio">MAIO</option>
                                  <option value="6" id="slJunho">JUNHO</option>
                                  <option value="7" id="slJulho">JULHO</option>
                                  <option value="8" id="slAgosto">AGOSTO</option>
                                  <option value="9" id="slSetembro">SETEMBRO</option>
                                  <option value="10" id="slOutubro">OUTUBRO</option>
                                  <option value="11" id="slNovembro">NOVEMBRO</option>
                                  <option value="12" id="slDezembro">DEZEMBRO</option>
                                </select>
                              </div>
                            </div>
                            <div class="col-auto">
                              <span class="fas fa-check ml-1" id="defineMes" title="Confirmar">
                            </div>
                          </div>

                          <div class="row">
                            <div class="col-xl-8 col-12 mt-2" id="MarcaInfoTour">
                              <label data-error="wrong" data-success="right" for="txtConsultaMoeda">Moeda:</label>
                              <div class="input-group">
                                <input type="text" autocomplete="off" class="input-default focus form-control" id="txtConsultaMoeda" name="txtConsultaMoeda" class="form-control" placeholder="01" maxlength="2">
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnConsultaMoeda" name="btnConsultaMoeda" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                  <button class="btn bg-danger" id="btnLimpaMoeda" name="btnLimpaMoeda" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>
                            <div class="col-xl-2  col-12 form-group mt-2">
                              <label data-error="wrong" data-success="right" for="txtValorCompra">Valor Compra:
                                <span type="button" class="btn btn-info ml-2 infoValor" style="color: white;" title="Para garantir a exatidão necessária em transações financeiras, os campos de valores apresentam quatro dígitos decimais após o ponto.">
                                  <i class="fas fa-question-circle"></i>
                                </span>
                              </label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control" id="txtValorCompra" name="txtValorCompra" class="form-control" placeholder="1.0" min="0">
                              </div>
                            </div>
                            <div class="col-xl-2  col-12 form-group mt-2">
                              <label data-error="wrong" data-success="right" for="txtValorVenda">Valor Venda:
                                <span type="button" class="btn btn-info ml-2 infoValor" style="color: white;" title="Para garantir a exatidão necessária em transações financeiras, os campos de valores apresentam quatro dígitos decimais após o ponto.">
                                  <i class="fas fa-question-circle"></i>
                                </span>
                              </label>
                              <div class="input-group">
                                <input type="text" class="input-default focus form-control" id="txtValorVenda" name="txtValorVenda" placeholder="1.0" min="0">
                              </div>
                            </div>
                          </div>
                          <div class="row justify-content-end">
                            <button type="button" id="btnBC" style="font-size:15px;" class="btn-sisp btnAzul"><span class="fas fa-dollar-sign mr-2"></span>Importar BC</button>
                            <button type="button" id="btnConfirmar" style="font-size:15px;" class="btn-sisp action-button">Confirmar</button>
                          </div>

                          <div class="col-sm-12 table-responsive card divCadastroCotacao" style="max-height: 633px">
                            <table id="tabelaCadastroCotacao" class="table table-responsive-sm table-select table-hover" width="100%">
                              <thead>
                                <tr>
                                  <th>Moeda</th>
                                  <th>Descrição</th>
                                  <th>Valor Compra</th>
                                  <th>Valor Venda</th>
                                  <th>Data</th>
                                </tr>
                              </thead>
                              <tbody>
                              </tbody>
                            </table>
                          </div>

                        </div>
                      </fieldset>
                      <input type="button" name="btnGravar" id="btnGravar" class="btn-sisp action-button" value="Gravar" />
                      <button type="button" id="btnVoltar" style="font-size:15px;" class="btn-sisp action-button-previous" data-dismiss="modal">Voltar</button>
                    </form>
                  </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div id="modalBancoCentral" class="modal" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-lg" 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 justify-content-end">
              <div class="col-lg-8 col-sm-12 col-12 mt-2">
                <label data-error="wrong" data-success="right" for="txtDataIniModalBC">Data da Cotação de/até: </label>
                <div class="relative">
                  <div class="input-group">
                    <input type="date" max="2500-12-31" class="input-default focus form-control mr-1" id="txtDataIniModalBC" name="txtDataIniModalBC" class="form-control">
                    <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDataFimModalBC" name="txtDataFimModalBC" class="form-control">
                  </div>
                </div>
              </div>
              <div class="col-12 col-lg-4 mt-2" id="MarcaInfoTour">
                <label data-error="wrong" data-success="right" for="txtConsultaMoeda">Moeda:</label>
                <div class="input-group">
                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtConsultaMoedaBC" name="txtConsultaMoedaBC" class="form-control" placeholder="01" maxlength="2">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnConsultaMoedaBC" name="btnConsultaMoedaBC" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaMoedaBC" name="btnLimpaMoedaBC" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
              <div class="row">
                <button type="button" id="btnConsultarBC" style="font-size:15px;" class="btnAzul mr-3 mt-4">Consultar</button>
              </div>

              <div class="col-sm-12 table-responsive card divCadastroCotacao" style="max-height: 633px">
                <table id="tabelaCotacaoBC" class="table table-responsive-sm table-select table-hover" width="100%">
                  <thead>
                    <tr>
                      <th>Data</th>
                      <th>Valor Compra</th>
                      <th>Valor Venda</th>
                      <th>Cotação Oficial</th>
                    </tr>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <div class="row">
              <button class="btnVermelho" id="btnConfirmarBC"></span>Confirmar</button>
            </div>
          </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"></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('COTACAO_MOEDA');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

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

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

    });
  </script>
</body>

</html>