-
Notifications
You must be signed in to change notification settings - Fork 0
/
villa.html
183 lines (156 loc) · 6.65 KB
/
villa.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Booking Confirmation</title>
<style>
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
font-family: Arial, sans-serif;
}
label {
display: block;
margin-top: 10px;
}
input[type="text"], input[type="number"], input[type="date"] {
width: 100%;
padding: 8px;
margin-top: 5px;
}
button {
margin-top: 20px;
padding: 10px 20px;
}
pre {
background-color: #f8f8f8;
padding: 10px;
border: 1px solid #ddd;
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<h2>Booking Confirmation Generator</h2>
<form id="bookingForm">
<label for="customerName">Customer Name:</label>
<input type="text" id="customerName" name="customerName" required>
<label for="numberOfGuests">Number of Guests:</label>
<input type="number" id="numberOfGuests" name="numberOfGuests" required>
<label for="checkInDate">Check-in Date:</label>
<input type="date" id="checkInDate" name="checkInDate" required>
<label for="checkOutDate">Check-out Date:</label>
<input type="date" id="checkOutDate" name="checkOutDate" required>
<label for="advancereceived">Advance Received:</label>
<input type="number" id="advancereceived" name="advancereceived" required>
<label for="total">Total (Advance + Pending):</label>
<input type="number" id="total" name="total" required>
<button type="submit">Generate Confirmation</button>
<pre id="confirmationMessage"></pre>
<button onclick="copyText()">Copy to Clipbaord</button>
</form>
<pre id="confirmationMessage"></pre>
</div>
<script>
function numberToWords(num) {
const belowTwenty = [
"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten",
"Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"
];
const tens = [
"", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"
];
const thousands = ["", "Thousand", "Million", "Billion"];
if (num === 0) return "Zero";
function helper(n) {
if (n < 20) return belowTwenty[n];
if (n < 100) return tens[Math.floor(n / 10)] + (n % 10 ? " " + belowTwenty[n % 10] : "");
if (n < 1000) return belowTwenty[Math.floor(n / 100)] + " Hundred" + (n % 100 ? " " + helper(n % 100) : "");
for (let i = 0; i < thousands.length; i++) {
const divisor = Math.pow(1000, i + 1);
if (n < divisor) {
return helper(Math.floor(n / Math.pow(1000, i))) + " " + thousands[i] + (n % Math.pow(1000, i) ? " " + helper(n % Math.pow(1000, i)) : "");
}
}
}
return helper(num);
}
function copyText() {
// Get the text from the div
var textToCopy = document.getElementById('confirmationMessage').innerText;
// Create a temporary textarea element
var tempTextArea = document.createElement('textarea');
tempTextArea.value = textToCopy;
// Append the textarea to the body
document.body.appendChild(tempTextArea);
// Select the text
tempTextArea.select();
tempTextArea.setSelectionRange(0, 99999); // For mobile devices
// Copy the text
document.execCommand('copy');
// Remove the textarea
document.body.removeChild(tempTextArea);
// Optionally, provide feedback to the user
alert('Text copied to clipboard: ' + textToCopy);
}
document.getElementById('bookingForm').addEventListener('submit', function(event) {
event.preventDefault();
const customerName = document.getElementById('customerName').value;
const numberOfGuests = document.getElementById('numberOfGuests').value;
const checkInDate = new Date(document.getElementById('checkInDate').value).toLocaleDateString('en-US', { month: 'long', day: 'numeric' });
const checkOutDate = new Date(document.getElementById('checkOutDate').value).toLocaleDateString('en-US', { month: 'long', day: 'numeric' });
const bookingAmount = document.getElementById('advancereceived').value;
const balanceAmount = document.getElementById('total').value - document.getElementById('advancereceived').value ;
const propertyName = "VillaHopper#70";
const location = "VillaHopper#70, Adithyaram Signature City, Pattipulam, 100ft Road, ECR";
const checkInTime = "12:30 PM";
const checkOutTime = "11:30 AM";
const amenities = [
"2 AC Bedrooms including a large Suite Room, 1 Non AC Bedroom",
"A Private Swimming Pool with an attached shower and restroom",
"Play Area with TT Table",
"Rooftop Gazebo for candle light dinner, or just to hang out with friends",
"Fully functional bar",
"Free Wifi",
"Inverter Backup upto 8 Hours",
"Ample Parking Space",
"Morning tea/coffee complimentary"
];
const confirmationMessage = `
Booking Confirmation for ${propertyName} - ${checkInDate} to ${checkOutDate}
Dear ${customerName},
Thank you for choosing ${propertyName} for your upcoming stay!
Booking Amount: Rs. ${bookingAmount}/- (${numberToWords(bookingAmount)} Only)
Balance Amount: Rs. ${balanceAmount}/- (${numberToWords(balanceAmount)} Only) to be given during check-in.
We are pleased to confirm your booking as follows:
• Property: ${propertyName}
• Check-in Date: ${checkInDate}
• Check-out Date: ${checkOutDate}
• Location: ${location}
Booking Details:
• Guest Name: ${customerName}
• Number of Guests: ${numberOfGuests}
Check-in Instructions:
• Check-in Time: ${checkInTime}
• Check-out Time: ${checkOutTime}
Amenities:
• ${amenities.join('\n• ')}
Contact Information:
If you have any questions or need further assistance, please do not hesitate to contact us:
• Phone: +91-8838581697
• Email: villahopper70@gmail.com
We look forward to hosting you and hope you have a wonderful stay at ${propertyName}.
Best regards,
R. Rathan Gangaa
`;
const confirmationMessageElement = document.getElementById('confirmationMessage');
confirmationMessageElement.textContent = confirmationMessage;
const copyButton = document.getElementById('copyButton');
copyButton.style.display = 'block';
});
</script>
</body>
</html>