/* ========================================================================== CREA DISEÑO & CONSTRUCCIÓN · FORMULARIO DE CONTACTO Y WHATSAPP ========================================================================== */ document.addEventListener('DOMContentLoaded', () => { // Botones de Estado de Presupuesto en el Formulario Dark const budgetStatusButtons = document.querySelectorAll('.budget-status-btn-dark'); const budgetStatusInput = document.getElementById('form-budget-status-val'); if (budgetStatusButtons.length > 0 && budgetStatusInput) { budgetStatusButtons.forEach(btn => { btn.addEventListener('click', () => { budgetStatusButtons.forEach(b => b.classList.remove('active')); btn.classList.add('active'); budgetStatusInput.value = btn.getAttribute('data-status'); }); }); } // Envío del Formulario de Contacto directo a WhatsApp const contactForm = document.getElementById('contact-form'); if (contactForm) { contactForm.addEventListener('submit', (e) => { e.preventDefault(); const nombre = document.getElementById('form-nombre') ? document.getElementById('form-nombre').value.trim() : ''; const apellido = document.getElementById('form-apellido') ? document.getElementById('form-apellido').value.trim() : ''; const telefono = document.getElementById('form-telefono') ? document.getElementById('form-telefono').value.trim() : ''; const email = document.getElementById('form-email') ? document.getElementById('form-email').value.trim() : ''; const servicio = document.getElementById('form-servicio') ? document.getElementById('form-servicio').value : ''; const estadoPresupuesto = budgetStatusInput ? budgetStatusInput.value : ''; const mensaje = document.getElementById('form-mensaje') ? document.getElementById('form-mensaje').value.trim() : ''; const textoWa = `*CONSULTA TÉCNICA WEB - CREA MDP* ▪ *Nombre:* ${nombre} ${apellido} ▪ *Teléfono:* ${telefono} ▪ *Email:* ${email || 'No especificado'} ▪ *Servicio de Interés:* ${servicio} ▪ *Presupuesto Estimado:* ${estadoPresupuesto} ▪ *Mensaje:* ${mensaje || 'Sin comentarios adicionales'}`; const waUrl = `https://wa.me/5492235336283?text=${encodeURIComponent(textoWa)}`; window.open(waUrl, '_blank'); }); } });