<?php
session_start();
?>

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

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>Masuk | Portal UMKM</title>
  <meta content="" name="description">
  <meta content="" name="keywords">
  <meta name="robots" content="noindex">

  <!-- Favicons -->
  <link href="../assets//img/favicon.png" rel="icon">
  <link href="../assets//img/apple-touch-icon.png" rel="apple-touch-icon">

  <!-- Google Fonts -->
  <link href="https://fonts.gstatic.com" rel="preconnect">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">

  <!-- Vendor CSS Files -->
  <link href="../assets//template/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="../assets//template/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
  <link href="../assets//template/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <link href="../assets//template/vendor/quill/quill.snow.css" rel="stylesheet">
  <link href="../assets//template/vendor/quill/quill.bubble.css" rel="stylesheet">
  <link href="../assets//template/vendor/remixicon/remixicon.css" rel="stylesheet">
  <link href="../assets//template/vendor/simple-datatables/style.css" rel="stylesheet">

  <!-- Template Main CSS File -->
  <link href="../assets//template/css/style.css" rel="stylesheet">

</head>

<body>

  <main>
    <div class="container">

      <section class="section register min-vh-100 d-flex flex-column align-items-center justify-content-center py-4">
        <div class="container">
          <div class="row justify-content-center">
            <div class="col-lg-4 col-md-6 d-flex flex-column align-items-center justify-content-center">

              <div class="d-flex justify-content-center py-4">
                <a href="/" class="logo d-flex align-items-center w-auto">
                  <img src="../assets//img/logo.png" alt="">
                  <span class="d-none d-lg-block">Portal UMKM</span>
                </a>
              </div><!-- End Logo -->

              <div class="card mb-3">

                <div class="card-body">

                  <div class="pt-4 pb-2">
                    <h5 class="card-title text-center pb-0 fs-4">Selamat Datang!</h5>
                    <p class="text-center small">Masukkan email dan kata sandi untuk masuk</p>
                  </div>

                  <?php if (isset($_SESSION['success'])): ?>
                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                      <?= $_SESSION['success']; ?>
                      <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                    <?php unset($_SESSION['success']); ?>
                  <?php endif; ?>

                  <?php if (isset($_SESSION['error'])): ?>
                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                      <?= $_SESSION['error']; ?>
                      <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                    <?php unset($_SESSION['error']); ?>
                  <?php endif; ?>

                  <form class="row g-3 needs-validation" action="auth.php" method="POST" novalidate>

                    <div class="col-12">
                      <label for="yourUsername" class="form-label">Email<span class="text-danger">*</span></label>
                        <input type="email" name="username" class="form-control" id="username" required>
                        <div class="invalid-feedback">Silakan masukkan alamat email.</div>
                     </div>

                                       <div class="col-12">
                      <label for="yourPassword" class="form-label">Kata Sandi<span class="text-danger">*</span></label>
                      <div class="input-group">
                        <input type="password" name="password" class="form-control" id="password" required>
                        <span class="input-group-text" onclick="togglePassword()" style="cursor: pointer;">
                          <i class="fa fa-eye" id="togglePasswordIcon"></i>
                        </span>
                      </div>
                      <div class="invalid-feedback">Silakan masukkan kata sandi!</div>
                    </div>

                    <div class="col-12">
                      <div class="form-check">
                        <input class="form-check-input" type="checkbox" name="remember" value="true" id="rememberMe">
                        <label class="form-check-label" for="rememberMe">Ingatkan Saya</label>
                      </div>
                    </div>
                    <div class="col-12">
                      <button class="btn btn-primary w-100 rounded-pill" type="submit">Masuk</button>
                    </div>
                    <div class="col-12">
                      <p class="small mb-0">Lupa Kata Sandi? <a href="../lupa-password">Klik Disini</a></p>
                      <p class="small mb-0">Belum Punya Akun? <a href="../register">Buat Sekarang</a></p>
                    </div>
                  </form>

                </div>
              </div>

             

            </div>
          </div>
        </div>

      </section>

    </div>
  </main><!-- End #main -->

  <a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

  <!-- Vendor JS Files -->
  <script src="../assets//template/vendor/apexcharts/apexcharts.min.js"></script>
  <script src="../assets//template/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="../assets//template/vendor/chart.js/chart.umd.js"></script>
  <script src="../assets//template/template/vendor/echarts/echarts.min.js"></script>
  <script src="../assets//template/vendor/quill/quill.js"></script>
  <script src="../assets//template/vendor/simple-datatables/simple-datatables.js"></script>
  <script src="../assets//template/vendor/tinymce/tinymce.min.js"></script>
  <script src="../assets//template/vendor/php-email-form/validate.js"></script>

  <!-- Template Main JS File -->
  <script src="../assets//template/js/main.js"></script>
  
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">

  <script>
  function togglePassword() {
    const passwordInput = document.getElementById('password');
    const toggleIcon = document.getElementById('togglePasswordIcon');
    const isPassword = passwordInput.type === 'password';
    passwordInput.type = isPassword ? 'text' : 'password';
    toggleIcon.classList.toggle('fa-eye');
    toggleIcon.classList.toggle('fa-eye-slash');
  }
  </script>


</body>

</html>