inventory.ejs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. <form id="accountDisplay" onsubmit="accountObj.editAccount()">
  47. <label>Name:&nbsp;&nbsp;
  48. <p><%=merchant.name%></p>
  49. </label>
  50. <label>Email:&nbsp;&nbsp;
  51. <p><%=merchant.email%></p>
  52. </label>
  53. <button class="button" onclick="accountObj.editAccount()">Edit</button>
  54. </form>
  55. <form id="accountEdit" onsubmit="accountObj.updateAccount()">
  56. <label>Name:&nbsp;&nbsp;
  57. <input id="accountName" type="text" value="<%=merchant.name%>">
  58. </label>
  59. <label>Email:&nbsp;&nbsp;
  60. <input id="accountEmail" type="email" value="<%=merchant.email%>">
  61. </label>
  62. <div class="buttonBox">
  63. <button class="button" onclick="accountObj.updateAccount()">Save</button>
  64. <button class="button" onclick="accountObj.editAccountCancel()">Cancel</button>
  65. </div>
  66. </form>
  67. <form id="passwordEdit" onsubmit="accountObj.updatePassword()">
  68. <label>Old password:
  69. <input id="oldPass" type="password" required>
  70. </label>
  71. <label>New password:
  72. <input id="newPass" type="password" required>
  73. </label>
  74. <label>Confirm new password:
  75. <input id="confirmNewPass" type="password" required>
  76. </label>
  77. <div class="buttonBox">
  78. <input class="button" type="submit" value="Submit">
  79. <button class="button" onclick="accountObj.editPasswordCancel()">Cancel</button>
  80. </div>
  81. </form>
  82. <button class="button" onclick="accountObj.editPassword()">Change password</button>
  83. </div>
  84. <div id="addIngredientAction" class="action">
  85. <div class="container">
  86. <form onsubmit="addIngredientObj.submitAdd()">
  87. <h2>Select Ingredient</h2>
  88. <label>Ingredient
  89. <select id="addName"></select>
  90. </label>
  91. <label>Quantity
  92. <input id="addQuantity" type="number" step="0.01" required>
  93. </label>
  94. <input class="button" type="submit" value="Add Ingredient">
  95. </form>
  96. <form id="createIngredientInput" onsubmit="addIngredientObj.submitNew()">
  97. <h2>Create New Ingredient</h2>
  98. <label>Name
  99. <input id="newName" type="text" required>
  100. </label>
  101. <label>Category
  102. <input id="newCategory" type="text" required>
  103. </label>
  104. <label>Unit
  105. <input id="newUnit" type="text" required>
  106. </label>
  107. <label>Quantity
  108. <input id="newQuantity" type="number" step="0.01" required>
  109. </label>
  110. <button class="button">Create Ingredient</button>
  111. </form>
  112. </div>
  113. </div>
  114. <div id="enterTransactionsAction" class="action">
  115. <h1>Enter all sales</h1>
  116. <h3>Last updated: <span id="updated"></span></h3>
  117. <table>
  118. <thead>
  119. <tr>
  120. <th>Recipe</th>
  121. <th>Number sold</th>
  122. </tr>
  123. </thead>
  124. <tbody></tbody>
  125. </table>
  126. <button class="button" onclick="enterTransactionsObj.submit()">Submit</button>
  127. </div>
  128. <div id="enterPurchaseAction" class="action">
  129. <h1>Enter Purchases</h1>
  130. <table>
  131. <thead>
  132. <tr>
  133. <th>Ingredient</th>
  134. <th>Amount</th>
  135. </tr>
  136. </thead>
  137. <tbody></tbody>
  138. </table>
  139. <button class="button" onclick="enterPurchaseObj.submit()">Submit</button>
  140. </div>
  141. <div id="singleRecipeAction" class="action">
  142. <h2 id="recipeName"></h2>
  143. <div class="buttonsDiv">
  144. <button class="button" id="addButton">Add Ingredient</button>
  145. </div>
  146. <table>
  147. <thead>
  148. <tr>
  149. <th>Name</th>
  150. <th>Quantity</th>
  151. <th>Actions</th>
  152. </tr>
  153. </thead>
  154. <tbody></tbody>
  155. </table>
  156. </div>
  157. <%- include ../shared/footer %>
  158. <script>
  159. <% if(locals.error){ %>
  160. let error = <%- JSON.stringify(error) %>;
  161. <% }else{ %>
  162. let error = undefined;
  163. <% } %>
  164. </script>
  165. <script>
  166. let merchant = <%- JSON.stringify(merchant) %>;
  167. </script>
  168. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  169. <script src="../shared/validation.js"></script>
  170. <script src="/inventoryPage/inventory.js"></script>
  171. <script src="/inventoryPage/recipes.js"></script>
  172. <script src="/inventoryPage/account.js"></script>
  173. <script src="/inventoryPage/addIngredient.js"></script>
  174. <script src="/inventoryPage/enterTransactions.js"></script>
  175. <script src="/inventoryPage/enterPurchase.js"></script>
  176. <script src="/inventoryPage/singleRecipe.js"></script>
  177. <script src="/shared/controller.js"></script>
  178. </body>
  179. </html>