2024-08-28 19:11:58 +02:00
< ? php snippet ( 'header' ) ?>
2024-08-30 14:37:13 +02:00
< div
2024-08-30 15:16:41 +02:00
class = " program-methods "
2024-08-30 14:37:13 +02:00
x - data = " {
setInitialTab () {
const queryString = window . location . search ;
if ( queryString . length === 0 ) return 'Programme' ;
const urlParams = new URLSearchParams ( queryString );
const tab = urlParams . get ( 'tab' );
return tab ;
2024-09-24 12:15:12 +02:00
},
disableEmptySections () {
setTimeout (() => {
const sections = document . querySelectorAll ( '.collapsable' )
sections . forEach ( section => {
const sessions = section . querySelector ( '.sessions li' )
const toggleBtn = section . querySelector ( '.toggle' )
if ( sessions ) {
toggleBtn . removeAttribute ( 'disabled' )
toggleBtn . setAttribute ( 'title' , '' )
toggleBtn . querySelector ( '.arrow-right' ) . classList . remove ( 'unvisible' )
} else {
toggleBtn . setAttribute ( 'disabled' , true )
toggleBtn . setAttribute ( 'title' , 'aucune séance' )
toggleBtn . querySelector ( '.arrow-right' ) . classList . add ( 'unvisible' )
}
})
})
2024-11-04 11:32:33 +01:00
},
scrollToNextClosestDate () {
const nodes = document . querySelectorAll ( '.sessions [data-date]' );
const today = new Date ();
2024-11-07 15:41:13 +01:00
today . setHours ( 0 , 0 , 0 , 0 ); // On ne garde que la date
2024-11-04 11:32:33 +01:00
2024-11-07 15:41:13 +01:00
const nextNode = Array . from ( nodes ) . find ( node => {
const date = new Date ( node . getAttribute ( 'data-date' ));
date . setHours ( 0 , 0 , 0 , 0 );
return date >= today ;
2024-11-04 11:32:33 +01:00
});
2024-11-07 15:41:13 +01:00
if ( nextNode ) {
nextNode . scrollIntoView ({ behavior : 'smooth' });
}
2024-11-05 17:37:31 +01:00
},
2024-11-07 15:41:13 +01:00
2024-11-05 17:37:31 +01:00
getFilter ( string ) {
2024-11-05 17:48:31 +01:00
return string . split ( '—' )[ 1 ] . trim ()
2024-08-30 14:37:13 +02:00
}
} "
>
2024-08-30 15:16:41 +02:00
< div class = " program-data "
2024-08-30 14:37:13 +02:00
x - data = " {
2024-09-02 18:02:46 +02:00
tab : setInitialTab (),
filter : null
2024-08-30 14:37:13 +02:00
} "
2024-09-24 12:15:12 +02:00
x - init = "
disableEmptySections ()
$watch ( 'tab' , value => {
disableEmptySections ()
})
"
2024-08-30 14:37:13 +02:00
>
2024-08-30 15:16:41 +02:00
2024-09-05 12:13:58 +02:00
2024-08-30 15:16:41 +02:00
< section class = " filters " >
< button
x - data = " { title: 'Calendrier'} "
x - text = " title "
2024-09-02 18:02:46 +02:00
: class = " tab === title ? 'strong' : '' "
2024-09-10 18:36:50 +02:00
@ click = "
2024-09-24 08:59:17 +02:00
tab = title
2024-09-10 18:36:50 +02:00
const url = new URL ( window . location . href );
url . searchParams . set ( 'tab' , tab );
window . history . pushState ({}, '' , url );
2024-11-04 11:32:33 +01:00
setTimeout ( scrollToNextClosestDate , 100 )
2024-09-10 18:36:50 +02:00
"
2024-08-30 15:16:41 +02:00
></ button >
2024-09-04 15:56:19 +02:00
< ? 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' : '' "
2024-09-10 18:36:50 +02:00
@ click = "
2024-09-24 08:59:17 +02:00
tab = filterTitle ; filter = title
2024-09-10 18:36:50 +02:00
const url = new URL ( window . location . href );
url . searchParams . set ( 'tab' , tab );
window . history . pushState ({}, '' , url );
2024-11-04 11:32:33 +01:00
setTimeout ( scrollToNextClosestDate , 100 )
2024-09-10 18:36:50 +02:00
"
2024-09-04 15:56:19 +02:00
></ button >
< ? php endforeach ?>
2024-08-30 15:16:41 +02:00
</ section >
2024-08-30 14:37:13 +02:00
< section class = " page-title " >
< h1 x - text = " tab " ></ h1 >
</ section >
2024-08-30 15:16:41 +02:00
<!-- Programme -->
< template x - if = " tab === 'Programme' " >
< div class = " program-content__events " >
< section class = " yellow " >
2024-09-10 15:23:24 +02:00
< h2 > Prochainement — < ? = $page -> children () -> first () -> title () ?> </h2>
2024-08-30 15:16:41 +02:00
</ section >
2024-11-04 15:09:17 +01:00
< ? php snippet ( 'events-grid' , [ 'events' => $events [ 'next' ], 'columns' => 3 ]) ?>
< ? php if ( $events [ 'previous' ] -> count () > 0 ) : ?>
2024-09-19 12:29:48 +02:00
< section class = " yellow " >
< h2 > Événements passés </ h2 >
</ section >
2024-11-04 15:09:17 +01:00
< ? php snippet ( 'events-grid' , [ 'events' => $events [ 'previous' ], 'columns' => 3 ]) ?>
2024-09-19 12:29:48 +02:00
< ? php endif ?>
2024-08-30 15:16:41 +02:00
</ div >
</ template >
<!-- Calendrier -->
2024-09-02 18:02:46 +02:00
< template x - if = " tab.includes('Calendrier') " >
2024-08-30 15:16:41 +02:00
< div class = " program-content__events " >
< section class = " collapsable-sections " >
2024-09-16 16:28:12 +02:00
< ? php
2024-09-24 11:42:01 +02:00
$currentMonth = date ( 'n' );
2024-09-16 16:28:12 +02:00
foreach ( $currentSeasonSessions as $month => $sessions ) : ?>
2024-09-24 11:42:01 +02:00
< ? php
$open = getMonthNumber ( $month ) == $currentMonth || getMonthNumber ( $month ) == $currentMonth + 1 ;
?>
2024-08-30 15:16:41 +02:00
< ? php if ( count ( $sessions ) > 0 ) : ?>
2024-09-24 11:42:01 +02:00
< ? php snippet ( 'collapsable-section' , [ 'title' => $month , 'padding' => false , 'open' => $open ], slots : true ) ?>
2024-08-30 15:16:41 +02:00
< ? php slot ( 'content' ) ?>
2024-11-04 11:32:33 +01:00
< ul
class = " sessions sessions--detailed "
x - init = "
scrollToNextClosestDate ()
2024-11-05 17:48:31 +01:00
2024-11-04 11:32:33 +01:00
"
>
2024-09-02 16:32:21 +02:00
< ? php
foreach ( $sessions as $session ) :
$date = new DateTime ( $session [ 'date' ]);
$formatter = new IntlDateFormatter ( 'fr_FR' , IntlDateFormatter :: NONE , IntlDateFormatter :: NONE );
$formattedDate = $formatter -> formatObject ( $date , " d MMMM " );
2024-09-04 15:56:19 +02:00
?>
2024-11-05 17:48:31 +01:00
< template
x - if = " tab === 'Calendrier' || ('<?= $session['categories'] ?>'.length > 0 && '<?= $session['categories'] ?>'.includes(getFilter(tab))) "
>
2024-11-04 11:32:33 +01:00
< li id = " <?= Str::slug( $session['title'] ) ?> " class = " collapsable__item--padding session grid js-link " style = " --color: <?= $session['color'] ?> " data - date = " <?= $session['date'] ?> " >
2024-09-12 15:39:44 +02:00
< div class = " left-column " >
< div class = " session__info " >
< p >< ? = $formattedDate ?> </p>
2024-10-31 14:35:37 +01:00
< p >< ? = $session [ 'time' ] ?> </p>
2024-09-12 15:39:44 +02:00
</ div >
< div class = " session__info " >
< p >< strong >< ? = $session [ 'title' ] ?> </strong></p>
< p >< ? = $session [ 'authors' ] ?> </p>
</ div >
2024-09-02 17:09:53 +02:00
</ div >
2024-09-12 15:39:44 +02:00
< div class = " right-column " >
< div class = " mobile-group " >
< div class = " session__info " >
< ? php if ( strlen ( $session [ 'duration' ]) > 0 || strlen ( $session [ 'public' ]) > 0 ) : ?>
< p >
< ? php if ( strlen ( $session [ 'duration' ]) > 0 ) : ?>
Durée : < ? = $session [ 'duration' ] ?> <br />
< ? php endif ?>
< ? php if ( strlen ( $session [ 'public' ]) > 0 ) : ?>
< ? = $session [ 'public' ] ?>
< ? php endif ?>
</ p >
2024-09-02 17:09:53 +02:00
< ? php endif ?>
2024-09-12 15:39:44 +02:00
</ div >
< div class = " session__info " >
< p >< ? = $session [ 'place' ] ?> </p>
</ div >
</ div >
< div class = " session__info session__info--ticket " >
< ? php if ( $session [ 'bookableStock' ] === 'free' ) : ?>
2024-10-31 15:02:42 +01:00
< ? 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 : ?>
2024-09-20 10:14:43 +02:00
< a class = " ticket-link " title = " Entrée libre " disabled tabindex = " -1 " >< ? php snippet ( 'ticket' ) ?> Entrée libre</a>
2024-10-31 15:02:42 +01:00
< ? php endif ?>
2024-09-12 15:39:44 +02:00
< ? php elseif ( $session [ 'bookableStock' ] == 0 ) : ?>
2024-09-20 10:14:43 +02:00
< a class = " ticket-link " title = " Séance complète " disabled tabindex = " -1 " >< ? php snippet ( 'ticket' ) ?> Complet</a>
2024-09-12 15:39:44 +02:00
< ? php elseif ( $session [ 'bookableStock' ] < (( $session [ 'totalStock' ] / 100 ) * 25 )) : ?>
2024-09-20 10:14:43 +02:00
< a class = " ticket-link " title = " Plateforme de réservation " href = " <?= $session['ticketingUrl'] ?> " target = " _blank " tabindex = " -1 " >< ? php snippet ( 'ticket' ) ?> Plus que quelques places !</a>
2024-09-12 15:39:44 +02:00
< ? php else : ?>
2024-09-20 10:14:43 +02:00
< a class = " ticket-link " title = " Plateforme de réservation " href = " <?= $session['ticketingUrl'] ?> " target = " _blank " tabindex = " -1 " >< ? php snippet ( 'ticket' ) ?> Billetterie</a>
2024-09-12 15:39:44 +02:00
< ? php endif ?>
</ div >
2024-09-02 17:09:53 +02:00
</ div >
2024-09-20 10:14:43 +02:00
< a class = " event-link " href = " <?= $session['event-url'] ?> " title = " En savoir plus " tabindex = " -1 " ></ a >
2024-09-02 16:32:21 +02:00
</ li >
2024-09-04 15:56:19 +02:00
</ template >
2024-09-02 14:02:13 +02:00
< ? php endforeach ?>
2024-09-02 16:32:21 +02:00
</ ul >
2024-08-30 15:16:41 +02:00
< ? php endslot () ?>
< ? php endsnippet () ?>
< ? php endif ?>
< ? php endforeach ?>
</ section >
</ div >
2024-09-04 14:23:32 +02:00
</ template >
2024-08-30 14:37:13 +02:00
</ div >
</ div >
2024-08-28 19:11:58 +02:00
< ? php snippet ( 'footer' ) ?>