@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,487 @@
1
+ <script setup>
2
+ import { shiftDays, shiftsRoleLabel } from "../utils/admin-shifts";
3
+ import { shiftsApi } from "../../utils/api";
4
+ import { SHIFT_SWAP_STATUS_LABELS } from "../../utils/status";
5
+ import { dayKey } from "@frigear-nu/module-kit/time";
6
+ import { computed, h, navigateTo, ref, resolveComponent, tableUi, useFetch, useModuleT, useRoute, useShiftsActions, useShiftsFormat, useShiftsTranslate, watch } from "#imports";
7
+ defineOptions({ name: "ShiftsOperationTab" });
8
+ const props = defineProps({
9
+ operation: { type: Object, required: false }
10
+ });
11
+ const t = useModuleT("shifts");
12
+ const tr = useShiftsTranslate();
13
+ const format = useShiftsFormat();
14
+ const actions = useShiftsActions();
15
+ const route = useRoute();
16
+ const operationId = computed(() => props.operation?.id ?? "");
17
+ const hasOperation = computed(() => !!operationId.value);
18
+ const { data: operationTeams } = await useFetch(() => shiftsApi.admin.teams(operationId.value || "_"), {
19
+ immediate: hasOperation.value,
20
+ watch: false,
21
+ key: computed(() => `shifts:teams:${operationId.value}`),
22
+ default: () => []
23
+ });
24
+ const teams = computed(() => operationTeams.value.map(({ id, kind, name }) => ({ id, kind, name })));
25
+ const ladders = computed(() => {
26
+ const byKind = /* @__PURE__ */ new Map();
27
+ for (const team of operationTeams.value) if (team.ladder) byKind.set(team.kind, { kind: team.kind, ...team.ladder });
28
+ return [...byKind.values()];
29
+ });
30
+ const { data: schedules, status: schedulesStatus, refresh: refreshSchedules } = await useFetch(shiftsApi.admin.schedules, {
31
+ query: computed(() => ({ operationId: operationId.value || void 0 })),
32
+ immediate: hasOperation.value,
33
+ key: computed(() => `shifts:schedules:${operationId.value}`),
34
+ default: () => []
35
+ });
36
+ const selectedId = computed(() => typeof route.query.schedule === "string" ? route.query.schedule : "");
37
+ const selected = computed(() => schedules.value.find((schedule) => schedule.id === selectedId.value));
38
+ const openSchedule = (id) => navigateTo({ query: { ...route.query, schedule: id ?? void 0 } });
39
+ async function newSchedule() {
40
+ const created = await actions.createSchedule(operationId.value);
41
+ if (!created) return;
42
+ await refreshSchedules();
43
+ await openSchedule(created.id);
44
+ }
45
+ const statusLabel = (status) => status === "published" ? t("admin.statusPublished", "Published") : t("admin.statusDraft", "Draft");
46
+ const RowMenu = resolveComponent("RowMenu");
47
+ const StatusBadge = resolveComponent("StatusBadge");
48
+ const scheduleColumns = computed(() => [
49
+ { accessorKey: "name", header: t("admin.name", "Name"), cell: ({ row }) => h("span", { class: "text-highlighted font-medium" }, tr(row.original.name)) },
50
+ { accessorKey: "status", header: t("admin.status", "Status"), cell: ({ row }) => h(StatusBadge, { status: row.original.status, label: statusLabel(row.original.status) }) },
51
+ { id: "settings", header: t("admin.swaps", "Swaps"), cell: ({ row }) => actions.settingsLabel(row.original) },
52
+ { accessorKey: "shiftCount", header: t("admin.shifts", "Shifts"), cell: ({ row }) => String(row.original.shiftCount ?? 0) },
53
+ {
54
+ id: "actions",
55
+ meta: { class: { th: "w-0", td: "w-0" } },
56
+ cell: ({ row }) => h(RowMenu, {
57
+ items: actions.scheduleMenu(row.original, { open: () => openSchedule(row.original.id), changed: refreshSchedules }),
58
+ subject: tr(row.original.name)
59
+ })
60
+ }
61
+ ]);
62
+ const { data: shifts, status: shiftsStatus, refresh: refreshShifts } = await useFetch(() => shiftsApi.admin.shifts(selectedId.value || "_"), {
63
+ immediate: !!selectedId.value,
64
+ watch: [selectedId],
65
+ key: computed(() => `shifts:schedule-shifts:${selectedId.value}`),
66
+ default: () => []
67
+ });
68
+ const { data: roles, refresh: refreshRoles } = await useFetch(() => shiftsApi.admin.roles(selectedId.value || "_"), {
69
+ immediate: !!selectedId.value,
70
+ watch: [selectedId],
71
+ key: computed(() => `shifts:schedule-roles:${selectedId.value}`),
72
+ default: () => []
73
+ });
74
+ const { data: swaps, refresh: refreshSwaps } = await useFetch(shiftsApi.admin.swaps, {
75
+ query: computed(() => ({ operationId: operationId.value || void 0, status: "pending_approval" })),
76
+ immediate: hasOperation.value,
77
+ key: computed(() => `shifts:pending-swaps:${operationId.value}`),
78
+ default: () => []
79
+ });
80
+ const pendingSwaps = computed(() => swaps.value.filter((swap) => swap.shift.scheduleId === selectedId.value));
81
+ async function refreshSchedule() {
82
+ await Promise.all([refreshShifts(), refreshRoles(), refreshSwaps(), refreshSchedules()]);
83
+ }
84
+ const context = computed(() => ({ teams: teams.value, ladders: ladders.value, roles: roles.value }));
85
+ const settingsState = ref({ coverage: "flexible", handover: "both", approval: "peer" });
86
+ watch(selected, (schedule) => {
87
+ if (schedule) settingsState.value = { coverage: schedule.coverage, handover: schedule.handover, approval: schedule.approval };
88
+ }, { immediate: true });
89
+ const settingsChanged = computed(() => !!selected.value && ["coverage", "handover", "approval"].some((key) => settingsState.value[key] !== selected.value[key]));
90
+ const savingSettings = ref(false);
91
+ async function saveSettings() {
92
+ if (!selected.value) return;
93
+ savingSettings.value = true;
94
+ try {
95
+ if (await actions.saveScheduleSettings(selected.value, settingsState.value)) await refreshSchedules();
96
+ } finally {
97
+ savingSettings.value = false;
98
+ }
99
+ }
100
+ const view = ref("day");
101
+ const viewItems = computed(() => [
102
+ { label: t("admin.viewDay", "Day"), value: "day", icon: "i-lucide-calendar-range" },
103
+ { label: t("admin.viewList", "List"), value: "list", icon: "i-lucide-list" },
104
+ { label: t("admin.viewRoles", "Shift roles"), value: "roles", icon: "i-lucide-badge" },
105
+ { label: t("admin.viewSwaps", "Swaps to approve ({count})", { count: pendingSwaps.value.length }), value: "swaps", icon: "i-lucide-arrow-left-right" },
106
+ { label: t("admin.viewCheckIn", "Check-in"), value: "checkin", icon: "i-lucide-scan-line" },
107
+ { label: t("admin.viewSettings", "Settings"), value: "settings", icon: "i-lucide-settings" }
108
+ ]);
109
+ const teamFilter = ref("all");
110
+ const teamFilterOptions = computed(() => [{ label: t("admin.allTeams", "All teams"), value: "all" }, ...teams.value.map((team) => ({ label: tr(team.name), value: team.id }))]);
111
+ const visibleShifts = computed(() => teamFilter.value === "all" ? shifts.value : shifts.value.filter((shift) => shift.teamId === teamFilter.value));
112
+ const days = computed(() => shiftDays(visibleShifts.value, format.timeZone));
113
+ const day = ref("");
114
+ watch(days, (list) => {
115
+ if (!list.includes(day.value)) day.value = list.find((item) => item >= dayKey(/* @__PURE__ */ new Date(), format.timeZone)) ?? list[0] ?? "";
116
+ }, { immediate: true });
117
+ const dayItems = computed(() => days.value.map((value) => ({ label: format.day(value, { weekday: "short", day: "numeric", month: "short" }), value })));
118
+ const dayShifts = computed(() => visibleShifts.value.filter((shift) => dayKey(shift.startsAt, format.timeZone) === day.value));
119
+ async function open(shift) {
120
+ if (await actions.openShift(shift, { roles: roles.value, minPerShift: selected.value?.minPerShift })) await refreshSchedule();
121
+ }
122
+ const roleName = (id) => {
123
+ const role = id ? roles.value.find((item) => item.id === id) : void 0;
124
+ return role ? tr(role.name) : "";
125
+ };
126
+ const teamName = (id) => {
127
+ const team = teams.value.find((item) => item.id === id);
128
+ return team ? tr(team.name) : id;
129
+ };
130
+ const shiftColumns = computed(() => [
131
+ { accessorKey: "startsAt", header: t("admin.when", "When"), cell: ({ row }) => h("span", { class: "tabular-nums" }, format.range(row.original.startsAt, row.original.endsAt)) },
132
+ { accessorKey: "teamId", header: t("admin.team", "Team"), cell: ({ row }) => tr(row.original.teamName) },
133
+ { accessorKey: "shiftRoleId", header: t("admin.shiftRole", "Shift role"), cell: ({ row }) => roleName(row.original.shiftRoleId) },
134
+ { accessorKey: "filled", header: t("admin.people", "People"), cell: ({ row }) => row.original.effectiveCapacity === null ? String(row.original.filled) : `${row.original.filled}/${row.original.effectiveCapacity}` },
135
+ { id: "names", header: t("admin.who", "Who"), cell: ({ row }) => row.original.assignees.map((item) => item.person.name ?? "").filter(Boolean).join(", ") },
136
+ {
137
+ id: "actions",
138
+ meta: { class: { th: "w-0", td: "w-0" } },
139
+ cell: ({ row }) => h(RowMenu, {
140
+ items: [
141
+ [{ label: t("admin.openShift", "Open shift"), icon: "i-lucide-arrow-right", onSelect: () => open(row.original) }],
142
+ [{ label: t("admin.deleteShift", "Delete shift"), icon: "i-lucide-trash-2", color: "error", onSelect: async () => await actions.deleteShift(row.original) && refreshSchedule() }]
143
+ ],
144
+ subject: format.range(row.original.startsAt, row.original.endsAt)
145
+ })
146
+ }
147
+ ]);
148
+ const roleColumns = computed(() => [
149
+ { accessorKey: "name", header: t("admin.name", "Name"), cell: ({ row }) => h("span", { class: "text-highlighted font-medium" }, tr(row.original.name)) },
150
+ { accessorKey: "teamId", header: t("admin.team", "Team"), cell: ({ row }) => teamName(row.original.teamId) },
151
+ {
152
+ accessorKey: "teamRole",
153
+ header: t("admin.teamRole", "Lowest team role"),
154
+ cell: ({ row }) => row.original.teamRole ? shiftsRoleLabel(ladders.value, teams.value.find((team) => team.id === row.original.teamId)?.kind, row.original.teamRole, tr) : t("admin.anyRole", "Anybody on the team")
155
+ },
156
+ {
157
+ id: "actions",
158
+ meta: { class: { th: "w-0", td: "w-0" } },
159
+ cell: ({ row }) => h(RowMenu, { items: actions.roleMenu(row.original, { ...context.value, changed: refreshSchedule }), subject: tr(row.original.name) })
160
+ }
161
+ ]);
162
+ async function bulk() {
163
+ if (selected.value && await actions.bulkCreate(selected.value, context.value)) await refreshSchedule();
164
+ }
165
+ async function copy() {
166
+ if (selected.value && await actions.copyFrom(selected.value)) await refreshSchedule();
167
+ }
168
+ async function publish() {
169
+ if (selected.value && await actions.publishSchedule(selected.value)) await refreshSchedule();
170
+ }
171
+ async function edit() {
172
+ if (selected.value && await actions.editSchedule(selected.value)) await refreshSchedule();
173
+ }
174
+ async function addRole() {
175
+ if (selected.value && await actions.createRole(selected.value, context.value)) await refreshSchedule();
176
+ }
177
+ async function approve(swap) {
178
+ if (await actions.approveSwap(swap)) await refreshSchedule();
179
+ }
180
+ async function reject(swap) {
181
+ if (await actions.rejectSwap(swap)) await refreshSchedule();
182
+ }
183
+ </script>
184
+
185
+ <template>
186
+ <div class="flex flex-col gap-4">
187
+ <template v-if="selectedId">
188
+ <div class="flex flex-wrap items-center justify-between gap-3">
189
+ <div class="flex min-w-0 items-center gap-2">
190
+ <UButton
191
+ icon="i-lucide-arrow-left"
192
+ color="neutral"
193
+ variant="ghost"
194
+ :aria-label="t('admin.backToSchedules', 'Back to the schedules')"
195
+ @click="openSchedule(null)"
196
+ />
197
+ <h2 class="text-highlighted truncate text-lg font-semibold">
198
+ {{ selected ? tr(selected.name) : "" }}
199
+ </h2>
200
+ <StatusBadge
201
+ v-if="selected"
202
+ :status="selected.status"
203
+ :label="statusLabel(selected.status)"
204
+ />
205
+ <UBadge
206
+ v-if="selected"
207
+ color="neutral"
208
+ variant="subtle"
209
+ :label="actions.settingsLabel(selected)"
210
+ />
211
+ </div>
212
+ <div class="flex flex-wrap gap-2">
213
+ <UButton
214
+ color="neutral"
215
+ variant="outline"
216
+ icon="i-lucide-pencil"
217
+ :label="t('admin.editSchedule', 'Edit schedule')"
218
+ @click="edit"
219
+ />
220
+ <UButton
221
+ color="neutral"
222
+ variant="outline"
223
+ icon="i-lucide-copy"
224
+ :label="t('admin.copyShort', 'Copy shifts')"
225
+ @click="copy"
226
+ />
227
+ <UButton
228
+ color="neutral"
229
+ variant="outline"
230
+ icon="i-lucide-calendar-plus"
231
+ :label="t('admin.bulkTitle', 'Create shifts')"
232
+ :disabled="!teams.length"
233
+ @click="bulk"
234
+ />
235
+ <UButton
236
+ v-if="selected?.status === 'draft'"
237
+ icon="i-lucide-send"
238
+ :label="t('admin.publishAction', 'Publish schedule')"
239
+ @click="publish"
240
+ />
241
+ </div>
242
+ </div>
243
+
244
+ <UAlert
245
+ v-if="selected?.status === 'draft'"
246
+ color="neutral"
247
+ variant="subtle"
248
+ icon="i-lucide-eye-off"
249
+ :title="t('admin.draftNote', 'Draft: volunteers do not see this schedule until you publish it.')"
250
+ />
251
+
252
+ <div class="flex flex-wrap items-center justify-between gap-2">
253
+ <UTabs
254
+ v-model="view"
255
+ :items="viewItems"
256
+ :content="false"
257
+ variant="link"
258
+ />
259
+ <USelect
260
+ v-if="view === 'day' || view === 'list'"
261
+ v-model="teamFilter"
262
+ :items="teamFilterOptions"
263
+ class="w-48"
264
+ />
265
+ </div>
266
+
267
+ <SectionCard
268
+ v-if="view === 'day'"
269
+ flush
270
+ :loading="shiftsStatus === 'pending' && !shifts.length"
271
+ >
272
+ <UEmpty
273
+ v-if="!days.length"
274
+ icon="i-lucide-calendar-plus"
275
+ :title="t('admin.noShifts', 'No shifts yet')"
276
+ :description="t('admin.noShiftsDescription', 'Create shifts for a team over a range of days, or copy them from another schedule.')"
277
+ :actions="[{ label: t('admin.bulkTitle', 'Create shifts'), icon: 'i-lucide-calendar-plus', onClick: bulk }]"
278
+ />
279
+ <template v-else>
280
+ <div class="border-default flex gap-1 overflow-x-auto border-b p-2">
281
+ <UButton
282
+ v-for="item in dayItems"
283
+ :key="item.value"
284
+ size="sm"
285
+ :color="item.value === day ? 'primary' : 'neutral'"
286
+ :variant="item.value === day ? 'solid' : 'ghost'"
287
+ :label="item.label"
288
+ @click="day = item.value"
289
+ />
290
+ </div>
291
+ <ShiftDayView
292
+ :shifts="dayShifts"
293
+ :day="day"
294
+ :teams="teams"
295
+ :time-zone="format.timeZone"
296
+ :min-per-shift="selected?.minPerShift"
297
+ @open="open"
298
+ />
299
+ </template>
300
+ </SectionCard>
301
+
302
+ <TableCard
303
+ v-else-if="view === 'list'"
304
+ :title="t('admin.shifts', 'Shifts')"
305
+ :loading="shiftsStatus === 'pending' && !shifts.length"
306
+ >
307
+ <UTable
308
+ :data="visibleShifts"
309
+ :columns="shiftColumns"
310
+ :ui="tableUi()"
311
+ @select="(_event, row) => open(row.original)"
312
+ >
313
+ <template #empty>
314
+ <UEmpty
315
+ icon="i-lucide-calendar-plus"
316
+ :title="t('admin.noShifts', 'No shifts yet')"
317
+ :actions="[{ label: t('admin.bulkTitle', 'Create shifts'), icon: 'i-lucide-calendar-plus', onClick: bulk }]"
318
+ />
319
+ </template>
320
+ </UTable>
321
+ </TableCard>
322
+
323
+ <TableCard
324
+ v-else-if="view === 'roles'"
325
+ :title="t('admin.viewRoles', 'Shift roles')"
326
+ :description="t('admin.rolesDescription', 'Roles such as team lead or bartender, with the lowest team role that may hold them.')"
327
+ >
328
+ <template #actions>
329
+ <UButton
330
+ icon="i-lucide-plus"
331
+ :label="t('admin.createRole', 'Add shift role')"
332
+ :disabled="!teams.length"
333
+ @click="addRole"
334
+ />
335
+ </template>
336
+ <UTable
337
+ :data="roles"
338
+ :columns="roleColumns"
339
+ :ui="tableUi()"
340
+ >
341
+ <template #empty>
342
+ <UEmpty
343
+ icon="i-lucide-badge"
344
+ :title="t('admin.noRoles', 'No shift roles')"
345
+ :description="t('admin.noRolesDescription', 'Without roles anybody on the team can hold any shift.')"
346
+ :actions="[{ label: t('admin.createRole', 'Add shift role'), icon: 'i-lucide-plus', onClick: addRole }]"
347
+ />
348
+ </template>
349
+ </UTable>
350
+ </TableCard>
351
+
352
+ <ShiftCheckInCard
353
+ v-else-if="view === 'checkin' && selected"
354
+ :schedule="selected"
355
+ :teams="teams"
356
+ @changed="refreshSchedules"
357
+ />
358
+
359
+ <SectionCard
360
+ v-else-if="view === 'settings'"
361
+ :title="t('admin.settingsTitle', 'How shifts change hands')"
362
+ :description="t('admin.settingsDescription', 'Changes apply to swaps opened before too: accepting or approving one checks the settings of that moment.')"
363
+ >
364
+ <UForm
365
+ id="shift-schedule-settings-form"
366
+ :state="settingsState"
367
+ class="divide-default divide-y"
368
+ @submit="saveSettings"
369
+ >
370
+ <ShiftScheduleSettingsFields v-model="settingsState" />
371
+ </UForm>
372
+ <template #footer>
373
+ <div class="flex justify-end">
374
+ <UButton
375
+ type="submit"
376
+ form="shift-schedule-settings-form"
377
+ :loading="savingSettings"
378
+ :disabled="!settingsChanged"
379
+ :label="t('admin.saveSettings', 'Save settings')"
380
+ />
381
+ </div>
382
+ </template>
383
+ </SectionCard>
384
+
385
+ <SectionCard
386
+ v-else
387
+ :title="t('admin.viewSwapsTitle', 'Swaps to approve')"
388
+ :description="selected?.approval === 'lead' ? t('admin.swapsApprovalHelp', 'Swaps the owner accepted wait here for a lead of the team or staff.') : t('admin.swapsPeerHelp', 'This schedule swaps between volunteers: nothing waits for approval.')"
389
+ >
390
+ <p
391
+ v-if="!pendingSwaps.length"
392
+ class="text-muted text-sm"
393
+ >
394
+ {{ t("admin.noPendingSwaps", "No swaps wait for approval.") }}
395
+ </p>
396
+ <ul
397
+ v-else
398
+ class="divide-default divide-y"
399
+ >
400
+ <li
401
+ v-for="swap in pendingSwaps"
402
+ :key="swap.id"
403
+ class="flex flex-wrap items-center justify-between gap-2 py-2"
404
+ >
405
+ <div class="flex flex-col text-sm">
406
+ <span class="text-highlighted font-medium">{{ tr(swap.shift.teamName) }} · {{ format.range(swap.shift.startsAt, swap.shift.endsAt) }}</span>
407
+ <span class="text-muted">
408
+ {{ actions.swapSummary(swap) }}
409
+ </span>
410
+ <StatusBadge
411
+ class="self-start"
412
+ :status="swap.status"
413
+ :label="t(`swapStatuses.${swap.status}`, SHIFT_SWAP_STATUS_LABELS[swap.status])"
414
+ />
415
+ </div>
416
+ <div class="flex items-center gap-2">
417
+ <span
418
+ v-if="!actions.swapAllowed(swap)"
419
+ class="text-muted text-sm"
420
+ >
421
+ {{ t("swaps.noLongerAllowed", "No longer allowed by the schedule's settings: reject it.") }}
422
+ </span>
423
+ <UButton
424
+ color="neutral"
425
+ variant="outline"
426
+ :label="t('swaps.rejectAction', 'Reject swap')"
427
+ @click="reject(swap)"
428
+ />
429
+ <UButton
430
+ v-if="actions.swapAllowed(swap)"
431
+ :label="t('swaps.approveAction', 'Approve swap')"
432
+ @click="approve(swap)"
433
+ />
434
+ </div>
435
+ </li>
436
+ </ul>
437
+ </SectionCard>
438
+ </template>
439
+
440
+ <template v-else>
441
+ <TableCard
442
+ :title="t('admin.schedules', 'Schedules')"
443
+ :description="t('admin.schedulesDescription', 'Each schedule holds shifts for the operation\'s teams. Publish it when it is ready.')"
444
+ :loading="schedulesStatus === 'pending' && !schedules.length"
445
+ >
446
+ <template #actions>
447
+ <UButton
448
+ icon="i-lucide-plus"
449
+ :label="t('admin.newSchedule', 'New schedule')"
450
+ :disabled="!hasOperation"
451
+ @click="newSchedule"
452
+ />
453
+ </template>
454
+ <UTable
455
+ :data="schedules"
456
+ :columns="scheduleColumns"
457
+ :ui="tableUi()"
458
+ @select="(_event, row) => openSchedule(row.original.id)"
459
+ >
460
+ <template #empty>
461
+ <UEmpty
462
+ icon="i-lucide-calendar-clock"
463
+ :title="t('admin.noSchedules', 'No schedules yet')"
464
+ :description="t('admin.noSchedulesDescription', 'Create a schedule, then add shifts for the teams.')"
465
+ :actions="[{ label: t('admin.newSchedule', 'New schedule'), icon: 'i-lucide-plus', onClick: newSchedule }]"
466
+ />
467
+ </template>
468
+ </UTable>
469
+ </TableCard>
470
+ <ShiftNowCard
471
+ v-if="hasOperation"
472
+ :operation-id="operationId"
473
+ />
474
+ <ShiftPerksCard
475
+ v-if="hasOperation"
476
+ :operation-id="operationId"
477
+ :teams="teams"
478
+ />
479
+ <ShiftBroadcastsCard
480
+ v-if="hasOperation"
481
+ :operation-id="operationId"
482
+ :teams="teams"
483
+ :ladders="ladders"
484
+ />
485
+ </template>
486
+ </div>
487
+ </template>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ operation?: {
3
+ id: string;
4
+ slug?: string;
5
+ };
6
+ };
7
+ 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>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,42 @@
1
+ import type { ShiftWarning, Translated } from '../../../types.js';
2
+ /** A team of the operation, as `GET /api/admin/teams?ownerType=operation&ownerId=...` answers (the fields used here). */
3
+ export type ShiftsTeamOption = {
4
+ id: string;
5
+ kind: string;
6
+ name: Translated;
7
+ };
8
+ /** A ladder as `GET /api/admin/teams/ladders` answers (the fields used here). */
9
+ export type ShiftsLadder = {
10
+ kind: string;
11
+ roles: Array<{
12
+ key: string;
13
+ label: Translated;
14
+ }>;
15
+ leadFrom: string | null;
16
+ };
17
+ type TranslateText = (value: Translated | null | undefined) => string;
18
+ /** The select options of a kind's ladder, highest role first. */
19
+ export declare function shiftsRoleOptions(ladders: readonly ShiftsLadder[] | null | undefined, kind: string | undefined, tr: TranslateText): {
20
+ label: string;
21
+ value: string;
22
+ }[];
23
+ /** The label of a role key on a ladder, falling back to the key. */
24
+ export declare function shiftsRoleLabel(ladders: readonly ShiftsLadder[] | null | undefined, kind: string | undefined, role: string, tr: TranslateText): string;
25
+ /**
26
+ * Shift times are entered as wall-clock times in the module's time zone (`public.shifts.timeZone`), not the browser's:
27
+ * a coordinator abroad still plans the festival's local hours. `toZonedInput` turns a stored instant into a
28
+ * `datetime-local` value in that zone, `zonedInputToIso` turns one back.
29
+ */
30
+ export declare const toZonedInput: (value: string | null | undefined, timeZone: string) => string;
31
+ export declare const zonedInputToIso: (value: string, timeZone: string) => string | null;
32
+ /** Every `YYYY-MM-DD` day from `from` to `to`, both included (at most 62). */
33
+ export declare function daysBetween(from: string, to: string): string[];
34
+ /** The days shifts start on, in the time zone, sorted. */
35
+ export declare function shiftDays(shifts: ReadonlyArray<{
36
+ startsAt: string;
37
+ }>, timeZone: string): string[];
38
+ /** Minutes since local midnight of `day` in the time zone (may be below 0 or above 1440 for shifts crossing midnight). */
39
+ export declare function minutesInDay(value: string, day: string, timeZone: string): number;
40
+ /** The colour of a guard warning. */
41
+ export declare const warningColor: (warning: ShiftWarning) => "error" | "warning";
42
+ export {};
@@ -0,0 +1,36 @@
1
+ import { clockOf, dayKey, zonedTimeToUtc } from "@frigear-nu/module-kit/time";
2
+ export function shiftsRoleOptions(ladders, kind, tr) {
3
+ const ladder = ladders?.find((item) => item.kind === kind);
4
+ return [...ladder?.roles ?? []].reverse().map((role) => ({ label: tr(role.label) || role.key, value: role.key }));
5
+ }
6
+ export function shiftsRoleLabel(ladders, kind, role, tr) {
7
+ const found = ladders?.find((ladder) => ladder.kind === kind)?.roles.find((item) => item.key === role);
8
+ return found ? tr(found.label) || role : role;
9
+ }
10
+ export const toZonedInput = (value, timeZone) => {
11
+ if (!value) return "";
12
+ return `${dayKey(value, timeZone)}T${clockOf(value, timeZone)}`;
13
+ };
14
+ export const zonedInputToIso = (value, timeZone) => {
15
+ const [day, clock] = value.split("T");
16
+ if (!day || !clock) return null;
17
+ return zonedTimeToUtc(day, clock.slice(0, 5), timeZone).toISOString();
18
+ };
19
+ export function daysBetween(from, to) {
20
+ const days = [];
21
+ let time = Date.parse(`${from}T00:00:00Z`);
22
+ const end = Date.parse(`${to}T00:00:00Z`);
23
+ while (!Number.isNaN(time) && time <= end && days.length < 62) {
24
+ days.push(new Date(time).toISOString().slice(0, 10));
25
+ time += 864e5;
26
+ }
27
+ return days;
28
+ }
29
+ export function shiftDays(shifts, timeZone) {
30
+ return [...new Set(shifts.map((shift) => dayKey(shift.startsAt, timeZone)))].sort();
31
+ }
32
+ export function minutesInDay(value, day, timeZone) {
33
+ const midnight = zonedTimeToUtc(day, "00:00", timeZone).getTime();
34
+ return Math.round((new Date(value).getTime() - midnight) / 6e4);
35
+ }
36
+ export const warningColor = (warning) => warning.code === "shift_full" || warning.code === "overlap" ? "error" : "warning";
@@ -0,0 +1,8 @@
1
+ import type { DashboardItem } from '@frigear-nu/dashboard/types';
2
+ /** The dashboard shifts adds its items to when `@frigear-nu/dashboard` is installed. */
3
+ export declare const SHIFTS_DASHBOARD = "crew.home";
4
+ /**
5
+ * The items shifts adds to `crew.home`. `resolve` turns a path relative to `module.ts` into an absolute one. Kept apart
6
+ * from the module so a test can register them without a Nuxt build.
7
+ */
8
+ export declare function shiftsDashboardItems(resolve: (path: string) => string): DashboardItem[];
@@ -0,0 +1,30 @@
1
+ import { shiftsAccess } from "./access.js";
2
+ export const SHIFTS_DASHBOARD = "crew.home";
3
+ export function shiftsDashboardItems(resolve) {
4
+ return [
5
+ {
6
+ id: "shifts.next",
7
+ component: resolve("./runtime/app/dashboard/NextShift.vue"),
8
+ title: "My next shift",
9
+ titleKey: "shifts.dashboard.next",
10
+ order: 20,
11
+ permission: shiftsAccess.permissions.read
12
+ },
13
+ {
14
+ id: "shifts.on-now",
15
+ component: resolve("./runtime/app/dashboard/TeamOnNow.vue"),
16
+ title: "My team on shift now",
17
+ titleKey: "shifts.dashboard.onNow",
18
+ order: 30,
19
+ permission: shiftsAccess.permissions.read
20
+ },
21
+ {
22
+ id: "shifts.swaps",
23
+ component: resolve("./runtime/app/dashboard/OpenSwaps.vue"),
24
+ title: "Open swaps",
25
+ titleKey: "shifts.dashboard.swaps",
26
+ order: 40,
27
+ permission: shiftsAccess.permissions.read
28
+ }
29
+ ];
30
+ }
@@ -0,0 +1,8 @@
1
+ type __VLS_Props = {
2
+ name: string;
3
+ subject: string;
4
+ message: string;
5
+ };
6
+ 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>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,24 @@
1
+ <script setup>
2
+ import { EmailDivider, EmailHeading, EmailLayout, EmailText } from "@frigear-nu/email-templates/components";
3
+ defineProps({
4
+ name: { type: String, required: true },
5
+ subject: { type: String, required: true },
6
+ message: { type: String, required: true }
7
+ });
8
+ </script>
9
+
10
+ <template>
11
+ <EmailLayout :preview="subject">
12
+ <ESubject>{{ subject }}</ESubject>
13
+ <EmailHeading>
14
+ {{ subject }}
15
+ </EmailHeading>
16
+ <EmailDivider />
17
+ <EmailText>
18
+ Hi {{ name }},
19
+ </EmailText>
20
+ <EmailText style="white-space: pre-line">
21
+ {{ message }}
22
+ </EmailText>
23
+ </EmailLayout>
24
+ </template>
@@ -0,0 +1,8 @@
1
+ type __VLS_Props = {
2
+ name: string;
3
+ subject: string;
4
+ message: string;
5
+ };
6
+ 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>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;