dashboard.ejs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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="/dashboardPage/dashboard.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 class="cursor" onclick="inventoryObj.sortIngredients('name')">Item</th>
  29. <th class="cursor" onclick="inventoryObj.sortIngredients('category')">Category</th>
  30. <th class="cursor" onclick="inventoryObj.sortIngredients('quantity')">Quantity</th>
  31. <th class="cursor" 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. <div>
  100. <h2>Choose Ingredients</h2>
  101. <input id="addFilter" type="text" placeholder="FILTER INGREDIENTS" onkeyup="window.addIngredientObj.filterAndDisplay()">
  102. <table>
  103. <thead>
  104. <tr>
  105. <th>Add</th>
  106. <th class="cursor" onclick="window.addIngredientObj.sort(1)">Ingredient</th>
  107. <th class="cursor" onclick="window.addIngredientObj.sort(2)">Category</th>
  108. <th class="cursor" onclick="window.addIngredientObj.sort(3)">Unit</th>
  109. <th>Quantity</th>
  110. </tr>
  111. </thead>
  112. <tbody></tbody>
  113. </table>
  114. <button class="button" onclick="addIngredientObj.submitAdd()">Submit</button>
  115. </div>
  116. <h1>Or</h1>
  117. <form id="createIngredientInput" onsubmit="addIngredientObj.submitNew()">
  118. <h2>Create New Ingredient</h2>
  119. <label>Name
  120. <input id="newIngName" type="text" required>
  121. </label>
  122. <label>Category
  123. <input id="newCategory" type="text" required>
  124. </label>
  125. <label>Unit
  126. <input id="newUnit" type="text" required>
  127. </label>
  128. <label>Quantity
  129. <input id="newQuantity" type="number" step="0.01" required>
  130. </label>
  131. <button class="button">Create Ingredient</button>
  132. </form>
  133. </div>
  134. </div>
  135. <div id="enterTransactionsAction" class="action">
  136. <h1>Enter all sales</h1>
  137. <h3>Last updated: <span id="updated"></span></h3>
  138. <table>
  139. <thead>
  140. <tr>
  141. <th>Recipe</th>
  142. <th>Number sold</th>
  143. </tr>
  144. </thead>
  145. <tbody></tbody>
  146. </table>
  147. <button class="button" onclick="enterTransactionsObj.submit()">Submit</button>
  148. </div>
  149. <div id="enterPurchaseAction" class="action">
  150. <h1>Enter Purchases</h1>
  151. <table>
  152. <thead>
  153. <tr>
  154. <th>Ingredient</th>
  155. <th>Amount</th>
  156. </tr>
  157. </thead>
  158. <tbody></tbody>
  159. </table>
  160. <button class="button" onclick="enterPurchaseObj.submit()">Submit</button>
  161. </div>
  162. <div id="singleRecipeAction" class="action">
  163. <h2 id="recipeName"></h2>
  164. <div class="buttonBox">
  165. <button class="button" id="addButton">Add Ingredient</button>
  166. <% if(merchant.pos === "none"){ %>
  167. <button class="button" id="removeButton">Remove</button>
  168. <% } %>
  169. </div>
  170. <table>
  171. <thead>
  172. <tr>
  173. <th>Name</th>
  174. <th>Quantity</th>
  175. <th>Actions</th>
  176. </tr>
  177. </thead>
  178. <tbody></tbody>
  179. </table>
  180. </div>
  181. <%- include ../shared/footer %>
  182. <script>
  183. <% if(locals.error){ %>
  184. let error = <%- JSON.stringify(error) %>;
  185. <% }else{ %>
  186. let error = undefined;
  187. <% } %>
  188. </script>
  189. <script>let merchant = <%- JSON.stringify(merchant) %>;</script>
  190. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  191. <script src="../shared/validation.js"></script>
  192. <script src="/dashboardPage/inventory.js"></script>
  193. <script src="/dashboardPage/recipes.js"></script>
  194. <script src="/dashboardPage/account.js"></script>
  195. <script src="/dashboardPage/addIngredient.js"></script>
  196. <script src="/dashboardPage/enterTransactions.js"></script>
  197. <script src="/dashboardPage/enterPurchase.js"></script>
  198. <script src="/dashboardPage/singleRecipe.js"></script>
  199. <script src="/shared/controller.js"></script>
  200. </body>
  201. </html>