@frigear-nu/shifts 0.0.0-stage → 0.0.0

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 (341) hide show
  1. package/README.md +53 -2
  2. package/dist/module.d.mts +709 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +253 -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 +169 -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 +192 -0
  96. package/dist/runtime/app/pages/swaps.vue.d.ts +3 -0
  97. package/dist/runtime/app/tabs/Shifts.d.vue.ts +9 -0
  98. package/dist/runtime/app/tabs/Shifts.vue +487 -0
  99. package/dist/runtime/app/tabs/Shifts.vue.d.ts +9 -0
  100. package/dist/runtime/app/utils/admin-shifts.d.ts +42 -0
  101. package/dist/runtime/app/utils/admin-shifts.js +36 -0
  102. package/dist/runtime/dashboard.d.ts +8 -0
  103. package/dist/runtime/dashboard.js +30 -0
  104. package/dist/runtime/emails/shifts-broadcast.d.vue.ts +8 -0
  105. package/dist/runtime/emails/shifts-broadcast.vue +24 -0
  106. package/dist/runtime/emails/shifts-broadcast.vue.d.ts +8 -0
  107. package/dist/runtime/emails/shifts-reminder.d.vue.ts +12 -0
  108. package/dist/runtime/emails/shifts-reminder.vue +34 -0
  109. package/dist/runtime/emails/shifts-reminder.vue.d.ts +12 -0
  110. package/dist/runtime/emails/shifts-swap-accepted.d.vue.ts +11 -0
  111. package/dist/runtime/emails/shifts-swap-accepted.vue +32 -0
  112. package/dist/runtime/emails/shifts-swap-accepted.vue.d.ts +11 -0
  113. package/dist/runtime/emails/shifts-swap-completed.d.vue.ts +11 -0
  114. package/dist/runtime/emails/shifts-swap-completed.vue +32 -0
  115. package/dist/runtime/emails/shifts-swap-completed.vue.d.ts +11 -0
  116. package/dist/runtime/emails/shifts-swap-offered.d.vue.ts +11 -0
  117. package/dist/runtime/emails/shifts-swap-offered.vue +32 -0
  118. package/dist/runtime/emails/shifts-swap-offered.vue.d.ts +11 -0
  119. package/dist/runtime/emails/shifts-swap-pending.d.vue.ts +11 -0
  120. package/dist/runtime/emails/shifts-swap-pending.vue +32 -0
  121. package/dist/runtime/emails/shifts-swap-pending.vue.d.ts +11 -0
  122. package/dist/runtime/emails/shifts-swap-proposed.d.vue.ts +11 -0
  123. package/dist/runtime/emails/shifts-swap-proposed.vue +32 -0
  124. package/dist/runtime/emails/shifts-swap-proposed.vue.d.ts +11 -0
  125. package/dist/runtime/emails/shifts-swap-rejected.d.vue.ts +11 -0
  126. package/dist/runtime/emails/shifts-swap-rejected.vue +32 -0
  127. package/dist/runtime/emails/shifts-swap-rejected.vue.d.ts +11 -0
  128. package/dist/runtime/i18n/lang/da.json +626 -0
  129. package/dist/runtime/i18n/lang/en.json +626 -0
  130. package/dist/runtime/menus.d.ts +2 -0
  131. package/dist/runtime/menus.js +17 -0
  132. package/dist/runtime/notifications.d.ts +9 -0
  133. package/dist/runtime/notifications.js +36 -0
  134. package/dist/runtime/server/db/schema.postgresql.d.ts +2151 -0
  135. package/dist/runtime/server/db/schema.postgresql.js +228 -0
  136. package/dist/runtime/server/db/schema.sqlite.d.ts +2263 -0
  137. package/dist/runtime/server/db/schema.sqlite.js +228 -0
  138. package/dist/runtime/server/digest-email.d.ts +17 -0
  139. package/dist/runtime/server/digest-email.js +42 -0
  140. package/dist/runtime/server/plugins/station-key.d.ts +2 -0
  141. package/dist/runtime/server/plugins/station-key.js +5 -0
  142. package/dist/runtime/server/plugins/teams.d.ts +2 -0
  143. package/dist/runtime/server/plugins/teams.js +19 -0
  144. package/dist/runtime/server/policies.d.ts +2 -0
  145. package/dist/runtime/server/policies.js +41 -0
  146. package/dist/runtime/server/reminder-email.d.ts +67 -0
  147. package/dist/runtime/server/reminder-email.js +109 -0
  148. package/dist/runtime/server/routes/admin/assignment.delete.d.ts +2 -0
  149. package/dist/runtime/server/routes/admin/assignment.delete.js +10 -0
  150. package/dist/runtime/server/routes/admin/assignments.post.d.ts +2 -0
  151. package/dist/runtime/server/routes/admin/assignments.post.js +11 -0
  152. package/dist/runtime/server/routes/admin/broadcasts.get.d.ts +2 -0
  153. package/dist/runtime/server/routes/admin/broadcasts.get.js +8 -0
  154. package/dist/runtime/server/routes/admin/broadcasts.post.d.ts +2 -0
  155. package/dist/runtime/server/routes/admin/broadcasts.post.js +9 -0
  156. package/dist/runtime/server/routes/admin/candidates.get.d.ts +2 -0
  157. package/dist/runtime/server/routes/admin/candidates.get.js +10 -0
  158. package/dist/runtime/server/routes/admin/operation-teams.get.d.ts +2 -0
  159. package/dist/runtime/server/routes/admin/operation-teams.get.js +9 -0
  160. package/dist/runtime/server/routes/admin/perk.delete.d.ts +2 -0
  161. package/dist/runtime/server/routes/admin/perk.delete.js +10 -0
  162. package/dist/runtime/server/routes/admin/perk.patch.d.ts +2 -0
  163. package/dist/runtime/server/routes/admin/perk.patch.js +10 -0
  164. package/dist/runtime/server/routes/admin/perks.get.d.ts +2 -0
  165. package/dist/runtime/server/routes/admin/perks.get.js +9 -0
  166. package/dist/runtime/server/routes/admin/perks.post.d.ts +2 -0
  167. package/dist/runtime/server/routes/admin/perks.post.js +10 -0
  168. package/dist/runtime/server/routes/admin/role.delete.d.ts +2 -0
  169. package/dist/runtime/server/routes/admin/role.delete.js +11 -0
  170. package/dist/runtime/server/routes/admin/role.patch.d.ts +2 -0
  171. package/dist/runtime/server/routes/admin/role.patch.js +11 -0
  172. package/dist/runtime/server/routes/admin/roles.get.d.ts +2 -0
  173. package/dist/runtime/server/routes/admin/roles.get.js +9 -0
  174. package/dist/runtime/server/routes/admin/roles.post.d.ts +2 -0
  175. package/dist/runtime/server/routes/admin/roles.post.js +10 -0
  176. package/dist/runtime/server/routes/admin/schedule-copy.post.d.ts +2 -0
  177. package/dist/runtime/server/routes/admin/schedule-copy.post.js +12 -0
  178. package/dist/runtime/server/routes/admin/schedule-publish.post.d.ts +2 -0
  179. package/dist/runtime/server/routes/admin/schedule-publish.post.js +9 -0
  180. package/dist/runtime/server/routes/admin/schedule.delete.d.ts +2 -0
  181. package/dist/runtime/server/routes/admin/schedule.delete.js +10 -0
  182. package/dist/runtime/server/routes/admin/schedule.get.d.ts +2 -0
  183. package/dist/runtime/server/routes/admin/schedule.get.js +9 -0
  184. package/dist/runtime/server/routes/admin/schedule.patch.d.ts +2 -0
  185. package/dist/runtime/server/routes/admin/schedule.patch.js +10 -0
  186. package/dist/runtime/server/routes/admin/schedules.get.d.ts +2 -0
  187. package/dist/runtime/server/routes/admin/schedules.get.js +10 -0
  188. package/dist/runtime/server/routes/admin/schedules.post.d.ts +2 -0
  189. package/dist/runtime/server/routes/admin/schedules.post.js +9 -0
  190. package/dist/runtime/server/routes/admin/shift.delete.d.ts +2 -0
  191. package/dist/runtime/server/routes/admin/shift.delete.js +10 -0
  192. package/dist/runtime/server/routes/admin/shift.patch.d.ts +2 -0
  193. package/dist/runtime/server/routes/admin/shift.patch.js +10 -0
  194. package/dist/runtime/server/routes/admin/shifts-bulk.post.d.ts +2 -0
  195. package/dist/runtime/server/routes/admin/shifts-bulk.post.js +10 -0
  196. package/dist/runtime/server/routes/admin/shifts.get.d.ts +2 -0
  197. package/dist/runtime/server/routes/admin/shifts.get.js +10 -0
  198. package/dist/runtime/server/routes/admin/station.delete.d.ts +2 -0
  199. package/dist/runtime/server/routes/admin/station.delete.js +11 -0
  200. package/dist/runtime/server/routes/admin/station.patch.d.ts +2 -0
  201. package/dist/runtime/server/routes/admin/station.patch.js +11 -0
  202. package/dist/runtime/server/routes/admin/stations.get.d.ts +2 -0
  203. package/dist/runtime/server/routes/admin/stations.get.js +9 -0
  204. package/dist/runtime/server/routes/admin/stations.post.d.ts +2 -0
  205. package/dist/runtime/server/routes/admin/stations.post.js +10 -0
  206. package/dist/runtime/server/routes/admin/swap-cancel.post.d.ts +2 -0
  207. package/dist/runtime/server/routes/admin/swap-cancel.post.js +10 -0
  208. package/dist/runtime/server/routes/admin/swaps.get.d.ts +2 -0
  209. package/dist/runtime/server/routes/admin/swaps.get.js +10 -0
  210. package/dist/runtime/server/routes/feed/feed.get.d.ts +2 -0
  211. package/dist/runtime/server/routes/feed/feed.get.js +9 -0
  212. package/dist/runtime/server/routes/lead/attended.post.d.ts +2 -0
  213. package/dist/runtime/server/routes/lead/attended.post.js +11 -0
  214. package/dist/runtime/server/routes/lead/broadcast.post.d.ts +2 -0
  215. package/dist/runtime/server/routes/lead/broadcast.post.js +12 -0
  216. package/dist/runtime/server/routes/lead/check-in.post.d.ts +2 -0
  217. package/dist/runtime/server/routes/lead/check-in.post.js +9 -0
  218. package/dist/runtime/server/routes/lead/exceptions.get.d.ts +2 -0
  219. package/dist/runtime/server/routes/lead/exceptions.get.js +8 -0
  220. package/dist/runtime/server/routes/lead/no-show.post.d.ts +2 -0
  221. package/dist/runtime/server/routes/lead/no-show.post.js +11 -0
  222. package/dist/runtime/server/routes/lead/now.get.d.ts +2 -0
  223. package/dist/runtime/server/routes/lead/now.get.js +9 -0
  224. package/dist/runtime/server/routes/lead/on-duty.get.d.ts +2 -0
  225. package/dist/runtime/server/routes/lead/on-duty.get.js +10 -0
  226. package/dist/runtime/server/routes/lead/stations.get.d.ts +2 -0
  227. package/dist/runtime/server/routes/lead/stations.get.js +8 -0
  228. package/dist/runtime/server/routes/lead/team-shifts.get.d.ts +2 -0
  229. package/dist/runtime/server/routes/lead/team-shifts.get.js +9 -0
  230. package/dist/runtime/server/routes/lead/team-swaps.get.d.ts +2 -0
  231. package/dist/runtime/server/routes/lead/team-swaps.get.js +9 -0
  232. package/dist/runtime/server/routes/me/check-in.post.d.ts +2 -0
  233. package/dist/runtime/server/routes/me/check-in.post.js +11 -0
  234. package/dist/runtime/server/routes/me/earned-perk-claim.post.d.ts +2 -0
  235. package/dist/runtime/server/routes/me/earned-perk-claim.post.js +10 -0
  236. package/dist/runtime/server/routes/me/earned-perks.get.d.ts +2 -0
  237. package/dist/runtime/server/routes/me/earned-perks.get.js +9 -0
  238. package/dist/runtime/server/routes/me/feed-token.delete.d.ts +2 -0
  239. package/dist/runtime/server/routes/me/feed-token.delete.js +7 -0
  240. package/dist/runtime/server/routes/me/feed-token.get.d.ts +2 -0
  241. package/dist/runtime/server/routes/me/feed-token.get.js +6 -0
  242. package/dist/runtime/server/routes/me/feed-token.post.d.ts +2 -0
  243. package/dist/runtime/server/routes/me/feed-token.post.js +7 -0
  244. package/dist/runtime/server/routes/me/leads.get.d.ts +2 -0
  245. package/dist/runtime/server/routes/me/leads.get.js +5 -0
  246. package/dist/runtime/server/routes/me/now.get.d.ts +2 -0
  247. package/dist/runtime/server/routes/me/now.get.js +5 -0
  248. package/dist/runtime/server/routes/me/pass.get.d.ts +2 -0
  249. package/dist/runtime/server/routes/me/pass.get.js +11 -0
  250. package/dist/runtime/server/routes/me/settle.post.d.ts +2 -0
  251. package/dist/runtime/server/routes/me/settle.post.js +14 -0
  252. package/dist/runtime/server/routes/me/shift.get.d.ts +2 -0
  253. package/dist/runtime/server/routes/me/shift.get.js +10 -0
  254. package/dist/runtime/server/routes/me/shifts.get.d.ts +2 -0
  255. package/dist/runtime/server/routes/me/shifts.get.js +6 -0
  256. package/dist/runtime/server/routes/me/swap.delete.d.ts +2 -0
  257. package/dist/runtime/server/routes/me/swap.delete.js +11 -0
  258. package/dist/runtime/server/routes/me/swap.post.d.ts +2 -0
  259. package/dist/runtime/server/routes/me/swap.post.js +11 -0
  260. package/dist/runtime/server/routes/stations/token.get.d.ts +2 -0
  261. package/dist/runtime/server/routes/stations/token.get.js +12 -0
  262. package/dist/runtime/server/routes/swaps/approve.post.d.ts +2 -0
  263. package/dist/runtime/server/routes/swaps/approve.post.js +9 -0
  264. package/dist/runtime/server/routes/swaps/list.get.d.ts +2 -0
  265. package/dist/runtime/server/routes/swaps/list.get.js +5 -0
  266. package/dist/runtime/server/routes/swaps/offer-accept.post.d.ts +2 -0
  267. package/dist/runtime/server/routes/swaps/offer-accept.post.js +9 -0
  268. package/dist/runtime/server/routes/swaps/offer-reject.post.d.ts +2 -0
  269. package/dist/runtime/server/routes/swaps/offer-reject.post.js +9 -0
  270. package/dist/runtime/server/routes/swaps/offer.delete.d.ts +2 -0
  271. package/dist/runtime/server/routes/swaps/offer.delete.js +11 -0
  272. package/dist/runtime/server/routes/swaps/offer.post.d.ts +2 -0
  273. package/dist/runtime/server/routes/swaps/offer.post.js +11 -0
  274. package/dist/runtime/server/routes/swaps/reject.post.d.ts +2 -0
  275. package/dist/runtime/server/routes/swaps/reject.post.js +9 -0
  276. package/dist/runtime/server/swap-email.d.ts +28 -0
  277. package/dist/runtime/server/swap-email.js +49 -0
  278. package/dist/runtime/server/tasks/close-shifts.d.ts +2 -0
  279. package/dist/runtime/server/tasks/close-shifts.js +9 -0
  280. package/dist/runtime/server/tasks/send-reminders.d.ts +2 -0
  281. package/dist/runtime/server/tasks/send-reminders.js +9 -0
  282. package/dist/runtime/server/utils/shifts-admin.d.ts +67 -0
  283. package/dist/runtime/server/utils/shifts-admin.js +312 -0
  284. package/dist/runtime/server/utils/shifts-assign.d.ts +89 -0
  285. package/dist/runtime/server/utils/shifts-assign.js +264 -0
  286. package/dist/runtime/server/utils/shifts-automation.d.ts +37 -0
  287. package/dist/runtime/server/utils/shifts-automation.js +171 -0
  288. package/dist/runtime/server/utils/shifts-broadcasts.d.ts +38 -0
  289. package/dist/runtime/server/utils/shifts-broadcasts.js +113 -0
  290. package/dist/runtime/server/utils/shifts-core.d.ts +78 -0
  291. package/dist/runtime/server/utils/shifts-core.js +142 -0
  292. package/dist/runtime/server/utils/shifts-dto.d.ts +32 -0
  293. package/dist/runtime/server/utils/shifts-dto.js +127 -0
  294. package/dist/runtime/server/utils/shifts-emails.d.ts +16 -0
  295. package/dist/runtime/server/utils/shifts-emails.js +44 -0
  296. package/dist/runtime/server/utils/shifts-exceptions.d.ts +7 -0
  297. package/dist/runtime/server/utils/shifts-exceptions.js +32 -0
  298. package/dist/runtime/server/utils/shifts-feed.d.ts +16 -0
  299. package/dist/runtime/server/utils/shifts-feed.js +73 -0
  300. package/dist/runtime/server/utils/shifts-notify.d.ts +40 -0
  301. package/dist/runtime/server/utils/shifts-notify.js +22 -0
  302. package/dist/runtime/server/utils/shifts-on-duty.d.ts +12 -0
  303. package/dist/runtime/server/utils/shifts-on-duty.js +37 -0
  304. package/dist/runtime/server/utils/shifts-perks.d.ts +46 -0
  305. package/dist/runtime/server/utils/shifts-perks.js +183 -0
  306. package/dist/runtime/server/utils/shifts-reminders.d.ts +30 -0
  307. package/dist/runtime/server/utils/shifts-reminders.js +102 -0
  308. package/dist/runtime/server/utils/shifts-schemas.d.ts +318 -0
  309. package/dist/runtime/server/utils/shifts-schemas.js +177 -0
  310. package/dist/runtime/server/utils/shifts-station-key.d.ts +7 -0
  311. package/dist/runtime/server/utils/shifts-station-key.js +22 -0
  312. package/dist/runtime/server/utils/shifts-stations.d.ts +28 -0
  313. package/dist/runtime/server/utils/shifts-stations.js +109 -0
  314. package/dist/runtime/server/utils/shifts-swaps.d.ts +114 -0
  315. package/dist/runtime/server/utils/shifts-swaps.js +559 -0
  316. package/dist/runtime/server/utils/shifts-views.d.ts +62 -0
  317. package/dist/runtime/server/utils/shifts-views.js +212 -0
  318. package/dist/runtime/utils/api.d.ts +108 -0
  319. package/dist/runtime/utils/api.js +111 -0
  320. package/dist/runtime/utils/checkin.d.ts +59 -0
  321. package/dist/runtime/utils/checkin.js +57 -0
  322. package/dist/runtime/utils/guards.d.ts +21 -0
  323. package/dist/runtime/utils/guards.js +36 -0
  324. package/dist/runtime/utils/ics.d.ts +32 -0
  325. package/dist/runtime/utils/ics.js +56 -0
  326. package/dist/runtime/utils/index.d.ts +16 -0
  327. package/dist/runtime/utils/index.js +15 -0
  328. package/dist/runtime/utils/links.d.ts +30 -0
  329. package/dist/runtime/utils/links.js +18 -0
  330. package/dist/runtime/utils/reminders.d.ts +27 -0
  331. package/dist/runtime/utils/reminders.js +28 -0
  332. package/dist/runtime/utils/settings.d.ts +28 -0
  333. package/dist/runtime/utils/settings.js +18 -0
  334. package/dist/runtime/utils/station-key.d.ts +9 -0
  335. package/dist/runtime/utils/station-key.js +12 -0
  336. package/dist/runtime/utils/status.d.ts +23 -0
  337. package/dist/runtime/utils/status.js +46 -0
  338. package/dist/runtime/utils/time.d.ts +22 -0
  339. package/dist/runtime/utils/time.js +14 -0
  340. package/dist/types.d.mts +5 -0
  341. package/package.json +131 -3
