<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>

<div class="container mt-4">
    <h2>Edit Staff Member</h2>
    <form action="<?= site_url('staff/update/' . $user['id']) ?>" method="post">
        <?= csrf_field() ?>
        <div class="mb-3">
            <label>First Name</label>
            <input type="text" name="firstname" class="form-control" value="<?= esc($user['firstname']) ?>" required>
        </div>
        <div class="mb-3">
            <label>Last Name</label>
            <input type="text" name="lastname" class="form-control" value="<?= esc($user['lastname']) ?>" required>
        </div>
        <div class="mb-3">
            <label>Email</label>
            <input type="email" name="email" class="form-control" value="<?= esc($user['email']) ?>" required>
        </div>
        <div class="mb-3">
            <label>Phone Number</label>
            <input type="tel" name="phone" class="form-control" value="<?= esc($user['phone'] ?? '') ?>" placeholder="Enter phone number">
        </div>

        <!--
        <div class="mb-3">
            <label>Role</label>
            <select name="role_id" class="form-control" required>
                <?php foreach ($roles as $role): ?>
                    <option value="<?= $role['id'] ?>" <?= $roleId == $role['id'] ? 'selected' : '' ?>>
                        <?= esc($role['name']) ?>
                    </option>
                <?php endforeach ?>
            </select>
        </div>
        -->
        <button type="submit" class="btn btn-primary">Update</button>
    </form>
</div>

<?= $this->endSection() ?>
