@frigear-nu/shifts 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/README.md +53 -2
  2. package/dist/module.d.mts +716 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +272 -0
  5. package/dist/runtime/access.d.ts +2 -0
  6. package/dist/runtime/access.js +84 -0
  7. package/dist/runtime/app/components/ShiftBroadcastSlideover.d.vue.ts +19 -0
  8. package/dist/runtime/app/components/ShiftBroadcastSlideover.vue +142 -0
  9. package/dist/runtime/app/components/ShiftBroadcastSlideover.vue.d.ts +19 -0
  10. package/dist/runtime/app/components/ShiftBroadcastsCard.d.vue.ts +9 -0
  11. package/dist/runtime/app/components/ShiftBroadcastsCard.vue +74 -0
  12. package/dist/runtime/app/components/ShiftBroadcastsCard.vue.d.ts +9 -0
  13. package/dist/runtime/app/components/ShiftBulkSlideover.d.vue.ts +15 -0
  14. package/dist/runtime/app/components/ShiftBulkSlideover.vue +185 -0
  15. package/dist/runtime/app/components/ShiftBulkSlideover.vue.d.ts +15 -0
  16. package/dist/runtime/app/components/ShiftCheckInCard.d.vue.ts +13 -0
  17. package/dist/runtime/app/components/ShiftCheckInCard.vue +238 -0
  18. package/dist/runtime/app/components/ShiftCheckInCard.vue.d.ts +13 -0
  19. package/dist/runtime/app/components/ShiftCopySlideover.d.vue.ts +11 -0
  20. package/dist/runtime/app/components/ShiftCopySlideover.vue +71 -0
  21. package/dist/runtime/app/components/ShiftCopySlideover.vue.d.ts +11 -0
  22. package/dist/runtime/app/components/ShiftDayView.d.vue.ts +16 -0
  23. package/dist/runtime/app/components/ShiftDayView.vue +124 -0
  24. package/dist/runtime/app/components/ShiftDayView.vue.d.ts +16 -0
  25. package/dist/runtime/app/components/ShiftFeedSlideover.d.vue.ts +7 -0
  26. package/dist/runtime/app/components/ShiftFeedSlideover.vue +172 -0
  27. package/dist/runtime/app/components/ShiftFeedSlideover.vue.d.ts +7 -0
  28. package/dist/runtime/app/components/ShiftNowCard.d.vue.ts +6 -0
  29. package/dist/runtime/app/components/ShiftNowCard.vue +83 -0
  30. package/dist/runtime/app/components/ShiftNowCard.vue.d.ts +6 -0
  31. package/dist/runtime/app/components/ShiftPassFullscreen.d.vue.ts +13 -0
  32. package/dist/runtime/app/components/ShiftPassFullscreen.vue +79 -0
  33. package/dist/runtime/app/components/ShiftPassFullscreen.vue.d.ts +13 -0
  34. package/dist/runtime/app/components/ShiftPerkSlideover.d.vue.ts +14 -0
  35. package/dist/runtime/app/components/ShiftPerkSlideover.vue +103 -0
  36. package/dist/runtime/app/components/ShiftPerkSlideover.vue.d.ts +14 -0
  37. package/dist/runtime/app/components/ShiftPerksCard.d.vue.ts +8 -0
  38. package/dist/runtime/app/components/ShiftPerksCard.vue +66 -0
  39. package/dist/runtime/app/components/ShiftPerksCard.vue.d.ts +8 -0
  40. package/dist/runtime/app/components/ShiftQrScanner.d.vue.ts +10 -0
  41. package/dist/runtime/app/components/ShiftQrScanner.vue +44 -0
  42. package/dist/runtime/app/components/ShiftQrScanner.vue.d.ts +10 -0
  43. package/dist/runtime/app/components/ShiftRoleSlideover.d.vue.ts +15 -0
  44. package/dist/runtime/app/components/ShiftRoleSlideover.vue +88 -0
  45. package/dist/runtime/app/components/ShiftRoleSlideover.vue.d.ts +15 -0
  46. package/dist/runtime/app/components/ShiftScheduleSettingsFields.d.vue.ts +11 -0
  47. package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue +61 -0
  48. package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue.d.ts +11 -0
  49. package/dist/runtime/app/components/ShiftScheduleSlideover.d.vue.ts +12 -0
  50. package/dist/runtime/app/components/ShiftScheduleSlideover.vue +129 -0
  51. package/dist/runtime/app/components/ShiftScheduleSlideover.vue.d.ts +12 -0
  52. package/dist/runtime/app/components/ShiftSlideover.d.vue.ts +13 -0
  53. package/dist/runtime/app/components/ShiftSlideover.vue +353 -0
  54. package/dist/runtime/app/components/ShiftSlideover.vue.d.ts +13 -0
  55. package/dist/runtime/app/components/ShiftStationSlideover.d.vue.ts +15 -0
  56. package/dist/runtime/app/components/ShiftStationSlideover.vue +92 -0
  57. package/dist/runtime/app/components/ShiftStationSlideover.vue.d.ts +15 -0
  58. package/dist/runtime/app/composables/index.d.ts +6 -0
  59. package/dist/runtime/app/composables/index.js +5 -0
  60. package/dist/runtime/app/composables/useShiftsActions.d.ts +61 -0
  61. package/dist/runtime/app/composables/useShiftsActions.js +224 -0
  62. package/dist/runtime/app/composables/useShiftsFormat.d.ts +12 -0
  63. package/dist/runtime/app/composables/useShiftsFormat.js +14 -0
  64. package/dist/runtime/app/composables/useShiftsLinks.d.ts +12 -0
  65. package/dist/runtime/app/composables/useShiftsLinks.js +6 -0
  66. package/dist/runtime/app/composables/useShiftsTranslate.d.ts +5 -0
  67. package/dist/runtime/app/composables/useShiftsTranslate.js +12 -0
  68. package/dist/runtime/app/composables/useShiftsVenueFeatures.d.ts +17 -0
  69. package/dist/runtime/app/composables/useShiftsVenueFeatures.js +18 -0
  70. package/dist/runtime/app/dashboard/NextShift.d.vue.ts +3 -0
  71. package/dist/runtime/app/dashboard/NextShift.vue +69 -0
  72. package/dist/runtime/app/dashboard/NextShift.vue.d.ts +3 -0
  73. package/dist/runtime/app/dashboard/OpenSwaps.d.vue.ts +3 -0
  74. package/dist/runtime/app/dashboard/OpenSwaps.vue +69 -0
  75. package/dist/runtime/app/dashboard/OpenSwaps.vue.d.ts +3 -0
  76. package/dist/runtime/app/dashboard/TeamOnNow.d.vue.ts +3 -0
  77. package/dist/runtime/app/dashboard/TeamOnNow.vue +72 -0
  78. package/dist/runtime/app/dashboard/TeamOnNow.vue.d.ts +3 -0
  79. package/dist/runtime/app/pages/check-in.d.vue.ts +3 -0
  80. package/dist/runtime/app/pages/check-in.vue +93 -0
  81. package/dist/runtime/app/pages/check-in.vue.d.ts +3 -0
  82. package/dist/runtime/app/pages/lead.d.vue.ts +3 -0
  83. package/dist/runtime/app/pages/lead.vue +300 -0
  84. package/dist/runtime/app/pages/lead.vue.d.ts +3 -0
  85. package/dist/runtime/app/pages/shift.d.vue.ts +3 -0
  86. package/dist/runtime/app/pages/shift.vue +482 -0
  87. package/dist/runtime/app/pages/shift.vue.d.ts +3 -0
  88. package/dist/runtime/app/pages/shifts.d.vue.ts +3 -0
  89. package/dist/runtime/app/pages/shifts.vue +21 -0
  90. package/dist/runtime/app/pages/shifts.vue.d.ts +3 -0
  91. package/dist/runtime/app/pages/station.d.vue.ts +3 -0
  92. package/dist/runtime/app/pages/station.vue +104 -0
  93. package/dist/runtime/app/pages/station.vue.d.ts +3 -0
  94. package/dist/runtime/app/pages/swaps.d.vue.ts +3 -0
  95. package/dist/runtime/app/pages/swaps.vue +32 -0
  96. package/dist/runtime/app/pages/swaps.vue.d.ts +3 -0
  97. package/dist/runtime/app/tabs/HomeShifts.d.vue.ts +6 -0
  98. package/dist/runtime/app/tabs/HomeShifts.vue +194 -0
  99. package/dist/runtime/app/tabs/HomeShifts.vue.d.ts +6 -0
  100. package/dist/runtime/app/tabs/HomeSwaps.d.vue.ts +3 -0
  101. package/dist/runtime/app/tabs/HomeSwaps.vue +188 -0
  102. package/dist/runtime/app/tabs/HomeSwaps.vue.d.ts +3 -0
  103. package/dist/runtime/app/tabs/Shifts.d.vue.ts +9 -0
  104. package/dist/runtime/app/tabs/Shifts.vue +487 -0
  105. package/dist/runtime/app/tabs/Shifts.vue.d.ts +9 -0
  106. package/dist/runtime/app/utils/admin-shifts.d.ts +42 -0
  107. package/dist/runtime/app/utils/admin-shifts.js +36 -0
  108. package/dist/runtime/dashboard.d.ts +8 -0
  109. package/dist/runtime/dashboard.js +30 -0
  110. package/dist/runtime/emails/shifts-broadcast.d.vue.ts +8 -0
  111. package/dist/runtime/emails/shifts-broadcast.vue +24 -0
  112. package/dist/runtime/emails/shifts-broadcast.vue.d.ts +8 -0
  113. package/dist/runtime/emails/shifts-reminder.d.vue.ts +12 -0
  114. package/dist/runtime/emails/shifts-reminder.vue +34 -0
  115. package/dist/runtime/emails/shifts-reminder.vue.d.ts +12 -0
  116. package/dist/runtime/emails/shifts-swap-accepted.d.vue.ts +11 -0
  117. package/dist/runtime/emails/shifts-swap-accepted.vue +32 -0
  118. package/dist/runtime/emails/shifts-swap-accepted.vue.d.ts +11 -0
  119. package/dist/runtime/emails/shifts-swap-completed.d.vue.ts +11 -0
  120. package/dist/runtime/emails/shifts-swap-completed.vue +32 -0
  121. package/dist/runtime/emails/shifts-swap-completed.vue.d.ts +11 -0
  122. package/dist/runtime/emails/shifts-swap-offered.d.vue.ts +11 -0
  123. package/dist/runtime/emails/shifts-swap-offered.vue +32 -0
  124. package/dist/runtime/emails/shifts-swap-offered.vue.d.ts +11 -0
  125. package/dist/runtime/emails/shifts-swap-pending.d.vue.ts +11 -0
  126. package/dist/runtime/emails/shifts-swap-pending.vue +32 -0
  127. package/dist/runtime/emails/shifts-swap-pending.vue.d.ts +11 -0
  128. package/dist/runtime/emails/shifts-swap-proposed.d.vue.ts +11 -0
  129. package/dist/runtime/emails/shifts-swap-proposed.vue +32 -0
  130. package/dist/runtime/emails/shifts-swap-proposed.vue.d.ts +11 -0
  131. package/dist/runtime/emails/shifts-swap-rejected.d.vue.ts +11 -0
  132. package/dist/runtime/emails/shifts-swap-rejected.vue +32 -0
  133. package/dist/runtime/emails/shifts-swap-rejected.vue.d.ts +11 -0
  134. package/dist/runtime/i18n/lang/da.json +627 -0
  135. package/dist/runtime/i18n/lang/en.json +627 -0
  136. package/dist/runtime/notifications.d.ts +9 -0
  137. package/dist/runtime/notifications.js +36 -0
  138. package/dist/runtime/server/db/schema.postgresql.d.ts +2151 -0
  139. package/dist/runtime/server/db/schema.postgresql.js +228 -0
  140. package/dist/runtime/server/db/schema.sqlite.d.ts +2263 -0
  141. package/dist/runtime/server/db/schema.sqlite.js +228 -0
  142. package/dist/runtime/server/digest-email.d.ts +17 -0
  143. package/dist/runtime/server/digest-email.js +42 -0
  144. package/dist/runtime/server/plugins/station-key.d.ts +2 -0
  145. package/dist/runtime/server/plugins/station-key.js +5 -0
  146. package/dist/runtime/server/plugins/teams.d.ts +2 -0
  147. package/dist/runtime/server/plugins/teams.js +19 -0
  148. package/dist/runtime/server/policies.d.ts +2 -0
  149. package/dist/runtime/server/policies.js +41 -0
  150. package/dist/runtime/server/reminder-email.d.ts +67 -0
  151. package/dist/runtime/server/reminder-email.js +109 -0
  152. package/dist/runtime/server/routes/admin/assignment.delete.d.ts +2 -0
  153. package/dist/runtime/server/routes/admin/assignment.delete.js +10 -0
  154. package/dist/runtime/server/routes/admin/assignments.post.d.ts +2 -0
  155. package/dist/runtime/server/routes/admin/assignments.post.js +11 -0
  156. package/dist/runtime/server/routes/admin/broadcasts.get.d.ts +2 -0
  157. package/dist/runtime/server/routes/admin/broadcasts.get.js +8 -0
  158. package/dist/runtime/server/routes/admin/broadcasts.post.d.ts +2 -0
  159. package/dist/runtime/server/routes/admin/broadcasts.post.js +9 -0
  160. package/dist/runtime/server/routes/admin/candidates.get.d.ts +2 -0
  161. package/dist/runtime/server/routes/admin/candidates.get.js +10 -0
  162. package/dist/runtime/server/routes/admin/operation-teams.get.d.ts +2 -0
  163. package/dist/runtime/server/routes/admin/operation-teams.get.js +9 -0
  164. package/dist/runtime/server/routes/admin/perk.delete.d.ts +2 -0
  165. package/dist/runtime/server/routes/admin/perk.delete.js +10 -0
  166. package/dist/runtime/server/routes/admin/perk.patch.d.ts +2 -0
  167. package/dist/runtime/server/routes/admin/perk.patch.js +10 -0
  168. package/dist/runtime/server/routes/admin/perks.get.d.ts +2 -0
  169. package/dist/runtime/server/routes/admin/perks.get.js +9 -0
  170. package/dist/runtime/server/routes/admin/perks.post.d.ts +2 -0
  171. package/dist/runtime/server/routes/admin/perks.post.js +10 -0
  172. package/dist/runtime/server/routes/admin/role.delete.d.ts +2 -0
  173. package/dist/runtime/server/routes/admin/role.delete.js +11 -0
  174. package/dist/runtime/server/routes/admin/role.patch.d.ts +2 -0
  175. package/dist/runtime/server/routes/admin/role.patch.js +11 -0
  176. package/dist/runtime/server/routes/admin/roles.get.d.ts +2 -0
  177. package/dist/runtime/server/routes/admin/roles.get.js +9 -0
  178. package/dist/runtime/server/routes/admin/roles.post.d.ts +2 -0
  179. package/dist/runtime/server/routes/admin/roles.post.js +10 -0
  180. package/dist/runtime/server/routes/admin/schedule-copy.post.d.ts +2 -0
  181. package/dist/runtime/server/routes/admin/schedule-copy.post.js +12 -0
  182. package/dist/runtime/server/routes/admin/schedule-publish.post.d.ts +2 -0
  183. package/dist/runtime/server/routes/admin/schedule-publish.post.js +9 -0
  184. package/dist/runtime/server/routes/admin/schedule.delete.d.ts +2 -0
  185. package/dist/runtime/server/routes/admin/schedule.delete.js +10 -0
  186. package/dist/runtime/server/routes/admin/schedule.get.d.ts +2 -0
  187. package/dist/runtime/server/routes/admin/schedule.get.js +9 -0
  188. package/dist/runtime/server/routes/admin/schedule.patch.d.ts +2 -0
  189. package/dist/runtime/server/routes/admin/schedule.patch.js +10 -0
  190. package/dist/runtime/server/routes/admin/schedules.get.d.ts +2 -0
  191. package/dist/runtime/server/routes/admin/schedules.get.js +10 -0
  192. package/dist/runtime/server/routes/admin/schedules.post.d.ts +2 -0
  193. package/dist/runtime/server/routes/admin/schedules.post.js +9 -0
  194. package/dist/runtime/server/routes/admin/shift.delete.d.ts +2 -0
  195. package/dist/runtime/server/routes/admin/shift.delete.js +10 -0
  196. package/dist/runtime/server/routes/admin/shift.patch.d.ts +2 -0
  197. package/dist/runtime/server/routes/admin/shift.patch.js +10 -0
  198. package/dist/runtime/server/routes/admin/shifts-bulk.post.d.ts +2 -0
  199. package/dist/runtime/server/routes/admin/shifts-bulk.post.js +10 -0
  200. package/dist/runtime/server/routes/admin/shifts.get.d.ts +2 -0
  201. package/dist/runtime/server/routes/admin/shifts.get.js +10 -0
  202. package/dist/runtime/server/routes/admin/station.delete.d.ts +2 -0
  203. package/dist/runtime/server/routes/admin/station.delete.js +11 -0
  204. package/dist/runtime/server/routes/admin/station.patch.d.ts +2 -0
  205. package/dist/runtime/server/routes/admin/station.patch.js +11 -0
  206. package/dist/runtime/server/routes/admin/stations.get.d.ts +2 -0
  207. package/dist/runtime/server/routes/admin/stations.get.js +9 -0
  208. package/dist/runtime/server/routes/admin/stations.post.d.ts +2 -0
  209. package/dist/runtime/server/routes/admin/stations.post.js +10 -0
  210. package/dist/runtime/server/routes/admin/swap-cancel.post.d.ts +2 -0
  211. package/dist/runtime/server/routes/admin/swap-cancel.post.js +10 -0
  212. package/dist/runtime/server/routes/admin/swaps.get.d.ts +2 -0
  213. package/dist/runtime/server/routes/admin/swaps.get.js +10 -0
  214. package/dist/runtime/server/routes/feed/feed.get.d.ts +2 -0
  215. package/dist/runtime/server/routes/feed/feed.get.js +9 -0
  216. package/dist/runtime/server/routes/lead/attended.post.d.ts +2 -0
  217. package/dist/runtime/server/routes/lead/attended.post.js +11 -0
  218. package/dist/runtime/server/routes/lead/broadcast.post.d.ts +2 -0
  219. package/dist/runtime/server/routes/lead/broadcast.post.js +12 -0
  220. package/dist/runtime/server/routes/lead/check-in.post.d.ts +2 -0
  221. package/dist/runtime/server/routes/lead/check-in.post.js +9 -0
  222. package/dist/runtime/server/routes/lead/exceptions.get.d.ts +2 -0
  223. package/dist/runtime/server/routes/lead/exceptions.get.js +8 -0
  224. package/dist/runtime/server/routes/lead/no-show.post.d.ts +2 -0
  225. package/dist/runtime/server/routes/lead/no-show.post.js +11 -0
  226. package/dist/runtime/server/routes/lead/now.get.d.ts +2 -0
  227. package/dist/runtime/server/routes/lead/now.get.js +9 -0
  228. package/dist/runtime/server/routes/lead/on-duty.get.d.ts +2 -0
  229. package/dist/runtime/server/routes/lead/on-duty.get.js +10 -0
  230. package/dist/runtime/server/routes/lead/stations.get.d.ts +2 -0
  231. package/dist/runtime/server/routes/lead/stations.get.js +8 -0
  232. package/dist/runtime/server/routes/lead/team-shifts.get.d.ts +2 -0
  233. package/dist/runtime/server/routes/lead/team-shifts.get.js +9 -0
  234. package/dist/runtime/server/routes/lead/team-swaps.get.d.ts +2 -0
  235. package/dist/runtime/server/routes/lead/team-swaps.get.js +9 -0
  236. package/dist/runtime/server/routes/me/check-in.post.d.ts +2 -0
  237. package/dist/runtime/server/routes/me/check-in.post.js +11 -0
  238. package/dist/runtime/server/routes/me/earned-perk-claim.post.d.ts +2 -0
  239. package/dist/runtime/server/routes/me/earned-perk-claim.post.js +10 -0
  240. package/dist/runtime/server/routes/me/earned-perks.get.d.ts +2 -0
  241. package/dist/runtime/server/routes/me/earned-perks.get.js +9 -0
  242. package/dist/runtime/server/routes/me/feed-token.delete.d.ts +2 -0
  243. package/dist/runtime/server/routes/me/feed-token.delete.js +7 -0
  244. package/dist/runtime/server/routes/me/feed-token.get.d.ts +2 -0
  245. package/dist/runtime/server/routes/me/feed-token.get.js +6 -0
  246. package/dist/runtime/server/routes/me/feed-token.post.d.ts +2 -0
  247. package/dist/runtime/server/routes/me/feed-token.post.js +7 -0
  248. package/dist/runtime/server/routes/me/leads.get.d.ts +2 -0
  249. package/dist/runtime/server/routes/me/leads.get.js +5 -0
  250. package/dist/runtime/server/routes/me/now.get.d.ts +2 -0
  251. package/dist/runtime/server/routes/me/now.get.js +5 -0
  252. package/dist/runtime/server/routes/me/pass.get.d.ts +2 -0
  253. package/dist/runtime/server/routes/me/pass.get.js +11 -0
  254. package/dist/runtime/server/routes/me/settle.post.d.ts +2 -0
  255. package/dist/runtime/server/routes/me/settle.post.js +14 -0
  256. package/dist/runtime/server/routes/me/shift.get.d.ts +2 -0
  257. package/dist/runtime/server/routes/me/shift.get.js +10 -0
  258. package/dist/runtime/server/routes/me/shifts.get.d.ts +2 -0
  259. package/dist/runtime/server/routes/me/shifts.get.js +6 -0
  260. package/dist/runtime/server/routes/me/swap.delete.d.ts +2 -0
  261. package/dist/runtime/server/routes/me/swap.delete.js +11 -0
  262. package/dist/runtime/server/routes/me/swap.post.d.ts +2 -0
  263. package/dist/runtime/server/routes/me/swap.post.js +11 -0
  264. package/dist/runtime/server/routes/stations/token.get.d.ts +2 -0
  265. package/dist/runtime/server/routes/stations/token.get.js +12 -0
  266. package/dist/runtime/server/routes/swaps/approve.post.d.ts +2 -0
  267. package/dist/runtime/server/routes/swaps/approve.post.js +9 -0
  268. package/dist/runtime/server/routes/swaps/list.get.d.ts +2 -0
  269. package/dist/runtime/server/routes/swaps/list.get.js +5 -0
  270. package/dist/runtime/server/routes/swaps/offer-accept.post.d.ts +2 -0
  271. package/dist/runtime/server/routes/swaps/offer-accept.post.js +9 -0
  272. package/dist/runtime/server/routes/swaps/offer-reject.post.d.ts +2 -0
  273. package/dist/runtime/server/routes/swaps/offer-reject.post.js +9 -0
  274. package/dist/runtime/server/routes/swaps/offer.delete.d.ts +2 -0
  275. package/dist/runtime/server/routes/swaps/offer.delete.js +11 -0
  276. package/dist/runtime/server/routes/swaps/offer.post.d.ts +2 -0
  277. package/dist/runtime/server/routes/swaps/offer.post.js +11 -0
  278. package/dist/runtime/server/routes/swaps/reject.post.d.ts +2 -0
  279. package/dist/runtime/server/routes/swaps/reject.post.js +9 -0
  280. package/dist/runtime/server/swap-email.d.ts +28 -0
  281. package/dist/runtime/server/swap-email.js +49 -0
  282. package/dist/runtime/server/tasks/close-shifts.d.ts +2 -0
  283. package/dist/runtime/server/tasks/close-shifts.js +9 -0
  284. package/dist/runtime/server/tasks/send-reminders.d.ts +2 -0
  285. package/dist/runtime/server/tasks/send-reminders.js +9 -0
  286. package/dist/runtime/server/utils/shifts-admin.d.ts +67 -0
  287. package/dist/runtime/server/utils/shifts-admin.js +312 -0
  288. package/dist/runtime/server/utils/shifts-assign.d.ts +89 -0
  289. package/dist/runtime/server/utils/shifts-assign.js +264 -0
  290. package/dist/runtime/server/utils/shifts-automation.d.ts +37 -0
  291. package/dist/runtime/server/utils/shifts-automation.js +171 -0
  292. package/dist/runtime/server/utils/shifts-broadcasts.d.ts +38 -0
  293. package/dist/runtime/server/utils/shifts-broadcasts.js +113 -0
  294. package/dist/runtime/server/utils/shifts-core.d.ts +78 -0
  295. package/dist/runtime/server/utils/shifts-core.js +142 -0
  296. package/dist/runtime/server/utils/shifts-dto.d.ts +32 -0
  297. package/dist/runtime/server/utils/shifts-dto.js +127 -0
  298. package/dist/runtime/server/utils/shifts-emails.d.ts +16 -0
  299. package/dist/runtime/server/utils/shifts-emails.js +44 -0
  300. package/dist/runtime/server/utils/shifts-exceptions.d.ts +7 -0
  301. package/dist/runtime/server/utils/shifts-exceptions.js +32 -0
  302. package/dist/runtime/server/utils/shifts-feed.d.ts +16 -0
  303. package/dist/runtime/server/utils/shifts-feed.js +73 -0
  304. package/dist/runtime/server/utils/shifts-notify.d.ts +40 -0
  305. package/dist/runtime/server/utils/shifts-notify.js +22 -0
  306. package/dist/runtime/server/utils/shifts-on-duty.d.ts +12 -0
  307. package/dist/runtime/server/utils/shifts-on-duty.js +37 -0
  308. package/dist/runtime/server/utils/shifts-perks.d.ts +46 -0
  309. package/dist/runtime/server/utils/shifts-perks.js +183 -0
  310. package/dist/runtime/server/utils/shifts-reminders.d.ts +30 -0
  311. package/dist/runtime/server/utils/shifts-reminders.js +102 -0
  312. package/dist/runtime/server/utils/shifts-schemas.d.ts +318 -0
  313. package/dist/runtime/server/utils/shifts-schemas.js +177 -0
  314. package/dist/runtime/server/utils/shifts-station-key.d.ts +7 -0
  315. package/dist/runtime/server/utils/shifts-station-key.js +22 -0
  316. package/dist/runtime/server/utils/shifts-stations.d.ts +28 -0
  317. package/dist/runtime/server/utils/shifts-stations.js +109 -0
  318. package/dist/runtime/server/utils/shifts-swaps.d.ts +114 -0
  319. package/dist/runtime/server/utils/shifts-swaps.js +559 -0
  320. package/dist/runtime/server/utils/shifts-views.d.ts +62 -0
  321. package/dist/runtime/server/utils/shifts-views.js +212 -0
  322. package/dist/runtime/utils/api.d.ts +108 -0
  323. package/dist/runtime/utils/api.js +111 -0
  324. package/dist/runtime/utils/checkin.d.ts +59 -0
  325. package/dist/runtime/utils/checkin.js +57 -0
  326. package/dist/runtime/utils/guards.d.ts +21 -0
  327. package/dist/runtime/utils/guards.js +36 -0
  328. package/dist/runtime/utils/ics.d.ts +32 -0
  329. package/dist/runtime/utils/ics.js +56 -0
  330. package/dist/runtime/utils/index.d.ts +16 -0
  331. package/dist/runtime/utils/index.js +15 -0
  332. package/dist/runtime/utils/links.d.ts +44 -0
  333. package/dist/runtime/utils/links.js +21 -0
  334. package/dist/runtime/utils/reminders.d.ts +27 -0
  335. package/dist/runtime/utils/reminders.js +28 -0
  336. package/dist/runtime/utils/settings.d.ts +28 -0
  337. package/dist/runtime/utils/settings.js +18 -0
  338. package/dist/runtime/utils/station-key.d.ts +9 -0
  339. package/dist/runtime/utils/station-key.js +12 -0
  340. package/dist/runtime/utils/status.d.ts +23 -0
  341. package/dist/runtime/utils/status.js +46 -0
  342. package/dist/runtime/utils/time.d.ts +22 -0
  343. package/dist/runtime/utils/time.js +14 -0
  344. package/dist/types.d.mts +5 -0
  345. package/package.json +131 -3
