Преглед изворни кода

Rename folder inventory to inventoryPage

Lee Morgan пре 6 година
родитељ
комит
8b5578fa43

+ 1 - 1
controllers/home.js

@@ -42,7 +42,7 @@ module.exports = {
 
 
                             merchant.save()
                             merchant.save()
                                 .then((updatedMerchant)=>{
                                 .then((updatedMerchant)=>{
-                                    return res.render("inventory/inventory", {merchant: updatedMerchant});
+                                    return res.render("inventoryPage/inventory", {merchant: updatedMerchant});
                                 })
                                 })
                                 .catch((err)=>{
                                 .catch((err)=>{
                                     console.log(err);
                                     console.log(err);

+ 2 - 2
views/inventory/inventory.ejs

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html>
 <html>
     <head>
     <head>
-        <link rel="stylesheet" href="/inventory/inventory.css">
+        <link rel="stylesheet" href="/inventoryPage/inventory.css">
         <link rel="stylesheet" href="/shared/shared.css">
         <link rel="stylesheet" href="/shared/shared.css">
     </head>
     </head>
     <body>
     <body>
@@ -80,6 +80,6 @@
         <script>let merchant = <%- JSON.stringify(merchant) %>;</script>
         <script>let merchant = <%- JSON.stringify(merchant) %>;</script>
         <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
         <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
         <script src="../shared/validation.js"></script>
         <script src="../shared/validation.js"></script>
-        <script src="/inventory/inventory.js"></script>
+        <script src="/inventoryPage/inventory.js"></script>
     </body>
     </body>
 </html>
 </html>

+ 0 - 0
views/inventory/inventory.css → views/inventoryPage/inventory.css


+ 85 - 0
views/inventoryPage/inventory.ejs

@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <link rel="stylesheet" href="/inventoryPage/inventory.css">
+        <link rel="stylesheet" href="/shared/shared.css">
+    </head>
+    <body>
+        <% include ../shared/header %>
+
+        <% include ../shared/banner %>
+
+        <div class="container">
+            <h1><%= merchant.name %> inventory</h1>
+
+            <a href="/recipes">View Recipes</a>
+
+            <button onclick="inventoryPage.displayAdd()">Add Ingredient</button>
+
+            <input id="filter" onkeyup="inventoryPage.filter()" type="text" placeholder="Start typing to filter">
+
+            <table>
+                <thead>
+                    <tr>
+                        <th onclick="inventoryPage.sortIngredients('name')">Item</th>
+                        <th onclick="inventoryPage.sortIngredients('category')">Category</th>
+                        <th onclick="inventoryPage.sortIngredients('quantity')">Quantity</th>
+                        <th onclick="inventoryPage.sortIngredients('unit')">Unit</th>
+                        <th></th>
+                    </tr>
+                    <tbody></tbody>
+                </thead>
+            </table>
+        </div>
+
+        <div class="add-ingredient">
+            <div class="modal-content" onclick="event.stopPropagation()">
+                <div id="existingIngredient">
+                    <button id="createNew">Create New</button>
+                    <table>
+                        <thead>
+                            <tr>
+                                <th>Ingredient</th>
+                                <th>Category</th>
+                                <th>Unit</th>
+                                <th></th>
+                            </tr>
+                        </thead>
+                        <tbody></tbody>
+                    </table>
+                </div>
+
+                <div id="quantityInput">
+                    <h3 id="quantityInputTitle"></h3>
+                    <input type="number" step="0.01" required>
+                    <button id="addIngredient">Add Ingredient</button>
+                </div>
+
+                <div id="newIngredient">
+                    <label>Ingredient Name:
+                        <input id="newName" type="text">
+                    </label>
+
+                    <label>Category:
+                        <input id="newCategory" type="text">
+                    </label>
+
+                    <label>Quantity:
+                        <input id="newQuantity" type="number" step="0.01">
+                    </label>
+
+                    <label>Unit:
+                        <input id="newUnit" type="text">
+                    </label>
+
+                    <button id="createIngredient">Create Ingredient</button>
+                </div>
+            </div>
+        </div>
+
+        <script>let merchant = <%- JSON.stringify(merchant) %>;</script>
+        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
+        <script src="../shared/validation.js"></script>
+        <script src="/inventoryPage/inventory.js"></script>
+    </body>
+</html>

+ 0 - 0
views/inventory/inventory.js → views/inventoryPage/inventory.js