<?php include __DIR__ . '/../../views/layouts/header.php'; ?>
<div class="wrapper">
<?php include __DIR__ . '/../../views/layouts/sidebar.php'; ?>
<div class="main-content">
<?php include __DIR__ . '/../../views/layouts/topbar.php'; ?>
<div class="page-content">
  <div class="page-header">
    <h1><i class="bi bi-key me-2 text-primary"></i>Ubah Sandi</h1>
  </div>

  <?php if ($flash): ?>
  <div class="alert alert-<?= $flash['type'] ?> alert-auto-dismiss alert-dismissible fade show">
    <i class="bi bi-check-circle-fill me-2"></i><?= e($flash['message']) ?>
    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
  </div>
  <?php endif; ?>

  <?php if (!empty($errors)): ?>
  <div class="alert alert-danger"><ul class="mb-0"><?php foreach ($errors as $e): ?><li><?= e($e) ?></li><?php endforeach; ?></ul></div>
  <?php endif; ?>

  <div class="row justify-content-center">
    <div class="col-12 col-md-6 col-lg-5">
      <div class="card">
        <div class="card-header"><h6>Form Ubah Password</h6></div>
        <div class="card-body">
          <form method="POST" class="needs-validation" novalidate>
            <input type="hidden" name="csrf_token" value="<?= e($csrfToken) ?>">
            <div class="mb-3">
              <label class="form-label">Password Lama <span class="text-danger">*</span></label>
              <input type="password" class="form-control" name="sandi_lama" required autocomplete="current-password">
            </div>
            <div class="mb-3">
              <label class="form-label">Password Baru <span class="text-danger">*</span></label>
              <input type="password" class="form-control" name="sandi_baru" required
                     minlength="6" autocomplete="new-password">
              <div class="form-text">Minimal 6 karakter</div>
            </div>
            <div class="mb-4">
              <label class="form-label">Konfirmasi Password Baru <span class="text-danger">*</span></label>
              <input type="password" class="form-control" name="konfirmasi" required autocomplete="new-password">
            </div>
            <button type="submit" class="btn btn-primary w-100">
              <i class="bi bi-key me-1"></i> Ubah Password
            </button>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<?php include __DIR__ . '/../../views/layouts/footer.php'; ?>
</div>
</div>
