program - calendar filters working

This commit is contained in:
isUnknown 2024-09-04 15:56:19 +02:00
parent a2fd20c1cc
commit 3d24e61e12
4 changed files with 42 additions and 41 deletions

View file

@ -164,7 +164,16 @@ tabs:
label: Réglages
icon: cog
fields:
color: fields/color
category:
label: Catégorie
type: select
width: 1/4
options:
type: query
query: page.parent.parent.categories.split
color:
extends: fields/color
width: 3/4
mapadoLine:
type: line
isMapadoEvent:

View file

@ -13,9 +13,18 @@ tabs:
contentTab:
label: Calendrier
icon: calendar
sections:
seasons:
label: Saisons
type: pages
template: season
info: "{{ page.children.count }} événements"
columns:
- width: 1/2
fields:
categories:
label: Catégories d'événement
type: tags
max: 5
help: Permet aux visiteurs de filtrer les événements du [programme](/programme).
- width: 1/2
sections:
seasons:
label: Saisons
type: pages
template: season
info: "{{ page.children.count }} événements"

View file

@ -38,6 +38,7 @@ function createArraySession($event, $session) {
$arraySession['ticketingUrl'] = $isMapadoEvent ? $session->ticketingUrl() : false;
$arraySession['bookableStock'] = $isMapadoEvent ? $session->bookableStock()->value() : 'free';
$arraySession['color'] = $event->color();
$arraySession['category'] = $event->category();
return $arraySession;

View file

@ -29,39 +29,19 @@
:class="tab === title ? 'strong' : ''"
@click="if (tab === title) { tab = 'Programme' } else {tab = title}"
></button>
<button
x-data="{
title: 'Spectacles',
get filterTitle() {
return 'Calendrier — ' + this.title
}
}"
x-text="title"
:class="tab === filterTitle ? 'strong' : ''"
@click="if (tab === filterTitle) { tab = 'Programme' } else { tab = filterTitle; filter = title }"
></button>
<button
x-data="{
title: 'Autres événements',
get filterTitle() {
return 'Calendrier — ' + this.title
}
}"
x-text="title"
:class="tab === filterTitle ? 'strong' : ''"
@click="if (tab === filterTitle) { tab = 'Programme' } else { tab = filterTitle; filter = title }"
></button>
<button
x-data="{
title: 'Ici & Là',
get filterTitle() {
return 'Calendrier — ' + this.title
}
}"
x-text="title"
:class="tab === filterTitle ? 'strong' : ''"
@click="if (tab === filterTitle) { tab = 'Programme' } else { tab = filterTitle; filter = title }"
></button>
<?php foreach($page->categories()->split() as $filter): ?>
<button
x-data="{
title: '<?= $filter ?>',
get filterTitle() {
return 'Calendrier — ' + this.title
}
}"
x-text="title"
:class="tab === filterTitle ? 'strong' : ''"
@click="if (tab === filterTitle) { tab = 'Programme' } else { tab = filterTitle; filter = title }"
></button>
<?php endforeach ?>
</section>
<section class="page-title">
<h1 x-text="tab"></h1>
@ -101,7 +81,8 @@
} catch (\Throwable $th) {
throw new Exception($session['title'], 1);
}
?>
?>
<template x-if="tab === 'Calendrier' || ('<?= $session['category'] ?>'.length > 0 && tab.includes('<?= $session['category'] ?>'))">
<li class="collapsable__item--padding session grid js-link" style="--color: <?= $session['color'] ?>" @click="goTo(event, '<?= $session['event-url'] ?>')" title="En savoir plus">
<div class="session__info">
<p><?= $formattedDate ?></p>
@ -138,6 +119,7 @@
<?php endif ?>
</div>
</li>
</template>
<?php endforeach ?>
</ul>
<?php endslot() ?>