inventory.ejs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="/inventoryPage/inventory.css">
  5. <link rel="stylesheet" href="/shared/shared.css">
  6. </head>
  7. <body>
  8. <% include ../shared/header %>
  9. <% include ../shared/banner %>
  10. <div id="inventoryStrand">
  11. <h1><%= merchant.name %> inventory</h1>
  12. <a href="/recipes">View Recipes</a>
  13. <button onclick="addIngredientObj.display()">Add Ingredient</button>
  14. <% if(merchant.pos === "none"){ %>
  15. <button onclick="enterTransactionsObj.display()">Enter Transactions</button>
  16. <% } %>
  17. <input id="filter" onkeyup="inventoryObj.filter()" type="text" placeholder="Start typing to filter">
  18. <table>
  19. <thead>
  20. <tr>
  21. <th onclick="inventoryObj.sortIngredients('name')">Item</th>
  22. <th onclick="inventoryObj.sortIngredients('category')">Category</th>
  23. <th onclick="inventoryObj.sortIngredients('quantity')">Quantity</th>
  24. <th onclick="inventoryObj.sortIngredients('unit')">Unit</th>
  25. <th></th>
  26. </tr>
  27. <tbody></tbody>
  28. </thead>
  29. </table>
  30. </div>
  31. <div id="recipeStrand"></div>
  32. <div id="addIngredientStrand" class="add-ingredient">
  33. <button onclick="inventoryObj.display()">Back to Inventory</button>
  34. <form onsubmit="addIngredientObj.submitAdd()">
  35. <h2>Select Ingredient</h2>
  36. <label>Ingredient
  37. <select id="addName"></select>
  38. </label>
  39. <label>Quantity
  40. <input id="addQuantity" type="number" step="0.01" required>
  41. </label>
  42. <input type="submit" value="Add Ingredient">
  43. </form>
  44. <form onsubmit="addIngredientObj.submitNew()">
  45. <h2>Create New Ingredient</h2>
  46. <label>Name
  47. <input id="newName" type="text" required>
  48. </label>
  49. <label>Category
  50. <input id="newCategory" type="text" required>
  51. </label>
  52. <label>Unit
  53. <input id="newUnit" type="text" required>
  54. </label>
  55. <label>Quantity
  56. <input id="newQuantity" type="number" step="0.01" required>
  57. </label>
  58. <input type="submit" value="Create Ingredient">
  59. </form>
  60. </div>
  61. <div id="enterTransactionsStrand">
  62. <h1>Enter items sold since (Date)</h1>
  63. <button onclick="inventoryObj.display()">Back to inventory</button>
  64. <table>
  65. <thead>
  66. <tr>
  67. <th>Recipe</th>
  68. <th>Number sold</th>
  69. </tr>
  70. </thead>
  71. <tbody></tbody>
  72. </table>
  73. <button onclick="enterTransactionsObj.submit()">Submit</button>
  74. </div>
  75. <script>
  76. <% if(locals.error){ %>
  77. let error = <%- JSON.stringify(error) %>;
  78. <% }else{ %>
  79. let error = undefined;
  80. <% } %>
  81. </script>
  82. <script>
  83. let merchant = <%- JSON.stringify(merchant) %>;
  84. </script>
  85. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  86. <script src="../shared/validation.js"></script>
  87. <script src="/inventoryPage/inventory.js"></script>
  88. <script src="/inventoryPage/recipe.js"></script>
  89. <script src="/inventoryPage/addIngredient.js"></script>
  90. <script src="/inventoryPage/enterTransactions.js"></script>
  91. <script src="/inventoryPage/controller.js"></script>
  92. </body>
  93. </html>