<?php

use App\Models\UserModel;

/**
 * @var UserModel $user
 */


?>

<div class="container">
  <div class="card">
    <div class="card-body">

      <!-- Header -->
      <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
          <h5 class="mb-1">
            <i class="bi bi-key"></i>
            Ubah Password
          </h5>
          <small class="text-muted">
            Silahkan isi form dibawah ini untuk mengubah password pengguna.
          </small>
        </div>
        <a
          href="<?= url('MANAJEMEN_USER') ?>"
          class="btn btn-link">
          <i class="bi bi-arrow-left"></i>
          Kembali
        </a>
      </div>

      <form method="POST" action="<?= url('UBAH_PASSWORD', ['id' => $user->getId()]) ?>">

        <input type="hidden" name="id" value="<?= $user->getId() ?>">

        <div class="alert alert-info">
          <i class="bi bi-info-circle"></i>
          Anda akan mengubah password untuk pengguna berikut.
        </div>

        <div class="mb-3">
          <label class="form-label">Nama Pengguna</label>
          <input
            type="text"
            class="form-control"
            value="<?= htmlspecialchars($user->getNama()) ?>"
            readonly>
        </div>

        <div class="mb-3">
          <label class="form-label">Username</label>
          <input
            type="text"
            class="form-control"
            value="<?= htmlspecialchars($user->getUsername()) ?>"
            readonly>
        </div>

        <div class="mb-3">
          <label class="form-label">Email</label>
          <input
            type="email"
            class="form-control"
            value="<?= htmlspecialchars($user->getEmail()) ?>"
            readonly>
        </div>

        <hr>

        <div class="mb-3">
          <label class="form-label">Password Baru</label>
          <input
            type="password"
            class="form-control"
            name="password"
            placeholder="Masukkan password baru"
            required>
        </div>

        <div class="mb-3">
          <label class="form-label">Konfirmasi Password Baru</label>
          <input
            type="password"
            class="form-control"
            name="confirmPassword"
            placeholder="Masukkan kembali password baru"
            required>
        </div>

        <div class="d-flex justify-content-end gap-2">

          <button
            type="submit"
            class="btn btn-primary">
            <i class="bi bi-save"></i>
            Ubah Password
          </button>
        </div>


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