-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
133 lines (112 loc) · 3.93 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hotel Booking Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
}
.container {
max-width: 500px;
margin: auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 8px;
}
input[type="text"], input[type="date"], input[type="number"], select {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 3px;
}
input[type="submit"] {
background-color: #007BFF;
color: white;
padding: 10px 20px;
border: none;
border-radius: 3px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h2>Hotel Booking Registration Form</h2>
<form action="#" method="post">
<label for="customer-name">Customer Name:</label>
<input type="text" id="customer-name" name="customer_name" required>
<label for="check-in-date">Check-in Date:</label>
<input type="date" id="check-in-date" name="check_in_date" required>
<label for="total-days">Total No of Days:</label>
<input type="number" id="total-days" name="total_days" required>
<label for="total-persons">Total No of Persons:</label>
<input type="number" id="total-persons" name="total_persons" required>
<label for="room-type">Room Type:</label>
<select id="room-type" name="room_type">
<option value="deluxe">Deluxe Room</option>
<option value="suite">Suite Room</option>
</select>
<label for="amenities">Amenities:</label>
<select id="amenities" name="amenities">
<option value="ac">AC</option>
<option value="locker">Locker</option>
</select>
<label for="advance-amount">Advance Amount:</label>
<input type="number" id="advance-amount" name="advance_amount" required>
<input type="submit" value="Calculate">
<label for="total-room-cost">Total Room Cost:</label>
<input type="text" id="total-room-cost" name="total_room_cost" readonly>
<label for="total-amenities-cost">Total Amenities Cost:</label>
<input type="text" id="total-amenities-cost" name="total_amenities_cost" readonly>
<label for="total-cost">Total Cost:</label>
<input type="text" id="total-cost" name="total_cost" readonly>>
<label for="balance">Balance:</label>
<input type="text" id="balance" name="balance" readonly>
</form>
</div>
<script>
document.querySelector('form').addEventListener('submit', function(event) {
event.preventDefault();
const totalDays = parseInt(document.getElementById('total-days').value);
const roomType = document.getElementById('room-type').value;
const amenities = document.getElementById('amenities').value;
const advanceAmount = parseInt(document.getElementById('advance-amount').value);
const totalPersons = parseInt(document.getElementById('total-persons').value);
let roomRate = 0;
if (roomType === 'deluxe') {
roomRate = 2500;
} else if (roomType === 'suite') {
roomRate = 4000;
}
let amenitiesCost = 0;
if (amenities === 'ac') {
amenitiesCost += 1000;
}
if (amenities === 'locker') {
amenitiesCost += 300;
}
const totalRoomCost = roomRate * totalDays;
const totalAmenitiesCost = amenitiesCost * totalDays;
const totalCost = totalRoomCost + totalAmenitiesCost;
const balance = totalCost - advanceAmount;
document.getElementById('total-room-cost').value = totalRoomCost + "/-";
document.getElementById('total-amenities-cost').value = totalAmenitiesCost + "/-";
document.getElementById('total-cost').value = totalCost + "/-";
document.getElementById('balance').value = balance + "/-";
});
</script>
</body>
</html>