forked from AnupeshVerma/Hotel-Transylvania
-
Notifications
You must be signed in to change notification settings - Fork 0
/
booking.js
68 lines (48 loc) · 2.15 KB
/
booking.js
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
// function for enabling/disabling user profile & bed
function choose_profile() {
let book_for = document.getElementById("book_for_").value;
let single_room = document.getElementById("single_room");
let double_room = document.getElementById("double_room");
let triple_room = document.getElementById("triple_room");
let msg = document.querySelector(".message");
if (book_for == "human") {
msg.textContent = "Humans are welcome";
triple_room.disabled = true;
}
else if (book_for == "monster")
{
msg.textContent = "Monsters are welcome";
single_room.disabled = true;
}
}
// profile choosing function ends
// booking confirmation email sending js (starts)
function sendmail(){
let user= document.getElementById("user_name").value;
let email= document.getElementById("user_email").value;
let arrival= document.getElementById("user_arrival").value;
let rooms= document.getElementById("no._rooms").value;
let people= document.getElementById("no._people").value;
let room_type= document.getElementById("room_type").value + " bed";
let msg = "Congratulations !!! Your room has been sucessfully booked.This is the confirmation message regarding your booking. Here is the details that you have entered<hr>"
let body = msg+'<br>Name: ' + user +"<br>Email: " +email+ "<br>Arrival Date: "+arrival +"<br>No. Of Rooms: " + rooms+"<br>No. Of People: " + people+"<br>Room Type: " + room_type ;
Email.send({
SecureToken:"3e2ac407-b09f-46c8-a1f2-e79da3f7540c",
To : email,
From: "anupeshforcloud@gmail.com",
Subject: "Hotel Booking Status",
Body:body,
}).then(
message =>{
//console.log (message);
if(message=='OK'){
alert('Your room has been booked successfully, check your e-mail for confirmation.');
}
else{
console.error (message);
alert('There is error at sending e-mail. ')
}
}
);
}
// email sending js (ends)