@frigear-nu/shifts 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/dist/module.d.mts +5 -1
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +65 -49
  5. package/dist/runtime/access.d.ts +1 -1
  6. package/dist/runtime/access.js +7 -0
  7. package/dist/runtime/app/components/ShiftBulkSlideover.vue +4 -2
  8. package/dist/runtime/app/components/ShiftCheckInCard.vue +6 -3
  9. package/dist/runtime/app/components/ShiftFeedSlideover.vue +8 -6
  10. package/dist/runtime/app/components/ShiftNowCard.vue +2 -2
  11. package/dist/runtime/app/components/ShiftPerksCard.vue +2 -1
  12. package/dist/runtime/app/components/ShiftSlideover.vue +2 -1
  13. package/dist/runtime/app/dashboard/NextShift.d.vue.ts +4 -1
  14. package/dist/runtime/app/dashboard/NextShift.vue +14 -5
  15. package/dist/runtime/app/dashboard/NextShift.vue.d.ts +4 -1
  16. package/dist/runtime/app/dashboard/OpenSwaps.vue +11 -5
  17. package/dist/runtime/app/dashboard/TeamOnNow.vue +12 -4
  18. package/dist/runtime/app/pages/lead.vue +17 -10
  19. package/dist/runtime/app/pages/shift-redirect.d.vue.ts +3 -0
  20. package/dist/runtime/app/pages/shift-redirect.vue +10 -0
  21. package/dist/runtime/app/pages/shift-redirect.vue.d.ts +3 -0
  22. package/dist/runtime/app/pages/shift.vue +292 -286
  23. package/dist/runtime/app/tabs/HomeShifts.vue +101 -94
  24. package/dist/runtime/app/tabs/HomeSwaps.vue +17 -8
  25. package/dist/runtime/app/tabs/Shifts.vue +16 -8
  26. package/dist/runtime/dashboard.d.ts +2 -2
  27. package/dist/runtime/dashboard.js +5 -0
  28. package/dist/runtime/i18n/lang/da.json +33 -2
  29. package/dist/runtime/i18n/lang/en.json +33 -2
  30. package/dist/runtime/server/routes/lead/check-in-any.post.d.ts +2 -0
  31. package/dist/runtime/server/routes/lead/check-in-any.post.js +12 -0
  32. package/dist/runtime/server/routes/lead/check-in.post.js +1 -1
  33. package/dist/runtime/server/utils/shifts-assign.d.ts +10 -5
  34. package/dist/runtime/server/utils/shifts-assign.js +3 -3
  35. package/dist/runtime/utils/api.d.ts +2 -0
  36. package/dist/runtime/utils/api.js +2 -0
  37. package/dist/runtime/utils/links.d.ts +2 -0
  38. package/dist/runtime/utils/links.js +1 -0
  39. package/package.json +29 -25
@@ -2,7 +2,7 @@
2
2
  import { shiftsApi } from "../../utils/api";
3
3
  import { SHIFT_ASSIGNMENT_STATUS_LABELS } from "../../utils/status";
4
4
  import { dayKey } from "@frigear-nu/module-kit/time";
5
- import { $fetch, computed, errorMessage, navigateTo, ref, useAction, useAuthPages, useFetch, useHead, useModuleT, useRoute, useShiftsActions, useShiftsFormat, useShiftsLinks, useShiftsTranslate } from "#imports";
5
+ import { $fetch, computed, errorMessage, navigateTo, ref, useAction, useAuthPages, useCachedFetch, useFetch, useHead, useModuleT, useRoute, useShiftsActions, useShiftsFormat, useShiftsLinks, useShiftsTranslate } from "#imports";
6
6
  defineOptions({ name: "ShiftsLeadPage" });
7
7
  const t = useModuleT("shifts");
8
8
  const tr = useShiftsTranslate();
@@ -46,8 +46,8 @@ const exceptionLabel = (item) => ({
46
46
  claimed_no_show: t("exceptions.claimed_no_show", "No-show, perk claimed")
47
47
  })[item.kind];
48
48
  const exceptionColor = (kind) => kind === "late" ? "warning" : kind === "not_checked_in" ? "info" : "error";
