export function employmentContractCalculator(form: FormTs) {
// Contract types and base fees
const contractTypes: Record<string, { baseFee: number, hours: number }> = {
'standard-employee': { baseFee: 650, hours: 3 },
'executive': { baseFee: 2500, hours: 10 },
'c-suite': { baseFee: 5000, hours: 20 },
'sales-commission': { baseFee: 950, hours: 4 },
'part-time': { baseFee: 450, hours: 2 },
'temporary': { baseFee: 400, hours: 2 },
'intern': { baseFee: 350, hours: 1.5 },
'consultant': { baseFee: 750, hours: 3.5 },
'remote-worker': { baseFee: 700, hours: 3 },
'international': { baseFee: 1500, hours: 6 }
};
// Attorney rates
const attorneyRates: Record<string, number> = {
'paralegal': 95,
'associate': 275,
'senior-associate': 400,
'partner': 550
};
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Employment Contract Cost Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Position Details Section
const positionSection = form.addSubform('position', { title: '๐ Position Details' });
positionSection.addRow(row => {
row.addDropdown('contractType', {
label: 'Contract Type',
options: [
{ id: 'standard-employee', name: 'Standard Employee' },
{ id: 'executive', name: 'Executive / Director' },
{ id: 'c-suite', name: 'C-Suite Executive' },
{ id: 'sales-commission', name: 'Sales (Commission-based)' },
{ id: 'part-time', name: 'Part-Time Employee' },
{ id: 'temporary', name: 'Temporary / Fixed-Term' },
{ id: 'intern', name: 'Intern / Trainee' },
{ id: 'consultant', name: 'Consultant / Advisor' },
{ id: 'remote-worker', name: 'Remote Worker' },
{ id: 'international', name: 'International Employee' }
],
defaultValue: 'standard-employee',
isRequired: true
}, '1fr');
row.addDropdown('industry', {
label: 'Industry',
options: [
{ id: 'general', name: 'General Business' },
{ id: 'technology', name: 'Technology / Software' },
{ id: 'healthcare', name: 'Healthcare / Medical' },
{ id: 'financial', name: 'Financial Services' },
{ id: 'legal', name: 'Legal / Professional Services' },
{ id: 'manufacturing', name: 'Manufacturing' },
{ id: 'retail', name: 'Retail / Hospitality' },
{ id: 'nonprofit', name: 'Non-Profit' }
],
defaultValue: 'general',
isRequired: true
}, '1fr');
});
positionSection.addRow(row => {
row.addDropdown('seniority', {
label: 'Seniority Level',
options: [
{ id: 'entry', name: 'Entry Level' },
{ id: 'mid', name: 'Mid-Level' },
{ id: 'senior', name: 'Senior' },
{ id: 'manager', name: 'Manager' },
{ id: 'director', name: 'Director' },
{ id: 'vp', name: 'VP / Executive' },
{ id: 'c-level', name: 'C-Level' }
],
defaultValue: 'mid',
isRequired: true
}, '1fr');
row.addDropdown('jurisdiction', {
label: 'Jurisdiction',
options: [
{ id: 'single-state', name: 'Single State' },
{ id: 'multi-state', name: 'Multi-State (+$200)' },
{ id: 'international', name: 'International (+$500)' }
],
defaultValue: 'single-state',
isRequired: true
}, '1fr');
});
// Compensation Section
const compensationSection = form.addSubform('compensation', { title: '๐ต Compensation Structure' });
compensationSection.addRow(row => {
row.addDropdown('salaryStructure', {
label: 'Salary Structure',
options: [
{ id: 'fixed', name: 'Fixed Salary' },
{ id: 'hourly', name: 'Hourly Rate' },
{ id: 'salary-bonus', name: 'Salary + Bonus' },
{ id: 'commission', name: 'Base + Commission' },
{ id: 'equity', name: 'Salary + Equity' },
{ id: 'complex', name: 'Complex Package (+$300)' }
],
defaultValue: 'fixed',
isRequired: true
}, '1fr');
row.addCheckbox('stockOptions', {
label: 'Include Stock Options / Equity (+$350)',
defaultValue: false,
isVisible: () => {
const type = positionSection.dropdown('contractType')?.value();
return ['executive', 'c-suite', 'consultant'].includes(type || '');
}
}, '1fr');
});
compensationSection.addRow(row => {
row.addCheckbox('bonusStructure', {
label: 'Performance Bonus Provisions (+$200)',
defaultValue: false
}, '1fr');
row.addCheckbox('severancePackage', {
label: 'Severance Package Terms (+$400)',
defaultValue: false
}, '1fr');
});
// Restrictive Covenants Section
const covenantsSection = form.addSubform('covenants', { title: '๐ Restrictive Covenants' });
covenantsSection.addRow(row => {
row.addCheckbox('nonCompete', {
label: 'Non-Compete Agreement (+$300)',
defaultValue: false
}, '1fr');
row.addCheckbox('nonSolicitation', {
label: 'Non-Solicitation Clause (+$200)',
defaultValue: false
}, '1fr');
});
covenantsSection.addRow(row => {
row.addCheckbox('confidentiality', {
label: 'Confidentiality / NDA Provisions (+$150)',
defaultValue: true
}, '1fr');
row.addCheckbox('ipAssignment', {
label: 'IP Assignment / Work Product (+$250)',
defaultValue: false
}, '1fr');
});
covenantsSection.addRow(row => {
row.addCheckbox('gardenLeave', {
label: 'Garden Leave Provisions (+$200)',
defaultValue: false,
isVisible: () => {
const type = positionSection.dropdown('contractType')?.value();
return ['executive', 'c-suite'].includes(type || '');
}
}, '1fr');
row.addCheckbox('cloawback', {
label: 'Clawback Provisions (+$250)',
defaultValue: false,
isVisible: () => {
const type = positionSection.dropdown('contractType')?.value();
return ['executive', 'c-suite', 'sales-commission'].includes(type || '');
}
}, '1fr');
});
// Service Options Section
const serviceSection = form.addSubform('service', { title: 'โ๏ธ Service Options' });
serviceSection.addRow(row => {
row.addDropdown('level', {
label: 'Attorney Level',
options: [
{ id: 'paralegal', name: 'Paralegal ($95/hr)' },
{ id: 'associate', name: 'Associate ($275/hr)' },
{ id: 'senior-associate', name: 'Senior Associate ($400/hr)' },
{ id: 'partner', name: 'Partner ($550/hr)' }
],
defaultValue: 'associate',
isRequired: true
}, '1fr');
row.addDropdown('urgency', {
label: 'Timeline',
options: [
{ id: 'standard', name: 'Standard (1-2 weeks)' },
{ id: 'expedited', name: 'Expedited (3-5 days) (+25%)' },
{ id: 'rush', name: 'Rush (24-48 hrs) (+50%)' }
],
defaultValue: 'standard',
isRequired: true
}, '1fr');
});
serviceSection.addRow(row => {
row.addDropdown('serviceType', {
label: 'Service Type',
options: [
{ id: 'draft', name: 'New Contract Drafting' },
{ id: 'review', name: 'Review & Revise Existing (-20%)' },
{ id: 'negotiate', name: 'Draft + Negotiation Support (+40%)' }
],
defaultValue: 'draft',
isRequired: true
}, '1fr');
row.addInteger('quantity', {
label: 'Number of Contracts',
min: 1,
max: 100,
defaultValue: 1
}, '1fr');
});
// Additional Services
const addonsSection = form.addSubform('addons', { title: 'โจ Additional Services' });
addonsSection.addRow(row => {
row.addCheckbox('employeeHandbook', {
label: 'Employee Handbook Review (+$750)',
defaultValue: false
}, '1fr');
row.addCheckbox('complianceAudit', {
label: 'Employment Law Compliance Audit (+$500)',
defaultValue: false
}, '1fr');
});
addonsSection.addRow(row => {
row.addCheckbox('templatePackage', {
label: 'Contract Template Package (+$600)',
defaultValue: false
}, '1fr');
row.addCheckbox('onboarding', {
label: 'Onboarding Documentation (+$350)',
defaultValue: false
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// Summary Section
const summarySection = form.addSubform('summary', { title: '๐ฐ Cost Estimate', isCollapsible: false });
summarySection.addRow(row => {
row.addPriceDisplay('baseFee', {
label: 'Base Contract Fee',
computedValue: () => {
const type = positionSection.dropdown('contractType')?.value() || 'standard-employee';
const seniority = positionSection.dropdown('seniority')?.value() || 'mid';
const serviceType = serviceSection.dropdown('serviceType')?.value() || 'draft';
let fee = contractTypes[type]?.baseFee ?? 0;
// Seniority adjustment
const seniorityMultipliers: Record<string, number> = {
'entry': 0.8, 'mid': 1.0, 'senior': 1.15,
'manager': 1.3, 'director': 1.5, 'vp': 1.8, 'c-level': 2.0
};
fee *= seniorityMultipliers[seniority] || 1.0;
// Service type adjustment
if (serviceType === 'review') fee *= 0.8;
if (serviceType === 'negotiate') fee *= 1.4;
return Math.round(fee);
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('covenantsFee', {
label: 'Covenants & Provisions',
computedValue: () => {
let total = 0;
// Compensation
const salaryStructure = compensationSection.dropdown('salaryStructure')?.value();
if (salaryStructure === 'complex') total += 300;
if (compensationSection.checkbox('stockOptions')?.value()) total += 350;
if (compensationSection.checkbox('bonusStructure')?.value()) total += 200;
if (compensationSection.checkbox('severancePackage')?.value()) total += 400;
// Covenants
if (covenantsSection.checkbox('nonCompete')?.value()) total += 300;
if (covenantsSection.checkbox('nonSolicitation')?.value()) total += 200;
if (covenantsSection.checkbox('confidentiality')?.value()) total += 150;
if (covenantsSection.checkbox('ipAssignment')?.value()) total += 250;
if (covenantsSection.checkbox('gardenLeave')?.value()) total += 200;
if (covenantsSection.checkbox('cloawback')?.value()) total += 250;
// Jurisdiction
const jurisdiction = positionSection.dropdown('jurisdiction')?.value();
if (jurisdiction === 'multi-state') total += 200;
if (jurisdiction === 'international') total += 500;
return total;
},
variant: 'default',
prefix: '+'
}, '1fr');
});
summarySection.addRow(row => {
row.addPriceDisplay('urgencyFee', {
label: 'Urgency Premium',
computedValue: () => {
const type = positionSection.dropdown('contractType')?.value() || 'standard-employee';
const urgency = serviceSection.dropdown('urgency')?.value() || 'standard';
const baseFee = contractTypes[type]?.baseFee ?? 0;
const urgencyMultipliers: Record<string, number> = {
'standard': 0, 'expedited': 0.25, 'rush': 0.50
};
return Math.round(baseFee * (urgencyMultipliers[urgency] || 0));
},
variant: 'default',
prefix: '+'
}, '1fr');
row.addPriceDisplay('addonsFee', {
label: 'Additional Services',
computedValue: () => {
let total = 0;
if (addonsSection.checkbox('employeeHandbook')?.value()) total += 750;
if (addonsSection.checkbox('complianceAudit')?.value()) total += 500;
if (addonsSection.checkbox('templatePackage')?.value()) total += 600;
if (addonsSection.checkbox('onboarding')?.value()) total += 350;
return total;
},
variant: 'default',
prefix: '+'
}, '1fr');
});
const finalSection = form.addSubform('final', {
title: '๐งพ Total Estimate',
isCollapsible: false,
sticky: 'bottom'
});
finalSection.addRow(row => {
row.addPriceDisplay('totalFee', {
label: 'Estimated Total',
computedValue: () => {
const type = positionSection.dropdown('contractType')?.value() || 'standard-employee';
const seniority = positionSection.dropdown('seniority')?.value() || 'mid';
const serviceType = serviceSection.dropdown('serviceType')?.value() || 'draft';
const urgency = serviceSection.dropdown('urgency')?.value() || 'standard';
const quantity = serviceSection.integer('quantity')?.value() || 1;
// Base fee
let fee = contractTypes[type]?.baseFee ?? 0;
const seniorityMultipliers: Record<string, number> = {
'entry': 0.8, 'mid': 1.0, 'senior': 1.15,
'manager': 1.3, 'director': 1.5, 'vp': 1.8, 'c-level': 2.0
};
fee *= seniorityMultipliers[seniority] || 1.0;
if (serviceType === 'review') fee *= 0.8;
if (serviceType === 'negotiate') fee *= 1.4;
// Provisions
const salaryStructure = compensationSection.dropdown('salaryStructure')?.value();
if (salaryStructure === 'complex') fee += 300;
if (compensationSection.checkbox('stockOptions')?.value()) fee += 350;
if (compensationSection.checkbox('bonusStructure')?.value()) fee += 200;
if (compensationSection.checkbox('severancePackage')?.value()) fee += 400;
if (covenantsSection.checkbox('nonCompete')?.value()) fee += 300;
if (covenantsSection.checkbox('nonSolicitation')?.value()) fee += 200;
if (covenantsSection.checkbox('confidentiality')?.value()) fee += 150;
if (covenantsSection.checkbox('ipAssignment')?.value()) fee += 250;
if (covenantsSection.checkbox('gardenLeave')?.value()) fee += 200;
if (covenantsSection.checkbox('cloawback')?.value()) fee += 250;
const jurisdiction = positionSection.dropdown('jurisdiction')?.value();
if (jurisdiction === 'multi-state') fee += 200;
if (jurisdiction === 'international') fee += 500;
// Urgency
const urgencyMultipliers: Record<string, number> = {
'standard': 1.0, 'expedited': 1.25, 'rush': 1.50
};
fee *= urgencyMultipliers[urgency] || 1.0;
// Quantity
let total = fee * quantity;
if (quantity >= 5) total *= 0.9;
if (quantity >= 10) total *= 0.85;
// Add-ons
if (addonsSection.checkbox('employeeHandbook')?.value()) total += 750;
if (addonsSection.checkbox('complianceAudit')?.value()) total += 500;
if (addonsSection.checkbox('templatePackage')?.value()) total += 600;
if (addonsSection.checkbox('onboarding')?.value()) total += 350;
return Math.round(total);
},
variant: 'large'
});
});
finalSection.addRow(row => {
row.addTextPanel('volumeNote', {
computedValue: () => {
const quantity = serviceSection.integer('quantity')?.value() || 1;
if (quantity >= 10) return 'Volume discount: 15% applied';
if (quantity >= 5) return 'Volume discount: 10% applied';
return 'Volume discounts available for 5+ contracts';
},
customStyles: { 'font-size': '0.9rem', 'color': '#059669', 'text-align': 'center' }
});
});
finalSection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'This estimate is for budgeting purposes. Final fees depend on specific requirements and state employment law compliance. A consultation is recommended for executive-level contracts.',
customStyles: { 'font-size': '0.8rem', 'color': '#64748b', 'font-style': 'italic' }
});
});
form.configureSubmitButton({
label: 'Request Employment Contract Quote'
});
}