@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.
- package/README.md +53 -2
- package/dist/module.d.mts +716 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +272 -0
- package/dist/runtime/access.d.ts +2 -0
- package/dist/runtime/access.js +84 -0
- package/dist/runtime/app/components/ShiftBroadcastSlideover.d.vue.ts +19 -0
- package/dist/runtime/app/components/ShiftBroadcastSlideover.vue +142 -0
- package/dist/runtime/app/components/ShiftBroadcastSlideover.vue.d.ts +19 -0
- package/dist/runtime/app/components/ShiftBroadcastsCard.d.vue.ts +9 -0
- package/dist/runtime/app/components/ShiftBroadcastsCard.vue +74 -0
- package/dist/runtime/app/components/ShiftBroadcastsCard.vue.d.ts +9 -0
- package/dist/runtime/app/components/ShiftBulkSlideover.d.vue.ts +15 -0
- package/dist/runtime/app/components/ShiftBulkSlideover.vue +185 -0
- package/dist/runtime/app/components/ShiftBulkSlideover.vue.d.ts +15 -0
- package/dist/runtime/app/components/ShiftCheckInCard.d.vue.ts +13 -0
- package/dist/runtime/app/components/ShiftCheckInCard.vue +238 -0
- package/dist/runtime/app/components/ShiftCheckInCard.vue.d.ts +13 -0
- package/dist/runtime/app/components/ShiftCopySlideover.d.vue.ts +11 -0
- package/dist/runtime/app/components/ShiftCopySlideover.vue +71 -0
- package/dist/runtime/app/components/ShiftCopySlideover.vue.d.ts +11 -0
- package/dist/runtime/app/components/ShiftDayView.d.vue.ts +16 -0
- package/dist/runtime/app/components/ShiftDayView.vue +124 -0
- package/dist/runtime/app/components/ShiftDayView.vue.d.ts +16 -0
- package/dist/runtime/app/components/ShiftFeedSlideover.d.vue.ts +7 -0
- package/dist/runtime/app/components/ShiftFeedSlideover.vue +172 -0
- package/dist/runtime/app/components/ShiftFeedSlideover.vue.d.ts +7 -0
- package/dist/runtime/app/components/ShiftNowCard.d.vue.ts +6 -0
- package/dist/runtime/app/components/ShiftNowCard.vue +83 -0
- package/dist/runtime/app/components/ShiftNowCard.vue.d.ts +6 -0
- package/dist/runtime/app/components/ShiftPassFullscreen.d.vue.ts +13 -0
- package/dist/runtime/app/components/ShiftPassFullscreen.vue +79 -0
- package/dist/runtime/app/components/ShiftPassFullscreen.vue.d.ts +13 -0
- package/dist/runtime/app/components/ShiftPerkSlideover.d.vue.ts +14 -0
- package/dist/runtime/app/components/ShiftPerkSlideover.vue +103 -0
- package/dist/runtime/app/components/ShiftPerkSlideover.vue.d.ts +14 -0
- package/dist/runtime/app/components/ShiftPerksCard.d.vue.ts +8 -0
- package/dist/runtime/app/components/ShiftPerksCard.vue +66 -0
- package/dist/runtime/app/components/ShiftPerksCard.vue.d.ts +8 -0
- package/dist/runtime/app/components/ShiftQrScanner.d.vue.ts +10 -0
- package/dist/runtime/app/components/ShiftQrScanner.vue +44 -0
- package/dist/runtime/app/components/ShiftQrScanner.vue.d.ts +10 -0
- package/dist/runtime/app/components/ShiftRoleSlideover.d.vue.ts +15 -0
- package/dist/runtime/app/components/ShiftRoleSlideover.vue +88 -0
- package/dist/runtime/app/components/ShiftRoleSlideover.vue.d.ts +15 -0
- package/dist/runtime/app/components/ShiftScheduleSettingsFields.d.vue.ts +11 -0
- package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue +61 -0
- package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue.d.ts +11 -0
- package/dist/runtime/app/components/ShiftScheduleSlideover.d.vue.ts +12 -0
- package/dist/runtime/app/components/ShiftScheduleSlideover.vue +129 -0
- package/dist/runtime/app/components/ShiftScheduleSlideover.vue.d.ts +12 -0
- package/dist/runtime/app/components/ShiftSlideover.d.vue.ts +13 -0
- package/dist/runtime/app/components/ShiftSlideover.vue +353 -0
- package/dist/runtime/app/components/ShiftSlideover.vue.d.ts +13 -0
- package/dist/runtime/app/components/ShiftStationSlideover.d.vue.ts +15 -0
- package/dist/runtime/app/components/ShiftStationSlideover.vue +92 -0
- package/dist/runtime/app/components/ShiftStationSlideover.vue.d.ts +15 -0
- package/dist/runtime/app/composables/index.d.ts +6 -0
- package/dist/runtime/app/composables/index.js +5 -0
- package/dist/runtime/app/composables/useShiftsActions.d.ts +61 -0
- package/dist/runtime/app/composables/useShiftsActions.js +224 -0
- package/dist/runtime/app/composables/useShiftsFormat.d.ts +12 -0
- package/dist/runtime/app/composables/useShiftsFormat.js +14 -0
- package/dist/runtime/app/composables/useShiftsLinks.d.ts +12 -0
- package/dist/runtime/app/composables/useShiftsLinks.js +6 -0
- package/dist/runtime/app/composables/useShiftsTranslate.d.ts +5 -0
- package/dist/runtime/app/composables/useShiftsTranslate.js +12 -0
- package/dist/runtime/app/composables/useShiftsVenueFeatures.d.ts +17 -0
- package/dist/runtime/app/composables/useShiftsVenueFeatures.js +18 -0
- package/dist/runtime/app/dashboard/NextShift.d.vue.ts +3 -0
- package/dist/runtime/app/dashboard/NextShift.vue +69 -0
- package/dist/runtime/app/dashboard/NextShift.vue.d.ts +3 -0
- package/dist/runtime/app/dashboard/OpenSwaps.d.vue.ts +3 -0
- package/dist/runtime/app/dashboard/OpenSwaps.vue +69 -0
- package/dist/runtime/app/dashboard/OpenSwaps.vue.d.ts +3 -0
- package/dist/runtime/app/dashboard/TeamOnNow.d.vue.ts +3 -0
- package/dist/runtime/app/dashboard/TeamOnNow.vue +72 -0
- package/dist/runtime/app/dashboard/TeamOnNow.vue.d.ts +3 -0
- package/dist/runtime/app/pages/check-in.d.vue.ts +3 -0
- package/dist/runtime/app/pages/check-in.vue +93 -0
- package/dist/runtime/app/pages/check-in.vue.d.ts +3 -0
- package/dist/runtime/app/pages/lead.d.vue.ts +3 -0
- package/dist/runtime/app/pages/lead.vue +300 -0
- package/dist/runtime/app/pages/lead.vue.d.ts +3 -0
- package/dist/runtime/app/pages/shift.d.vue.ts +3 -0
- package/dist/runtime/app/pages/shift.vue +482 -0
- package/dist/runtime/app/pages/shift.vue.d.ts +3 -0
- package/dist/runtime/app/pages/shifts.d.vue.ts +3 -0
- package/dist/runtime/app/pages/shifts.vue +21 -0
- package/dist/runtime/app/pages/shifts.vue.d.ts +3 -0
- package/dist/runtime/app/pages/station.d.vue.ts +3 -0
- package/dist/runtime/app/pages/station.vue +104 -0
- package/dist/runtime/app/pages/station.vue.d.ts +3 -0
- package/dist/runtime/app/pages/swaps.d.vue.ts +3 -0
- package/dist/runtime/app/pages/swaps.vue +32 -0
- package/dist/runtime/app/pages/swaps.vue.d.ts +3 -0
- package/dist/runtime/app/tabs/HomeShifts.d.vue.ts +6 -0
- package/dist/runtime/app/tabs/HomeShifts.vue +194 -0
- package/dist/runtime/app/tabs/HomeShifts.vue.d.ts +6 -0
- package/dist/runtime/app/tabs/HomeSwaps.d.vue.ts +3 -0
- package/dist/runtime/app/tabs/HomeSwaps.vue +188 -0
- package/dist/runtime/app/tabs/HomeSwaps.vue.d.ts +3 -0
- package/dist/runtime/app/tabs/Shifts.d.vue.ts +9 -0
- package/dist/runtime/app/tabs/Shifts.vue +487 -0
- package/dist/runtime/app/tabs/Shifts.vue.d.ts +9 -0
- package/dist/runtime/app/utils/admin-shifts.d.ts +42 -0
- package/dist/runtime/app/utils/admin-shifts.js +36 -0
- package/dist/runtime/dashboard.d.ts +8 -0
- package/dist/runtime/dashboard.js +30 -0
- package/dist/runtime/emails/shifts-broadcast.d.vue.ts +8 -0
- package/dist/runtime/emails/shifts-broadcast.vue +24 -0
- package/dist/runtime/emails/shifts-broadcast.vue.d.ts +8 -0
- package/dist/runtime/emails/shifts-reminder.d.vue.ts +12 -0
- package/dist/runtime/emails/shifts-reminder.vue +34 -0
- package/dist/runtime/emails/shifts-reminder.vue.d.ts +12 -0
- package/dist/runtime/emails/shifts-swap-accepted.d.vue.ts +11 -0
- package/dist/runtime/emails/shifts-swap-accepted.vue +32 -0
- package/dist/runtime/emails/shifts-swap-accepted.vue.d.ts +11 -0
- package/dist/runtime/emails/shifts-swap-completed.d.vue.ts +11 -0
- package/dist/runtime/emails/shifts-swap-completed.vue +32 -0
- package/dist/runtime/emails/shifts-swap-completed.vue.d.ts +11 -0
- package/dist/runtime/emails/shifts-swap-offered.d.vue.ts +11 -0
- package/dist/runtime/emails/shifts-swap-offered.vue +32 -0
- package/dist/runtime/emails/shifts-swap-offered.vue.d.ts +11 -0
- package/dist/runtime/emails/shifts-swap-pending.d.vue.ts +11 -0
- package/dist/runtime/emails/shifts-swap-pending.vue +32 -0
- package/dist/runtime/emails/shifts-swap-pending.vue.d.ts +11 -0
- package/dist/runtime/emails/shifts-swap-proposed.d.vue.ts +11 -0
- package/dist/runtime/emails/shifts-swap-proposed.vue +32 -0
- package/dist/runtime/emails/shifts-swap-proposed.vue.d.ts +11 -0
- package/dist/runtime/emails/shifts-swap-rejected.d.vue.ts +11 -0
- package/dist/runtime/emails/shifts-swap-rejected.vue +32 -0
- package/dist/runtime/emails/shifts-swap-rejected.vue.d.ts +11 -0
- package/dist/runtime/i18n/lang/da.json +627 -0
- package/dist/runtime/i18n/lang/en.json +627 -0
- package/dist/runtime/notifications.d.ts +9 -0
- package/dist/runtime/notifications.js +36 -0
- package/dist/runtime/server/db/schema.postgresql.d.ts +2151 -0
- package/dist/runtime/server/db/schema.postgresql.js +228 -0
- package/dist/runtime/server/db/schema.sqlite.d.ts +2263 -0
- package/dist/runtime/server/db/schema.sqlite.js +228 -0
- package/dist/runtime/server/digest-email.d.ts +17 -0
- package/dist/runtime/server/digest-email.js +42 -0
- package/dist/runtime/server/plugins/station-key.d.ts +2 -0
- package/dist/runtime/server/plugins/station-key.js +5 -0
- package/dist/runtime/server/plugins/teams.d.ts +2 -0
- package/dist/runtime/server/plugins/teams.js +19 -0
- package/dist/runtime/server/policies.d.ts +2 -0
- package/dist/runtime/server/policies.js +41 -0
- package/dist/runtime/server/reminder-email.d.ts +67 -0
- package/dist/runtime/server/reminder-email.js +109 -0
- package/dist/runtime/server/routes/admin/assignment.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/assignment.delete.js +10 -0
- package/dist/runtime/server/routes/admin/assignments.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/assignments.post.js +11 -0
- package/dist/runtime/server/routes/admin/broadcasts.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/broadcasts.get.js +8 -0
- package/dist/runtime/server/routes/admin/broadcasts.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/broadcasts.post.js +9 -0
- package/dist/runtime/server/routes/admin/candidates.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/candidates.get.js +10 -0
- package/dist/runtime/server/routes/admin/operation-teams.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/operation-teams.get.js +9 -0
- package/dist/runtime/server/routes/admin/perk.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/perk.delete.js +10 -0
- package/dist/runtime/server/routes/admin/perk.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/perk.patch.js +10 -0
- package/dist/runtime/server/routes/admin/perks.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/perks.get.js +9 -0
- package/dist/runtime/server/routes/admin/perks.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/perks.post.js +10 -0
- package/dist/runtime/server/routes/admin/role.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/role.delete.js +11 -0
- package/dist/runtime/server/routes/admin/role.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/role.patch.js +11 -0
- package/dist/runtime/server/routes/admin/roles.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/roles.get.js +9 -0
- package/dist/runtime/server/routes/admin/roles.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/roles.post.js +10 -0
- package/dist/runtime/server/routes/admin/schedule-copy.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/schedule-copy.post.js +12 -0
- package/dist/runtime/server/routes/admin/schedule-publish.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/schedule-publish.post.js +9 -0
- package/dist/runtime/server/routes/admin/schedule.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/schedule.delete.js +10 -0
- package/dist/runtime/server/routes/admin/schedule.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/schedule.get.js +9 -0
- package/dist/runtime/server/routes/admin/schedule.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/schedule.patch.js +10 -0
- package/dist/runtime/server/routes/admin/schedules.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/schedules.get.js +10 -0
- package/dist/runtime/server/routes/admin/schedules.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/schedules.post.js +9 -0
- package/dist/runtime/server/routes/admin/shift.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/shift.delete.js +10 -0
- package/dist/runtime/server/routes/admin/shift.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/shift.patch.js +10 -0
- package/dist/runtime/server/routes/admin/shifts-bulk.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/shifts-bulk.post.js +10 -0
- package/dist/runtime/server/routes/admin/shifts.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/shifts.get.js +10 -0
- package/dist/runtime/server/routes/admin/station.delete.d.ts +2 -0
- package/dist/runtime/server/routes/admin/station.delete.js +11 -0
- package/dist/runtime/server/routes/admin/station.patch.d.ts +2 -0
- package/dist/runtime/server/routes/admin/station.patch.js +11 -0
- package/dist/runtime/server/routes/admin/stations.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/stations.get.js +9 -0
- package/dist/runtime/server/routes/admin/stations.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/stations.post.js +10 -0
- package/dist/runtime/server/routes/admin/swap-cancel.post.d.ts +2 -0
- package/dist/runtime/server/routes/admin/swap-cancel.post.js +10 -0
- package/dist/runtime/server/routes/admin/swaps.get.d.ts +2 -0
- package/dist/runtime/server/routes/admin/swaps.get.js +10 -0
- package/dist/runtime/server/routes/feed/feed.get.d.ts +2 -0
- package/dist/runtime/server/routes/feed/feed.get.js +9 -0
- package/dist/runtime/server/routes/lead/attended.post.d.ts +2 -0
- package/dist/runtime/server/routes/lead/attended.post.js +11 -0
- package/dist/runtime/server/routes/lead/broadcast.post.d.ts +2 -0
- package/dist/runtime/server/routes/lead/broadcast.post.js +12 -0
- package/dist/runtime/server/routes/lead/check-in.post.d.ts +2 -0
- package/dist/runtime/server/routes/lead/check-in.post.js +9 -0
- package/dist/runtime/server/routes/lead/exceptions.get.d.ts +2 -0
- package/dist/runtime/server/routes/lead/exceptions.get.js +8 -0
- package/dist/runtime/server/routes/lead/no-show.post.d.ts +2 -0
- package/dist/runtime/server/routes/lead/no-show.post.js +11 -0
- package/dist/runtime/server/routes/lead/now.get.d.ts +2 -0
- package/dist/runtime/server/routes/lead/now.get.js +9 -0
- package/dist/runtime/server/routes/lead/on-duty.get.d.ts +2 -0
- package/dist/runtime/server/routes/lead/on-duty.get.js +10 -0
- package/dist/runtime/server/routes/lead/stations.get.d.ts +2 -0
- package/dist/runtime/server/routes/lead/stations.get.js +8 -0
- package/dist/runtime/server/routes/lead/team-shifts.get.d.ts +2 -0
- package/dist/runtime/server/routes/lead/team-shifts.get.js +9 -0
- package/dist/runtime/server/routes/lead/team-swaps.get.d.ts +2 -0
- package/dist/runtime/server/routes/lead/team-swaps.get.js +9 -0
- package/dist/runtime/server/routes/me/check-in.post.d.ts +2 -0
- package/dist/runtime/server/routes/me/check-in.post.js +11 -0
- package/dist/runtime/server/routes/me/earned-perk-claim.post.d.ts +2 -0
- package/dist/runtime/server/routes/me/earned-perk-claim.post.js +10 -0
- package/dist/runtime/server/routes/me/earned-perks.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/earned-perks.get.js +9 -0
- package/dist/runtime/server/routes/me/feed-token.delete.d.ts +2 -0
- package/dist/runtime/server/routes/me/feed-token.delete.js +7 -0
- package/dist/runtime/server/routes/me/feed-token.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/feed-token.get.js +6 -0
- package/dist/runtime/server/routes/me/feed-token.post.d.ts +2 -0
- package/dist/runtime/server/routes/me/feed-token.post.js +7 -0
- package/dist/runtime/server/routes/me/leads.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/leads.get.js +5 -0
- package/dist/runtime/server/routes/me/now.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/now.get.js +5 -0
- package/dist/runtime/server/routes/me/pass.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/pass.get.js +11 -0
- package/dist/runtime/server/routes/me/settle.post.d.ts +2 -0
- package/dist/runtime/server/routes/me/settle.post.js +14 -0
- package/dist/runtime/server/routes/me/shift.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/shift.get.js +10 -0
- package/dist/runtime/server/routes/me/shifts.get.d.ts +2 -0
- package/dist/runtime/server/routes/me/shifts.get.js +6 -0
- package/dist/runtime/server/routes/me/swap.delete.d.ts +2 -0
- package/dist/runtime/server/routes/me/swap.delete.js +11 -0
- package/dist/runtime/server/routes/me/swap.post.d.ts +2 -0
- package/dist/runtime/server/routes/me/swap.post.js +11 -0
- package/dist/runtime/server/routes/stations/token.get.d.ts +2 -0
- package/dist/runtime/server/routes/stations/token.get.js +12 -0
- package/dist/runtime/server/routes/swaps/approve.post.d.ts +2 -0
- package/dist/runtime/server/routes/swaps/approve.post.js +9 -0
- package/dist/runtime/server/routes/swaps/list.get.d.ts +2 -0
- package/dist/runtime/server/routes/swaps/list.get.js +5 -0
- package/dist/runtime/server/routes/swaps/offer-accept.post.d.ts +2 -0
- package/dist/runtime/server/routes/swaps/offer-accept.post.js +9 -0
- package/dist/runtime/server/routes/swaps/offer-reject.post.d.ts +2 -0
- package/dist/runtime/server/routes/swaps/offer-reject.post.js +9 -0
- package/dist/runtime/server/routes/swaps/offer.delete.d.ts +2 -0
- package/dist/runtime/server/routes/swaps/offer.delete.js +11 -0
- package/dist/runtime/server/routes/swaps/offer.post.d.ts +2 -0
- package/dist/runtime/server/routes/swaps/offer.post.js +11 -0
- package/dist/runtime/server/routes/swaps/reject.post.d.ts +2 -0
- package/dist/runtime/server/routes/swaps/reject.post.js +9 -0
- package/dist/runtime/server/swap-email.d.ts +28 -0
- package/dist/runtime/server/swap-email.js +49 -0
- package/dist/runtime/server/tasks/close-shifts.d.ts +2 -0
- package/dist/runtime/server/tasks/close-shifts.js +9 -0
- package/dist/runtime/server/tasks/send-reminders.d.ts +2 -0
- package/dist/runtime/server/tasks/send-reminders.js +9 -0
- package/dist/runtime/server/utils/shifts-admin.d.ts +67 -0
- package/dist/runtime/server/utils/shifts-admin.js +312 -0
- package/dist/runtime/server/utils/shifts-assign.d.ts +89 -0
- package/dist/runtime/server/utils/shifts-assign.js +264 -0
- package/dist/runtime/server/utils/shifts-automation.d.ts +37 -0
- package/dist/runtime/server/utils/shifts-automation.js +171 -0
- package/dist/runtime/server/utils/shifts-broadcasts.d.ts +38 -0
- package/dist/runtime/server/utils/shifts-broadcasts.js +113 -0
- package/dist/runtime/server/utils/shifts-core.d.ts +78 -0
- package/dist/runtime/server/utils/shifts-core.js +142 -0
- package/dist/runtime/server/utils/shifts-dto.d.ts +32 -0
- package/dist/runtime/server/utils/shifts-dto.js +127 -0
- package/dist/runtime/server/utils/shifts-emails.d.ts +16 -0
- package/dist/runtime/server/utils/shifts-emails.js +44 -0
- package/dist/runtime/server/utils/shifts-exceptions.d.ts +7 -0
- package/dist/runtime/server/utils/shifts-exceptions.js +32 -0
- package/dist/runtime/server/utils/shifts-feed.d.ts +16 -0
- package/dist/runtime/server/utils/shifts-feed.js +73 -0
- package/dist/runtime/server/utils/shifts-notify.d.ts +40 -0
- package/dist/runtime/server/utils/shifts-notify.js +22 -0
- package/dist/runtime/server/utils/shifts-on-duty.d.ts +12 -0
- package/dist/runtime/server/utils/shifts-on-duty.js +37 -0
- package/dist/runtime/server/utils/shifts-perks.d.ts +46 -0
- package/dist/runtime/server/utils/shifts-perks.js +183 -0
- package/dist/runtime/server/utils/shifts-reminders.d.ts +30 -0
- package/dist/runtime/server/utils/shifts-reminders.js +102 -0
- package/dist/runtime/server/utils/shifts-schemas.d.ts +318 -0
- package/dist/runtime/server/utils/shifts-schemas.js +177 -0
- package/dist/runtime/server/utils/shifts-station-key.d.ts +7 -0
- package/dist/runtime/server/utils/shifts-station-key.js +22 -0
- package/dist/runtime/server/utils/shifts-stations.d.ts +28 -0
- package/dist/runtime/server/utils/shifts-stations.js +109 -0
- package/dist/runtime/server/utils/shifts-swaps.d.ts +114 -0
- package/dist/runtime/server/utils/shifts-swaps.js +559 -0
- package/dist/runtime/server/utils/shifts-views.d.ts +62 -0
- package/dist/runtime/server/utils/shifts-views.js +212 -0
- package/dist/runtime/utils/api.d.ts +108 -0
- package/dist/runtime/utils/api.js +111 -0
- package/dist/runtime/utils/checkin.d.ts +59 -0
- package/dist/runtime/utils/checkin.js +57 -0
- package/dist/runtime/utils/guards.d.ts +21 -0
- package/dist/runtime/utils/guards.js +36 -0
- package/dist/runtime/utils/ics.d.ts +32 -0
- package/dist/runtime/utils/ics.js +56 -0
- package/dist/runtime/utils/index.d.ts +16 -0
- package/dist/runtime/utils/index.js +15 -0
- package/dist/runtime/utils/links.d.ts +44 -0
- package/dist/runtime/utils/links.js +21 -0
- package/dist/runtime/utils/reminders.d.ts +27 -0
- package/dist/runtime/utils/reminders.js +28 -0
- package/dist/runtime/utils/settings.d.ts +28 -0
- package/dist/runtime/utils/settings.js +18 -0
- package/dist/runtime/utils/station-key.d.ts +9 -0
- package/dist/runtime/utils/station-key.js +12 -0
- package/dist/runtime/utils/status.d.ts +23 -0
- package/dist/runtime/utils/status.js +46 -0
- package/dist/runtime/utils/time.d.ts +22 -0
- package/dist/runtime/utils/time.js +14 -0
- package/dist/types.d.mts +5 -0
- package/package.json +131 -3
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { refDebounced } from "@vueuse/core";
|
|
4
|
+
import { toZonedInput, warningColor, zonedInputToIso } from "../utils/admin-shifts";
|
|
5
|
+
import { shiftsApi } from "../../utils/api";
|
|
6
|
+
import { SHIFT_ASSIGNMENT_STATUS_LABELS } from "../../utils/status";
|
|
7
|
+
import { $fetch, computed, errorMessage, reactive, ref, SHIFTS_NO_FEATURE, useAction, useConfirmDialog, useLazyFetch, useModuleT, useShiftsFormat, useShiftsTranslate, useShiftsVenueFeatures, useToast } from "#imports";
|
|
8
|
+
defineOptions({ name: "ShiftSlideover" });
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
shift: { type: Object, required: true },
|
|
11
|
+
roles: { type: Array, required: true },
|
|
12
|
+
minPerShift: { type: [Number, null], required: false }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["close"]);
|
|
15
|
+
const t = useModuleT("shifts");
|
|
16
|
+
const tr = useShiftsTranslate();
|
|
17
|
+
const format = useShiftsFormat();
|
|
18
|
+
const toast = useToast();
|
|
19
|
+
const confirm = useConfirmDialog();
|
|
20
|
+
const { busy, run } = useAction();
|
|
21
|
+
const timeZone = format.timeZone;
|
|
22
|
+
const current = ref(props.shift);
|
|
23
|
+
const changed = ref(false);
|
|
24
|
+
const assignees = computed(() => current.value.assignees);
|
|
25
|
+
const active = computed(() => assignees.value.filter((item) => item.status === "assigned" || item.status === "attended"));
|
|
26
|
+
const NONE = "__none__";
|
|
27
|
+
const schema = z.object({
|
|
28
|
+
startsAt: z.string().min(1),
|
|
29
|
+
endsAt: z.string().min(1),
|
|
30
|
+
capacity: z.number().int().min(0).nullable(),
|
|
31
|
+
shiftRoleId: z.string(),
|
|
32
|
+
featureId: z.string()
|
|
33
|
+
}).refine((value) => value.endsAt > value.startsAt, { message: t("admin.endsAfterStart", "A shift must end after it starts."), path: ["endsAt"] });
|
|
34
|
+
const state = reactive({
|
|
35
|
+
startsAt: toZonedInput(props.shift.startsAt, timeZone),
|
|
36
|
+
endsAt: toZonedInput(props.shift.endsAt, timeZone),
|
|
37
|
+
capacity: props.shift.capacity,
|
|
38
|
+
shiftRoleId: props.shift.shiftRoleId ?? NONE,
|
|
39
|
+
featureId: props.shift.location?.featureId ?? SHIFTS_NO_FEATURE
|
|
40
|
+
});
|
|
41
|
+
const venue = useShiftsVenueFeatures(() => props.shift.operationId);
|
|
42
|
+
const roleOptions = computed(() => [
|
|
43
|
+
{ label: t("admin.noRole", "No role"), value: NONE },
|
|
44
|
+
...props.roles.filter((role) => role.teamId === props.shift.teamId).map((role) => ({ label: tr(role.name), value: role.id }))
|
|
45
|
+
]);
|
|
46
|
+
async function save(event) {
|
|
47
|
+
const body = {
|
|
48
|
+
startsAt: zonedInputToIso(event.data.startsAt, timeZone),
|
|
49
|
+
endsAt: zonedInputToIso(event.data.endsAt, timeZone),
|
|
50
|
+
capacity: event.data.capacity,
|
|
51
|
+
shiftRoleId: event.data.shiftRoleId === NONE ? null : event.data.shiftRoleId,
|
|
52
|
+
location: shiftLocation(event.data.featureId)
|
|
53
|
+
};
|
|
54
|
+
const saved = await run(
|
|
55
|
+
() => $fetch(shiftsApi.admin.shift(current.value.id), { method: "PATCH", body }),
|
|
56
|
+
{ success: t("admin.shiftSaved", "Saved the shift") }
|
|
57
|
+
);
|
|
58
|
+
if (saved) emit("close", true);
|
|
59
|
+
}
|
|
60
|
+
function shiftLocation(featureId) {
|
|
61
|
+
const location = { ...props.shift.location };
|
|
62
|
+
if (featureId === SHIFTS_NO_FEATURE) delete location.featureId;
|
|
63
|
+
else location.featureId = featureId;
|
|
64
|
+
return Object.keys(location).length ? location : null;
|
|
65
|
+
}
|
|
66
|
+
const statusLabel = (status) => t(`statuses.${status}`, SHIFT_ASSIGNMENT_STATUS_LABELS[status]);
|
|
67
|
+
const nameOf = (person) => person.name ?? `#${person.userId}`;
|
|
68
|
+
function replaceAssignee(updated) {
|
|
69
|
+
const list = current.value.assignees.filter((item) => item.id !== updated.id);
|
|
70
|
+
if (updated.status !== "cancelled") list.push(updated);
|
|
71
|
+
current.value = { ...current.value, assignees: list, filled: list.filter((item) => item.status === "assigned" || item.status === "attended").length };
|
|
72
|
+
changed.value = true;
|
|
73
|
+
}
|
|
74
|
+
async function mark(assignee, to) {
|
|
75
|
+
const updated = await run(
|
|
76
|
+
() => $fetch(to === "attended" ? shiftsApi.attended(assignee.id) : shiftsApi.noShow(assignee.id), { method: "POST" }),
|
|
77
|
+
{ success: t("admin.marked", "Marked {name} {status}", { name: nameOf(assignee.person), status: statusLabel(to).toLowerCase() }) }
|
|
78
|
+
);
|
|
79
|
+
if (updated) replaceAssignee(updated);
|
|
80
|
+
}
|
|
81
|
+
async function cancelAssignment(assignee) {
|
|
82
|
+
const name = nameOf(assignee.person);
|
|
83
|
+
const confirmed = await confirm({
|
|
84
|
+
title: t("admin.cancelAssignmentTitle", "Take {name} off this shift?", { name }),
|
|
85
|
+
description: t("admin.cancelAssignmentDescription", "Their place is freed and an open swap of it is cancelled."),
|
|
86
|
+
confirmText: t("admin.cancelAssignment", "Remove from shift"),
|
|
87
|
+
destructive: true
|
|
88
|
+
});
|
|
89
|
+
if (!confirmed) return;
|
|
90
|
+
const done = await run(
|
|
91
|
+
() => $fetch(shiftsApi.admin.assignment(assignee.id), { method: "DELETE" }).then(() => true),
|
|
92
|
+
{ success: t("admin.assignmentCancelled", "Took {name} off the shift", { name }) }
|
|
93
|
+
);
|
|
94
|
+
if (done) replaceAssignee({ ...assignee, status: "cancelled" });
|
|
95
|
+
}
|
|
96
|
+
function assigneeMenu(assignee) {
|
|
97
|
+
const marks = [];
|
|
98
|
+
if (assignee.status !== "attended") marks.push({ label: t("admin.markAttended", "Mark attended"), icon: "i-lucide-check", onSelect: () => mark(assignee, "attended") });
|
|
99
|
+
if (assignee.status !== "no_show") marks.push({ label: t("admin.markNoShow", "Mark no-show"), icon: "i-lucide-user-x", onSelect: () => mark(assignee, "no_show") });
|
|
100
|
+
const destructive = assignee.status !== "attended" ? [{ label: t("admin.cancelAssignment", "Remove from shift"), icon: "i-lucide-trash-2", color: "error", onSelect: () => cancelAssignment(assignee) }] : [];
|
|
101
|
+
return [marks, destructive].filter((group) => group.length);
|
|
102
|
+
}
|
|
103
|
+
const search = ref("");
|
|
104
|
+
const query = refDebounced(search, 250);
|
|
105
|
+
const { data: candidates, status: candidatesStatus, refresh: refreshCandidates } = useLazyFetch(() => shiftsApi.admin.candidates(current.value.id), {
|
|
106
|
+
// The role picked below: eligibility and warnings follow it.
|
|
107
|
+
query: computed(() => ({ q: query.value || void 0, shiftRoleId: state.shiftRoleId === NONE ? void 0 : state.shiftRoleId })),
|
|
108
|
+
key: `shifts:candidates:${props.shift.id}`,
|
|
109
|
+
default: () => []
|
|
110
|
+
});
|
|
111
|
+
const lastWarnings = ref(null);
|
|
112
|
+
const warningText = (warning) => t(`warnings.${warning.code}`, warning.message);
|
|
113
|
+
async function assign(candidate, force = false) {
|
|
114
|
+
const name = nameOf(candidate);
|
|
115
|
+
try {
|
|
116
|
+
const result = await $fetch(shiftsApi.admin.assignments(current.value.id), { method: "POST", body: { userId: candidate.userId, force, shiftRoleId: state.shiftRoleId === NONE ? void 0 : state.shiftRoleId } });
|
|
117
|
+
replaceAssignee(result.assignment);
|
|
118
|
+
lastWarnings.value = result.warnings.length ? { name, warnings: result.warnings } : null;
|
|
119
|
+
toast.add({ title: t("admin.assigned", "Assigned {name}", { name }), color: result.warnings.length ? "warning" : "success", icon: "i-lucide-check" });
|
|
120
|
+
await refreshCandidates();
|
|
121
|
+
} catch (error) {
|
|
122
|
+
const code = error.data?.data?.code;
|
|
123
|
+
if (code === "shift_full" && !force) {
|
|
124
|
+
const confirmed = await confirm({
|
|
125
|
+
title: t("admin.fullTitle", "The shift is full"),
|
|
126
|
+
description: t("admin.fullDescription", "Assign {name} over the capacity anyway?", { name }),
|
|
127
|
+
confirmText: t("admin.assignAnyway", "Assign anyway")
|
|
128
|
+
});
|
|
129
|
+
if (confirmed) await assign(candidate, true);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
toast.add({ title: t("admin.assignFailed", "Could not assign {name}", { name }), description: errorMessage(error, ""), color: "error", icon: "i-lucide-circle-alert" });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const capacityLabel = computed(() => current.value.effectiveCapacity === null ? t("admin.filledUnlimited", "{filled} on it, no limit", { filled: current.value.filled }) : t("admin.filledOf", "{filled} of {capacity}", { filled: current.value.filled, capacity: current.value.effectiveCapacity }));
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<template>
|
|
139
|
+
<FormSlideover
|
|
140
|
+
form-id="shift-form"
|
|
141
|
+
:title="`${tr(current.teamName)} \xB7 ${format.range(current.startsAt, current.endsAt)}`"
|
|
142
|
+
:description="capacityLabel"
|
|
143
|
+
:submit-label="t('admin.saveShift', 'Save shift')"
|
|
144
|
+
:loading="busy"
|
|
145
|
+
@close="emit('close', changed)"
|
|
146
|
+
>
|
|
147
|
+
<div class="flex flex-col gap-6">
|
|
148
|
+
<UAlert
|
|
149
|
+
v-if="minPerShift && active.length < minPerShift"
|
|
150
|
+
color="warning"
|
|
151
|
+
variant="subtle"
|
|
152
|
+
icon="i-lucide-users"
|
|
153
|
+
:title="t('admin.shortStaffed', 'Short of people: {count} of at least {min}', { count: active.length, min: minPerShift })"
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
<section class="flex flex-col gap-2">
|
|
157
|
+
<h3 class="text-highlighted text-sm font-semibold">
|
|
158
|
+
{{ t("admin.onShift", "On this shift") }}
|
|
159
|
+
</h3>
|
|
160
|
+
<p
|
|
161
|
+
v-if="!assignees.length"
|
|
162
|
+
class="text-muted text-sm"
|
|
163
|
+
>
|
|
164
|
+
{{ t("admin.nobodyYet", "Nobody yet.") }}
|
|
165
|
+
</p>
|
|
166
|
+
<ul
|
|
167
|
+
v-else
|
|
168
|
+
class="divide-default divide-y"
|
|
169
|
+
>
|
|
170
|
+
<li
|
|
171
|
+
v-for="assignee in assignees"
|
|
172
|
+
:key="assignee.id"
|
|
173
|
+
class="flex items-center justify-between gap-2 py-2"
|
|
174
|
+
>
|
|
175
|
+
<TableIdentity
|
|
176
|
+
:title="nameOf(assignee.person)"
|
|
177
|
+
:description="assignee.person.phone || assignee.person.email || null"
|
|
178
|
+
:avatar="{ src: assignee.person.avatar ?? void 0, alt: nameOf(assignee.person) }"
|
|
179
|
+
/>
|
|
180
|
+
<div class="flex items-center gap-2">
|
|
181
|
+
<StatusBadge
|
|
182
|
+
:status="assignee.status"
|
|
183
|
+
:label="statusLabel(assignee.status)"
|
|
184
|
+
:colors="{ assigned: 'info', attended: 'success', no_show: 'error' }"
|
|
185
|
+
/>
|
|
186
|
+
<RowMenu
|
|
187
|
+
:items="assigneeMenu(assignee)"
|
|
188
|
+
:subject="nameOf(assignee.person)"
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
</li>
|
|
192
|
+
</ul>
|
|
193
|
+
</section>
|
|
194
|
+
|
|
195
|
+
<section class="flex flex-col gap-2">
|
|
196
|
+
<h3 class="text-highlighted text-sm font-semibold">
|
|
197
|
+
{{ t("admin.assignPerson", "Assign a person") }}
|
|
198
|
+
</h3>
|
|
199
|
+
<UAlert
|
|
200
|
+
v-if="lastWarnings"
|
|
201
|
+
color="warning"
|
|
202
|
+
variant="subtle"
|
|
203
|
+
icon="i-lucide-triangle-alert"
|
|
204
|
+
:title="t('admin.assignedWithWarnings', '{name} is assigned, but:', { name: lastWarnings.name })"
|
|
205
|
+
>
|
|
206
|
+
<template #description>
|
|
207
|
+
<ul class="list-disc ps-4">
|
|
208
|
+
<li
|
|
209
|
+
v-for="warning in lastWarnings.warnings"
|
|
210
|
+
:key="`${warning.code}${warning.shiftId ?? ''}`"
|
|
211
|
+
>
|
|
212
|
+
{{ warningText(warning) }}
|
|
213
|
+
</li>
|
|
214
|
+
</ul>
|
|
215
|
+
</template>
|
|
216
|
+
</UAlert>
|
|
217
|
+
<UInput
|
|
218
|
+
v-model="search"
|
|
219
|
+
icon="i-lucide-search"
|
|
220
|
+
:placeholder="t('admin.searchPeople', 'Search the team by name')"
|
|
221
|
+
class="w-full"
|
|
222
|
+
/>
|
|
223
|
+
<USkeleton
|
|
224
|
+
v-if="candidatesStatus === 'pending' && !candidates.length"
|
|
225
|
+
class="h-16 w-full"
|
|
226
|
+
/>
|
|
227
|
+
<p
|
|
228
|
+
v-else-if="!candidates.length"
|
|
229
|
+
class="text-muted text-sm"
|
|
230
|
+
>
|
|
231
|
+
{{ t("admin.noCandidates", "Nobody on the team matches. People need an approved place or a role added in Teams.") }}
|
|
232
|
+
</p>
|
|
233
|
+
<ul
|
|
234
|
+
v-else
|
|
235
|
+
class="divide-default divide-y"
|
|
236
|
+
>
|
|
237
|
+
<li
|
|
238
|
+
v-for="candidate in candidates"
|
|
239
|
+
:key="candidate.userId"
|
|
240
|
+
class="flex items-start justify-between gap-2 py-2"
|
|
241
|
+
>
|
|
242
|
+
<div class="flex min-w-0 flex-col gap-1">
|
|
243
|
+
<TableIdentity
|
|
244
|
+
:title="nameOf(candidate)"
|
|
245
|
+
:description="candidate.role"
|
|
246
|
+
:avatar="{ src: candidate.avatar ?? void 0, alt: nameOf(candidate) }"
|
|
247
|
+
/>
|
|
248
|
+
<div
|
|
249
|
+
v-if="candidate.warnings.length || candidate.reason"
|
|
250
|
+
class="flex flex-wrap gap-1"
|
|
251
|
+
>
|
|
252
|
+
<UBadge
|
|
253
|
+
v-if="candidate.reason"
|
|
254
|
+
color="neutral"
|
|
255
|
+
variant="subtle"
|
|
256
|
+
size="sm"
|
|
257
|
+
:label="candidate.reason === 'assigned' ? t('admin.alreadyOn', 'On the shift') : t('admin.roleTooLow', 'Role too low')"
|
|
258
|
+
/>
|
|
259
|
+
<UBadge
|
|
260
|
+
v-for="warning in candidate.warnings"
|
|
261
|
+
:key="`${warning.code}${warning.shiftId ?? ''}`"
|
|
262
|
+
:color="warningColor(warning)"
|
|
263
|
+
variant="subtle"
|
|
264
|
+
size="sm"
|
|
265
|
+
:label="warningText(warning)"
|
|
266
|
+
/>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
<UButton
|
|
270
|
+
size="sm"
|
|
271
|
+
color="neutral"
|
|
272
|
+
variant="outline"
|
|
273
|
+
:disabled="!candidate.eligible"
|
|
274
|
+
:label="t('admin.assignAction', 'Assign {name}', { name: candidate.name ?? '' })"
|
|
275
|
+
@click="assign(candidate)"
|
|
276
|
+
/>
|
|
277
|
+
</li>
|
|
278
|
+
</ul>
|
|
279
|
+
</section>
|
|
280
|
+
|
|
281
|
+
<USeparator />
|
|
282
|
+
|
|
283
|
+
<UForm
|
|
284
|
+
id="shift-form"
|
|
285
|
+
:schema="schema"
|
|
286
|
+
:state="state"
|
|
287
|
+
class="flex flex-col gap-4"
|
|
288
|
+
@submit="save"
|
|
289
|
+
>
|
|
290
|
+
<h3 class="text-highlighted text-sm font-semibold">
|
|
291
|
+
{{ t("admin.shiftDetails", "Shift details") }}
|
|
292
|
+
</h3>
|
|
293
|
+
<div class="grid grid-cols-2 gap-4">
|
|
294
|
+
<UFormField
|
|
295
|
+
name="startsAt"
|
|
296
|
+
:label="t('admin.startsAt', 'Starts')"
|
|
297
|
+
:description="timeZone"
|
|
298
|
+
>
|
|
299
|
+
<UInput
|
|
300
|
+
v-model="state.startsAt"
|
|
301
|
+
type="datetime-local"
|
|
302
|
+
class="w-full"
|
|
303
|
+
/>
|
|
304
|
+
</UFormField>
|
|
305
|
+
<UFormField
|
|
306
|
+
name="endsAt"
|
|
307
|
+
:label="t('admin.endsAt', 'Ends')"
|
|
308
|
+
>
|
|
309
|
+
<UInput
|
|
310
|
+
v-model="state.endsAt"
|
|
311
|
+
type="datetime-local"
|
|
312
|
+
class="w-full"
|
|
313
|
+
/>
|
|
314
|
+
</UFormField>
|
|
315
|
+
<UFormField
|
|
316
|
+
name="capacity"
|
|
317
|
+
:label="t('admin.capacity', 'Capacity')"
|
|
318
|
+
:description="t('admin.capacityHelp', 'Empty uses the schedule\'s maximum.')"
|
|
319
|
+
>
|
|
320
|
+
<UInputNumber
|
|
321
|
+
v-model="state.capacity"
|
|
322
|
+
:min="0"
|
|
323
|
+
class="w-full"
|
|
324
|
+
/>
|
|
325
|
+
</UFormField>
|
|
326
|
+
<UFormField
|
|
327
|
+
name="shiftRoleId"
|
|
328
|
+
:label="t('admin.shiftRole', 'Shift role')"
|
|
329
|
+
>
|
|
330
|
+
<USelect
|
|
331
|
+
v-model="state.shiftRoleId"
|
|
332
|
+
:items="roleOptions"
|
|
333
|
+
class="w-full"
|
|
334
|
+
/>
|
|
335
|
+
</UFormField>
|
|
336
|
+
<UFormField
|
|
337
|
+
name="featureId"
|
|
338
|
+
class="col-span-2"
|
|
339
|
+
:label="t('admin.venueFeature', 'Place on the venue layout')"
|
|
340
|
+
:description="t('admin.venueFeatureHelp', 'Where the shift is worked: the on-duty map draws it there.')"
|
|
341
|
+
>
|
|
342
|
+
<USelect
|
|
343
|
+
v-model="state.featureId"
|
|
344
|
+
:items="venue.items.value"
|
|
345
|
+
:loading="venue.status.value === 'pending'"
|
|
346
|
+
class="w-full"
|
|
347
|
+
/>
|
|
348
|
+
</UFormField>
|
|
349
|
+
</div>
|
|
350
|
+
</UForm>
|
|
351
|
+
</div>
|
|
352
|
+
</FormSlideover>
|
|
353
|
+
</template>
|
|
@@ -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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ShiftsTeamOption } from '../utils/admin-shifts.js';
|
|
2
|
+
import type { ShiftStationDto } from '../../../types.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
scheduleId: string;
|
|
5
|
+
operationId: string;
|
|
6
|
+
teams: ShiftsTeamOption[];
|
|
7
|
+
station?: ShiftStationDto;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
close: (saved: false | ShiftStationDto) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onClose?: ((saved: false | ShiftStationDto) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { shiftsApi } from "../../utils/api";
|
|
4
|
+
import { $fetch, computed, reactive, SHIFTS_NO_FEATURE, useAction, useModuleT, useShiftsTranslate, useShiftsVenueFeatures } from "#imports";
|
|
5
|
+
defineOptions({ name: "ShiftStationSlideover" });
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
scheduleId: { type: String, required: true },
|
|
8
|
+
operationId: { type: String, required: true },
|
|
9
|
+
teams: { type: Array, required: true },
|
|
10
|
+
station: { type: Object, required: false }
|
|
11
|
+
});
|
|
12
|
+
const emit = defineEmits(["close"]);
|
|
13
|
+
const t = useModuleT("shifts");
|
|
14
|
+
const tr = useShiftsTranslate();
|
|
15
|
+
const { busy, run } = useAction();
|
|
16
|
+
const venue = useShiftsVenueFeatures(() => props.operationId, { kind: "operations.station" });
|
|
17
|
+
const schema = z.object({
|
|
18
|
+
name: z.custom((value) => !!value && (typeof value === "string" ? !!value.trim() : Object.values(value).some((text) => text?.trim())), t("stations.nameRequired", "Give the station a name.")),
|
|
19
|
+
teamId: z.string().min(1, t("admin.teamRequired", "Choose a team.")),
|
|
20
|
+
featureId: z.string()
|
|
21
|
+
});
|
|
22
|
+
const state = reactive({
|
|
23
|
+
name: props.station?.name ?? "",
|
|
24
|
+
teamId: props.station?.teamId ?? props.teams[0]?.id ?? "",
|
|
25
|
+
featureId: props.station?.featureId ?? SHIFTS_NO_FEATURE
|
|
26
|
+
});
|
|
27
|
+
const teamOptions = computed(() => props.teams.map((team) => ({ label: tr(team.name), value: team.id })));
|
|
28
|
+
async function save(event) {
|
|
29
|
+
const { name, teamId, featureId } = event.data;
|
|
30
|
+
const feature = featureId === SHIFTS_NO_FEATURE ? null : featureId;
|
|
31
|
+
const saved = await run(
|
|
32
|
+
() => props.station ? $fetch(shiftsApi.admin.station(props.station.id), { method: "PATCH", body: { name, featureId: feature } }) : $fetch(shiftsApi.admin.stations(props.scheduleId), { method: "POST", body: { name, teamId, featureId: feature } }),
|
|
33
|
+
{ success: t("stations.saved", "Saved {name}", { name: tr(name) }) }
|
|
34
|
+
);
|
|
35
|
+
if (saved) emit("close", saved);
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<FormSlideover
|
|
41
|
+
form-id="shift-station-form"
|
|
42
|
+
:title="station ? t('stations.editTitle', 'Edit station') : t('stations.newTitle', 'New check-in station')"
|
|
43
|
+
:description="t('stations.description', 'A screen at the bar or gate with a QR code that changes every 30 seconds. Volunteers of the team scan it to check in.')"
|
|
44
|
+
:submit-label="station ? t('stations.save', 'Save station') : t('stations.create', 'Add station')"
|
|
45
|
+
:loading="busy"
|
|
46
|
+
@close="emit('close', false)"
|
|
47
|
+
>
|
|
48
|
+
<UForm
|
|
49
|
+
id="shift-station-form"
|
|
50
|
+
:schema="schema"
|
|
51
|
+
:state="state"
|
|
52
|
+
class="flex flex-col gap-4"
|
|
53
|
+
@submit="save"
|
|
54
|
+
>
|
|
55
|
+
<UFormField
|
|
56
|
+
name="name"
|
|
57
|
+
:label="t('admin.name', 'Name')"
|
|
58
|
+
required
|
|
59
|
+
>
|
|
60
|
+
<TranslatedInput
|
|
61
|
+
v-model="state.name"
|
|
62
|
+
class="w-full"
|
|
63
|
+
/>
|
|
64
|
+
</UFormField>
|
|
65
|
+
<UFormField
|
|
66
|
+
name="teamId"
|
|
67
|
+
:label="t('admin.team', 'Team')"
|
|
68
|
+
:description="station ? t('stations.teamFixed', 'A station stays with its team.') : t('stations.teamHelp', 'Only this team\'s volunteers check in at it.')"
|
|
69
|
+
required
|
|
70
|
+
>
|
|
71
|
+
<USelect
|
|
72
|
+
v-model="state.teamId"
|
|
73
|
+
:items="teamOptions"
|
|
74
|
+
:disabled="!!station"
|
|
75
|
+
class="w-full"
|
|
76
|
+
/>
|
|
77
|
+
</UFormField>
|
|
78
|
+
<UFormField
|
|
79
|
+
name="featureId"
|
|
80
|
+
:label="t('stations.feature', 'Station on the venue layout')"
|
|
81
|
+
:description="t('stations.featureHelp', 'Optional: where the station is on the venue layout.')"
|
|
82
|
+
>
|
|
83
|
+
<USelect
|
|
84
|
+
v-model="state.featureId"
|
|
85
|
+
:items="venue.items.value"
|
|
86
|
+
:loading="venue.status.value === 'pending'"
|
|
87
|
+
class="w-full"
|
|
88
|
+
/>
|
|
89
|
+
</UFormField>
|
|
90
|
+
</UForm>
|
|
91
|
+
</FormSlideover>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ShiftsTeamOption } from '../utils/admin-shifts.js';
|
|
2
|
+
import type { ShiftStationDto } from '../../../types.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
scheduleId: string;
|
|
5
|
+
operationId: string;
|
|
6
|
+
teams: ShiftsTeamOption[];
|
|
7
|
+
station?: ShiftStationDto;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
close: (saved: false | ShiftStationDto) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onClose?: ((saved: false | ShiftStationDto) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useShiftsLocale, useShiftsTranslate } from './useShiftsTranslate.js';
|
|
2
|
+
export { useShiftsFormat } from './useShiftsFormat.js';
|
|
3
|
+
export { useShiftsLinks } from './useShiftsLinks.js';
|
|
4
|
+
export { useShiftsActions } from './useShiftsActions.js';
|
|
5
|
+
export { SHIFTS_NO_FEATURE, useShiftsVenueFeatures } from './useShiftsVenueFeatures.js';
|
|
6
|
+
export type { ShiftsScheduleContext } from './useShiftsActions.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useShiftsLocale, useShiftsTranslate } from "./useShiftsTranslate.js";
|
|
2
|
+
export { useShiftsFormat } from "./useShiftsFormat.js";
|
|
3
|
+
export { useShiftsLinks } from "./useShiftsLinks.js";
|
|
4
|
+
export { useShiftsActions } from "./useShiftsActions.js";
|
|
5
|
+
export { SHIFTS_NO_FEATURE, useShiftsVenueFeatures } from "./useShiftsVenueFeatures.js";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { DropdownMenuItem } from '@nuxt/ui';
|
|
2
|
+
import type { ShiftsLadder, ShiftsTeamOption } from '../utils/admin-shifts.js';
|
|
3
|
+
import type { ShiftBroadcastResultDto, ShiftCopyResultDto, ShiftDto, ShiftPerkDto, ShiftRoleDto, ShiftScheduleDto, ShiftScheduleSettings, ShiftStationDto, ShiftSwapDto, ShiftWithAssigneesDto } from '../../../types.js';
|
|
4
|
+
/** What the schedule forms need to know about the operation. */
|
|
5
|
+
export type ShiftsScheduleContext = {
|
|
6
|
+
teams: ShiftsTeamOption[];
|
|
7
|
+
ladders: ShiftsLadder[];
|
|
8
|
+
roles: ShiftRoleDto[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* What staff do with schedules, roles, shifts and swaps, shared by the Shifts tab: the forms (opened as slideovers,
|
|
12
|
+
* resolving with the saved record or `false`), saving a schedule's settings, the confirmations of publishing and
|
|
13
|
+
* deleting, the row menus, and the short label of a schedule's settings.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useShiftsActions(): {
|
|
16
|
+
createSchedule: (operationId: string) => Promise<false | ShiftScheduleDto>;
|
|
17
|
+
editSchedule: (schedule: ShiftScheduleDto) => Promise<false | ShiftScheduleDto>;
|
|
18
|
+
saveScheduleSettings: (schedule: ShiftScheduleDto, settings: ShiftScheduleSettings) => Promise<ShiftScheduleDto | false>;
|
|
19
|
+
settingsLabel: (settings: ShiftScheduleSettings) => string;
|
|
20
|
+
publishSchedule: (schedule: ShiftScheduleDto) => Promise<ShiftScheduleDto | false>;
|
|
21
|
+
deleteSchedule: (schedule: ShiftScheduleDto) => Promise<boolean>;
|
|
22
|
+
bulkCreate: (schedule: ShiftScheduleDto, context: ShiftsScheduleContext) => Promise<false | ShiftDto[]>;
|
|
23
|
+
copyFrom: (schedule: ShiftScheduleDto) => Promise<false | ShiftCopyResultDto>;
|
|
24
|
+
createRole: (schedule: ShiftScheduleDto, context: ShiftsScheduleContext) => Promise<false | ShiftRoleDto>;
|
|
25
|
+
editRole: (role: ShiftRoleDto, context: ShiftsScheduleContext) => Promise<false | ShiftRoleDto>;
|
|
26
|
+
deleteRole: (role: ShiftRoleDto) => Promise<boolean>;
|
|
27
|
+
openShift: (shift: ShiftWithAssigneesDto, context: {
|
|
28
|
+
roles: ShiftRoleDto[];
|
|
29
|
+
minPerShift?: number | null;
|
|
30
|
+
}) => Promise<boolean>;
|
|
31
|
+
deleteShift: (shift: ShiftWithAssigneesDto) => Promise<boolean>;
|
|
32
|
+
approveSwap: (swap: ShiftSwapDto) => Promise<boolean>;
|
|
33
|
+
rejectSwap: (swap: ShiftSwapDto) => Promise<boolean>;
|
|
34
|
+
swapSummary: (swap: ShiftSwapDto) => string;
|
|
35
|
+
swapAllowed: (swap: ShiftSwapDto) => boolean;
|
|
36
|
+
scheduleMenu: (schedule: ShiftScheduleDto, handlers: {
|
|
37
|
+
open: () => unknown;
|
|
38
|
+
changed: () => unknown;
|
|
39
|
+
}) => DropdownMenuItem[][];
|
|
40
|
+
roleMenu: (role: ShiftRoleDto, context: ShiftsScheduleContext & {
|
|
41
|
+
changed: () => unknown;
|
|
42
|
+
}) => DropdownMenuItem[][];
|
|
43
|
+
subscribe: () => Promise<void>;
|
|
44
|
+
broadcast: (operationId: string, context: Pick<ShiftsScheduleContext, "teams" | "ladders">) => Promise<false | ShiftBroadcastResultDto>;
|
|
45
|
+
broadcastToTeam: (teamId: string, teamName: string) => Promise<false | ShiftBroadcastResultDto>;
|
|
46
|
+
createPerk: (operationId: string, teams: ShiftsScheduleContext["teams"]) => Promise<false | ShiftPerkDto>;
|
|
47
|
+
editPerk: (perk: ShiftPerkDto, teams: ShiftsScheduleContext["teams"]) => Promise<false | ShiftPerkDto>;
|
|
48
|
+
deletePerk: (perk: ShiftPerkDto) => Promise<boolean>;
|
|
49
|
+
perkMenu: (perk: ShiftPerkDto, context: {
|
|
50
|
+
teams: ShiftsScheduleContext["teams"];
|
|
51
|
+
changed: () => unknown;
|
|
52
|
+
}) => DropdownMenuItem[][];
|
|
53
|
+
createStation: (schedule: ShiftScheduleDto, teams: ShiftsScheduleContext["teams"]) => Promise<false | ShiftStationDto>;
|
|
54
|
+
editStation: (station: ShiftStationDto, schedule: ShiftScheduleDto, teams: ShiftsScheduleContext["teams"]) => Promise<false | ShiftStationDto>;
|
|
55
|
+
deleteStation: (station: ShiftStationDto) => Promise<boolean>;
|
|
56
|
+
stationMenu: (station: ShiftStationDto, context: {
|
|
57
|
+
schedule: ShiftScheduleDto;
|
|
58
|
+
teams: ShiftsScheduleContext["teams"];
|
|
59
|
+
changed: () => unknown;
|
|
60
|
+
}) => DropdownMenuItem[][];
|
|
61
|
+
};
|