Nutrition Journey Questionnaire
Processing...

Your Nutrition Journey

Let's create a personalized eating plan that fits your lifestyle, preferences, and health goals. Take your time with each section.

Step 1 of 3 33%
Getting to Know You

Let's start with the basics. This helps us understand your foundation and contact you with your personalized plan.

Include country code (e.g., +92 for Pakistan)

Health & Wellness

Understanding your health helps us create a safe, effective plan.

Your Food Preferences

The best diet is one you'll actually enjoy and stick with.

Perfect! We've Got Your Details

Your nutrition profile is complete! We've sent a copy to you and notified our team. Our expert will review your information and create a personalized eating plan just for you.

You can now connect directly with our nutrition expert on WhatsApp for immediate assistance and to receive your custom plan.

Chat on WhatsApp

Click "Email Me a Copy" to receive your nutrition profile in your inbox.

`;// Prepare template parameters for admin notification email const adminTemplateParams = { to_name: 'Nutrition Team', to_email: 'info.dietie@gmail.com', // YOUR EMAIL ADDRESS from_name: 'Nutrition Journey Form', subject: `New Client: ${formData.name} - Nutrition Questionnaire`, message: adminPlainText, html_message: adminHtmlContent, client_name: formData.name, client_email: formData.email, client_whatsapp: formData.whatsapp, submission_date: formData.submissionDate, reply_to: formData.email };// Send admin notification email emailjs.send('service_t1d9pgt', 'template_m2o01qn', adminTemplateParams) .then(function(response) { console.log('Admin notification sent successfully!', response);// After sending to admin, also send to user sendEmailToUser(formData); }) .catch(function(error) { console.error('Admin email error:', error);// Even if admin email fails, still try to send to user and show completion sendEmailToUser(formData);// Show warning that admin notification failed showEmailStatus('Note: Could not send notification to our team. Your form has been submitted.', 'error'); }); }// MODIFIED: Function to send email to user function sendEmailToUser() { if (!formData) { formData = getFormData(); }const userEmail = formData.email;if (!userEmail || userEmail === 'Not provided') { showEmailStatus('Please provide a valid email address first.', 'error'); loading.classList.remove('show'); return; }// Show sending status showEmailStatus('Sending your nutrition profile to your email...', 'sending'); emailBtn.disabled = true;// Create plain text content for user (same as PDF format) const userPlainText = `Your Nutrition Journey QuestionnairePersonalized Assessment Results1. Personal InformationName: ${formData.name} Age: ${formData.age} Height: ${formData.height} Weight: ${formData.weight} Email: ${formData.email} WhatsApp: ${formData.whatsapp} Submitted: ${formData.submissionDate}2. Lifestyle & Activity${formData.activity}3. Health InformationDiabetes Status: ${formData.diabetes} Other Conditions: ${formData.conditions} Allergies/Intolerances: ${formData.allergies}4. Dietary PreferencesEating Style: ${formData.diet} Primary Goal: ${formData.goal} Foods You Love: ${formData.likes} Foods You Avoid: ${formData.dislikes}5. Contact Our ExpertConnect with our nutrition expert on WhatsApp:WhatsApp Number: 971527069679Your custom plan will be delivered via WhatsApp and email. You can also expect follow-up support and adjustments.Thank you for taking this important step toward better health!`;// Create HTML content for user const userHtmlContent = `

Your Nutrition Journey Questionnaire

Personalized Assessment Results
1. Personal Information
Name: ${formData.name}
Age: ${formData.age}
Height: ${formData.height}
Weight: ${formData.weight}
Email: ${formData.email}
WhatsApp: ${formData.whatsapp}
Submitted: ${formData.submissionDate}
2. Lifestyle & Activity
${formData.activity}
3. Health Information
Diabetes Status: ${formData.diabetes}
Other Conditions: ${formData.conditions}
Allergies/Intolerances: ${formData.allergies}
4. Dietary Preferences
Eating Style: ${formData.diet}
Primary Goal: ${formData.goal}
Foods You Love: ${formData.likes}
Foods You Avoid: ${formData.dislikes}
5. Contact Our Expert

Connect with our nutrition expert on WhatsApp:

WhatsApp Number: +971527069679

Message: "Hi! I need diet plan for my self."

Your custom plan will be delivered via WhatsApp and email.

You can also expect follow-up support and adjustments.

Thank you for taking this important step toward better health!

