<h1>Úvodní stránka</h1>
<hr>

<h4>Nadcházející události</h4>
<div class="card mb-4">
    <div class="card-body">
    <div class="table-responsive">
        <table class="table table-hover align-middle">
            <thead>
                <tr>
                    <th>Tým</th>
                    <th>Typ</th>
                    <th>Datum</th>
                    <th>Čas</th>
                    <th>Místo</th>
                    <th>Popis</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($events as $event): ?>
                    <tr>
                        <td>
                            <span class="fw-semibold">
                                <?= htmlspecialchars($event['tym_nazev']) ?>
                            </span>
                        </td>

                        <td>
                            <?php if ($event['typ'] === 'trenink'): ?>
                                <span class="badge bg-success">Trénink</span>
                            <?php else: ?>
                                <span class="badge bg-danger">Zápas</span>
                            <?php endif; ?>
                        </td>

                        <td>
                            <?= date('d.m.Y', strtotime($event['datum'])) ?>
                        </td>

                        <td>
                            <?= date('H:i', strtotime($event['datum'])) ?>
                        </td>

                        <td>
                            <?= htmlspecialchars($event['misto'] ?? '—') ?>
                        </td>

                        <td>
                            <?= htmlspecialchars($event['popis'] ?? '') ?>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
        <?php if (empty($events)) echo '<p>Žádné nadcházející události</p>'; ?>
    </div>
</div>




<h4>Nástěnka</h4>
<div class="card mb-4">
    <div class="card-body">
        <?php foreach($notes as $note): ?>
        <div class="card note-card mb-3">
            <div class="card-body">
                <div class="d-flex justify-content-between">
                    <strong><?= htmlspecialchars($note['jmeno'] . ' ' . $note['prijmeni']) ?></strong>
                    <small class="text-muted"><?= date('H:i | d.m.Y', strtotime($note['datum'])) ?></small>
                </div>
                <p class="mt-2 mb-0"><?= htmlspecialchars($note['obsah']) ?></p>
            </div>
        </div>
        <?php endforeach; ?>
        <?php if (empty($notes)) echo '<p>Žádné poznámky</p>'; ?>
    </div>
</div>

