Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ body {
font-size: var(--fontSize-body-4);
font-weight: var(--weight-regular);
line-height: var(--lineHeight-5);
overflow: hidden;
/* overflow: hidden; */
height: 300vh;
}

Expand Down Expand Up @@ -2051,4 +2051,34 @@ textarea.input-field {
left: 0;
}

}



.reservation-online {
margin-block-start: -270px;
margin-top: 3%;
}
.reservation-online {
display: grid;
grid-template-columns: 1fr 0.5fr;
}

.form-left,
.form-right { padding: 40px 20px 30px; }
textarea.input-field {
resize: none;
height: 60px;
padding-block: 20px;
line-height: var(--lineHeight-1);
}


#estimated-cost{
display: flex;
justify-content: space-around;
padding-bottom: 1%;
margin-bottom: 1%;
border: 1px solid var(--gold-crayola);

}
60 changes: 60 additions & 0 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,67 @@ const addEventOnElements = function (elements, eventType, callback) {
}


const phoneInput = document.getElementById('number');
const phoneErrorMessage = document.getElementById('phone-error-message');

// Event listener for phone number input
phoneInput.addEventListener('input', function() {
let phoneNumber = phoneInput.value;
const firstChar = phoneNumber.charAt(0);
const illegalChars = /[^0-9+\- ]/; // Allows numbers, +, -, and spaces only
const multipleDashes = /--+/; // Matches two or more consecutive dashes

// Remove spaces and "-" for length check
const strippedNumber = phoneNumber.replace(/[\s\-]/g, '');

// Reset error message
phoneErrorMessage.style.display = 'none';
phoneErrorMessage.textContent = '';

// Check for invalid "-" at the start or consecutive dashes
if (firstChar === '-' || multipleDashes.test(phoneNumber)) {
phoneErrorMessage.style.display = 'block';
phoneErrorMessage.textContent = "Invalid Phone Number!";
return; // Stop further validation
}

// Check if the first character is "+" and adjust the max length dynamically
if (firstChar === "+") {
phoneInput.maxLength = 17; // Adjust maxLength to allow for spaces and dashes
if (strippedNumber.length < 12 || strippedNumber.length > 14) {
phoneErrorMessage.style.display = 'block';
phoneErrorMessage.textContent = "Phone number must have 10 digits.";
}
} else {
phoneInput.maxLength = 13; // Adjust maxLength to allow for spaces and dashes
if (strippedNumber.length !== 10) {
phoneErrorMessage.style.display = 'block';
phoneErrorMessage.textContent = "Phone number must have 10 digits.";
}
}

// Check for illegal characters (anything other than 0-9, +, -, and space)
for (let char of phoneNumber) {
if (illegalChars.test(char) || (char === "+" && phoneNumber.indexOf(char) !== 0)) {
phoneErrorMessage.style.display = 'block';
phoneErrorMessage.textContent = `'${char}' is not valid!`;
break;
}
}
});



const numberOfPeopleInput = document.getElementById('people');
const estimatedCostMessage = document.getElementById('estimated-cost-message');

numberOfPeopleInput.addEventListener('input', () => {
const numberOfPeople = parseInt(numberOfPeopleInput.value) || 0;
const costPerPerson = 20; // Example cost per person
const totalCost = numberOfPeople * costPerPerson;

estimatedCostMessage.innerHTML = `Estimated Cost: $${totalCost}`;
});
/**
* NAVBAR
*/
Expand Down
153 changes: 153 additions & 0 deletions book.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Grilli - Book a Table</title>
<!--
- favicon
-->
<link rel="shortcut icon" href="./favicon.svg" type="image/svg+xml">

<!--
- google font link
-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;700&family=Forum&display=swap" rel="stylesheet">

<!--
- custom css link
-->
<link rel="stylesheet" href="./assets/css/style.css">

