document.addEventListener('DOMContentLoaded', () => { // Add any global JavaScript functionality here console.log('Mystic Void Explorer initialized'); // Example: Toggle dark mode const toggleDarkMode = () => { document.documentElement.classList.toggle('dark'); }; }); // Example component interaction class VoidExplorer { constructor() { this.init(); } init() { console.log('Void exploration systems online'); // Initialize solar registration form if on that page if (window.location.pathname.includes('solar-registration')) { this.initSolarRegistration(); } } initSolarRegistration() { console.log('Solar registration system initializing...'); // Form state const formData = { company_id: '', property_type: 'RESIDENTIAL_SINGLE_FAMILY', monthly_consumption: '', consumption_profile: 'MEDIUM', roof_area: '', roof_type: 'FLAT', roof_orientation: 'SOUTH', roof_age: 0, roof_condition: 'good', shading_issues: 'none', electrical_capacity: '', current_energy_rate: '', preferred_installation_timeline: '3_months', budget_range: '20k-50k', financing_interest: 'loan', property_address: '', property_city: '', property_state: '', property_country: 'Brazil', utility_company: '', net_metering_eligible: true, previous_solar_consideration: false, solar_installation_year: null, energy_goals: [], financing_preferences: [], installer_preference: [], }; let currentStep = 1; const totalSteps = 3; // DOM elements const form = document.getElementById('registration-form'); const stepCounter = document.getElementById('step-counter'); const progressBar = document.getElementById('progress-bar'); const nextButton = document.getElementById('next-button'); const submitButton = document.getElementById('submit-button'); const backButtonContainer = document.getElementById('back-button-container'); // Step containers const step1 = document.getElementById('step-1'); const step2 = document.getElementById('step-2'); const step3 = document.getElementById('step-3'); // Render step 1 step1.innerHTML = `

Informações do Imóvel

`; // Render step 2 step2.innerHTML = `

Informações Energéticas e Financeiras

`; // Render step 3 step3.innerHTML = `

Objetivos e Preferências

`; // Event listeners nextButton.addEventListener('click', () => { currentStep++; updateForm(); }); form.addEventListener('submit', (e) => { e.preventDefault(); // Collect all form data const formElements = form.elements; for (let i = 0; i < formElements.length; i++) { const element = formElements[i]; if (element.name) { if (element.type === 'checkbox') { if (element.checked) { if (!formData[element.name]) { formData[element.name] = []; } formData[element.name].push(element.value); } } else { formData[element.name] = element.value; } } } console.log('Form submitted:', formData); alert('Cadastro enviado com sucesso!'); // In a real app, you would send this data to your backend }); function updateForm() { // Update step counter stepCounter.textContent = `Passo ${currentStep} de ${totalSteps}`; // Update progress bar progressBar.style.width = `${(currentStep / totalSteps) * 100}%`; // Show/hide steps step1.classList.toggle('hidden', currentStep !== 1); step2.classList.toggle('hidden', currentStep !== 2); step3.classList.toggle('hidden', currentStep !== 3); // Update buttons if (currentStep === totalSteps) { nextButton.classList.add('hidden'); submitButton.classList.remove('hidden'); } else { nextButton.classList.remove('hidden'); submitButton.classList.add('hidden'); } // Update back button if (currentStep > 1) { backButtonContainer.innerHTML = ` `; document.getElementById('back-button').addEventListener('click', () => { currentStep--; updateForm(); }); } else { backButtonContainer.innerHTML = ''; } } } } new VoidExplorer();