-
Notifications
You must be signed in to change notification settings - Fork 600
/
hotel.html
368 lines (340 loc) · 9.64 KB
/
hotel.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hotel Booking Form</title>
<style>
body {
font-family: Arial, sans-serif;
background: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSAgEx3UTsYmOsw00pc-dRtsGkOEgFmS7ca-w&s")
no-repeat center fixed;
background-size: cover;
color: #333;
padding: 20px;
overflow-x: hidden; /* Prevent horizontal scrolling due to animations */
}
.container {
padding: 30px;
border-radius: 8px;
max-width: 600px;
margin: auto;
transition: background-color 0.3s, color 0.3s;
background-color: #d7d8ff66;
border: 1px solid rgb(9, 9, 13);
box-shadow: 0 0 10px rgba(7, 6, 13, 0.9);
}
h2 {
text-align: center;
color: rgb(5, 5, 245);
font-size: 35px;
}
label {
margin-top: 20px;
display: block;
margin-bottom: 8px;
font-weight: bold;
color: rgb(11, 10, 10);
}
input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
width: 100%;
background: #d1e8f8;
padding: 10px;
margin-bottom: 20px;
color: black;
border: 1.5px solid #070505;
border-radius: 4px;
box-sizing: border-box;
transition: border-color 0.3s;
opacity: 0;
animation: fadeIn 1s forwards;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
border-color: #4caf50;
}
input[type="submit"],
.btn-book {
background-color: #64d068;
margin-left: 15rem;
color: rgb(15, 14, 14);
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
opacity: 0;
animation: fadeIn 3s forwards;
}
input[type="submit"]:hover,
.btn-book:hover {
background-color: #026a07;
color: white;
border: 1px solid black;
box-shadow: 0 0 10px rgba(7, 6, 13, 0.9);
}
.btn-book {
text-decoration: none;
}
.flex-container {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.flex-item {
flex: 1 1 calc(50% - 10px);
margin-right: 10px;
opacity: 0;
animation: slideInFromLeft 1s forwards;
}
.flex-item:last-child {
margin-right: 0;
animation: slideInFromRight 1s forwards;
}
.flex-item:nth-child(even) {
animation: slideInFromRight 2s forwards;
}
.flex-item:nth-child(odd) {
animation: slideInFromLeft 2s forwards;
}
textarea,
.btn-book {
animation-delay: 1s;
}
@keyframes slideInFromLeft {
0% {
transform: translateX(-100%);
opacity: 0;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slideInFromRight {
0% {
transform: translateX(100%);
opacity: 0;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.home-button {
position: absolute;
top: 20px;
left: 20px;
background-color: #f60303;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
text-decoration: none;
}
.home-button:hover {
background-color: #f2444d;
color: rgb(8, 6, 6);
border: 1px solid black;
box-shadow: #070505;
box-shadow: 0 0 10px rgba(7, 6, 13, 0.9);
}
@media (max-width: 768px) {
.flex-item {
flex: 1 1 100%;
margin-right: 0;
}
input[type="submit"],
.btn-book {
margin-left: 0;
width: 100%;
text-align: center;
}
}
</style>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
</head>
<body>
<a href="index.html" class="home-button">Home</a>
<div class="container">
<h2>Hotel Booking Form</h2>
<form
id="feedback-form"
action="#"
method="post"
onsubmit="submitFeedback(event)"
>
<div class="flex-container">
<div class="flex-item">
<label for="fname">First Name</label>
<input
type="text"
id="fname"
name="firstname"
placeholder="Your first name.."
required
/>
</div>
<div class="flex-item">
<label for="lname">Last Name</label>
<input
type="text"
id="lname"
name="lastname"
placeholder="Your last name.."
required
/>
</div>
</div>
<div class="flex-container">
<div class="flex-item">
<label for="email">Email</label>
<input
type="email"
id="email"
name="email"
placeholder="Your email.."
required
/>
</div>
<div class="flex-item">
<label for="phone">Phone Number</label>
<input
type="text"
id="phone"
name="phone"
placeholder="Your phone number.."
required
/>
</div>
</div>
<div class="flex-container">
<div class="flex-item">
<label for="checkin">Check-in Date</label>
<input type="date" id="checkin" name="checkin" required />
</div>
<div class="flex-item">
<label for="checkout">Check-out Date</label>
<input type="date" id="checkout" name="checkout" required />
</div>
</div>
<div class="flex-container">
<div class="flex-item">
<label for="adults">Number of Adults</label>
<input
type="number"
id="adults"
name="adults"
min="1"
max="10"
required
/>
</div>
<div class="flex-item">
<label for="children">Number of Children</label>
<input
type="number"
id="children"
name="children"
min="0"
max="10"
/>
</div>
</div>
<label for="room">Room Type</label>
<select id="room" name="room" required>
<option value="single">Single Room</option>
<option value="double">Double Room</option>
<option value="suite">Suite</option>
</select>
<label for="special-requests">Special Requests</label>
<textarea
id="special-requests"
name="special_requests"
placeholder="Any special requests.."
style="height: 100px"
></textarea>
<input type="submit" class="btn-book" value="Book Now" />
</form>
</div>
<script>
function submitFeedback(event) {
event.preventDefault(); // Prevent default form submission
// Get form elements
var fname = document.getElementById("fname").value.trim();
var lname = document.getElementById("lname").value.trim();
var email = document.getElementById("email").value.trim();
var phone = document.getElementById("phone").value.trim();
var checkin = document.getElementById("checkin").value;
var checkout = document.getElementById("checkout").value;
var adults = document.getElementById("adults").value;
var children = document.getElementById("children").value;
var room = document.getElementById("room").value;
var specialRequests = document
.getElementById("special-requests")
.value.trim();
// Check if the form is completely filled
if (
!fname ||
!lname ||
!email ||
!phone ||
!checkin ||
!checkout ||
!adults ||
!room
) {
Swal.fire({
icon: "error",
title: "Oops...",
text: "Please fill in all required fields before submitting.",
customClass: {
popup: "swal-popup",
title: "swal-title",
content: "swal-content",
confirmButton: "swal-confirm-button",
},
});
return; // Exit the function if any required field is empty
}
// Show a success message
Swal.fire({
icon: "success",
title: "Success!",
text: "Your booking request has been submitted.",
customClass: {
popup: "swal-popup",
title: "swal-title",
content: "swal-content",
confirmButton: "swal-confirm-button",
},
}).then((result) => {
// Clear the booking form after the user acknowledges the success modal
if (result.isConfirmed || result.isDismissed) {
document.getElementById("feedback-form").reset();
}
});
}
</script>
</body>
</html>