event : make it possible to add a text instead of a ticketing url
This commit is contained in:
parent
7aa8221cf4
commit
c5ae72945d
2 changed files with 33 additions and 15 deletions
|
|
@ -106,8 +106,9 @@ tabs:
|
|||
Format : 20h00 ou 20h (pas 20:00)
|
||||
width: 1/2
|
||||
ticketingUrl:
|
||||
label: Lien de réservation
|
||||
type: url
|
||||
label: Lien de réservation / texte
|
||||
type: text
|
||||
help: Entrer une URL affichera un bouton ticket cliquable, entrer du texte l'affichera simplement à la place du ticket.
|
||||
isFull:
|
||||
label: Complet
|
||||
type: toggle
|
||||
|
|
|
|||
|
|
@ -58,19 +58,36 @@
|
|||
<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') ?> <?= e($session->isFull(), 'Complet', 'Entrée libre') ?></a>
|
||||
<?php else: ?>
|
||||
<a
|
||||
class="ticket-link"
|
||||
href="<?= e($session->ticketingUrl()->isNotEmpty(), $session->ticketingUrl()->url(), $page->bookingUrl()->url()) ?>"
|
||||
target="_blank"
|
||||
title="Plateforme de réservation"
|
||||
<?= e($session->isFull()->isTrue(), ' disabled') ?>
|
||||
>
|
||||
<?php snippet('ticket') ?> <?= e($session->isFull()->isTrue(), 'Complet', 'Réserver') ?>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
<?php
|
||||
$hasBookingUrl = $page->bookingUrl()->isNotEmpty();
|
||||
$hasTicketingUrl = $session->ticketingUrl()->isNotEmpty();
|
||||
$isTicketingUrlValid = $hasTicketingUrl && filter_var($session->ticketingUrl(), FILTER_VALIDATE_URL);
|
||||
$isFull = $session->isFull()->isTrue();
|
||||
?>
|
||||
|
||||
<?php if (!$hasBookingUrl): ?>
|
||||
<a class="ticket-link" title="Entrée libre" disabled>
|
||||
<?php snippet('ticket') ?> <?= $isFull ? 'Complet' : 'Entrée libre' ?>
|
||||
</a>
|
||||
|
||||
<?php elseif ($hasTicketingUrl && !$isTicketingUrlValid): ?>
|
||||
<p><?= $session->ticketingUrl() ?></p>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$url = $isTicketingUrlValid
|
||||
? $session->ticketingUrl()->url()
|
||||
: $page->bookingUrl()->url();
|
||||
?>
|
||||
<a
|
||||
class="ticket-link"
|
||||
href="<?= $url ?>"
|
||||
target="_blank"
|
||||
title="Plateforme de réservation"
|
||||
<?= $isFull ? 'disabled' : '' ?>
|
||||
>
|
||||
<?php snippet('ticket') ?> <?= $isFull ? 'Complet' : 'Réserver' ?>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue