<?php
/**
 * @var Laminas\View\Renderer\PhpRenderer $this
 * @var \Tour\Entity\Show                 $show
 * @var \User\Entity\User|null            $user
 */
$this->headTitle($show->getTitle());
$isAdmin = $user && $user->getIsAdmin();

$joursFr = ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'];
$moisFr  = ['','Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'];
?>

<!-- Actions admin -->
<?php if ($isAdmin): ?>
<div class="d-flex gap-2 mb-4">
    <a href="<?= $this->url('shows', ['action' => 'edit', 'id' => $show->getId()]) ?>" class="btn btn-app">
        <i class="bi bi-pencil me-1"></i>Modifier
    </a>
    <a href="<?= $this->url('shows', ['action' => 'delete', 'id' => $show->getId()]) ?>"
       class="btn btn-outline-danger"
       onclick="return confirm('Supprimer ce show ?')">
        <i class="bi bi-trash me-1"></i>Supprimer
    </a>
</div>
<?php endif; ?>

<!-- Infos principales -->
<div class="card-app mb-3">
    <?php if ($show->getDate()): ?>
    <div class="jday-date-bar" style="text-align:left;padding:0 0 var(--space-md)">
        <i class="bi bi-calendar-event me-2" style="color:var(--color-accent)"></i>
        <?= $joursFr[(int)$show->getDate()->format('w')] ?>
        <?= $show->getDate()->format('j') ?>
        <?= $moisFr[(int)$show->getDate()->format('n')] ?>
        <?= $show->getDate()->format('Y') ?>
        · <?= $show->getDate()->format('H:i') ?>
    </div>
    <?php endif; ?>

    <dl class="mb-0 row g-0" style="row-gap:var(--space-sm)">
        <dt class="col-4 text-muted" style="font-size:.8rem">Structure</dt>
        <dd class="col-8 mb-0" style="font-size:.875rem">
            <i class="bi bi-building me-1" style="color:var(--color-accent)"></i>
            <?= $this->escapeHtml($show->getStructure()->getName()) ?>
        </dd>

        <?php if ($show->getVenue() || $show->getCity()): ?>
        <dt class="col-4 text-muted" style="font-size:.8rem">Lieu</dt>
        <dd class="col-8 mb-0" style="font-size:.875rem">
            <i class="bi bi-geo-alt me-1" style="color:var(--color-accent)"></i>
            <?= $show->getVenue() ? $this->escapeHtml($show->getVenue()) : '' ?>
            <?= ($show->getVenue() && $show->getCity()) ? ' — ' : '' ?>
            <?= $show->getCity() ? $this->escapeHtml($show->getCity()) : '' ?>
        </dd>
        <?php endif; ?>

        <?php if ($show->getTour()): ?>
        <dt class="col-4 text-muted" style="font-size:.8rem">Tournée</dt>
        <dd class="col-8 mb-0">
            <span class="badge" style="background:var(--color-accent-dim);color:var(--color-accent);font-size:.75rem">
                <i class="bi bi-music-note-list me-1"></i><?= $this->escapeHtml($show->getTour()->getName()) ?>
            </span>
        </dd>
        <?php endif; ?>
    </dl>
</div>

<!-- Notes -->
<?php if ($show->getNotes()): ?>
<div class="card-app">
    <div class="settings-section-title mb-2"><i class="bi bi-sticky me-2"></i>Notes</div>
    <p class="text-muted mb-0" style="font-size:.875rem;white-space:pre-line"><?= $this->escapeHtml($show->getNotes()) ?></p>
</div>
<?php endif; ?>
