Compare commits

...

7 Commits

Author SHA1 Message Date
Muyao CHEN
b3eb96845a Add CSS file and fix datepicker display error 2024-06-29 17:50:33 +02:00
Muyao CHEN
310f61539c Using JS module on the book button 2024-06-29 17:01:26 +02:00
Muyao CHEN
e5e5a93565 Custom alerts using Notie 2024-06-29 15:57:00 +02:00
Muyao CHEN
bd094d019e Making a better date picker 2024-06-29 15:38:55 +02:00
Muyao CHEN
52d4d40140 javascript init 2024-06-29 15:21:09 +02:00
Muyao CHEN
d7f978a884 Creating the reservation page 2024-06-29 15:02:15 +02:00
Muyao CHEN
bfe66073f1 Improving our form 2024-06-29 14:54:21 +02:00
8 changed files with 331 additions and 59 deletions

View File

@ -7,12 +7,7 @@
<title>About</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="css/style.css" rel="stylesheet">
<style>
.room-image {
max-width: 50%;
}
</style>
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>

View File

@ -7,12 +7,7 @@
<title>Contact</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="css/style.css" rel="stylesheet">
<style>
.room-image {
max-width: 50%;
}
</style>
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>

View File

@ -7,12 +7,7 @@
<title>General's Quarters</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="css/style.css" rel="stylesheet">
<style>
.room-image {
max-width: 50%;
}
</style>
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>

View File

@ -7,7 +7,7 @@
<title>My hotel project</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="css/style.css" rel="stylesheet">
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>

View File

@ -7,12 +7,7 @@
<title>Major's Suite</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="css/style.css" rel="stylesheet">
<style>
.room-image {
max-width: 50%;
}
</style>
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>

103
make-reservation.html Normal file
View File

@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg bg-body-tertiary" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Rooms
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="generals.html">General's Quarters</a></li>
<li><a class="dropdown-item" href="majors.html">Major's Suite</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="reservation.html">Book Now</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col">
<h1 class="text-center mt-3">Make reservation</h1>
<form method="post" action="" class="needs-validation" novalidate>
<div class="form-group mt-5">
<label for="first_name">First name:</label>
<input type="text" name="first_name" id="first_name" class="form-control" required
autocomplete="off">
</div>
<div class="form-group mt-5">
<label for="last_name">Last name:</label>
<input type="text" name="last_name" id="last_name" class="form-control" required
autocomplete="off">
</div>
<div class="form-group mt-5">
<label for="email">Email:</label>
<input type="email" name="email" id="email" class="form-control" required autocomplete="off">
</div>
<div class="form-group mt-5">
<label for="phone">Phone number:</label>
<input type="text" name="phone" id="phone" class="form-control" required autocomplete="off">
</div>
<hr>
<input type="submit" class="btn btn-primary" value="Make Reservation">
</form>
</div>
</div>
<div class="row">
<footer class="py-3 my-4">
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Home</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Features</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Pricing</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">FAQs</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">About</a></li>
</ul>
<p class="text-center text-body-secondary">© 2024 Company, Inc</p>
</footer>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
</html>

View File

