-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvilla.html
More file actions
173 lines (144 loc) · 6.34 KB
/
villa.html
File metadata and controls
173 lines (144 loc) · 6.34 KB
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
<!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;
white-space: pre-wrap;
}
</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>
<button type="button" onclick="copyText()">Copy to Clipboard</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() {
const textToCopy = document.getElementById('confirmationMessage').innerText;
navigator.clipboard.writeText(textToCopy).then(() => {
alert('Text copied to clipboard!');
}).catch(err => {
alert('Failed to copy text: ', err);
});
}
document.getElementById('bookingForm').addEventListener('submit', function (event) {
event.preventDefault();
const customerName = document.getElementById('customerName').value;
const numberOfGuests = document.getElementById('numberOfGuests').value;
const checkInDate = document.getElementById('checkInDate').value.split('-').reverse().join('/');
const checkOutDate = document.getElementById('checkOutDate').value.split('-').reverse().join('/');
const bookingAmount = parseInt(document.getElementById('advancereceived').value);
const totalAmount = parseInt(document.getElementById('total').value);
const balanceAmount = totalAmount - bookingAmount;
const propertyName = "VillaHopper#70";
const location = "VillaHopper#70, Adithyaram Signature City, Pattipulam, 100ft Road, ECR";
const checkInTime = "02:00 PM";
const checkOutTime = "11:00 AM";
const amenities = [
"3 AC Bedrooms including a large Suite Room with attached Bathrooms",
"3 King Size Beds and 4 Single Beds",
"A Private Swimming Pool with an attached shower and restroom",
"Play Area with TT Table, Carrom board and other board games",
"Rooftop Gazebo for candlelight dinners or casual gatherings",
"Fully functional bar (we do not serve alcohol)",
"Free Wi-Fi",
"Inverter backup of up to 8 hours for fans and lights, but not for AC",
"Ample parking space"
];
const confirmationMessage = `
Booking Confirmation: ${propertyName}
Stay Period: ${checkInDate} to ${checkOutDate}
Dear ${customerName},
Thank you for choosing ${propertyName} for your stay! We are pleased to confirm your booking.
**Booking Summary:**
- **Advance Paid:** ₹${bookingAmount}/- (${numberToWords(bookingAmount)} Only)
- **Balance Amount (Payable at Check-in):** ₹${balanceAmount}/- (${numberToWords(balanceAmount)} Only)
**Additional Charges:**
- ₹500/- Cleaning Fee (to be paid to the caretaker)
- ₹6,000/- Refundable Security Deposit (preferably in cash or via UPI, payable at check-in)
**Property Details:**
- **Property Name:** ${propertyName}
- **Location:** ${location}
**Stay Details:**
- **Check-in Date:** ${checkInDate}
- **Check-out Date:** ${checkOutDate}
- **Number of Guests:** ${numberOfGuests}
- **Check-in Time:** ${checkInTime}
- **Check-out Time:** ${checkOutTime}
**Amenities:**
${amenities.map(amenity => `- ${amenity}`).join('\n')}
**Contact Information:**
If you have any questions or need further assistance, please contact us:
- **Phone:** +91-8838581697
- **Email:** villahopper70@gmail.com
We look forward to hosting you and hope you have a memorable stay at ${propertyName}.
Warm regards,
R. Rathan Gangaa
`;
document.getElementById('confirmationMessage').textContent = confirmationMessage;
});
</script>
</body>
</html>