// Page Code — paste into the Wix Editor's page code panel (click "Dev Mode" first) // Requires the elements and Data Collection described above. import wixData from 'wix-data'; let currentUnit = 'metric'; let lastBMI = null; let lastCategory = null; $w.onReady(function () { showMetric(); resetReadout(); $w('#unitToggleMetric').onClick(() => { currentUnit = 'metric'; showMetric(); computeBMI(); }); $w('#unitToggleImperial').onClick(() => { currentUnit = 'imperial'; showImperial(); computeBMI(); }); ['#heightCmInput', '#weightKgInput', '#heightFtInput', '#heightInInput', '#weightLbInput'].forEach((id) => { $w(id).onInput(() => computeBMI()); }); $w('#sendToFormButton').onClick(sendToForm); $w('#submitButton').onClick(handleSubmit); $w('#formErrorText').hide(); $w('#bmiChipText').hide(); $w('#successBox').hide(); }); function showMetric() { $w('#metricBox').expand(); $w('#imperialBox').collapse(); } function showImperial() { $w('#imperialBox').expand(); $w('#metricBox').collapse(); } // BMI 15–40 mapped to 0–100% for the progress bar function bmiToPercent(bmi) { const clamped = Math.max(15, Math.min(40, bmi)); return ((clamped - 15) / 25) * 100; } function categoryFor(bmi) { if (bmi < 18.5) { return { label: 'Underweight', color: '#6C93B0', note: 'Below typical range — a nutritionist can help build toward a sustainable weight.' }; } if (bmi < 25) { return { label: 'Normal weight', color: '#5C8A5F', note: 'Within the typical range for most adults.' }; } if (bmi < 30) { return { label: 'Overweight', color: '#E0A93E', note: 'Above typical range — worth a conversation about sustainable changes.' }; } return { label: 'Obese', color: '#D8654B', note: 'Well above typical range — a nutritionist can help build a realistic plan.' }; } function computeBMI() { let heightM, weightKg; if (currentUnit === 'metric') { const cm = Number($w('#heightCmInput').value); const kg = Number($w('#weightKgInput').value); if (!cm || !kg) { resetReadout(); return; } heightM = cm / 100; weightKg = kg; } else { const ft = Number($w('#heightFtInput').value) || 0; const inch = Number($w('#heightInInput').value) || 0; const lb = Number($w('#weightLbInput').value); if ((!ft && !inch) || !lb) { resetReadout(); return; } heightM = ((ft * 12) + inch) * 0.0254; weightKg = lb * 0.453592; } if (heightM <= 0) { resetReadout(); return; } const bmi = weightKg / (heightM * heightM); const cat = categoryFor(bmi); lastBMI = bmi; lastCategory = cat.label; $w('#bmiValueText').text = bmi.toFixed(1); $w('#bmiCategoryText').text = cat.label; $w('#bmiCategoryText').style.color = cat.color; $w('#bmiNoteText').text = cat.note; $w('#bmiProgressBar').value = bmiToPercent(bmi); } function resetReadout() { lastBMI = null; lastCategory = null; $w('#bmiValueText').text = '—'; $w('#bmiCategoryText').text = 'Enter your numbers'; $w('#bmiCategoryText').style.color = '#7C907F'; $w('#bmiNoteText').text = 'Fill in height and weight to see where you fall.'; $w('#bmiProgressBar').value = 0; } function sendToForm() { if (lastBMI) { $w('#bmiChipText').text = `Your BMI: ${lastBMI.toFixed(1)} · ${lastCategory}`; $w('#bmiChipText').show(); } $w('#consultSection').scrollTo(); } function handleSubmit() { const name = $w('#nameInput').value.trim(); const email = $w('#emailInput').value.trim(); const goal = $w('#goalDropdown').value; $w('#formErrorText').hide(); if (!name || !email || !goal) { $w('#formErrorText').text = 'Please fill in your name, email, and goal.'; $w('#formErrorText').show(); return; } const record = { name, email, phone: $w('#phoneInput').value, goal, notes: $w('#notesInput').value, bmi: lastBMI ? Number(lastBMI.toFixed(1)) : null, bmiCategory: lastCategory, submittedDate: new Date() }; $w('#submitButton').disable(); wixData.insert('NutritionistLeads', record) .then(() => { $w('#consultForm').hide(); $w('#successBox').show(); $w('#successNameText').text = `Request received, ${name.split(' ')[0]}`; }) .catch((err) => { console.error('Insert failed:', err); $w('#formErrorText').text = 'Something went wrong — please try again.'; $w('#formErrorText').show(); $w('#submitButton').enable(); }); }
top of page

Let's Start Your Fitness Journey

Have questions about our nutrition plans, personal training, or online group classes? Fill out the form below, and our team will get back to you within 24 hours with the guidance you need.

Business Info

Address:

Email:

proteinworkk@gmail.com

Phone:

9831153184

Opening Hours

Mon - Fri

6:00 am – 8:00 pm

Saturday

6:00 am – 6:00 pm

Sunday

6:00 am – 6:00 pm

Contact

Contact us

bottom of page