export function babysittingNannyCalculator(form: FormTs) {
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Babysitting & Nanny Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Care Type Section
const careSection = form.addSubform('care', { title: '๐ถ Care Type' });
careSection.addRow(row => {
row.addRadioButton('careType', {
label: 'Service Type',
options: [
{ id: 'babysitting', name: 'Occasional Babysitting' },
{ id: 'part-time-nanny', name: 'Part-Time Nanny' },
{ id: 'full-time-nanny', name: 'Full-Time Nanny' },
{ id: 'live-in', name: 'Live-In Nanny' },
{ id: 'night-nurse', name: 'Night Nurse/Newborn Care' }
],
defaultValue: 'babysitting',
orientation: 'vertical'
});
});
// Children Section
const childrenSection = form.addSubform('children', { title: '๐จโ๐ฉโ๐งโ๐ฆ Children' });
childrenSection.addRow(row => {
row.addDropdown('numChildren', {
label: 'Number of Children',
options: [
{ id: '1', name: '1 child' },
{ id: '2', name: '2 children' },
{ id: '3', name: '3 children' },
{ id: '4', name: '4 children' },
{ id: '5+', name: '5 or more children' }
],
defaultValue: '1',
isRequired: true
}, '1fr');
});
childrenSection.addRow(row => {
row.addDropdown('youngestAge', {
label: 'Youngest Child\'s Age',
options: [
{ id: 'infant', name: 'Infant (0-12 months)' },
{ id: 'toddler', name: 'Toddler (1-3 years)' },
{ id: 'preschool', name: 'Preschool (3-5 years)' },
{ id: 'school-age', name: 'School Age (6-12 years)' },
{ id: 'teen', name: 'Teen (13+ years)' }
],
defaultValue: 'preschool',
isRequired: true
}, '1fr');
row.addDropdown('specialNeeds', {
label: 'Special Needs',
options: [
{ id: 'none', name: 'No special needs' },
{ id: 'mild', name: 'Mild (allergies, dietary)' },
{ id: 'moderate', name: 'Moderate (medical needs)' },
{ id: 'significant', name: 'Significant care needs' }
],
defaultValue: 'none'
}, '1fr');
});
// Schedule Section
const scheduleSection = form.addSubform('schedule', { title: '๐
Schedule' });
scheduleSection.addRow(row => {
row.addDropdown('hoursPerWeek', {
label: 'Hours per Week',
options: [
{ id: '4', name: '4 hours (date night)' },
{ id: '10', name: '10 hours' },
{ id: '20', name: '20 hours (part-time)' },
{ id: '30', name: '30 hours' },
{ id: '40', name: '40 hours (full-time)' },
{ id: '50+', name: '50+ hours' }
],
defaultValue: '20',
isRequired: true,
isVisible: () => careSection.radioButton('careType')?.value() !== 'babysitting'
}, '1fr');
row.addDropdown('frequency', {
label: 'Frequency',
options: [
{ id: 'one-time', name: 'One-time' },
{ id: 'occasional', name: 'Occasional (1-2x/month)' },
{ id: 'weekly', name: 'Weekly' },
{ id: 'ongoing', name: 'Ongoing/Regular' }
],
defaultValue: 'weekly'
}, '1fr');
});
scheduleSection.addRow(row => {
row.addDropdown('babysittingHours', {
label: 'Hours Needed',
options: [
{ id: '2', name: '2 hours' },
{ id: '3', name: '3 hours' },
{ id: '4', name: '4 hours' },
{ id: '5', name: '5 hours' },
{ id: '6', name: '6 hours' },
{ id: '8', name: '8 hours' },
{ id: '10', name: '10 hours' },
{ id: '12', name: '12 hours' }
],
defaultValue: '4',
isRequired: true,
isVisible: () => careSection.radioButton('careType')?.value() === 'babysitting'
}, '1fr');
});
scheduleSection.addRow(row => {
row.addCheckbox('overnight', {
label: 'Overnight Care',
defaultValue: false
}, '1fr');
row.addCheckbox('weekends', {
label: 'Weekend Care',
defaultValue: false
}, '1fr');
});
scheduleSection.addRow(row => {
row.addCheckbox('holidays', {
label: 'Holiday Care',
defaultValue: false
}, '1fr');
row.addCheckbox('lateNight', {
label: 'Late Night (after 10pm)',
defaultValue: false
}, '1fr');
});
// Caregiver Section
const caregiverSection = form.addSubform('caregiver', { title: '๐ฉโโ๏ธ Caregiver Requirements' });
caregiverSection.addRow(row => {
row.addRadioButton('experienceLevel', {
label: 'Experience Level',
options: [
{ id: 'entry', name: 'Entry Level (0-2 years)' },
{ id: 'experienced', name: 'Experienced (2-5 years)' },
{ id: 'professional', name: 'Professional (5-10 years)' },
{ id: 'expert', name: 'Expert/Specialist (10+ years)' }
],
defaultValue: 'experienced',
orientation: 'vertical'
});
});
caregiverSection.addRow(row => {
row.addCheckbox('cprCertified', {
label: 'CPR/First Aid Certified',
defaultValue: true
}, '1fr');
row.addCheckbox('earlyChildhoodEd', {
label: 'Early Childhood Education',
defaultValue: false
}, '1fr');
});
caregiverSection.addRow(row => {
row.addCheckbox('bilingual', {
label: 'Bilingual',
defaultValue: false
}, '1fr');
row.addCheckbox('specialNeedsTrained', {
label: 'Special Needs Training',
defaultValue: false,
isVisible: () => childrenSection.dropdown('specialNeeds')?.value() !== 'none'
}, '1fr');
});
// Additional Duties Section
const dutiesSection = form.addSubform('duties', { title: '๐ Additional Duties' });
dutiesSection.addRow(row => {
row.addCheckbox('mealPrep', {
label: 'Meal Preparation',
defaultValue: false
}, '1fr');
row.addCheckbox('lightHousekeeping', {
label: 'Light Housekeeping',
defaultValue: false
}, '1fr');
});
dutiesSection.addRow(row => {
row.addCheckbox('transportation', {
label: 'Transportation/Driving',
defaultValue: false
}, '1fr');
row.addCheckbox('homeworkHelp', {
label: 'Homework Help',
defaultValue: false,
isVisible: () => childrenSection.dropdown('youngestAge')?.value() === 'school-age' || childrenSection.dropdown('youngestAge')?.value() === 'teen'
}, '1fr');
});
dutiesSection.addRow(row => {
row.addCheckbox('petCare', {
label: 'Pet Care',
defaultValue: false
}, '1fr');
row.addCheckbox('errands', {
label: 'Run Errands',
defaultValue: false
}, '1fr');
});
dutiesSection.addRow(row => {
row.addCheckbox('laundry', {
label: 'Children\'s Laundry',
defaultValue: false
}, '1fr');
row.addCheckbox('activities', {
label: 'Educational Activities',
defaultValue: false
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// Pricing Section
const pricingSection = form.addSubform('pricing', { title: '๐ฐ Pricing', isCollapsible: false });
const calculatePrice = () => {
const careType = careSection.radioButton('careType')?.value() || 'babysitting';
const numChildren = childrenSection.dropdown('numChildren')?.value() || '1';
const youngestAge = childrenSection.dropdown('youngestAge')?.value() || 'preschool';
const specialNeeds = childrenSection.dropdown('specialNeeds')?.value() || 'none';
const hoursPerWeek = parseInt(scheduleSection.dropdown('hoursPerWeek')?.value() || '20');
const experienceLevel = caregiverSection.radioButton('experienceLevel')?.value() || 'experienced';
const babysittingHours = parseInt(scheduleSection.dropdown('babysittingHours')?.value() || '4');
// Base hourly rate by experience
const baseRates: Record<string, number> = {
'entry': 15,
'experienced': 20,
'professional': 25,
'expert': 32
};
let hourlyRate = baseRates[experienceLevel] || 20;
// Care type adjustment
const careTypeMult: Record<string, number> = {
'babysitting': 1.0,
'part-time-nanny': 1.05,
'full-time-nanny': 1.0, // Often slightly lower per hour due to guaranteed hours
'live-in': 0.85, // Lower hourly but includes room/board
'night-nurse': 1.5
};
hourlyRate *= careTypeMult[careType] || 1.0;
// Age adjustment (younger children require more care)
const ageMult: Record<string, number> = {
'infant': 1.25,
'toddler': 1.15,
'preschool': 1.0,
'school-age': 0.95,
'teen': 0.9
};
hourlyRate *= ageMult[youngestAge] || 1.0;
// Number of children adjustment
const numChildrenValue = numChildren === '5+' ? 5 : parseInt(numChildren);
if (numChildrenValue > 1) {
hourlyRate += (numChildrenValue - 1) * 3; // $3 per additional child
}
// Special needs adjustment
const specialNeedsMult: Record<string, number> = {
'none': 1.0,
'mild': 1.05,
'moderate': 1.15,
'significant': 1.3
};
hourlyRate *= specialNeedsMult[specialNeeds] || 1.0;
// Certifications/qualifications
if (caregiverSection.checkbox('cprCertified')?.value()) hourlyRate += 1;
if (caregiverSection.checkbox('earlyChildhoodEd')?.value()) hourlyRate += 3;
if (caregiverSection.checkbox('bilingual')?.value()) hourlyRate += 2;
if (caregiverSection.checkbox('specialNeedsTrained')?.value()) hourlyRate += 4;
// Schedule adjustments
if (scheduleSection.checkbox('overnight')?.value()) hourlyRate *= 1.25;
if (scheduleSection.checkbox('weekends')?.value()) hourlyRate *= 1.1;
if (scheduleSection.checkbox('holidays')?.value()) hourlyRate *= 1.5;
if (scheduleSection.checkbox('lateNight')?.value()) hourlyRate *= 1.15;
// Additional duties (small additions per hour)
let dutiesAddition = 0;
if (dutiesSection.checkbox('mealPrep')?.value()) dutiesAddition += 2;
if (dutiesSection.checkbox('lightHousekeeping')?.value()) dutiesAddition += 2;
if (dutiesSection.checkbox('transportation')?.value()) dutiesAddition += 3;
if (dutiesSection.checkbox('homeworkHelp')?.value()) dutiesAddition += 2;
if (dutiesSection.checkbox('petCare')?.value()) dutiesAddition += 1;
if (dutiesSection.checkbox('errands')?.value()) dutiesAddition += 2;
if (dutiesSection.checkbox('laundry')?.value()) dutiesAddition += 1;
if (dutiesSection.checkbox('activities')?.value()) dutiesAddition += 2;
hourlyRate += dutiesAddition;
// Calculate totals
let weeklyHours = careType === 'babysitting' ? babysittingHours : hoursPerWeek;
if (careType === 'live-in') weeklyHours = 45; // Typical live-in hours
const weeklyTotal = hourlyRate * weeklyHours;
const monthlyTotal = weeklyTotal * 4.33;
const yearlyTotal = monthlyTotal * 12;
// Live-in room & board value
let roomBoardValue = 0;
if (careType === 'live-in') {
roomBoardValue = 800; // Average monthly value
}
return {
hourlyRate: Math.round(hourlyRate * 100) / 100,
weeklyHours,
weeklyTotal: Math.round(weeklyTotal),
monthlyTotal: Math.round(monthlyTotal),
yearlyTotal: Math.round(yearlyTotal),
roomBoardValue,
isBabysitting: careType === 'babysitting',
isLiveIn: careType === 'live-in'
};
};
pricingSection.addRow(row => {
row.addPriceDisplay('hourlyRate', {
label: 'Hourly Rate',
computedValue: () => calculatePrice().hourlyRate,
variant: 'default'
}, '1fr');
row.addTextPanel('hoursInfo', {
computedValue: () => `${calculatePrice().weeklyHours} hrs/week`,
customStyles: { 'font-size': '0.9rem', 'color': '#64748b', 'align-self': 'center' },
isVisible: () => !calculatePrice().isBabysitting
}, '1fr');
});
pricingSection.addRow(row => {
row.addPriceDisplay('weekly', {
label: 'Weekly',
computedValue: () => calculatePrice().weeklyTotal,
variant: 'default',
isVisible: () => !calculatePrice().isBabysitting
}, '1fr');
row.addPriceDisplay('monthly', {
label: 'Monthly',
computedValue: () => calculatePrice().monthlyTotal,
variant: 'default',
isVisible: () => !calculatePrice().isBabysitting
}, '1fr');
});
pricingSection.addRow(row => {
row.addTextPanel('roomBoard', {
computedValue: () => `+ Room & Board Value: ~$${calculatePrice().roomBoardValue}/month`,
customStyles: { 'font-size': '0.9rem', 'color': '#475569' },
isVisible: () => calculatePrice().isLiveIn
});
});
// Summary Section
const summarySection = form.addSubform('summary', {
title: '๐งพ Summary',
isCollapsible: false,
sticky: 'bottom'
});
summarySection.addRow(row => {
row.addPriceDisplay('total', {
label: () => calculatePrice().isBabysitting ? 'Session Total' : 'Monthly Total',
computedValue: () => calculatePrice().isBabysitting ?
calculatePrice().hourlyRate * calculatePrice().weeklyHours :
calculatePrice().monthlyTotal,
variant: 'large'
}, '1fr');
row.addTextPanel('rateInfo', {
computedValue: () => `$${calculatePrice().hourlyRate}/hour`,
customStyles: { 'font-size': '1rem', 'color': '#64748b', 'text-align': 'center', 'align-self': 'center' }
}, '1fr');
});
summarySection.addRow(row => {
row.addTextPanel('yearlyInfo', {
computedValue: () => {
const price = calculatePrice();
if (price.isBabysitting) {
return `${price.weeklyHours} hours of care`;
}
return `Annual estimate: $${price.yearlyTotal.toLocaleString()}`;
},
customStyles: { 'font-size': '0.9rem', 'color': '#475569', 'text-align': 'center' }
});
});
summarySection.addRow(row => {
row.addTextPanel('note', {
computedValue: () => 'Rates may vary by location and availability. Does not include taxes or agency fees if applicable.',
customStyles: { 'font-size': '0.85rem', 'color': '#64748b', 'text-align': 'center' }
});
});
form.configureSubmitButton({
label: 'Get Quote'
});
}