inventory.ejs 7.8 KB

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