<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Kids Haven | Childcare at Your Doorstep</title>
<style>
:root {
--green: #829780;
--dark-green: #405844;
--pink: #f1d5d9;
--cream: #fffaf3;
--white: #ffffff;
--text: #343b34;
--muted: #747c73;
--shadow: 0 8px 25px rgba(50, 70, 50, 0.09);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
scroll-behavior: smooth;
}
body {
font-family: "Trebuchet MS", Arial, sans-serif;
background: var(--cream);
color: var(--text);
line-height: 1.6;
}
button,
input,
select,
textarea {
font: inherit;
}
button {
cursor: pointer;
}
header {
position: sticky;
top: 0;
z-index: 100;
background: rgba(255, 250, 243, 0.96);
border-bottom: 1px solid #e9e5dc;
padding: 15px 6%;
display: flex;
justify-content: space-between;
align-items: center;
gap: 20px;
flex-wrap: wrap;
}
.logo {
color: var(--dark-green);
font-size: 25px;
font-weight: bold;
}
.logo span {
color: #c88794;
}
nav {
display: flex;
gap: 18px;
flex-wrap: wrap;
}
nav a {
color: var(--text);
text-decoration: none;
font-size: 14px;
font-weight: bold;
}
nav a:hover {
color: #bd7887;
}
.hero {
padding: 85px 7%;
min-height: 480px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 40px;
flex-wrap: wrap;
background: linear-gradient(120deg, #f8e7e8, #fffaf3 60%, #e5eee1);
}
.hero-content {
max-width: 570px;
}
.eyebrow {
text-transform: uppercase;
letter-spacing: 2px;
color: var(--dark-green);
font-size: 12px;
font-weight: bold;
}
h1 {
font-size: clamp(38px, 5vw, 62px);
line-height: 1.15;
margin: 15px 0;
color: var(--dark-green);
}
h2 {
color: var(--dark-green);
font-size: clamp(27px, 4vw, 37px);
margin-bottom: 12px;
}
p {
color: var(--muted);
}
.hero p {
max-width: 520px;
margin-bottom: 25px;
}
.hero-art {
font-size: clamp(100px, 18vw, 190px);
text-align: center;
background: rgba(255, 255, 255, 0.65);
border-radius: 45% 45% 35% 35%;
padding: 25px;
min-width: 250px;
}
.btn {
display: inline-block;
background: var(--dark-green);
color: white;
border: none;
border-radius: 30px;
padding: 13px 23px;
text-decoration: none;
font-weight: bold;
transition: 0.2s;
}
.btn:hover {
transform: translateY(-2px);
opacity: 0.9;
}
.btn-pink {
background: #cf929e;
}
.btn-light {
background: #e6ede3;
color: var(--dark-green);
}
section {
padding: 70px 7%;
scroll-margin-top: 80px;
}
.section-heading {
text-align: center;
margin-bottom: 35px;
}
.section-heading p {
max-width: 620px;
margin: 0 auto;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 22px;
}
.card {
background: white;
padding: 25px;
border-radius: 20px;
box-shadow: var(--shadow);
}
.card h3 {
color: var(--dark-green);
margin: 10px 0;
}
.icon {
font-size: 38px;
}
.service-price {
color: #b87886;
font-weight: bold;
margin-top: 12px;
}
.soft-green {
background: #edf2e9;
}
.soft-pink {
background: #fae9eb;
}
.booking-layout {
display: grid;
grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
gap: 30px;
align-items: start;
}
form {
background: white;
border-radius: 22px;
padding: 28px;
box-shadow: var(--shadow);
}
label {
display: block;
margin: 14px 0 6px;
font-weight: bold;
font-size: 14px;
}
input,
select,
textarea {
width: 100%;
padding: 12px;
border: 1px solid #dcded6;
border-radius: 10px;
background: #fffefa;
outline: none;
}
input:focus,
select:focus,
textarea:focus {
border-color: var(--green);
}
textarea {
min-height: 90px;
resize: vertical;
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
}
form .btn {
margin-top: 20px;
width: 100%;
}
.notice {
background: #fff3df;
padding: 13px;
border-radius: 12px;
font-size: 13px;
margin: 15px 0;
}
.dashboard {
display: none;
margin-top: 25px;
}
.dashboard.visible {
display: block;
}
.status {
display: inline-block;
padding: 5px 12px;
border-radius: 20px;
background: #e2efdf;
color: #365d39;
font-size: 13px;
font-weight: bold;
}
.nanny-profile {
display: flex;
align-items: center;
gap: 15px;
margin: 15px 0;
}
.avatar {
width: 65px;
height: 65px;
border-radius: 50%;
display: grid;
place-items: center;
background: var(--pink);
font-size: 35px;
}
.nanny-profile p {
font-size: 13px;
}
.tracking-box {
background: white;
padding: 25px;
border-radius: 22px;
box-shadow: var(--shadow);
}
.map {
height: 300px;
position: relative;
overflow: hidden;
border-radius: 16px;
margin: 18px 0;
background-color: #e7efdf;
background-image:
linear-gradient(35deg, transparent 46%, #fff 47%, #fff 51%, transparent 52%),
linear-gradient(120deg, transparent 40%, #fff 41%, #fff 45%, transparent 46%),
linear-gradient(90deg, transparent 48%, #d4dfcb 49%, #d4dfcb 53%, transparent 54%);
background-size:
160px 130px,
190px 170px,
110px 110px;
}
.road {
position: absolute;
height: 13px;
width: 115%;
background: #ffffff;
top: 54%;
left: -5%;
transform: rotate(-23deg);
border: 1px solid #d9dfd5;
}
.road-two {
position: absolute;
height: 13px;
width: 85%;
background: #ffffff;
top: 45%;
left: 10%;
transform: rotate(35deg);
border: 1px solid #d9dfd5;
}
.map-label {
position: absolute;
background: white;
padding: 5px 9px;
border-radius: 8px;
font-size: 12px;
font-weight: bold;
box-shadow: 0 2px 8px #00000015;
}
.home-marker {
position: absolute;
right: 13%;
bottom: 18%;
font-size: 30px;
z-index: 3;
}
.nanny-marker {
position: absolute;
left: 12%;
top: 20%;
font-size: 30px;
z-index: 4;
transition:
left 1s linear,
top 1s linear;
}
.route-line {
position: absolute;
left: 18%;
top: 35%;
width: 60%;
height: 35%;
border-bottom: 4px dashed #799476;
border-right: 4px dashed #799476;
border-radius: 0 0 35px 0;
transform: rotate(-10deg);
}
.tracking-details {
display: flex;
justify-content: space-between;
gap: 15px;
flex-wrap: wrap;
}
.eta {
color: var(--dark-green);
font-size: 26px;
font-weight: bold;
}
.small-text {
font-size: 12px;
margin-top: 12px;
}
.review-section {
background: #f8eeee;
}
.review-track {
display: flex;
gap: 20px;
overflow-x: auto;
padding: 15px 2px 25px;
scroll-snap-type: x mandatory;
}
.review-card {
background: white;
border-radius: 18px;
padding: 22px;
min-width: 270px;
max-width: 320px;
flex: 0 0 30%;
scroll-snap-align: start;
box-shadow: var(--shadow);
}
.stars {
color: #d8a84f;
letter-spacing: 3px;
margin-bottom: 10px;
}
.review-card p {
font-size: 14px;
}
.review-author {
color: var(--dark-green);
font-weight: bold;
margin-top: 15px;
}
.review-form {
max-width: 650px;
margin: 30px auto 0;
}
.star-picker {
display: flex;
gap: 8px;
margin: 5px 0;
}
.star-picker button {
border: none;
background: none;
color: #c8c8c8;
font-size: 30px;
}
.star-picker button.selected {
color: #d8a84f;
}
.chat-layout {
display: grid;
grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.2fr);
gap: 25px;
align-items: start;
}
.chat-window {
background: white;
border-radius: 20px;
box-shadow: var(--shadow);
overflow: hidden;
}
.chat-header {
padding: 18px;
background: var(--green);
color: white;
}
.chat-header p {
color: white;
font-size: 13px;
}
.chat-messages {
height: 310px;
overflow-y: auto;
padding: 18px;
display: flex;
flex-direction: column;
gap: 12px;
}
.message {
padding: 11px 14px;
border-radius: 16px;
max-width: 85%;
font-size: 14px;
overflow-wrap: anywhere;
}
.message.nanny {
background: #edf2e9;
align-self: flex-start;
}
.message.customer {
background: #f8e4e7;
align-self: flex-end;
}
.chat-input {
display: flex;
padding: 12px;
gap: 8px;
border-top: 1px solid #eee;
}
.chat-input input {
min-width: 0;
}
.chat-input .btn {
padding: 10px 16px;
}
footer {
text-align: center;
padding: 35px 7%;
background: #405844;
color: white;
}
footer p {
color: #edf2e9;
font-size: 13px;
}
footer .logo {
color: white;
margin-bottom: 8px;
}
footer .logo span {
color: #f1d5d9;
}
.toast {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: #405844;
color: white;
padding: 12px 20px;
border-radius: 12px;
z-index: 200;
display: none;
max-width: 90%;
text-align: center;
}
.toast.show {
display: block;
}
@media (max-width: 760px) {
header {
justify-content: center;
}
nav {
justify-content: center;
gap: 12px;
}
.hero {
padding-top: 55px;
text-align: center;
justify-content: center;
}
.hero-art {
min-width: 0;
}
.booking-layout,
.chat-layout {
grid-template-columns: 1fr;
}
.form-row {
grid-template-columns: 1fr;
gap: 0;
}
.review-card {
flex-basis: 80%;
}
section {
padding: 50px 5%;
}
}
</style>
</head>
<body>
<header>
<div class="logo">🏡 Kids <span>Haven</span></div>
<nav>
<a href="#home">Home</a>
<a href="#services">Services</a>
<a href="#nannies">Our Nannies</a>
<a href="#booking">Book Now</a>
<a href="#tracking">Track</a>
<a href="#reviews">Reviews</a>
<a href="#chat">Chat</a>
</nav>
</header>
<main>
<!-- HOME -->
<section class="hero" id="home">
<div class="hero-content">
<div class="eyebrow">Childcare made easier</div>
<h1>Care that comes<br />to your doorstep.</h1>
<p>
Reliable childcare right at your doorstep. Kids Haven connects busy parents with caring
nannies who come directly to your home.
</p>
<a href="#booking" class="btn">Book a Nanny 💗</a>
<a href="#services" class="btn btn-light">Explore Services</a>
</div>
<div class="hero-art" aria-label="House and family illustration">🏡👩👧</div>
</section>
<!-- SERVICES -->
<section id="services">
<div class="section-heading">
<h2>Childcare for Every Occasion</h2>
<p>Flexible care that fits your family's schedule.</p>
</div>
<div class="grid">
<article class="card">
<div class="icon">⏰</div>
<h3>Hourly Childcare</h3>
<p>Need a few hours to run errands or attend an appointment? We've got you covered.</p>
<div class="service-price">From RM 25/hour</div>
</article>
<article class="card">
<div class="icon">⚡</div>
<h3>Last-Minute Care</h3>
<p>Request childcare when unexpected plans or urgent commitments arise.</p>
<div class="service-price">From RM 30/hour</div>
</article>
<article class="card">
<div class="icon">📅</div>
<h3>Regular Childcare</h3>
<p>Arrange recurring visits to support your family's weekly routine.</p>
<div class="service-price">Custom packages</div>
</article>
<article class="card">
<div class="icon">🌙</div>
<h3>Evening Care</h3>
<p>Request evening or overnight childcare, subject to availability and arrangements.</p>
<div class="service-price">Custom pricing</div>
</article>
</div>
<p class="small-text">
Demonstration prices only. Actual prices and availability would need to be confirmed.
</p>
</section>
<!-- NANNIES -->
<section id="nannies" class="soft-green">
<div class="section-heading">
<h2>Meet Your Nanny</h2>
<p>Explore example profiles to see how families could choose a suitable nanny.</p>
</div>
<div class="grid">
<article class="card">
<div class="icon">👩🏻</div>
<h3>Emily Tan</h3>
<p>Example profile · 5 years of experience</p>
<p>Enjoys creative activities, reading, and helping children learn through play.</p>
<div class="stars">★★★★★</div>
<button class="btn" onclick="chooseNanny('Emily Tan')">Choose Emily</button>
</article>
<article class="card">
<div class="icon">👩🏽</div>
<h3>Sarah Lim</h3>
<p>Example profile · 4 years of experience</p>
<p>Enjoys outdoor games, crafts, and supporting children's daily routines.</p>
<div class="stars">★★★★★</div>
<button class="btn" onclick="chooseNanny('Sarah Lim')">Choose Sarah</button>
</article>
<article class="card">
<div class="icon">👩🏼</div>
<h3>Aisha Rahman</h3>
<p>Example profile · 6 years of experience</p>
<p>Enjoys storytelling, imaginative play, and preparing child-friendly activities.</p>
<div class="stars">★★★★★</div>
<button class="btn" onclick="chooseNanny('Aisha Rahman')">Choose Aisha</button>
</article>
</div>
<p class="small-text">
All names, profiles, experience details, and ratings above are fictional examples. Real
nannies would require identity, qualification, reference, and safety checks.
</p>
</section>
<!-- BOOKING -->
<section id="booking">
<div class="section-heading">
<h2>Book a Nanny</h2>
<p>
Your nanny comes directly to your home. Simply enter your childcare requirements below.
</p>
</div>
<div class="booking-layout">
<form id="bookingForm">
<h3>📅 Your Booking Details</h3>
<label for="parentName">Parent's Name</label>
<input id="parentName" required placeholder="Enter your name" />
<label for="address">Home Address</label>
<textarea
id="address"
required
placeholder="Enter the address where the nanny should arrive"
></textarea>
<div class="form-row">
<div>
<label for="date">Date</label>
<input type="date" id="date" required />
</div>
<div>
<label for="time">Arrival Time</label>
<input type="time" id="time" required />
</div>
</div>
<div class="form-row">
<div>
<label for="children">Number of Children</label>
<select id="children" required>
<option value="">Select</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4 or more</option>
</select>
</div>
<div>
<label for="duration">Duration</label>
<select id="duration" required>
<option value="">Select</option>
<option>1 hour</option>
<option>2 hours</option>
<option>3 hours</option>
<option>4 hours</option>
<option>8 hours</option>
<option>Overnight</option>
</select>
</div>
</div>
<label for="ages">Children's Ages</label>
<input id="ages" required placeholder="e.g. 3 and 6 years old" />
<label for="service">Type of Service</label>
<select id="service" required>
<option value="">Choose a service</option>
<option>Hourly Childcare</option>
<option>Last-Minute Care</option>
<option>Regular Childcare</option>
<option>Evening Care</option>
</select>
<label for="nannyChoice">Preferred Nanny</label>
<select id="nannyChoice">
<option>Any available nanny</option>
<option>Emily Tan</option>
<option>Sarah Lim</option>
<option>Aisha Rahman</option>
</select>
<label for="instructions">Special Instructions</label>
<textarea
id="instructions"
placeholder="Activities, allergies, routines, or other relevant information"
></textarea>
<div class="notice">
🏡 Demonstration only: use a fictional address. No real nanny will be dispatched.
</div>
<button class="btn" type="submit">Confirm My Booking 💗</button>
</form>
<div>
<div class="card soft-pink">
<div class="icon">🛡️</div>
<h3>Your Child's Safety Matters</h3>
<p>
A real Kids Haven service should verify nanny identities, check qualifications and
references, and establish child-safety procedures before offering bookings.
</p>
</div>
<div class="card" style="margin-top: 20px">
<div class="icon">🚗</div>
<h3>Track Your Nanny</h3>
<p>After creating a demonstration booking, explore the tracking feature below.</p>
<a href="#tracking" class="btn btn-light" style="margin-top: 15px">Open Tracking</a>
</div>
<div id="dashboard" class="dashboard card">
<h3>💗 Booking Confirmed!</h3>
<p class="status">DEMO BOOKING</p>
<div id="bookingSummary" style="margin-top: 15px"></div>
<button class="btn" onclick="startTracking()" style="margin-top: 15px">
Track My Nanny
</button>
<button class="btn btn-pink" onclick="openChat()" style="margin-top: 10px">
Chat With My Nanny
</button>
</div>
</div>
</div>
</section>
<!-- TRACKING -->
<section id="tracking" class="soft-green">
<div class="section-heading">
<h2>Track Your Nanny 🚗</h2>
<p>A simulated journey showing how a nanny-tracking feature could work.</p>
</div>
<div class="tracking-box">
<div class="tracking-details">
<div>
<h3 id="trackingTitle">Your nanny's journey</h3>
<p id="trackingStatus">Create a demonstration booking to begin.</p>
</div>
<div>
<div class="eta" id="eta">-- min</div>
<p>Estimated arrival</p>
</div>
</div>
<div class="map" id="map">
<div class="road"></div>
<div class="road-two"></div>
<div class="route-line"></div>
<div class="map-label" style="top: 8%; left: 8%">📍 Nanny's starting point</div>
<div class="nanny-marker" id="nannyMarker">🚗</div>
<div class="home-marker" id="homeMarker">🏠</div>
<div class="map-label" style="bottom: 7%; right: 5%">Your home</div>
</div>
<div class="tracking-details">
<p>🚗 Simulated nanny location</p>
<p id="trackingPercent">Journey not started</p>
</div>
<div class="notice">
This map uses a fictional route and simulated movement. It does not use real GPS, live
traffic, or a real nanny's location.
</div>
<button class="btn" onclick="startTracking()">Start Demo Journey</button>
<button class="btn btn-light" onclick="resetTracking()">Reset Journey</button>
</div>
</section>
<!-- REVIEWS -->
<section id="reviews" class="review-section">
<div class="section-heading">
<h2>What Families Say 💗</h2>
<p>Scroll through the example reviews, or submit your own demonstration review.</p>
</div>
<div class="review-track" id="reviewTrack">
<article class="review-card">
<div class="stars">★★★★★</div>
<p>
"The booking process was simple, and I love the idea of childcare coming directly to
my home."
</p>
<div class="review-author">Sarah M. · Example review</div>
</article>
<article class="review-card">
<div class="stars">★★★★★</div>
<p>
"A convenient concept for busy families. The booking and tracking features are
especially useful."
</p>
<div class="review-author">Amanda L. · Example review</div>
</article>
<article class="review-card">
<div class="stars">★★★★☆</div>
<p>
"I would love having a simple way to arrange childcare when my plans suddenly change."
</p>
<div class="review-author">Priya K. · Example review</div>
</article>
</div>
<div class="review-form">
<form id="reviewForm">
<h3>✍️ Write a Review</h3>
<label for="reviewName">Your Display Name</label>
<input id="reviewName" maxlength="40" required placeholder="Enter a display name" />
<label>Your Rating</label>
<div class="star-picker" id="starPicker" aria-label="Choose a star rating">
<button type="button" data-rating="1" aria-label="1 star">★</button>
<button type="button" data-rating="2" aria-label="2 stars">★</button>
<button type="button" data-rating="3" aria-label="3 stars">★</button>
<button type="button" data-rating="4" aria-label="4 stars">★</button>
<button type="button" data-rating="5" aria-label="5 stars">★</button>
</div>
<label for="reviewText">Your Review</label>
<textarea
id="reviewText"
maxlength="500"
required
placeholder="Tell us what you think about Kids Haven..."
></textarea>
<button class="btn btn-pink" type="submit">Submit Review 💗</button>
<p class="small-text">
Reviews submitted here are demonstration content saved in this browser.
</p>
</form>
</div>
</section>
<!-- CHAT -->
<section id="chat">
<div class="section-heading">
<h2>Chat With Your Nanny 💬</h2>
<p>
Try the simulated nanny chat to see how customers could communicate during a booking.
</p>
</div>
<div class="chat-layout">
<div class="card soft-pink">
<div class="nanny-profile">
<div class="avatar">👩🏻</div>
<div>
<h3 id="chatNannyName">Your Kids Haven Nanny</h3>
<p>AI demonstration assistant</p>
<span class="status">Demo chat</span>
</div>
</div>
<h3>What can you ask?</h3>
<p style="margin-top: 10px">
• Ask whether the nanny has arrived.<br />
• Ask for an estimated arrival time.<br />
• Ask about your booking instructions.<br />
• Send a thank-you message.
</p>
<p class="small-text">
This is not a real nanny or a live AI service. Responses are generated by the
website's local demonstration logic.
</p>
</div>
<div class="chat-window">
<div class="chat-header">
<strong id="chatHeaderName">Kids Haven Chat</strong>
<p>Simulated conversation · Not a real person</p>
</div>
<div class="chat-messages" id="chatMessages" aria-live="polite">
<div class="message nanny">
Hi! 💗 Welcome to Kids Haven. Try asking me, "Have you arrived?"
</div>
</div>
<form class="chat-input" id="chatForm">
<input id="chatInput" placeholder="Type your message..." maxlength="500" required />
<button class="btn" type="submit">Send</button>
</form>
</div>
</div>
</section>
<!-- ABOUT -->
<section id="about" class="soft-green">
<div class="section-heading">
<h2>About Kids Haven</h2>
<p>
Our business concept is built around making childcare more convenient for busy families.
</p>
</div>
<div class="grid">
<article class="card">
<div class="icon">💗</div>
<h3>Our Mission</h3>
<p>
To make reliable, convenient, home-based childcare easier for families to arrange.
</p>
</article>
<article class="card">
<div class="icon">🌱</div>
<h3>Our Vision</h3>
<p>
To become a trusted childcare platform that supports families and children's
wellbeing.
</p>
</article>
<article class="card">
<div class="icon">🏡</div>
<h3>Our Promise</h3>
<p>
To build a service concept that prioritises convenience, communication, and child
safety.
</p>
</article>
</div>
</section>
<!-- CONTACT -->
<section id="contact">
<div class="section-heading">
<h2>Contact Us 📞</h2>
<p>Have questions about our childcare concept? Try the demonstration enquiry form.</p>
</div>
<form id="contactForm" style="max-width: 600px; margin: auto">
<label for="contactName">Your Name</label>
<input id="contactName" required placeholder="Enter your name" />
<label for="contactEmail">Email Address</label>
<input id="contactEmail" type="email" required placeholder="you@example.com" />
<label for="contactMessage">Your Message</label>
<textarea id="contactMessage" required placeholder="How can we help?"></textarea>
<button class="btn" type="submit">Send Enquiry</button>
<p class="small-text">This form demonstrates the interface. It does not send emails.</p>
</form>
</section>
</main>
<footer>
<div class="logo">🏡 Kids <span>Haven</span></div>
<p>Reliable childcare right at your doorstep.</p>
<p style="margin-top: 10px">Commerce Exhibition Demonstration Website</p>
<p>© <span id="year"></span> Kids Haven · Concept demonstration</p>
</footer>
<div class="toast" id="toast" role="status" aria-live="polite"></div>
<script>
/* --------------------------------------------------
KIDS HAVEN DEMONSTRATION WEBSITE
Booking, tracking, reviews and chat
-------------------------------------------------- */
const $ = (id) => document.getElementById(id);
let selectedRating = 5;
let chosenNanny = "Any available nanny";
let booking = null;
let journeyTimer = null;
let journeyProgress = 0;
$("year").textContent = new Date().getFullYear();
/* TOAST MESSAGE */
let toastTimer;
function showToast(message) {
$("toast").textContent = message;
$("toast").classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(() => {
$("toast").classList.remove("show");
}, 3000);
}
/* DATE INPUT: PREVENT PAST DATES */
const today = new Date();
const localToday = new Date(today.getTime() - today.getTimezoneOffset() * 60000)
.toISOString()
.split("T")[0];
$("date").min = localToday;
/* NANNY SELECTION */
function chooseNanny(name) {
chosenNanny = name;
$("nannyChoice").value = name;
$("booking").scrollIntoView({ behavior: "smooth" });
showToast(name + " selected! Complete the booking form.");
}
/* BOOKING FORM */
$("bookingForm").addEventListener("submit", function (event) {
event.preventDefault();
const parentName = $("parentName").value.trim();
const address = $("address").value.trim();
const date = $("date").value;
const time = $("time").value;
const children = $("children").value;
const duration = $("duration").value;
const ages = $("ages").value.trim();
const service = $("service").value;
const nanny = $("nannyChoice").value;
const instructions = $("instructions").value.trim();
if (
!parentName ||
!address ||
!date ||
!time ||
!children ||
!duration ||
!ages ||
!service
) {
showToast("Please complete all required fields.");
return;
}
if (date < localToday) {
showToast("Please choose today or a future date.");
return;
}
booking = {
parentName,
address,
date,
time,
children,
duration,
ages,
service,
nanny,
instructions,
};
chosenNanny = nanny === "Any available nanny" ? "Emily Tan" : nanny;
$("dashboard").classList.add("visible");
$("bookingSummary").innerHTML = `
<p><strong>Parent:</strong> ${escapeHTML(parentName)}</p>
<p><strong>Arrival:</strong> ${escapeHTML(date)} at ${escapeHTML(time)}</p>
<p><strong>Service:</strong> ${escapeHTML(service)}</p>
<p><strong>Duration:</strong> ${escapeHTML(duration)}</p>
<p><strong>Nanny:</strong> ${escapeHTML(chosenNanny)}</p>
<p><strong>Destination:</strong> Your home address (entered in this demo)</p>
`;
$("chatNannyName").textContent = chosenNanny;
$("chatHeaderName").textContent = chosenNanny + " · Kids Haven";
resetTracking();
$("dashboard").scrollIntoView({ behavior: "smooth", block: "center" });
showToast("Demonstration booking created successfully! 💗");
});
/* BASIC HTML ESCAPING FOR USER INPUT */
function escapeHTML(value) {
return String(value).replace(
/[&<>"']/g,
(character) =>
({
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
})[character],
);
}
/* NANNY TRACKING SIMULATION */
function startTracking() {
if (!booking) {
showToast("Please create a demonstration booking first.");
$("booking").scrollIntoView({ behavior: "smooth" });
return;
}
clearInterval(journeyTimer);
journeyProgress = 0;
updateTracking();
$("tracking").scrollIntoView({ behavior: "smooth" });
journeyTimer = setInterval(() => {
journeyProgress += 5;
if (journeyProgress >= 100) {
journeyProgress = 100;
clearInterval(journeyTimer);
journeyTimer = null;
}
updateTracking();
}, 1000);
showToast("Your simulated nanny journey has started! 🚗");
}
function updateTracking() {
const marker = $("nannyMarker");
const left = 12 + journeyProgress * 0.63;
const top = 20 + journeyProgress * 0.42;
marker.style.left = Math.min(left, 76) + "%";
marker.style.top = Math.min(top, 67) + "%";
const minutes = Math.ceil((100 - journeyProgress) * 0.12);
$("eta").textContent = journeyProgress >= 100 ? "Arrived!" : minutes + " min";
$("trackingPercent").textContent = journeyProgress + "% of simulated journey";
if (journeyProgress === 0) {
$("trackingStatus").textContent = "Ready to begin the demo journey.";
} else if (journeyProgress < 100) {
$("trackingStatus").textContent = chosenNanny + " is travelling towards your home.";
} else {
$("trackingStatus").textContent =
chosenNanny + " has arrived at your home in the simulation.";
showToast("Your simulated nanny has arrived! 🏡");
addNannyMessage("I've arrived at your home in our demonstration journey! 💗");
}
$("trackingTitle").textContent = booking
? chosenNanny + "'s journey"
: "Your nanny's journey";
}
function resetTracking() {
clearInterval(journeyTimer);
journeyTimer = null;
journeyProgress = 0;
$("nannyMarker").style.left = "12%";
$("nannyMarker").style.top = "20%";
$("eta").textContent = "-- min";
$("trackingPercent").textContent = "Journey not started";
$("trackingStatus").textContent = booking
? "Ready to begin the simulated journey."
: "Create a demonstration booking to begin.";
$("trackingTitle").textContent = booking
? chosenNanny + "'s journey"
: "Your nanny's journey";
}
/* CUSTOMER REVIEWS */
const starButtons = document.querySelectorAll("#starPicker button");
starButtons.forEach((button) => {
button.addEventListener("click", () => {
selectedRating = Number(button.dataset.rating);
updateStarPicker();
});
});
function updateStarPicker() {
starButtons.forEach((button) => {
button.classList.toggle("selected", Number(button.dataset.rating) <= selectedRating);
});
}
updateStarPicker();
function makeReviewCard(name, rating, review, isDemo = true) {
const article = document.createElement("article");
article.className = "review-card";
const stars = document.createElement("div");
stars.className = "stars";
stars.textContent = "★".repeat(rating) + "☆".repeat(5 - rating);
const text = document.createElement("p");
text.textContent = '"' + review + '"';
const author = document.createElement("div");
author.className = "review-author";
author.textContent = name + (isDemo ? " · Demo review" : " · Visitor review");
article.append(stars, text, author);
return article;
}
function loadSavedReviews() {
try {
const saved = JSON.parse(localStorage.getItem("kidsHavenReviews") || "[]");
if (Array.isArray(saved)) {
saved.forEach((review) => {
if (
review &&
typeof review.name === "string" &&
typeof review.text === "string" &&
Number.isInteger(review.rating) &&
review.rating >= 1 &&
review.rating <= 5
) {
$("reviewTrack").appendChild(
makeReviewCard(review.name, review.rating, review.text, false),
);
}
});
}
} catch (error) {
console.warn("Saved demo reviews could not be loaded.");
}
}
loadSavedReviews();
$("reviewForm").addEventListener("submit", function (event) {
event.preventDefault();
const name = $("reviewName").value.trim();
const text = $("reviewText").value.trim();
if (!name || !text) {
showToast("Please enter your name and review.");
return;
}
const review = {
name,
rating: selectedRating,
text,
};
$("reviewTrack").appendChild(makeReviewCard(name, selectedRating, text, false));
try {
const saved = JSON.parse(localStorage.getItem("kidsHavenReviews") || "[]");
saved.push(review);
localStorage.setItem("kidsHavenReviews", JSON.stringify(saved));
} catch (error) {
showToast("Review added for this session.");
}
this.reset();
selectedRating = 5;
updateStarPicker();
$("reviewTrack").scrollTo({
left: $("reviewTrack").scrollWidth,
behavior: "smooth",
});
showToast("Thank you! Your demo review has been added. ⭐");
});
/* CHAT SIMULATION */
function addChatMessage(text, sender) {
const message = document.createElement("div");
message.className = "message " + sender;
message.textContent = text;
$("chatMessages").appendChild(message);
$("chatMessages").scrollTop = $("chatMessages").scrollHeight;
}
function addNannyMessage(text) {
addChatMessage(text, "nanny");
}
function openChat() {
if (!booking) {
showToast("Create a demonstration booking to try the chat.");
$("booking").scrollIntoView({ behavior: "smooth" });
return;
}
$("chatNannyName").textContent = chosenNanny;
$("chatHeaderName").textContent = chosenNanny + " · Kids Haven";
$("chat").scrollIntoView({ behavior: "smooth" });
showToast("Your simulated nanny chat is ready! 💬");
}
function getChatReply(message) {
const text = message.toLowerCase();
if (
text.includes("arrived") ||
text.includes("reached") ||
text.includes("where are you")
) {
if (journeyProgress >= 100) {
return "I've arrived at your home in the demonstration journey! 🏡";
}
if (journeyProgress > 0) {
const minutes = Math.ceil((100 - journeyProgress) * 0.12);
return (
"I'm on my way in our simulation! The estimated arrival time is about " +
minutes +
" minutes. 💗"
);
}
return "Hi! Your booking has been recorded in the demo. Start the simulated tracking journey to see an estimated arrival time.";
}
if (text.includes("time") || text.includes("how long") || text.includes("eta")) {
if (journeyProgress >= 100) {
return "The demonstration journey is complete. The nanny has arrived!";
}
if (journeyProgress > 0) {
const minutes = Math.ceil((100 - journeyProgress) * 0.12);
return "The simulated estimated arrival time is approximately " + minutes + " minutes.";
}
return "Please start the simulated tracking journey to generate an estimated arrival time.";
}
if (
text.includes("instruction") ||
text.includes("allerg") ||
text.includes("children") ||
text.includes("kids")
) {
return booking
? "Your demonstration booking contains your childcare details. In a real service, the nanny would need to review and confirm the relevant instructions before accepting the booking."
: "Please create a booking first so the demonstration can show how childcare instructions would be handled.";
}
if (text.includes("thank") || text.includes("thanks")) {
return "You're very welcome! 💗 Kids Haven is here to make childcare more convenient.";
}
if (
text.includes("hello") ||
text.includes("hi ") ||
text === "hi" ||
text.startsWith("hey")
) {
return "Hi there! 💗 I'm the Kids Haven demonstration assistant. You can ask about arrival times, your booking, or childcare instructions.";
}
if (text.includes("book") || text.includes("booking")) {
return booking
? "Your demonstration booking has been created. You can open the tracking section to simulate the nanny's journey."
: "You can make a demonstration booking using the Book a Nanny form. Remember to use a fictional address.";
}
if (text.includes("cancel")) {
return "This is a demonstration chat, so it cannot cancel a real booking. In a real Kids Haven service, cancellation would be handled through the booking system.";
}
return "Thanks for your message! 💗 I'm the Kids Haven demo assistant. Try asking, 'Have you arrived?', 'How long will you take?', or 'Did you read my instructions?'";
}
$("chatForm").addEventListener("submit", function (event) {
event.preventDefault();
const input = $("chatInput");
const message = input.value.trim();
if (!message) return;
addChatMessage(message, "customer");
input.value = "";
const reply = getChatReply(message);
setTimeout(() => {
addNannyMessage(reply);
}, 600);
});
/* CONTACT FORM */
$("contactForm").addEventListener("submit", function (event) {
event.preventDefault();
showToast("Thank you! Your demonstration enquiry has been recorded on screen only.");
this.reset();
});
</script>
</body>
</html>