49
- const { data: led } = await useFetch(shiftsApi.me.leads, { key: "shifts:leads", default: () => [] });
50
- const team = computed(() => led.value.find((item) => item.teamId === teamId.value));
49
+ const { data: led } = await useCachedFetch(shiftsApi.me.leads, { key: "shifts:leads", ttl: 0 });
50
+ const team = computed(() => (led.value ?? []).find((item) => item.teamId === teamId.value));
51
51
  const days = computed(() => {
52
52
  const byDay = /* @__PURE__ */ new Map();
53
53
  for (const shift of shifts.value) {
@@ -82,11 +82,12 @@ useHead({ title: () => t("lead.title", "Lead {team}", { team: team.value ? tr(te
82
82
  :description="team ? tr(team.operationName) : t('lead.description', 'Your team\'s shifts, attendance and swaps.')"
83
83
  >
84
84
  <template #links>
85
- <UButton
85
+ <TooltipButton
86
86
  icon="i-lucide-megaphone"
87
87
  color="neutral"
88
88
  variant="outline"
89
89
  :label="t('broadcast.leadAction', 'Message team')"
90
+ :tooltip="t('broadcast.leadActionHint', 'Send a message to everyone on this team')"
90
91
  @click="actions.broadcastToTeam(teamId, team ? tr(team.teamName) : '')"
91
92
  />
92
93
  <UButton
@@ -132,15 +133,17 @@ useHead({ title: () => t("lead.title", "Lead {team}", { team: team.value ? tr(te
132
133
  >
133
134
  {{ t("swaps.noLongerAllowed", "No longer allowed by the schedule's settings: reject it.") }}
134
135
  </span>
135
- <UButton
136
+ <TooltipButton
136
137
  color="neutral"
137
138
  variant="outline"
138
139
  :label="t('swaps.rejectAction', 'Reject swap')"
140
+ :tooltip="t('swaps.rejectActionHint', 'Both keep their shifts; the shift is open for offers again')"
139
141
  @click="reject(swap)"
140
142
  />
141
- <UButton
143
+ <TooltipButton
142
144
  v-if="actions.swapAllowed(swap)"
143
145
  :label="t('swaps.approveAction', 'Approve swap')"
146
+ :tooltip="t('swaps.approveActionHint', 'The shifts change hands as the two agreed')"
144
147
  @click="approve(swap)"
145
148
  />
146
149
  </div>
@@ -204,20 +207,22 @@ useHead({ title: () => t("lead.title", "Lead {team}", { team: team.value ? tr(te
204
207
  variant="subtle"
205
208
  :label="exceptionLabel(item)"
206
209
  />
207
- <UButton
210
+ <TooltipButton
208
211
  v-if="item.assignment.status !== 'attended'"
209
212
  size="xs"
210
213
  color="neutral"
211
214
  variant="outline"
212
215
  :label="t('admin.markAttended', 'Mark attended')"
216
+ :tooltip="t('admin.markAttendedHint', 'Record that they worked this shift')"
213
217
  @click="mark(item.assignment, 'attended')"
214
218
  />
215
- <UButton
219
+ <TooltipButton
216
220
  v-if="item.assignment.status === 'assigned'"
217
221
  size="xs"
218
222
  color="neutral"
219
223
  variant="ghost"
220
224
  :label="t('admin.markNoShow', 'Mark no-show')"
225
+ :tooltip="t('admin.markNoShowHint', 'Record that they did not turn up for this shift')"
221
226
  @click="mark(item.assignment, 'no_show')"
222
227
  />
223
228
  </div>
@@ -271,20 +276,22 @@ useHead({ title: () => t("lead.title", "Lead {team}", { team: team.value ? tr(te
271
276
  :label="statusLabel(assignee.status)"
272
277
  :colors="{ assigned: 'info', attended: 'success', no_show: 'error' }"
273
278
  />
274
- <UButton
279
+ <TooltipButton
275
280
  v-if="assignee.status !== 'attended'"
276
281
  size="xs"
277
282
  color="neutral"
278
283
  variant="outline"
279
284
  :label="t('admin.markAttended', 'Mark attended')"
285
+ :tooltip="t('admin.markAttendedHint', 'Record that they worked this shift')"
280
286
  @click="mark(assignee, 'attended')"
281
287
  />
282
- <UButton
288
+ <TooltipButton
283
289
  v-if="assignee.status !== 'no_show'"
284
290
  size="xs"
285
291
  color="neutral"
286
292
  variant="ghost"
287
293
  :label="t('admin.markNoShow', 'Mark no-show')"
294
+ :tooltip="t('admin.markNoShowHint', 'Record that they did not turn up for this shift')"
288
295
  @click="mark(assignee, 'no_show')"
289
296
  />
290
297
  </div>
@@ -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,10 @@
1
+ <script setup>
2
+ import { navigateTo, useRoute, useShiftsLinks } from "#imports";
3
+ defineOptions({ name: "ShiftsShiftRedirectPage" });
4
+ const route = useRoute();
5
+ await navigateTo(useShiftsLinks().shift(String(route.params.assignmentId ?? "")), { redirectCode: 301, replace: true });
6
+ </script>
7
+
8
+ <template>
9
+ <div />
10
+ </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;