@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,14 @@
1
+ import type { ShiftsTeamOption } from '../utils/admin-shifts.js';
2
+ import type { ShiftPerkDto } from '../../../types.js';
3
+ type __VLS_Props = {
4
+ operationId: string;
5
+ teams: ShiftsTeamOption[];
6
+ perk?: ShiftPerkDto;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ close: (saved: false | ShiftPerkDto) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ onClose?: ((saved: false | ShiftPerkDto) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import type { ShiftsTeamOption } from '../utils/admin-shifts.js';
2
+ type __VLS_Props = {
3
+ operationId: string;
4
+ teams: ShiftsTeamOption[];
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,66 @@
1
+ <script setup>
2
+ import { shiftsApi } from "../../utils/api";
3
+ import { computed, h, resolveComponent, tableUi, useFetch, useModuleT, useShiftsActions, useShiftsTranslate } from "#imports";
4
+ defineOptions({ name: "ShiftPerksCard" });
5
+ const props = defineProps({
6
+ operationId: { type: String, required: true },
7
+ teams: { type: Array, required: true }
8
+ });
9
+ const t = useModuleT("shifts");
10
+ const tr = useShiftsTranslate();
11
+ const actions = useShiftsActions();
12
+ const { data: perks, status, refresh } = await useFetch(() => shiftsApi.admin.perks(props.operationId), {
13
+ key: computed(() => `shifts:perks:${props.operationId}`),
14
+ default: () => []
15
+ });
16
+ async function add() {
17
+ if (await actions.createPerk(props.operationId, props.teams)) await refresh();
18
+ }
19
+ const RowMenu = resolveComponent("RowMenu");
20
+ const teamName = (id) => {
21
+ const team = id ? props.teams.find((item) => item.id === id) : void 0;
22
+ return team ? tr(team.name) : t("admin.allTeams", "All teams");
23
+ };
24
+ const columns = computed(() => [
25
+ { accessorKey: "name", header: t("admin.name", "Name"), cell: ({ row }) => h("span", { class: "text-highlighted font-medium" }, tr(row.original.name)) },
26
+ { accessorKey: "voucherType", header: t("perks.voucherType", "Voucher type"), cell: ({ row }) => row.original.voucherType },
27
+ { accessorKey: "teamId", header: t("admin.team", "Team"), cell: ({ row }) => teamName(row.original.teamId) },
28
+ { accessorKey: "quantity", header: t("perks.quantity", "Per shift"), cell: ({ row }) => String(row.original.quantity) },
29
+ { accessorKey: "earned", header: t("perks.earned", "Earned"), cell: ({ row }) => String(row.original.earned ?? 0) },
30
+ {
31
+ id: "actions",
32
+ meta: { class: { th: "w-0", td: "w-0" } },
33
+ cell: ({ row }) => h(RowMenu, { items: actions.perkMenu(row.original, { teams: props.teams, changed: refresh }), subject: tr(row.original.name) })
34
+ }
35
+ ]);
36
+ </script>
37
+
38
+ <template>
39
+ <TableCard
40
+ :title="t('perks.title', 'Perks')"
41
+ :description="t('perks.cardDescription', 'What volunteers earn for every shift they attend, given at the end of the shift. The vouchers app hands it out.')"
42
+ :loading="status === 'pending' && !perks.length"
43
+ >
44
+ <template #actions>
45
+ <UButton
46
+ icon="i-lucide-plus"
47
+ :label="t('perks.create', 'Add perk')"
48
+ @click="add"
49
+ />
50
+ </template>
51
+ <UTable
52
+ :data="perks"
53
+ :columns="columns"
54
+ :ui="tableUi()"
55
+ >
56
+ <template #empty>
57
+ <UEmpty
58
+ icon="i-lucide-utensils"
59
+ :title="t('perks.empty', 'No perks yet')"
60
+ :description="t('perks.emptyDescription', 'Add a perk, for example two beers per shift.')"
61
+ :actions="[{ label: t('perks.create', 'Add perk'), icon: 'i-lucide-plus', onClick: add }]"
62
+ />
63
+ </template>
64
+ </UTable>
65
+ </TableCard>
66
+ </template>
@@ -0,0 +1,8 @@
1
+ import type { ShiftsTeamOption } from '../utils/admin-shifts.js';
2
+ type __VLS_Props = {
3
+ operationId: string;
4
+ teams: ShiftsTeamOption[];
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,10 @@
1
+ type __VLS_Props = {
2
+ paused?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ detect: (code: string) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ onDetect?: ((code: string) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,44 @@
1
+ <script setup>
2
+ import { defineAsyncComponent, ref, useModuleT } from "#imports";
3
+ defineOptions({ name: "ShiftQrScanner" });
4
+ defineProps({
5
+ paused: { type: Boolean, required: false }
6
+ });
7
+ const emit = defineEmits(["detect"]);
8
+ const t = useModuleT("shifts");
9
+ const QrcodeStream = defineAsyncComponent(() => import("vue-qrcode-reader").then((module) => module.QrcodeStream));
10
+ const failure = ref(null);
11
+ function onDetect(codes) {
12
+ const code = codes[0]?.rawValue?.trim();
13
+ if (code) emit("detect", code);
14
+ }
15
+ function onError(error) {
16
+ failure.value = error.name === "NotAllowedError" ? t("scanner.noPermission", "The camera is not allowed. Allow it in the browser, or type the code.") : error.name === "NotFoundError" || error.name === "OverconstrainedError" ? t("scanner.noCamera", "No camera found. Type the code instead.") : t("scanner.cameraFailed", "The camera could not start. Type the code instead.");
17
+ }
18
+ </script>
19
+
20
+ <template>
21
+ <ClientOnly>
22
+ <UAlert
23
+ v-if="failure"
24
+ color="warning"
25
+ variant="subtle"
26
+ icon="i-lucide-camera-off"
27
+ :title="failure"
28
+ />
29
+ <div
30
+ v-else
31
+ class="border-default aspect-square w-full overflow-hidden rounded-lg border"
32
+ >
33
+ <QrcodeStream
34
+ :paused="paused"
35
+ :formats="['qr_code']"
36
+ @detect="onDetect"
37
+ @error="onError"
38
+ />
39
+ </div>
40
+ <template #fallback>
41
+ <USkeleton class="aspect-square w-full" />
42
+ </template>
43
+ </ClientOnly>
44
+ </template>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ paused?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ detect: (code: string) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ onDetect?: ((code: string) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import type { ShiftsLadder, ShiftsTeamOption } from '../utils/admin-shifts.js';
2
+ import type { ShiftRoleDto } from '../../../types.js';
3
+ type __VLS_Props = {
4
+ scheduleId: string;
5
+ teams: ShiftsTeamOption[];
6
+ ladders: ShiftsLadder[];
7
+ role?: ShiftRoleDto;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ close: (saved: false | ShiftRoleDto) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onClose?: ((saved: false | ShiftRoleDto) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,88 @@
1
+ <script setup>
2
+ import { z } from "zod";
3
+ import { shiftsRoleOptions } from "../utils/admin-shifts";
4
+ import { shiftsApi } from "../../utils/api";
5
+ import { $fetch, computed, reactive, useAction, useModuleT, useShiftsTranslate } from "#imports";
6
+ defineOptions({ name: "ShiftRoleSlideover" });
7
+ const props = defineProps({
8
+ scheduleId: { type: String, required: true },
9
+ teams: { type: Array, required: true },
10
+ ladders: { type: Array, required: true },
11
+ role: { type: Object, required: false }
12
+ });
13
+ const emit = defineEmits(["close"]);
14
+ const t = useModuleT("shifts");
15
+ const tr = useShiftsTranslate();
16
+ const { busy, run } = useAction();
17
+ const ANY = "__any__";
18
+ const schema = z.object({
19
+ name: z.custom((value) => !!value && (typeof value === "string" ? !!value.trim() : Object.values(value).some((text) => text?.trim())), t("admin.roleNameRequired", "Give the role a name.")),
20
+ teamId: z.string().min(1, t("admin.teamRequired", "Choose a team.")),
21
+ teamRole: z.string()
22
+ });
23
+ const state = reactive({ name: props.role?.name ?? "", teamId: props.role?.teamId ?? props.teams[0]?.id ?? "", teamRole: props.role?.teamRole ?? ANY });
24
+ const teamOptions = computed(() => props.teams.map((team) => ({ label: tr(team.name), value: team.id })));
25
+ const kind = computed(() => props.teams.find((team) => team.id === state.teamId)?.kind);
26
+ const roleOptions = computed(() => [{ label: t("admin.anyRole", "Anybody on the team"), value: ANY }, ...shiftsRoleOptions(props.ladders, kind.value, tr)]);
27
+ async function save(event) {
28
+ const teamRole = event.data.teamRole === ANY ? null : event.data.teamRole;
29
+ const saved = await run(
30
+ () => props.role ? $fetch(shiftsApi.admin.role(props.role.id), { method: "PATCH", body: { name: event.data.name, teamRole } }) : $fetch(shiftsApi.admin.roles(props.scheduleId), { method: "POST", body: { name: event.data.name, teamId: event.data.teamId, teamRole } }),
31
+ { success: t("admin.roleSaved", "Saved {name}", { name: tr(event.data.name) }) }
32
+ );
33
+ if (saved) emit("close", saved);
34
+ }
35
+ </script>
36
+
37
+ <template>
38
+ <FormSlideover
39
+ form-id="shift-role-form"
40
+ :title="role ? t('admin.editRole', 'Edit shift role') : t('admin.newRole', 'New shift role')"
41
+ :description="t('admin.roleDescription', 'A role people hold on a shift, such as team lead or bartender, with the lowest team role that may hold it.')"
42
+ :submit-label="role ? t('admin.saveRole', 'Save shift role') : t('admin.createRole', 'Add shift role')"
43
+ :loading="busy"
44
+ @close="emit('close', false)"
45
+ >
46
+ <UForm
47
+ id="shift-role-form"
48
+ :schema="schema"
49
+ :state="state"
50
+ class="flex flex-col gap-4"
51
+ @submit="save"
52
+ >
53
+ <UFormField
54
+ name="name"
55
+ :label="t('admin.name', 'Name')"
56
+ required
57
+ >
58
+ <TranslatedInput
59
+ v-model="state.name"
60
+ class="w-full"
61
+ />
62
+ </UFormField>
63
+ <UFormField
64
+ name="teamId"
65
+ :label="t('admin.team', 'Team')"
66
+ required
67
+ >
68
+ <USelect
69
+ v-model="state.teamId"
70
+ :items="teamOptions"
71
+ :disabled="!!role"
72
+ class="w-full"
73
+ />
74
+ </UFormField>
75
+ <UFormField
76
+ name="teamRole"
77
+ :label="t('admin.teamRole', 'Lowest team role')"
78
+ :description="t('admin.teamRoleHelp', 'People below it on the team\'s ladder cannot hold this role.')"
79
+ >
80
+ <USelect
81
+ v-model="state.teamRole"
82
+ :items="roleOptions"
83
+ class="w-full"
84
+ />
85
+ </UFormField>
86
+ </UForm>
87
+ </FormSlideover>
88
+ </template>
@@ -0,0 +1,15 @@
1
+ import type { ShiftsLadder, ShiftsTeamOption } from '../utils/admin-shifts.js';
2
+ import type { ShiftRoleDto } from '../../../types.js';
3
+ type __VLS_Props = {
4
+ scheduleId: string;
5
+ teams: ShiftsTeamOption[];
6
+ ladders: ShiftsLadder[];
7
+ role?: ShiftRoleDto;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ close: (saved: false | ShiftRoleDto) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onClose?: ((saved: false | ShiftRoleDto) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import type { ShiftScheduleSettings } from '../../../types.js';
2
+ type __VLS_ModelProps = {
3
+ modelValue: ShiftScheduleSettings;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:modelValue": (value: ShiftScheduleSettings) => any;
7
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: ShiftScheduleSettings) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,61 @@
1
+ <script setup>
2
+ import { computed, useModuleT, watch } from "#imports";
3
+ defineOptions({ name: "ShiftScheduleSettingsFields" });
4
+ const settings = defineModel({ type: Object, ...{ required: true } });
5
+ const t = useModuleT("shifts");
6
+ watch(() => settings.value.coverage, (coverage) => {
7
+ if (coverage === "all" && settings.value.handover !== "trade") settings.value = { ...settings.value, handover: "trade" };
8
+ });
9
+ const coverages = computed(() => [
10
+ { label: t("admin.coverages.flexible", "Flexible"), value: "flexible", description: t("admin.coverages.flexibleHelp", "Volunteers may give shifts away and take others over.") },
11
+ { label: t("admin.coverages.all", "Every shift"), value: "all", description: t("admin.coverages.allHelp", "Volunteers must work every shift they hold. They can only trade one shift for another.") }
12
+ ]);
13
+ const handovers = computed(() => [
14
+ { label: t("admin.handovers.trade", "Trade"), value: "trade", description: t("admin.handovers.tradeHelp", "Shift for shift: both change hands together, so nobody works fewer shifts.") },
15
+ { label: t("admin.handovers.release", "Give away"), value: "release", description: t("admin.handovers.releaseHelp", "A volunteer gives a shift away and somebody else takes it over."), disabled: settings.value.coverage === "all" },
16
+ { label: t("admin.handovers.both", "Both"), value: "both", description: t("admin.handovers.bothHelp", "Volunteers choose: trade a shift, or give it away."), disabled: settings.value.coverage === "all" }
17
+ ]);
18
+ const approvals = computed(() => [
19
+ { label: t("admin.approvals.peer", "Between volunteers"), value: "peer", description: t("admin.approvals.peerHelp", "A swap is done as soon as the owner accepts an offer.") },
20
+ { label: t("admin.approvals.lead", "A lead approves"), value: "lead", description: t("admin.approvals.leadHelp", "A lead of the team or staff approves each swap the owner accepted.") }
21
+ ]);
22
+ const update = (key, value) => {
23
+ settings.value = { ...settings.value, [key]: value };
24
+ };
25
+ </script>
26
+
27
+ <template>
28
+ <FormRow
29
+ name="coverage"
30
+ :label="t('admin.coverage', 'Coverage')"
31
+ :description="t('admin.coverageHelp', 'Whether volunteers must work every shift they are given.')"
32
+ >
33
+ <URadioGroup
34
+ :model-value="settings.coverage"
35
+ :items="coverages"
36
+ @update:model-value="update('coverage', $event)"
37
+ />
38
+ </FormRow>
39
+ <FormRow
40
+ name="handover"
41
+ :label="t('admin.handover', 'Handover')"
42
+ :description="settings.coverage === 'all' ? t('admin.handoverAllHelp', 'With every shift covered, volunteers can only trade.') : t('admin.handoverHelp', 'How a shift changes hands between volunteers.')"
43
+ >
44
+ <URadioGroup
45
+ :model-value="settings.handover"
46
+ :items="handovers"
47
+ @update:model-value="update('handover', $event)"
48
+ />
49
+ </FormRow>
50
+ <FormRow
51
+ name="approval"
52
+ :label="t('admin.approval', 'Approval')"
53
+ :description="t('admin.approvalHelp', 'Whether a swap the two volunteers agree on needs a lead too.')"
54
+ >
55
+ <URadioGroup
56
+ :model-value="settings.approval"
57
+ :items="approvals"
58
+ @update:model-value="update('approval', $event)"
59
+ />
60
+ </FormRow>
61
+ </template>
@@ -0,0 +1,11 @@
1
+ import type { ShiftScheduleSettings } from '../../../types.js';
2
+ type __VLS_ModelProps = {
3
+ modelValue: ShiftScheduleSettings;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:modelValue": (value: ShiftScheduleSettings) => any;
7
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: ShiftScheduleSettings) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import type { ShiftScheduleDto } from '../../../types.js';
2
+ type __VLS_Props = {
3
+ operationId: string;
4
+ schedule?: ShiftScheduleDto;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ close: (saved: false | ShiftScheduleDto) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((saved: false | ShiftScheduleDto) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,129 @@
1
+ <script setup>
2
+ import { z } from "zod";
3
+ import { shiftsApi } from "../../utils/api";
4
+ import { DEFAULT_SCHEDULE_SETTINGS, SHIFT_APPROVALS, SHIFT_COVERAGES, SHIFT_HANDOVERS, validScheduleSettings } from "../../utils/settings";
5
+ import { $fetch, computed, reactive, useAction, useModuleT, useShiftsTranslate } from "#imports";
6
+ defineOptions({ name: "ShiftScheduleSlideover" });
7
+ const props = defineProps({
8
+ operationId: { type: String, required: true },
9
+ schedule: { type: Object, required: false }
10
+ });
11
+ const emit = defineEmits(["close"]);
12
+ const t = useModuleT("shifts");
13
+ const tr = useShiftsTranslate();
14
+ const { busy, run } = useAction();
15
+ const optionalCount = z.number().int().min(0).nullable();
16
+ const schema = z.object({
17
+ name: z.custom((value) => !!value && (typeof value === "string" ? !!value.trim() : Object.values(value).some((text) => text?.trim())), t("admin.nameRequired", "Give the schedule a name.")),
18
+ coverage: z.enum(SHIFT_COVERAGES),
19
+ handover: z.enum(SHIFT_HANDOVERS),
20
+ approval: z.enum(SHIFT_APPROVALS),
21
+ minPerShift: optionalCount,
22
+ maxPerShift: optionalCount,
23
+ maxShiftsPerDay: z.number().int().min(1).max(24).nullable(),
24
+ minRestHours: z.number().min(0).max(72).nullable()
25
+ }).refine(validScheduleSettings, { message: t("admin.handoverAllHelp", "With every shift covered, volunteers can only trade."), path: ["handover"] });
26
+ const state = reactive({
27
+ name: props.schedule?.name ?? "",
28
+ coverage: props.schedule?.coverage ?? DEFAULT_SCHEDULE_SETTINGS.coverage,
29
+ handover: props.schedule?.handover ?? DEFAULT_SCHEDULE_SETTINGS.handover,
30
+ approval: props.schedule?.approval ?? DEFAULT_SCHEDULE_SETTINGS.approval,
31
+ minPerShift: props.schedule?.minPerShift ?? null,
32
+ maxPerShift: props.schedule?.maxPerShift ?? null,
33
+ maxShiftsPerDay: props.schedule?.guards.maxShiftsPerDay ?? null,
34
+ minRestHours: props.schedule?.guards.minRestHours ?? null
35
+ });
36
+ const settings = computed({
37
+ get: () => ({ coverage: state.coverage, handover: state.handover, approval: state.approval }),
38
+ set: (value) => Object.assign(state, value)
39
+ });
40
+ async function save(event) {
41
+ const { name, coverage, handover, approval, minPerShift, maxPerShift, maxShiftsPerDay, minRestHours } = event.data;
42
+ const body = { name, coverage, handover, approval, minPerShift, maxPerShift, guards: { maxShiftsPerDay, minRestHours } };
43
+ const saved = await run(
44
+ () => props.schedule ? $fetch(shiftsApi.admin.schedule(props.schedule.id), { method: "PATCH", body }) : $fetch(shiftsApi.admin.schedules, { method: "POST", body: { operationId: props.operationId, ...body } }),
45
+ { success: t("admin.scheduleSaved", "Saved {name}", { name: tr(name) }) }
46
+ );
47
+ if (saved) emit("close", saved);
48
+ }
49
+ </script>
50
+
51
+ <template>
52
+ <FormSlideover
53
+ form-id="shift-schedule-form"
54
+ :title="schedule ? t('admin.editSchedule', 'Edit schedule') : t('admin.newSchedule', 'New schedule')"
55
+ :description="t('admin.scheduleDescription', 'A schedule holds the shifts of an operation. It stays a draft until you publish it.')"
56
+ :submit-label="schedule ? t('admin.saveSchedule', 'Save schedule') : t('admin.createSchedule', 'Create schedule')"
57
+ :loading="busy"
58
+ @close="emit('close', false)"
59
+ >
60
+ <UForm
61
+ id="shift-schedule-form"
62
+ :schema="schema"
63
+ :state="state"
64
+ class="flex flex-col gap-4"
65
+ @submit="save"
66
+ >
67
+ <UFormField
68
+ name="name"
69
+ :label="t('admin.name', 'Name')"
70
+ required
71
+ >
72
+ <TranslatedInput
73
+ v-model="state.name"
74
+ class="w-full"
75
+ />
76
+ </UFormField>
77
+ <div class="divide-default border-default divide-y border-y py-4">
78
+ <ShiftScheduleSettingsFields v-model="settings" />
79
+ </div>
80
+ <div class="grid grid-cols-2 gap-4">
81
+ <UFormField
82
+ name="minPerShift"
83
+ :label="t('admin.minPerShift', 'Minimum per shift')"
84
+ :description="t('admin.minPerShiftHelp', 'Fewer shows the shift as short.')"
85
+ >
86
+ <UInputNumber
87
+ v-model="state.minPerShift"
88
+ :min="0"
89
+ class="w-full"
90
+ />
91
+ </UFormField>
92
+ <UFormField
93
+ name="maxPerShift"
94
+ :label="t('admin.maxPerShift', 'Maximum per shift')"
95
+ :description="t('admin.maxPerShiftHelp', 'Used when a shift sets no capacity. Empty is no limit.')"
96
+ >
97
+ <UInputNumber
98
+ v-model="state.maxPerShift"
99
+ :min="0"
100
+ class="w-full"
101
+ />
102
+ </UFormField>
103
+ <UFormField
104
+ name="maxShiftsPerDay"
105
+ :label="t('admin.maxShiftsPerDay', 'Shifts per person per day')"
106
+ :description="t('admin.maxShiftsPerDayHelp', 'More shows a warning; volunteers cannot swap past it.')"
107
+ >
108
+ <UInputNumber
109
+ v-model="state.maxShiftsPerDay"
110
+ :min="1"
111
+ class="w-full"
112
+ />
113
+ </UFormField>
114
+ <UFormField
115
+ name="minRestHours"
116
+ :label="t('admin.minRestHours', 'Rest between shifts (hours)')"
117
+ :description="t('admin.minRestHoursHelp', 'Less shows a warning; volunteers cannot swap past it.')"
118
+ >
119
+ <UInputNumber
120
+ v-model="state.minRestHours"
121
+ :min="0"
122
+ :step="0.5"
123
+ class="w-full"
124
+ />
125
+ </UFormField>
126
+ </div>
127
+ </UForm>
128
+ </FormSlideover>
129
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { ShiftScheduleDto } from '../../../types.js';
2
+ type __VLS_Props = {
3
+ operationId: string;
4
+ schedule?: ShiftScheduleDto;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ close: (saved: false | ShiftScheduleDto) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onClose?: ((saved: false | ShiftScheduleDto) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { ShiftRoleDto, ShiftWithAssigneesDto } from '../../../types.js';
2
+ type __VLS_Props = {
3
+ shift: ShiftWithAssigneesDto;
4
+ roles: ShiftRoleDto[];
5
+ minPerShift?: number | null;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ close: (changed: boolean) => any;
9
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ onClose?: ((changed: boolean) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;