@@ -0,0 +1,224 @@
1
+ import ShiftBroadcastSlideover from "../components/ShiftBroadcastSlideover.vue";
2
+ import ShiftBulkSlideover from "../components/ShiftBulkSlideover.vue";
3
+ import ShiftCopySlideover from "../components/ShiftCopySlideover.vue";
4
+ import ShiftFeedSlideover from "../components/ShiftFeedSlideover.vue";
5
+ import ShiftPerkSlideover from "../components/ShiftPerkSlideover.vue";
6
+ import ShiftRoleSlideover from "../components/ShiftRoleSlideover.vue";
7
+ import ShiftScheduleSlideover from "../components/ShiftScheduleSlideover.vue";
8
+ import ShiftSlideover from "../components/ShiftSlideover.vue";
9
+ import ShiftStationSlideover from "../components/ShiftStationSlideover.vue";
10
+ import { shiftsApi } from "../../utils/api.js";
11
+ import { allowsSwapKind, offerKind } from "../../utils/settings.js";
12
+ import { $fetch, navigateTo, useAction, useConfirmDialog, useModuleT, useOverlay, useShiftsFormat, useShiftsLinks, useShiftsTranslate } from "#imports";
13
+ export function useShiftsActions() {
14
+ const t = useModuleT("shifts");
15
+ const tr = useShiftsTranslate();
16
+ const format = useShiftsFormat();
17
+ const overlay = useOverlay();
18
+ const confirm = useConfirmDialog();
19
+ const { run } = useAction();
20
+ const links = useShiftsLinks();
21
+ const createSchedule = async (operationId) => await overlay.create(ShiftScheduleSlideover, { destroyOnClose: true, props: { operationId } }).open();
22
+ const editSchedule = async (schedule) => await overlay.create(ShiftScheduleSlideover, { destroyOnClose: true, props: { operationId: schedule.operationId, schedule } }).open();
23
+ async function saveScheduleSettings(schedule, settings) {
24
+ return await run(
25
+ () => $fetch(shiftsApi.admin.schedule(schedule.id), { method: "PATCH", body: settings }),
26
+ { success: t("admin.settingsSaved", "Saved the settings of {name}", { name: tr(schedule.name) }), error: t("admin.settingsFailed", "Could not save the settings") }
27
+ ) ?? false;
28
+ }
29
+ function settingsLabel(settings) {
30
+ const handover = settings.coverage === "all" ? t("admin.settingsAll", "Every shift, trade only") : settings.handover === "trade" ? t("admin.settingsTrade", "Trade only") : settings.handover === "release" ? t("admin.settingsRelease", "Give away only") : t("admin.settingsBoth", "Trade or give away");
31
+ const approval = settings.approval === "lead" ? t("admin.approvals.lead", "A lead approves") : t("admin.approvals.peer", "Between volunteers");
32
+ return `${handover} \xB7 ${approval}`;
33
+ }
34
+ function swapSummary(swap) {
35
+ const accepted = swap.offers?.find((offer) => offer.status === "accepted");
36
+ const names = { from: swap.owner.name ?? "", to: accepted?.person?.name ?? "" };
37
+ const back = accepted?.offeredShift;
38
+ return back ? t("swaps.tradesWith", "{from} trades it with {to} for {team}, {when}", { ...names, team: tr(back.teamName), when: format.range(back.startsAt, back.endsAt) }) : t("swaps.fromTo", "{from} gives it to {to}", names);
39
+ }
40
+ function swapAllowed(swap) {
41
+ const accepted = swap.offers?.find((offer) => offer.status === "accepted");
42
+ return allowsSwapKind(swap.settings, accepted ? offerKind(accepted) : swap.kind);
43
+ }
44
+ async function publishSchedule(schedule) {
45
+ const name = tr(schedule.name);
46
+ const confirmed = await confirm({
47
+ title: t("admin.publishTitle", "Publish {name}?", { name }),
48
+ description: t("admin.publishDescription", "Volunteers see their shifts in it and can swap them. A published schedule cannot go back to draft."),
49
+ confirmText: t("admin.publishAction", "Publish schedule")
50
+ });
51
+ if (!confirmed) return false;
52
+ return await run(
53
+ () => $fetch(shiftsApi.admin.publish(schedule.id), { method: "POST" }),
54
+ { success: t("admin.published", "Published {name}", { name }), error: t("admin.publishFailed", "Could not publish the schedule") }
55
+ ) ?? false;
56
+ }
57
+ async function deleteSchedule(schedule) {
58
+ const name = tr(schedule.name);
59
+ const confirmed = await confirm({
60
+ title: t("admin.deleteScheduleTitle", "Delete {name}?", { name }),
61
+ description: t("admin.deleteScheduleDescription", "Its shift roles and shifts are deleted too. A schedule with people on its shifts cannot be deleted."),
62
+ confirmText: t("admin.deleteSchedule", "Delete schedule"),
63
+ destructive: true
64
+ });
65
+ if (!confirmed) return false;
66
+ return await run(
67
+ () => $fetch(shiftsApi.admin.schedule(schedule.id), { method: "DELETE" }).then(() => true),
68
+ { success: t("admin.scheduleDeleted", "Deleted {name}", { name }), error: t("admin.deleteScheduleFailed", "Could not delete the schedule") }
69
+ ) === true;
70
+ }
71
+ const bulkCreate = async (schedule, context) => await overlay.create(ShiftBulkSlideover, { destroyOnClose: true, props: { scheduleId: schedule.id, operationId: schedule.operationId, teams: context.teams, roles: context.roles } }).open();
72
+ const copyFrom = async (schedule) => await overlay.create(ShiftCopySlideover, { destroyOnClose: true, props: { schedule } }).open();
73
+ const createRole = async (schedule, context) => await overlay.create(ShiftRoleSlideover, { destroyOnClose: true, props: { scheduleId: schedule.id, teams: context.teams, ladders: context.ladders } }).open();
74
+ const editRole = async (role, context) => await overlay.create(ShiftRoleSlideover, { destroyOnClose: true, props: { scheduleId: role.scheduleId, teams: context.teams, ladders: context.ladders, role } }).open();
75
+ async function deleteRole(role) {
76
+ const name = tr(role.name);
77
+ const confirmed = await confirm({
78
+ title: t("admin.deleteRoleTitle", "Delete the role {name}?", { name }),
79
+ description: t("admin.deleteRoleDescription", "A role that shifts or assignments use cannot be deleted."),
80
+ confirmText: t("admin.deleteRole", "Delete shift role"),
81
+ destructive: true
82
+ });
83
+ if (!confirmed) return false;
84
+ return await run(
85
+ () => $fetch(shiftsApi.admin.role(role.id), { method: "DELETE" }).then(() => true),
86
+ { success: t("admin.roleDeleted", "Deleted {name}", { name }), error: t("admin.deleteRoleFailed", "Could not delete the shift role") }
87
+ ) === true;
88
+ }
89
+ const openShift = async (shift, context) => await overlay.create(ShiftSlideover, { destroyOnClose: true, props: { shift, roles: context.roles, minPerShift: context.minPerShift ?? null } }).open();
90
+ async function deleteShift(shift) {
91
+ const confirmed = await confirm({
92
+ title: t("admin.deleteShiftTitle", "Delete this shift?"),
93
+ description: t("admin.deleteShiftDescription", "A shift with people on it cannot be deleted: take them off first."),
94
+ confirmText: t("admin.deleteShift", "Delete shift"),
95
+ destructive: true
96
+ });
97
+ if (!confirmed) return false;
98
+ return await run(
99
+ () => $fetch(shiftsApi.admin.shift(shift.id), { method: "DELETE" }).then(() => true),
100
+ { success: t("admin.shiftDeleted", "Deleted the shift"), error: t("admin.deleteShiftFailed", "Could not delete the shift") }
101
+ ) === true;
102
+ }
103
+ async function approveSwap(swap) {
104
+ return await run(
105
+ () => $fetch(shiftsApi.approveSwap(swap.id), { method: "POST" }).then(() => true),
106
+ { success: t("swaps.approved", "Approved the swap of {name}", { name: swap.owner.name ?? "" }), error: t("swaps.approveFailed", "Could not approve the swap") }
107
+ ) === true;
108
+ }
109
+ async function rejectSwap(swap) {
110
+ const confirmed = await confirm({
111
+ title: t("swaps.rejectTitle", "Reject this swap?"),
112
+ description: t("swaps.rejectDescription", "Both people keep their shifts, and the shift is open for other offers again."),
113
+ confirmText: t("swaps.rejectAction", "Reject swap"),
114
+ destructive: true
115
+ });
116
+ if (!confirmed) return false;
117
+ return await run(
118
+ () => $fetch(shiftsApi.rejectSwap(swap.id), { method: "POST" }).then(() => true),
119
+ { success: t("swaps.rejected", "Rejected the swap"), error: t("swaps.rejectFailed", "Could not reject the swap") }
120
+ ) === true;
121
+ }
122
+ const subscribe = async () => {
123
+ await overlay.create(ShiftFeedSlideover, { destroyOnClose: true }).open();
124
+ };
125
+ const broadcast = async (operationId, context) => await overlay.create(ShiftBroadcastSlideover, { destroyOnClose: true, props: { operationId, teams: context.teams, ladders: context.ladders } }).open();
126
+ const broadcastToTeam = async (teamId, teamName) => await overlay.create(ShiftBroadcastSlideover, { destroyOnClose: true, props: { teamId, teamName } }).open();
127
+ const createPerk = async (operationId, teams) => await overlay.create(ShiftPerkSlideover, { destroyOnClose: true, props: { operationId, teams } }).open();
128
+ const editPerk = async (perk, teams) => await overlay.create(ShiftPerkSlideover, { destroyOnClose: true, props: { operationId: perk.operationId, teams, perk } }).open();
129
+ async function deletePerk(perk) {
130
+ const name = tr(perk.name);
131
+ const confirmed = await confirm({
132
+ title: t("perks.deleteTitle", "Delete {name}?", { name }),
133
+ description: t("perks.deleteDescription", "Shifts no longer earn it. A perk somebody earned already cannot be deleted: change it instead."),
134
+ confirmText: t("perks.delete", "Delete perk"),
135
+ destructive: true
136
+ });
137
+ if (!confirmed) return false;
138
+ return await run(
139
+ () => $fetch(shiftsApi.admin.perk(perk.id), { method: "DELETE" }).then(() => true),
140
+ { success: t("perks.deleted", "Deleted {name}", { name }), error: t("perks.deleteFailed", "Could not delete the perk") }
141
+ ) === true;
142
+ }
143
+ function perkMenu(perk, context) {
144
+ return [
145
+ [{ label: t("perks.editTitle", "Edit perk"), icon: "i-lucide-pencil", onSelect: async () => await editPerk(perk, context.teams) && context.changed() }],
146
+ [{ label: t("perks.delete", "Delete perk"), icon: "i-lucide-trash-2", color: "error", onSelect: async () => await deletePerk(perk) && context.changed() }]
147
+ ];
148
+ }
149
+ const createStation = async (schedule, teams) => await overlay.create(ShiftStationSlideover, { destroyOnClose: true, props: { scheduleId: schedule.id, operationId: schedule.operationId, teams } }).open();
150
+ const editStation = async (station, schedule, teams) => await overlay.create(ShiftStationSlideover, { destroyOnClose: true, props: { scheduleId: schedule.id, operationId: schedule.operationId, teams, station } }).open();
151
+ async function deleteStation(station) {
152
+ const name = tr(station.name);
153
+ const confirmed = await confirm({
154
+ title: t("stations.deleteTitle", "Delete {name}?", { name }),
155
+ description: t("stations.deleteDescription", "Its screen stops working at once. Volunteers check in at another station, by location or with a lead."),
156
+ confirmText: t("stations.delete", "Delete station"),
157
+ destructive: true
158
+ });
159
+ if (!confirmed) return false;
160
+ return await run(
161
+ () => $fetch(shiftsApi.admin.station(station.id), { method: "DELETE" }).then(() => true),
162
+ { success: t("stations.deleted", "Deleted {name}", { name }), error: t("stations.deleteFailed", "Could not delete the station") }
163
+ ) === true;
164
+ }
165
+ function stationMenu(station, context) {
166
+ return [
167
+ [{ label: t("stations.open", "Open station screen"), icon: "i-lucide-qr-code", onSelect: () => navigateTo(links.station(station.id)) }],
168
+ [{ label: t("stations.editTitle", "Edit station"), icon: "i-lucide-pencil", onSelect: async () => await editStation(station, context.schedule, context.teams) && context.changed() }],
169
+ [{ label: t("stations.delete", "Delete station"), icon: "i-lucide-trash-2", color: "error", onSelect: async () => await deleteStation(station) && context.changed() }]
170
+ ];
171
+ }
172
+ function scheduleMenu(schedule, handlers) {
173
+ const after = async (result) => {
174
+ if (result) await handlers.changed();
175
+ };
176
+ return [
177
+ [{ label: t("admin.openSchedule", "Open schedule"), icon: "i-lucide-arrow-right", onSelect: () => handlers.open() }],
178
+ [
179
+ { label: t("admin.editSchedule", "Edit schedule"), icon: "i-lucide-pencil", onSelect: async () => after(await editSchedule(schedule)) },
180
+ { label: t("admin.copyTitle", "Copy from another schedule"), icon: "i-lucide-copy", onSelect: async () => after(await copyFrom(schedule)) },
181
+ ...schedule.status === "draft" ? [{ label: t("admin.publishAction", "Publish schedule"), icon: "i-lucide-send", onSelect: async () => after(await publishSchedule(schedule)) }] : []
182
+ ],
183
+ [{ label: t("admin.deleteSchedule", "Delete schedule"), icon: "i-lucide-trash-2", color: "error", onSelect: async () => after(await deleteSchedule(schedule)) }]
184
+ ];
185
+ }
186
+ function roleMenu(role, context) {
187
+ return [
188
+ [{ label: t("admin.editRole", "Edit shift role"), icon: "i-lucide-pencil", onSelect: async () => await editRole(role, context) && context.changed() }],
189
+ [{ label: t("admin.deleteRole", "Delete shift role"), icon: "i-lucide-trash-2", color: "error", onSelect: async () => await deleteRole(role) && context.changed() }]
190
+ ];
191
+ }
192
+ return {
193
+ createSchedule,
194
+ editSchedule,
195
+ saveScheduleSettings,
196
+ settingsLabel,
197
+ publishSchedule,
198
+ deleteSchedule,
199
+ bulkCreate,
200
+ copyFrom,
201
+ createRole,
202
+ editRole,
203
+ deleteRole,
204
+ openShift,
205
+ deleteShift,
206
+ approveSwap,
207
+ rejectSwap,
208
+ swapSummary,
209
+ swapAllowed,
210
+ scheduleMenu,
211
+ roleMenu,
212
+ subscribe,
213
+ broadcast,
214
+ broadcastToTeam,
215
+ createPerk,
216
+ editPerk,
217
+ deletePerk,
218
+ perkMenu,
219
+ createStation,
220
+ editStation,
221
+ deleteStation,
222
+ stationMenu
223
+ };
224
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Date formatters for shift times, in the shifts time zone (`shifts.timeZone`, else the app's), so every viewer sees the local times of
3
+ * the operation, whatever their own time zone: `time`, `range` (a shift's start and end with the date) and `day` (a
4
+ * `YYYY-MM-DD` day as a long date).
5
+ */
6
+ export declare function useShiftsFormat(): {
7
+ timeZone: string;
8
+ time: (value: string | Date) => any;
9
+ dateTime: (value: string | Date) => any;
10
+ range: (start: string | Date, end: string | Date) => any;
11
+ day: (day: string, options?: Intl.DateTimeFormatOptions) => any;
12
+ };
@@ -0,0 +1,14 @@
1
+ import { useAppConfig, useFormat, useRuntimeConfig } from "#imports";
2
+ import { resolveShiftsTimeZone } from "../../utils/time.js";
3
+ export function useShiftsFormat() {
4
+ const format = useFormat();
5
+ const timeZone = resolveShiftsTimeZone(useRuntimeConfig().public.shifts?.timeZone, useAppConfig());
6
+ return {
7
+ timeZone,
8
+ time: (value) => format.time(value, { timeZone }),
9
+ dateTime: (value) => format.dateTime(value, { timeZone }),
10
+ range: (start, end) => format.dateRange(start, end, { dateStyle: "medium", timeStyle: "short", timeZone }),
11
+ // Noon UTC stays on the same calendar day in every zone; `dateStyle` is cleared: it cannot be combined with parts.
12
+ day: (day, options = { weekday: "long", day: "numeric", month: "long" }) => format.date(`${day}T12:00:00Z`, { dateStyle: void 0, timeZone: "UTC", ...options })
13
+ };
14
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Locale-aware links to the shifts pages (my shifts, one shift, swaps, the check-in scanner). They keep the locale prefix
3
+ * and follow `shifts.settings.pages`.
4
+ */
5
+ export declare function useShiftsLinks(): {
6
+ shifts: () => string;
7
+ shift: (assignmentId: string) => string;
8
+ swaps: () => string;
9
+ checkIn: (teamId: string) => string;
10
+ lead: (teamId: string) => string;
11
+ station: (stationId: string) => string;
12
+ };
@@ -0,0 +1,6 @@
1
+ import { createShiftsLinks } from "../../utils/links.js";
2
+ import { useLocaleLink, useRuntimeConfig } from "#imports";
3
+ export function useShiftsLinks() {
4
+ const { localize } = useLocaleLink();
5
+ return createShiftsLinks(useRuntimeConfig().public.shifts?.pages, localize);
6
+ }
@@ -0,0 +1,5 @@
1
+ import type { Translated } from '../../../types.js';
2
+ /** Locale for translated texts: `@nuxtjs/i18n`'s when installed, otherwise `en`. */
3
+ export declare function useShiftsLocale(): import("vue").ComputedRef<string>;
4
+ /** `tr(value)`: a translated text in the current locale, falling back to the default locale, then `en`, then any. */
5
+ export declare function useShiftsTranslate(): (value: Translated | null | undefined) => string;
@@ -0,0 +1,12 @@
1
+ import { translate } from "../../utils/index.js";
2
+ import { computed, useNuxtApp } from "#imports";
3
+ export function useShiftsLocale() {
4
+ const nuxtApp = useNuxtApp();
5
+ return computed(() => nuxtApp.$i18n?.locale?.value ?? "en");
6
+ }
7
+ export function useShiftsTranslate() {
8
+ const locale = useShiftsLocale();
9
+ const nuxtApp = useNuxtApp();
10
+ const fallback = computed(() => nuxtApp.$i18n?.defaultLocale ?? "en");
11
+ return (value) => translate(value, locale.value, fallback.value);
12
+ }
@@ -0,0 +1,17 @@
1
+ import type { MaybeRefOrGetter } from 'vue';
2
+ /** The value of a "no feature" option in the selects (a select item cannot be empty). */
3
+ export declare const SHIFTS_NO_FEATURE = "__none__";
4
+ /**
5
+ * The features of an operation's venue layout as select options (label, else kind and id), for the `featureId` pickers of
6
+ * shifts and stations. `kind` narrows to one feature kind (`operations.station`). Loaded lazily; staff only.
7
+ */
8
+ export declare function useShiftsVenueFeatures(operationId: MaybeRefOrGetter<string>, options?: {
9
+ kind?: string;
10
+ }): {
11
+ features: import("vue").ComputedRef<import("@frigear-nu/maps/utils").PlaneFeature[]>;
12
+ items: import("vue").ComputedRef<{
13
+ label: any;
14
+ value: string;
15
+ }[]>;
16
+ status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
17
+ };
@@ -0,0 +1,18 @@
1
+ import { operationsApi } from "@frigear-nu/operations/api";
2
+ import { computed, toValue, useLazyFetch, useModuleT, useShiftsTranslate } from "#imports";
3
+ export const SHIFTS_NO_FEATURE = "__none__";
4
+ export function useShiftsVenueFeatures(operationId, options = {}) {
5
+ const t = useModuleT("shifts");
6
+ const tr = useShiftsTranslate();
7
+ const { data, status } = useLazyFetch(() => operationsApi.admin.venueLayout(toValue(operationId) || "_"), {
8
+ key: computed(() => `shifts:venue-layout:${toValue(operationId)}`),
9
+ immediate: !!toValue(operationId),
10
+ server: false
11
+ });
12
+ const features = computed(() => (data.value?.features ?? []).filter((feature) => !options.kind || feature.kind === options.kind));
13
+ const items = computed(() => [
14
+ { label: t("admin.noFeature", "No place on the venue layout"), value: SHIFTS_NO_FEATURE },
15
+ ...features.value.map((feature) => ({ label: (feature.label ? tr(feature.label) : "") || `${feature.kind} \xB7 ${feature.id}`, value: feature.id }))
16
+ ]);
17
+ return { features, items, status };
18
+ }
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,69 @@
1
+ <script setup>
2
+ import { shiftsApi } from "../../utils/api";
3
+ import { computed, surfaceClass, useLazyFetch, useModuleT, useShiftsFormat, useShiftsLinks, useShiftsTranslate } from "#imports";
4
+ defineOptions({ name: "ShiftsNextItem" });
5
+ const t = useModuleT("shifts");
6
+ const tr = useShiftsTranslate();
7
+ const format = useShiftsFormat();
8
+ const links = useShiftsLinks();
9
+ const { data, status, error } = useLazyFetch(shiftsApi.me.shifts, {
10
+ key: "shifts:dashboard:next",
11
+ query: { from: (/* @__PURE__ */ new Date()).toISOString() },
12
+ default: () => [],
13
+ onResponseError: () => {
14
+ }
15
+ });
16
+ const loading = computed(() => status.value === "pending" && !data.value?.length);
17
+ const next = computed(() => (data.value ?? []).find((item) => item.assignment.status === "assigned" || item.assignment.status === "attended"));
18
+ const running = computed(() => !!next.value && Date.parse(next.value.shift.startsAt) <= Date.now());
19
+ </script>
20
+
21
+ <template>
22
+ <div
23
+ v-if="loading"
24
+ :class="[surfaceClass, 'h-full space-y-3 p-4']"
25
+ >
26
+ <USkeleton class="h-5 w-2/3" />
27
+ <USkeleton class="h-4 w-1/2" />
28
+ </div>
29
+ <div
30
+ v-else-if="error && !data?.length"
31
+ :class="[surfaceClass, 'text-error h-full p-4 text-sm']"
32
+ >
33
+ {{ t("dashboard.nextFailed", "Could not load your shifts.") }}
34
+ </div>
35
+ <EmptyCard
36
+ v-else-if="!next"
37
+ icon="i-lucide-calendar-clock"
38
+ :title="t('dashboard.nextEmpty', 'No upcoming shifts')"
39
+ :description="t('dashboard.nextEmptyDescription', 'Your next shift shows here once you are on a schedule.')"
40
+ :action-label="t('dashboard.allShifts', 'See my shifts')"
41
+ :to="links.shifts()"
42
+ />
43
+ <div
44
+ v-else
45
+ :class="[surfaceClass, 'flex h-full flex-col gap-3 p-4']"
46
+ >
47
+ <div class="flex flex-col gap-1">
48
+ <div class="flex flex-wrap items-center gap-2">
49
+ <span class="text-highlighted text-lg font-semibold">{{ format.range(next.shift.startsAt, next.shift.endsAt) }}</span>
50
+ <UBadge
51
+ v-if="running"
52
+ color="success"
53
+ variant="subtle"
54
+ :label="t('dashboard.nextRunning', 'On now')"
55
+ />
56
+ </div>
57
+ <span class="text-default text-sm">{{ tr(next.teamName) }}<template v-if="next.roleName"> · {{ tr(next.roleName) }}</template></span>
58
+ <span class="text-muted text-xs">{{ tr(next.operationName) }}<template v-if="next.shift.location?.name"> · {{ tr(next.shift.location.name) }}</template></span>
59
+ </div>
60
+ <div class="mt-auto">
61
+ <UButton
62
+ :to="links.shift(next.assignment.id)"
63
+ icon="i-lucide-qr-code"
64
+ trailing-icon="i-lucide-arrow-right"
65
+ :label="t('dashboard.nextPass', 'Open shift and pass')"
66
+ />
67
+ </div>
68
+ </div>
69
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,69 @@
1
+ <script setup>
2
+ import { shiftsApi } from "../../utils/api";
3
+ import { computed, surfaceClass, useLazyFetch, useModuleT, useShiftsFormat, useShiftsLinks, useShiftsTranslate } from "#imports";
4
+ defineOptions({ name: "ShiftsSwapsItem" });
5
+ const t = useModuleT("shifts");
6
+ const tr = useShiftsTranslate();
7
+ const format = useShiftsFormat();
8
+ const links = useShiftsLinks();
9
+ const { data, status, error } = useLazyFetch(shiftsApi.swaps, {
10
+ key: "shifts:dashboard:swaps",
11
+ default: () => [],
12
+ onResponseError: () => {
13
+ }
14
+ });
15
+ const loading = computed(() => status.value === "pending" && !data.value?.length);
16
+ const swaps = computed(() => [...data.value ?? []].sort((a, b) => Date.parse(a.shift.startsAt) - Date.parse(b.shift.startsAt)));
17
+ const shown = computed(() => swaps.value.slice(0, 3));
18
+ </script>
19
+
20
+ <template>
21
+ <div
22
+ v-if="loading"
23
+ :class="[surfaceClass, 'h-full space-y-3 p-4']"
24
+ >
25
+ <USkeleton class="h-4 w-2/3" />
26
+ <USkeleton class="h-4 w-1/2" />
27
+ </div>
28
+ <div
29
+ v-else-if="error && !data?.length"
30
+ :class="[surfaceClass, 'text-error h-full p-4 text-sm']"
31
+ >
32
+ {{ t("dashboard.swapsFailed", "Could not load the open swaps.") }}
33
+ </div>
34
+ <EmptyCard
35
+ v-else-if="!swaps.length"
36
+ icon="i-lucide-repeat"
37
+ :title="t('dashboard.swapsEmpty', 'No open swaps')"
38
+ :description="t('dashboard.swapsEmptyDescription', 'Shifts other people give away show here when you could take them.')"
39
+ />
40
+ <div
41
+ v-else
42
+ :class="[surfaceClass, 'flex h-full flex-col']"
43
+ >
44
+ <p class="text-highlighted px-4 pt-3 text-sm font-semibold">
45
+ {{ t("dashboard.swapsCount", "{count} open swaps you can take", { count: swaps.length }) }}
46
+ </p>
47
+ <ul class="divide-default flex-1 divide-y px-4 text-sm [&>li]:py-2.5">
48
+ <li
49
+ v-for="swap in shown"
50
+ :key="swap.id"
51
+ class="flex flex-col gap-0.5"
52
+ >
53
+ <span class="text-highlighted font-medium">{{ format.range(swap.shift.startsAt, swap.shift.endsAt) }}</span>
54
+ <span class="text-muted text-xs">{{ tr(swap.shift.teamName) }}</span>
55
+ </li>
56
+ </ul>
57
+ <div class="border-default border-t px-4 py-2.5">
58
+ <UButton
59
+ :to="links.swaps()"
60
+ variant="link"
61
+ color="neutral"
62
+ size="xs"
63
+ class="p-0"
64
+ trailing-icon="i-lucide-arrow-right"
65
+ :label="t('dashboard.swapsLink', 'See the swaps')"
66
+ />
67
+ </div>
68
+ </div>
69
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,72 @@
1
+ <script setup>
2
+ import { shiftsApi } from "../../utils/api";
3
+ import { computed, onBeforeUnmount, surfaceClass, useLazyFetch, useModuleT, useShiftsTranslate } from "#imports";
4
+ defineOptions({ name: "ShiftsOnNowItem" });
5
+ const t = useModuleT("shifts");
6
+ const tr = useShiftsTranslate();
7
+ const { data, status, error, refresh } = useLazyFetch(shiftsApi.me.now, {
8
+ key: "shifts:dashboard:on-now",
9
+ default: () => ({ at: "", teams: [] }),
10
+ onResponseError: () => {
11
+ }
12
+ });
13
+ if (import.meta.client) {
14
+ const timer = setInterval(() => refresh(), 6e4);
15
+ onBeforeUnmount(() => clearInterval(timer));
16
+ }
17
+ const loading = computed(() => status.value === "pending" && !data.value?.teams.length);
18
+ const teams = computed(() => data.value?.teams ?? []);
19
+ const nameOf = (person) => person.name ?? `#${person.userId}`;
20
+ </script>
21
+
22
+ <template>
23
+ <div
24
+ v-if="loading"
25
+ :class="[surfaceClass, 'h-full space-y-3 p-4']"
26
+ >
27
+ <USkeleton class="h-4 w-2/3" />
28
+ <USkeleton class="h-4 w-1/2" />
29
+ </div>
30
+ <div
31
+ v-else-if="error && !teams.length"
32
+ :class="[surfaceClass, 'text-error h-full p-4 text-sm']"
33
+ >
34
+ {{ t("dashboard.onNowFailed", "Could not load who is on shift.") }}
35
+ </div>
36
+ <EmptyCard
37
+ v-else-if="!teams.length"
38
+ icon="i-lucide-radio"
39
+ :title="t('dashboard.onNowEmpty', 'Nobody on your teams is on shift')"
40
+ :description="t('dashboard.onNowEmptyDescription', 'When a shift of one of your teams is running, you see who is on it.')"
41
+ />
42
+ <ul
43
+ v-else
44
+ :class="[surfaceClass, 'divide-default h-full divide-y px-4 text-sm [&>li]:py-3']"
45
+ >
46
+ <li
47
+ v-for="team in teams"
48
+ :key="team.teamId"
49
+ class="flex flex-col gap-1"
50
+ >
51
+ <div class="flex flex-wrap items-center justify-between gap-2">
52
+ <span class="text-highlighted font-medium">{{ tr(team.teamName) }}</span>
53
+ <UBadge
54
+ v-if="team.leads.length"
55
+ color="primary"
56
+ variant="subtle"
57
+ icon="i-lucide-shield-check"
58
+ :label="t('dashboard.onNowLead', 'Lead on duty: {names}', { names: team.leads.map(nameOf).join(', ') })"
59
+ />
60
+ <UBadge
61
+ v-else
62
+ color="warning"
63
+ variant="subtle"
64
+ icon="i-lucide-shield-alert"
65
+ :label="t('dashboard.onNowNoLead', 'No lead on duty')"
66
+ />
67
+ </div>
68
+ <span class="text-muted text-xs">{{ tr(team.operationName) }} · {{ t("dashboard.onNowPeople", "{count} on now", { count: team.people.length }) }}</span>
69
+ <span class="text-default text-xs">{{ team.people.map(nameOf).join(", ") }}</span>
70
+ </li>
71
+ </ul>
72
+ </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;