Spaces:
Running
Running
Create registration.js
Browse files- registration.js +116 -0
registration.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function nextStep(stepNumber) {
|
| 2 |
+
// Remove active class from all steps and progress indicators
|
| 3 |
+
document.querySelectorAll('.step').forEach(step => {
|
| 4 |
+
step.classList.remove('active');
|
| 5 |
+
});
|
| 6 |
+
document.querySelectorAll('.progress-step').forEach(indicator => {
|
| 7 |
+
indicator.classList.remove('active');
|
| 8 |
+
});
|
| 9 |
+
|
| 10 |
+
// Show next step
|
| 11 |
+
const nextStep = document.querySelector(`.step[data-step="${stepNumber}"]`);
|
| 12 |
+
const nextProgressIndicator = document.querySelector(`.progress-step[data-step="${stepNumber}"]`);
|
| 13 |
+
|
| 14 |
+
if (nextStep && nextProgressIndicator) {
|
| 15 |
+
nextStep.classList.add('active');
|
| 16 |
+
nextProgressIndicator.classList.add('active');
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
document.querySelector('#ai-needs-form').addEventListener('submit', function(e) {
|
| 21 |
+
e.preventDefault();
|
| 22 |
+
|
| 23 |
+
// Collect form data
|
| 24 |
+
const formData = {
|
| 25 |
+
name: document.querySelector('input[placeholder="Nom"]').value,
|
| 26 |
+
firstName: document.querySelector('input[placeholder="Prénom"]').value,
|
| 27 |
+
phone: document.querySelector('input[placeholder="Numéro de téléphone WhatsApp"]').value,
|
| 28 |
+
company: document.querySelector('input[placeholder="Nom de l\'entreprise"]').value,
|
| 29 |
+
sector: document.querySelector('input[placeholder="Secteur d\'activité"]').value,
|
| 30 |
+
companySize: document.querySelector('select').value,
|
| 31 |
+
services: Array.from(document.querySelectorAll('input[name="services"]:checked'))
|
| 32 |
+
.map(checkbox => checkbox.nextElementSibling.textContent.trim()),
|
| 33 |
+
objectives: document.querySelector('textarea').value
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
// Create WhatsApp message
|
| 37 |
+
const whatsappMessage = `Nouvelle demande Séli IA Master Agency:
|
| 38 |
+
|
| 39 |
+
Informations Personnelles:
|
| 40 |
+
- Nom: ${formData.name}
|
| 41 |
+
- Prénom: ${formData.firstName}
|
| 42 |
+
- Téléphone: ${formData.phone}
|
| 43 |
+
|
| 44 |
+
Détails de l'Entreprise:
|
| 45 |
+
- Entreprise: ${formData.company}
|
| 46 |
+
- Secteur: ${formData.sector}
|
| 47 |
+
- Taille: ${formData.companySize}
|
| 48 |
+
|
| 49 |
+
Services Sélectionnés:
|
| 50 |
+
${formData.services.map(service => `- ${service}`).join('\n')}
|
| 51 |
+
|
| 52 |
+
Objectifs:
|
| 53 |
+
${formData.objectives}`;
|
| 54 |
+
|
| 55 |
+
// Encode message for WhatsApp
|
| 56 |
+
const encodedMessage = encodeURIComponent(whatsappMessage);
|
| 57 |
+
|
| 58 |
+
// WhatsApp number
|
| 59 |
+
const whatsappNumber = '+22656888879';
|
| 60 |
+
|
| 61 |
+
// Open WhatsApp with pre-filled message
|
| 62 |
+
const whatsappUrl = `https://wa.me/${whatsappNumber}?text=${encodedMessage}`;
|
| 63 |
+
|
| 64 |
+
// Open WhatsApp
|
| 65 |
+
window.open(whatsappUrl, '_blank');
|
| 66 |
+
|
| 67 |
+
// Hide the form and show confirmation
|
| 68 |
+
const currentStep = document.querySelector('.step[data-step="3"]');
|
| 69 |
+
currentStep.innerHTML = `
|
| 70 |
+
<div class="confirmation-message">
|
| 71 |
+
<h2>Merci pour votre demande !</h2>
|
| 72 |
+
<p>Votre formulaire a été envoyé avec succès à Séli IA Master Agency via WhatsApp.</p>
|
| 73 |
+
<p>Notre équipe vous contactera très prochainement pour discuter de vos besoins en IA.</p>
|
| 74 |
+
<button onclick="window.location.reload()">Faire une nouvelle demande</button>
|
| 75 |
+
</div>
|
| 76 |
+
`;
|
| 77 |
+
});
|
| 78 |
+
|
| 79 |
+
// Gallery functionality
|
| 80 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 81 |
+
const galleryButton = document.getElementById('open-services-gallery');
|
| 82 |
+
const galleryModal = document.getElementById('services-gallery-modal');
|
| 83 |
+
const closeModalBtn = document.querySelector('.close-modal');
|
| 84 |
+
|
| 85 |
+
// Initialize Swiper
|
| 86 |
+
const swiper = new Swiper('.services-gallery', {
|
| 87 |
+
slidesPerView: 1,
|
| 88 |
+
spaceBetween: 30,
|
| 89 |
+
loop: true,
|
| 90 |
+
pagination: {
|
| 91 |
+
el: '.swiper-pagination',
|
| 92 |
+
clickable: true
|
| 93 |
+
},
|
| 94 |
+
navigation: {
|
| 95 |
+
nextEl: '.swiper-button-next',
|
| 96 |
+
prevEl: '.swiper-button-prev',
|
| 97 |
+
}
|
| 98 |
+
});
|
| 99 |
+
|
| 100 |
+
// Open modal
|
| 101 |
+
galleryButton.addEventListener('click', function() {
|
| 102 |
+
galleryModal.style.display = 'block';
|
| 103 |
+
});
|
| 104 |
+
|
| 105 |
+
// Close modal
|
| 106 |
+
closeModalBtn.addEventListener('click', function() {
|
| 107 |
+
galleryModal.style.display = 'none';
|
| 108 |
+
});
|
| 109 |
+
|
| 110 |
+
// Close modal when clicking outside of it
|
| 111 |
+
window.addEventListener('click', function(event) {
|
| 112 |
+
if (event.target == galleryModal) {
|
| 113 |
+
galleryModal.style.display = 'none';
|
| 114 |
+
}
|
| 115 |
+
});
|
| 116 |
+
});
|