/* Condo Renovation Estimator: every rule is scoped to #ce-estimator so it won't touch the rest of your site. Change the colors below to match your brand. */ #ce-estimator { --ce-bg: #f4f3ef; --ce-paper: #ffffff; --ce-soft: #eeece6; --ce-ink: #1b1a17; --ce-muted: #6b6860; --ce-line: #dcd9d1; --ce-accent: #2f5d50; --ce-accent-ink: #ffffff; --ce-accent-soft: #e3ece8; --ce-warn: #9a5b13; --ce-warn-soft: #fbf1e3; --ce-danger: #b3261e; --ce-radius: 18px; --ce-radius-sm: 12px; container-type: inline-size; display: block; max-width: 1180px; margin: 0 auto; color: var(--ce-ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 16px; line-height: 1.5; text-align: left; } #ce-estimator *, #ce-estimator *::before, #ce-estimator *::after { box-sizing: border-box; } #ce-estimator button, #ce-estimator input, #ce-estimator select, #ce-estimator textarea { font: inherit; color: inherit; margin: 0; letter-spacing: normal; text-transform: none; line-height: 1.4; } #ce-estimator button { cursor: pointer; background: none; border: 0; padding: 0; box-shadow: none; text-shadow: none; } #ce-estimator button:disabled { cursor: not-allowed; } #ce-estimator :focus-visible { outline: 3px solid var(--ce-accent); outline-offset: 2px; } #ce-estimator p, #ce-estimator h2, #ce-estimator h3, #ce-estimator h4, #ce-estimator dl, #ce-estimator ul { margin: 0; padding: 0; text-transform: none; font-family: inherit; font-weight: 700; text-align: inherit; } #ce-estimator p, #ce-estimator dl, #ce-estimator ul { font-weight: 400; } #ce-estimator strong { font-weight: 700; } #ce-estimator .ce-wrap { background: var(--ce-bg); border-radius: var(--ce-radius); padding: clamp(16px, 3cqi, 32px); } #ce-estimator .ce-muted { color: var(--ce-muted); } #ce-estimator .ce-h2 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 6px; color: var(--ce-ink); } #ce-estimator .ce-h3 { font-size: 1.05rem; line-height: 1.2; margin: 26px 0 12px; color: var(--ce-ink); } /* Header + stepper */ #ce-estimator .ce-head { position: relative; margin-bottom: 20px; } #ce-estimator .ce-eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 700; color: var(--ce-accent); margin-bottom: 8px; } #ce-estimator .ce-title { font-size: clamp(1.6rem, 4cqi, 2.4rem); line-height: 1.12; letter-spacing: -0.03em; max-width: 20ch; color: var(--ce-ink); margin-bottom: 18px; } #ce-estimator .ce-demo-note { position: absolute; top: 0; right: 0; font-size: 12px; padding: 5px 11px; border-radius: 999px; background: var(--ce-warn-soft); color: var(--ce-warn); font-weight: 600; } #ce-estimator .ce-stepper { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--ce-line); scrollbar-width: none; } #ce-estimator .ce-step { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--ce-muted); font-weight: 600; font-size: 15px; } #ce-estimator .ce-step.is-current { color: var(--ce-ink); border-bottom-color: var(--ce-accent); } #ce-estimator .ce-step.is-done { color: var(--ce-ink); } #ce-estimator .ce-step-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--ce-soft); color: var(--ce-muted); } #ce-estimator .ce-step.is-current .ce-step-num, #ce-estimator .ce-step.is-done .ce-step-num { background: var(--ce-accent); color: var(--ce-accent-ink); } /* Layout */ #ce-estimator .ce-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; } #ce-estimator .ce-panel, #ce-estimator .ce-summary { background: var(--ce-paper); border: 1px solid var(--ce-line); border-radius: var(--ce-radius); } #ce-estimator .ce-panel { padding: clamp(18px, 3cqi, 30px); min-width: 0; } #ce-estimator .ce-summary { padding: 22px; position: sticky; top: 16px; } #ce-estimator .ce-total { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; } #ce-estimator .ce-monthly { color: var(--ce-muted); margin: 4px 0 16px; } #ce-estimator .ce-facts { border-top: 1px solid var(--ce-line); } #ce-estimator .ce-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--ce-line); } #ce-estimator .ce-facts dt { color: var(--ce-muted); } #ce-estimator .ce-facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; } #ce-estimator .ce-note { margin-top: 12px; color: var(--ce-warn); background: var(--ce-warn-soft); padding: 8px 12px; border-radius: var(--ce-radius-sm); font-size: 14px; } #ce-estimator .ce-fine { font-size: 12px; color: var(--ce-muted); margin-top: 14px; } /* Cards */ #ce-estimator .ce-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; } #ce-estimator .ce-grid.ce-compact { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); margin-top: 0; } #ce-estimator .ce-card { position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; padding: 15px; border-radius: var(--ce-radius-sm); border: 1.5px solid var(--ce-line); background: var(--ce-paper); transition: border-color 0.15s, background-color 0.15s; } #ce-estimator .ce-card:hover { border-color: var(--ce-muted); } #ce-estimator .ce-card.is-selected { border-color: var(--ce-accent); background: var(--ce-accent-soft); } #ce-estimator .ce-card span { color: var(--ce-muted); font-size: 14px; } #ce-estimator .ce-card small { color: var(--ce-muted); font-size: 12px; margin-top: 2px; } #ce-estimator .ce-room { padding-right: 44px; } #ce-estimator .ce-card .ce-check { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; border: 1.5px solid var(--ce-line); color: var(--ce-muted); } #ce-estimator .is-selected .ce-check { background: var(--ce-accent); border-color: var(--ce-accent); color: var(--ce-accent-ink); } #ce-estimator .ce-palette { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin-bottom: 8px; } #ce-estimator .ce-palette i { flex: 1; } /* Inputs */ #ce-estimator .ce-input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--ce-line); background: var(--ce-paper); color: var(--ce-ink); height: auto; box-shadow: none; } #ce-estimator .ce-input:focus { border-color: var(--ce-accent); outline: none; } #ce-estimator .ce-lookup { margin-top: 22px; padding: 16px; background: var(--ce-soft); border-radius: var(--ce-radius-sm); } #ce-estimator .ce-lookup label { display: block; font-weight: 600; margin-bottom: 8px; } #ce-estimator .ce-lookup-row { display: flex; gap: 8px; flex-wrap: wrap; } #ce-estimator .ce-lookup-row .ce-input { flex: 1 1 160px; width: auto; } #ce-estimator .ce-lookup-msg { margin-top: 10px; font-size: 14px; } /* Chips */ #ce-estimator .ce-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; } #ce-estimator .ce-chip { border: 1.5px solid var(--ce-line); background: var(--ce-paper); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; } #ce-estimator .ce-chip:hover { border-color: var(--ce-accent); color: var(--ce-accent); } #ce-estimator .ce-chip.ce-subtle { color: var(--ce-muted); } #ce-estimator .ce-chip.ce-chip-sm { padding: 3px 10px; font-size: 13px; } /* Finishes */ #ce-estimator .ce-section-head { display: flex; flex-direction: column; gap: 8px; margin-top: 26px; } #ce-estimator .ce-section-head .ce-h3 { margin: 0; } #ce-estimator .ce-apply { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--ce-muted); } #ce-estimator .ce-select-sm { width: auto; padding: 5px 10px; font-size: 13px; } #ce-estimator .ce-floors { display: grid; gap: 12px; margin-top: 14px; } #ce-estimator .ce-floor { border: 1.5px solid var(--ce-line); border-radius: var(--ce-radius-sm); padding: 14px 16px; } #ce-estimator .ce-floor.is-needs { border-style: dashed; } #ce-estimator .ce-floor-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; } #ce-estimator .ce-line-total { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; } #ce-estimator .is-needs .ce-line-total { color: var(--ce-warn); font-weight: 600; font-size: 14px; } #ce-estimator .ce-materials { display: flex; flex-wrap: wrap; gap: 8px; } #ce-estimator .ce-material { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 7px; border-radius: 999px; border: 1.5px solid var(--ce-line); background: var(--ce-paper); font-size: 14px; } #ce-estimator .ce-material i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); } #ce-estimator .ce-material.is-selected { border-color: var(--ce-accent); background: var(--ce-accent-soft); font-weight: 600; } #ce-estimator .ce-existing { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--ce-muted); } #ce-estimator .ce-existing .ce-input { width: auto; flex: 0 1 240px; padding: 7px 10px; } #ce-estimator .ce-list { list-style: none; border-top: 1px solid var(--ce-line); } #ce-estimator .ce-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ce-line); margin: 0; } #ce-estimator .ce-list small { display: block; font-size: 13px; } /* Review */ #ce-estimator .ce-table-wrap { overflow-x: auto; margin-top: 16px; } #ce-estimator .ce-table { width: 100%; min-width: 440px; border-collapse: collapse; font-variant-numeric: tabular-nums; background: none; border: 0; margin: 0; } #ce-estimator .ce-table th { text-align: right; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ce-muted); padding: 8px 0 8px 12px; border: 0; border-bottom: 1px solid var(--ce-line); background: none; font-weight: 700; } #ce-estimator .ce-table td { text-align: right; padding: 11px 0 11px 12px; border: 0; border-bottom: 1px solid var(--ce-line); vertical-align: top; background: none; } #ce-estimator .ce-table th:first-child, #ce-estimator .ce-table td:first-child { text-align: left; padding-left: 0; } #ce-estimator .ce-table td small { display: block; color: var(--ce-muted); font-size: 13px; } #ce-estimator .ce-table tfoot td { font-weight: 800; border-bottom: 0; font-size: 1.05rem; } #ce-estimator .ce-finance { margin-top: 16px; padding: 14px 18px; border-radius: var(--ce-radius-sm); background: var(--ce-accent-soft); } #ce-estimator .ce-finance strong { display: block; font-size: 1.35rem; } #ce-estimator .ce-finance span { color: var(--ce-muted); font-size: 14px; } #ce-estimator .ce-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; } #ce-estimator .ce-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; } #ce-estimator .ce-field .ce-input { font-weight: 400; } #ce-estimator .ce-field.ce-full { margin-top: 14px; } #ce-estimator .ce-field.has-error .ce-input { border-color: var(--ce-danger); } #ce-estimator .ce-error { color: var(--ce-danger); font-style: normal; font-weight: 500; font-size: 13px; margin-top: 8px; } #ce-estimator .ce-field .ce-error { margin-top: 0; } #ce-estimator .ce-success { text-align: center; padding: 20px 0; } #ce-estimator .ce-success-mark { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: var(--ce-accent); color: var(--ce-accent-ink); } #ce-estimator .ce-success p { max-width: 52ch; margin: 0 auto 18px; } #ce-estimator .ce-payload { text-align: left; margin-bottom: 18px; background: var(--ce-soft); border-radius: var(--ce-radius-sm); padding: 12px 16px; } #ce-estimator .ce-payload summary { cursor: pointer; font-weight: 600; font-size: 14px; } #ce-estimator .ce-payload pre { font-size: 12px; overflow: auto; max-height: 300px; margin: 12px 0 0; white-space: pre; background: none; border: 0; padding: 0; } /* Buttons */ #ce-estimator .ce-nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--ce-line); } #ce-estimator .ce-nav-right { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 14px; margin-left: auto; } #ce-estimator .ce-hint { color: var(--ce-muted); font-size: 14px; } #ce-estimator .ce-btn { border-radius: 999px; padding: 11px 22px; font-weight: 700; border: 1.5px solid transparent; } #ce-estimator .ce-btn.ce-primary { background: var(--ce-accent); color: var(--ce-accent-ink); } #ce-estimator .ce-btn.ce-primary:disabled { opacity: 0.4; } #ce-estimator .ce-btn.ce-ghost { background: transparent; border-color: var(--ce-line); color: var(--ce-ink); } #ce-estimator .ce-btn.ce-ghost:hover { border-color: var(--ce-ink); } /* Narrow containers (sidebar, phone): stack the summary above the steps */ @container (max-width: 820px) { #ce-estimator .ce-layout { grid-template-columns: minmax(0, 1fr); } #ce-estimator .ce-summary { position: static; order: -1; } } @container (max-width: 520px) { #ce-estimator .ce-demo-note { position: static; display: inline-block; margin-bottom: 12px; } #ce-estimator .ce-total { font-size: 2rem; } } Skip Navigation
 

