export function auditFeedbackSurvey(form: FormTs) {
// Audit Process Feedback - Post-audit client satisfaction survey
// Demonstrates: Dropdown, Datepicker, MatrixQuestion, RatingScale, StarRating, ThumbRating, conditional logic
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Audit Process Feedback',
computedValue: () => 'Your feedback helps us continuously improve our audit services.',
customStyles: {
background: 'linear-gradient(135deg, #1e40af 0%, #3b82f6 100%)',
color: 'white',
padding: '28px',
borderRadius: '16px',
textAlign: 'center',
fontSize: '15px'
}
});
});
// ============================================
// SECTION 1: Audit Information
// ============================================
const infoSection = form.addSubform('infoSection', {
title: 'Audit Details',
customStyles: { backgroundColor: '#eff6ff', padding: '20px', borderRadius: '12px' }
});
infoSection.addRow(row => {
row.addDropdown('auditType', {
label: 'Type of audit conducted:',
options: [
{ id: 'financial', name: 'Financial Audit' },
{ id: 'internal', name: 'Internal Audit' },
{ id: 'compliance', name: 'Compliance Audit' },
{ id: 'operational', name: 'Operational Audit' },
{ id: 'it', name: 'IT/Systems Audit' },
{ id: 'quality', name: 'Quality Audit (ISO, etc.)' },
{ id: 'other', name: 'Other' }
],
placeholder: 'Select audit type',
isRequired: true
}, '1fr');
row.addDatepicker('auditDate', {
label: 'Audit completion date:',
maxDate: () => new Date().toISOString(),
isRequired: true
}, '1fr');
});
infoSection.addRow(row => {
row.addRadioButton('firstAudit', {
label: 'Was this your first audit with our firm?',
options: [
{ id: 'yes', name: 'Yes, first time' },
{ id: 'no', name: 'No, we\'ve worked together before' }
],
orientation: 'horizontal'
});
});
// ============================================
// SECTION 2: Audit Team Performance
// ============================================
const teamSection = form.addSubform('teamSection', {
title: 'Audit Team Performance',
isVisible: () => infoSection.dropdown('auditType')?.value() !== null
});
teamSection.addRow(row => {
row.addMatrixQuestion('teamRatings', {
label: 'Please rate the audit team on the following:',
rows: [
{ id: 'professionalism', label: 'Professionalism and conduct', isRequired: true },
{ id: 'expertise', label: 'Technical expertise/knowledge', isRequired: true },
{ id: 'communication', label: 'Communication clarity', isRequired: true },
{ id: 'responsiveness', label: 'Responsiveness to questions', isRequired: true },
{ id: 'respect', label: 'Respect for your time', isRequired: false },
{ id: 'organization', label: 'Organization and preparedness', isRequired: false }
],
columns: [
{ id: '1', label: 'Poor' },
{ id: '2', label: 'Fair' },
{ id: '3', label: 'Good' },
{ id: '4', label: 'Very Good' },
{ id: '5', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
teamSection.addRow(row => {
row.addStarRating('engagementPartner', {
label: 'Engagement partner/lead auditor availability:',
maxStars: 5,
size: 'md',
showCounter: true,
alignment: 'left'
}, '1fr');
row.addStarRating('teamCoordination', {
label: 'Team coordination and consistency:',
maxStars: 5,
size: 'md',
showCounter: true,
alignment: 'left'
}, '1fr');
});
// ============================================
// SECTION 3: Audit Process Quality
// ============================================
const processSection = form.addSubform('processSection', {
title: 'Audit Process',
isVisible: () => infoSection.dropdown('auditType')?.value() !== null,
customStyles: { backgroundColor: '#f8fafc', padding: '20px', borderRadius: '12px' }
});
processSection.addRow(row => {
row.addMatrixQuestion('processRatings', {
label: 'Rate the audit process on these aspects:',
rows: [
{ id: 'planning', label: 'Audit planning and scoping', isRequired: true },
{ id: 'thoroughness', label: 'Thoroughness of examination', isRequired: true },
{ id: 'disruption', label: 'Minimal disruption to operations', isRequired: true },
{ id: 'timeline', label: 'Adherence to timeline', isRequired: true },
{ id: 'documentation', label: 'Documentation requests clarity', isRequired: false },
{ id: 'flexibility', label: 'Flexibility and accommodation', isRequired: false }
],
columns: [
{ id: '1', label: 'Poor' },
{ id: '2', label: 'Fair' },
{ id: '3', label: 'Good' },
{ id: '4', label: 'Very Good' },
{ id: '5', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
processSection.addRow(row => {
row.addRatingScale('effortRequired', {
label: 'How much effort did the audit require from your team?',
preset: 'ces',
lowLabel: 'Very high effort',
highLabel: 'Very low effort',
variant: 'buttons',
size: 'md',
alignment: 'center'
});
});
// ============================================
// SECTION 4: Findings & Reporting
// ============================================
const findingsSection = form.addSubform('findingsSection', {
title: 'Findings & Reporting',
isVisible: () => infoSection.dropdown('auditType')?.value() !== null
});
findingsSection.addRow(row => {
row.addStarRating('findingsClarity', {
label: 'Clarity of audit findings:',
maxStars: 5,
size: 'md',
showCounter: true,
alignment: 'left'
}, '1fr');
row.addStarRating('findingsRelevance', {
label: 'Relevance and usefulness of findings:',
maxStars: 5,
size: 'md',
showCounter: true,
alignment: 'left'
}, '1fr');
});
findingsSection.addRow(row => {
row.addStarRating('recommendationsQuality', {
label: 'Quality of recommendations:',
maxStars: 5,
size: 'md',
showCounter: true,
alignment: 'left'
}, '1fr');
row.addStarRating('reportQuality', {
label: 'Final report quality:',
maxStars: 5,
size: 'md',
showCounter: true,
alignment: 'left'
}, '1fr');
});
findingsSection.addRow(row => {
row.addThumbRating('actionableFindings', {
label: 'Were the findings and recommendations actionable for your organization?',
size: 'lg',
showLabels: true,
upLabel: 'Yes, very actionable',
downLabel: 'Not really actionable',
alignment: 'center'
});
});
// ============================================
// SECTION 5: Value Assessment
// ============================================
const valueSection = form.addSubform('valueSection', {
title: 'Value & Satisfaction',
isVisible: () => infoSection.dropdown('auditType')?.value() !== null,
customStyles: { backgroundColor: '#fefce8', padding: '20px', borderRadius: '12px' }
});
valueSection.addRow(row => {
row.addRatingScale('overallValue', {
label: 'Overall, how would you rate the value delivered by this audit?',
preset: 'likert-5',
lowLabel: 'Poor value',
highLabel: 'Excellent value',
variant: 'buttons',
size: 'lg',
alignment: 'center'
});
});
valueSection.addRow(row => {
row.addEmojiRating('overallSatisfaction', {
label: 'How satisfied are you with the overall audit experience?',
preset: 'satisfaction',
size: 'lg',
showLabels: true,
alignment: 'center'
});
});
valueSection.addRow(row => {
row.addCheckboxList('valueAreas', {
label: 'Where did the audit provide the most value? (Select all that apply)',
options: [
{ id: 'compliance', name: 'Compliance assurance' },
{ id: 'risks', name: 'Risk identification' },
{ id: 'controls', name: 'Control improvements' },
{ id: 'efficiency', name: 'Process efficiency insights' },
{ id: 'governance', name: 'Governance strengthening' },
{ id: 'training', name: 'Staff education/awareness' },
{ id: 'stakeholder', name: 'Stakeholder confidence' },
{ id: 'benchmarking', name: 'Industry benchmarking' }
],
orientation: 'vertical'
});
});
// ============================================
// SECTION 6: Future Engagement
// ============================================
const futureSection = form.addSubform('futureSection', {
title: 'Future Engagement',
isVisible: () => infoSection.dropdown('auditType')?.value() !== null
});
futureSection.addRow(row => {
row.addThumbRating('wouldReengage', {
label: 'Would you engage our firm for future audits?',
size: 'lg',
showLabels: true,
upLabel: 'Yes, definitely',
downLabel: 'Probably not',
alignment: 'center'
});
});
futureSection.addRow(row => {
row.addThumbRating('wouldRecommend', {
label: 'Would you recommend our audit services to others?',
size: 'lg',
showLabels: true,
upLabel: 'Yes, I would recommend',
downLabel: 'Probably not',
alignment: 'center'
});
});
futureSection.addRow(row => {
row.addCheckboxList('otherServices', {
label: 'Are you interested in learning about other services we offer?',
options: [
{ id: 'tax', name: 'Tax advisory' },
{ id: 'consulting', name: 'Business consulting' },
{ id: 'risk', name: 'Risk management' },
{ id: 'it-audit', name: 'IT audit/Cybersecurity' },
{ id: 'internal-audit', name: 'Internal audit outsourcing' },
{ id: 'none', name: 'No, thank you' }
],
orientation: 'vertical',
isVisible: () => futureSection.thumbRating('wouldReengage')?.value() === 'up'
});
});
// ============================================
// SECTION 7: Additional Feedback
// ============================================
const additionalSection = form.addSubform('additionalSection', {
title: 'Additional Comments',
isVisible: () => infoSection.dropdown('auditType')?.value() !== null
});
additionalSection.addSpacer({ height: '8px' });
additionalSection.addRow(row => {
row.addTextarea('improvements', {
label: 'What could we improve for future audits?',
placeholder: 'Share any suggestions for improving our audit process...',
rows: 3,
autoExpand: true
});
});
additionalSection.addRow(row => {
row.addTextarea('commendations', {
label: 'Any team members or aspects you would like to commend?',
placeholder: 'Let us know if anyone went above and beyond...',
rows: 2,
autoExpand: true
});
});
// ============================================
// SECTION 8: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Feedback Summary',
isVisible: () => valueSection.emojiRating('overallSatisfaction')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const auditType = infoSection.dropdown('auditType')?.value();
const satisfaction = valueSection.emojiRating('overallSatisfaction')?.value();
const value = valueSection.ratingScale('overallValue')?.value();
const reengage = futureSection.thumbRating('wouldReengage')?.value();
const recommend = futureSection.thumbRating('wouldRecommend')?.value();
const valueAreas = valueSection.checkboxList('valueAreas')?.value() || [];
const typeLabels: Record<string, string> = {
'financial': 'Financial Audit',
'internal': 'Internal Audit',
'compliance': 'Compliance Audit',
'operational': 'Operational Audit',
'it': 'IT/Systems Audit',
'quality': 'Quality Audit',
'other': 'Other Audit'
};
const satLabels: Record<string, string> = {
'very-bad': 'Very Dissatisfied',
'bad': 'Dissatisfied',
'neutral': 'Neutral',
'good': 'Satisfied',
'excellent': 'Very Satisfied'
};
let summary = '📋 Audit Feedback Summary\n';
summary += `${'═'.repeat(30)}\n\n`;
summary += `📊 Audit Type: ${typeLabels[auditType || ''] || auditType}\n`;
if (satisfaction) {
summary += `😊 Satisfaction: ${satLabels[satisfaction] || satisfaction}\n`;
}
if (value) {
summary += `💰 Value Rating: ${value}/5\n`;
}
if (reengage) {
summary += `\n🔄 Would Re-engage: ${reengage === 'up' ? 'Yes' : 'No'}`;
}
if (recommend) {
summary += `\n👍 Would Recommend: ${recommend === 'up' ? 'Yes' : 'No'}`;
}
if (valueAreas.length > 0) {
summary += `\n\n✨ Key Value Areas: ${valueAreas.length} identified`;
}
return summary;
},
customStyles: () => {
const satisfaction = valueSection.emojiRating('overallSatisfaction')?.value();
const baseStyles = {
padding: '20px',
borderRadius: '12px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (satisfaction === 'excellent' || satisfaction === 'good') {
return { ...baseStyles, backgroundColor: '#eff6ff', borderLeft: '4px solid #3b82f6' };
} else if (satisfaction === 'neutral') {
return { ...baseStyles, backgroundColor: '#fefce8', borderLeft: '4px solid #eab308' };
} else {
return { ...baseStyles, backgroundColor: '#fef2f2', borderLeft: '4px solid #ef4444' };
}
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Audit Feedback',
isVisible: () => infoSection.dropdown('auditType')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback!',
message: 'Your insights help us improve our audit services and deliver greater value to our clients. We review all feedback carefully and take action on your suggestions.'
});
}