inventory.ejs 8.4 KB

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