-
Notifications
You must be signed in to change notification settings - Fork 0
/
r3.html
127 lines (119 loc) · 5.77 KB
/
r3.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
<!DOCTYPE html>
<html>
<head>
<title>Form 2 (Table)</title>
<link rel="stylesheet" href="form.css" >
</head>
<body>
<div class="testbox">
<form form method="post" name="google-sheet">
<div class="banner">
<h1>Table Booking Form-meetinga-room1</h1>
</div>
<br/>
<fieldset>
<legend>Reservation Details</legend>
<div class="columns">
<div class="item">
<label for="fname">First Name<span>*</span></label>
<input id="fname" type="text" name="fname" />
</div>
<div class="item">
<label for="lname"> Last Name<span>*</span></label>
<input id="lname" type="text" name="lname" />
</div>
<div class="item">
<label for="email">Email Address<span>*</span></label>
<input id="email" type="text" name="email" />
</div>
<div class="item">
<label for="phone">Phone<span>*</span></label>
<input id="phone" type="tel" name="phone" />
</div>
</div>
</fieldset>
<br/>
<fieldset>
<legend>Dates</legend>
<div class="columns">
<div class="item">
<label for="date">Date <span>*</span></label>
<input id="date" type="date" name="date" />
</div>
<div class="item">
</div>
<div class="item">
<p> Time </p>
<div class="item">
<input id="timing" type="number" placeholder=" timings" name="timing" />
</div>
<div class="item">
</div>
<div class="item">
<p>How many tables</p>
<div class="item">
<input id="tables" type="number" placeholder=" count" name="tables" />
</div>
<label for="instruction">Special Instructions</label>
<textarea id="instruction" rows="3"></textarea>
</div>
</fieldset>
<div class="btn-block">
<button type="submit" value="send message" onclick="generateqr();sendemail()">Submit</button>
</div>
<div id="qrcode">
</div>
</form>
</div>
<script>
const scriptURL = 'https://script.google.com/macros/s/AKfycbyCKwNUkVFdnw_4WRXTFfgjTMUdlRYHw17STyq-0_Dv7vL-zP1qYQtAHJ4xakjVrMaAfQ/exec'
const form = document.forms['google-sheet']
form.addEventListener('submit', e => {
e.preventDefault()
fetch(scriptURL, { method: 'POST', body: new FormData(form)})
.then(response => alert("Thanks for Contacting us..! We Will Contact You Soon..."))
.catch(error => console.error('Error!', error.message))
})
</script>
<script>
function generateqr() {
var fname = document.getElementById('fname').value;
var lname = document.getElementById('lname').value;
var email = document.getElementById('email').value;
var phone = document.getElementById('phone').value;
var Formdate = document.getElementById('date').value;
var Todate = document.getElementById('timing').value;
var hours = document.getElementById('tables').value;
console.log( "<br>fname" + fname + "lname" + lname+ "email" + email+ "phone " + phone+ "date " + date+ "timing " + timing+ "tables" + tables);
var url = "https://chart.googleapis.com/chart?cht=qr&chs=200x200&chl=Name:"+"<br>room-1"+"<br>fname:" + fname +"<br>"+ "lname:" + lname+"<br>"+ "email:" + email+"<br>"+ "phone: " + phone+"<br>"+ "date:" + date+"<br>"+ "timing:" + timing+"<br>"+ "tables" + tables;
var ifr = `<iframe src="${url}" height="200" width="200" margin-left="500px"> </iframe>`;
document.getElementById('qrcode').innerHTML = ifr;
}
</script>
<script src="https://smtpjs.com/v3/smtp.js"></script>
<script>
function sendemail(){
var fname = document.getElementById('fname').value;
var lname = document.getElementById('lname').value;
var email = document.getElementById('email').value;
var phone = document.getElementById('phone').value;
var Formdate = document.getElementById('date').value;
var Todate = document.getElementById('timing').value;
var hours = document.getElementById('tables').value;
Email.send({
Host : "smtp.elasticemail.com",
Username : "[email protected]",
Password : "77E68D2816F3938CBDEFCC325E0457772371",
To : document.getElementById('email').value,
From : "[email protected]",
Subject : "To Conform your reservation at room-1 in cafe",
Body :"you have registered at the cafe at the room-1 we will provide you all the things required to you <br>your booked place:room-1"+"<br>room-1"+"<br>fname:" + fname +"<br>"+ "lname:" + lname+"<br>"+ "email:" + email+"<br>"+ "phone: " + phone+"<br>"+ "date:" + date+"<br>"+ "timing:" + timing+"<br>"+ "tables" + tables+"<br>this are the registration details of your booking"+"<br>we will contact you as soon as possible and your responce is noted "+"we welocome to our cafe we promisse you that you will have best time in our cafe",
}).then(
message => alert(message)
);
}
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</body>
</html>