Schedule a Measure

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vitae elementum justo. Curabitur varius dolor a placerat facilisis. Sed ipsum quam, pharetra ut sapien in, scelerisque hendrerit felis. Aliquam vitae arcu eget leo tincidunt pulvinar. Cras ut dapibus neque. Fusce efficitur porta odio, eget vulputate enim facilisis non. In sollicitudin commodo ex id sagittis.

Name
Contact

Thank You For Contacting Us.

Thank you for contacting Carpet One Floor & Home. Your local flooring expert will reach out to you regarding your inquiry.

 

 

Sub Title

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vitae elementum justo. Curabitur varius dolor a placerat facilisis. Sed ipsum quam, pharetra ut sapien in, scelerisque hendrerit felis. Aliquam vitae arcu eget leo tincidunt pulvinar. Cras ut dapibus neque. Fusce efficitur porta odio, eget vulputate enim facilisis non. In sollicitudin commodo ex id sagittis.

/* Condo Renovation Estimator: embeddable widget. Plain JavaScript, no libraries. Needs
on the page. */ (function () { 'use strict'; var root = document.getElementById('ce-estimator'); if (!root) return; // ---- Settings -------------------------------------------------------- const CONFIG = { // Empty = demo mode: nothing is sent and the lead data is shown on screen. // Set to an HTTPS URL that accepts a JSON POST to receive leads. submitUrl: '', title: 'Price your condo refresh in about two minutes.', }; // ---- SAMPLE DATA: every building and price below is made up --------- const MATERIALS = { tile: { label: 'Porcelain tile', pricePerSqft: 14.5, swatch: '#cfc8bd', note: 'Waterproof, most durable' }, lvp: { label: 'Luxury vinyl plank', pricePerSqft: 8.25, swatch: '#b08c66', note: 'Waterproof, quiet underfoot' }, laminate: { label: 'Laminate', pricePerSqft: 7.5, swatch: '#9c7b5b', note: 'Budget friendly, scratch resistant' }, wood: { label: 'Engineered wood', pricePerSqft: 12.75, swatch: '#7a5636', note: 'Real wood top layer' }, carpet: { label: 'Carpet', pricePerSqft: 5.25, swatch: '#a9a59c', note: 'Soft and warm' }, }; // Removal cost per sq ft, by what is on the floor today. const DEMO_RATES = { tile_wood: { label: 'Tile or wood', perSqft: 3.5 }, lvp_laminate: { label: 'LVP or laminate', perSqft: 1.25 }, carpet: { label: 'Carpet', perSqft: 0.5 }, mixed: { label: 'Mixed tile + LVP', perSqft: 3.75 }, unsure: { label: 'Not sure, we’ll check', perSqft: 3.5 }, }; const PACKAGES = [ { id: 'essential', name: 'Essential', tagline: 'Clean, durable builder-grade finishes', multiplier: 1, colors: ['#e9e6df', '#c9c2b6', '#8a8378'] }, { id: 'coastal', name: 'Coastal', tagline: 'Light oak tones and soft whites', multiplier: 1.12, colors: ['#f4efe6', '#d8c3a0', '#7fa2a8'] }, { id: 'modern', name: 'Modern', tagline: 'Matte black fixtures, large-format tile', multiplier: 1.2, colors: ['#f2f2f0', '#9a9a96', '#1d1d1c'] }, { id: 'luxe', name: 'Luxe', tagline: 'Natural stone looks and premium hardware', multiplier: 1.35, colors: ['#f1ebe3', '#b9a58a', '#4b3b2c'] }, ]; // 0% financing: 12 months, or 24 months at or above the threshold. const FINANCING = { shortTermMonths: 12, longTermMonths: 24, longTermThreshold: 15000 }; const ALL = ['tile', 'lvp', 'laminate', 'wood', 'carpet']; const HARD = ['tile', 'lvp', 'laminate', 'wood']; const WET = ['tile', 'lvp']; const floor = (id, label, group, sqft, materials) => ({ id, label, group, category: 'floor', sqft, materials }); function twoBed(prefix, scale = 1) { const s = (n) => Math.round(n * scale); return [ { id: prefix + '_mshower', label: 'Primary shower', group: 'Wet areas', category: 'shower', fixedPrice: s(9800) }, { id: prefix + '_gtub', label: 'Guest tub surround', group: 'Wet areas', category: 'tub', fixedPrice: s(6400) }, floor(prefix + '_mbath', 'Primary bath floor', 'Bathroom floors', s(90), WET), floor(prefix + '_gbath', 'Guest bath floor', 'Bathroom floors', s(45), WET), { id: prefix + '_splash', label: 'Kitchen backsplash', group: 'Kitchen & entry', category: 'backsplash', fixedPrice: s(2900) }, floor(prefix + '_kitchen', 'Kitchen floor', 'Kitchen & entry', s(160), HARD), floor(prefix + '_foyer', 'Entry / foyer', 'Kitchen & entry', s(70), HARD), floor(prefix + '_living', 'Living / dining', 'Living & bedrooms', s(420), ALL), floor(prefix + '_mbr', 'Primary bedroom', 'Living & bedrooms', s(230), ALL), floor(prefix + '_br2', 'Second bedroom', 'Living & bedrooms', s(150), ALL), ]; } function penthouse(prefix) { return twoBed(prefix, 1.35).concat([ { id: prefix + '_g2shower', label: 'Third bath shower', group: 'Wet areas', category: 'shower', fixedPrice: 9400 }, floor(prefix + '_g3bath', 'Third bath floor', 'Bathroom floors', 50, WET), floor(prefix + '_br3', 'Third bedroom', 'Living & bedrooms', 165, ALL), floor(prefix + '_den', 'Den / office', 'Living & bedrooms', 120, ALL), ]); } function oneBed(prefix) { return twoBed(prefix, 0.85).filter((r) => !/_(br2|gtub|gbath)$/.test(r.id)); } const BUILDINGS = [ { id: 'harbor', name: 'Harbor View Towers', city: 'Sample City', unitTypes: [ { id: 'harbor_a', name: 'Residence A', description: '2 bed, 2 bath · ~1,200 sq ft', unitNumbers: ['201', '301', '401', '501', '601'], rooms: twoBed('ha') }, { id: 'harbor_b', name: 'Residence B', description: '1 bed, 1 bath · ~800 sq ft', unitNumbers: ['202', '302', '402', '502', '602'], rooms: oneBed('hb') }, { id: 'harbor_ph', name: 'Penthouse', description: '3 bed, 3 bath · ~2,100 sq ft', unitNumbers: ['PH1', 'PH2'], rooms: penthouse('hp') }, ] }, { id: 'maple', name: 'Maple Court', city: 'Sample City', unitTypes: [ { id: 'maple_c', name: 'Corner unit', description: '2 bed, 2 bath · ~1,300 sq ft', unitNumbers: ['101', '104', '201', '204', '301', '304'], rooms: twoBed('mc', 1.08) }, { id: 'maple_s', name: 'Studio plus', description: '1 bed, 1 bath · ~700 sq ft', unitNumbers: ['102', '103', '202', '203', '302', '303'], rooms: oneBed('ms') }, ] }, { id: 'lakeside', name: 'Lakeside Residences', city: 'Sample City', unitTypes: [ { id: 'lake_l', name: 'Lakefront', description: '3 bed, 3 bath · ~1,900 sq ft', unitNumbers: ['1A', '2A', '3A', '4A'], rooms: penthouse('ll') }, { id: 'lake_g', name: 'Garden', description: '2 bed, 2 bath · ~1,100 sq ft', unitNumbers: ['1B', '2B', '3B', '4B'], rooms: twoBed('lg', 0.95) }, ] }, { id: 'other', name: 'My building isn’t listed', city: 'General estimate', unitTypes: [ { id: 'other_2bed', name: 'Typical 2 bed condo', description: 'General pricing · final quote after site visit', unitNumbers: [], rooms: twoBed('ot') }, ] }, ]; const GROUPS = ['Wet areas', 'Bathroom floors', 'Kitchen & entry', 'Living & bedrooms']; const PRESETS = { whole: () => true, floors: (r) => r.category === 'floor', baths: (r) => r.group === 'Wet areas' || r.group === 'Bathroom floors', }; const STEPS = ['Property', 'Areas', 'Finishes', 'Review & send']; // ---- State ------------------------------------------------------------ const blankState = () => ({ step: 0, buildingId: null, unitTypeId: null, selections: {}, packageId: 'essential', customer: { name: '', email: '', phone: '', unitNumber: '', notes: '' }, lookup: '', lookupMsg: '', errors: {}, sending: false, sent: null, sendError: '', }); let state = blankState(); // ---- Helpers ---------------------------------------------------------- const ESC = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ESC[c]); const money = (n) => n.toLocaleString('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }); const building = () => BUILDINGS.find((b) => b.id === state.buildingId); const unitType = () => { const b = building(); return b && b.unitTypes.find((u) => u.id === state.unitTypeId); }; const pkg = () => PACKAGES.find((p) => p.id === state.packageId) || PACKAGES[0]; const isEmail = (e) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()); const plural = (n, w) => n + ' ' + w + (n === 1 ? '' : 's'); // ---- Pricing ---------------------------------------------------------- function priceLine(room, sel, mult) { if (room.category !== 'floor') { const base = Math.round(room.fixedPrice * mult); return { room, description: 'Full demo + remodel', base, demo: 0, total: base, incomplete: false }; } const mat = sel.material && MATERIALS[sel.material]; const base = mat ? Math.round(room.sqft * mat.pricePerSqft * mult) : 0; const demo = sel.existingFloor ? Math.round(room.sqft * DEMO_RATES[sel.existingFloor].perSqft) : 0; return { room, base, demo, total: base + demo, description: mat ? mat.label + ' · ' + room.sqft + ' sq ft' : room.sqft + ' sq ft · choose a material', incomplete: !mat || !sel.existingFloor, }; } function computeEstimate() { const u = unitType(); const mult = pkg().multiplier; const lines = (u ? u.rooms : []).filter((r) => state.selections[r.id]).map((r) => priceLine(r, state.selections[r.id], mult)); const base = lines.reduce((a, l) => a + l.base, 0); const demo = lines.reduce((a, l) => a + l.demo, 0); const total = base + demo; const months = total >= FINANCING.longTermThreshold ? FINANCING.longTermMonths : FINANCING.shortTermMonths; return { lines, base, demo, total, months, monthly: total ? Math.round(total / months) : 0, incompleteCount: lines.filter((l) => l.incomplete).length, }; } // ---- Rendering -------------------------------------------------------- function card(action, value, selected, inner, extra) { return ''; } function floorOptions(selected) { return Object.keys(DEMO_RATES).map((id) => '').join(''); } function header() { return '
' + '

Instant renovation estimate

' + '

' + esc(CONFIG.title) + '

' + '
Demo · sample pricing
' + '
'; } function stepProperty() { const b = building(); let html = '

Where is the renovation?

' + '

Choose your building. Each layout has its own room sizes, so pricing is specific to your unit.

' + '
' + BUILDINGS.map((x) => card('building', x.id, x.id === state.buildingId, '' + esc(x.name) + '' + esc(x.city) + ' · ' + plural(x.unitTypes.length, 'layout') + '')).join('') + '
'; if (!b) return html; if (b.unitTypes.length > 1) { html += '
' + '' + '
' + (state.lookupMsg ? '

' + esc(state.lookupMsg) + '

' : '') + '
'; } html += '

Layout

' + b.unitTypes.map((u) => card('unit', u.id, u.id === state.unitTypeId, '' + esc(u.name) + '' + esc(u.description) + '' + (u.unitNumbers.length ? 'Units ' + esc(u.unitNumbers.join(', ')) + '' : ''))).join('') + '
'; return html; } function stepAreas(u) { let html = '

What would you like redone?

Tap areas to add or remove them, or start from a preset.

' + '
' + [['whole', 'Whole unit'], ['floors', 'All floors'], ['baths', 'Bathrooms']].map((p) => '').join('') + '
'; GROUPS.forEach((g) => { const rooms = u.rooms.filter((r) => r.group === g); if (!rooms.length) return; html += '

' + esc(g) + '

' + rooms.map((r) => { const on = !!state.selections[r.id]; return card('toggle', r.id, on, '' + esc(r.label) + '' + (r.category === 'floor' ? r.sqft + ' sq ft' : 'Full demo + remodel') + '', 'ce-room'); }).join('') + '
'; }); return html; } function stepFinishes(est) { const floors = est.lines.filter((l) => l.room.category === 'floor'); const others = est.lines.filter((l) => l.room.category !== 'floor'); let html = '

Choose your finishes

A design package sets the style and grade for everything you selected.

' + '
' + PACKAGES.map((p) => card('package', p.id, p.id === state.packageId, '' + '' + esc(p.name) + '' + esc(p.tagline) + '' + (p.multiplier === 1 ? 'Base pricing' : '+' + Math.round((p.multiplier - 1) * 100) + '%') + '')).join('') + '
'; if (floors.length) { const allowed = Object.keys(MATERIALS).filter((m) => floors.some((l) => l.room.materials.indexOf(m) !== -1)); html += '

Flooring

' + '
Same floor everywhere:' + allowed.map((m) => '').join('') + '
' + '
' + floors.map((l) => { const sel = state.selections[l.room.id] || {}; return '
' + esc(l.room.label) + ' · ' + l.room.sqft + ' sq ft
' + (l.incomplete ? 'Needs choices' : money(l.total)) + '
' + '
' + l.room.materials.map((m) => { const on = sel.material === m; return ''; }).join('') + '
' + '
'; }).join('') + '
'; } if (others.length) { html += '

Showers, tubs & backsplash

'; } return html; } function field(key, label, type, autocomplete) { const err = state.errors[key]; return ''; } function stepReview(est) { const b = building(); const u = unitType(); if (state.sent) { return '

Estimate ' + (CONFIG.submitUrl ? 'sent' : 'saved') + '

Reference ' + esc(state.sent.submissionId) + '. ' + (CONFIG.submitUrl ? 'Thanks! We’ll be in touch to confirm measurements and timing.' : 'Demo mode: nothing was sent. Set submitUrl in the script to receive leads.') + '

' + (CONFIG.submitUrl ? '' : '
View the lead data that would be sent
' +
          esc(JSON.stringify(state.sent, null, 2)) + '
') + '
'; } const c = state.customer; return '

Review your estimate

' + esc(b.name) + ' · ' + esc(u.name) + ' · ' + esc(pkg().name) + ' package

' + '
' + est.lines.map((l) => { const ex = (state.selections[l.room.id] || {}).existingFloor; return ''; }).join('') + '
AreaInstallationDemoTotal
' + esc(l.room.label) + '' + esc(l.description) + (ex ? ' · removing ' + esc(DEMO_RATES[ex].label.toLowerCase()) : '') + '' + money(l.base) + '' + (l.demo ? money(l.demo) : '—') + '' + money(l.total) + '
Estimated total' + money(est.base) + '' + money(est.demo) + '' + money(est.total) + '
' + '
' + money(est.monthly) + '/mofor ' + est.months + ' months at 0% APR (sample offer, subject to approval)
' + '

Where should we send it?

' + field('name', 'Full name', 'text', 'name') + field('phone', 'Phone', 'tel', 'tel') + field('email', 'Email', 'email', 'email') + field('unitNumber', 'Unit number (optional)', 'text', '') + '
' + '' + (state.sendError ? '' : '') + '
' + '
'; } function navRow(est) { const can = [!!unitType(), est.lines.length > 0, est.lines.length > 0 && est.incompleteCount === 0][state.step]; const why = [ 'Pick your building and unit type to continue.', 'Select at least one area to renovate.', 'Choose a material and current floor for ' + plural(est.incompleteCount, 'more area') + '.', ][state.step]; return '
' + (state.step > 0 ? '' : '') + '
' + (can ? '' : '' + esc(why) + '') + '
'; } function summary(est) { const b = building(); const u = unitType(); const fact = (k, v) => '
' + k + '
' + v + '
'; return '

Your estimate

' + money(est.total) + '
' + (est.total ? money(est.monthly) + '/mo · ' + est.months + ' months at 0%' : 'Select areas to see pricing') + '
' + '
' + fact('Property', b ? esc(b.name) : '—') + fact('Unit', u ? esc(u.name) : '—') + fact('Areas', est.lines.length || '—') + fact('Installation', money(est.base)) + fact('Demo & removal', money(est.demo)) + '
' + (est.incompleteCount ? '

' + plural(est.incompleteCount, 'area') + ' still need finish choices.

' : '') + '

Estimates are for planning only. Final pricing is confirmed after an in-home measure.

'; } // Identifies a control across re-renders so keyboard focus can be restored. const focusKey = (el) => [el.tagName, el.dataset.action, el.dataset.value, el.dataset.change, el.dataset.room, el.dataset.field].join('|'); function render() { const active = document.activeElement; const key = active && root.contains(active) ? focusKey(active) : null; const est = computeEstimate(); const u = unitType(); let panel = ''; if (state.step === 0) panel = stepProperty(); else if (state.step === 1 && u) panel = stepAreas(u); else if (state.step === 2 && u) panel = stepFinishes(est); else if (state.step === 3 && u) panel = stepReview(est); if (state.step < 3) panel += navRow(est); root.innerHTML = '
' + header() + '
' + panel + '
'; if (key) { const match = Array.prototype.find.call(root.querySelectorAll('button, input, select, textarea'), (el) => focusKey(el) === key); if (match && !match.disabled) match.focus({ preventScroll: true }); } } // ---- Actions ---------------------------------------------------------- function goTo(step) { state.step = Math.max(0, Math.min(3, step)); render(); if (root.getBoundingClientRect().top < 0) root.scrollIntoView({ behavior: 'smooth', block: 'start' }); } function selectedFloorRooms() { const u = unitType(); return u ? u.rooms.filter((r) => r.category === 'floor' && state.selections[r.id]) : []; } function lookupUnit() { const b = building(); if (!b) return; const raw = state.lookup.trim(); state.customer.unitNumber = raw; if (!raw) { state.lookupMsg = ''; return; } const match = b.unitTypes.find((u) => u.unitNumbers.some((n) => n.toUpperCase() === raw.toUpperCase())); if (match) { if (state.unitTypeId !== match.id) { state.unitTypeId = match.id; state.selections = {}; } state.lookupMsg = 'Unit ' + raw + ' is a ' + match.name + '.'; } else { state.lookupMsg = 'We couldn’t match that unit number. Pick your layout below.'; } } function act(action, value) { switch (action) { case 'building': { const b = BUILDINGS.find((x) => x.id === value); state.buildingId = value; state.unitTypeId = b.unitTypes.length === 1 ? b.unitTypes[0].id : null; state.selections = {}; state.lookupMsg = ''; break; } case 'unit': state.unitTypeId = value; state.selections = {}; break; case 'lookup': lookupUnit(); break; case 'toggle': if (state.selections[value]) delete state.selections[value]; else state.selections[value] = {}; break; case 'preset': { if (value === 'clear') { state.selections = {}; break; } const next = {}; unitType().rooms.forEach((r) => { if (PRESETS[value](r)) next[r.id] = state.selections[r.id] || {}; }); state.selections = next; break; } case 'package': state.packageId = value; break; case 'material': { const parts = value.split('|'); state.selections[parts[0]] = Object.assign({}, state.selections[parts[0]], { material: parts[1] }); break; } case 'all-material': selectedFloorRooms().forEach((r) => { if (r.materials.indexOf(value) !== -1) state.selections[r.id] = Object.assign({}, state.selections[r.id], { material: value }); }); break; case 'goto': return goTo(Number(value)); case 'next': return goTo(state.step + 1); case 'back': return goTo(state.step - 1); case 'restart': state = blankState(); return goTo(0); } render(); } function buildPayload(est) { const params = new URLSearchParams(window.location.search); return { submissionId: 'EST-' + Date.now(), submittedAt: new Date().toISOString(), customer: Object.assign({}, state.customer), property: { building: building().name, unitType: unitType().name, unitDescription: unitType().description }, package: pkg().name, lines: est.lines.map((l) => { const sel = state.selections[l.room.id] || {}; return { area: l.room.label, detail: sel.material ? MATERIALS[sel.material].label : l.description, currentFloor: sel.existingFloor ? DEMO_RATES[sel.existingFloor].label : null, installation: l.base, demo: l.demo, total: l.total, }; }), totals: { installation: est.base, demo: est.demo, total: est.total, monthly: est.monthly, months: est.months }, source: { pageUrl: window.location.href, utmSource: params.get('utm_source') || '', utmMedium: params.get('utm_medium') || '', utmCampaign: params.get('utm_campaign') || '', }, }; } async function submit() { if (state.sending) return; const c = state.customer; const errors = {}; if (!c.name.trim()) errors.name = 'Please add your name.'; if (c.phone.replace(/\D/g, '').length < 10) errors.phone = 'Please enter a 10-digit phone number.'; if (!isEmail(c.email)) errors.email = 'Please enter a valid email.'; state.errors = errors; state.sendError = ''; if (Object.keys(errors).length) { render(); const bad = root.querySelector('[aria-invalid="true"]'); if (bad) bad.focus(); return; } state.sending = true; render(); const payload = buildPayload(computeEstimate()); try { if (CONFIG.submitUrl) { const res = await fetch(CONFIG.submitUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), }); if (!res.ok) throw new Error('HTTP ' + res.status); } else { console.info('[estimator demo] Lead payload (not sent):', payload); await new Promise((r) => setTimeout(r, 500)); } state.sent = payload; } catch (err) { console.error(err); state.sendError = 'Something went wrong sending your estimate. Please try again.'; } state.sending = false; render(); } // ---- Events (delegated, so they survive re-renders) -------------------- root.addEventListener('click', (e) => { const el = e.target.closest('[data-action]'); if (el && root.contains(el) && !el.disabled) act(el.dataset.action, el.dataset.value); }); root.addEventListener('change', (e) => { const el = e.target; const kind = el.dataset && el.dataset.change; if (!kind || !el.value) return; if (kind === 'existing') { state.selections[el.dataset.room] = Object.assign({}, state.selections[el.dataset.room], { existingFloor: el.value }); } else if (kind === 'all-existing') { selectedFloorRooms().forEach((r) => { state.selections[r.id] = Object.assign({}, state.selections[r.id], { existingFloor: el.value }); }); } render(); }); // Typing only updates state; no re-render, so the cursor stays put. root.addEventListener('input', (e) => { const el = e.target; const f = el.dataset && el.dataset.field; if (!f) return; if (f === 'lookup') { state.lookup = el.value; return; } const k = f.replace('customer.', ''); state.customer[k] = el.value; if (state.errors[k]) { delete state.errors[k]; const wrap = el.closest('.ce-field'); wrap.classList.remove('has-error'); const msg = wrap.querySelector('.ce-error'); if (msg) msg.remove(); el.removeAttribute('aria-invalid'); } }); root.addEventListener('keydown', (e) => { if (e.key === 'Enter' && e.target.dataset && e.target.dataset.field === 'lookup') { e.preventDefault(); act('lookup'); } }); root.addEventListener('submit', (e) => { e.preventDefault(); submit(); }); render(); })();