export function researchCollaborationFeedback(form: FormTs) {
// Research Collaboration Feedback Form - Academic partnership evaluation
// Demonstrates: RatingScale (NPS, Likert), StarRating, MatrixQuestion, EmojiRating, ThumbRating, SuggestionChips, conditional visibility, dynamic labels
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Research Collaboration Feedback',
computedValue: () => 'Help us improve future research partnerships',
customStyles: {
backgroundColor: '#4338ca',
color: 'white',
padding: '24px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Collaboration Details
// ============================================
const detailsSection = form.addSubform('details', {
title: 'Collaboration Details',
customStyles: { padding: '16px', borderRadius: '8px', border: '1px solid #e2e8f0' }
});
detailsSection.addRow(row => {
row.addTextbox('projectTitle', {
label: 'Research Project Title',
placeholder: 'e.g., Multi-site Study on...',
isRequired: true
});
});
detailsSection.addRow(row => {
row.addTextbox('partnerInstitution', {
label: 'Partner Institution/Organization',
placeholder: 'e.g., University of...',
isRequired: true
}, '1fr');
row.addDropdown('collaborationType', {
label: 'Collaboration Type',
options: [
{ id: 'academic-academic', name: 'Academic - Academic' },
{ id: 'academic-industry', name: 'Academic - Industry' },
{ id: 'multi-institutional', name: 'Multi-Institutional Consortium' },
{ id: 'international', name: 'International Partnership' },
{ id: 'government', name: 'Government/Public Sector' },
{ id: 'ngo', name: 'NGO/Non-profit' }
],
placeholder: 'Select type',
isRequired: true
}, '1fr');
});
detailsSection.addRow(row => {
row.addDropdown('projectDuration', {
label: 'Project Duration',
options: [
{ id: 'less-6m', name: 'Less than 6 months' },
{ id: '6m-1y', name: '6 months - 1 year' },
{ id: '1y-2y', name: '1-2 years' },
{ id: '2y-3y', name: '2-3 years' },
{ id: '3y-5y', name: '3-5 years' },
{ id: 'more-5y', name: 'More than 5 years' },
{ id: 'ongoing', name: 'Ongoing/Long-term' }
],
placeholder: 'Select duration'
}, '1fr');
row.addDropdown('yourRole', {
label: 'Your Role in Collaboration',
options: [
{ id: 'pi', name: 'Principal Investigator' },
{ id: 'co-pi', name: 'Co-Principal Investigator' },
{ id: 'co-investigator', name: 'Co-Investigator' },
{ id: 'postdoc', name: 'Postdoctoral Researcher' },
{ id: 'phd-student', name: 'PhD Student' },
{ id: 'research-staff', name: 'Research Staff' },
{ id: 'admin', name: 'Project Administrator' },
{ id: 'other', name: 'Other' }
],
placeholder: 'Select role',
isRequired: true
}, '1fr');
});
// ============================================
// SECTION 2: Communication & Coordination
// ============================================
const communicationSection = form.addSubform('communication', {
title: 'Communication & Coordination',
isVisible: () => detailsSection.dropdown('collaborationType')?.value() !== null
});
communicationSection.addRow(row => {
row.addMatrixQuestion('communicationMatrix', {
label: 'Rate the following communication aspects:',
rows: [
{ id: 'frequency', label: 'Meeting frequency was appropriate', isRequired: true },
{ id: 'responsiveness', label: 'Partners responded promptly', isRequired: true },
{ id: 'clarity', label: 'Communication was clear and transparent', isRequired: true },
{ id: 'conflict', label: 'Disagreements were handled constructively', isRequired: false },
{ id: 'updates', label: 'Progress updates were regular and helpful', isRequired: false }
],
columns: [
{ id: '1', label: 'Strongly Disagree' },
{ id: '2', label: 'Disagree' },
{ id: '3', label: 'Neutral' },
{ id: '4', label: 'Agree' },
{ id: '5', label: 'Strongly Agree' }
],
striped: true,
fullWidth: true
});
});
communicationSection.addRow(row => {
row.addStarRating('overallCommunication', {
label: 'Overall Communication Quality',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
// ============================================
// SECTION 3: Contributions & Deliverables
// ============================================
const contributionsSection = form.addSubform('contributions', {
title: 'Contributions & Deliverables',
isVisible: () => detailsSection.dropdown('collaborationType')?.value() !== null
});
contributionsSection.addRow(row => {
row.addMatrixQuestion('contributionsMatrix', {
label: 'Rate partner contributions:',
rows: [
{ id: 'expertise', label: 'Scientific/Technical Expertise', isRequired: true },
{ id: 'data', label: 'Data Collection/Sharing', isRequired: false },
{ id: 'resources', label: 'Resources & Equipment', isRequired: false },
{ id: 'funding', label: 'Funding/Financial Support', isRequired: false },
{ id: 'personnel', label: 'Personnel/Staff Support', isRequired: false },
{ id: 'deadlines', label: 'Meeting Deadlines', isRequired: true }
],
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
});
});
contributionsSection.addRow(row => {
row.addRatingScale('balanceContributions', {
label: 'Contributions were balanced between partners',
preset: 'likert-5',
lowLabel: 'Strongly Disagree',
highLabel: 'Strongly Agree',
alignment: 'center'
});
});
// ============================================
// SECTION 4: Outcomes & Impact
// ============================================
const outcomesSection = form.addSubform('outcomes', {
title: 'Outcomes & Impact',
isVisible: () => detailsSection.dropdown('collaborationType')?.value() !== null
});
outcomesSection.addRow(row => {
row.addCheckboxList('projectOutcomes', {
label: 'Select outcomes achieved through this collaboration:',
options: [
{ id: 'publications', name: 'Peer-reviewed publications' },
{ id: 'presentations', name: 'Conference presentations' },
{ id: 'datasets', name: 'Shared datasets' },
{ id: 'methods', name: 'New methods/protocols' },
{ id: 'grants', name: 'Successful grant applications' },
{ id: 'students', name: 'Student training/mentorship' },
{ id: 'patents', name: 'Patents/IP' },
{ id: 'policy', name: 'Policy impact' },
{ id: 'industry', name: 'Industry partnerships' },
{ id: 'media', name: 'Media coverage/public engagement' }
],
orientation: 'vertical'
});
});
outcomesSection.addRow(row => {
row.addStarRating('outcomesSatisfaction', {
label: 'Satisfaction with collaboration outcomes',
maxStars: 5,
size: 'lg',
alignment: 'center',
showConfettiOnMax: true
});
});
outcomesSection.addRow(row => {
row.addRatingScale('metObjectives', {
label: 'The collaboration met its stated objectives',
preset: 'likert-5',
lowLabel: 'Strongly Disagree',
highLabel: 'Strongly Agree',
alignment: 'center'
});
});
// ============================================
// SECTION 5: Strengths & Challenges
// ============================================
const strengthsSection = form.addSubform('strengths', {
title: 'Collaboration Strengths',
isVisible: () => detailsSection.dropdown('collaborationType')?.value() !== null,
customStyles: { backgroundColor: '#f0fdf4', padding: '16px', borderRadius: '8px' }
});
strengthsSection.addRow(row => {
row.addSuggestionChips('strengthAreas', {
label: 'What were the greatest strengths of this collaboration? (select up to 5)',
suggestions: [
{ id: 'expertise', name: 'Complementary Expertise' },
{ id: 'communication', name: 'Clear Communication' },
{ id: 'trust', name: 'Mutual Trust' },
{ id: 'flexibility', name: 'Flexibility' },
{ id: 'commitment', name: 'Shared Commitment' },
{ id: 'innovation', name: 'Innovation' },
{ id: 'resources', name: 'Resource Sharing' },
{ id: 'leadership', name: 'Strong Leadership' },
{ id: 'mentorship', name: 'Mentorship' },
{ id: 'impact', name: 'Real-world Impact' }
],
max: 5,
alignment: 'center'
});
});
const challengesSection = form.addSubform('challenges', {
title: 'Challenges Encountered',
isVisible: () => detailsSection.dropdown('collaborationType')?.value() !== null,
customStyles: { backgroundColor: '#fef3c7', padding: '16px', borderRadius: '8px' }
});
challengesSection.addRow(row => {
row.addSuggestionChips('challengeAreas', {
label: 'What challenges did you experience? (select all that apply)',
suggestions: [
{ id: 'communication', name: 'Communication Issues' },
{ id: 'time-zones', name: 'Time Zone Differences' },
{ id: 'cultural', name: 'Cultural Differences' },
{ id: 'workload', name: 'Unequal Workload' },
{ id: 'funding', name: 'Funding Issues' },
{ id: 'delays', name: 'Project Delays' },
{ id: 'ip', name: 'IP/Authorship Disputes' },
{ id: 'turnover', name: 'Staff Turnover' },
{ id: 'bureaucracy', name: 'Administrative Bureaucracy' },
{ id: 'technology', name: 'Technology/Tools' }
],
alignment: 'center'
});
});
challengesSection.addSpacer({ isVisible: () => {
const challenges = challengesSection.suggestionChips('challengeAreas')?.value() || [];
return challenges.length > 0;
}});
challengesSection.addRow(row => {
row.addTextarea('challengeDetails', {
label: 'Please elaborate on the challenges and how they were addressed',
placeholder: 'Describe the challenges and any solutions attempted...',
rows: 3,
autoExpand: true,
isVisible: () => {
const challenges = challengesSection.suggestionChips('challengeAreas')?.value() || [];
return challenges.length > 0;
}
});
});
// ============================================
// SECTION 6: Future Collaboration (NPS)
// ============================================
const futureSection = form.addSubform('future', {
title: 'Future Collaboration',
isVisible: () => detailsSection.dropdown('collaborationType')?.value() !== null,
customStyles: () => {
const nps = futureSection.ratingScale('collaborateAgainNPS')?.npsCategory();
if (nps === 'promoter') return { backgroundColor: '#dcfce7', padding: '16px', borderRadius: '8px' };
if (nps === 'passive') return { backgroundColor: '#fef9c3', padding: '16px', borderRadius: '8px' };
if (nps === 'detractor') return { backgroundColor: '#fecaca', padding: '16px', borderRadius: '8px' };
return { padding: '16px', borderRadius: '8px', border: '1px dashed #cbd5e1' };
}
});
futureSection.addRow(row => {
row.addRatingScale('collaborateAgainNPS', {
preset: 'nps',
label: 'How likely are you to collaborate with this partner again?',
showSegmentColors: true,
showCategoryLabel: true,
showConfettiOnPromoter: true,
alignment: 'center'
});
});
futureSection.addRow(row => {
row.addThumbRating('recommendPartner', {
label: 'Would you recommend this partner to other researchers?',
showLabels: true,
upLabel: 'Yes, definitely',
downLabel: 'No, probably not',
alignment: 'center',
size: 'lg'
});
});
futureSection.addRow(row => {
row.addTextarea('npsReason', {
label: () => {
const nps = futureSection.ratingScale('collaborateAgainNPS')?.npsCategory();
if (nps === 'promoter') return 'What made this collaboration successful?';
if (nps === 'passive') return 'What would make you more likely to collaborate again?';
if (nps === 'detractor') return 'What issues would need to be resolved?';
return 'Please explain your rating';
},
placeholder: 'Share your thoughts...',
rows: 3,
autoExpand: true,
isVisible: () => futureSection.ratingScale('collaborateAgainNPS')?.value() !== null
});
});
// ============================================
// SECTION 7: Overall Satisfaction
// ============================================
const satisfactionSection = form.addSubform('satisfaction', {
title: 'Overall Satisfaction',
isVisible: () => futureSection.ratingScale('collaborateAgainNPS')?.value() !== null
});
satisfactionSection.addRow(row => {
row.addEmojiRating('overallExperience', {
label: 'How would you describe your overall collaboration experience?',
preset: 'satisfaction',
size: 'lg',
showLabels: true,
alignment: 'center'
});
});
satisfactionSection.addSpacer();
satisfactionSection.addRow(row => {
row.addTextarea('lessonsLearned', {
label: 'Key lessons learned and recommendations for future collaborations',
placeholder: 'Share insights that could benefit future research partnerships...',
rows: 4,
autoExpand: true
});
});
// ============================================
// SECTION 8: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Feedback Summary',
isVisible: () => satisfactionSection.emojiRating('overallExperience')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const project = detailsSection.textbox('projectTitle')?.value();
const partner = detailsSection.textbox('partnerInstitution')?.value();
const collab = detailsSection.dropdown('collaborationType')?.value();
const commRating = communicationSection.starRating('overallCommunication')?.value();
const outcomesRating = outcomesSection.starRating('outcomesSatisfaction')?.value();
const nps = futureSection.ratingScale('collaborateAgainNPS')?.npsCategory();
const npsScore = futureSection.ratingScale('collaborateAgainNPS')?.value();
const outcomes = outcomesSection.checkboxList('projectOutcomes')?.value() || [];
const strengths = strengthsSection.suggestionChips('strengthAreas')?.value() || [];
const challenges = challengesSection.suggestionChips('challengeAreas')?.value() || [];
const recommend = futureSection.thumbRating('recommendPartner')?.value();
let summary = `COLLABORATION FEEDBACK\n`;
summary += `${'═'.repeat(28)}\n\n`;
if (project) summary += `Project: ${project}\n`;
if (partner) summary += `Partner: ${partner}\n`;
if (collab) {
const collabLabels: Record<string, string> = {
'academic-academic': 'Academic-Academic',
'academic-industry': 'Academic-Industry',
'multi-institutional': 'Multi-Institutional',
'international': 'International',
'government': 'Government',
'ngo': 'NGO/Non-profit'
};
summary += `Type: ${collabLabels[collab]}\n`;
}
summary += `\nRATINGS:\n`;
if (commRating) summary += `Communication: ${'★'.repeat(commRating)}${'☆'.repeat(5 - commRating)}\n`;
if (outcomesRating) summary += `Outcomes: ${'★'.repeat(outcomesRating)}${'☆'.repeat(5 - outcomesRating)}\n`;
if (nps && npsScore !== null && npsScore !== undefined) {
const emoji = nps === 'promoter' ? '🎉' : nps === 'passive' ? '😐' : '😟';
summary += `\n${emoji} Future Collab: ${npsScore}/10 (${nps})\n`;
}
if (outcomes.length > 0) {
summary += `\nOutcomes achieved: ${outcomes.length}\n`;
}
if (strengths.length > 0) {
summary += `Strengths identified: ${strengths.length}\n`;
}
if (challenges.length > 0) {
summary += `Challenges faced: ${challenges.length}\n`;
}
if (recommend) {
summary += `\nWould recommend: ${recommend === 'up' ? 'Yes' : 'No'}`;
}
return summary;
},
customStyles: () => {
const nps = futureSection.ratingScale('collaborateAgainNPS')?.npsCategory();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '13px'
};
if (nps === 'promoter') {
return { ...baseStyles, backgroundColor: '#dcfce7', borderLeft: '4px solid #22c55e' };
} else if (nps === 'passive') {
return { ...baseStyles, backgroundColor: '#fef9c3', borderLeft: '4px solid #eab308' };
} else if (nps === 'detractor') {
return { ...baseStyles, backgroundColor: '#fecaca', borderLeft: '4px solid #ef4444' };
}
return { ...baseStyles, backgroundColor: '#f8fafc', borderLeft: '4px solid #4338ca' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Feedback',
isVisible: () => satisfactionSection.emojiRating('overallExperience')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback!',
message: 'Your insights help strengthen research partnerships and improve future collaborations. Your feedback will be used to enhance collaboration practices and support productive research relationships.'
});
}