<?php

declare(strict_types=1);

ob_start();

?>

<div class="d-flex justify-content-between align-items-center mb-4">

    <div>
        <h2 class="mb-1">Reset Password</h2>
        <p class="text-muted mb-0">
            User:
            <?= htmlspecialchars(
                $user['username'],
                ENT_QUOTES,
                'UTF-8'
            ) ?>
        </p>
    </div>

    <a
        href="/public/users"
        class="btn btn-outline-secondary">

        Back

    </a>

</div>

<div class="row">

    <div class="col-lg-6">

        <div class="card shadow-sm border-0">

            <div class="card-body p-4">

                <?php if (!empty($error)): ?>

                    <div class="alert alert-danger">

                        <?= htmlspecialchars(
                            $error,
                            ENT_QUOTES,
                            'UTF-8'
                        ) ?>

                    </div>

                <?php endif; ?>

                <form
                    method="POST"
                    action="/public/users/reset-password">

                    <input
                        type="hidden"
                        name="id"
                        value="<?= (int) $user['id'] ?>">

                    <div class="mb-3">

                        <label class="form-label">
                            New Password
                        </label>

                        <input
                            type="password"
                            name="password"
                            class="form-control"
                            minlength="8"
                            required>

                    </div>

                    <div class="mb-3">

                        <label class="form-label">
                            Confirm New Password
                        </label>

                        <input
                            type="password"
                            name="password_confirmation"
                            class="form-control"
                            minlength="8"
                            required>

                    </div>

                    <button
                        type="submit"
                        class="btn btn-warning">

                        <i class="bi bi-key me-1"></i>
                        Reset Password

                    </button>

                </form>

            </div>

        </div>

    </div>

</div>

<?php

$content = ob_get_clean();

$title = 'Reset Password';

include APP_PATH .
    '/Modules/Administration/Views/layouts/admin.php';