-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestaurant.html
56 lines (45 loc) · 2.01 KB
/
restaurant.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="CSS/restaurant.css">
<title>Restaurant Page</title>
</head>
<body>
<img id="logo" src="images/lassologo.jpeg" alt="Leftover Lasso Logo">
<script>
fetch("session.php")
.then(response => response.json())
.then(data => {
document.getElementById("greeting").innerText = `Howdy, ${data.restaurant_name}`;
})
.catch(error => console.error("Error fetching session data:", error));
</script>
<h1 id="greeting"></h1>
<h2>Inventory</h2>
<ul id="inventoryList"></ul> <!-- Inventory will be displayed here -->
<script>
fetch("inventory.php")
.then(response => response.json())
.then(data => {
if (data.status === "success") {
const inventoryList = document.getElementById("inventoryList");
inventoryList.innerHTML = data.inventory.map(item =>
`<li>${item.food_type}: ${item.amount}</li>`
).join(""); // Populate the list
} else {
console.error("Error fetching inventory:", data.message);
}
})
.catch(error => console.error("Error fetching inventory:", error));
</script>
<div class="container">
<form action="update_inventory.php" method="POST">
<label for="subject">Description of Food Item</label>
<textarea id="subject" name="subject" placeholder="Describe the item..." style="height:200px"></textarea>
<label for="fname">Amount of Servings</label>
<input type="text" id="fname" name="firstname" placeholder="Number of Servings">
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>