<h1>Vytvořit nového uživatele</h1>

<form method="post" action="">
    <div class="mb-3">
        <label class="form-label">Uživatelské jméno *</label>
        <input type="text" name="uzivatelske_jmeno" class="form-control" required>
    </div>

    <div class="mb-3">
        <label class="form-label">Jméno *</label>
        <input type="text" name="jmeno" class="form-control" required>
    </div>

    <div class="mb-3">
        <label class="form-label">Příjmení *</label>
        <input type="text" name="prijmeni" class="form-control" required>
    </div>

    <div class="mb-3">
        <label class="form-label">Heslo * (min. 8 znaků)</label>
        <input type="password" name="heslo" class="form-control" required minlength="8">
    </div>

    <?php if ($userRole === 'admin'): ?>
        <div class="mb-3">
            <label class="form-label">Role *</label>
            <select name="role" class="form-select" required>
                <option value="sportovec">Sportovec</option>
                <option value="trener">Trenér</option>
                <option value="admin">Správce</option>
            </select>
        </div>
    <?php else: ?>
        <p class="text-muted">Vytváříte uživatele s rolí: <strong>Sportovec</strong></p>
    <?php endif; ?>

    <div class="mb-3">
        <label class="form-label">Tým</label>
        <select name="tym_id" class="form-select">
            <option value="">-- Vyberte tým --</option>
            <?php foreach ($teams as $team): ?>
                <option value="<?= $team['id'] ?>"><?= htmlspecialchars($team['nazev']) ?></option>
            <?php endforeach; ?>
        </select>
    </div>

    <button title="Uložit" class="btn btn-success"><i class="ti ti-device-floppy fs-4"></i></button>
    <a href="<?= BASE_URL ?>/user/index" class="btn btn-outline-secondary" title="Zpět"><i class="ti ti-arrow-back-up fs-4"></i></a>
</form>
