export function coachEffectivenessSurvey(form: FormTs) {
// Coach/Trainer Effectiveness Survey - Comprehensive coaching evaluation
// Demonstrates: StarRating x6, MatrixQuestion, RatingScale (NPS), EmojiRating, Slider, conditional visibility
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Coach/Trainer Evaluation',
computedValue: () => 'Your feedback helps us ensure quality coaching. All responses are confidential.',
customStyles: {
background: 'linear-gradient(135deg, #dc2626 0%, #f97316 100%)',
color: 'white',
padding: '28px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Coach Information
// ============================================
const infoSection = form.addSubform('infoSection', {
title: 'Evaluation Details'
});
infoSection.addRow(row => {
row.addTextbox('coachName', {
label: 'Coach/Trainer Name',
placeholder: 'Enter the coach\'s name',
isRequired: true
}, '1fr');
row.addDropdown('sport', {
label: 'Sport/Activity',
options: [
{ id: 'basketball', name: 'Basketball' },
{ id: 'soccer', name: 'Soccer/Football' },
{ id: 'swimming', name: 'Swimming' },
{ id: 'tennis', name: 'Tennis' },
{ id: 'fitness', name: 'Personal Training/Fitness' },
{ id: 'gymnastics', name: 'Gymnastics' },
{ id: 'martial-arts', name: 'Martial Arts' },
{ id: 'running', name: 'Running/Track' },
{ id: 'other', name: 'Other' }
],
placeholder: 'Select sport...',
isRequired: true
}, '1fr');
});
infoSection.addRow(row => {
row.addDropdown('duration', {
label: 'How long have you trained with this coach?',
options: [
{ id: 'less-1-month', name: 'Less than 1 month' },
{ id: '1-3-months', name: '1-3 months' },
{ id: '3-6-months', name: '3-6 months' },
{ id: '6-12-months', name: '6 months to 1 year' },
{ id: 'more-1-year', name: 'More than 1 year' }
],
isRequired: true
}, '1fr');
row.addDropdown('sessionFrequency', {
label: 'Training frequency',
options: [
{ id: 'once-week', name: 'Once a week' },
{ id: '2-3-week', name: '2-3 times per week' },
{ id: '4-5-week', name: '4-5 times per week' },
{ id: 'daily', name: 'Daily' }
]
}, '1fr');
});
// ============================================
// SECTION 2: Overall Impression
// ============================================
const overallSection = form.addSubform('overallSection', {
title: 'Overall Impression',
isVisible: () => infoSection.textbox('coachName')?.value()?.trim() !== ''
});
overallSection.addRow(row => {
row.addEmojiRating('overallFeeling', {
label: () => {
const coachName = infoSection.textbox('coachName')?.value();
return `How do you feel about training with ${coachName || 'this coach'}?`;
},
preset: 'satisfaction',
size: 'lg',
alignment: 'center',
showLabels: true
});
});
overallSection.addRow(row => {
row.addStarRating('overallRating', {
label: 'Overall coaching effectiveness',
maxStars: 5,
size: 'lg',
alignment: 'center',
showConfettiOnMax: true
});
});
// ============================================
// SECTION 3: Core Competencies (Star Ratings)
// ============================================
const competenciesSection = form.addSubform('competenciesSection', {
title: 'Core Competencies',
isVisible: () => overallSection.starRating('overallRating')?.value() !== null
});
competenciesSection.addRow(row => {
row.addTextPanel('competenciesIntro', {
computedValue: () => 'Please rate your coach in each of the following areas:',
customStyles: {
backgroundColor: '#fef3c7',
padding: '12px',
borderRadius: '6px',
borderLeft: '4px solid #f59e0b',
marginBottom: '8px'
}
});
});
competenciesSection.addRow(row => {
row.addStarRating('communication', {
label: 'Communication & Clarity',
tooltip: 'Explains techniques clearly, provides understandable feedback',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('technicalKnowledge', {
label: 'Technical Knowledge',
tooltip: 'Demonstrates expertise in the sport/activity',
maxStars: 5,
size: 'md'
}, '1fr');
});
competenciesSection.addRow(row => {
row.addStarRating('motivation', {
label: 'Motivation & Encouragement',
tooltip: 'Inspires you to push harder and stay committed',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('patience', {
label: 'Patience & Support',
tooltip: 'Remains patient when you struggle, provides support',
maxStars: 5,
size: 'md'
}, '1fr');
});
competenciesSection.addRow(row => {
row.addStarRating('organization', {
label: 'Session Organization',
tooltip: 'Sessions are well-planned and time is used effectively',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('safety', {
label: 'Safety Awareness',
tooltip: 'Prioritizes proper form and injury prevention',
maxStars: 5,
size: 'md'
}, '1fr');
});
// ============================================
// SECTION 4: Detailed Assessment (Matrix)
// ============================================
const detailedSection = form.addSubform('detailedSection', {
title: 'Detailed Assessment',
isVisible: () => {
const comm = competenciesSection.starRating('communication')?.value();
return comm !== null;
}
});
detailedSection.addRow(row => {
row.addMatrixQuestion('coachingSkills', {
label: 'Rate how well your coach demonstrates each skill:',
rows: [
{ id: 'listens', label: 'Listens to your concerns and questions' },
{ id: 'adapts', label: 'Adapts training to your skill level' },
{ id: 'feedback', label: 'Provides constructive feedback' },
{ id: 'goals', label: 'Helps you set and achieve goals' },
{ id: 'punctual', label: 'Is punctual and reliable' },
{ id: 'professional', label: 'Maintains professional conduct' }
],
columns: [
{ id: 'poor', label: 'Poor' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
// ============================================
// SECTION 5: Progress & Development
// ============================================
const progressSection = form.addSubform('progressSection', {
title: 'Your Progress',
isVisible: () => overallSection.starRating('overallRating')?.value() !== null
});
progressSection.addRow(row => {
row.addSlider('skillImprovement', {
label: 'How much have your skills improved since training with this coach?',
min: 0,
max: 100,
step: 5,
unit: '%',
showValue: true,
defaultValue: 50
});
});
progressSection.addRow(row => {
row.addRatingScale('goalsProgress', {
preset: 'likert-5',
label: 'I am on track to achieve my training goals',
lowLabel: 'Strongly Disagree',
highLabel: 'Strongly Agree',
variant: 'segmented'
});
});
progressSection.addRow(row => {
row.addCheckboxList('improvements', {
label: 'In which areas have you seen the most improvement?',
options: [
{ id: 'technique', name: 'Technical skills' },
{ id: 'fitness', name: 'Physical fitness' },
{ id: 'confidence', name: 'Confidence' },
{ id: 'strategy', name: 'Game strategy/tactics' },
{ id: 'mental', name: 'Mental toughness' },
{ id: 'consistency', name: 'Consistency' }
],
orientation: 'horizontal'
});
});
// ============================================
// SECTION 6: Strengths & Development Areas
// ============================================
const feedbackSection = form.addSubform('feedbackSection', {
title: () => {
const coachName = infoSection.textbox('coachName')?.value();
return `Feedback for ${coachName || 'Coach'}`;
},
isVisible: () => overallSection.starRating('overallRating')?.value() !== null
});
feedbackSection.addRow(row => {
row.addSuggestionChips('strengths', {
label: 'What are this coach\'s greatest strengths?',
suggestions: [
{ id: 'motivating', name: 'Motivating' },
{ id: 'knowledgeable', name: 'Knowledgeable' },
{ id: 'patient', name: 'Patient' },
{ id: 'encouraging', name: 'Encouraging' },
{ id: 'organized', name: 'Organized' },
{ id: 'creative', name: 'Creative' },
{ id: 'attentive', name: 'Attentive' },
{ id: 'fun', name: 'Makes training fun' }
],
alignment: 'center',
max: 4
});
});
feedbackSection.addSpacer();
feedbackSection.addRow(row => {
row.addTextarea('positiveFeedback', {
label: () => {
const overall = overallSection.starRating('overallRating')?.value();
if (overall && overall >= 4) {
return 'What do you appreciate most about your coach?';
}
return 'What does your coach do well?';
},
placeholder: 'Share specific examples of what works well...',
rows: 3,
autoExpand: true
});
});
feedbackSection.addRow(row => {
row.addTextarea('improvementFeedback', {
label: 'What could your coach improve?',
placeholder: 'Constructive suggestions for development...',
rows: 3,
autoExpand: true,
isVisible: () => {
const overall = overallSection.starRating('overallRating')?.value();
return overall !== null && overall !== undefined && overall < 5;
}
});
});
// ============================================
// SECTION 7: Recommendation
// ============================================
const recommendSection = form.addSubform('recommendSection', {
title: 'Recommendation',
isVisible: () => overallSection.starRating('overallRating')?.value() !== null,
customStyles: () => {
const category = recommendSection.ratingScale('npsScore')?.npsCategory();
if (category === 'promoter') return { backgroundColor: '#dcfce7', padding: '16px', borderRadius: '8px' };
if (category === 'passive') return { backgroundColor: '#fef3c7', padding: '16px', borderRadius: '8px' };
if (category === 'detractor') return { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '8px' };
return { padding: '16px', borderRadius: '8px', border: '1px dashed #e5e7eb' };
}
});
recommendSection.addRow(row => {
row.addRatingScale('npsScore', {
preset: 'nps',
label: () => {
const coachName = infoSection.textbox('coachName')?.value();
return `How likely are you to recommend ${coachName || 'this coach'} to others?`;
},
showCategoryLabel: true,
showSegmentColors: true,
showConfettiOnPromoter: true
});
});
recommendSection.addRow(row => {
row.addCheckbox('continueTraining', {
label: () => {
const coachName = infoSection.textbox('coachName')?.value();
return `I would like to continue training with ${coachName || 'this coach'}`;
}
});
});
// ============================================
// SUMMARY
// ============================================
const summarySection = form.addSubform('summarySection', {
title: 'Evaluation Summary',
isVisible: () => {
const overall = overallSection.starRating('overallRating')?.value();
return overall !== null;
}
});
summarySection.addRow(row => {
row.addTextPanel('summary', {
computedValue: () => {
const coachName = infoSection.textbox('coachName')?.value();
const sport = infoSection.dropdown('sport')?.value();
const overall = overallSection.starRating('overallRating')?.value();
const feeling = overallSection.emojiRating('overallFeeling')?.value();
const nps = recommendSection.ratingScale('npsScore')?.value();
const category = recommendSection.ratingScale('npsScore')?.npsCategory();
const improvement = progressSection.slider('skillImprovement')?.value();
const continueFlag = recommendSection.checkbox('continueTraining')?.value();
// Get competency ratings
const comm = competenciesSection.starRating('communication')?.value() || 0;
const tech = competenciesSection.starRating('technicalKnowledge')?.value() || 0;
const motiv = competenciesSection.starRating('motivation')?.value() || 0;
const patience = competenciesSection.starRating('patience')?.value() || 0;
const org = competenciesSection.starRating('organization')?.value() || 0;
const safety = competenciesSection.starRating('safety')?.value() || 0;
const competencyAvg = ((comm + tech + motiv + patience + org + safety) / 6).toFixed(1);
let summary = `🏆 COACH EVALUATION SUMMARY\n`;
summary += '═'.repeat(30) + '\n\n';
if (coachName) summary += `👤 Coach: ${coachName}\n`;
if (sport) summary += `🏅 Sport: ${sport}\n\n`;
if (overall) summary += `⭐ Overall Rating: ${overall}/5\n`;
if (feeling) {
const labels: Record<string, string> = {
'very-bad': 'Very Unsatisfied',
'bad': 'Unsatisfied',
'neutral': 'Neutral',
'good': 'Satisfied',
'excellent': 'Very Satisfied'
};
summary += `😊 Feeling: ${labels[feeling] || feeling}\n`;
}
summary += `\n📊 Competency Average: ${competencyAvg}/5\n`;
if (improvement !== null && improvement !== undefined) {
summary += `📈 Skill Improvement: ${improvement}%\n`;
}
if (nps !== null && nps !== undefined) {
const emoji = category === 'promoter' ? '🎉' : category === 'passive' ? '🤔' : '📝';
summary += `\n${emoji} NPS: ${nps}/10 (${category?.charAt(0).toUpperCase()}${category?.slice(1)})\n`;
}
if (continueFlag) {
summary += `\n✅ Wants to continue training\n`;
}
return summary;
},
customStyles: () => {
const category = recommendSection.ratingScale('npsScore')?.npsCategory();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (category === 'promoter') {
return { ...baseStyles, backgroundColor: '#dcfce7', borderLeft: '4px solid #22c55e' };
} else if (category === 'passive') {
return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
} else if (category === 'detractor') {
return { ...baseStyles, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
return { ...baseStyles, backgroundColor: '#f8fafc', borderLeft: '4px solid #64748b' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Evaluation',
isVisible: () => overallSection.starRating('overallRating')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback!',
message: () => {
const category = recommendSection.ratingScale('npsScore')?.npsCategory();
if (category === 'promoter') {
return 'Your positive feedback will be shared with your coach. Great coaches make great athletes!';
}
return 'Your feedback helps us maintain coaching excellence. We take all evaluations seriously.';
}
});
}