Subbu1304 commited on
Commit
2af84dd
·
verified ·
1 Parent(s): 10e74fe

Create templets/index.html

Browse files
Files changed (1) hide show
  1. templets/index.html +48 -0
templets/index.html ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Restaurant Table Availability</title>
7
+ <link rel="stylesheet" href="styles.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <h1>Check Table Availability</h1>
12
+ <div class="qr-code">
13
+ <input type="text" id="table-id" placeholder="Enter Table ID (e.g. 1)" />
14
+ <button onclick="checkAvailability()">Check Availability</button>
15
+ </div>
16
+ <div id="table-info" class="table-info"></div>
17
+ </div>
18
+
19
+ <script>
20
+ function checkAvailability() {
21
+ let tableId = document.getElementById('table-id').value;
22
+ if (!tableId) {
23
+ alert("Please enter a table ID.");
24
+ return;
25
+ }
26
+
27
+ // Call the backend to get table status
28
+ fetch(`/get_table_status/${tableId}`)
29
+ .then(response => response.json())
30
+ .then(data => {
31
+ let tableInfo = document.getElementById('table-info');
32
+ tableInfo.innerHTML = ''; // Clear previous info
33
+
34
+ if (data.status === "Available") {
35
+ tableInfo.innerHTML = `<h2>Table ${tableId} is Available!</h2>`;
36
+ } else if (data.status === "Reserved") {
37
+ tableInfo.innerHTML = `<h2>Table ${tableId} is Reserved.</h2><p>${data.message}</p>`;
38
+ } else {
39
+ tableInfo.innerHTML = `<h2>${data.error}</h2>`;
40
+ }
41
+ })
42
+ .catch(error => {
43
+ console.error('Error:', error);
44
+ });
45
+ }
46
+ </script>
47
+ </body>
48
+ </html>