export function hairBeautyForm(form: FormTs) {
form.setTitle(() => '✂️ Salon Price Calculator');
form.configureCompletionScreen({
type: 'text',
title: () => '💇 Quote Ready!',
message: () => 'Your service estimate is ready. Book your appointment today!'
});
const clientSection = form.addSubform('client', {
title: () => '👤 Client Info',
mobileBreakpoint: 0
});
clientSection.addRow(row => {
row.addDropdown('clientType', {
label: 'Client Type',
options: [
{ id: 'women', name: 'Women' },
{ id: 'men', name: 'Men' },
{ id: 'child', name: 'Child (12 & under)' }
],
defaultValue: 'women',
isRequired: true
}, '1fr');
row.addDropdown('hairLength', {
label: 'Hair Length',
options: [
{ id: 'short', name: 'Short' },
{ id: 'medium', name: 'Medium' },
{ id: 'long', name: 'Long' },
{ id: 'extra-long', name: 'Extra Long' }
],
defaultValue: 'medium'
}, '1fr');
});
const servicesSection = form.addSubform('services', {
title: () => '✂️ Services',
mobileBreakpoint: 0
});
servicesSection.addRow(row => {
row.addCheckboxList('mainServices', {
label: 'Select Services',
orientation: 'vertical',
options: [
{ id: 'haircut', name: '✂️ Haircut ($25-$65)' },
{ id: 'color', name: '🎨 Color Service ($75-$200)' },
{ id: 'highlights', name: '✨ Highlights/Balayage ($150+)' },
{ id: 'blowout', name: '💨 Blowout/Styling ($45)' },
{ id: 'treatment', name: '💆 Deep Treatment ($35)' }
]
});
});
const colorSection = form.addSubform('color', {
title: () => '🎨 Color Details',
isVisible: () => {
const services = servicesSection.checkboxList('mainServices')?.value() || [];
return services.includes('color') || services.includes('highlights');
},
mobileBreakpoint: 0
});
colorSection.addRow(row => {
row.addDropdown('colorType', {
label: 'Color Type',
options: [
{ id: 'root-touch', name: 'Root Touch-Up ($75)' },
{ id: 'single', name: 'Single Process ($95)' },
{ id: 'partial', name: 'Partial Highlights ($125)' },
{ id: 'full', name: 'Full Highlights ($175)' },
{ id: 'balayage', name: 'Balayage/Ombre ($200)' }
],
defaultValue: 'single'
}, '1fr');
});
colorSection.addRow(row => {
row.addCheckbox('toner', {
label: 'Add Toner (+$35)',
defaultValue: false
}, '1fr');
row.addCheckbox('olaplex', {
label: 'Add Olaplex (+$45)',
defaultValue: false
}, '1fr');
});
const stylistSection = form.addSubform('stylist', {
title: () => '👩🎨 Stylist Level',
mobileBreakpoint: 0
});
stylistSection.addRow(row => {
row.addRadioButton('level', {
label: 'Choose Stylist',
options: [
{ id: 'junior', name: 'Junior (-20%)' },
{ id: 'senior', name: 'Senior (Standard)' },
{ id: 'master', name: 'Master (+25%)' }
],
defaultValue: 'senior',
orientation: 'horizontal'
});
});
const calculatePrice = () => {
const clientType = clientSection.dropdown('clientType')?.value() || 'women';
const hairLength = clientSection.dropdown('hairLength')?.value() || 'medium';
const services = servicesSection.checkboxList('mainServices')?.value() || [];
const stylistLevel = stylistSection.radioButton('level')?.value() || 'senior';
const lengthMult: Record<string, number> = { short: 1, medium: 1.15, long: 1.35, 'extra-long': 1.55 };
const stylistMult: Record<string, number> = { junior: 0.8, senior: 1, master: 1.25 };
const lengthMultiplier = lengthMult[hairLength] || 1;
const stylistMultiplier = stylistMult[stylistLevel] || 1;
let total = 0;
if (services.includes('haircut')) {
const baseCut = clientType === 'women' ? 65 : clientType === 'men' ? 35 : 25;
total += baseCut * lengthMultiplier;
}
if (services.includes('color')) {
const colorType = colorSection.dropdown('colorType')?.value() || 'single';
const colorPrices: Record<string, number> = {
'root-touch': 75, single: 95, partial: 125, full: 175, balayage: 200
};
total += (colorPrices[colorType] || 95) * lengthMultiplier;
}
if (services.includes('highlights')) {
total += 150 * lengthMultiplier;
}
if (services.includes('blowout')) {
total += 45 * lengthMultiplier;
}
if (services.includes('treatment')) {
total += 35 * lengthMultiplier;
}
total *= stylistMultiplier;
if (colorSection.checkbox('toner')?.value()) total += 35;
if (colorSection.checkbox('olaplex')?.value()) total += 45;
return Math.round(total);
};
const summary = form.addSubform('summary', {
title: () => '💰 Your Quote',
isCollapsible: false
});
summary.addRow(row => {
row.addPriceDisplay('total', {
label: 'Estimated Total',
computedValue: () => calculatePrice(),
alignment: 'center',
variant: 'large'
});
});
summary.addRow(row => {
row.addTextPanel('tip', {
computedValue: () => {
const total = calculatePrice();
const tip = Math.round(total * 0.2);
return `💡 Suggested tip (20%): $${tip}`;
},
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
textAlign: 'center'
}
});
});
form.configureSubmitButton({
label: () => 'Book Appointment'
});
}