export function personalTrainingCalculator(form: FormTs) {
const sessionRates: Record<string, number> = {
'single': 75,
'pack-5': 65,
'pack-10': 60,
'pack-20': 55,
'monthly': 50
};
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Personal Training Quote',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Goals Section
const goalsSection = form.addSubform('fitnessGoals', { title: '๐ฏ Your Fitness Goals' });
goalsSection.addRow(row => {
row.addRadioButton('primaryGoal', {
label: 'Primary Goal',
options: [
{ id: 'weight-loss', name: 'Weight Loss' },
{ id: 'muscle-gain', name: 'Build Muscle' },
{ id: 'strength', name: 'Increase Strength' },
{ id: 'endurance', name: 'Improve Endurance' },
{ id: 'flexibility', name: 'Flexibility & Mobility' },
{ id: 'general', name: 'General Fitness' }
],
defaultValue: 'general',
orientation: 'vertical',
isRequired: true
});
});
goalsSection.addRow(row => {
row.addDropdown('fitnessLevel', {
label: 'Current Fitness Level',
options: [
{ id: 'beginner', name: 'Beginner - New to exercise' },
{ id: 'intermediate', name: 'Intermediate - Some experience' },
{ id: 'advanced', name: 'Advanced - Regular exerciser' },
{ id: 'athlete', name: 'Athlete - Competitive training' }
],
defaultValue: 'beginner',
isRequired: true
}, '1fr');
row.addDropdown('timeframe', {
label: 'Goal Timeframe',
options: [
{ id: '1-month', name: '1 Month' },
{ id: '3-months', name: '3 Months' },
{ id: '6-months', name: '6 Months' },
{ id: '12-months', name: '12 Months' }
],
defaultValue: '3-months'
}, '1fr');
});
// Training Options Section
const trainingSection = form.addSubform('trainingOptions', { title: '๐๏ธ Training Options' });
trainingSection.addRow(row => {
row.addDropdown('sessionType', {
label: 'Session Type',
options: [
{ id: '1-on-1', name: '1-on-1 Private Training' },
{ id: 'semi-private', name: 'Semi-Private (2-3 people, -20%)' },
{ id: 'small-group', name: 'Small Group (4-6 people, -40%)' }
],
defaultValue: '1-on-1',
isRequired: true
}, '1fr');
row.addDropdown('sessionLength', {
label: 'Session Length',
options: [
{ id: '30', name: '30 minutes (-25%)' },
{ id: '45', name: '45 minutes' },
{ id: '60', name: '60 minutes (standard)' },
{ id: '90', name: '90 minutes (+40%)' }
],
defaultValue: '60'
}, '1fr');
});
trainingSection.addRow(row => {
row.addRadioButton('package', {
label: 'Package Type',
options: [
{ id: 'single', name: 'Single Session ($75)' },
{ id: 'pack-5', name: '5-Pack ($65/session)' },
{ id: 'pack-10', name: '10-Pack ($60/session)' },
{ id: 'pack-20', name: '20-Pack ($55/session)' },
{ id: 'monthly', name: 'Monthly Unlimited ($50/session avg)' }
],
defaultValue: 'pack-10',
orientation: 'vertical',
isRequired: true
});
});
trainingSection.addRow(row => {
row.addInteger('sessionsPerWeek', {
label: 'Sessions Per Week',
min: 1,
max: 7,
defaultValue: 2,
isRequired: true
}, '1fr');
row.addDropdown('trainerLevel', {
label: 'Trainer Experience Level',
options: [
{ id: 'standard', name: 'Certified Trainer' },
{ id: 'senior', name: 'Senior Trainer (+25%)' },
{ id: 'master', name: 'Master Trainer (+50%)' },
{ id: 'specialist', name: 'Specialist (PT, Sports, etc.) (+40%)' }
],
defaultValue: 'standard'
}, '1fr');
});
// Add-ons Section
const addonsSection = form.addSubform('addons', { title: 'โจ Additional Services' });
addonsSection.addRow(row => {
row.addCheckbox('nutritionPlan', {
label: 'Nutrition Plan (+$100/month)',
defaultValue: false
}, '1fr');
row.addCheckbox('mealPrep', {
label: 'Meal Prep Guidance (+$75/month)',
defaultValue: false
}, '1fr');
});
addonsSection.addRow(row => {
row.addCheckbox('bodyComp', {
label: 'Body Composition Analysis (+$50)',
defaultValue: false
}, '1fr');
row.addCheckbox('programDesign', {
label: 'Custom Program Design (+$150)',
defaultValue: false
}, '1fr');
});
addonsSection.addRow(row => {
row.addCheckbox('onlineSupport', {
label: 'Online Support & Tracking (+$50/month)',
defaultValue: false
}, '1fr');
row.addCheckbox('inHomeTraining', {
label: 'In-Home Training (+$25/session)',
defaultValue: false
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// Results Section
const resultsSection = form.addSubform('results', { title: '๐ฐ Investment Summary', isCollapsible: false });
const getSessionMultiplier = () => {
const sessionType = trainingSection.dropdown('sessionType')?.value() || '1-on-1';
const multipliers: Record<string, number> = {
'1-on-1': 1.0,
'semi-private': 0.8,
'small-group': 0.6
};
return multipliers[sessionType] || 1;
};
const getLengthMultiplier = () => {
const length = trainingSection.dropdown('sessionLength')?.value() || '60';
const multipliers: Record<string, number> = {
'30': 0.75,
'45': 0.9,
'60': 1.0,
'90': 1.4
};
return multipliers[length] || 1;
};
const getTrainerMultiplier = () => {
const level = trainingSection.dropdown('trainerLevel')?.value() || 'standard';
const multipliers: Record<string, number> = {
'standard': 1.0,
'senior': 1.25,
'master': 1.5,
'specialist': 1.4
};
return multipliers[level] || 1;
};
resultsSection.addRow(row => {
row.addPriceDisplay('perSession', {
label: 'Per Session Rate',
computedValue: () => {
const packageType = trainingSection.radioButton('package')?.value() || 'pack-10';
const baseRate = sessionRates[packageType] || 60;
let rate = baseRate * getSessionMultiplier() * getLengthMultiplier() * getTrainerMultiplier();
if (addonsSection.checkbox('inHomeTraining')?.value()) {
rate += 25;
}
return Math.round(rate);
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('weeklyInvestment', {
label: 'Weekly Investment',
computedValue: () => {
const packageType = trainingSection.radioButton('package')?.value() || 'pack-10';
const baseRate = sessionRates[packageType] || 60;
const sessionsPerWeek = trainingSection.integer('sessionsPerWeek')?.value() || 2;
let rate = baseRate * getSessionMultiplier() * getLengthMultiplier() * getTrainerMultiplier();
if (addonsSection.checkbox('inHomeTraining')?.value()) rate += 25;
return Math.round(rate * sessionsPerWeek);
},
variant: 'default'
}, '1fr');
});
resultsSection.addRow(row => {
row.addPriceDisplay('monthlyTotal', {
label: 'Monthly Investment',
computedValue: () => {
const packageType = trainingSection.radioButton('package')?.value() || 'pack-10';
const baseRate = sessionRates[packageType] || 60;
const sessionsPerWeek = trainingSection.integer('sessionsPerWeek')?.value() || 2;
let sessionRate = baseRate * getSessionMultiplier() * getLengthMultiplier() * getTrainerMultiplier();
if (addonsSection.checkbox('inHomeTraining')?.value()) sessionRate += 25;
let monthly = sessionRate * sessionsPerWeek * 4.33; // avg weeks per month
// Add-ons
if (addonsSection.checkbox('nutritionPlan')?.value()) monthly += 100;
if (addonsSection.checkbox('mealPrep')?.value()) monthly += 75;
if (addonsSection.checkbox('onlineSupport')?.value()) monthly += 50;
return Math.round(monthly);
},
variant: 'large',
suffix: '/month'
});
});
resultsSection.addRow(row => {
row.addPriceDisplay('packageTotal', {
label: () => {
const packageType = trainingSection.radioButton('package')?.value() || 'pack-10';
const labels: Record<string, string> = {
'single': 'Single Session',
'pack-5': '5-Session Package',
'pack-10': '10-Session Package',
'pack-20': '20-Session Package',
'monthly': 'Monthly Package (estimate)'
};
return labels[packageType] || 'Package Total';
},
computedValue: () => {
const packageType = trainingSection.radioButton('package')?.value() || 'pack-10';
const baseRate = sessionRates[packageType] || 60;
let sessionRate = baseRate * getSessionMultiplier() * getLengthMultiplier() * getTrainerMultiplier();
if (addonsSection.checkbox('inHomeTraining')?.value()) sessionRate += 25;
const sessionCounts: Record<string, number> = {
'single': 1,
'pack-5': 5,
'pack-10': 10,
'pack-20': 20,
'monthly': 8 // estimate
};
let total = sessionRate * (sessionCounts[packageType] || 10);
// One-time add-ons
if (addonsSection.checkbox('bodyComp')?.value()) total += 50;
if (addonsSection.checkbox('programDesign')?.value()) total += 150;
return Math.round(total);
},
variant: 'default'
});
});
resultsSection.addRow(row => {
row.addTextPanel('recommendation', {
computedValue: () => {
const goal = goalsSection.radioButton('primaryGoal')?.value() || 'general';
const level = goalsSection.dropdown('fitnessLevel')?.value() || 'beginner';
const sessions = trainingSection.integer('sessionsPerWeek')?.value() || 2;
if (level === 'beginner' && sessions < 2) {
return 'Recommendation: Beginners typically see best results with 2-3 sessions per week.';
}
if (goal === 'weight-loss' && !addonsSection.checkbox('nutritionPlan')?.value()) {
return 'Tip: Nutrition plans significantly improve weight loss results.';
}
return 'Your personalized training plan will be designed during your first session.';
},
customStyles: { 'font-size': '0.9rem', 'color': '#059669' }
});
});
const finalSection = form.addSubform('final', {
title: '๐งพ Summary',
isCollapsible: false,
sticky: 'bottom'
});
finalSection.addRow(row => {
row.addPriceDisplay('monthlyTotal', {
label: 'Monthly Investment',
computedValue: () => {
const packageType = trainingSection.radioButton('package')?.value() || 'pack-10';
const baseRate = sessionRates[packageType] || 60;
const sessionsPerWeek = trainingSection.integer('sessionsPerWeek')?.value() || 2;
let sessionRate = baseRate * getSessionMultiplier() * getLengthMultiplier() * getTrainerMultiplier();
if (addonsSection.checkbox('inHomeTraining')?.value()) sessionRate += 25;
let monthly = sessionRate * sessionsPerWeek * 4.33;
if (addonsSection.checkbox('nutritionPlan')?.value()) monthly += 100;
if (addonsSection.checkbox('mealPrep')?.value()) monthly += 75;
if (addonsSection.checkbox('onlineSupport')?.value()) monthly += 50;
return Math.round(monthly);
},
variant: 'large',
suffix: '/month'
});
});
finalSection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'Final pricing confirmed during consultation.',
customStyles: { 'font-size': '0.85rem', 'color': '#94a3b8', 'font-style': 'italic' }
});
});
form.configureSubmitButton({
label: 'Book Free Consultation'
});
}