export function nutritionCoachingCalculator(form: FormTs) {
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Nutrition Coaching Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Goals Section
const goalsSection = form.addSubform('goals', { title: '🎯 Your Goals' });
goalsSection.addRow(row => {
row.addDropdown('primaryGoal', {
label: 'Primary Goal',
options: [
{ id: 'weight-loss', name: 'Weight Loss' },
{ id: 'muscle-gain', name: 'Muscle Building' },
{ id: 'maintenance', name: 'Healthy Maintenance' },
{ id: 'performance', name: 'Athletic Performance' },
{ id: 'medical', name: 'Medical/Therapeutic Diet' },
{ id: 'general', name: 'General Nutrition Education' }
],
defaultValue: 'weight-loss',
isRequired: true
}, '1fr');
row.addDropdown('experienceLevel', {
label: 'Nutrition Knowledge',
options: [
{ id: 'beginner', name: 'Beginner - Need lots of guidance' },
{ id: 'intermediate', name: 'Some knowledge - Need fine-tuning' },
{ id: 'advanced', name: 'Advanced - Want optimization' }
],
defaultValue: 'beginner'
}, '1fr');
});
goalsSection.addRow(row => {
row.addCheckbox('dietaryRestrictions', {
label: 'Have dietary restrictions (allergies, medical)',
defaultValue: false,
tooltip: 'May require specialized expertise'
}, '1fr');
row.addCheckbox('competitionPrep', {
label: 'Competition/Event preparation',
defaultValue: false,
tooltip: 'Bodybuilding, sports events, photoshoots'
}, '1fr');
});
// Coaching Type Section
const coachingSection = form.addSubform('coaching', { title: '👨🏫 Coaching Package' });
coachingSection.addRow(row => {
row.addRadioButton('coachingLevel', {
label: 'Coaching Level',
options: [
{ id: 'basic', name: 'Basic ($99/mo) - Meal plan + weekly check-ins' },
{ id: 'standard', name: 'Standard ($199/mo) - Basic + 2 coaching calls/month' },
{ id: 'premium', name: 'Premium ($349/mo) - Unlimited messaging + weekly calls' },
{ id: 'elite', name: 'Elite ($499/mo) - Full-service with daily accountability' }
],
defaultValue: 'standard',
isRequired: true
});
});
coachingSection.addRow(row => {
row.addDropdown('coachCredentials', {
label: 'Coach Credentials',
options: [
{ id: 'certified', name: 'Certified Nutrition Coach' },
{ id: 'rd', name: 'Registered Dietitian (+$50/mo)' },
{ id: 'specialist', name: 'Sports Nutrition Specialist (+$75/mo)' },
{ id: 'md', name: 'Clinical Nutritionist/MD (+$150/mo)' }
],
defaultValue: 'certified',
tooltip: 'Higher credentials recommended for medical conditions'
});
});
// Program Duration Section
const durationSection = form.addSubform('duration', { title: '📅 Program Duration' });
durationSection.addRow(row => {
row.addRadioButton('programLength', {
label: 'Commitment Length',
options: [
{ id: '1', name: '1 Month (Trial)' },
{ id: '3', name: '3 Months (5% off) - Recommended' },
{ id: '6', name: '6 Months (10% off)' },
{ id: '12', name: '12 Months (20% off)' }
],
defaultValue: '3',
isRequired: true
});
});
durationSection.addRow(row => {
row.addTextPanel('durationTip', {
computedValue: () => 'Tip: Sustainable results typically require 3-6 months of consistent coaching',
customStyles: { 'font-size': '0.85rem', 'color': '#059669', 'font-style': 'italic' }
});
});
// Services Section
const servicesSection = form.addSubform('services', { title: '✨ Additional Services' });
servicesSection.addRow(row => {
row.addCheckbox('customMealPlans', {
label: 'Custom Meal Plans (+$50/mo)',
defaultValue: true,
tooltip: 'Personalized recipes and meal prep guides'
}, '1fr');
row.addCheckbox('groceryLists', {
label: 'Weekly Grocery Lists (+$25/mo)',
defaultValue: false
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('macroTracking', {
label: 'Macro Tracking Setup & Review (+$30/mo)',
defaultValue: false,
tooltip: 'MyFitnessPal setup and weekly reviews'
}, '1fr');
row.addCheckbox('supplementGuidance', {
label: 'Supplement Protocol (+$40/mo)',
defaultValue: false
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('bodyComposition', {
label: 'Body Composition Analysis (+$35/mo)',
defaultValue: false,
tooltip: 'Monthly progress photos and measurements review'
}, '1fr');
row.addCheckbox('fitnessIntegration', {
label: 'Fitness Program Integration (+$50/mo)',
defaultValue: false,
tooltip: 'Nutrition coordinated with your workout program'
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('cookingClasses', {
label: 'Virtual Cooking Sessions (+$75/mo)',
defaultValue: false,
tooltip: '2 live cooking sessions per month'
}, '1fr');
row.addCheckbox('familyPlan', {
label: 'Family Meal Planning (+$60/mo)',
defaultValue: false,
tooltip: 'Meal plans for entire household'
}, '1fr');
});
// One-Time Services Section
const oneTimeSection = form.addSubform('oneTime', { title: '🔬 One-Time Add-Ons' });
oneTimeSection.addRow(row => {
row.addCheckbox('initialAssessment', {
label: 'Comprehensive Initial Assessment ($149)',
defaultValue: false,
tooltip: 'Detailed health history, food journal analysis, and goal setting'
}, '1fr');
row.addCheckbox('metabolicTest', {
label: 'Metabolic Rate Testing ($199)',
defaultValue: false,
tooltip: 'Lab test for accurate calorie needs'
}, '1fr');
});
oneTimeSection.addRow(row => {
row.addCheckbox('foodSensitivity', {
label: 'Food Sensitivity Test ($299)',
defaultValue: false
}, '1fr');
row.addCheckbox('bloodwork', {
label: 'Bloodwork Analysis Review ($99)',
defaultValue: false,
tooltip: 'Review of recent blood panel results'
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// What's Included Section
const includedSection = form.addSubform('included', { title: '📋 Package Includes', isCollapsible: true });
includedSection.addRow(row => {
row.addTextPanel('includedList', {
computedValue: () => {
const level = coachingSection.radioButton('coachingLevel')?.value() || 'standard';
const includes: Record<string, string> = {
'basic': '• Initial nutrition assessment\n• Personalized macro targets\n• Basic meal template\n• Weekly email check-ins\n• Access to recipe database',
'standard': '• Everything in Basic, plus:\n• 2 video coaching calls/month\n• Customized meal plans\n• Priority email support\n• Progress tracking dashboard',
'premium': '• Everything in Standard, plus:\n• Weekly video calls\n• Unlimited messaging support\n• Real-time meal feedback\n• Restaurant dining guides',
'elite': '• Everything in Premium, plus:\n• Daily accountability texts\n• 24/7 priority support\n• Quarterly strategy sessions\n• Personalized recipe development'
};
return includes[level] || '';
},
customStyles: { 'font-size': '0.9rem', 'white-space': 'pre-line', 'color': '#475569' }
});
});
// Cost Breakdown Section
const breakdownSection = form.addSubform('breakdown', { title: '📊 Cost Breakdown', isCollapsible: true });
breakdownSection.addRow(row => {
row.addPriceDisplay('basePrice', {
label: 'Base Coaching',
computedValue: () => {
const level = coachingSection.radioButton('coachingLevel')?.value() || 'standard';
const prices: Record<string, number> = { basic: 99, standard: 199, premium: 349, elite: 499 };
return prices[level] || 199;
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('credentialsFee', {
label: 'Credentials Premium',
computedValue: () => {
const credentials = coachingSection.dropdown('coachCredentials')?.value() || 'certified';
const fees: Record<string, number> = { certified: 0, rd: 50, specialist: 75, md: 150 };
return fees[credentials] || 0;
},
variant: 'default'
}, '1fr');
});
breakdownSection.addRow(row => {
row.addPriceDisplay('servicesFee', {
label: 'Additional Services',
computedValue: () => {
let total = 0;
if (servicesSection.checkbox('customMealPlans')?.value()) total += 50;
if (servicesSection.checkbox('groceryLists')?.value()) total += 25;
if (servicesSection.checkbox('macroTracking')?.value()) total += 30;
if (servicesSection.checkbox('supplementGuidance')?.value()) total += 40;
if (servicesSection.checkbox('bodyComposition')?.value()) total += 35;
if (servicesSection.checkbox('fitnessIntegration')?.value()) total += 50;
if (servicesSection.checkbox('cookingClasses')?.value()) total += 75;
if (servicesSection.checkbox('familyPlan')?.value()) total += 60;
return total;
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('oneTimeFees', {
label: 'One-Time Add-Ons',
computedValue: () => {
let total = 0;
if (oneTimeSection.checkbox('initialAssessment')?.value()) total += 149;
if (oneTimeSection.checkbox('metabolicTest')?.value()) total += 199;
if (oneTimeSection.checkbox('foodSensitivity')?.value()) total += 299;
if (oneTimeSection.checkbox('bloodwork')?.value()) total += 99;
return total;
},
variant: 'default'
}, '1fr');
});
// Summary Section
const summarySection = form.addSubform('summary', {
title: '💰 Your Investment',
isCollapsible: false,
sticky: 'bottom'
});
summarySection.addRow(row => {
row.addPriceDisplay('monthlyTotal', {
label: 'Monthly Cost',
computedValue: () => {
const level = coachingSection.radioButton('coachingLevel')?.value() || 'standard';
const credentials = coachingSection.dropdown('coachCredentials')?.value() || 'certified';
const duration = durationSection.radioButton('programLength')?.value() || '3';
const levelPrices: Record<string, number> = { basic: 99, standard: 199, premium: 349, elite: 499 };
const credentialFees: Record<string, number> = { certified: 0, rd: 50, specialist: 75, md: 150 };
const discounts: Record<string, number> = { '1': 0, '3': 0.05, '6': 0.10, '12': 0.20 };
let monthly = levelPrices[level] + credentialFees[credentials];
if (servicesSection.checkbox('customMealPlans')?.value()) monthly += 50;
if (servicesSection.checkbox('groceryLists')?.value()) monthly += 25;
if (servicesSection.checkbox('macroTracking')?.value()) monthly += 30;
if (servicesSection.checkbox('supplementGuidance')?.value()) monthly += 40;
if (servicesSection.checkbox('bodyComposition')?.value()) monthly += 35;
if (servicesSection.checkbox('fitnessIntegration')?.value()) monthly += 50;
if (servicesSection.checkbox('cookingClasses')?.value()) monthly += 75;
if (servicesSection.checkbox('familyPlan')?.value()) monthly += 60;
monthly *= (1 - (discounts[duration] || 0));
return Math.round(monthly);
},
variant: 'large'
}, '1fr');
row.addPriceDisplay('totalInvestment', {
label: 'Program Total',
computedValue: () => {
const level = coachingSection.radioButton('coachingLevel')?.value() || 'standard';
const credentials = coachingSection.dropdown('coachCredentials')?.value() || 'certified';
const duration = durationSection.radioButton('programLength')?.value() || '3';
const levelPrices: Record<string, number> = { basic: 99, standard: 199, premium: 349, elite: 499 };
const credentialFees: Record<string, number> = { certified: 0, rd: 50, specialist: 75, md: 150 };
const discounts: Record<string, number> = { '1': 0, '3': 0.05, '6': 0.10, '12': 0.20 };
let monthly = levelPrices[level] + credentialFees[credentials];
if (servicesSection.checkbox('customMealPlans')?.value()) monthly += 50;
if (servicesSection.checkbox('groceryLists')?.value()) monthly += 25;
if (servicesSection.checkbox('macroTracking')?.value()) monthly += 30;
if (servicesSection.checkbox('supplementGuidance')?.value()) monthly += 40;
if (servicesSection.checkbox('bodyComposition')?.value()) monthly += 35;
if (servicesSection.checkbox('fitnessIntegration')?.value()) monthly += 50;
if (servicesSection.checkbox('cookingClasses')?.value()) monthly += 75;
if (servicesSection.checkbox('familyPlan')?.value()) monthly += 60;
monthly *= (1 - (discounts[duration] || 0));
let oneTime = 0;
if (oneTimeSection.checkbox('initialAssessment')?.value()) oneTime += 149;
if (oneTimeSection.checkbox('metabolicTest')?.value()) oneTime += 199;
if (oneTimeSection.checkbox('foodSensitivity')?.value()) oneTime += 299;
if (oneTimeSection.checkbox('bloodwork')?.value()) oneTime += 99;
const months = parseInt(duration) || 3;
return Math.round(monthly * months + oneTime);
},
variant: 'success'
}, '1fr');
});
summarySection.addRow(row => {
row.addTextPanel('programSummary', {
computedValue: () => {
const level = coachingSection.radioButton('coachingLevel')?.value() || 'standard';
const duration = durationSection.radioButton('programLength')?.value() || '3';
const goal = goalsSection.dropdown('primaryGoal')?.value() || 'weight-loss';
const levelNames: Record<string, string> = { basic: 'Basic', standard: 'Standard', premium: 'Premium', elite: 'Elite' };
const goalNames: Record<string, string> = {
'weight-loss': 'Weight Loss', 'muscle-gain': 'Muscle Building', 'maintenance': 'Maintenance',
'performance': 'Performance', 'medical': 'Medical Diet', 'general': 'General Nutrition'
};
return `${levelNames[level]} ${goalNames[goal]} Program • ${duration} month${parseInt(duration) > 1 ? 's' : ''}`;
},
customStyles: { 'font-size': '0.95rem', 'text-align': 'center', 'color': '#475569' }
});
});
summarySection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'Results vary by individual. Nutrition coaching does not replace medical advice. Consult your physician for medical conditions.',
customStyles: { 'font-size': '0.8rem', 'color': '#94a3b8', 'text-align': 'center' }
});
});
form.configureSubmitButton({
label: 'Start Your Journey'
});
}