@ -7,12 +7,10 @@
<title>Reservation</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="css/style.css" rel="stylesheet">
<style>
.room-image {
max-width: 50%;
}
</style>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.3.4/dist/css/datepicker-bulma.min.css">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/notie/dist/notie.min.css">
<link href="static/css/style.css" rel="stylesheet">
</head>
<body>
@ -55,49 +53,228 @@
<div class="container">
<div class="row">
<div class="col">
<h1 class="text-center mt-3">Search for Availability</h1>
<div class="col-md-3">
</div>
<div class="col-md-6">
<h1 class="text-center mt-5">Search for Availability</h1>
<form action="reservation.html" method="get">
<div class="mb-3">
<label for="start_date" class="form-label">Starting Date</label>
<input type="date" class="form-control" id="start_date" name="start_date"
aria-describedby="startDateHelp">
<small id="startDateHelp" class="form-text text-muted">Enter your starting date in the form of
YYYY-MM-DD</small>
<form action="reservation.html" method="get" novalidate class="needs-validation">
<div id="reservation-dates" class="row">
<div class="col mb-3">
<input required type="text" class="form-control" name="start" placeholder="Arrival">
</div>
<div class="col mb-3">
<input required type="text" class="form-control" name="end" placeholder="Departure">
</div>
</div>
<div class="mb-3">
<label for="end_date" class="form-label">Eding Date</label>
<input type="date" class="form-control" id="end_date" name="end_date"
aria-describedby="endDateHelp">
<small id="endDateHelp" class="form-text text-muted">Enter your ending date in the form of
YYYY-MM-DD</small>
</div>
<div class="mb-3">
<button type="submit" class="btn btn-primary mb-3">Submit</button>
<button type="submit" class="btn btn-primary mb-3">Search Availability</button>
</div>
</form>
</div>
</div>
</div>
<div class="row">
<footer class="py-3 my-4">
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Home</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Features</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Pricing</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">FAQs</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">About</a></li>
</ul>
<p class="text-center text-body-secondary">© 2024 Company, Inc</p>
</footer>
<div class="row">
<div class="col">
<button id="dummy" class="btn btn-secondary mb-3">Dummy</button>
</div>
</div>
<div class="row">
<footer class="py-3 my-4">
<ul class="nav justify-content-center border-bottom pb-3 mb-3">
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Home</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Features</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Pricing</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">FAQs</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">About</a></li>
</ul>
<p class="text-center text-body-secondary">© 2024 Company, Inc</p>
</footer>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/vanillajs-datepicker@1.3.4/dist/js/datepicker-full.min.js"></script>
<script src="https://unpkg.com/notie"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
(() => {
'use strict'
// Fetch all the forms we want to apply custom Bootstrap validation styles to
const forms = document.querySelectorAll('.needs-validation')
// Loop over them and prevent submission
Array.from(forms).forEach(form => {
form.addEventListener('submit', event => {
if (!form.checkValidity()) {
event.preventDefault()
event.stopPropagation()
}
form.classList.add('was-validated')
}, false)
})
})()
// vanillajs-datepicker
const elem = document.getElementById('reservation-dates');
const rangepicker = new DateRangePicker(elem, {
"format": "yyyy-mm-dd",
});
// notie
function notify(msg, msgType) {
notie.alert({
type: msgType,
text: msg,
});
}
// sweetalert2
function notifyModal(title, text, icon, confirmButtonText) {
Swal.fire({
title: title,
text: text,
icon: icon,
confirmButtonText: confirmButtonText
})
}
// Prompt is out Javascript module for all alerts, notifications, and custom popup dialogs
function Prompt() {
let toast = function (c) {
const {
msg = "",
icon = "success",
position = "top-end",
} = c
const Toast = Swal.mixin({
toast: true,
title: msg,
position: position,
icon: icon,
showConfirmButton: false,
timer: 3000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({})
}
let success = function (c) {
const {
msg = "",
title = "",
footer = "",
} = c
Swal.fire({
icon: 'success',
title: title,
text: msg,
footer: footer,
})
}
let error = function (c) {
const {
msg = "",
title = "",
footer = "",
} = c
Swal.fire({
icon: 'error',
title: title,
text: msg,
footer: footer,
})
}
async function custom(c) {
const {
msg = "",
title = "",
} = c;
const {value: formValues} = await Swal.fire({
title: title,
html: msg,
backdrop: false,
focusConfirm: false,
showCancelButton: true,
willOpen: () => {
console.log("test")
const elem = document.getElementById('reservation-dates-modal')
const rp = new DateRangePicker(elem, {
"format": "yyyy-mm-dd",
showOnFocus: true,
});
},
didOpen: () => {
return [
document.getElementById('start').removeAttribute("disabled"),
document.getElementById('end').removeAttribute("disabled"),
]
},
preConfirm: () => {
return [
document.getElementById('start').value,
document.getElementById('end').value,
]
},
})
if (formValues) {
Swal.fire(JSON.stringify(formValues))
}
}
return {
toast: toast,
success: success,
error: error,
custom: custom,
}
}
document.getElementById("dummy").addEventListener('click', () => {
notify("This is a message", "success");
// notifyModal("title", "text", "success", "confirm");
// Prompt().toast({msg: "Prompt Test"})
Prompt().success({msg: "Success!"})
// Prompt().error({msg: "Ooops"})
let html = `
<form action="reservation.html" method="get" novalidate class="needs-validation">
<div id="reservation-dates-modal" class="row">
<div class="col mb-3">
<input disabled required type="text" class="form-control" name="start" id="start" placeholder="Arrival">
</div>
<div class="col mb-3">
<input disabled required type="text" class="form-control" name="end" id="end" placeholder="Departure">
</div>
</div>
</form>
`;
Prompt().custom({title: "Choose your dates", msg: html})
});
</script>
</body>
</html>

12
static/css/style.css Normal file
View File

@ -0,0 +1,12 @@
.room-image {
max-width: 50%;
}
.notie-container {
box-shadow: none;
}
.swal2-actions {
z-index: auto;
/* This is to fix the bug that datepicker shows under the buttons */
}