export function personalTrainerSurvey(form: FormTs) {
// Personal Trainer Rating Form - Comprehensive fitness coach evaluation
// Demonstrates: StarRating, MatrixQuestion, Slider, EmojiRating, Conditional Progress Sections
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Rate Your Personal Trainer',
computedValue: () => 'Help us ensure you get the best training experience possible.',
customStyles: {
background: 'linear-gradient(135deg, #059669 0%, #047857 100%)',
color: 'white',
padding: '28px',
borderRadius: '12px',
textAlign: 'center',
fontSize: '15px'
}
});
});
// ============================================
// SECTION 1: Training Context
// ============================================
const contextSection = form.addSubform('context', {
title: 'Your Training',
customStyles: { backgroundColor: '#ecfdf5', padding: '16px', borderRadius: '8px' }
});
contextSection.addRow(row => {
row.addDropdown('trainingType', {
label: 'Type of training',
options: [
{ id: 'weight-loss', name: 'Weight Loss / Fat Burning' },
{ id: 'muscle-building', name: 'Muscle Building / Strength' },
{ id: 'general-fitness', name: 'General Fitness' },
{ id: 'sports-specific', name: 'Sports-Specific Training' },
{ id: 'rehabilitation', name: 'Rehabilitation / Recovery' },
{ id: 'flexibility', name: 'Flexibility / Mobility' },
{ id: 'endurance', name: 'Cardio / Endurance' }
],
placeholder: 'Select your training goal',
isRequired: true
}, '1fr');
row.addDropdown('sessionCount', {
label: 'Sessions completed',
options: [
{ id: '1-5', name: '1-5 sessions' },
{ id: '6-10', name: '6-10 sessions' },
{ id: '11-20', name: '11-20 sessions' },
{ id: '21-50', name: '21-50 sessions' },
{ id: '50+', name: 'Over 50 sessions' }
],
placeholder: 'Select range',
isRequired: true
}, '1fr');
});
contextSection.addRow(row => {
row.addRadioButton('sessionFrequency', {
label: 'How often do you train with this trainer?',
options: [
{ id: 'once-week', name: '1x per week' },
{ id: 'twice-week', name: '2x per week' },
{ id: 'three-plus', name: '3+ times per week' },
{ id: 'occasional', name: 'Occasionally' }
],
orientation: 'horizontal'
});
});
// ============================================
// SECTION 2: Overall Satisfaction
// ============================================
const overallSection = form.addSubform('overall', {
title: 'Overall Rating',
isVisible: () => contextSection.dropdown('trainingType')?.value() !== null
});
overallSection.addRow(row => {
row.addStarRating('overallRating', {
label: 'Overall satisfaction with your personal trainer',
maxStars: 5,
size: 'xl',
alignment: 'center',
showConfettiOnMax: true
});
});
overallSection.addRow(row => {
row.addEmojiRating('trainerFeeling', {
label: 'How do you feel after training sessions?',
preset: 'mood',
size: 'lg',
alignment: 'center'
});
});
// ============================================
// SECTION 3: Trainer Skills (Matrix)
// ============================================
const skillsSection = form.addSubform('skills', {
title: 'Trainer Skills & Qualities',
isVisible: () => overallSection.starRating('overallRating')?.value() !== null,
customStyles: { backgroundColor: '#f0fdf4', padding: '16px', borderRadius: '8px' }
});
skillsSection.addRow(row => {
row.addMatrixQuestion('trainerSkills', {
label: 'Rate your trainer on the following:',
rows: [
{ id: 'knowledge', label: 'Technical knowledge & expertise', isRequired: true },
{ id: 'communication', label: 'Clear explanations & instructions', isRequired: true },
{ id: 'motivation', label: 'Motivation & encouragement', isRequired: true },
{ id: 'attentiveness', label: 'Attention to your form & safety', isRequired: true },
{ id: 'customization', label: 'Personalizing workouts to your needs', isRequired: true },
{ id: 'punctuality', label: 'Punctuality & time management', isRequired: false },
{ id: 'professionalism', label: 'Professional demeanor', isRequired: false }
],
columns: [
{ id: 'poor', label: 'Poor' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
fullWidth: true,
striped: true
});
});
// ============================================
// SECTION 4: Motivation & Support
// ============================================
const motivationSection = form.addSubform('motivation', {
title: 'Motivation & Support',
isVisible: () => skillsSection.matrixQuestion('trainerSkills')?.areAllRequiredRowsAnswered() === true,
customStyles: { backgroundColor: '#eff6ff', padding: '16px', borderRadius: '8px' }
});
motivationSection.addRow(row => {
row.addStarRating('pushLevel', {
label: 'Does your trainer push you to achieve more?',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('supportLevel', {
label: 'Emotional support and understanding',
maxStars: 5,
size: 'md'
}, '1fr');
});
motivationSection.addRow(row => {
row.addRatingScale('challengeBalance', {
label: 'How well does your trainer balance challenge with your abilities?',
preset: 'likert-5',
lowLabel: 'Too easy',
highLabel: 'Too hard',
size: 'md',
alignment: 'center'
});
});
motivationSection.addRow(row => {
row.addThumbRating('enjoysWorkouts', {
label: 'Do you enjoy your training sessions?',
size: 'lg',
showLabels: true,
upLabel: 'Yes, I look forward to them!',
downLabel: 'Not really',
alignment: 'center'
});
});
// ============================================
// SECTION 5: Results & Progress
// ============================================
const resultsSection = form.addSubform('results', {
title: 'Results & Progress',
isVisible: () => motivationSection.starRating('pushLevel')?.value() !== null,
customStyles: { backgroundColor: '#fefce8', padding: '16px', borderRadius: '8px' }
});
resultsSection.addRow(row => {
row.addSlider('goalProgress', {
label: 'How much progress have you made toward your fitness goals?',
min: 0,
max: 100,
step: 5,
showValue: true,
unit: '%',
defaultValue: 50
});
});
resultsSection.addRow(row => {
row.addStarRating('fitnessImprovement', {
label: 'Overall improvement in fitness level',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
resultsSection.addRow(row => {
row.addCheckboxList('improvements', {
label: 'What improvements have you noticed? (Select all)',
options: [
{ id: 'strength', name: 'Increased strength' },
{ id: 'endurance', name: 'Better endurance' },
{ id: 'flexibility', name: 'Improved flexibility' },
{ id: 'weight', name: 'Weight/body composition changes' },
{ id: 'energy', name: 'More energy' },
{ id: 'confidence', name: 'Improved confidence' },
{ id: 'technique', name: 'Better exercise technique' },
{ id: 'habits', name: 'Healthier habits overall' }
],
orientation: 'vertical'
});
});
// ============================================
// SECTION 6: Program Quality
// ============================================
const programSection = form.addSubform('program', {
title: 'Training Program',
isVisible: () => resultsSection.starRating('fitnessImprovement')?.value() !== null
});
programSection.addRow(row => {
row.addStarRating('programVariety', {
label: 'Workout variety',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('programProgression', {
label: 'Progressive challenge',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('programStructure', {
label: 'Session structure',
maxStars: 5,
size: 'md'
}, '1fr');
});
programSection.addRow(row => {
row.addThumbRating('nutritionGuidance', {
label: 'Does your trainer provide helpful nutrition guidance?',
size: 'md',
showLabels: true,
upLabel: 'Yes',
downLabel: 'No / Not applicable',
alignment: 'center'
});
});
// ============================================
// SECTION 7: Areas for Improvement (Conditional)
// ============================================
const improvementSection = form.addSubform('improvement', {
title: 'Areas for Improvement',
isVisible: () => {
const rating = overallSection.starRating('overallRating')?.value();
return rating !== null && rating !== undefined && rating <= 3;
},
customStyles: { backgroundColor: '#fef2f2', padding: '16px', borderRadius: '8px' }
});
improvementSection.addRow(row => {
row.addCheckboxList('improvementAreas', {
label: 'What could your trainer improve? (Select all that apply)',
options: [
{ id: 'listen-more', name: 'Listen more to my concerns' },
{ id: 'more-variety', name: 'Add more workout variety' },
{ id: 'better-explanations', name: 'Explain exercises more clearly' },
{ id: 'more-motivation', name: 'Provide more motivation' },
{ id: 'less-phone', name: 'Be less distracted / on phone' },
{ id: 'punctuality', name: 'Be more punctual' },
{ id: 'intensity', name: 'Adjust workout intensity' },
{ id: 'nutrition-help', name: 'Provide better nutrition guidance' }
],
orientation: 'vertical'
});
});
improvementSection.addSpacer({ height: '12px' });
improvementSection.addRow(row => {
row.addTextarea('improvementDetails', {
label: 'Please share specific suggestions:',
placeholder: 'What changes would improve your training experience?',
rows: 3,
autoExpand: true
});
});
// ============================================
// SECTION 8: Final Questions
// ============================================
const finalSection = form.addSubform('final', {
title: 'Final Thoughts',
isVisible: () => programSection.starRating('programVariety')?.value() !== null ||
improvementSection.checkboxList('improvementAreas')?.value()?.length !== undefined
});
finalSection.addRow(row => {
row.addRadioButton('wouldContinue', {
label: 'Would you continue training with this trainer?',
options: [
{ id: 'definitely', name: 'Definitely yes' },
{ id: 'probably', name: 'Probably yes' },
{ id: 'unsure', name: 'Not sure' },
{ id: 'probably-not', name: 'Probably not' },
{ id: 'definitely-not', name: 'Definitely not' }
],
orientation: 'horizontal'
});
});
finalSection.addRow(row => {
row.addRatingScale('recommendTrainer', {
label: 'How likely are you to recommend this trainer to a friend?',
preset: 'nps',
showCategoryLabel: true,
showSegmentColors: true,
alignment: 'center'
});
});
finalSection.addSpacer({ height: '16px' });
finalSection.addRow(row => {
row.addTextarea('additionalComments', {
label: 'Any additional feedback for your trainer?',
placeholder: 'Share what you appreciate or any suggestions...',
rows: 3,
autoExpand: true
});
});
// ============================================
// SECTION 9: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Rating Summary',
isVisible: () => finalSection.radioButton('wouldContinue')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const overall = overallSection.starRating('overallRating')?.value();
const feeling = overallSection.emojiRating('trainerFeeling')?.value();
const goalProgress = resultsSection.slider('goalProgress')?.value();
const fitnessImprovement = resultsSection.starRating('fitnessImprovement')?.value();
const improvements = resultsSection.checkboxList('improvements')?.value() || [];
const wouldContinue = finalSection.radioButton('wouldContinue')?.value();
const nps = finalSection.ratingScale('recommendTrainer')?.value();
if (!overall) return '';
const feelingLabels: Record<string, string> = {
'sad': 'Exhausted / Unhappy',
'down': 'Tired',
'neutral': 'Okay',
'happy': 'Energized',
'excited': 'Amazing!'
};
const continueLabels: Record<string, string> = {
'definitely': 'Definitely continuing',
'probably': 'Probably continuing',
'unsure': 'Unsure',
'probably-not': 'Probably not',
'definitely-not': 'Not continuing'
};
let summary = 'Trainer Rating Summary\n';
summary += '═'.repeat(25) + '\n\n';
summary += `Overall Rating: ${'★'.repeat(overall)}${'☆'.repeat(5 - overall)} (${overall}/5)\n`;
if (feeling) {
summary += `Post-Session Feeling: ${feelingLabels[feeling] || feeling}\n`;
}
if (goalProgress !== null && goalProgress !== undefined) {
summary += `Goal Progress: ${goalProgress}%\n`;
}
if (fitnessImprovement) {
summary += `Fitness Improvement: ${'★'.repeat(fitnessImprovement)}${'☆'.repeat(5 - fitnessImprovement)}\n`;
}
if (improvements.length > 0) {
summary += `\nImprovements Noticed: ${improvements.length} areas\n`;
}
if (wouldContinue) {
summary += `\nFuture Intent: ${continueLabels[wouldContinue] || wouldContinue}\n`;
}
if (nps !== null && nps !== undefined) {
const category = nps >= 9 ? 'Promoter' : nps >= 7 ? 'Passive' : 'Detractor';
summary += `Recommend Score: ${nps}/10 (${category})`;
}
return summary;
},
customStyles: () => {
const overall = overallSection.starRating('overallRating')?.value();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '13px'
};
if (overall !== null && overall !== undefined) {
if (overall >= 4) return { ...baseStyles, backgroundColor: '#dcfce7', borderLeft: '4px solid #22c55e' };
if (overall >= 3) return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
return { ...baseStyles, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
return baseStyles;
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Trainer Feedback',
isVisible: () => finalSection.radioButton('wouldContinue')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback!',
message: 'Your input helps us maintain high training standards and supports your trainer in providing the best possible service. Keep crushing your fitness goals!'
});
}