inventory.ejs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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">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. <button class="button">Save</button>
  63. </form>
  64. <button class="button" onclick="accountObj.passChangeDisplay()">Change password</button>
  65. </div>
  66. <div id="addIngredientAction" class="action">
  67. <div class="container">
  68. <form onsubmit="addIngredientObj.submitAdd()">
  69. <h2>Select Ingredient</h2>
  70. <label>Ingredient
  71. <select id="addName"></select>
  72. </label>
  73. <label>Quantity
  74. <input id="addQuantity" type="number" step="0.01" required>
  75. </label>
  76. <input class="button" type="submit" value="Add Ingredient">
  77. </form>
  78. <form id="createIngredientInput" onsubmit="addIngredientObj.submitNew()">
  79. <h2>Create New Ingredient</h2>
  80. <label>Name
  81. <input id="newName" type="text" required>
  82. </label>
  83. <label>Category
  84. <input id="newCategory" type="text" required>
  85. </label>
  86. <label>Unit
  87. <input id="newUnit" type="text" required>
  88. </label>
  89. <label>Quantity
  90. <input id="newQuantity" type="number" step="0.01" required>
  91. </label>
  92. <button class="button">Create Ingredient</button>
  93. </form>
  94. </div>
  95. </div>
  96. <div id="enterTransactionsAction" class="action">
  97. <h1>Enter all sales</h1>
  98. <h3>Last updated: <span id="updated"></span></h3>
  99. <table>
  100. <thead>
  101. <tr>
  102. <th>Recipe</th>
  103. <th>Number sold</th>
  104. </tr>
  105. </thead>
  106. <tbody></tbody>
  107. </table>
  108. <button class="button" onclick="enterTransactionsObj.submit()">Submit</button>
  109. </div>
  110. <div id="enterPurchaseAction" class="action">
  111. <h1>Enter Purchases</h1>
  112. <table>
  113. <thead>
  114. <tr>
  115. <th>Ingredient</th>
  116. <th>Amount</th>
  117. </tr>
  118. </thead>
  119. <tbody></tbody>
  120. </table>
  121. <button class="button" onclick="enterPurchaseObj.submit()">Submit</button>
  122. </div>
  123. <div id="singleRecipeAction" class="action">
  124. <h2 id="recipeName"></h2>
  125. <div class="buttonsDiv">
  126. <button class="button" id="addButton">Add Ingredient</button>
  127. </div>
  128. <table>
  129. <thead>
  130. <tr>
  131. <th>Name</th>
  132. <th>Quantity</th>
  133. <th>Actions</th>
  134. </tr>
  135. </thead>
  136. <tbody></tbody>
  137. </table>
  138. </div>
  139. <script>
  140. <% if(locals.error){ %>
  141. let error = <%- JSON.stringify(error) %>;
  142. <% }else{ %>
  143. let error = undefined;
  144. <% } %>
  145. </script>
  146. <script>
  147. let merchant = <%- JSON.stringify(merchant) %>;
  148. </script>
  149. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  150. <script src="../shared/validation.js"></script>
  151. <script src="/inventoryPage/inventory.js"></script>
  152. <script src="/inventoryPage/recipes.js"></script>
  153. <script src="/inventoryPage/account.js"></script>
  154. <script src="/inventoryPage/addIngredient.js"></script>
  155. <script src="/inventoryPage/enterTransactions.js"></script>
  156. <script src="/inventoryPage/enterPurchase.js"></script>
  157. <script src="/inventoryPage/singleRecipe.js"></script>
  158. <script src="/shared/controller.js"></script>
  159. </body>
  160. </html>