nouveau-theatre-de-besancon/site/templates/event.php

168 lines
6.9 KiB
PHP
Raw Normal View History

2024-08-18 16:56:58 +02:00
<?php snippet('header') ?>
<section class="key-infos">
<ul>
<li><p class="key-infos__key">Dates</p><p class="key-infos__info"><?= $page->schedule() ?></p></li>
2024-09-10 13:47:04 +02:00
<li><p class="key-infos__key">Durée</p><p class="key-infos__info"><?= $page->duration() ?></p></li>
2024-08-18 16:56:58 +02:00
<li><p class="key-infos__key">Public</p><p class="key-infos__info"><?= $page->public() ?></p></li>
<li><p class="key-infos__key">Lieu</p><p class="key-infos__info"><?= $page->place() ?></p></li>
</ul>
</section>
<section class="presentation">
<div id="swiper" style="--span: 8; --color: <?= $page->color()->isNotEmpty() ? $page->color() : 'var(--color-season)' ?>">
2024-09-18 17:00:56 +02:00
<div class="swiper-wrapper">
<?php
$images = $page->gallery()->toFiles()->count() > 1 ? $page->gallery()->toFiles()->without($page->gallery()->toFiles()->first()) : $page->gallery()->toFiles();
foreach($images as $slide): ?>
2024-08-28 14:16:34 +02:00
<div class="swiper-slide">
<?php snippet('picture', ['file' => $slide]) ?>
</div>
<?php endforeach ?>
</div>
2024-09-18 16:39:40 +02:00
<button class="swiper-button swiper-button-prev" title="précédente"></button>
<button class="swiper-button swiper-button-next" title="suivante"></button>
2024-08-28 14:16:34 +02:00
</div>
2024-08-18 16:56:58 +02:00
<div class="presentation__text">
<h2 class="h1 presentation__title"><?= $page->title() ?></h2>
<h3 class="h2 presentation__authors"><?= $page->authors() ?></h3>
<div class="presentation__chapo"><?= $page->chapo() ?></div>
<div class="presentation__description"><?= $page->description() ?></div>
</div>
</section>
<section class="collapsable-sections">
<?php snippet('collapsable-section', ['title' => 'Réserver', 'padding' => false], slots: true) ?>
2024-09-06 14:20:46 +02:00
<!--========== KIRBY EVENT ==========-->
<?php if ($page->isMapadoEvent() != 'true'): ?>
<?php slot('content') ?>
<div
class="sessions"
>
<?php
$sessions = $page->sessions()->toStructure();
foreach ($sessions as $session) :
$date = new DateTime($session->date());
$formatter = new IntlDateFormatter('fr_FR', IntlDateFormatter::FULL, IntlDateFormatter::NONE);
$formattedDate = $formatter->format($date);
?>
2024-09-06 14:20:46 +02:00
<div class="session collapsable__item--padding grid">
2024-09-10 16:55:01 +02:00
<div class="left-column">
<p><?= $formattedDate ?></p>
<p><?= e($session->timeComplement()->isEmpty() == 'true', $session->time(), $session->time() . ' ' . $session->timeComplement()) ?></p>
<p><?= $page->place() ?></p>
</div>
<div class="right-column">
<?php if ($page->bookingUrl()->isEmpty()): ?>
<a class="ticket-link" title="Entrée libre" disabled><?php snippet('ticket') ?> Entrée libre</a>
<?php else: ?>
<a class="ticket-link" href="<?= $page->bookingUrl()->url() ?>" target="_blank" title="Plateforme de réservation"><?php snippet('ticket') ?> Réserver</a>
<?php endif ?>
</div>
</div>
<?php endforeach ?>
</div>
<?php endslot() ?>
2024-09-06 14:20:46 +02:00
<!--========== MAPADO EVENT ==========-->
<?php else: ?>
<?php slot('content') ?>
<div
class="sessions"
x-data="{
2024-09-05 11:57:46 +02:00
stockThreshold: (<?= $page->totalStock()->value() ?> / 100) * 25,
sessions: [],
slug: null,
eventDateId: null,
async fetchSessions() {
const event = await updateMapadoEvent('<?= $page->uri() ?>');
this.sessions = event.remoteSessions
this.slug = event.mapadoSlug
this.eventDateId = event.eventDateId
},
}"
x-init="
if (<?= $page->isMapadoEvent() == 'true' ?>) {
fetchSessions()
}
"
>
<template x-for="session in sessions">
2024-09-04 17:02:37 +02:00
<div
x-data="{
2024-09-05 11:57:46 +02:00
stockThreshold: (<?= $page->totalStock()->value() ?> / 100) * 25
2024-09-04 17:02:37 +02:00
}"
class="collapsable__item--padding session grid"
>
2024-09-10 16:55:01 +02:00
<div class="left-column">
<p x-text="dateToFrench(session.date)"></p>
<p x-text="session.time"></p>
<p><?= $page->place() ?></p>
</div>
2024-09-19 15:41:48 +02:00
<template x-if="!session.ticketingUrl">
<a class="ticket-link" title="Plus de places disponibles" disabled><?php snippet('ticket') ?> Entrée libre</a>
</template>
<template x-if="session.bookableStock === 0">
<a class="ticket-link" title="Plus de places disponibles" disabled><?php snippet('ticket') ?> Complet</a>
</template>
<template x-if="session.bookableStock > stockThreshold">
2024-09-02 14:02:13 +02:00
<a class="ticket-link" title="Plateforme de réservation" :href="session.ticketingUrl" target="_blank"><?php snippet('ticket') ?> Billetterie</a>
</template>
2024-09-02 14:02:13 +02:00
<template x-if="session.bookableStock !== 0 && session.bookableStock < stockThreshold">
<a class="ticket-link" title="Plateforme de réservation" :href="session.ticketingUrl" target="_blank"><?php snippet('ticket') ?> Plus que quelques places !</a>
</template>
</div>
</template>
2024-08-28 08:46:00 +02:00
</div>
<?php endslot() ?>
<?php endif ?>
2024-08-28 08:46:00 +02:00
<?php endsnippet() ?>
<?php if ($page->production()->isNotEmpty()): ?>
<?php snippet('collapsable-section', ['title' => 'Distribution et production'], slots: true) ?>
<?php slot('content') ?>
<div class="production">
<?php foreach ($page->production()->toLayouts() as $layout): ?>
<div class="collapsable__item--padding grid" id="<?= $layout->id() ?>">
<?php foreach ($layout->columns() as $column): ?>
<div class="grid__item" style="--span:<?= $column->span() ?>">
<div class="blocks">
<?= $column->blocks() ?>
</div>
2024-08-27 17:10:48 +02:00
</div>
<?php endforeach ?>
2024-08-27 17:10:48 +02:00
</div>
<?php endforeach ?>
</div>
<?php endslot() ?>
<?php endsnippet() ?>
<?php endif ?>
2024-08-27 17:10:48 +02:00
<?php if ($page->resources()->isNotEmpty()): ?>
<?php snippet('collapsable-section', ['title' => 'Ressources'], slots: true) ?>
<?php slot('content') ?>
2024-09-03 13:21:23 +02:00
<div class="resources">
<div class="collapsable__item--padding grid">
2024-08-27 17:10:48 +02:00
<?php foreach($page->resources()->toStructure() as $resource): ?>
<div class="resource grid__item" style="--span: 4;">
<p><?= $resource->name() ?></p><a href="<?= $resource->file()->toFile()->url() ?>" title="Télécharger le fichier" download>télécharger ↓</a>
</div>
<?php endforeach ?>
2024-09-03 13:21:23 +02:00
</div>
2024-08-27 17:10:48 +02:00
</div>
<?php endslot() ?>
<?php endsnippet() ?>
<?php endif ?>
2024-08-18 16:56:58 +02:00
</section>
2024-08-28 11:28:22 +02:00
<?php if ($page->linkedPages()->isNotEmpty()): ?>
<?php snippet('events-grid', ['title' => 'Pour aller plus loin', 'events' => $page->linkedPages()->toPages()]) ?>
<?php endif ?>
2024-09-13 16:00:15 +02:00
<?php snippet('callout') ?>
2024-08-18 16:56:58 +02:00
<?php snippet('footer') ?>