export function benefitsSatisfactionSurvey(form: FormTs) {
// Benefits Satisfaction Survey - HR Benefits Feedback
// Demonstrates: MatrixQuestion, StarRating, CheckboxList, Slider, RadioButton, Dynamic Visibility
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Benefits Satisfaction Survey',
computedValue: () => 'Your feedback helps us create a benefits package that works for you. All responses are anonymous.',
customStyles: {
backgroundColor: '#0891b2',
color: 'white',
padding: '24px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: About You (Anonymous Demographics)
// ============================================
const aboutSection = form.addSubform('about', {
title: 'About You (Optional & Anonymous)'
});
aboutSection.addRow(row => {
row.addRadioButton('tenure', {
label: 'How long have you worked here?',
options: [
{ id: 'new', name: 'Less than 1 year' },
{ id: 'mid', name: '1-3 years' },
{ id: 'senior', name: '3-5 years' },
{ id: 'veteran', name: '5+ years' }
],
orientation: 'horizontal'
}, '1fr');
row.addRadioButton('lifeStage', {
label: 'Which best describes your situation?',
options: [
{ id: 'single', name: 'Single' },
{ id: 'couple', name: 'Married/Partner' },
{ id: 'family', name: 'Family with children' },
{ id: 'empty', name: 'Empty nester' }
],
orientation: 'horizontal'
}, '1fr');
});
// ============================================
// SECTION 2: Overall Benefits Satisfaction
// ============================================
const overallSection = form.addSubform('overall', {
title: 'Overall Benefits Package',
customStyles: { backgroundColor: '#f0f9ff', padding: '16px', borderRadius: '8px' }
});
overallSection.addRow(row => {
row.addStarRating('overallSatisfaction', {
label: 'How satisfied are you with our overall benefits package?',
maxStars: 5,
size: 'lg',
alignment: 'center',
showConfettiOnMax: true
});
});
overallSection.addRow(row => {
row.addRatingScale('competitiveness', {
label: 'How do our benefits compare to other employers?',
preset: 'likert-5',
lowLabel: 'Much worse',
highLabel: 'Much better',
alignment: 'center'
});
});
// ============================================
// SECTION 3: Health Benefits Matrix
// ============================================
const healthSection = form.addSubform('health', {
title: 'Health & Wellness Benefits'
});
healthSection.addRow(row => {
row.addMatrixQuestion('healthRatings', {
label: 'Rate your satisfaction with each health benefit:',
rows: [
{ id: 'medical', label: 'Medical Insurance', isRequired: true },
{ id: 'dental', label: 'Dental Coverage' },
{ id: 'vision', label: 'Vision Coverage' },
{ id: 'mental', label: 'Mental Health Support' },
{ id: 'wellness', label: 'Wellness Programs' },
{ id: 'gym', label: 'Gym/Fitness Benefits' }
],
columns: [
{ id: 'na', label: 'N/A' },
{ id: 'poor', label: 'Poor' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
// Health deep dive for dissatisfied
const healthIssuesSection = form.addSubform('healthIssues', {
title: 'Health Benefits Concerns',
isVisible: () => {
const ratings = healthSection.matrixQuestion('healthRatings')?.value();
if (!ratings) return false;
return Object.values(ratings).some(v => v === 'poor' || v === 'fair');
},
customStyles: { backgroundColor: '#fef3c7', padding: '16px', borderRadius: '8px' }
});
healthIssuesSection.addRow(row => {
row.addCheckboxList('healthConcerns', {
label: 'What are your main concerns with health benefits?',
options: [
{ id: 'cost', name: 'Premiums are too high' },
{ id: 'deductible', name: 'Deductibles are too high' },
{ id: 'network', name: 'Limited provider network' },
{ id: 'coverage', name: 'Coverage gaps' },
{ id: 'rx', name: 'Prescription drug costs' },
{ id: 'options', name: 'Not enough plan options' }
],
orientation: 'vertical'
});
});
// ============================================
// SECTION 4: Financial Benefits Matrix
// ============================================
const financialSection = form.addSubform('financial', {
title: 'Financial & Retirement Benefits'
});
financialSection.addRow(row => {
row.addMatrixQuestion('financialRatings', {
label: 'Rate your satisfaction with financial benefits:',
rows: [
{ id: '401k', label: '401(k) / Retirement Plan', isRequired: true },
{ id: 'match', label: 'Company Match' },
{ id: 'stock', label: 'Stock Options/ESPP' },
{ id: 'hsa', label: 'HSA/FSA Options' },
{ id: 'life', label: 'Life Insurance' },
{ id: 'disability', label: 'Disability Coverage' }
],
columns: [
{ id: 'na', label: 'N/A' },
{ id: 'poor', label: 'Poor' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
// ============================================
// SECTION 5: Time Off & Flexibility
// ============================================
const timeOffSection = form.addSubform('timeOff', {
title: 'Time Off & Work-Life Balance'
});
timeOffSection.addRow(row => {
row.addMatrixQuestion('timeOffRatings', {
label: 'Rate your satisfaction with time-off benefits:',
rows: [
{ id: 'pto', label: 'Paid Time Off (PTO)', isRequired: true },
{ id: 'sick', label: 'Sick Leave' },
{ id: 'parental', label: 'Parental Leave' },
{ id: 'bereavement', label: 'Bereavement Leave' },
{ id: 'flexible', label: 'Flexible Hours' },
{ id: 'remote', label: 'Remote Work Options' }
],
columns: [
{ id: 'na', label: 'N/A' },
{ id: 'poor', label: 'Poor' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
timeOffSection.addRow(row => {
row.addSlider('ptoUsage', {
label: 'What percentage of your PTO do you typically use each year?',
min: 0,
max: 100,
step: 10,
unit: '%',
showValue: true,
defaultValue: 70
}, '1fr');
row.addEmojiRating('workLifeBalance', {
label: 'How is your work-life balance?',
preset: 'satisfaction',
size: 'md',
alignment: 'center'
}, '1fr');
});
// ============================================
// SECTION 6: Perks & Development
// ============================================
const perksSection = form.addSubform('perks', {
title: 'Perks & Professional Development'
});
perksSection.addRow(row => {
row.addMatrixQuestion('perksRatings', {
label: 'Rate satisfaction with workplace perks:',
rows: [
{ id: 'learning', label: 'Learning & Development' },
{ id: 'tuition', label: 'Tuition Reimbursement' },
{ id: 'equipment', label: 'Equipment/Home Office' },
{ id: 'meals', label: 'Meals/Snacks' },
{ id: 'commute', label: 'Commuter Benefits' },
{ id: 'events', label: 'Company Events/Team Building' }
],
columns: [
{ id: 'na', label: 'N/A' },
{ id: 'poor', label: 'Poor' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
// ============================================
// SECTION 7: Benefits Priorities
// ============================================
const prioritiesSection = form.addSubform('priorities', {
title: 'What Matters Most to You?',
customStyles: { backgroundColor: '#f0fdf4', padding: '16px', borderRadius: '8px' }
});
prioritiesSection.addRow(row => {
row.addCheckboxList('topPriorities', {
label: 'Select your TOP 3 most important benefits:',
options: [
{ id: 'medical', name: 'Health Insurance' },
{ id: 'retirement', name: 'Retirement/401k' },
{ id: 'pto', name: 'Paid Time Off' },
{ id: 'remote', name: 'Remote Work' },
{ id: 'flexibility', name: 'Flexible Hours' },
{ id: 'parental', name: 'Parental Leave' },
{ id: 'learning', name: 'Learning & Development' },
{ id: 'mental', name: 'Mental Health Support' }
],
max: 3,
orientation: 'vertical'
}, '1fr');
row.addCheckboxList('wishlist', {
label: 'Which NEW benefits would you like to see?',
options: [
{ id: 'sabbatical', name: 'Sabbatical Program' },
{ id: 'student', name: 'Student Loan Assistance' },
{ id: 'fertility', name: 'Fertility Benefits' },
{ id: 'pet', name: 'Pet Insurance' },
{ id: 'legal', name: 'Legal Services' },
{ id: 'childcare', name: 'Childcare Assistance' },
{ id: 'financial', name: 'Financial Planning' },
{ id: 'volunteer', name: 'Volunteer Time Off' }
],
orientation: 'vertical'
}, '1fr');
});
// ============================================
// SECTION 8: Impact on Retention
// ============================================
const retentionSection = form.addSubform('retention', {
title: 'Benefits & Your Future Here'
});
retentionSection.addRow(row => {
row.addRatingScale('stayLikelihood', {
label: 'How much do benefits influence your decision to stay with the company?',
preset: 'likert-5',
lowLabel: 'Not at all',
highLabel: 'Very much',
alignment: 'center'
});
});
retentionSection.addRow(row => {
row.addThumbRating('wouldRecommend', {
label: 'Would you recommend our benefits package to a friend considering working here?',
size: 'lg',
showLabels: true,
upLabel: 'Yes, I would',
downLabel: 'No, I would not',
alignment: 'center'
});
});
// ============================================
// SECTION 9: Open Feedback
// ============================================
const feedbackSection = form.addSubform('feedback', {
title: 'Additional Feedback'
});
feedbackSection.addSpacer({ height: '8px' });
feedbackSection.addRow(row => {
row.addTextarea('suggestions', {
label: 'What specific changes would improve our benefits package?',
placeholder: 'Share your ideas for better benefits, coverage changes, or new perks...',
rows: 4
});
});
// ============================================
// SECTION 10: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Your Benefits Feedback Summary',
isVisible: () => overallSection.starRating('overallSatisfaction')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const overall = overallSection.starRating('overallSatisfaction')?.value();
const competitive = overallSection.ratingScale('competitiveness')?.value();
const workLife = timeOffSection.emojiRating('workLifeBalance')?.value();
const ptoUsage = timeOffSection.slider('ptoUsage')?.value();
const topPriorities = prioritiesSection.checkboxList('topPriorities')?.value() || [];
const wishlist = prioritiesSection.checkboxList('wishlist')?.value() || [];
const stayInfluence = retentionSection.ratingScale('stayLikelihood')?.value();
const recommend = retentionSection.thumbRating('wouldRecommend')?.value();
const healthRatings = healthSection.matrixQuestion('healthRatings')?.value();
const financialRatings = financialSection.matrixQuestion('financialRatings')?.value();
const timeOffRatings = timeOffSection.matrixQuestion('timeOffRatings')?.value();
const perksRatings = perksSection.matrixQuestion('perksRatings')?.value();
// Count excellent/good vs poor/fair across all matrices
let excellent = 0, poor = 0;
[healthRatings, financialRatings, timeOffRatings, perksRatings].forEach(ratings => {
if (ratings) {
Object.values(ratings).forEach(v => {
if (v === 'excellent' || v === 'good') excellent++;
if (v === 'poor' || v === 'fair') poor++;
});
}
});
let summary = `Benefits Feedback Summary\n`;
summary += `${''.repeat(25)}\n\n`;
if (overall) {
summary += ` Overall Satisfaction: ${overall}/5 stars\n`;
}
if (competitive) {
const compLabels: Record<number, string> = {
1: 'Much worse than competitors',
2: 'Worse than competitors',
3: 'About average',
4: 'Better than competitors',
5: 'Much better than competitors'
};
summary += ` Competitiveness: ${compLabels[competitive] || competitive}\n`;
}
summary += `\n Category Ratings:\n`;
summary += ` ${excellent} rated Good/Excellent\n`;
summary += ` ${poor} rated Fair/Poor\n`;
if (workLife) {
const workLifeLabels: Record<string, string> = {
'very-bad': 'Very Poor',
'bad': 'Poor',
'neutral': 'Neutral',
'good': 'Good',
'excellent': 'Excellent'
};
summary += `\n Work-Life Balance: ${workLifeLabels[workLife] || workLife}\n`;
}
if (ptoUsage !== null && ptoUsage !== undefined) {
summary += ` PTO Usage: ${ptoUsage}%\n`;
}
if (topPriorities.length > 0) {
summary += `\n Top ${topPriorities.length} Priorities: Selected\n`;
}
if (wishlist.length > 0) {
summary += ` Wishlist Items: ${wishlist.length} new benefits requested\n`;
}
if (recommend) {
summary += `\n Would Recommend: ${recommend === 'up' ? ' Yes' : ' No'}\n`;
}
return summary;
},
customStyles: () => {
const overall = overallSection.starRating('overallSatisfaction')?.value() ?? 0;
const baseStyles = {
padding: '20px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (overall >= 4) return { ...baseStyles, backgroundColor: '#d1fae5', borderLeft: '4px solid #10b981' };
if (overall >= 3) return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
return { ...baseStyles, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Benefits Feedback'
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank you for your feedback!',
message: 'Your anonymous input helps us create a better benefits package for everyone. HR will review all responses to prioritize improvements for the upcoming benefits cycle.'
});
}