export function officeFeedbackSurvey(form: FormTs) {
// Office Environment Feedback - Workplace satisfaction and comfort assessment
// Demonstrates: Slider, MatrixQuestion, EmojiRating, StarRating, SuggestionChips, dynamic styling
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Office Environment Feedback',
computedValue: () => 'Help us create a better workplace by sharing your feedback on our office environment. Your input guides facility improvements.',
customStyles: {
backgroundColor: '#0891b2',
color: 'white',
padding: '24px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Location & Work Pattern
// ============================================
const locationSection = form.addSubform('locationInfo', {
title: 'Your Workspace'
});
locationSection.addRow(row => {
row.addDropdown('floor', {
label: 'Which floor/area do you primarily work on?',
options: [
{ id: 'floor-1', name: '1st Floor' },
{ id: 'floor-2', name: '2nd Floor' },
{ id: 'floor-3', name: '3rd Floor' },
{ id: 'floor-4', name: '4th Floor' },
{ id: 'basement', name: 'Basement/Lower Level' },
{ id: 'multiple', name: 'Multiple floors' }
],
placeholder: 'Select your floor...',
isRequired: true
}, '1fr');
row.addDropdown('workspaceType', {
label: 'What type of workspace do you use?',
options: [
{ id: 'private', name: 'Private office' },
{ id: 'shared', name: 'Shared office' },
{ id: 'cubicle', name: 'Cubicle' },
{ id: 'open-desk', name: 'Open desk area' },
{ id: 'hot-desk', name: 'Hot-desking/flexible' },
{ id: 'remote', name: 'Primarily remote' }
],
placeholder: 'Select workspace type...',
isRequired: true
}, '1fr');
});
locationSection.addRow(row => {
row.addRadioButton('daysInOffice', {
label: 'How many days per week do you typically work in the office?',
options: [
{ id: '5', name: '5 days' },
{ id: '4', name: '4 days' },
{ id: '3', name: '3 days' },
{ id: '2', name: '2 days' },
{ id: '1', name: '1 day or less' }
],
orientation: 'horizontal'
});
});
// ============================================
// SECTION 2: Overall Satisfaction
// ============================================
const overallSection = form.addSubform('overallSatisfaction', {
title: 'Overall Satisfaction',
isVisible: () => locationSection.dropdown('floor')?.value() !== null
});
overallSection.addRow(row => {
row.addEmojiRating('overallFeeling', {
label: 'How do you feel about the overall office environment?',
preset: 'satisfaction',
size: 'lg',
showLabels: true,
alignment: 'center'
});
});
overallSection.addRow(row => {
row.addRatingScale('recommendWorkspace', {
preset: 'nps',
label: 'How likely are you to recommend this office to a colleague?',
showCategoryLabel: true,
showSegmentColors: true,
alignment: 'center'
});
});
// ============================================
// SECTION 3: Temperature & Air Quality
// ============================================
const temperatureSection = form.addSubform('temperatureAir', {
title: 'Temperature & Air Quality',
isVisible: () => overallSection.emojiRating('overallFeeling')?.value() !== null
});
temperatureSection.addRow(row => {
row.addSlider('temperatureComfort', {
label: 'Temperature comfort level',
min: 1,
max: 5,
step: 1,
defaultValue: 3,
showValue: true
}, '1fr');
row.addTextPanel('tempLabel', {
computedValue: () => {
const temp = temperatureSection.slider('temperatureComfort')?.value() ?? 3;
const labels = ['Too Cold', 'Slightly Cold', 'Comfortable', 'Slightly Warm', 'Too Hot'];
return labels[temp - 1] || '';
},
customStyles: () => {
const temp = temperatureSection.slider('temperatureComfort')?.value() ?? 3;
const colors = ['#3b82f6', '#93c5fd', '#10b981', '#fcd34d', '#ef4444'];
return {
color: colors[temp - 1] || '#6b7280',
fontWeight: 'bold',
paddingTop: '24px'
};
}
}, '150px');
});
temperatureSection.addRow(row => {
row.addSlider('airQuality', {
label: 'Air quality/freshness',
min: 1,
max: 5,
step: 1,
defaultValue: 3,
showValue: true
}, '1fr');
row.addTextPanel('airLabel', {
computedValue: () => {
const air = temperatureSection.slider('airQuality')?.value() ?? 3;
const labels = ['Very Poor', 'Poor', 'Adequate', 'Good', 'Excellent'];
return labels[air - 1] || '';
},
customStyles: { paddingTop: '24px', fontWeight: 'bold' }
}, '150px');
});
temperatureSection.addRow(row => {
row.addCheckboxList('temperatureIssues', {
label: 'Have you experienced any of these issues?',
options: [
{ id: 'drafts', name: 'Cold drafts near windows/vents' },
{ id: 'hot-spots', name: 'Hot spots in certain areas' },
{ id: 'stuffy', name: 'Stuffy/stale air' },
{ id: 'hvac-noise', name: 'Noisy HVAC system' },
{ id: 'inconsistent', name: 'Inconsistent temperatures' },
{ id: 'no-control', name: 'No thermostat control' }
],
orientation: 'vertical',
isVisible: () => {
const temp = temperatureSection.slider('temperatureComfort')?.value() ?? 3;
return temp !== 3;
}
});
});
// ============================================
// SECTION 4: Lighting
// ============================================
const lightingSection = form.addSubform('lighting', {
title: 'Lighting',
isVisible: () => overallSection.emojiRating('overallFeeling')?.value() !== null
});
lightingSection.addRow(row => {
row.addStarRating('naturalLight', {
label: 'Natural light availability',
maxStars: 5,
size: 'md',
alignment: 'center'
}, '1fr');
row.addStarRating('artificialLight', {
label: 'Artificial lighting quality',
maxStars: 5,
size: 'md',
alignment: 'center'
}, '1fr');
});
lightingSection.addRow(row => {
row.addCheckboxList('lightingIssues', {
label: 'Any lighting issues?',
options: [
{ id: 'too-dim', name: 'Too dim' },
{ id: 'too-bright', name: 'Too bright' },
{ id: 'glare', name: 'Screen glare' },
{ id: 'flickering', name: 'Flickering lights' },
{ id: 'no-control', name: 'Cannot adjust lighting' },
{ id: 'none', name: 'No issues' }
],
orientation: 'horizontal'
});
});
// ============================================
// SECTION 5: Noise & Privacy
// ============================================
const noiseSection = form.addSubform('noisePrivacy', {
title: 'Noise & Privacy',
isVisible: () => overallSection.emojiRating('overallFeeling')?.value() !== null
});
noiseSection.addRow(row => {
row.addSlider('noiseLevel', {
label: 'Noise level in your area',
min: 1,
max: 5,
step: 1,
defaultValue: 3,
showValue: true
}, '1fr');
row.addTextPanel('noiseLabel', {
computedValue: () => {
const noise = noiseSection.slider('noiseLevel')?.value() ?? 3;
const labels = ['Very Quiet', 'Quiet', 'Moderate', 'Noisy', 'Very Noisy'];
return labels[noise - 1] || '';
},
customStyles: { paddingTop: '24px', fontWeight: 'bold' }
}, '150px');
});
noiseSection.addRow(row => {
row.addSuggestionChips('noiseSourcesChips', {
label: 'Main sources of noise (if any):',
suggestions: [
{ id: 'conversations', name: 'Conversations' },
{ id: 'phone-calls', name: 'Phone calls' },
{ id: 'meetings', name: 'Nearby meetings' },
{ id: 'equipment', name: 'Equipment/machines' },
{ id: 'hvac', name: 'HVAC noise' },
{ id: 'traffic', name: 'Outside traffic' },
{ id: 'construction', name: 'Construction' }
],
alignment: 'center',
isVisible: () => {
const noise = noiseSection.slider('noiseLevel')?.value() ?? 3;
return noise >= 4;
}
});
});
noiseSection.addRow(row => {
row.addThumbRating('hasPrivacy', {
label: 'Do you have adequate privacy for focused work?',
showLabels: true,
upLabel: 'Yes',
downLabel: 'No',
alignment: 'center'
});
});
// ============================================
// SECTION 6: Facilities & Amenities
// ============================================
const amenitiesSection = form.addSubform('amenities', {
title: 'Facilities & Amenities',
isVisible: () => overallSection.emojiRating('overallFeeling')?.value() !== null
});
amenitiesSection.addRow(row => {
row.addMatrixQuestion('amenityRatings', {
label: 'Rate the following facilities:',
rows: [
{ id: 'restrooms', label: 'Restrooms', isRequired: true },
{ id: 'kitchen', label: 'Kitchen/break room', isRequired: true },
{ id: 'meeting-rooms', label: 'Meeting rooms', isRequired: false },
{ id: 'parking', label: 'Parking', isRequired: false },
{ id: 'elevator', label: 'Elevators/stairs', isRequired: false },
{ id: 'outdoor', label: 'Outdoor spaces', isRequired: false }
],
columns: [
{ id: 'poor', label: 'Poor' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' },
{ id: 'na', label: 'N/A' }
],
striped: true,
fullWidth: true
});
});
amenitiesSection.addRow(row => {
row.addCheckboxList('missingAmenities', {
label: 'What amenities would you like to see added?',
options: [
{ id: 'standing-desks', name: 'Standing desks' },
{ id: 'phone-booths', name: 'Phone booths' },
{ id: 'quiet-rooms', name: 'Quiet/focus rooms' },
{ id: 'wellness-room', name: 'Wellness/meditation room' },
{ id: 'better-coffee', name: 'Better coffee/beverages' },
{ id: 'snacks', name: 'Healthy snacks' },
{ id: 'bike-storage', name: 'Bike storage' },
{ id: 'showers', name: 'Showers' }
],
orientation: 'vertical'
});
});
// ============================================
// SECTION 7: Cleanliness & Maintenance
// ============================================
const cleanlinessSection = form.addSubform('cleanliness', {
title: 'Cleanliness & Maintenance',
isVisible: () => amenitiesSection.matrixQuestion('amenityRatings')?.areAllRequiredRowsAnswered() === true
});
cleanlinessSection.addRow(row => {
row.addStarRating('overallCleanliness', {
label: 'Overall cleanliness rating',
maxStars: 5,
size: 'lg',
alignment: 'center',
showConfettiOnMax: true
});
});
cleanlinessSection.addRow(row => {
row.addCheckboxList('cleanlinessIssues', {
label: 'Any cleanliness concerns?',
options: [
{ id: 'dust', name: 'Dust/allergens' },
{ id: 'restrooms', name: 'Restroom cleanliness' },
{ id: 'kitchen', name: 'Kitchen cleanliness' },
{ id: 'desks', name: 'Desk/work area cleaning' },
{ id: 'carpets', name: 'Carpet/flooring' },
{ id: 'windows', name: 'Dirty windows' },
{ id: 'pests', name: 'Pest issues' },
{ id: 'none', name: 'No concerns' }
],
orientation: 'vertical',
isVisible: () => {
const rating = cleanlinessSection.starRating('overallCleanliness')?.value();
return rating !== null && rating !== undefined && rating <= 3;
}
});
});
// ============================================
// SECTION 8: Improvement Suggestions
// ============================================
const suggestionsSection = form.addSubform('suggestions', {
title: 'Improvement Suggestions',
isVisible: () => cleanlinessSection.starRating('overallCleanliness')?.value() !== null
});
suggestionsSection.addRow(row => {
row.addDropdown('topPriority', {
label: 'What\'s the single most important improvement?',
options: [
{ id: 'temperature', name: 'Temperature/HVAC' },
{ id: 'lighting', name: 'Lighting' },
{ id: 'noise', name: 'Noise reduction' },
{ id: 'cleanliness', name: 'Cleanliness' },
{ id: 'amenities', name: 'Better amenities' },
{ id: 'space', name: 'More space' },
{ id: 'privacy', name: 'More privacy' },
{ id: 'equipment', name: 'Better equipment' },
{ id: 'none', name: 'No improvements needed' }
],
placeholder: 'Select top priority...'
});
});
suggestionsSection.addSpacer();
suggestionsSection.addRow(row => {
row.addTextarea('detailedSuggestions', {
label: () => {
const priority = suggestionsSection.dropdown('topPriority')?.value();
if (priority && priority !== 'none') {
const priorityLabels: Record<string, string> = {
'temperature': 'temperature/HVAC',
'lighting': 'lighting',
'noise': 'noise issues',
'cleanliness': 'cleanliness',
'amenities': 'amenities',
'space': 'space concerns',
'privacy': 'privacy',
'equipment': 'equipment'
};
return `Please elaborate on how we can improve ${priorityLabels[priority] || 'the office'}:`;
}
return 'Any other suggestions for improving the office environment?';
},
placeholder: 'Share your specific suggestions...',
rows: 4,
autoExpand: true
});
});
// ============================================
// SECTION 9: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Feedback Summary',
isVisible: () => {
const feeling = overallSection.emojiRating('overallFeeling')?.value();
const cleanliness = cleanlinessSection.starRating('overallCleanliness')?.value();
return feeling !== null && cleanliness !== null;
}
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const floor = locationSection.dropdown('floor')?.value();
const workspaceType = locationSection.dropdown('workspaceType')?.value();
const feeling = overallSection.emojiRating('overallFeeling')?.value();
const nps = overallSection.ratingScale('recommendWorkspace')?.value();
const temp = temperatureSection.slider('temperatureComfort')?.value() ?? 3;
const noise = noiseSection.slider('noiseLevel')?.value() ?? 3;
const cleanliness = cleanlinessSection.starRating('overallCleanliness')?.value();
const priority = suggestionsSection.dropdown('topPriority')?.value();
if (!feeling) return '';
const floorLabels: Record<string, string> = {
'floor-1': '1st Floor', 'floor-2': '2nd Floor', 'floor-3': '3rd Floor',
'floor-4': '4th Floor', 'basement': 'Basement', 'multiple': 'Multiple floors'
};
const workspaceLabels: Record<string, string> = {
'private': 'Private office', 'shared': 'Shared office', 'cubicle': 'Cubicle',
'open-desk': 'Open desk', 'hot-desk': 'Hot-desking', 'remote': 'Remote'
};
const satisfactionLabels: Record<string, string> = {
'very-bad': 'Very Dissatisfied',
'bad': 'Dissatisfied',
'neutral': 'Neutral',
'good': 'Satisfied',
'excellent': 'Very Satisfied'
};
const tempLabels = ['Too Cold', 'Cool', 'Comfortable', 'Warm', 'Too Hot'];
const noiseLabels = ['Very Quiet', 'Quiet', 'Moderate', 'Noisy', 'Very Noisy'];
let summary = 'Feedback Summary\n';
summary += '═'.repeat(25) + '\n\n';
summary += `Location: ${floorLabels[floor ?? ''] || floor}\n`;
summary += `Workspace: ${workspaceLabels[workspaceType ?? ''] || workspaceType}\n\n`;
summary += `Overall: ${satisfactionLabels[feeling] || feeling}\n`;
if (nps !== null && nps !== undefined) {
summary += `Recommend: ${nps}/10\n`;
}
summary += `\nComfort Metrics:\n`;
summary += ` Temperature: ${tempLabels[temp - 1]}\n`;
summary += ` Noise: ${noiseLabels[noise - 1]}\n`;
if (cleanliness) {
summary += ` Cleanliness: ${'★'.repeat(cleanliness)}${'☆'.repeat(5 - cleanliness)}\n`;
}
if (priority && priority !== 'none') {
summary += `\nTop Priority: ${priority}`;
}
return summary;
},
customStyles: () => {
const feeling = overallSection.emojiRating('overallFeeling')?.value();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (feeling === 'excellent' || feeling === 'good') {
return { ...baseStyles, backgroundColor: '#d1fae5', borderLeft: '4px solid #10b981' };
} else if (feeling === 'neutral') {
return { ...baseStyles, backgroundColor: '#e0e7ff', borderLeft: '4px solid #6366f1' };
} else {
return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
}
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Feedback',
isVisible: () => overallSection.emojiRating('overallFeeling')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank you for your feedback!',
message: 'Your input helps our facilities team prioritize improvements and create a better workplace for everyone. We review all feedback quarterly and will communicate any planned changes.'
});
}