<!--
- preload images
-->
<link rel="preload" as="image" href="./assets/images/hero-slider-1.jpg">
<link rel="preload" as="image" href="./assets/images/hero-slider-2.jpg">
<link rel="preload" as="image" href="./assets/images/hero-slider-3.jpg">

</head>
<body>
<section class="reservation">
<div class="container">

<div class="form reservation-online bg-black-10">

<form action="" class="form-left">

<h2 class="headline-1 text-center">Book a Table</h2>

<p class="form-text text-center">
Booking request <a href="tel:+88123123456" class="link">+88-123-123456</a>
or fill out the order form
</p>

<div class="input-wrapper">
<input type="text" name="name" placeholder="Your Name" autocomplete="off" class="input-field">

<input type="tel" name="phone" placeholder="Phone Number" autocomplete="off" class="input-field" id="number">
</div>

<div class="input-wrapper">

<div class="icon-wrapper">
<ion-icon name="person-outline" aria-hidden="true"></ion-icon>

<input type="number" class="input-field" min="1" max="25" name="person" id="people" placeholder="Number of People">

</div>

<div class="icon-wrapper">
<ion-icon name="calendar-clear-outline" aria-hidden="true"></ion-icon>

<input type="date" name="reservation-date" class="input-field">

<ion-icon name="chevron-down" aria-hidden="true"></ion-icon>
</div>

<div class="icon-wrapper">
<ion-icon name="time-outline" aria-hidden="true"></ion-icon>

<select name="person" class="input-field">
<option value="08:00am">08 : 00 am</option>
<option value="09:00am">09 : 00 am</option>
<option value="010:00am">10 : 00 am</option>
<option value="011:00am">11 : 00 am</option>
<option value="012:00am">12 : 00 am</option>
<option value="01:00pm">01 : 00 pm</option>
<option value="02:00pm">02 : 00 pm</option>
<option value="03:00pm">03 : 00 pm</option>
<option value="04:00pm">04 : 00 pm</option>
<option value="05:00pm">05 : 00 pm</option>
<option value="06:00pm">06 : 00 pm</option>
<option value="07:00pm">07 : 00 pm</option>
<option value="08:00pm">08 : 00 pm</option>
<option value="09:00pm">09 : 00 pm</option>
<option value="10:00pm">10 : 00 pm</option>
</select>

<ion-icon name="chevron-down" aria-hidden="true"></ion-icon>
</div>

</div>
<div id="estimated-cost">
<p name="message" id="estimated-cost-message">Estimated Cost:</p>
</div>
<p id="phone-error-message" style="color: yellow; display: none; padding-top: 1%;"></p>

<button type="submit" class="btn btn-secondary">
<span class="text text-1">Book A Table</span>

<span class="text text-2" aria-hidden="true">Book A Table</span>
</button>

</form>

<div class="form-right text-center" style="background-image: url('./assets/images/form-pattern.png')">

<h2 class="headline-1 text-center">Contact Us</h2>

<p class="contact-label">Booking Request</p>

<a href="tel:+88123123456" class="body-1 contact-number hover-underline">+88-123-123456</a>

<div class="separator"></div>

<p class="contact-label">Location</p>

<address class="body-4">
Restaurant St, Delicious City, <br>
London 9578, UK
</address>

<p class="contact-label">Lunch Time</p>

<p class="body-4">
Monday to Sunday <br>
11.00 am - 2.30pm
</p>

<p class="contact-label">Dinner Time</p>

<p class="body-4">
Monday to Sunday <br>
05.00 pm - 10.00pm
</p>

</div>

</div>

</div>
</section>




<script src="./assets/js/script.js"></script>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ <h1 class="display-1 hero-title slider-reveal">
<ion-icon name="chevron-forward"></ion-icon>
</button>

<a href="#" class="hero-btn has-after">
<a href="book.html" class="hero-btn has-after">
<img src="./assets/images/hero-icon.png" width="48" height="48" alt="booking icon">

<span class="label-2 text-center span">Book A Table</span>
Expand Down