`;// Prepare template parameters for user email const userTemplateParams = { to_name: formData.name, to_email: userEmail, from_name: 'Nutrition Journey Team', subject: `Your Nutrition Questionnaire - ${formData.name}`, message: userPlainText, html_message: userHtmlContent, user_name: formData.name, user_email: userEmail, user_whatsapp: formData.whatsapp, submission_date: formData.submissionDate, reply_to: 'noreply@nutritionjourney.com' };// Send email to user emailjs.send('service_t1d9pgt', 'template_m2o01qn', userTemplateParams) .then(function(response) { console.log('User email sent successfully!', response.status, response.text);loading.classList.remove('show'); showCompletionScreen(); showEmailStatus('Your nutrition profile has been sent to your email! Check your inbox.', 'success'); }) .catch(function(error) { console.error('User email error:', error);loading.classList.remove('show'); showCompletionScreen(); showEmailStatus('Could not send email. Please use "Email Me a Copy" button.', 'error'); }) .finally(function() { emailBtn.disabled = false; }); }function showCompletionScreen() { document.getElementById('complete-screen').classList.add('active'); sections.forEach(section => { if (section.id !== 'complete-screen') { section.classList.remove('active'); } }); progressFill.style.width = '100%'; currentStep.textContent = 'Complete!'; progressPercent.textContent = '100%'; }// Function to show email status messages function showEmailStatus(message, type) { emailStatusText.textContent = message; emailStatus.className = 'email-status';switch(type) { case 'success': emailStatus.classList.add('email-success'); break; case 'error': emailStatus.classList.add('email-error'); break; case 'sending': emailStatus.classList.add('email-sending'); break; }emailStatus.style.display = 'block';// Auto-hide success messages after 5 seconds if (type === 'success') { setTimeout(() => { emailStatus.style.display = 'none'; }, 5000); } }function generatePDF() { loading.classList.add('show');setTimeout(() => { try { if (!formData) { formData = getFormData(); }// Create PDF document const doc = new jsPDF();// Set document properties doc.setProperties({ title: 'Nutrition Questionnaire - ' + formData.name, subject: 'Personalized Nutrition Plan Assessment', author: 'Nutrition Journey Team', keywords: 'nutrition, diet, health, wellness, questionnaire' });// Add a simple header doc.setFillColor(123, 181, 125); doc.rect(0, 0, 210, 25, 'F');// Title doc.setTextColor(255, 255, 255); doc.setFontSize(16); doc.setFont("helvetica", "bold"); doc.text("Your Nutrition Journey Questionnaire", 105, 15, null, null, "center");// Subtitle doc.setFontSize(9); doc.setFont("helvetica", "normal"); doc.text("Personalized Assessment Results", 105, 22, null, null, "center");let y = 35;// Personal Information doc.setTextColor(44, 85, 48); doc.setFontSize(14); doc.setFont("helvetica", "bold"); doc.text("1. Personal Information", 14, y);y += 10; doc.setTextColor(0, 0, 0); doc.setFontSize(10); doc.setFont("helvetica", "normal");doc.text(`Name: ${formData.name}`, 14, y); y += 7; doc.text(`Age: ${formData.age}`, 14, y); y += 7; doc.text(`Height: ${formData.height}`, 14, y); y += 7; doc.text(`Weight: ${formData.weight}`, 14, y); y += 7; doc.text(`Email: ${formData.email}`, 14, y); y += 7; doc.text(`WhatsApp: ${formData.whatsapp}`, 14, y); y += 7; doc.text(`Submitted: ${formData.submissionDate}`, 14, y);y += 15;// Lifestyle & Activity doc.setTextColor(44, 85, 48); doc.setFontSize(14); doc.setFont("helvetica", "bold"); doc.text("2. Lifestyle & Activity", 14, y);y += 10; doc.setTextColor(0, 0, 0); doc.setFontSize(10); doc.setFont("helvetica", "normal"); doc.text(`${formData.activity}`, 14, y);y += 15;// Health Information doc.setTextColor(44, 85, 48); doc.setFontSize(14); doc.setFont("helvetica", "bold"); doc.text("3. Health Information", 14, y);y += 10; doc.setTextColor(0, 0, 0); doc.setFontSize(10); doc.setFont("helvetica", "normal");doc.text(`Diabetes Status: ${formData.diabetes}`, 14, y); y += 7; doc.text(`Other Conditions: ${formData.conditions}`, 14, y); y += 7; doc.text(`Allergies/Intolerances: ${formData.allergies}`, 14, y);y += 15;// Dietary Preferences doc.setTextColor(44, 85, 48); doc.setFontSize(14); doc.setFont("helvetica", "bold"); doc.text("4. Dietary Preferences", 14, y);y += 10; doc.setTextColor(0, 0, 0); doc.setFontSize(10); doc.setFont("helvetica", "normal");doc.text(`Eating Style: ${formData.diet}`, 14, y); y += 7; doc.text(`Primary Goal: ${formData.goal}`, 14, y); y += 10;// Favorite Foods const likesText = doc.splitTextToSize(`Foods You Love: ${formData.likes}`, 180); doc.text(likesText, 14, y); y += (likesText.length * 6);y += 5;// Disliked Foods const dislikesText = doc.splitTextToSize(`Foods You Avoid: ${formData.dislikes}`, 180); doc.text(dislikesText, 14, y); y += (dislikesText.length * 6);y += 15;// Contact Information doc.setTextColor(44, 85, 48); doc.setFontSize(14); doc.setFont("helvetica", "bold"); doc.text("5. Contact Our Expert", 14, y);y += 10; doc.setTextColor(0, 0, 0); doc.setFontSize(10); doc.setFont("helvetica", "normal");const contactText = [ "Connect with our nutrition expert on WhatsApp:", "", "WhatsApp Number: +971527069679", "Message: 'Hi! I need diet plan for my self.'", "", "Your custom plan will be delivered via WhatsApp and email.", "You can also expect follow-up support and adjustments.", "", "Thank you for taking this important step toward better health!" ];contactText.forEach(line => { if (line === "") { y += 5; } else { doc.text(line, 14, y); y += 6; } });// Add page number doc.setFontSize(8); doc.setTextColor(150, 150, 150); doc.text("Page 1 of 1", 105, 290, null, null, "center");// Generate filename const safeName = formData.name.replace(/[^a-z0-9]/gi, '_').toLowerCase(); const filename = `nutrition_questionnaire_${safeName}.pdf`;// Save the PDF doc.save(filename);} catch (error) { console.error('PDF Error:', error); alert('There was an issue creating the PDF. Please try again.'); } finally { loading.classList.remove('show'); } }, 800); }function resetForm() { // Reset all form fields document.getElementById('name').value = ''; document.getElementById('age').value = ''; document.getElementById('height').value = ''; document.getElementById('weight').value = ''; document.getElementById('email').value = ''; document.getElementById('whatsapp').value = ''; document.getElementById('allergies').value = ''; document.getElementById('likes').value = ''; document.getElementById('dislikes').value = '';// Reset radio buttons document.querySelectorAll('input[type="radio"]').forEach(radio => { radio.checked = false; });// Reset checkboxes document.querySelectorAll('input[type="checkbox"]').forEach(cb => { cb.checked = false; });// Reset WhatsApp link whatsappLink.href = 'https://wa.me/971527069679?text=Hi!%20I%20need%20diet%20plan%20for%20my%20self.';// Reset form data formData = null;// Hide email status emailStatus.style.display = 'none'; emailBtn.disabled = false;// Go back to first section showSection(0); }// Initialize updateProgress();// Add some interactive elements document.querySelectorAll('input, textarea').forEach(element => { element.addEventListener('focus', function() { this.parentElement.style.transform = 'translateY(-2px)'; });element.addEventListener('blur', function() { this.parentElement.style.transform = 'translateY(0)'; }); });// Format WhatsApp number as user types document.getElementById('whatsapp').addEventListener('input', function(e) { let value = e.target.value.replace(/\D/g, '');// Ensure it starts with + if (!value.startsWith('+')) { value = '+' + value; }e.target.value = value; });// Add some interactive elements document.querySelectorAll('input, textarea').forEach(element => { element.addEventListener('focus', function() { this.parentElement.style.transform = 'translateY(-2px)'; });element.addEventListener('blur', function() { this.parentElement.style.transform = 'translateY(0)'; }); });// Format WhatsApp number as user types document.getElementById('whatsapp').addEventListener('input', function(e) { // Get value and remove everything except digits let value = e.target.value.replace(/\D/g, '');// Prefix with + if there is a value if (value.length > 0) { e.target.value = '+' + value; } else { e.target.value = ''; } });// REMOVED: The window.resize event listener has been deleted // because it was causing the page to jump to the top on mobile.