program / calendar : add ticket to not connected event if bookingUrl is not empty #4

This commit is contained in:
isUnknown 2024-10-31 15:02:42 +01:00
parent a2062cd350
commit 4dc2164820
3 changed files with 12 additions and 1 deletions

View file

@ -49,7 +49,7 @@ function createArraySession($event, $session) {
$arraySession['public'] = $event->public();
$arraySession['event-url'] = $event->url();
$arraySession['duration'] = $event->duration();
$arraySession['ticketingUrl'] = $isMapadoEvent ? $session->ticketingUrl() : false;
$arraySession['ticketingUrl'] = $isMapadoEvent ? $session->ticketingUrl()->value() : $event->bookingUrl()->value();
$arraySession['bookableStock'] = $isMapadoEvent ? $session->bookableStock()->value() : 'free';
$arraySession['totalStock'] = $isMapadoEvent ? (int) $event->totalStock()->value() : 'free';
$arraySession['color'] = $event->color();

View file

@ -18,6 +18,8 @@
<h5><?= $event->title() ?></h5>
<?php if ($event->isMapadoEvent() == 'true'): ?>
<?php snippet('ticket', ['link' => option('ticketingUrl') . 'event/' . $event->mapadoSlug(), 'size' => (100 / (12 / $span) - 10)]) ?>
<?php elseif($event->bookingUrl()->isNotEmpty()): ?>
<?php snippet('ticket', ['link' => $event->bookingUrl(), 'size' => (100 / (12 / $span) - 10)]) ?>
<?php endif ?>
</div>
<div>

View file

@ -148,8 +148,17 @@
</div>
</div>
<div class="session__info session__info--ticket">
<?php
// if (str_contains($session['title'], 'Atelier')) {
// throw new Exception(json_encode($session), 1);
// }
?>
<?php if ($session['bookableStock'] === 'free'): ?>
<?php if (strlen($session['ticketingUrl']) > 0): ?>
<a class="ticket-link" title="Plateforme de réservation" href="<?= $session['ticketingUrl'] ?>" target="_blank" tabindex="-1"><?php snippet('ticket') ?>Billetterie</a>
<?php else: ?>
<a class="ticket-link" title="Entrée libre" disabled tabindex="-1"><?php snippet('ticket') ?>Entrée libre</a>
<?php endif ?>
<?php elseif ($session['bookableStock'] == 0): ?>
<a class="ticket-link" title="Séance complète" disabled tabindex="-1"><?php snippet('ticket') ?>Complet</a>
<?php elseif ($session['bookableStock'] < (($session['totalStock'] / 100) * 25)): ?>