-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
134 lines (131 loc) · 5.19 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
134
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Scalable Waitlist AWS</title>
</head>
<body class="container text-center">
<h1 class="col-md-6 col-12 offset-md-3">Scalable Waitlist AWS</h1>
<div class="row col-md-12 mb-3">
<div class="card col-md-6 col-12 m-0">
<div class="card-body">
<h5 class="card-title">User - Get Estimate</h5>
<button id="getEstimate" type="submit" class="btn btn-dark mt-4">Get Estimate</button>
<p><small id="estimate"></small></p>
</div>
</div>
<div class="card col-md-6 col-12 m-0">
<div class="card-body">
<h5 class="card-title">User - Reserve Table</h5>
<form class="col-md-8 col-12 offset-md-2">
<div class="form-group">
<label for="customerPhoneNumber">Customer Name</label>
<input type="text" class="form-control col-8 offset-2" id="reserveTableCustomerName" aria-describedby="emailHelp" placeholder="Joe">
<label for="customerPhoneNumber">Customer Phone Number</label>
<input type="text" class="form-control col-8 offset-2" id="reserveTableCustomerPhoneNumber" aria-describedby="emailHelp" placeholder="+12345678912">
</div>
<button id="reserveTable" type="submit" class="btn btn-primary">Reserve Table</button>
<p><small id="reserveTableInfo"></small></p>
</form>
</div>
</div>
</div>
<div class="card col-md-6 col-12 offset-md-3">
<div class="card-body">
<h5 class="card-title">Host</h5>
<div class="col-md-8 col-12 offset-md-2">
<table class="table table-striped">
First In Line
<tbody>
<tr>
<td id="currentCustomerName"></td>
<td id="currentCustomerPhoneNumber"></td>
</tr>
</tbody>
</table>
<button id="nextCustomer" type="submit" class="btn btn-warning">Get First In Line</button>
<p><small id="nextCustomerInfo" class="success"></small></p>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script>
$(document).ready(function(){
var postCapacityRequestUrl = "https://m2tn2l3ty7.execute-api.us-east-1.amazonaws.com/sample/post-capacity-request"
var getNextCustomerUrl = "https://m2tn2l3ty7.execute-api.us-east-1.amazonaws.com/sample/get-next-customer"
var apiKey = "V9TAGwHfUZbpmx0b3Gpd18hxBlkmqavaLOx0jE48"
$.ajax({
type: "POST",
url: postCapacityRequestUrl,
data: {
"eventType": "getCurrentCustomer"
},
headers: {
"x-api-key": apiKey
},
success: function(data){
if(data.response) {
$("#currentCustomerName").html(data.response.customerName)
$("#currentCustomerPhoneNumber").html(data.response.customerPhoneNumber)
}
}
})
$("#getEstimate").click(function(event){
event.preventDefault();
$.ajax({
type: "POST",
url: postCapacityRequestUrl,
data: {
"eventType": "getEstimate"
},
headers: {
"x-api-key": apiKey
},
success: function(data){
$("#estimate").html("Estimate: "+data.estimateMin+" Minutes")
}
})
});
$("#reserveTable").click(function(event){
event.preventDefault();
$.ajax({
type: "POST",
url: postCapacityRequestUrl,
data: {
"customerPhoneNumber": $("#reserveTableCustomerPhoneNumber").val(),
"customerName": $("#reserveTableCustomerName").val(),
"eventType": "addNewCustomer"
},
headers: {
"x-api-key": apiKey
},
success: function(data){
$("#reserveTableInfo").html("Added customer to waitlist and text sent")
}
})
});
$("#nextCustomer").click(function(event){
event.preventDefault();
$.ajax({
type: "POST",
url: getNextCustomerUrl,
headers: {
"x-api-key": apiKey
},
success: function(data){
$("#nextCustomerInfo").html("Notified next customer to arrive.")
}
})
});
})
</script>
</body>
</html>