<h2>Kalendář – detail</h2>

<div class="card">
    <div class="card-body">
        <div class="row mb-3">
            <div class="col-md-6">
                <strong>Tým:</strong> <?= htmlspecialchars($event['tym_nazev']) ?>
            </div>
            <div class="col-md-6">
                <strong>Typ:</strong>
                <?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; ?>
            </div>
        </div>

        <div class="row mb-3">
            <div class="col-md-6">
                <strong>Datum:</strong> <?= date('d.m.Y', strtotime($event['datum'])) ?>
            </div>
            <div class="col-md-6">
                <strong>Čas:</strong> <?= date('H:i', strtotime($event['datum'])) ?>
            </div>
        </div>

        <?php if (!empty($event['misto'])): ?>
            <div class="row mb-3">
                <div class="col-md-12">
                    <strong>Místo:</strong> <?= htmlspecialchars($event['misto']) ?>
                </div>
            </div>
        <?php endif; ?>

        <?php if (!empty($event['popis'])): ?>
            <div class="row mb-3">
                <div class="col-md-12">
                    <strong>Popis:</strong><br>
                    <?= nl2br(htmlspecialchars($event['popis'])) ?>
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>

<?php if (!empty($canEdit)): ?>
    <div class="mt-3 d-flex gap-2">
        <a href="<?= BASE_URL ?>/kalendar/edit?id=<?= $event['id'] ?>"
           title="Upravit" class="btn btn-success"><i class="ti ti-edit fs-4"></i></a>

        <a href="<?= BASE_URL ?>/kalendar/delete?id=<?= $event['id'] ?>"
           title="Smazat" class="btn btn-danger"
           onclick="return confirm('Opravdu chcete událost smazat?');">
            <i class="ti ti-trash fs-4"></i>
        </a>
        <a href="<?= BASE_URL ?>/dochazka/show?id=<?= $event['id'] ?>" class="btn btn-outline-primary" title="Docházka">
            <i class="ti ti-clipboard-check fs-4"></i>
        </a>
        <a href="<?= BASE_URL ?>/kalendar/index" class="btn btn-outline-secondary" title="Zpět"><i class="ti ti-arrow-back-up fs-4"></i></a>
    </div>
<?php else: ?>
    <div class="mt-3 d-flex gap-2">
        <a href="<?= BASE_URL ?>/dochazka/show?id=<?= $event['id'] ?>" class="btn btn-outline-primary" title="Docházka">
            <i class="ti ti-clipboard-check fs-4"></i>
        </a>
        <a href="<?= BASE_URL ?>/kalendar/index" class="btn btn-outline-secondary" title="Zpět"><i class="ti ti-arrow-back-up fs-4"></i></a>
    </div>
<?php endif; ?>