@@ -0,0 +1,124 @@
1
+ <script setup>
2
+ import { minutesInDay } from "../utils/admin-shifts";
3
+ import { computed, useModuleT, useShiftsFormat, useShiftsTranslate } from "#imports";
4
+ defineOptions({ name: "ShiftDayView" });
5
+ const props = defineProps({
6
+ shifts: { type: Array, required: true },
7
+ day: { type: String, required: true },
8
+ teams: { type: Array, required: true },
9
+ timeZone: { type: String, required: true },
10
+ minPerShift: { type: [Number, null], required: false }
11
+ });
12
+ const emit = defineEmits(["open"]);
13
+ const t = useModuleT("shifts");
14
+ const tr = useShiftsTranslate();
15
+ const format = useShiftsFormat();
16
+ const blocks = computed(() => props.shifts.map((shift) => ({
17
+ shift,
18
+ start: minutesInDay(shift.startsAt, props.day, props.timeZone),
19
+ end: minutesInDay(shift.endsAt, props.day, props.timeZone)
20
+ })));
21
+ const range = computed(() => {
22
+ if (!blocks.value.length) return { from: 8 * 60, to: 20 * 60 };
23
+ const from = Math.floor(Math.min(...blocks.value.map((block) => block.start)) / 60) * 60;
24
+ let to = Math.ceil(Math.max(...blocks.value.map((block) => block.end)) / 60) * 60;
25
+ if (to - from < 6 * 60) to = from + 6 * 60;
26
+ return { from, to };
27
+ });
28
+ const hours = computed(() => {
29
+ const list = [];
30
+ for (let minute = range.value.from; minute < range.value.to; minute += 60) list.push(minute);
31
+ return list;
32
+ });
33
+ const span = computed(() => range.value.to - range.value.from);
34
+ const rows = computed(() => {
35
+ const teamIds = [.../* @__PURE__ */ new Set([...props.teams.map((team) => team.id), ...props.shifts.map((shift) => shift.teamId)])];
36
+ return teamIds.flatMap((teamId) => {
37
+ const own = blocks.value.filter((block) => block.shift.teamId === teamId).sort((a, b) => a.start - b.start);
38
+ if (!own.length) return [];
39
+ const laneEnds = [];
40
+ const placed = own.map((block) => {
41
+ let lane = laneEnds.findIndex((end) => end <= block.start);
42
+ if (lane === -1) lane = laneEnds.push(0) - 1;
43
+ laneEnds[lane] = block.end;
44
+ return { ...block, lane };
45
+ });
46
+ const team = props.teams.find((item) => item.id === teamId);
47
+ return [{ teamId, name: team ? tr(team.name) : own[0].shift.teamName ? tr(own[0].shift.teamName) : teamId, lanes: laneEnds.length, blocks: placed }];
48
+ });
49
+ });
50
+ const LANE = 52;
51
+ const left = (minute) => `${(minute - range.value.from) / span.value * 100}%`;
52
+ const width = (block) => `${Math.max(block.end - block.start, 15) / span.value * 100}%`;
53
+ const hourLabel = (minute) => `${String((minute / 60 % 24 + 24) % 24).padStart(2, "0")}:00`;
54
+ function tone(shift) {
55
+ if (props.minPerShift && shift.filled < props.minPerShift) return "border-warning/60 bg-warning/10";
56
+ if (shift.effectiveCapacity !== null && shift.filled >= shift.effectiveCapacity) return "border-success/60 bg-success/10";
57
+ return "border-primary/50 bg-primary/10";
58
+ }
59
+ const fill = (shift) => shift.effectiveCapacity === null ? String(shift.filled) : `${shift.filled}/${shift.effectiveCapacity}`;
60
+ </script>
61
+
62
+ <template>
63
+ <div class="overflow-x-auto">
64
+ <div class="min-w-[720px]">
65
+ <div class="border-default grid grid-cols-[10rem_1fr] border-b">
66
+ <div />
67
+ <div class="relative h-7">
68
+ <span
69
+ v-for="hour in hours"
70
+ :key="hour"
71
+ class="text-muted absolute top-1 -translate-x-1/2 text-xs tabular-nums"
72
+ :style="{ left: left(hour) }"
73
+ >{{ hourLabel(hour) }}</span>
74
+ </div>
75
+ </div>
76
+ <p
77
+ v-if="!rows.length"
78
+ class="text-muted p-4 text-sm"
79
+ >
80
+ {{ t("admin.noShiftsDay", "No shifts on this day.") }}
81
+ </p>
82
+ <div
83
+ v-for="row in rows"
84
+ :key="row.teamId"
85
+ class="border-default grid grid-cols-[10rem_1fr] border-b last:border-b-0"
86
+ >
87
+ <div class="text-highlighted truncate p-2 text-sm font-medium">
88
+ {{ row.name }}
89
+ </div>
90
+ <div
91
+ class="relative"
92
+ :style="{ height: `${row.lanes * LANE + 8}px` }"
93
+ >
94
+ <div
95
+ v-for="hour in hours"
96
+ :key="hour"
97
+ class="border-default/60 absolute inset-y-0 border-s"
98
+ :style="{ left: left(hour) }"
99
+ />
100
+ <button
101
+ v-for="block in row.blocks"
102
+ :key="block.shift.id"
103
+ type="button"
104
+ class="absolute flex flex-col overflow-hidden rounded-md border px-2 py-1 text-start text-xs transition hover:brightness-95 focus-visible:outline-2"
105
+ :class="tone(block.shift)"
106
+ :style="{ left: left(block.start), width: width(block), top: `${block.lane * LANE + 4}px`, height: `${LANE - 6}px` }"
107
+ :aria-label="`${row.name} ${format.range(block.shift.startsAt, block.shift.endsAt)}`"
108
+ @click="emit('open', block.shift)"
109
+ >
110
+ <span class="text-highlighted truncate font-medium tabular-nums">{{ format.time(block.shift.startsAt) }}–{{ format.time(block.shift.endsAt) }}</span>
111
+ <span class="text-muted truncate">
112
+ <UIcon
113
+ name="i-lucide-users"
114
+ class="size-3 align-[-2px]"
115
+ />
116
+ {{ fill(block.shift) }}
117
+ <template v-if="block.shift.assignees.length"> · {{ block.shift.assignees.map((item) => item.person.name ?? "").filter(Boolean).join(", ") }}</template>
118
+ </span>
119
+ </button>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </template>
@@ -0,0 +1,16 @@
1
+ import type { ShiftsTeamOption } from '../utils/admin-shifts.js';
2
+ import type { ShiftWithAssigneesDto } from '../../../types.js';
3
+ type __VLS_Props = {
4
+ shifts: ShiftWithAssigneesDto[];
5
+ day: string;
6
+ teams: ShiftsTeamOption[];
7
+ timeZone: string;
8
+ minPerShift?: number | null;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ open: (shift: ShiftWithAssigneesDto) => any;
12
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
+ onOpen?: ((shift: ShiftWithAssigneesDto) => any) | undefined;
14
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ close: (value: false) => any;
3
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
+ onClose?: ((value: false) => any) | undefined;
5
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,172 @@
1
+ <script setup>
2
+ import { shiftsApi } from "../../utils/api";
3
+ import { $fetch, ref, useAction, useConfirmDialog, useFetch, useModuleT, useShiftsFormat, useToast } from "#imports";
4
+ defineOptions({ name: "ShiftFeedSlideover" });
5
+ const emit = defineEmits(["close"]);
6
+ const t = useModuleT("shifts");
7
+ const format = useShiftsFormat();
8
+ const confirm = useConfirmDialog();
9
+ const toast = useToast();
10
+ const { busy, run } = useAction();
11
+ const { data: status, refresh } = await useFetch(shiftsApi.me.feedToken, {
12
+ key: "shifts:feed-status",
13
+ default: () => ({ active: false, prefix: null, createdAt: null, lastUsedAt: null })
14
+ });
15
+ const minted = ref(null);
16
+ async function mint() {
17
+ if (status.value.active) {
18
+ const confirmed = await confirm({
19
+ title: t("feed.replaceTitle", "Replace the calendar link?"),
20
+ description: t("feed.replaceDescription", "The old link stops working: calendars subscribed to it stop updating until you subscribe with the new one."),
21
+ confirmText: t("feed.replace", "Replace link"),
22
+ destructive: true
23
+ });
24
+ if (!confirmed) return;
25
+ }
26
+ const result = await run(
27
+ () => $fetch(shiftsApi.me.feedToken, { method: "POST" }),
28
+ { error: t("feed.mintFailed", "Could not create the calendar link") }
29
+ );
30
+ if (result) {
31
+ minted.value = result;
32
+ await refresh();
33
+ }
34
+ }
35
+ async function revoke() {
36
+ const confirmed = await confirm({
37
+ title: t("feed.revokeTitle", "Revoke the calendar link?"),
38
+ description: t("feed.revokeDescription", "Calendars subscribed to it stop updating. You can create a new link at any time."),
39
+ confirmText: t("feed.revoke", "Revoke link"),
40
+ destructive: true
41
+ });
42
+ if (!confirmed) return;
43
+ const done = await run(
44
+ () => $fetch(shiftsApi.me.feedToken, { method: "DELETE" }).then(() => true),
45
+ { success: t("feed.revoked", "Revoked the calendar link"), error: t("feed.revokeFailed", "Could not revoke the calendar link") }
46
+ );
47
+ if (done) {
48
+ minted.value = null;
49
+ await refresh();
50
+ }
51
+ }
52
+ async function copy(value) {
53
+ try {
54
+ await navigator.clipboard.writeText(value);
55
+ toast.add({ title: t("feed.copied", "Copied the link"), color: "success" });
56
+ } catch {
57
+ toast.add({ title: t("feed.copyFailed", "Could not copy: select the link and copy it by hand"), color: "error" });
58
+ }
59
+ }
60
+ </script>
61
+
62
+ <template>
63
+ <FormSlideover
64
+ form-id="shift-feed-form"
65
+ :title="t('feed.title', 'Subscribe in calendar')"
66
+ :description="t('feed.description', 'Your shifts as a calendar feed for Apple Calendar, Google Calendar or Outlook. The link is secret: anyone who has it can see your shifts.')"
67
+ :submit-label="t('feed.close', 'Close')"
68
+ @close="emit('close', false)"
69
+ >
70
+ <div class="flex flex-col gap-4">
71
+ <template v-if="minted">
72
+ <UAlert
73
+ color="warning"
74
+ variant="subtle"
75
+ icon="i-lucide-eye-off"
76
+ :title="t('feed.onceTitle', 'Copy the link now')"
77
+ :description="t('feed.once', 'It is shown only once. If you lose it, create a new one.')"
78
+ />
79
+ <UFormField :label="t('feed.webcal', 'Calendar app link')">
80
+ <UInput
81
+ :model-value="minted.webcalUrl"
82
+ readonly
83
+ class="w-full"
84
+ :ui="{ trailing: 'pe-1' }"
85
+ >
86
+ <template #trailing>
87
+ <UButton
88
+ color="neutral"
89
+ variant="link"
90
+ size="sm"
91
+ icon="i-lucide-copy"
92
+ :aria-label="t('feed.copy', 'Copy link')"
93
+ @click="copy(minted.webcalUrl)"
94
+ />
95
+ </template>
96
+ </UInput>
97
+ </UFormField>
98
+ <UFormField
99
+ :label="t('feed.https', 'Web address')"
100
+ :description="t('feed.httpsHelp', 'For calendars that ask for a URL.')"
101
+ >
102
+ <UInput
103
+ :model-value="minted.url"
104
+ readonly
105
+ class="w-full"
106
+ :ui="{ trailing: 'pe-1' }"
107
+ >
108
+ <template #trailing>
109
+ <UButton
110
+ color="neutral"
111
+ variant="link"
112
+ size="sm"
113
+ icon="i-lucide-copy"
114
+ :aria-label="t('feed.copy', 'Copy link')"
115
+ @click="copy(minted.url)"
116
+ />
117
+ </template>
118
+ </UInput>
119
+ </UFormField>
120
+ <UButton
121
+ :to="minted.webcalUrl"
122
+ external
123
+ icon="i-lucide-calendar-plus"
124
+ :label="t('feed.open', 'Open in my calendar app')"
125
+ class="self-start"
126
+ />
127
+ </template>
128
+ <UAlert
129
+ v-else-if="status.active"
130
+ color="neutral"
131
+ variant="subtle"
132
+ icon="i-lucide-calendar-check"
133
+ :title="t('feed.active', 'Your calendar link is active')"
134
+ :description="status.lastUsedAt ? t('feed.activeSince', 'Made {made}, last read {read}. It is not shown again: replace it to get a new one.', { made: status.createdAt ? format.dateTime(status.createdAt) : '', read: format.dateTime(status.lastUsedAt) }) : t('feed.activeUnused', 'Made {made}, not read yet. It is not shown again: replace it to get a new one.', { made: status.createdAt ? format.dateTime(status.createdAt) : '' })"
135
+ />
136
+ <p
137
+ v-else
138
+ class="text-muted text-sm"
139
+ >
140
+ {{ t("feed.none", "You have no calendar link yet.") }}
141
+ </p>
142
+
143
+ <div class="flex flex-wrap gap-2">
144
+ <UButton
145
+ :loading="busy"
146
+ :color="minted ? 'neutral' : 'primary'"
147
+ :variant="minted ? 'outline' : 'solid'"
148
+ :icon="status.active ? 'i-lucide-refresh-cw' : 'i-lucide-link'"
149
+ :label="status.active ? t('feed.replace', 'Replace link') : t('feed.create', 'Create calendar link')"
150
+ @click="mint"
151
+ />
152
+ <UButton
153
+ v-if="status.active"
154
+ :disabled="busy"
155
+ color="error"
156
+ variant="outline"
157
+ icon="i-lucide-trash-2"
158
+ :label="t('feed.revoke', 'Revoke link')"
159
+ @click="revoke"
160
+ />
161
+ </div>
162
+ </div>
163
+ <template #footer="{ cancel }">
164
+ <UButton
165
+ :label="t('feed.close', 'Close')"
166
+ color="neutral"
167
+ variant="outline"
168
+ @click="cancel"
169
+ />
170
+ </template>
171
+ </FormSlideover>
172
+ </template>
@@ -0,0 +1,7 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ close: (value: false) => any;
3
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
+ onClose?: ((value: false) => any) | undefined;
5
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ operationId: string;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,83 @@
1
+ <script setup>
2
+ import { shiftsApi } from "../../utils/api";
3
+ import { computed, useLazyFetch, useModuleT, useShiftsFormat, useShiftsTranslate } from "#imports";
4
+ defineOptions({ name: "ShiftNowCard" });
5
+ const props = defineProps({
6
+ operationId: { type: String, required: true }
7
+ });
8
+ const t = useModuleT("shifts");
9
+ const tr = useShiftsTranslate();
10
+ const format = useShiftsFormat();
11
+ const { data, status, error, refresh } = useLazyFetch(() => shiftsApi.now(props.operationId), { key: computed(() => `shifts:now:${props.operationId}`) });
12
+ const loading = computed(() => status.value === "pending" && !data.value);
13
+ const nameOf = (person) => person.name ?? `#${person.userId}`;
14
+ </script>
15
+
16
+ <template>
17
+ <SectionCard
18
+ :title="t('now.title', 'Working now')"
19
+ :description="t('now.description', 'Who is on shift right now, and the lead on duty per team.')"
20
+ icon="i-lucide-radio"
21
+ :loading="loading"
22
+ >
23
+ <template #actions>
24
+ <UButton
25
+ icon="i-lucide-rotate-ccw"
26
+ color="neutral"
27
+ variant="ghost"
28
+ :aria-label="t('now.refresh', 'Refresh who is working')"
29
+ @click="refresh()"
30
+ />
31
+ </template>
32
+ <p
33
+ v-if="error"
34
+ class="text-error text-sm"
35
+ >
36
+ {{ t("now.loadFailed", "Could not load who is working.") }}
37
+ </p>
38
+ <p
39
+ v-else-if="!data?.teams.length"
40
+ class="text-muted text-sm"
41
+ >
42
+ {{ t("now.empty", "Nobody is on shift right now.") }}
43
+ </p>
44
+ <div
45
+ v-else
46
+ class="flex flex-col gap-4"
47
+ >
48
+ <div
49
+ v-for="team in data.teams"
50
+ :key="team.teamId"
51
+ class="flex flex-col gap-1"
52
+ >
53
+ <div class="flex flex-wrap items-center justify-between gap-2">
54
+ <span class="text-highlighted text-sm font-semibold">{{ tr(team.teamName) }}</span>
55
+ <UBadge
56
+ v-if="team.leads.length"
57
+ color="primary"
58
+ variant="subtle"
59
+ icon="i-lucide-shield-check"
60
+ :label="t('now.leadOnDuty', 'Lead on duty: {names}', { names: team.leads.map(nameOf).join(', ') })"
61
+ />
62
+ <UBadge
63
+ v-else
64
+ color="warning"
65
+ variant="subtle"
66
+ icon="i-lucide-shield-alert"
67
+ :label="t('now.noLead', 'No lead on duty')"
68
+ />
69
+ </div>
70
+ <ul class="text-sm">
71
+ <li
72
+ v-for="shift in team.shifts"
73
+ :key="shift.id"
74
+ class="text-muted"
75
+ >
76
+ <span class="tabular-nums">{{ format.time(shift.startsAt) }}–{{ format.time(shift.endsAt) }}</span>:
77
+ <span class="text-default">{{ shift.assignees.map((item) => nameOf(item.person) + (item.person.phone ? ` (${item.person.phone})` : "")).join(", ") || t("now.nobody", "nobody") }}</span>
78
+ </li>
79
+ </ul>
80
+ </div>
81
+ </div>
82
+ </SectionCard>
83
+ </template>
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ operationId: string;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,13 @@
1
+ type __VLS_Props = {
2
+ qr: string;
3
+ code?: string | null;
4
+ title: string;
5
+ leads: string[];
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ close: () => any;
9
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ onClose?: (() => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,79 @@
1
+ <script setup>
2
+ import { onBeforeUnmount, onMounted, useModuleT } from "#imports";
3
+ defineOptions({ name: "ShiftPassFullscreen" });
4
+ defineProps({
5
+ qr: { type: String, required: true },
6
+ code: { type: [String, null], required: false },
7
+ title: { type: String, required: true },
8
+ leads: { type: Array, required: true }
9
+ });
10
+ const emit = defineEmits(["close"]);
11
+ const t = useModuleT("shifts");
12
+ let lock = null;
13
+ async function acquire() {
14
+ try {
15
+ const wakeLock = navigator.wakeLock;
16
+ lock = await wakeLock?.request("screen") ?? null;
17
+ } catch {
18
+ lock = null;
19
+ }
20
+ }
21
+ const onVisible = () => {
22
+ if (document.visibilityState === "visible") void acquire();
23
+ };
24
+ const onKey = (event) => {
25
+ if (event.key === "Escape") emit("close");
26
+ };
27
+ onMounted(() => {
28
+ void acquire();
29
+ document.addEventListener("visibilitychange", onVisible);
30
+ document.addEventListener("keydown", onKey);
31
+ });
32
+ onBeforeUnmount(() => {
33
+ document.removeEventListener("visibilitychange", onVisible);
34
+ document.removeEventListener("keydown", onKey);
35
+ void lock?.release().catch(() => {
36
+ });
37
+ });
38
+ </script>
39
+
40
+ <template>
41
+ <div
42
+ class="fixed inset-0 z-[100] flex flex-col items-center justify-between gap-4 bg-white p-4 text-black"
43
+ role="dialog"
44
+ aria-modal="true"
45
+ :aria-label="t('shift.passLarge', 'Check-in pass, large')"
46
+ >
47
+ <div class="flex w-full items-start justify-between gap-2">
48
+ <p class="text-lg font-semibold">
49
+ {{ title }}
50
+ </p>
51
+ <UButton
52
+ color="neutral"
53
+ variant="solid"
54
+ icon="i-lucide-x"
55
+ :label="t('shift.passClose', 'Close')"
56
+ @click="emit('close')"
57
+ />
58
+ </div>
59
+ <img
60
+ :src="qr"
61
+ :alt="t('shift.passAlt', 'QR code to check in')"
62
+ class="aspect-square w-[min(92vw,62vh)] max-w-full bg-white"
63
+ >
64
+ <div class="flex flex-col items-center gap-1 text-center">
65
+ <p
66
+ v-if="code"
67
+ class="font-mono text-xs break-all text-neutral-600"
68
+ >
69
+ {{ code }}
70
+ </p>
71
+ <p
72
+ v-if="leads.length"
73
+ class="text-base"
74
+ >
75
+ {{ t("shift.leadOnDutyIs", "Lead on duty: {names}", { names: leads.join(", ") }) }}
76
+ </p>
77
+ </div>
78
+ </div>
79
+ </template>
@@ -0,0 +1,13 @@
1
+ type __VLS_Props = {
2
+ qr: string;
3
+ code?: string | null;
4
+ title: string;
5
+ leads: string[];
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ close: () => any;
9
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ onClose?: (() => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import type { ShiftsTeamOption } from '../utils/admin-shifts.js';
2
+ import type { ShiftPerkDto } from '../../../types.js';
3
+ type __VLS_Props = {
4
+ operationId: string;
5
+ teams: ShiftsTeamOption[];
6
+ perk?: ShiftPerkDto;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ close: (saved: false | ShiftPerkDto) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ onClose?: ((saved: false | ShiftPerkDto) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,103 @@
1
+ <script setup>
2
+ import { z } from "zod";
3
+ import { shiftsApi } from "../../utils/api";
4
+ import { $fetch, computed, reactive, useAction, useModuleT, useShiftsTranslate } from "#imports";
5
+ defineOptions({ name: "ShiftPerkSlideover" });
6
+ const props = defineProps({
7
+ operationId: { type: String, required: true },
8
+ teams: { type: Array, required: true },
9
+ perk: { type: Object, required: false }
10
+ });
11
+ const emit = defineEmits(["close"]);
12
+ const t = useModuleT("shifts");
13
+ const tr = useShiftsTranslate();
14
+ const { busy, run } = useAction();
15
+ const ALL = "__all__";
16
+ const schema = z.object({
17
+ name: z.custom((value) => !!value && (typeof value === "string" ? !!value.trim() : Object.values(value).some((text) => text?.trim())), t("perks.nameRequired", "Give the perk a name.")),
18
+ voucherType: z.string().trim().min(1, t("perks.voucherTypeRequired", "Name the voucher type, e.g. beer.")).max(64),
19
+ teamId: z.string(),
20
+ quantity: z.number().int().min(1, t("perks.amountMin", "At least 1.")).max(1e3)
21
+ });
22
+ const state = reactive({
23
+ name: props.perk?.name ?? "",
24
+ voucherType: props.perk?.voucherType ?? "",
25
+ teamId: props.perk?.teamId ?? ALL,
26
+ quantity: props.perk?.quantity ?? 1
27
+ });
28
+ const teamOptions = computed(() => [{ label: t("admin.allTeams", "All teams"), value: ALL }, ...props.teams.map((team) => ({ label: tr(team.name), value: team.id }))]);
29
+ async function save(event) {
30
+ const { data } = event;
31
+ const body = { name: data.name, voucherType: data.voucherType, quantity: data.quantity, teamId: data.teamId === ALL ? null : data.teamId };
32
+ const saved = await run(
33
+ () => props.perk ? $fetch(shiftsApi.admin.perk(props.perk.id), { method: "PATCH", body }) : $fetch(shiftsApi.admin.perks(props.operationId), { method: "POST", body }),
34
+ { success: t("perks.saved", "Saved {name}", { name: tr(data.name) }) }
35
+ );
36
+ if (saved) emit("close", saved);
37
+ }
38
+ </script>
39
+
40
+ <template>
41
+ <FormSlideover
42
+ form-id="shift-perk-form"
43
+ :title="perk ? t('perks.editTitle', 'Edit perk') : t('perks.newTitle', 'New perk')"
44
+ :description="t('perks.description', 'What a volunteer earns for every shift they attend. The vouchers app hands it out.')"
45
+ :submit-label="perk ? t('perks.save', 'Save perk') : t('perks.create', 'Add perk')"
46
+ :loading="busy"
47
+ @close="emit('close', false)"
48
+ >
49
+ <UForm
50
+ id="shift-perk-form"
51
+ :schema="schema"
52
+ :state="state"
53
+ class="flex flex-col gap-4"
54
+ @submit="save"
55
+ >
56
+ <UFormField
57
+ name="name"
58
+ :label="t('admin.name', 'Name')"
59
+ required
60
+ >
61
+ <TranslatedInput
62
+ v-model="state.name"
63
+ class="w-full"
64
+ />
65
+ </UFormField>
66
+ <UFormField
67
+ name="voucherType"
68
+ :label="t('perks.voucherType', 'Voucher type')"
69
+ :description="t('perks.voucherTypeHelp', 'What the vouchers app hands out, e.g. beer or meal.')"
70
+ required
71
+ >
72
+ <UInput
73
+ v-model="state.voucherType"
74
+ class="w-full"
75
+ />
76
+ </UFormField>
77
+ <UFormField
78
+ name="quantity"
79
+ :label="t('perks.quantity', 'Per shift')"
80
+ :description="t('perks.quantityHelp', 'How many one attended shift earns.')"
81
+ required
82
+ >
83
+ <UInputNumber
84
+ v-model="state.quantity"
85
+ :min="1"
86
+ :max="1e3"
87
+ class="w-full"
88
+ />
89
+ </UFormField>
90
+ <UFormField
91
+ name="teamId"
92
+ :label="t('admin.team', 'Team')"
93
+ :description="t('perks.teamHelp', 'Only shifts of this team earn it.')"
94
+ >
95
+ <USelect
96
+ v-model="state.teamId"
97
+ :items="teamOptions"
98
+ class="w-full"
99
+ />
100
+ </UFormField>
101
+ </UForm>
102
+ </FormSlideover>
103
+ </template>