@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,482 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { shiftsApi } from "../../utils/api";
|
|
3
|
+
import { allowedSwapKinds, allowsSwapKind, offerKind } from "../../utils/settings";
|
|
4
|
+
import { SHIFT_ASSIGNMENT_STATUS_LABELS, SHIFT_SWAP_OFFER_STATUS_LABELS, SHIFT_SWAP_STATUS_LABELS } from "../../utils/status";
|
|
5
|
+
import { dayKey } from "@frigear-nu/module-kit/time";
|
|
6
|
+
import { countdownParts } from "../../utils/time";
|
|
7
|
+
import { $fetch, computed, errorMessage, navigateTo, onBeforeUnmount, onMounted, ref, useAction, useAuthPages, useConfirmDialog, useFetch, useHead, useLazyFetch, useModuleT, useRoute, useShiftsFormat, useShiftsLinks, useShiftsTranslate, watch } from "#imports";
|
|
8
|
+
defineOptions({ name: "ShiftsShiftPage" });
|
|
9
|
+
const t = useModuleT("shifts");
|
|
10
|
+
const tr = useShiftsTranslate();
|
|
11
|
+
const format = useShiftsFormat();
|
|
12
|
+
const links = useShiftsLinks();
|
|
13
|
+
const confirm = useConfirmDialog();
|
|
14
|
+
const { busy, run } = useAction();
|
|
15
|
+
const route = useRoute();
|
|
16
|
+
const assignmentId = computed(() => String(route.params.assignmentId ?? ""));
|
|
17
|
+
const { data, error, refresh } = await useFetch(() => shiftsApi.me.shift(assignmentId.value), { key: computed(() => `shifts:me:${assignmentId.value}`) });
|
|
18
|
+
if (error.value?.statusCode === 401) {
|
|
19
|
+
await navigateTo({ path: useAuthPages().login, query: { redirect: route.path } });
|
|
20
|
+
}
|
|
21
|
+
const now = ref(0);
|
|
22
|
+
let timer;
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
now.value = Date.now();
|
|
25
|
+
timer = setInterval(() => now.value = Date.now(), 3e4);
|
|
26
|
+
});
|
|
27
|
+
onBeforeUnmount(() => clearInterval(timer));
|
|
28
|
+
const passOpen = computed(() => !!data.value && now.value >= Date.parse(data.value.passOpensAt) && now.value <= Date.parse(data.value.passClosesAt));
|
|
29
|
+
const holdsPlace = computed(() => data.value?.assignment.status === "assigned" || data.value?.assignment.status === "attended");
|
|
30
|
+
const { data: pass, refresh: refreshPass } = useLazyFetch(() => shiftsApi.me.pass(assignmentId.value), {
|
|
31
|
+
key: computed(() => `shifts:pass:${assignmentId.value}`),
|
|
32
|
+
watch: [passOpen],
|
|
33
|
+
server: false
|
|
34
|
+
});
|
|
35
|
+
let settled = false;
|
|
36
|
+
watch(() => pass.value?.eligible, async (eligible) => {
|
|
37
|
+
if (eligible !== false || settled) return;
|
|
38
|
+
settled = true;
|
|
39
|
+
try {
|
|
40
|
+
pass.value = await $fetch(shiftsApi.me.settle(assignmentId.value), { method: "POST" });
|
|
41
|
+
await refresh();
|
|
42
|
+
} catch {
|
|
43
|
+
settled = false;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const qr = computed(() => pass.value?.svg ? `data:image/svg+xml;utf8,${encodeURIComponent(pass.value.svg)}` : null);
|
|
47
|
+
const large = ref(false);
|
|
48
|
+
const countdown = computed(() => {
|
|
49
|
+
if (!data.value || !now.value) return "";
|
|
50
|
+
const { days, hours, minutes } = countdownParts(Date.parse(data.value.passOpensAt) - now.value);
|
|
51
|
+
return [days ? t("shift.unitDays", "{count} d", { count: days }) : "", days || hours ? t("shift.unitHours", "{count} h", { count: hours }) : "", t("shift.unitMinutes", "{count} min", { count: minutes })].filter(Boolean).join(" ");
|
|
52
|
+
});
|
|
53
|
+
const perks = computed(() => pass.value?.perks ?? []);
|
|
54
|
+
const perkLabel = (perk) => perk.status === "upcoming" ? t("shift.perkUpcoming", "You will earn this") : perk.status === "earned" ? t("shift.perkEarned", "Earned") : perk.status === "claimed" ? t("shift.perkClaimed", "Claimed") : t("shift.perkRevoked", "Revoked");
|
|
55
|
+
const perkColor = (perk) => perk.status === "earned" ? "success" : perk.status === "revoked" ? "error" : "neutral";
|
|
56
|
+
const checkedIn = computed(() => data.value?.assignment.status === "attended" && !!data.value.assignment.checkedInAt);
|
|
57
|
+
const canStation = computed(() => !!pass.value?.available && !!pass.value.checkIn.modes.includes("station"));
|
|
58
|
+
const canLocation = computed(() => !!pass.value?.available && !!pass.value.checkIn.modes.includes("location"));
|
|
59
|
+
const scanning = ref(false);
|
|
60
|
+
const checkInBusy = ref(false);
|
|
61
|
+
const checkInResult = ref(null);
|
|
62
|
+
const checkInFailure = (code, fallback) => ({
|
|
63
|
+
token_expired: t("checkIn.errors.expired", "That code has expired. Scan the station again."),
|
|
64
|
+
invalid_token: t("checkIn.errors.invalid", "That is not a check-in station's code."),
|
|
65
|
+
wrong_station: t("checkIn.errors.wrongStation", "That station is not your team's."),
|
|
66
|
+
outside_location: t("checkIn.errors.outside", "You are not at the check-in place yet."),
|
|
67
|
+
inaccurate_position: t("checkIn.errors.inaccurate", "Your position is not accurate enough. Try again outside, or ask your lead."),
|
|
68
|
+
outside_window: t("checkIn.errors.window", "Check-in for this shift is not open now."),
|
|
69
|
+
mode_disabled: t("checkIn.errors.disabled", "This way of checking in is not on for your shift.")
|
|
70
|
+
})[code ?? ""] ?? fallback;
|
|
71
|
+
async function checkIn(body) {
|
|
72
|
+
if (checkInBusy.value) return;
|
|
73
|
+
checkInBusy.value = true;
|
|
74
|
+
try {
|
|
75
|
+
const answer = await $fetch(shiftsApi.me.checkIn(assignmentId.value), { method: "POST", body });
|
|
76
|
+
scanning.value = false;
|
|
77
|
+
checkInResult.value = answer.alreadyCheckedIn ? { tone: "warning", title: t("checkIn.already", "You were checked in already, at {time}.", { time: format.time(answer.checkedInAt) }) } : { tone: "success", title: answer.alsoCheckedIn.length ? t("checkIn.doneDaily", "Checked in, and on your {count} other shifts today.", { count: answer.alsoCheckedIn.length }) : t("checkIn.done", "Checked in. Have a good shift!") };
|
|
78
|
+
await Promise.all([refresh(), refreshPass()]);
|
|
79
|
+
} catch (error2) {
|
|
80
|
+
const code = error2.data?.data?.code;
|
|
81
|
+
checkInResult.value = { tone: "error", title: checkInFailure(code, errorMessage(error2, t("checkIn.failed", "Could not check in"))) };
|
|
82
|
+
} finally {
|
|
83
|
+
checkInBusy.value = false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const onStationScan = (token) => checkIn({ mode: "station", token });
|
|
87
|
+
function checkInHere() {
|
|
88
|
+
if (!import.meta.client || !navigator.geolocation) {
|
|
89
|
+
checkInResult.value = { tone: "error", title: t("checkIn.errors.noGeo", "This device cannot tell where you are.") };
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
checkInBusy.value = true;
|
|
93
|
+
navigator.geolocation.getCurrentPosition(
|
|
94
|
+
(position) => {
|
|
95
|
+
checkInBusy.value = false;
|
|
96
|
+
void checkIn({ mode: "location", latitude: position.coords.latitude, longitude: position.coords.longitude, accuracy: position.coords.accuracy });
|
|
97
|
+
},
|
|
98
|
+
() => {
|
|
99
|
+
checkInBusy.value = false;
|
|
100
|
+
checkInResult.value = { tone: "error", title: t("checkIn.errors.geoDenied", "Allow the app to use your location, or ask your lead to scan your pass.") };
|
|
101
|
+
},
|
|
102
|
+
{ enableHighAccuracy: true, timeout: 15e3, maximumAge: 0 }
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const leadNames = computed(() => (data.value?.leadsOnDuty ?? []).map((lead) => lead.name ?? `#${lead.userId}`));
|
|
106
|
+
const swap = computed(() => data.value?.swapDetail ?? null);
|
|
107
|
+
const upcoming = computed(() => !!data.value && Date.parse(data.value.shift.startsAt) > now.value);
|
|
108
|
+
const canOpenSwap = computed(() => !swap.value && data.value?.assignment.status === "assigned" && upcoming.value);
|
|
109
|
+
const waitingOffers = computed(() => (swap.value?.offers ?? []).filter((offer) => offer.status === "offered" || offer.status === "accepted"));
|
|
110
|
+
const kinds = computed(() => data.value ? allowedSwapKinds(data.value.settings) : []);
|
|
111
|
+
const mustWorkAll = computed(() => data.value?.settings.coverage === "all");
|
|
112
|
+
const canAccept = (offer) => !!data.value && allowsSwapKind(data.value.settings, offerKind(offer));
|
|
113
|
+
async function openSwap(kind) {
|
|
114
|
+
const done = await run(
|
|
115
|
+
() => $fetch(shiftsApi.me.swap(assignmentId.value), { method: "POST", body: { kind } }).then(() => true),
|
|
116
|
+
kind === "trade" ? { success: t("shift.tradeOpened", "Your shift is open for a trade"), error: t("shift.swapOpenFailed", "Could not open a swap") } : { success: t("shift.swapOpened", "Your shift is up for grabs"), error: t("shift.swapOpenFailed", "Could not open a swap") }
|
|
117
|
+
);
|
|
118
|
+
if (done) await refresh();
|
|
119
|
+
}
|
|
120
|
+
async function withdrawSwap() {
|
|
121
|
+
const confirmed = await confirm({
|
|
122
|
+
title: t("shift.withdrawSwapTitle", "Withdraw the swap?"),
|
|
123
|
+
description: t("shift.withdrawSwapDescription", "You keep the shift. The offers you got are turned down."),
|
|
124
|
+
confirmText: t("shift.withdrawSwap", "Withdraw swap"),
|
|
125
|
+
destructive: true
|
|
126
|
+
});
|
|
127
|
+
if (!confirmed) return;
|
|
128
|
+
const done = await run(
|
|
129
|
+
() => $fetch(shiftsApi.me.swap(assignmentId.value), { method: "DELETE" }).then(() => true),
|
|
130
|
+
{ success: t("shift.swapWithdrawn", "Withdrew the swap"), error: t("shift.swapWithdrawFailed", "Could not withdraw the swap") }
|
|
131
|
+
);
|
|
132
|
+
if (done) await refresh();
|
|
133
|
+
}
|
|
134
|
+
async function decide(offer, accept) {
|
|
135
|
+
if (!swap.value) return;
|
|
136
|
+
const name = offer.person?.name ?? "";
|
|
137
|
+
const done = await run(
|
|
138
|
+
() => $fetch(accept ? shiftsApi.acceptOffer(swap.value.id, offer.id) : shiftsApi.rejectOffer(swap.value.id, offer.id), { method: "POST" }).then(() => true),
|
|
139
|
+
accept ? { success: t("shift.offerAccepted", "Accepted the offer of {name}", { name }), error: t("shift.offerAcceptFailed", "Could not accept the offer") } : { success: t("shift.offerRejected", "Turned down the offer of {name}", { name }), error: t("shift.offerRejectFailed", "Could not turn the offer down") }
|
|
140
|
+
);
|
|
141
|
+
if (done) {
|
|
142
|
+
if (accept && data.value?.settings.approval === "peer") return navigateTo(links.shifts());
|
|
143
|
+
await refresh();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const facts = computed(() => data.value ? [
|
|
147
|
+
{ key: "when", label: t("shift.when", "When"), value: format.range(data.value.shift.startsAt, data.value.shift.endsAt) },
|
|
148
|
+
{ key: "team", label: t("shift.team", "Team"), value: tr(data.value.teamName) },
|
|
149
|
+
...data.value.roleName ? [{ key: "role", label: t("shift.role", "Role"), value: tr(data.value.roleName) }] : [],
|
|
150
|
+
...data.value.shift.location?.name ? [{ key: "where", label: t("shift.where", "Where"), value: tr(data.value.shift.location.name) }] : [],
|
|
151
|
+
{ key: "operation", label: t("shift.operation", "Operation"), value: tr(data.value.operationName) },
|
|
152
|
+
{ key: "status", label: t("shift.status", "Status"), value: t(`statuses.${data.value.assignment.status}`, SHIFT_ASSIGNMENT_STATUS_LABELS[data.value.assignment.status]) },
|
|
153
|
+
...data.value.shift.notes && tr(data.value.shift.notes) ? [{ key: "notes", label: t("shift.notes", "Notes"), value: tr(data.value.shift.notes) }] : []
|
|
154
|
+
] : []);
|
|
155
|
+
useHead({ title: () => t("shift.title", "My shift") });
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<template>
|
|
159
|
+
<UContainer>
|
|
160
|
+
<UPage>
|
|
161
|
+
<UPageHeader
|
|
162
|
+
:title="data ? `${tr(data.teamName)} \xB7 ${format.time(data.shift.startsAt)}\u2013${format.time(data.shift.endsAt)}` : t('shift.title', 'My shift')"
|
|
163
|
+
:description="data ? format.day(dayKey(data.shift.startsAt, format.timeZone)) : void 0"
|
|
164
|
+
>
|
|
165
|
+
<template #links>
|
|
166
|
+
<UButton
|
|
167
|
+
:to="links.shifts()"
|
|
168
|
+
icon="i-lucide-arrow-left"
|
|
169
|
+
color="neutral"
|
|
170
|
+
variant="ghost"
|
|
171
|
+
:label="t('shift.back', 'My shifts')"
|
|
172
|
+
/>
|
|
173
|
+
</template>
|
|
174
|
+
</UPageHeader>
|
|
175
|
+
<UPageBody class="max-w-2xl">
|
|
176
|
+
<UEmpty
|
|
177
|
+
v-if="error && error.statusCode !== 401"
|
|
178
|
+
icon="i-lucide-circle-alert"
|
|
179
|
+
:title="error.statusCode === 404 ? t('shift.notFound', 'This shift is not yours, or no longer exists') : t('shift.loadFailed', 'The shift could not be loaded')"
|
|
180
|
+
:description="error.statusCode === 404 ? void 0 : errorMessage(error, '')"
|
|
181
|
+
:actions="[{ label: t('shift.back', 'My shifts'), to: links.shifts(), color: 'neutral', variant: 'outline' }]"
|
|
182
|
+
/>
|
|
183
|
+
<div
|
|
184
|
+
v-else-if="data"
|
|
185
|
+
class="flex flex-col gap-4"
|
|
186
|
+
>
|
|
187
|
+
<SectionCard
|
|
188
|
+
v-if="holdsPlace"
|
|
189
|
+
:title="t('shift.pass', 'Check-in pass')"
|
|
190
|
+
icon="i-lucide-qr-code"
|
|
191
|
+
>
|
|
192
|
+
<div
|
|
193
|
+
v-if="passOpen && qr"
|
|
194
|
+
class="flex flex-col items-center gap-2"
|
|
195
|
+
>
|
|
196
|
+
<img
|
|
197
|
+
:src="qr"
|
|
198
|
+
:alt="t('shift.passAlt', 'QR code to check in')"
|
|
199
|
+
class="size-60 rounded-md bg-white p-2"
|
|
200
|
+
>
|
|
201
|
+
<p class="text-muted text-center text-sm">
|
|
202
|
+
{{ canStation || canLocation ? t("shift.passHelpSelf", "Check in below, or show this to the lead of your team.") : t("shift.passHelp", "Show this to the lead of your team when you arrive.") }}
|
|
203
|
+
</p>
|
|
204
|
+
<UButton
|
|
205
|
+
color="neutral"
|
|
206
|
+
variant="outline"
|
|
207
|
+
icon="i-lucide-maximize-2"
|
|
208
|
+
:label="t('shift.passLarger', 'Show larger')"
|
|
209
|
+
@click="large = true"
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
<USkeleton
|
|
213
|
+
v-else-if="passOpen"
|
|
214
|
+
class="mx-auto size-60"
|
|
215
|
+
/>
|
|
216
|
+
<div
|
|
217
|
+
v-else
|
|
218
|
+
class="flex flex-col gap-1"
|
|
219
|
+
>
|
|
220
|
+
<p
|
|
221
|
+
v-if="now && now < Date.parse(data.passOpensAt)"
|
|
222
|
+
class="text-highlighted text-lg font-semibold tabular-nums"
|
|
223
|
+
>
|
|
224
|
+
{{ t("shift.passOpensIn", "Opens in {time}", { time: countdown }) }}
|
|
225
|
+
</p>
|
|
226
|
+
<p class="text-muted text-sm">
|
|
227
|
+
{{ now < Date.parse(data.passOpensAt) ? t("shift.passLater", "Your pass shows here from {time}.", { time: format.dateTime(data.passOpensAt) }) : t("shift.passClosed", "Check-in for this shift has closed.") }}
|
|
228
|
+
</p>
|
|
229
|
+
</div>
|
|
230
|
+
<div
|
|
231
|
+
v-if="checkedIn || canStation || canLocation || checkInResult"
|
|
232
|
+
class="border-default mt-3 flex flex-col gap-2 border-t pt-3"
|
|
233
|
+
>
|
|
234
|
+
<UAlert
|
|
235
|
+
v-if="checkInResult"
|
|
236
|
+
:color="checkInResult.tone"
|
|
237
|
+
variant="subtle"
|
|
238
|
+
:icon="checkInResult.tone === 'success' ? 'i-lucide-check-circle' : checkInResult.tone === 'warning' ? 'i-lucide-info' : 'i-lucide-circle-alert'"
|
|
239
|
+
:title="checkInResult.title"
|
|
240
|
+
/>
|
|
241
|
+
<p
|
|
242
|
+
v-else-if="checkedIn"
|
|
243
|
+
class="text-success flex items-center gap-1.5 text-sm font-medium"
|
|
244
|
+
>
|
|
245
|
+
<UIcon
|
|
246
|
+
name="i-lucide-check-circle"
|
|
247
|
+
class="size-4"
|
|
248
|
+
/>
|
|
249
|
+
{{ t("checkIn.checkedInAt", "Checked in at {time}", { time: format.time(data.assignment.checkedInAt) }) }}
|
|
250
|
+
</p>
|
|
251
|
+
<div
|
|
252
|
+
v-if="!checkedIn && (canStation || canLocation)"
|
|
253
|
+
class="flex flex-wrap gap-2"
|
|
254
|
+
>
|
|
255
|
+
<UButton
|
|
256
|
+
v-if="canStation"
|
|
257
|
+
icon="i-lucide-scan-line"
|
|
258
|
+
:color="scanning ? 'neutral' : 'primary'"
|
|
259
|
+
:variant="scanning ? 'outline' : 'solid'"
|
|
260
|
+
:label="scanning ? t('checkIn.stopScanning', 'Stop scanning') : t('checkIn.scanStation', 'Scan the station code')"
|
|
261
|
+
@click="scanning = !scanning"
|
|
262
|
+
/>
|
|
263
|
+
<UButton
|
|
264
|
+
v-if="canLocation"
|
|
265
|
+
icon="i-lucide-map-pin"
|
|
266
|
+
:color="canStation ? 'neutral' : 'primary'"
|
|
267
|
+
:variant="canStation ? 'outline' : 'solid'"
|
|
268
|
+
:loading="checkInBusy"
|
|
269
|
+
:label="t('checkIn.imHere', 'I\'m here: check in')"
|
|
270
|
+
@click="checkInHere"
|
|
271
|
+
/>
|
|
272
|
+
</div>
|
|
273
|
+
<ShiftQrScanner
|
|
274
|
+
v-if="scanning && !checkedIn"
|
|
275
|
+
:paused="checkInBusy"
|
|
276
|
+
@detect="onStationScan"
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
<p
|
|
280
|
+
v-if="leadNames.length"
|
|
281
|
+
class="text-muted mt-3 flex items-center gap-1.5 text-sm"
|
|
282
|
+
>
|
|
283
|
+
<UIcon
|
|
284
|
+
name="i-lucide-shield-check"
|
|
285
|
+
class="size-4"
|
|
286
|
+
/>
|
|
287
|
+
{{ t("shift.leadOnDutyIs", "Lead on duty: {names}", { names: leadNames.join(", ") }) }}
|
|
288
|
+
</p>
|
|
289
|
+
<div
|
|
290
|
+
v-if="perks.length"
|
|
291
|
+
class="border-default mt-3 flex flex-col gap-1.5 border-t pt-3"
|
|
292
|
+
>
|
|
293
|
+
<h3 class="text-highlighted text-sm font-semibold">
|
|
294
|
+
{{ t("shift.perks", "What this shift earns") }}
|
|
295
|
+
</h3>
|
|
296
|
+
<ul class="flex flex-col gap-1 text-sm">
|
|
297
|
+
<li
|
|
298
|
+
v-for="perk in perks"
|
|
299
|
+
:key="perk.perkId"
|
|
300
|
+
class="flex items-center justify-between gap-2"
|
|
301
|
+
>
|
|
302
|
+
<span>{{ perk.quantity }} × {{ tr(perk.name) }}</span>
|
|
303
|
+
<UBadge
|
|
304
|
+
:color="perkColor(perk)"
|
|
305
|
+
variant="subtle"
|
|
306
|
+
:label="perkLabel(perk)"
|
|
307
|
+
/>
|
|
308
|
+
</li>
|
|
309
|
+
</ul>
|
|
310
|
+
</div>
|
|
311
|
+
</SectionCard>
|
|
312
|
+
|
|
313
|
+
<SectionCard :title="t('shift.details', 'Shift')">
|
|
314
|
+
<DescriptionList :items="facts" />
|
|
315
|
+
</SectionCard>
|
|
316
|
+
|
|
317
|
+
<SectionCard
|
|
318
|
+
:title="t('shift.leadOnDuty', 'Lead on duty')"
|
|
319
|
+
icon="i-lucide-shield-check"
|
|
320
|
+
>
|
|
321
|
+
<p
|
|
322
|
+
v-if="!data.leadsOnDuty.length"
|
|
323
|
+
class="text-muted text-sm"
|
|
324
|
+
>
|
|
325
|
+
{{ t("shift.noLead", "No lead of your team is on shift with you yet.") }}
|
|
326
|
+
</p>
|
|
327
|
+
<div
|
|
328
|
+
v-else
|
|
329
|
+
class="flex flex-wrap gap-3"
|
|
330
|
+
>
|
|
331
|
+
<TableIdentity
|
|
332
|
+
v-for="lead in data.leadsOnDuty"
|
|
333
|
+
:key="lead.userId"
|
|
334
|
+
:title="lead.name ?? `#${lead.userId}`"
|
|
335
|
+
:avatar="{ src: lead.avatar ?? void 0, alt: lead.name ?? '' }"
|
|
336
|
+
/>
|
|
337
|
+
</div>
|
|
338
|
+
</SectionCard>
|
|
339
|
+
|
|
340
|
+
<SectionCard
|
|
341
|
+
:title="t('shift.swap', 'Swap')"
|
|
342
|
+
icon="i-lucide-arrow-left-right"
|
|
343
|
+
:description="data.settings.approval === 'lead' ? t('shift.swapApprovalHelp', 'A lead of the team approves a swap you accept.') : t('shift.swapPeerHelp', 'A swap is done as soon as you accept an offer.')"
|
|
344
|
+
>
|
|
345
|
+
<template
|
|
346
|
+
v-if="swap"
|
|
347
|
+
#actions
|
|
348
|
+
>
|
|
349
|
+
<div class="flex items-center gap-2">
|
|
350
|
+
<UBadge
|
|
351
|
+
color="neutral"
|
|
352
|
+
variant="subtle"
|
|
353
|
+
:label="swap.kind === 'trade' ? t('swapKinds.trade', 'Trade') : t('swapKinds.release', 'Give away')"
|
|
354
|
+
/>
|
|
355
|
+
<StatusBadge
|
|
356
|
+
:status="swap.status"
|
|
357
|
+
:label="t(`swapStatuses.${swap.status}`, SHIFT_SWAP_STATUS_LABELS[swap.status])"
|
|
358
|
+
/>
|
|
359
|
+
</div>
|
|
360
|
+
</template>
|
|
361
|
+
<UAlert
|
|
362
|
+
v-if="mustWorkAll"
|
|
363
|
+
class="mb-3"
|
|
364
|
+
color="info"
|
|
365
|
+
variant="subtle"
|
|
366
|
+
icon="i-lucide-info"
|
|
367
|
+
:title="t('shift.tradeOnly', 'Trade only: you must work all your shifts.')"
|
|
368
|
+
/>
|
|
369
|
+
<UAlert
|
|
370
|
+
v-if="swap && !allowsSwapKind(data.settings, swap.kind)"
|
|
371
|
+
class="mb-3"
|
|
372
|
+
color="warning"
|
|
373
|
+
variant="subtle"
|
|
374
|
+
icon="i-lucide-triangle-alert"
|
|
375
|
+
:title="t('shift.swapNoLongerAllowed', 'The schedule no longer allows this kind of swap: withdraw it and open a new one.')"
|
|
376
|
+
/>
|
|
377
|
+
<div
|
|
378
|
+
v-if="swap"
|
|
379
|
+
class="flex flex-col gap-3"
|
|
380
|
+
>
|
|
381
|
+
<p
|
|
382
|
+
v-if="!waitingOffers.length"
|
|
383
|
+
class="text-muted text-sm"
|
|
384
|
+
>
|
|
385
|
+
{{ swap.kind === "trade" ? t("shift.noTradeOffers", "No offers yet. People who can take your shift see it in the open swaps and offer one of theirs.") : t("shift.noOffers", "No offers yet. People who can take your shift see it in the open swaps.") }}
|
|
386
|
+
</p>
|
|
387
|
+
<ul
|
|
388
|
+
v-else
|
|
389
|
+
class="divide-default divide-y"
|
|
390
|
+
>
|
|
391
|
+
<li
|
|
392
|
+
v-for="offer in waitingOffers"
|
|
393
|
+
:key="offer.id"
|
|
394
|
+
class="flex flex-wrap items-center justify-between gap-2 py-2"
|
|
395
|
+
>
|
|
396
|
+
<div class="flex flex-col text-sm">
|
|
397
|
+
<span class="text-highlighted font-medium">{{ offer.person?.name ?? `#${offer.userId}` }}</span>
|
|
398
|
+
<span class="text-muted">
|
|
399
|
+
{{ offer.offeredShift ? t("shift.offerBack", "Gives you {team}, {when}", { team: tr(offer.offeredShift.teamName), when: format.range(offer.offeredShift.startsAt, offer.offeredShift.endsAt) }) : t("shift.offerTake", "Takes your shift over") }}
|
|
400
|
+
</span>
|
|
401
|
+
</div>
|
|
402
|
+
<div
|
|
403
|
+
v-if="offer.status === 'offered' && swap.status === 'offered' && canAccept(offer)"
|
|
404
|
+
class="flex gap-2"
|
|
405
|
+
>
|
|
406
|
+
<UButton
|
|
407
|
+
color="neutral"
|
|
408
|
+
variant="outline"
|
|
409
|
+
size="sm"
|
|
410
|
+
:loading="busy"
|
|
411
|
+
:label="t('shift.rejectOffer', 'Turn down offer')"
|
|
412
|
+
@click="decide(offer, false)"
|
|
413
|
+
/>
|
|
414
|
+
<UButton
|
|
415
|
+
size="sm"
|
|
416
|
+
:loading="busy"
|
|
417
|
+
:label="t('shift.acceptOffer', 'Accept offer')"
|
|
418
|
+
@click="decide(offer, true)"
|
|
419
|
+
/>
|
|
420
|
+
</div>
|
|
421
|
+
<UBadge
|
|
422
|
+
v-else
|
|
423
|
+
color="neutral"
|
|
424
|
+
variant="subtle"
|
|
425
|
+
:label="t(`offerStatuses.${offer.status}`, SHIFT_SWAP_OFFER_STATUS_LABELS[offer.status])"
|
|
426
|
+
/>
|
|
427
|
+
</li>
|
|
428
|
+
</ul>
|
|
429
|
+
</div>
|
|
430
|
+
<p
|
|
431
|
+
v-else-if="!canOpenSwap"
|
|
432
|
+
class="text-muted text-sm"
|
|
433
|
+
>
|
|
434
|
+
{{ t("shift.cannotSwap", "This shift cannot be swapped now.") }}
|
|
435
|
+
</p>
|
|
436
|
+
<template
|
|
437
|
+
v-if="swap && swap.status !== 'accepted' || canOpenSwap && kinds.length"
|
|
438
|
+
#footer
|
|
439
|
+
>
|
|
440
|
+
<div class="flex flex-wrap justify-end gap-2">
|
|
441
|
+
<UButton
|
|
442
|
+
v-if="swap && swap.status !== 'accepted'"
|
|
443
|
+
color="neutral"
|
|
444
|
+
variant="outline"
|
|
445
|
+
:loading="busy"
|
|
446
|
+
:label="t('shift.withdrawSwap', 'Withdraw swap')"
|
|
447
|
+
@click="withdrawSwap"
|
|
448
|
+
/>
|
|
449
|
+
<template v-else-if="canOpenSwap">
|
|
450
|
+
<UButton
|
|
451
|
+
v-if="kinds.includes('release')"
|
|
452
|
+
:color="kinds.includes('trade') ? 'neutral' : 'primary'"
|
|
453
|
+
:variant="kinds.includes('trade') ? 'outline' : 'solid'"
|
|
454
|
+
icon="i-lucide-hand"
|
|
455
|
+
:loading="busy"
|
|
456
|
+
:label="t('shift.openRelease', 'Give shift away')"
|
|
457
|
+
@click="openSwap('release')"
|
|
458
|
+
/>
|
|
459
|
+
<UButton
|
|
460
|
+
v-if="kinds.includes('trade')"
|
|
461
|
+
icon="i-lucide-arrow-left-right"
|
|
462
|
+
:loading="busy"
|
|
463
|
+
:label="t('shift.openTrade', 'Offer shift for a trade')"
|
|
464
|
+
@click="openSwap('trade')"
|
|
465
|
+
/>
|
|
466
|
+
</template>
|
|
467
|
+
</div>
|
|
468
|
+
</template>
|
|
469
|
+
</SectionCard>
|
|
470
|
+
</div>
|
|
471
|
+
</UPageBody>
|
|
472
|
+
</UPage>
|
|
473
|
+
<ShiftPassFullscreen
|
|
474
|
+
v-if="large && qr"
|
|
475
|
+
:qr="qr"
|
|
476
|
+
:code="pass?.code"
|
|
477
|
+
:title="data ? `${tr(data.teamName)} \xB7 ${format.time(data.shift.startsAt)}\u2013${format.time(data.shift.endsAt)}` : ''"
|
|
478
|
+
:leads="leadNames"
|
|
479
|
+
@close="large = false"
|
|
480
|
+
/>
|
|
481
|
+
</UContainer>
|
|
482
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import HomeShifts from "../tabs/HomeShifts.vue";
|
|
3
|
+
import { useHead, useModuleT } from "#imports";
|
|
4
|
+
defineOptions({ name: "ShiftsMinePage" });
|
|
5
|
+
const t = useModuleT("shifts");
|
|
6
|
+
useHead({ title: () => t("mine.title", "My shifts") });
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<UContainer>
|
|
11
|
+
<UPage>
|
|
12
|
+
<UPageHeader
|
|
13
|
+
:title="t('mine.title', 'My shifts')"
|
|
14
|
+
:description="t('mine.description', 'Your shifts, your check-in pass and your swaps.')"
|
|
15
|
+
/>
|
|
16
|
+
<UPageBody>
|
|
17
|
+
<HomeShifts standalone />
|
|
18
|
+
</UPageBody>
|
|
19
|
+
</UPage>
|
|
20
|
+
</UContainer>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { shiftsApi } from "../../utils/api";
|
|
3
|
+
import { computed, errorMessage, navigateTo, onBeforeUnmount, onMounted, useAuthPages, useFetch, useHead, useModuleT, useRoute, useShiftsLinks, useShiftsTranslate, watch } from "#imports";
|
|
4
|
+
defineOptions({ name: "ShiftsStationPage" });
|
|
5
|
+
const t = useModuleT("shifts");
|
|
6
|
+
const tr = useShiftsTranslate();
|
|
7
|
+
const links = useShiftsLinks();
|
|
8
|
+
const route = useRoute();
|
|
9
|
+
const stationId = computed(() => String(route.params.stationId ?? ""));
|
|
10
|
+
const { data, error, refresh } = await useFetch(() => shiftsApi.stationToken(stationId.value), {
|
|
11
|
+
key: computed(() => `shifts:station:${stationId.value}`),
|
|
12
|
+
server: false
|
|
13
|
+
});
|
|
14
|
+
watch(error, async (value) => {
|
|
15
|
+
if (value?.statusCode === 401) await navigateTo({ path: useAuthPages().login, query: { redirect: route.path } });
|
|
16
|
+
}, { immediate: true });
|
|
17
|
+
const qr = computed(() => data.value ? `data:image/svg+xml;utf8,${encodeURIComponent(data.value.svg)}` : null);
|
|
18
|
+
let timer;
|
|
19
|
+
function schedule() {
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
const next = data.value ? Date.parse(data.value.refreshAt) - Date.now() + 250 : 5e3;
|
|
22
|
+
timer = setTimeout(async () => {
|
|
23
|
+
await refresh();
|
|
24
|
+
schedule();
|
|
25
|
+
}, Math.min(Math.max(next, 1e3), 3e4));
|
|
26
|
+
}
|
|
27
|
+
let lock = null;
|
|
28
|
+
async function acquire() {
|
|
29
|
+
try {
|
|
30
|
+
lock = await navigator.wakeLock?.request("screen") ?? null;
|
|
31
|
+
} catch {
|
|
32
|
+
lock = null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const onVisible = () => {
|
|
36
|
+
if (document.visibilityState !== "visible") return;
|
|
37
|
+
void acquire();
|
|
38
|
+
void refresh().then(schedule);
|
|
39
|
+
};
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
schedule();
|
|
42
|
+
void acquire();
|
|
43
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
44
|
+
});
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
document.removeEventListener("visibilitychange", onVisible);
|
|
48
|
+
void lock?.release().catch(() => {
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
useHead({ title: () => data.value ? tr(data.value.station.name) : t("station.title", "Check-in station") });
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<div class="fixed inset-0 z-[100] flex flex-col items-center justify-between gap-4 bg-white p-4 text-black">
|
|
56
|
+
<div class="flex w-full items-start justify-between gap-2">
|
|
57
|
+
<div>
|
|
58
|
+
<p class="text-2xl font-semibold">
|
|
59
|
+
{{ data ? tr(data.station.name) : t("station.title", "Check-in station") }}
|
|
60
|
+
</p>
|
|
61
|
+
<p
|
|
62
|
+
v-if="data"
|
|
63
|
+
class="text-lg text-neutral-600"
|
|
64
|
+
>
|
|
65
|
+
{{ tr(data.station.teamName) }}
|
|
66
|
+
</p>
|
|
67
|
+
</div>
|
|
68
|
+
<UButton
|
|
69
|
+
:to="links.shifts()"
|
|
70
|
+
color="neutral"
|
|
71
|
+
variant="solid"
|
|
72
|
+
icon="i-lucide-x"
|
|
73
|
+
:label="t('station.close', 'Close station')"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
<img
|
|
77
|
+
v-if="qr"
|
|
78
|
+
:src="qr"
|
|
79
|
+
:alt="t('station.qrAlt', 'QR code to check in at this station')"
|
|
80
|
+
class="aspect-square w-[min(92vw,70vh)] max-w-full bg-white"
|
|
81
|
+
>
|
|
82
|
+
<div
|
|
83
|
+
v-else-if="error && error.statusCode !== 401"
|
|
84
|
+
class="flex max-w-md flex-col items-center gap-2 text-center"
|
|
85
|
+
>
|
|
86
|
+
<p class="text-xl font-semibold">
|
|
87
|
+
{{ error.statusCode === 403 ? t("station.forbidden", "Only leads of the team can open this station") : error.statusCode === 404 ? t("station.notFound", "This station does not exist") : error.statusCode === 501 ? t("station.notConfigured", "Station check-in is not set up on this server") : t("station.loadFailed", "The station could not be loaded") }}
|
|
88
|
+
</p>
|
|
89
|
+
<p
|
|
90
|
+
v-if="error.statusCode !== 403 && error.statusCode !== 404"
|
|
91
|
+
class="text-neutral-600"
|
|
92
|
+
>
|
|
93
|
+
{{ errorMessage(error, "") }}
|
|
94
|
+
</p>
|
|
95
|
+
</div>
|
|
96
|
+
<USkeleton
|
|
97
|
+
v-else
|
|
98
|
+
class="aspect-square w-[min(92vw,70vh)]"
|
|
99
|
+
/>
|
|
100
|
+
<p class="text-center text-lg">
|
|
101
|
+
{{ t("station.help", "Scan this code in the app, on your shift, to check in. It changes every 30 seconds.") }}
|
|
102
|
+
</p>
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|