inventory.ejs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>The Subline</title>
  6. <link rel="icon" type="img/png" href="/shared/images/logo.png">
  7. <link rel="stylesheet" href="/inventoryPage/inventory.css">
  8. <link rel="stylesheet" href="/shared/shared.css">
  9. </head>
  10. <body>
  11. <% include ../shared/header %>
  12. <% include ../shared/banner %>
  13. <h1 id="title"><%=merchant.name%></h1>
  14. <strand-selector></strand-selector>
  15. <div id="inventoryStrand" class="strand">
  16. <div class="options">
  17. <button class="button" onclick="addIngredientObj.display()">Add Ingredient</button>
  18. <button class="button" onclick="enterPurchaseObj.display()">Enter Purchases</button>
  19. <% if(merchant.pos === "none"){ %>
  20. <button class="button" onclick="enterTransactionsObj.display()">Enter Transactions</button>
  21. <% } %>
  22. </div>
  23. <input id="filter" onkeyup="inventoryObj.filter()" type="text" placeholder="FILTER INGREDIENTS">
  24. <table>
  25. <thead>
  26. <tr>
  27. <th onclick="inventoryObj.sortIngredients('name')">Item</th>
  28. <th onclick="inventoryObj.sortIngredients('category')">Category</th>
  29. <th onclick="inventoryObj.sortIngredients('quantity')">Quantity</th>
  30. <th onclick="inventoryObj.sortIngredients('unit')">Unit</th>
  31. <th>Actions</th>
  32. </tr>
  33. <tbody></tbody>
  34. </thead>
  35. </table>
  36. </div>
  37. <div id="recipesStrand" class="strand">
  38. <div>
  39. <% if(merchant.pos !== "none"){ %>
  40. <button class="button" id="recipeUpdate" onclick="recipesObj.updateRecipes()">Update Recipes</button>
  41. <% } %>
  42. </div>
  43. <div id="recipesContainer"></div>
  44. </div>
  45. <div id="accountStrand" class="strand">
  46. <h1>Account Strand</h1>
  47. <form onsubmit="accountObj.submitForm()"></form>
  48. </div>
  49. <div id="addIngredientAction" class="action">
  50. <div class="container">
  51. <form onsubmit="addIngredientObj.submitAdd()">
  52. <h2>Select Ingredient</h2>
  53. <label>Ingredient
  54. <select id="addName"></select>
  55. </label>
  56. <label>Quantity
  57. <input id="addQuantity" type="number" step="0.01" required>
  58. </label>
  59. <input class="button" type="submit" value="Add Ingredient">
  60. </form>
  61. <form id="createIngredientInput" onsubmit="addIngredientObj.submitNew()">
  62. <h2>Create New Ingredient</h2>
  63. <label>Name
  64. <input id="newName" type="text" required>
  65. </label>
  66. <label>Category
  67. <input id="newCategory" type="text" required>
  68. </label>
  69. <label>Unit
  70. <input id="newUnit" type="text" required>
  71. </label>
  72. <label>Quantity
  73. <input id="newQuantity" type="number" step="0.01" required>
  74. </label>
  75. <button class="button">Create Ingredient</button>
  76. </form>
  77. </div>
  78. </div>
  79. <div id="enterTransactionsAction" class="action">
  80. <h1>Enter all sales</h1>
  81. <h3>Last updated: <span id="updated"></span></h3>
  82. <table>
  83. <thead>
  84. <tr>
  85. <th>Recipe</th>
  86. <th>Number sold</th>
  87. </tr>
  88. </thead>
  89. <tbody></tbody>
  90. </table>
  91. <button class="button" onclick="enterTransactionsObj.submit()">Submit</button>
  92. </div>
  93. <div id="enterPurchaseAction" class="action">
  94. <h1>Enter Purchases</h1>
  95. <table>
  96. <thead>
  97. <tr>
  98. <th>Ingredient</th>
  99. <th>Amount</th>
  100. </tr>
  101. </thead>
  102. <tbody></tbody>
  103. </table>
  104. <button class="button" onclick="enterPurchaseObj.submit()">Submit</button>
  105. </div>
  106. <div id="singleRecipeAction" class="action">
  107. <h1><span><%=merchant.name%></span>'s</h1>
  108. <h1 id="recipeName"></h1>
  109. <div class="buttonsDiv">
  110. <button class="button" id="addButton">Add Ingredient</button>
  111. <button class="button" onclick="recipesObj.display()">Back to Recipes</button>
  112. </div>
  113. <table>
  114. <thead>
  115. <tr>
  116. <th>Name</th>
  117. <th>Quantity</th>
  118. <th>Actions</th>
  119. </tr>
  120. </thead>
  121. <tbody></tbody>
  122. </table>
  123. </div>
  124. <script>
  125. <% if(locals.error){ %>
  126. let error = <%- JSON.stringify(error) %>;
  127. <% }else{ %>
  128. let error = undefined;
  129. <% } %>
  130. </script>
  131. <script>
  132. let merchant = <%- JSON.stringify(merchant) %>;
  133. </script>
  134. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  135. <script src="../shared/validation.js"></script>
  136. <script src="/inventoryPage/inventory.js"></script>
  137. <script src="/inventoryPage/recipes.js"></script>
  138. <script src="/inventoryPage/account.js"></script>
  139. <script src="/inventoryPage/addIngredient.js"></script>
  140. <script src="/inventoryPage/enterTransactions.js"></script>
  141. <script src="/inventoryPage/enterPurchase.js"></script>
  142. <script src="/inventoryPage/singleRecipe.js"></script>
  143. <script src="/shared/controller.js"></script>
  144. </body>
  145. </html>