<!DOCTYPE html>
<html lang="pt">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';">
   <!--<link href="images/logo/<?php echo $rows[9]['valor']; ?>" rel="icon">-->
  <title>Buesimples | Área do Gestor</title>
  <link rel="stylesheet" href="template/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="template/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" href="template/plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="template/plugins/fontawesome-free/css/all.min.css">
  <!-- daterange picker -->
  <link rel="stylesheet" href="template/plugins/daterangepicker/daterangepicker.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="template/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="template/plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
  <!-- Tempusdominus Bootstrap 4 -->
  <link rel="stylesheet" href="template/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="template/plugins/select2/css/select2.min.css">
  <link rel="stylesheet" href="template/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
  <!-- Bootstrap4 Duallistbox -->
  <link rel="stylesheet" href="template/plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
  <!-- BS Stepper -->
  <link rel="stylesheet" href="template/plugins/bs-stepper/css/bs-stepper.min.css">
  <!-- dropzonejs -->
  <link rel="stylesheet" href="template/plugins/dropzone/min/dropzone.min.css">
  <link rel="stylesheet" href="template/plugins/toastr/toastr.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="template/dist/css/adminlte.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
  <style>
    #swal2-title {
      display: flex !important;
      flex-direction: column;
      align-items: center;
    }
  </style>
</head>
<style type="text/css">
  .logo img {
    width: 150px;
  }
</style>

<body class="hold-transition login-page" style="margin: 0; overflow: hidden;">
  <div id="particles-js"></div>
  <div class="login-box" id="caixa-login">
    <div class="card card-body">
      <!-- /.login-logo -->
      <div class="login-logo logo" style="padding-top: 20px;">
        <img style="width: 80%;" src="images/logo/logo.svg" alt="Imagem Buesimples" class="brand-image">
      </div>
      <div class="card-body login-card-body">
        <form action="includes/login.inc.php" method="post">
          <p class="login-box-msg">Login</p>
          <div class="input-group mb-3">
            <input type="text" class="form-control" placeholder="Nome de usuário / E-mail" name="nomeUsuarioEmail" id="nomeUsuarioEmail">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-user"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="password" class="form-control" placeholder="Palavra-passe" name="senha" id="senha">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-lock"></span>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-md-12">
              <button type="submit" name="btn-submit" id="btn-submit" class="btn btn-block btn-primary" style="background-color: #560085; border-color: #560085;">Login</button>
            </div>
          </div>
          <p class="mb-1">
            <a href="#" style="color: #666;    display: flex; justify-content: center; color: #666; padding-top: .5rem;">Esqueci-me da palavra-passe!</a>
          </p>
        </form>
      </div>
    </div>
  </div>
  <!-- /.login-box -->
  <!-- jQuery -->
  <script src="template/plugins/jquery/jquery.min.js"></script>
  <!-- Bootstrap 4 -->
  <script src="template/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <!-- AdminLTE App -->
  <script src="template/dist/js/adminlte.min.js"></script>
  <script src="template/plugins/toastr/toastr.min.js"></script>
  <script src="./template/dist/js/sweetalert2.min.js"></script>
  <script src="./template/dist/js/particles.min.js"></script>
  <script src="./template/dist/js/app.js"></script>
  <script src="./javascript/function.js"></script>
  <script>
    $(function() {
      $('.toastrDefaultSuccess').click(function() {
        toastr.success('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
      });
      $('.toastrDefaultInfo').click(function() {
        toastr.info('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
      });
      $('.toastrDefaultError').click(function() {
        toastr.error('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
      });
      $('.toastrDefaultWarning').click(function() {
        toastr.warning('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.')
      });
    });

    let btn = document.getElementById("btn-submit");
    btn.addEventListener("click", function(e) {
      e.preventDefault();
      funcaoLogin("includes/login.inc.php", "post", "json", "viewusuariotipo", {
          nomeUsuario: nomeUsuarioEmail.value,
          senha: senha.value
        }, function success(data) {
          if (data == "semSenha") {
            toastr.info('Coloque o Código que enviamos ao seu E-mail para validar a sua conta.');
          } else if (data == "credenciaisInvalidas") {
            console.log("Credênciais Invalidas");
            toastr.error('Nome de usuário/E-mail e ou senha inválidos.');
          } else if (data == "success") {
            toastr.success('Login Efectuado com sucesso.')

            function login() {
              window.location.href = "pos.php";
            }
            setTimeout(login, 500);
          }
        }, function error(data) {

        }, function done(data) {

        });
    });
  </script>
</body>

</html>