{#
Drawer "Créer mon espace séjour" - Premium Flow
Stripe-level UX · Conversion max · Sans pitié
#}
<!-- Overlay -->
<div class="s5-drawer-overlay" id="s5DrawerOverlay"></div>
<!-- Drawer -->
<div class="s5-drawer" id="s5Drawer" role="dialog" aria-modal="true" aria-labelledby="s5DrawerTitle">
<!-- Header (fixed) -->
<header class="s5-drawer-header">
<div class="s5-drawer-header-content">
<div class="s5-drawer-step-badge" id="s5StepBadge">Étape 1/2</div>
<h2 class="s5-drawer-title" id="s5DrawerTitle">Créez votre séjour</h2>
<p class="s5-drawer-subtitle">Activation sans frais pour votre structure. Les accès familles peuvent être proposés en option… ou offerts par vous.</p>
</div>
<button type="button" class="s5-drawer-close" id="s5DrawerClose" aria-label="Fermer">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 6L6 18M6 6l12 12"/>
</svg>
</button>
</header>
<!-- Body (scrollable) -->
<div class="s5-drawer-body" id="s5DrawerBody">
<!-- STEP 1 -->
<div class="s5-step" data-step="1" id="s5Step1">
<!-- Profile Selector -->
<div class="s5-section">
<label class="s5-section-label">Vous êtes :</label>
<div class="s5-pills" role="radiogroup" aria-label="Type de structure">
<button type="button" class="s5-pill active" data-profile="ecole_publique" role="radio" aria-checked="true">
École publique
</button>
<button type="button" class="s5-pill" data-profile="ecole_privee" role="radio" aria-checked="false">
École privée
</button>
<button type="button" class="s5-pill" data-profile="organisme" role="radio" aria-checked="false">
Organisme / Mairie
</button>
<button type="button" class="s5-pill" data-profile="autre" role="radio" aria-checked="false">
Autre
</button>
</div>
</div>
<!-- Free notice for public schools -->
<div class="s5-free-notice" id="s5FreeNotice">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
<polyline points="22 4 12 14.01 9 11.01"/>
</svg>
<span>Soutien aux écoles publiques : service offert</span>
</div>
<!-- Plans -->
<div class="s5-section">
<label class="s5-section-label">Choisissez votre formule</label>
<div class="s5-plans">
<!-- Plan: Séjour unique -->
<button type="button" class="s5-plan-card active" data-plan="sejour_unique" data-base-price="0" aria-pressed="true">
<div class="s5-plan-header">
<span class="s5-plan-name">Séjour unique</span>
</div>
<ul class="s5-plan-features">
<li>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
Photos & vidéos illimitées
</li>
<li>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
Localisation en temps réel
</li>
<li>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
Jusqu'à 45 enfants
</li>
</ul>
<div class="s5-plan-check">
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>
</div>
</button>
<!-- Plan: Pack annuel -->
<button type="button" class="s5-plan-card" data-plan="pack_annuel" data-base-price="490" aria-pressed="false">
<div class="s5-plan-badge">Recommandé</div>
<div class="s5-plan-header">
<span class="s5-plan-name">Pack annuel</span>
</div>
<ul class="s5-plan-features">
<li>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
Jusqu'à 25 séjours / an
</li>
<li>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
Boîte vocale incluse
</li>
<li>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
Support prioritaire
</li>
</ul>
<div class="s5-plan-check">
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>
</div>
</button>
</div>
</div>
<!-- Enterprise link -->
<a href="/Accueil5sur5/devenir_partenaire" class="s5-enterprise-link">
Plus de 25 séjours/an ? <span>Nous contacter →</span>
</a>
</div>
<!-- STEP 2 -->
<div class="s5-step" data-step="2" id="s5Step2" style="display:none;">
<div class="s5-section">
<label class="s5-section-label">Options</label>
<!-- Voice Option -->
<div class="s5-option-card" id="s5VoiceOption">
<div class="s5-option-content">
<div class="s5-option-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>
</svg>
</div>
<div class="s5-option-text">
<span class="s5-option-title">Boîte vocale téléphonique</span>
<span class="s5-option-desc">À chaque message vocal publié, les parents reçoivent un appel.</span>
</div>
<div class="s5-option-right">
<label class="s5-toggle">
<input type="checkbox" id="s5VoiceToggle" aria-label="Ajouter boîte vocale">
<span class="s5-toggle-slider"></span>
</label>
</div>
</div>
<div class="s5-option-tiers" id="s5VoiceTiers" style="display:none;">
<button type="button" class="s5-tier active" data-tier="35" data-price="40">
<span class="s5-tier-label">Jusqu'à 35 enfants</span>
</button>
<button type="button" class="s5-tier" data-tier="70" data-price="70">
<span class="s5-tier-label">Jusqu'à 70 enfants</span>
</button>
</div>
</div>
</div>
<!-- Summary card -->
<div class="s5-summary-card">
<div class="s5-summary-row">
<span>Formule</span>
<span id="s5SummaryPlan">Séjour unique</span>
</div>
<div class="s5-summary-row" id="s5SummaryVoiceRow" style="display:none;">
<span>Boîte vocale</span>
<span id="s5SummaryVoice">Activée</span>
</div>
</div>
</div>
</div>
<!-- Footer (sticky) -->
<footer class="s5-drawer-footer">
<div class="s5-footer-recap">
<span id="s5FooterRecap">Séjour unique</span>
<span class="s5-footer-total" id="s5FooterTotal">Activation gratuite</span>
</div>
<div class="s5-footer-actions">
<button type="button" class="s5-btn-back" id="s5BtnBack" style="display:none;">
← Retour
</button>
<button type="button" class="s5-btn-primary" id="s5BtnContinue">
Créer mon séjour
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M12 5l7 7-7 7"/></svg>
</button>
</div>
<p class="s5-footer-trust">Activation sans frais pour votre structure. Les accès familles peuvent être proposés en option… ou offerts par vous.</p>
</footer>
</div>
<style>
/* ========================================
5sur5 DRAWER - Premium Flow
Scoped styles: .s5-drawer-*
======================================== */
/* Variables */
.s5-drawer,
.s5-drawer-overlay {
--s5-teal: #41a2aa;
--s5-teal-dark: #2d8a91;
--s5-teal-light: rgba(65, 162, 170, 0.08);
--s5-teal-border: rgba(65, 162, 170, 0.3);
--s5-orange: #f09e7a;
--s5-text: #1a1a1a;
--s5-text-secondary: #5f6368;
--s5-text-muted: #80868b;
--s5-border: #e8eaed;
--s5-bg: #ffffff;
--s5-bg-hover: #f8f9fa;
--s5-radius: 14px;
--s5-radius-sm: 8px;
--s5-shadow: 0 24px 80px -12px rgba(0,0,0,0.25);
--s5-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Overlay */
.s5-drawer-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(4px);
z-index: 10000;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s ease, visibility 0.3s ease;
}
.s5-drawer-overlay.active {
opacity: 1;
visibility: visible;
}
/* Drawer */
.s5-drawer {
position: fixed;
top: 0;
right: 0;
width: 480px;
max-width: 100%;
height: 100%;
background: var(--s5-bg);
z-index: 10001;
display: flex;
flex-direction: column;
box-shadow: var(--s5-shadow);
transform: translateX(100%);
transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
-webkit-font-smoothing: antialiased;
}
.s5-drawer.active {
transform: translateX(0);
}
/* Header */
.s5-drawer-header {
padding: 20px 24px 16px;
border-bottom: 1px solid var(--s5-border);
position: relative;
flex-shrink: 0;
}
.s5-drawer-header-content {
padding-right: 40px;
}
/* Masquer tout bouton "Je me connecte" dans le drawer */
.s5-drawer .btn-primary[data-bs-target="#modal-login"],
.s5-drawer [data-bs-target="#modal-login"],
.s5-drawer a[href*="modal-login"],
.s5-drawer .s5-drawer-header .btn,
.s5-drawer .s5-drawer-header-content .btn {
display: none !important;
}
.s5-drawer-step-badge {
display: inline-block;
padding: 4px 10px;
background: var(--s5-teal-light);
color: var(--s5-teal);
font-size: 12px;
font-weight: 600;
border-radius: 100px;
margin-bottom: 8px;
}
.s5-drawer-title {
font-size: 22px;
font-weight: 700;
color: var(--s5-text);
margin: 0 0 4px;
line-height: 1.2;
}
.s5-drawer-subtitle {
font-size: 14px;
color: var(--s5-text-secondary);
margin: 0;
}
.s5-drawer-close {
position: absolute;
top: 16px;
right: 16px;
width: 36px;
height: 36px;
border: none;
background: transparent;
color: var(--s5-text-muted);
cursor: pointer;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
transition: var(--s5-transition);
}
.s5-drawer-close:hover {
background: var(--s5-bg-hover);
color: var(--s5-text);
}
/* Body */
.s5-drawer-body {
flex: 1;
overflow-y: auto;
padding: 20px 24px;
}
/* Steps */
.s5-step {
animation: s5FadeIn 0.25s ease;
}
@keyframes s5FadeIn {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
/* Sections */
.s5-section {
margin-bottom: 20px;
}
.s5-section-label {
display: block;
font-size: 13px;
font-weight: 600;
color: var(--s5-text-secondary);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 10px;
}
/* Pills */
.s5-pills {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.s5-pill {
padding: 8px 14px;
font-size: 13px;
font-weight: 500;
color: var(--s5-text-secondary);
background: var(--s5-bg);
border: 1.5px solid var(--s5-border);
border-radius: 100px;
cursor: pointer;
transition: var(--s5-transition);
white-space: nowrap;
}
.s5-pill:hover {
border-color: var(--s5-teal-border);
color: var(--s5-teal);
}
.s5-pill.active {
background: var(--s5-teal);
border-color: var(--s5-teal);
color: #fff;
}
/* Free notice */
.s5-free-notice {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
background: linear-gradient(135deg, rgba(65, 162, 170, 0.08), rgba(65, 162, 170, 0.04));
border-radius: var(--s5-radius-sm);
font-size: 13px;
font-weight: 500;
color: var(--s5-teal-dark);
margin-bottom: 20px;
}
.s5-free-notice svg {
color: var(--s5-teal);
flex-shrink: 0;
}
.s5-free-notice.hidden {
display: none;
}
/* Plans */
.s5-plans {
display: flex;
flex-direction: column;
gap: 12px;
}
.s5-plan-card {
position: relative;
width: 100%;
padding: 18px 20px;
background: var(--s5-bg);
border: 2px solid var(--s5-border);
border-radius: var(--s5-radius);
cursor: pointer;
transition: var(--s5-transition);
text-align: left;
display: flex;
flex-direction: column;
gap: 8px;
}
.s5-plan-card:hover {
border-color: var(--s5-teal-border);
}
.s5-plan-card.active {
border-color: var(--s5-teal);
background: var(--s5-teal-light);
}
.s5-plan-badge {
position: absolute;
top: -10px;
right: 16px;
padding: 4px 10px;
background: var(--s5-orange);
color: #fff;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.3px;
border-radius: 100px;
}
.s5-plan-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.s5-plan-name {
font-size: 16px;
font-weight: 600;
color: var(--s5-text);
}
.s5-plan-price {
display: none;
align-items: baseline;
gap: 6px;
flex-wrap: wrap;
}
.s5-price-original {
font-size: 18px;
font-weight: 500;
color: var(--s5-text-muted);
text-decoration: line-through;
display: none;
}
.s5-price-original.visible {
display: inline;
}
.s5-price-value {
font-size: 28px;
font-weight: 700;
color: var(--s5-text);
line-height: 1;
}
.s5-price-value.free {
color: var(--s5-teal);
}
.s5-price-period {
font-size: 13px;
color: var(--s5-text-muted);
}
.s5-price-badge {
display: none;
padding: 3px 8px;
background: linear-gradient(135deg, var(--s5-teal), var(--s5-teal-dark));
color: #fff;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.3px;
border-radius: 100px;
margin-left: 4px;
}
.s5-price-badge.visible {
display: inline-block;
}
.s5-plan-features {
list-style: none;
padding: 0;
margin: 4px 0 0;
display: flex;
flex-direction: column;
gap: 6px;
}
.s5-plan-features li {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: var(--s5-text-secondary);
}
.s5-plan-features svg {
color: var(--s5-teal);
flex-shrink: 0;
}
.s5-plan-check {
position: absolute;
top: 18px;
right: 16px;
width: 24px;
height: 24px;
color: var(--s5-teal);
opacity: 0;
transform: scale(0.8);
transition: var(--s5-transition);
}
.s5-plan-card.active .s5-plan-check {
opacity: 1;
transform: scale(1);
}
/* Enterprise link */
.s5-enterprise-link {
display: block;
text-align: center;
font-size: 13px;
color: var(--s5-text-muted);
text-decoration: none;
padding: 12px 0;
transition: var(--s5-transition);
}
.s5-enterprise-link span {
color: var(--s5-teal);
font-weight: 500;
}
.s5-enterprise-link:hover {
color: var(--s5-text-secondary);
}
.s5-enterprise-link:hover span {
text-decoration: underline;
}
/* Option Card */
.s5-option-card {
background: var(--s5-bg);
border: 2px solid var(--s5-border);
border-radius: var(--s5-radius);
overflow: hidden;
transition: var(--s5-transition);
}
.s5-option-card.active {
border-color: var(--s5-teal);
}
.s5-option-content {
display: flex;
align-items: center;
gap: 14px;
padding: 16px 18px;
}
.s5-option-icon {
width: 44px;
height: 44px;
background: var(--s5-teal-light);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
color: var(--s5-teal);
flex-shrink: 0;
}
.s5-option-text {
flex: 1;
min-width: 0;
}
.s5-option-title {
display: block;
font-size: 14px;
font-weight: 600;
color: var(--s5-text);
margin-bottom: 2px;
}
.s5-option-desc {
display: block;
font-size: 12px;
color: var(--s5-text-muted);
line-height: 1.4;
}
.s5-option-right {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
}
.s5-option-price {
display: none;
font-size: 15px;
font-weight: 600;
color: var(--s5-teal);
}
/* Toggle */
.s5-toggle {
position: relative;
width: 44px;
height: 24px;
cursor: pointer;
}
.s5-toggle input {
opacity: 0;
width: 0;
height: 0;
}
.s5-toggle-slider {
position: absolute;
inset: 0;
background: var(--s5-border);
border-radius: 100px;
transition: var(--s5-transition);
}
.s5-toggle-slider::before {
content: '';
position: absolute;
width: 18px;
height: 18px;
left: 3px;
bottom: 3px;
background: #fff;
border-radius: 50%;
transition: var(--s5-transition);
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.s5-toggle input:checked + .s5-toggle-slider {
background: var(--s5-teal);
}
.s5-toggle input:checked + .s5-toggle-slider::before {
transform: translateX(20px);
}
/* Voice Tiers */
.s5-option-tiers {
display: flex;
gap: 8px;
padding: 0 18px 16px;
}
.s5-tier {
flex: 1;
padding: 10px 12px;
background: var(--s5-bg-hover);
border: 1.5px solid var(--s5-border);
border-radius: var(--s5-radius-sm);
cursor: pointer;
transition: var(--s5-transition);
text-align: center;
}
.s5-tier:hover {
border-color: var(--s5-teal-border);
}
.s5-tier.active {
border-color: var(--s5-teal);
background: var(--s5-teal-light);
}
.s5-tier-label {
display: block;
font-size: 12px;
color: var(--s5-text-secondary);
margin-bottom: 2px;
}
.s5-tier-price {
display: none;
font-size: 14px;
font-weight: 600;
color: var(--s5-text);
}
/* Summary Card */
.s5-summary-card {
background: var(--s5-bg-hover);
border-radius: var(--s5-radius-sm);
padding: 14px 16px;
margin-top: 20px;
}
.s5-summary-row {
display: flex;
justify-content: space-between;
font-size: 13px;
color: var(--s5-text-secondary);
padding: 4px 0;
}
.s5-summary-row span:last-child {
font-weight: 500;
color: var(--s5-text);
}
/* Footer */
.s5-drawer-footer {
padding: 16px 24px 20px;
border-top: 1px solid var(--s5-border);
background: var(--s5-bg);
flex-shrink: 0;
}
.s5-footer-recap {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
color: var(--s5-text-secondary);
margin-bottom: 12px;
}
.s5-footer-total {
color: var(--s5-text);
}
.s5-footer-total strong {
font-size: 18px;
font-weight: 700;
color: var(--s5-teal);
}
.s5-footer-actions {
display: flex;
gap: 10px;
margin-bottom: 12px;
}
.s5-btn-back {
padding: 12px 18px;
font-size: 14px;
font-weight: 500;
color: var(--s5-text-secondary);
background: transparent;
border: 1.5px solid var(--s5-border);
border-radius: var(--s5-radius-sm);
cursor: pointer;
transition: var(--s5-transition);
}
.s5-btn-back:hover {
border-color: var(--s5-text-muted);
color: var(--s5-text);
}
.s5-btn-primary {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 14px 24px;
font-size: 15px;
font-weight: 600;
color: #fff;
background: var(--s5-teal);
border: none;
border-radius: var(--s5-radius-sm);
cursor: pointer;
transition: var(--s5-transition);
}
.s5-btn-primary:hover {
background: var(--s5-teal-dark);
}
.s5-btn-primary:active {
transform: scale(0.98);
}
.s5-footer-trust {
font-size: 11px;
color: var(--s5-text-muted);
text-align: center;
margin: 0;
}
/* Mobile */
@media (max-width: 540px) {
.s5-drawer {
width: 100%;
}
.s5-drawer-header {
padding: 16px 20px 14px;
}
.s5-drawer-title {
font-size: 20px;
}
.s5-drawer-body {
padding: 16px 20px;
}
.s5-drawer-footer {
padding: 14px 20px 16px;
}
.s5-pills {
gap: 6px;
}
.s5-pill {
padding: 7px 12px;
font-size: 12px;
}
.s5-plan-card {
padding: 14px 16px;
}
.s5-price-value {
font-size: 24px;
}
}
</style>
<script>
(function() {
'use strict';
// DOM Elements
const overlay = document.getElementById('s5DrawerOverlay');
const drawer = document.getElementById('s5Drawer');
const closeBtn = document.getElementById('s5DrawerClose');
const step1 = document.getElementById('s5Step1');
const step2 = document.getElementById('s5Step2');
const stepBadge = document.getElementById('s5StepBadge');
const btnContinue = document.getElementById('s5BtnContinue');
const btnBack = document.getElementById('s5BtnBack');
const freeNotice = document.getElementById('s5FreeNotice');
const priceUnique = document.getElementById('s5PriceUnique');
const priceOriginal = document.getElementById('s5PriceOriginal');
const priceBadge = document.getElementById('s5PriceBadge');
const voiceToggle = document.getElementById('s5VoiceToggle');
const voiceTiers = document.getElementById('s5VoiceTiers');
const voicePrice = document.getElementById('s5VoicePrice');
const voiceOptionCard = document.getElementById('s5VoiceOption');
const footerRecap = document.getElementById('s5FooterRecap');
const footerTotal = document.getElementById('s5FooterTotal');
const summaryPlan = document.getElementById('s5SummaryPlan');
const summaryVoiceRow = document.getElementById('s5SummaryVoiceRow');
const summaryVoice = document.getElementById('s5SummaryVoice');
// State
let currentStep = 1;
let state = {
profile: 'ecole_publique',
plan: 'sejour_unique',
voiceEnabled: false,
voiceTier: 35,
voicePrice: 40
};
// Pricing rules
const pricing = {
sejour_unique: {
ecole_publique: 0,
ecole_privee: 39,
organisme: 39,
autre: 39
},
pack_annuel: 490,
voice: { 35: 40, 70: 70 }
};
// Open drawer
window.openSejourDrawer = function() {
overlay.classList.add('active');
drawer.classList.add('active');
document.body.style.overflow = 'hidden';
drawer.querySelector('button').focus();
};
// Close drawer
window.closeSejourDrawer = function() {
overlay.classList.remove('active');
drawer.classList.remove('active');
document.body.style.overflow = '';
resetState();
};
function resetState() {
currentStep = 1;
state = {
profile: 'ecole_publique',
plan: 'sejour_unique',
voiceEnabled: false,
voiceTier: 35,
voicePrice: 40
};
showStep(1);
updateUI();
}
// Events
overlay.addEventListener('click', closeSejourDrawer);
closeBtn.addEventListener('click', closeSejourDrawer);
// Escape key
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && drawer.classList.contains('active')) {
closeSejourDrawer();
}
});
// Profile pills
document.querySelectorAll('.s5-pill').forEach(pill => {
pill.addEventListener('click', () => {
document.querySelectorAll('.s5-pill').forEach(p => {
p.classList.remove('active');
p.setAttribute('aria-checked', 'false');
});
pill.classList.add('active');
pill.setAttribute('aria-checked', 'true');
state.profile = pill.dataset.profile;
updateUI();
});
});
// Plan cards
document.querySelectorAll('.s5-plan-card').forEach(card => {
card.addEventListener('click', () => {
document.querySelectorAll('.s5-plan-card').forEach(c => {
c.classList.remove('active');
c.setAttribute('aria-pressed', 'false');
});
card.classList.add('active');
card.setAttribute('aria-pressed', 'true');
state.plan = card.dataset.plan;
updateUI();
});
});
// Voice toggle
voiceToggle.addEventListener('change', () => {
state.voiceEnabled = voiceToggle.checked;
voiceTiers.style.display = state.voiceEnabled ? 'flex' : 'none';
voiceOptionCard.classList.toggle('active', state.voiceEnabled);
updateUI();
});
// Voice tiers
document.querySelectorAll('.s5-tier').forEach(tier => {
tier.addEventListener('click', () => {
document.querySelectorAll('.s5-tier').forEach(t => t.classList.remove('active'));
tier.classList.add('active');
state.voiceTier = parseInt(tier.dataset.tier);
state.voicePrice = parseInt(tier.dataset.price);
updateUI();
});
});
// Continue button
btnContinue.addEventListener('click', () => {
if (currentStep === 1) {
// If Pack annuel, redirect directly
if (state.plan === 'pack_annuel') {
window.location.href = '/Accueil5sur5/Pack_Annuel_Partenaires';
return;
}
showStep(2);
} else {
// Step 2 -> Submit
submitForm();
}
});
// Back button
btnBack.addEventListener('click', () => {
showStep(1);
});
function showStep(step) {
currentStep = step;
if (step === 1) {
step1.style.display = 'block';
step2.style.display = 'none';
stepBadge.textContent = 'Étape 1/2';
btnBack.style.display = 'none';
btnContinue.innerHTML = 'Créer mon séjour <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M12 5l7 7-7 7"/></svg>';
} else {
step1.style.display = 'none';
step2.style.display = 'block';
stepBadge.textContent = 'Étape 2/2';
btnBack.style.display = 'inline-flex';
btnContinue.innerHTML = 'Créer mon séjour <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>';
}
updateUI();
}
function updateUI() {
const isSchool = ['ecole_publique', 'ecole_privee'].includes(state.profile);
const isPublicSchool = state.profile === 'ecole_publique';
// Free notice
freeNotice.classList.toggle('hidden', !isPublicSchool);
// Hide price displays
if (priceOriginal) priceOriginal.style.display = 'none';
if (priceUnique) priceUnique.style.display = 'none';
if (priceBadge) priceBadge.style.display = 'none';
// Calculate plan label
let planLabel = '';
if (state.plan === 'sejour_unique') {
planLabel = 'Séjour unique';
} else {
planLabel = 'Pack annuel';
}
// Update footer
let recapText = planLabel;
if (state.plan === 'sejour_unique' && state.voiceEnabled) {
recapText += ' + Boîte vocale';
}
footerRecap.textContent = recapText;
// Always show "Activation gratuite" for footer
footerTotal.textContent = 'Activation gratuite';
// Step 2 summary
summaryPlan.textContent = planLabel;
summaryVoiceRow.style.display = state.voiceEnabled ? 'flex' : 'none';
if (summaryVoice) summaryVoice.textContent = 'Activée';
}
function submitForm() {
const params = new URLSearchParams();
params.set('profile', state.profile);
if (state.voiceEnabled) {
params.set('voice_pack', state.voiceTier.toString());
}
let url = '/creation-simple/creer';
// Special redirect for public schools
if (state.profile === 'ecole_publique') {
url = '/ecoles-publiques/creer';
}
window.location.href = url + '?' + params.toString();
}
// Initialize
updateUI();
// S'assurer qu'aucun bouton "Je me connecte" n'apparaît dans le drawer
const observer = new MutationObserver(() => {
const drawer = document.getElementById('s5Drawer');
if (drawer) {
const loginButtons = drawer.querySelectorAll('[data-bs-target="#modal-login"], a[href*="modal-login"], .btn-primary[href*="#modal-login"]');
loginButtons.forEach(btn => btn.remove());
}
});
observer.observe(document.body, { childList: true, subtree: true });
})();
</script>