Tagline
Verfügbarkeit & Preise
Kurtaxe: Zusätzlich (festgelegt vom Gemeinderat von Valfréjus)
Saison 2025 - 2026
<?php
// Récupérer les valeurs du repeater depuis l'option page
$repeater_data = get_field('cal_ligne', 'option');
// Vérifier si le repeater contient des entrées
if ($repeater_data) : ?>
<ul class="tarifs__list">
<?php foreach ($repeater_data as $row) :
// Récupérer les sous-champs
$cal_ferme = $row['cal_ferme']; // Toujours un tableau en ACF Checkbox
$cal_date_debut = $row['cal_date_debut'];
$cal_jours = intval($row['cal_jours']);
$cal_prix = $row['cal_prix'];
$cal_date_fin = $row['cal_date_fin'];
$cal_dispo = $row['cal_dispo']; // Champ True/False
// Vérifier si "1" est coché dans le tableau
$est_ferme = (is_array($cal_ferme) && in_array('1', $cal_ferme));
// Déterminer la classe principale (cal-ouvert ou cal-ferme)
$li_classes = $est_ferme ? 'tarifs__list-element cal-ferme' : 'tarifs__list-element cal-ouvert';
// Ajouter la classe "nondispo" si cal_dispo est false (non disponible)
if ($cal_dispo === false) {
$li_classes .= ' nondispo';
}
// Déterminer la date de fin
if ($est_ferme) {
// Si fermé, on utilise la date fournie dans ACF
$date_fin_affichee = !empty($cal_date_fin) ? $cal_date_fin : 'Date invalide';
} else {
// Si ouvert, on calcule la date de fin
$date_fin_affichee = 'Date invalide';
$date_obj = DateTime::createFromFormat('d/m/Y', $cal_date_debut);
if ($date_obj && $cal_jours > 0) {
$date_obj->modify('+' . $cal_jours . ' days');
$date_fin_affichee = $date_obj->format('d/m/Y'); // Format final
}
}
// Construire la période d'affichage
$periode = "" . esc_html($cal_date_debut) . " > " . esc_html($date_fin_affichee);
?>
<li class="<?php echo esc_attr($li_classes); ?>" itemscope itemtype="http://schema.org/Product">
<div class="tarifs__list-container-name">
<p class="tarifs__list-heading" itemprop="name"><?php echo $periode; ?></p>
<?php if (!$est_ferme) : ?>
<div class="tarifs__list-divider"></div>
<?php endif; ?>
</div>
<?php if ($est_ferme) : ?>
<p class="tarifs__non-louable">Non louable</p>
<?php else : ?>
<div class="tarifs__list-price-wrapper">
<span class="tarifs__list-price" itemprop="price" content="<?php echo esc_attr($cal_prix); ?>">
<?php echo esc_html($cal_prix); ?>
</span>
<span class="tarifs__list-currency" itemprop="priceCurrency" content="EUR">€</span>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<p>⚠️ Aucun calendrier trouvé dans les options.</p>
<?php endif; ?>
.tarifs__list {
list-style: none;
padding: 0;
margin: 0;
}
.tarifs__list-element {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 15px;
border-radius: 5px;
margin-bottom: 10px;
font-size: 16px;
font-weight: bold;
color: #fff;
}
.cal-ouvert {
background-color: #7cb518; /* Vert */
}
.cal-ferme {
background-color: #B8B8B8; /* Gris */
padding: 20px 15px;
}
.nondispo {
background-color: #D85531; /* Rouge */
}
.tarifs__list-container-name {
display: flex;
align-items: center;
flex-grow: 1;
}
.tarifs__list-heading {
margin: 0;
font-size: 16px;
}
.tarifs__list-divider {
flex-grow: 1;
height: 1px;
background-color: rgba(255, 255, 255, 0.5);
margin: 0 15px;
}
.tarifs__list-price-wrapper {
display: flex;
align-items: center;
gap: 5px;
}
.tarifs__list-price {
font-size: 18px;
font-weight: bold;
color: #fff;
}
.tarifs__list-currency {
font-size: 16px;
opacity: 0.8;
color: #fff;
}
-
05/07/2025 > 12/07/2025
1980 € -
12/07/2025 > 19/07/2025
1980 € -
19/07/2025 > 26/07/2025
1980 € -
26/07/2025 > 02/08/2025
1980 € -
02/08/2025 > 09/08/2025
€ -
09/08/2025 > 16/08/2025
€ -
16/08/2025 > 23/08/2025
€ -
23/08/2025 > 30/08/2025
1980 € -
30/08/2025 > 06/09/2025
1580 € -
06/09/2025 > 13/09/2025
1580 € -
13/09/2025 > 20/09/2025
1580 € -
20/09/2025 > 27/09/2025
1580 € -
27/09/2025 > 04/10/2025
1580 € -
20/12/2025 > 27/12/2025
€ -
27/12/2025 > 03/01/2026
€ -
03/01/2026 > 10/01/2026
2650 € -
10/01/2026 > 17/01/2026
2650 € -
17/01/2026 > 24/01/2026
2900 € -
24/01/2026 > 31/01/2026
2900 € -
31/01/2026 > 07/02/2026
3100 € -
07/02/2026 > 14/02/2026
4850 € -
14/02/2026 > 21/02/2026
€ -
21/02/2026 > 28/02/2026
4850 € -
28/02/2026 > 07/03/2026
4850 € -
07/03/2026 > 14/03/2026
3100 € -
14/03/2026 > 21/03/2026
2300 € -
21/03/2026 > 28/03/2026
2300 € -
28/03/2026 > 04/04/2026
2300 € -
04/04/2026 > 11/04/2026
2300 € -
11/04/2026 > 18/04/2026
2300 € -
18/04/2026 > 25/04/2026
2300 € -
25/04/2026 > 02/05/2026
2300 € -
02/05/2026 > 04/07/2026
Non louable
