@frigear-nu/shifts 0.0.0 → 0.1.0
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/dist/module.d.mts +9 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +26 -7
- package/dist/runtime/app/pages/shifts.vue +4 -152
- package/dist/runtime/app/pages/swaps.vue +3 -163
- 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/i18n/lang/da.json +8 -7
- package/dist/runtime/i18n/lang/en.json +8 -7
- package/dist/runtime/server/utils/shifts-emails.js +2 -2
- package/dist/runtime/server/utils/shifts-schemas.d.ts +4 -4
- package/dist/runtime/utils/links.d.ts +16 -2
- package/dist/runtime/utils/links.js +5 -2
- package/package.json +17 -17
- package/dist/runtime/menus.d.ts +0 -2
- package/dist/runtime/menus.js +0 -17
package/dist/module.d.mts
CHANGED
|
@@ -84,11 +84,16 @@ type ShiftCheckInRule = {
|
|
|
84
84
|
type ModuleOptions = {
|
|
85
85
|
settings?: {
|
|
86
86
|
pages?: {
|
|
87
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* My shifts (list and calendar): the My shifts tab of the crew home (`crew.dashboard` of `@frigear-nu/crew`), and a
|
|
89
|
+
* page at `/shifts`. When the crew home is in the signed-in hub (`/dashboard/crew`) only the tab is there and
|
|
90
|
+
* `/shifts` redirects to it, unless this is a path (a page there too) or `@frigear-nu/mobile` is installed (its
|
|
91
|
+
* Shifts tab opens the page). `false` turns both off.
|
|
92
|
+
*/
|
|
88
93
|
shifts?: string | boolean;
|
|
89
94
|
/** One of my shifts: the lead on duty, the QR pass and the swap; must contain an `:assignmentId` param. On by default (`/shifts/:assignmentId`). */
|
|
90
95
|
shift?: string | boolean;
|
|
91
|
-
/** The swap marketplace
|
|
96
|
+
/** The swap marketplace: the Swaps tab of the crew home, and a page at `/shifts/swaps` on the same terms as `shifts`. */
|
|
92
97
|
swaps?: string | boolean;
|
|
93
98
|
/** The check-in scanner of a team's leads; must contain a `:teamId` param. On by default (`/shifts/check-in/:teamId`). */
|
|
94
99
|
checkIn?: string | boolean;
|
|
@@ -139,6 +144,7 @@ type ShiftsRemindersOptions = {
|
|
|
139
144
|
batchSize?: number;
|
|
140
145
|
};
|
|
141
146
|
type PublicModuleOptions = {
|
|
147
|
+
/** `home`: the crew home of `@frigear-nu/crew`, where the My shifts and Swaps tabs are. */
|
|
142
148
|
pages: {
|
|
143
149
|
shifts?: string;
|
|
144
150
|
shift?: string;
|
|
@@ -146,6 +152,7 @@ type PublicModuleOptions = {
|
|
|
146
152
|
checkIn?: string;
|
|
147
153
|
lead?: string;
|
|
148
154
|
station?: string;
|
|
155
|
+
home?: string;
|
|
149
156
|
};
|
|
150
157
|
timeZone: string;
|
|
151
158
|
checkInOpensMinutes: number;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addServerImportsDir, addServerPlugin, addImports, addComponentsDir
|
|
2
|
-
import { registerModule, registerTailwindSource, registerLocales, resolvePagePath, registerDatabaseTable, addModuleRoutes, inlineModuleRuntime, addModulePages,
|
|
1
|
+
import { defineNuxtModule, createResolver, hasNuxtModule, addServerImportsDir, addServerPlugin, addImports, addComponentsDir } from '@nuxt/kit';
|
|
2
|
+
import { registerModule, registerTailwindSource, registerLocales, resolveDashboardHubPath, isPathUnder, resolvePagePath, registerDatabaseTable, addModuleRoutes, inlineModuleRuntime, addModulePages, addPageRedirects } from '@frigear-nu/module-kit/utils';
|
|
3
3
|
import { extendMaps, defineMapLayer } from '@frigear-nu/maps/utils';
|
|
4
4
|
import { OPERATIONS_VENUE_SURFACE } from '@frigear-nu/operations/utils';
|
|
5
5
|
import { registerAccess, addPolicies } from '@frigear-nu/auth/utils';
|
|
6
6
|
import { shiftsAccess, perksAccess } from '../dist/runtime/access.js';
|
|
7
|
-
import { SHIFTS_DEFAULT_PAGES } from '../dist/runtime/utils/links.js';
|
|
7
|
+
import { SHIFTS_DEFAULT_PAGES, SHIFTS_HOME_TAB, shiftsSwapsPath, shiftsMinePath } from '../dist/runtime/utils/links.js';
|
|
8
|
+
import { resolveCrewHomePath } from '@frigear-nu/crew/utils';
|
|
8
9
|
import { isValidTimeZone } from '@frigear-nu/module-kit/time';
|
|
9
10
|
import { normalizeReminderBatch, normalizeReminderOffsets } from '../dist/runtime/utils/reminders.js';
|
|
10
11
|
import { SHIFTS_DASHBOARD, shiftsDashboardItems } from '../dist/runtime/dashboard.js';
|
|
@@ -57,14 +58,19 @@ const module$1 = defineNuxtModule({
|
|
|
57
58
|
const timeZone = options.timeZone || "";
|
|
58
59
|
if (timeZone && !isValidTimeZone(timeZone)) throw new Error(`[shifts] \`timeZone\` "${timeZone}" is not a time zone this runtime knows.`);
|
|
59
60
|
const checkInOpensMinutes = Math.max(0, Math.round(options.checkInOpensMinutes ?? 60));
|
|
60
|
-
const
|
|
61
|
+
const hub = resolveDashboardHubPath(nuxt, { dependency: true });
|
|
62
|
+
const crewHome = resolveCrewHomePath(nuxt.options.crew?.settings?.pages?.home, hub);
|
|
63
|
+
const tabsOnly = !!(crewHome && hub && isPathUnder(crewHome, hub)) && !hasNuxtModule("@frigear-nu/mobile");
|
|
64
|
+
const shiftsSetting = settings.pages?.shifts ?? true;
|
|
65
|
+
const swapsSetting = settings.pages?.swaps ?? true;
|
|
66
|
+
const shiftsPath = tabsOnly && typeof shiftsSetting !== "string" ? void 0 : resolvePagePath(shiftsSetting, SHIFTS_DEFAULT_PAGES.shifts);
|
|
61
67
|
const shiftPath = resolvePagePath(settings.pages?.shift ?? true, SHIFTS_DEFAULT_PAGES.shift);
|
|
62
|
-
const swapsPath = resolvePagePath(
|
|
68
|
+
const swapsPath = tabsOnly && typeof swapsSetting !== "string" ? void 0 : resolvePagePath(swapsSetting, SHIFTS_DEFAULT_PAGES.swaps);
|
|
63
69
|
const checkInPath = resolvePagePath(settings.pages?.checkIn ?? true, SHIFTS_DEFAULT_PAGES.checkIn);
|
|
64
70
|
const leadPath = resolvePagePath(settings.pages?.lead ?? true, SHIFTS_DEFAULT_PAGES.lead);
|
|
65
71
|
const stationPath = resolvePagePath(settings.pages?.station ?? true, SHIFTS_DEFAULT_PAGES.station);
|
|
66
72
|
nuxt.options.runtimeConfig.public.shifts = {
|
|
67
|
-
pages: { shifts: shiftsPath, shift: shiftPath, swaps: swapsPath, checkIn: checkInPath, lead: leadPath, station: stationPath },
|
|
73
|
+
pages: { shifts: shiftsPath, shift: shiftPath, swaps: swapsPath, checkIn: checkInPath, lead: leadPath, station: stationPath, home: crewHome },
|
|
68
74
|
timeZone,
|
|
69
75
|
checkInOpensMinutes
|
|
70
76
|
};
|
|
@@ -228,6 +234,20 @@ const module$1 = defineNuxtModule({
|
|
|
228
234
|
permission: shiftsAccess.permissions.manage
|
|
229
235
|
});
|
|
230
236
|
}
|
|
237
|
+
if (crewHome && hasNuxtModule("@frigear-nu/widget")) {
|
|
238
|
+
const { extendTabs } = await import('@frigear-nu/widget/utils');
|
|
239
|
+
extendTabs(nuxt, "crew.dashboard", [
|
|
240
|
+
...shiftsSetting === false ? [] : [{ id: SHIFTS_HOME_TAB.shifts, component: resolver.resolve("./runtime/app/tabs/HomeShifts.vue"), order: 20, label: "My shifts", labelKey: "shifts.home.tabs.shifts", icon: "i-lucide-calendar-clock", permission: shiftsAccess.permissions.read }],
|
|
241
|
+
...swapsSetting === false ? [] : [{ id: SHIFTS_HOME_TAB.swaps, component: resolver.resolve("./runtime/app/tabs/HomeSwaps.vue"), order: 30, label: "Swaps", labelKey: "shifts.home.tabs.swaps", icon: "i-lucide-arrow-left-right", permission: shiftsAccess.permissions.swap }]
|
|
242
|
+
]);
|
|
243
|
+
}
|
|
244
|
+
if (tabsOnly && crewHome) {
|
|
245
|
+
const pages = { home: crewHome };
|
|
246
|
+
addPageRedirects(nuxt, {
|
|
247
|
+
...shiftsSetting === true ? { [SHIFTS_DEFAULT_PAGES.shifts]: shiftsMinePath(pages) } : {},
|
|
248
|
+
...swapsSetting === true ? { [SHIFTS_DEFAULT_PAGES.swaps]: shiftsSwapsPath(pages) } : {}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
231
251
|
if (shiftsPath && hasNuxtModule("@frigear-nu/mobile")) {
|
|
232
252
|
const { extendMobileTabs } = await import('@frigear-nu/mobile/utils');
|
|
233
253
|
extendMobileTabs(nuxt, {
|
|
@@ -246,7 +266,6 @@ const module$1 = defineNuxtModule({
|
|
|
246
266
|
const { extendDashboard } = await import('@frigear-nu/dashboard/utils');
|
|
247
267
|
extendDashboard(nuxt, SHIFTS_DASHBOARD, shiftsDashboardItems((path) => resolver.resolve(path)));
|
|
248
268
|
}
|
|
249
|
-
addOptionalMenuSource(nuxt, { file: resolver.resolve("./runtime/menus"), menu: "account" });
|
|
250
269
|
}
|
|
251
270
|
});
|
|
252
271
|
|
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { dayKey } from "@frigear-nu/module-kit/time";
|
|
5
|
-
import { computed, errorMessage, navigateTo, ref, shallowRef, useAuthPages, useFetch, useHead, useModuleT, useRoute, useShiftsActions, useShiftsFormat, useShiftsLinks, useShiftsTranslate } from "#imports";
|
|
2
|
+
import HomeShifts from "../tabs/HomeShifts.vue";
|
|
3
|
+
import { useHead, useModuleT } from "#imports";
|
|
6
4
|
defineOptions({ name: "ShiftsMinePage" });
|
|
7
5
|
const t = useModuleT("shifts");
|
|
8
|
-
const tr = useShiftsTranslate();
|
|
9
|
-
const format = useShiftsFormat();
|
|
10
|
-
const links = useShiftsLinks();
|
|
11
|
-
const actions = useShiftsActions();
|
|
12
|
-
const route = useRoute();
|
|
13
|
-
const { data, error, refresh } = await useFetch(shiftsApi.me.shifts, { key: "shifts:me", default: () => [] });
|
|
14
|
-
if (error.value?.statusCode === 401) {
|
|
15
|
-
await navigateTo({ path: useAuthPages().login, query: { redirect: route.path } });
|
|
16
|
-
}
|
|
17
|
-
const { data: led } = await useFetch(shiftsApi.me.leads, { key: "shifts:leads", default: () => [] });
|
|
18
|
-
const today = dayKey(/* @__PURE__ */ new Date(), format.timeZone);
|
|
19
|
-
const showPast = ref(false);
|
|
20
|
-
const picked = shallowRef();
|
|
21
|
-
const keyOf = (value) => `${value.year}-${String(value.month).padStart(2, "0")}-${String(value.day).padStart(2, "0")}`;
|
|
22
|
-
const workDays = computed(() => new Set(data.value.map((item) => dayKey(item.shift.startsAt, format.timeZone))));
|
|
23
|
-
const groups = computed(() => {
|
|
24
|
-
const pickedKey = picked.value ? keyOf(picked.value) : null;
|
|
25
|
-
const byDay = /* @__PURE__ */ new Map();
|
|
26
|
-
for (const item of data.value) {
|
|
27
|
-
const key = dayKey(item.shift.startsAt, format.timeZone);
|
|
28
|
-
if (pickedKey ? key !== pickedKey : !showPast.value && item.shift.endsAt < (/* @__PURE__ */ new Date()).toISOString()) continue;
|
|
29
|
-
byDay.set(key, [...byDay.get(key) ?? [], item]);
|
|
30
|
-
}
|
|
31
|
-
return [...byDay.entries()].map(([day, items]) => ({ day, items }));
|
|
32
|
-
});
|
|
33
|
-
const pastCount = computed(() => data.value.filter((item) => item.shift.endsAt < (/* @__PURE__ */ new Date()).toISOString()).length);
|
|
34
|
-
const statusLabel = (item) => item.swap ? t(`swapStatuses.${item.swap.status}`, SHIFT_SWAP_STATUS_LABELS[item.swap.status]) : t(`statuses.${item.assignment.status}`, SHIFT_ASSIGNMENT_STATUS_LABELS[item.assignment.status]);
|
|
35
6
|
useHead({ title: () => t("mine.title", "My shifts") });
|
|
36
7
|
</script>
|
|
37
8
|
|
|
@@ -41,128 +12,9 @@ useHead({ title: () => t("mine.title", "My shifts") });
|
|
|
41
12
|
<UPageHeader
|
|
42
13
|
:title="t('mine.title', 'My shifts')"
|
|
43
14
|
:description="t('mine.description', 'Your shifts, your check-in pass and your swaps.')"
|
|
44
|
-
|
|
45
|
-
<template #links>
|
|
46
|
-
<UButton
|
|
47
|
-
v-for="team in led"
|
|
48
|
-
:key="team.teamId"
|
|
49
|
-
:to="links.lead(team.teamId)"
|
|
50
|
-
icon="i-lucide-shield-check"
|
|
51
|
-
color="neutral"
|
|
52
|
-
variant="outline"
|
|
53
|
-
:label="t('mine.lead', 'Lead {team}', { team: tr(team.teamName) })"
|
|
54
|
-
/>
|
|
55
|
-
<UButton
|
|
56
|
-
icon="i-lucide-calendar-plus"
|
|
57
|
-
color="neutral"
|
|
58
|
-
variant="outline"
|
|
59
|
-
:label="t('feed.title', 'Subscribe in calendar')"
|
|
60
|
-
@click="actions.subscribe()"
|
|
61
|
-
/>
|
|
62
|
-
<UButton
|
|
63
|
-
:to="links.swaps()"
|
|
64
|
-
icon="i-lucide-arrow-left-right"
|
|
65
|
-
color="neutral"
|
|
66
|
-
variant="outline"
|
|
67
|
-
:label="t('mine.openSwaps', 'Open swaps')"
|
|
68
|
-
/>
|
|
69
|
-
</template>
|
|
70
|
-
</UPageHeader>
|
|
15
|
+
/>
|
|
71
16
|
<UPageBody>
|
|
72
|
-
<
|
|
73
|
-
v-if="error && !data.length && error.statusCode !== 401"
|
|
74
|
-
icon="i-lucide-circle-alert"
|
|
75
|
-
:title="t('mine.loadFailed', 'Your shifts could not be loaded')"
|
|
76
|
-
:description="errorMessage(error, '')"
|
|
77
|
-
:actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
|
|
78
|
-
/>
|
|
79
|
-
<UEmpty
|
|
80
|
-
v-else-if="!data.length"
|
|
81
|
-
icon="i-lucide-calendar-clock"
|
|
82
|
-
:title="t('mine.empty', 'No shifts yet')"
|
|
83
|
-
:description="t('mine.emptyDescription', 'When a coordinator puts you on a shift, it shows up here.')"
|
|
84
|
-
/>
|
|
85
|
-
<div
|
|
86
|
-
v-else
|
|
87
|
-
class="grid gap-6 lg:grid-cols-[20rem_1fr]"
|
|
88
|
-
>
|
|
89
|
-
<div class="flex flex-col gap-2">
|
|
90
|
-
<SectionCard>
|
|
91
|
-
<UCalendar
|
|
92
|
-
v-model="picked"
|
|
93
|
-
:week-starts-on="1"
|
|
94
|
-
class="w-full"
|
|
95
|
-
>
|
|
96
|
-
<template #day="{ day }">
|
|
97
|
-
<UChip
|
|
98
|
-
:show="workDays.has(keyOf(day))"
|
|
99
|
-
size="2xs"
|
|
100
|
-
position="bottom-right"
|
|
101
|
-
>
|
|
102
|
-
{{ day.day }}
|
|
103
|
-
</UChip>
|
|
104
|
-
</template>
|
|
105
|
-
</UCalendar>
|
|
106
|
-
</SectionCard>
|
|
107
|
-
<UButton
|
|
108
|
-
v-if="picked"
|
|
109
|
-
color="neutral"
|
|
110
|
-
variant="ghost"
|
|
111
|
-
icon="i-lucide-x"
|
|
112
|
-
:label="t('mine.showAll', 'Show all days')"
|
|
113
|
-
@click="picked = void 0"
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
<div class="flex flex-col gap-6">
|
|
117
|
-
<p
|
|
118
|
-
v-if="!groups.length"
|
|
119
|
-
class="text-muted text-sm"
|
|
120
|
-
>
|
|
121
|
-
{{ picked ? t("mine.noneThatDay", "No shifts on that day.") : t("mine.noneUpcoming", "No upcoming shifts.") }}
|
|
122
|
-
</p>
|
|
123
|
-
<section
|
|
124
|
-
v-for="group in groups"
|
|
125
|
-
:key="group.day"
|
|
126
|
-
class="flex flex-col gap-2"
|
|
127
|
-
>
|
|
128
|
-
<h2 class="text-highlighted text-sm font-semibold">
|
|
129
|
-
{{ format.day(group.day) }}
|
|
130
|
-
<UBadge
|
|
131
|
-
v-if="group.day === today"
|
|
132
|
-
class="ms-2"
|
|
133
|
-
size="sm"
|
|
134
|
-
:label="t('mine.today', 'Today')"
|
|
135
|
-
/>
|
|
136
|
-
</h2>
|
|
137
|
-
<ULink
|
|
138
|
-
v-for="item in group.items"
|
|
139
|
-
:key="item.assignment.id"
|
|
140
|
-
:to="links.shift(item.assignment.id)"
|
|
141
|
-
class="border-default hover:bg-elevated/50 flex items-center justify-between gap-3 rounded-lg border p-3 transition"
|
|
142
|
-
>
|
|
143
|
-
<div class="flex min-w-0 flex-col">
|
|
144
|
-
<span class="text-highlighted font-medium tabular-nums">{{ format.time(item.shift.startsAt) }}–{{ format.time(item.shift.endsAt) }}</span>
|
|
145
|
-
<span class="text-muted truncate text-sm">
|
|
146
|
-
{{ tr(item.teamName) }}<template v-if="item.roleName"> · {{ tr(item.roleName) }}</template> · {{ tr(item.operationName) }}
|
|
147
|
-
</span>
|
|
148
|
-
</div>
|
|
149
|
-
<StatusBadge
|
|
150
|
-
:status="item.swap ? item.swap.status : item.assignment.status"
|
|
151
|
-
:label="statusLabel(item)"
|
|
152
|
-
:colors="{ assigned: 'info', attended: 'success', no_show: 'error', open: 'warning', offered: 'warning', pending_approval: 'warning' }"
|
|
153
|
-
/>
|
|
154
|
-
</ULink>
|
|
155
|
-
</section>
|
|
156
|
-
<UButton
|
|
157
|
-
v-if="!picked && pastCount"
|
|
158
|
-
color="neutral"
|
|
159
|
-
variant="ghost"
|
|
160
|
-
class="self-start"
|
|
161
|
-
:label="showPast ? t('mine.hidePast', 'Hide past shifts') : t('mine.showPast', 'Show {count} past shifts', { count: pastCount })"
|
|
162
|
-
@click="showPast = !showPast"
|
|
163
|
-
/>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
17
|
+
<HomeShifts standalone />
|
|
166
18
|
</UPageBody>
|
|
167
19
|
</UPage>
|
|
168
20
|
</UContainer>
|
|
@@ -1,43 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { allowsSwapKind } from "../../utils/settings";
|
|
5
|
-
import { $fetch, computed, errorMessage, navigateTo, onMounted, reactive, ref, useAction, useAuthPages, useFetch, useHead, useModuleT, useRoute, useShiftsFormat, useShiftsLinks, useShiftsTranslate } from "#imports";
|
|
2
|
+
import HomeSwaps from "../tabs/HomeSwaps.vue";
|
|
3
|
+
import { useHead, useModuleT, useShiftsLinks } from "#imports";
|
|
6
4
|
defineOptions({ name: "ShiftsSwapsPage" });
|
|
7
5
|
const t = useModuleT("shifts");
|
|
8
|
-
const tr = useShiftsTranslate();
|
|
9
|
-
const format = useShiftsFormat();
|
|
10
6
|
const links = useShiftsLinks();
|
|
11
|
-
const { busy, run } = useAction();
|
|
12
|
-
const route = useRoute();
|
|
13
|
-
const { data: swaps, error, refresh } = await useFetch(shiftsApi.swaps, { key: "shifts:swaps", default: () => [] });
|
|
14
|
-
if (error.value?.statusCode === 401) {
|
|
15
|
-
await navigateTo({ path: useAuthPages().login, query: { redirect: route.path } });
|
|
16
|
-
}
|
|
17
|
-
const { data: mine, refresh: refreshMine } = await useFetch(shiftsApi.me.shifts, { key: "shifts:me", default: () => [] });
|
|
18
|
-
const now = ref(0);
|
|
19
|
-
onMounted(() => now.value = Date.now());
|
|
20
|
-
const upcomingMine = computed(() => mine.value.filter((item) => item.assignment.status === "assigned" && Date.parse(item.shift.startsAt) > now.value));
|
|
21
|
-
const myOpen = computed(() => upcomingMine.value.filter((item) => item.swap));
|
|
22
|
-
const giving = reactive({});
|
|
23
|
-
const givingOptions = (swap) => upcomingMine.value.filter((item) => !swap.wantedAssignmentId || item.assignment.id === swap.wantedAssignmentId).filter((item) => allowsSwapKind(item.settings, "trade")).filter((item) => item.shift.scheduleId === swap.shift.scheduleId || swap.settings.coverage !== "all" && item.settings.coverage !== "all").map((item) => ({ label: `${tr(item.teamName)} \xB7 ${format.range(item.shift.startsAt, item.shift.endsAt)}`, value: item.assignment.id }));
|
|
24
|
-
async function offer(swap) {
|
|
25
|
-
const back = swap.kind === "trade" ? giving[swap.id] ?? swap.wantedAssignmentId ?? null : null;
|
|
26
|
-
if (swap.kind === "trade" && !back) return;
|
|
27
|
-
const done = await run(
|
|
28
|
-
() => $fetch(shiftsApi.offers(swap.id), { method: "POST", body: { assignmentId: back } }).then(() => true),
|
|
29
|
-
swap.kind === "trade" ? { success: t("swaps.tradeOffered", "Offered {name} a trade", { name: swap.owner.name ?? "" }), error: t("swaps.offerFailed", "Could not make the offer") } : { success: t("swaps.offered", "Offered to take the shift of {name}", { name: swap.owner.name ?? "" }), error: t("swaps.offerFailed", "Could not make the offer") }
|
|
30
|
-
);
|
|
31
|
-
if (done) await Promise.all([refresh(), refreshMine()]);
|
|
32
|
-
}
|
|
33
|
-
async function withdraw(swap) {
|
|
34
|
-
if (!swap.myOffer) return;
|
|
35
|
-
const done = await run(
|
|
36
|
-
() => $fetch(shiftsApi.offer(swap.id, swap.myOffer.id), { method: "DELETE" }).then(() => true),
|
|
37
|
-
{ success: t("swaps.offerWithdrawn", "Withdrew your offer"), error: t("swaps.offerWithdrawFailed", "Could not withdraw the offer") }
|
|
38
|
-
);
|
|
39
|
-
if (done) await refresh();
|
|
40
|
-
}
|
|
41
7
|
useHead({ title: () => t("swaps.title", "Open swaps") });
|
|
42
8
|
</script>
|
|
43
9
|
|
|
@@ -59,133 +25,7 @@ useHead({ title: () => t("swaps.title", "Open swaps") });
|
|
|
59
25
|
</template>
|
|
60
26
|
</UPageHeader>
|
|
61
27
|
<UPageBody class="max-w-3xl">
|
|
62
|
-
<
|
|
63
|
-
v-if="myOpen.length"
|
|
64
|
-
:title="t('swaps.mine', 'Your shifts on offer')"
|
|
65
|
-
>
|
|
66
|
-
<ul class="divide-default divide-y">
|
|
67
|
-
<li
|
|
68
|
-
v-for="item in myOpen"
|
|
69
|
-
:key="item.assignment.id"
|
|
70
|
-
class="flex items-center justify-between gap-2 py-2"
|
|
71
|
-
>
|
|
72
|
-
<span class="text-sm">{{ tr(item.teamName) }} · {{ format.range(item.shift.startsAt, item.shift.endsAt) }}</span>
|
|
73
|
-
<UButton
|
|
74
|
-
:to="links.shift(item.assignment.id)"
|
|
75
|
-
size="sm"
|
|
76
|
-
color="neutral"
|
|
77
|
-
variant="outline"
|
|
78
|
-
:label="t('swaps.seeOffers', 'See offers')"
|
|
79
|
-
/>
|
|
80
|
-
</li>
|
|
81
|
-
</ul>
|
|
82
|
-
</SectionCard>
|
|
83
|
-
|
|
84
|
-
<UEmpty
|
|
85
|
-
v-if="error && error.statusCode !== 401"
|
|
86
|
-
icon="i-lucide-circle-alert"
|
|
87
|
-
:title="t('swaps.loadFailed', 'The swaps could not be loaded')"
|
|
88
|
-
:description="errorMessage(error, '')"
|
|
89
|
-
:actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
|
|
90
|
-
/>
|
|
91
|
-
<UEmpty
|
|
92
|
-
v-else-if="!swaps.length"
|
|
93
|
-
icon="i-lucide-arrow-left-right"
|
|
94
|
-
:title="t('swaps.empty', 'No open swaps for you')"
|
|
95
|
-
:description="t('swaps.emptyDescription', 'When somebody on your team offers a shift you can take, it shows up here.')"
|
|
96
|
-
/>
|
|
97
|
-
<div
|
|
98
|
-
v-else
|
|
99
|
-
class="flex flex-col gap-3"
|
|
100
|
-
>
|
|
101
|
-
<SectionCard
|
|
102
|
-
v-for="swap in swaps"
|
|
103
|
-
:key="swap.id"
|
|
104
|
-
:title="`${tr(swap.shift.teamName)} \xB7 ${format.range(swap.shift.startsAt, swap.shift.endsAt)}`"
|
|
105
|
-
:description="t('swaps.from', 'From {name} \xB7 {schedule}', { name: swap.owner.name ?? '', schedule: tr(swap.shift.scheduleName) })"
|
|
106
|
-
>
|
|
107
|
-
<template #actions>
|
|
108
|
-
<div class="flex items-center gap-2">
|
|
109
|
-
<UBadge
|
|
110
|
-
color="neutral"
|
|
111
|
-
variant="subtle"
|
|
112
|
-
:label="swap.kind === 'trade' ? t('swapKinds.trade', 'Trade') : t('swapKinds.release', 'Give away')"
|
|
113
|
-
/>
|
|
114
|
-
<UBadge
|
|
115
|
-
v-if="swap.myOffer"
|
|
116
|
-
color="primary"
|
|
117
|
-
variant="subtle"
|
|
118
|
-
:label="t(`offerStatuses.${swap.myOffer.status}`, SHIFT_SWAP_OFFER_STATUS_LABELS[swap.myOffer.status])"
|
|
119
|
-
/>
|
|
120
|
-
</div>
|
|
121
|
-
</template>
|
|
122
|
-
<UAlert
|
|
123
|
-
v-if="swap.settings.coverage === 'all'"
|
|
124
|
-
class="mb-3"
|
|
125
|
-
color="info"
|
|
126
|
-
variant="subtle"
|
|
127
|
-
icon="i-lucide-info"
|
|
128
|
-
:title="t('shift.tradeOnly', 'Trade only: you must work all your shifts.')"
|
|
129
|
-
/>
|
|
130
|
-
<p
|
|
131
|
-
v-if="swap.wantedShift && !swap.myOffer"
|
|
132
|
-
class="text-muted mb-3 text-sm"
|
|
133
|
-
>
|
|
134
|
-
{{ t("swaps.wants", "Wants your shift on {team}, {when}", { team: tr(swap.wantedShift.teamName), when: format.range(swap.wantedShift.startsAt, swap.wantedShift.endsAt) }) }}
|
|
135
|
-
</p>
|
|
136
|
-
<div
|
|
137
|
-
v-if="!swap.myOffer && swap.kind === 'trade'"
|
|
138
|
-
class="flex flex-wrap items-end gap-2"
|
|
139
|
-
>
|
|
140
|
-
<UFormField
|
|
141
|
-
:label="t('swaps.giveBack', 'You give in return')"
|
|
142
|
-
:description="givingOptions(swap).length ? void 0 : t('swaps.nothingToTrade', 'You have no upcoming shift to trade.')"
|
|
143
|
-
required
|
|
144
|
-
class="min-w-64 flex-1"
|
|
145
|
-
>
|
|
146
|
-
<USelect
|
|
147
|
-
v-model="giving[swap.id]"
|
|
148
|
-
:items="givingOptions(swap)"
|
|
149
|
-
:placeholder="t('swaps.pickShift', 'Choose one of your shifts')"
|
|
150
|
-
:disabled="!givingOptions(swap).length"
|
|
151
|
-
class="w-full"
|
|
152
|
-
/>
|
|
153
|
-
</UFormField>
|
|
154
|
-
<UButton
|
|
155
|
-
:loading="busy"
|
|
156
|
-
:disabled="!giving[swap.id] && !swap.wantedAssignmentId"
|
|
157
|
-
:label="t('swaps.tradeAction', 'Offer a trade')"
|
|
158
|
-
@click="offer(swap)"
|
|
159
|
-
/>
|
|
160
|
-
</div>
|
|
161
|
-
<div
|
|
162
|
-
v-else-if="!swap.myOffer"
|
|
163
|
-
class="flex justify-end"
|
|
164
|
-
>
|
|
165
|
-
<UButton
|
|
166
|
-
:loading="busy"
|
|
167
|
-
:label="t('swaps.offerAction', 'Take the shift over')"
|
|
168
|
-
@click="offer(swap)"
|
|
169
|
-
/>
|
|
170
|
-
</div>
|
|
171
|
-
<div
|
|
172
|
-
v-else
|
|
173
|
-
class="flex items-center justify-between gap-2"
|
|
174
|
-
>
|
|
175
|
-
<span class="text-muted text-sm">
|
|
176
|
-
{{ swap.myOffer.offeredShift ? t("swaps.youGive", "You give {team}, {when}", { team: tr(swap.myOffer.offeredShift.teamName), when: format.range(swap.myOffer.offeredShift.startsAt, swap.myOffer.offeredShift.endsAt) }) : t("swaps.youTake", "You take the shift over") }}
|
|
177
|
-
</span>
|
|
178
|
-
<UButton
|
|
179
|
-
color="neutral"
|
|
180
|
-
variant="outline"
|
|
181
|
-
size="sm"
|
|
182
|
-
:loading="busy"
|
|
183
|
-
:label="t('swaps.withdrawOffer', 'Withdraw offer')"
|
|
184
|
-
@click="withdraw(swap)"
|
|
185
|
-
/>
|
|
186
|
-
</div>
|
|
187
|
-
</SectionCard>
|
|
188
|
-
</div>
|
|
28
|
+
<HomeSwaps />
|
|
189
29
|
</UPageBody>
|
|
190
30
|
</UPage>
|
|
191
31
|
</UContainer>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
standalone?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { shiftsApi } from "../../utils/api";
|
|
3
|
+
import { SHIFT_ASSIGNMENT_STATUS_LABELS, SHIFT_SWAP_STATUS_LABELS } from "../../utils/status";
|
|
4
|
+
import { dayKey } from "@frigear-nu/module-kit/time";
|
|
5
|
+
import { computed, errorMessage, navigateTo, ref, shallowRef, useAuthPages, useLazyFetch, useModuleT, useRoute, useShiftsActions, useShiftsFormat, useShiftsLinks, useShiftsTranslate, watch } from "#imports";
|
|
6
|
+
defineOptions({ name: "ShiftsHomeShiftsTab" });
|
|
7
|
+
defineProps({
|
|
8
|
+
standalone: { type: Boolean, required: false }
|
|
9
|
+
});
|
|
10
|
+
const t = useModuleT("shifts");
|
|
11
|
+
const tr = useShiftsTranslate();
|
|
12
|
+
const format = useShiftsFormat();
|
|
13
|
+
const links = useShiftsLinks();
|
|
14
|
+
const actions = useShiftsActions();
|
|
15
|
+
const route = useRoute();
|
|
16
|
+
const { data, status, error, refresh } = useLazyFetch(shiftsApi.me.shifts, { key: "shifts:me", default: () => [] });
|
|
17
|
+
const { data: led } = useLazyFetch(shiftsApi.me.leads, { key: "shifts:leads", default: () => [] });
|
|
18
|
+
const loading = computed(() => status.value === "pending" && !data.value.length);
|
|
19
|
+
watch(() => error.value?.statusCode, async (code) => {
|
|
20
|
+
if (code === 401) await navigateTo({ path: useAuthPages().login, query: { redirect: route.fullPath } });
|
|
21
|
+
}, { immediate: true });
|
|
22
|
+
const today = dayKey(/* @__PURE__ */ new Date(), format.timeZone);
|
|
23
|
+
const showPast = ref(false);
|
|
24
|
+
const picked = shallowRef();
|
|
25
|
+
const keyOf = (value) => `${value.year}-${String(value.month).padStart(2, "0")}-${String(value.day).padStart(2, "0")}`;
|
|
26
|
+
const workDays = computed(() => new Set(data.value.map((item) => dayKey(item.shift.startsAt, format.timeZone))));
|
|
27
|
+
const groups = computed(() => {
|
|
28
|
+
const pickedKey = picked.value ? keyOf(picked.value) : null;
|
|
29
|
+
const byDay = /* @__PURE__ */ new Map();
|
|
30
|
+
for (const item of data.value) {
|
|
31
|
+
const key = dayKey(item.shift.startsAt, format.timeZone);
|
|
32
|
+
if (pickedKey ? key !== pickedKey : !showPast.value && item.shift.endsAt < (/* @__PURE__ */ new Date()).toISOString()) continue;
|
|
33
|
+
byDay.set(key, [...byDay.get(key) ?? [], item]);
|
|
34
|
+
}
|
|
35
|
+
return [...byDay.entries()].map(([day, items]) => ({ day, items }));
|
|
36
|
+
});
|
|
37
|
+
const pastCount = computed(() => data.value.filter((item) => item.shift.endsAt < (/* @__PURE__ */ new Date()).toISOString()).length);
|
|
38
|
+
const statusLabel = (item) => item.swap ? t(`swapStatuses.${item.swap.status}`, SHIFT_SWAP_STATUS_LABELS[item.swap.status]) : t(`statuses.${item.assignment.status}`, SHIFT_ASSIGNMENT_STATUS_LABELS[item.assignment.status]);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<div class="flex flex-col gap-4">
|
|
43
|
+
<div class="flex flex-wrap justify-end gap-2">
|
|
44
|
+
<UButton
|
|
45
|
+
v-for="team in led"
|
|
46
|
+
:key="team.teamId"
|
|
47
|
+
:to="links.lead(team.teamId)"
|
|
48
|
+
icon="i-lucide-shield-check"
|
|
49
|
+
color="neutral"
|
|
50
|
+
variant="outline"
|
|
51
|
+
:label="t('mine.lead', 'Lead {team}', { team: tr(team.teamName) })"
|
|
52
|
+
/>
|
|
53
|
+
<UButton
|
|
54
|
+
icon="i-lucide-calendar-plus"
|
|
55
|
+
color="neutral"
|
|
56
|
+
variant="outline"
|
|
57
|
+
:label="t('feed.title', 'Subscribe in calendar')"
|
|
58
|
+
@click="actions.subscribe()"
|
|
59
|
+
/>
|
|
60
|
+
<UButton
|
|
61
|
+
v-if="standalone"
|
|
62
|
+
:to="links.swaps()"
|
|
63
|
+
icon="i-lucide-arrow-left-right"
|
|
64
|
+
color="neutral"
|
|
65
|
+
variant="outline"
|
|
66
|
+
:label="t('mine.openSwaps', 'Open swaps')"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div
|
|
71
|
+
v-if="loading"
|
|
72
|
+
class="grid gap-4 lg:grid-cols-[20rem_1fr]"
|
|
73
|
+
aria-busy="true"
|
|
74
|
+
>
|
|
75
|
+
<SectionCard loading />
|
|
76
|
+
<SectionCard loading />
|
|
77
|
+
</div>
|
|
78
|
+
<UEmpty
|
|
79
|
+
v-else-if="error && !data.length"
|
|
80
|
+
icon="i-lucide-circle-alert"
|
|
81
|
+
:title="t('mine.loadFailed', 'Your shifts could not be loaded')"
|
|
82
|
+
:description="errorMessage(error, '')"
|
|
83
|
+
:actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
|
|
84
|
+
/>
|
|
85
|
+
<UEmpty
|
|
86
|
+
v-else-if="!data.length"
|
|
87
|
+
icon="i-lucide-calendar-clock"
|
|
88
|
+
:title="t('mine.empty', 'No shifts yet')"
|
|
89
|
+
:description="t('mine.emptyDescription', 'When a coordinator puts you on a shift, it shows up here.')"
|
|
90
|
+
:actions="[{ label: t('mine.openSwaps', 'Open swaps'), to: links.swaps(), icon: 'i-lucide-arrow-left-right', color: 'neutral', variant: 'outline' }]"
|
|
91
|
+
/>
|
|
92
|
+
<div
|
|
93
|
+
v-else
|
|
94
|
+
class="grid items-start gap-4 lg:grid-cols-[20rem_1fr]"
|
|
95
|
+
data-shifts-mine
|
|
96
|
+
>
|
|
97
|
+
<SectionCard
|
|
98
|
+
:title="t('mine.calendar', 'Calendar')"
|
|
99
|
+
icon="i-lucide-calendar"
|
|
100
|
+
>
|
|
101
|
+
<template
|
|
102
|
+
v-if="picked"
|
|
103
|
+
#actions
|
|
104
|
+
>
|
|
105
|
+
<UButton
|
|
106
|
+
color="neutral"
|
|
107
|
+
variant="ghost"
|
|
108
|
+
size="xs"
|
|
109
|
+
icon="i-lucide-x"
|
|
110
|
+
:label="t('mine.showAll', 'Show all days')"
|
|
111
|
+
@click="picked = void 0"
|
|
112
|
+
/>
|
|
113
|
+
</template>
|
|
114
|
+
<UCalendar
|
|
115
|
+
v-model="picked"
|
|
116
|
+
:week-starts-on="1"
|
|
117
|
+
class="w-full"
|
|
118
|
+
>
|
|
119
|
+
<template #day="{ day }">
|
|
120
|
+
<UChip
|
|
121
|
+
:show="workDays.has(keyOf(day))"
|
|
122
|
+
size="2xs"
|
|
123
|
+
position="bottom-right"
|
|
124
|
+
>
|
|
125
|
+
{{ day.day }}
|
|
126
|
+
</UChip>
|
|
127
|
+
</template>
|
|
128
|
+
</UCalendar>
|
|
129
|
+
</SectionCard>
|
|
130
|
+
|
|
131
|
+
<div class="flex flex-col gap-4">
|
|
132
|
+
<SectionCard v-if="!groups.length">
|
|
133
|
+
<p class="text-muted text-sm">
|
|
134
|
+
{{ picked ? t("mine.noneThatDay", "No shifts on that day.") : t("mine.noneUpcoming", "No upcoming shifts.") }}
|
|
135
|
+
</p>
|
|
136
|
+
</SectionCard>
|
|
137
|
+
<SectionCard
|
|
138
|
+
v-for="group in groups"
|
|
139
|
+
:key="group.day"
|
|
140
|
+
:title="format.day(group.day)"
|
|
141
|
+
flush
|
|
142
|
+
>
|
|
143
|
+
<template
|
|
144
|
+
v-if="group.day === today"
|
|
145
|
+
#actions
|
|
146
|
+
>
|
|
147
|
+
<UBadge
|
|
148
|
+
size="sm"
|
|
149
|
+
variant="subtle"
|
|
150
|
+
:label="t('mine.today', 'Today')"
|
|
151
|
+
/>
|
|
152
|
+
</template>
|
|
153
|
+
<ul class="divide-default divide-y">
|
|
154
|
+
<li
|
|
155
|
+
v-for="item in group.items"
|
|
156
|
+
:key="item.assignment.id"
|
|
157
|
+
>
|
|
158
|
+
<ULink
|
|
159
|
+
:to="links.shift(item.assignment.id)"
|
|
160
|
+
class="hover:bg-elevated/50 flex items-center justify-between gap-3 px-4 py-3 transition"
|
|
161
|
+
>
|
|
162
|
+
<div class="flex min-w-0 flex-col">
|
|
163
|
+
<span class="text-highlighted font-medium tabular-nums">{{ format.time(item.shift.startsAt) }}–{{ format.time(item.shift.endsAt) }}</span>
|
|
164
|
+
<span class="text-muted truncate text-sm">
|
|
165
|
+
{{ tr(item.teamName) }}<template v-if="item.roleName"> · {{ tr(item.roleName) }}</template> · {{ tr(item.operationName) }}
|
|
166
|
+
</span>
|
|
167
|
+
</div>
|
|
168
|
+
<div class="flex shrink-0 items-center gap-2">
|
|
169
|
+
<StatusBadge
|
|
170
|
+
:status="item.swap ? item.swap.status : item.assignment.status"
|
|
171
|
+
:label="statusLabel(item)"
|
|
172
|
+
:colors="{ assigned: 'info', attended: 'success', no_show: 'error', open: 'warning', offered: 'warning', pending_approval: 'warning' }"
|
|
173
|
+
/>
|
|
174
|
+
<UIcon
|
|
175
|
+
name="i-lucide-chevron-right"
|
|
176
|
+
class="text-dimmed size-4"
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
</ULink>
|
|
180
|
+
</li>
|
|
181
|
+
</ul>
|
|
182
|
+
</SectionCard>
|
|
183
|
+
<UButton
|
|
184
|
+
v-if="!picked && pastCount"
|
|
185
|
+
color="neutral"
|
|
186
|
+
variant="ghost"
|
|
187
|
+
class="self-start"
|
|
188
|
+
:label="showPast ? t('mine.hidePast', 'Hide past shifts') : t('mine.showPast', 'Show {count} past shifts', { count: pastCount })"
|
|
189
|
+
@click="showPast = !showPast"
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</template>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
standalone?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
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,188 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { shiftsApi } from "../../utils/api";
|
|
3
|
+
import { SHIFT_SWAP_OFFER_STATUS_LABELS } from "../../utils/status";
|
|
4
|
+
import { allowsSwapKind } from "../../utils/settings";
|
|
5
|
+
import { $fetch, computed, errorMessage, navigateTo, onMounted, reactive, ref, useAction, useAuthPages, useLazyFetch, useModuleT, useRoute, useShiftsFormat, useShiftsLinks, useShiftsTranslate, watch } from "#imports";
|
|
6
|
+
defineOptions({ name: "ShiftsHomeSwapsTab" });
|
|
7
|
+
const t = useModuleT("shifts");
|
|
8
|
+
const tr = useShiftsTranslate();
|
|
9
|
+
const format = useShiftsFormat();
|
|
10
|
+
const links = useShiftsLinks();
|
|
11
|
+
const { busy, run } = useAction();
|
|
12
|
+
const route = useRoute();
|
|
13
|
+
const { data: swaps, status, error, refresh } = useLazyFetch(shiftsApi.swaps, { key: "shifts:swaps", default: () => [] });
|
|
14
|
+
const { data: mine, refresh: refreshMine } = useLazyFetch(shiftsApi.me.shifts, { key: "shifts:me", default: () => [] });
|
|
15
|
+
const loading = computed(() => status.value === "pending" && !swaps.value.length);
|
|
16
|
+
watch(() => error.value?.statusCode, async (code) => {
|
|
17
|
+
if (code === 401) await navigateTo({ path: useAuthPages().login, query: { redirect: route.fullPath } });
|
|
18
|
+
}, { immediate: true });
|
|
19
|
+
const now = ref(0);
|
|
20
|
+
onMounted(() => now.value = Date.now());
|
|
21
|
+
const upcomingMine = computed(() => mine.value.filter((item) => item.assignment.status === "assigned" && Date.parse(item.shift.startsAt) > now.value));
|
|
22
|
+
const myOpen = computed(() => upcomingMine.value.filter((item) => item.swap));
|
|
23
|
+
const giving = reactive({});
|
|
24
|
+
const givingOptions = (swap) => upcomingMine.value.filter((item) => !swap.wantedAssignmentId || item.assignment.id === swap.wantedAssignmentId).filter((item) => allowsSwapKind(item.settings, "trade")).filter((item) => item.shift.scheduleId === swap.shift.scheduleId || swap.settings.coverage !== "all" && item.settings.coverage !== "all").map((item) => ({ label: `${tr(item.teamName)} \xB7 ${format.range(item.shift.startsAt, item.shift.endsAt)}`, value: item.assignment.id }));
|
|
25
|
+
async function offer(swap) {
|
|
26
|
+
const back = swap.kind === "trade" ? giving[swap.id] ?? swap.wantedAssignmentId ?? null : null;
|
|
27
|
+
if (swap.kind === "trade" && !back) return;
|
|
28
|
+
const done = await run(
|
|
29
|
+
() => $fetch(shiftsApi.offers(swap.id), { method: "POST", body: { assignmentId: back } }).then(() => true),
|
|
30
|
+
swap.kind === "trade" ? { success: t("swaps.tradeOffered", "Offered {name} a trade", { name: swap.owner.name ?? "" }), error: t("swaps.offerFailed", "Could not make the offer") } : { success: t("swaps.offered", "Offered to take the shift of {name}", { name: swap.owner.name ?? "" }), error: t("swaps.offerFailed", "Could not make the offer") }
|
|
31
|
+
);
|
|
32
|
+
if (done) await Promise.all([refresh(), refreshMine()]);
|
|
33
|
+
}
|
|
34
|
+
async function withdraw(swap) {
|
|
35
|
+
if (!swap.myOffer) return;
|
|
36
|
+
const done = await run(
|
|
37
|
+
() => $fetch(shiftsApi.offer(swap.id, swap.myOffer.id), { method: "DELETE" }).then(() => true),
|
|
38
|
+
{ success: t("swaps.offerWithdrawn", "Withdrew your offer"), error: t("swaps.offerWithdrawFailed", "Could not withdraw the offer") }
|
|
39
|
+
);
|
|
40
|
+
if (done) await refresh();
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div class="flex flex-col gap-4">
|
|
46
|
+
<SectionCard
|
|
47
|
+
v-if="myOpen.length"
|
|
48
|
+
:title="t('swaps.mine', 'Your shifts on offer')"
|
|
49
|
+
icon="i-lucide-megaphone"
|
|
50
|
+
flush
|
|
51
|
+
>
|
|
52
|
+
<ul class="divide-default divide-y">
|
|
53
|
+
<li
|
|
54
|
+
v-for="item in myOpen"
|
|
55
|
+
:key="item.assignment.id"
|
|
56
|
+
class="flex items-center justify-between gap-2 px-4 py-2.5"
|
|
57
|
+
>
|
|
58
|
+
<span class="text-sm">{{ tr(item.teamName) }} · {{ format.range(item.shift.startsAt, item.shift.endsAt) }}</span>
|
|
59
|
+
<UButton
|
|
60
|
+
:to="links.shift(item.assignment.id)"
|
|
61
|
+
size="sm"
|
|
62
|
+
color="neutral"
|
|
63
|
+
variant="outline"
|
|
64
|
+
:label="t('swaps.seeOffers', 'See offers')"
|
|
65
|
+
/>
|
|
66
|
+
</li>
|
|
67
|
+
</ul>
|
|
68
|
+
</SectionCard>
|
|
69
|
+
|
|
70
|
+
<div
|
|
71
|
+
v-if="loading"
|
|
72
|
+
class="flex flex-col gap-3"
|
|
73
|
+
aria-busy="true"
|
|
74
|
+
>
|
|
75
|
+
<SectionCard
|
|
76
|
+
v-for="index in 2"
|
|
77
|
+
:key="index"
|
|
78
|
+
loading
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
<UEmpty
|
|
82
|
+
v-else-if="error && error.statusCode !== 401"
|
|
83
|
+
icon="i-lucide-circle-alert"
|
|
84
|
+
:title="t('swaps.loadFailed', 'The swaps could not be loaded')"
|
|
85
|
+
:description="errorMessage(error, '')"
|
|
86
|
+
:actions="[{ label: t('tryAgain', 'Try again'), icon: 'i-lucide-rotate-ccw', color: 'neutral', variant: 'outline', onClick: () => refresh() }]"
|
|
87
|
+
/>
|
|
88
|
+
<UEmpty
|
|
89
|
+
v-else-if="!swaps.length"
|
|
90
|
+
icon="i-lucide-arrow-left-right"
|
|
91
|
+
:title="t('swaps.empty', 'No open swaps for you')"
|
|
92
|
+
:description="t('swaps.emptyDescription', 'When somebody on your team offers a shift you can take, it shows up here.')"
|
|
93
|
+
/>
|
|
94
|
+
<div
|
|
95
|
+
v-else
|
|
96
|
+
class="flex flex-col gap-3"
|
|
97
|
+
data-shifts-swaps
|
|
98
|
+
>
|
|
99
|
+
<SectionCard
|
|
100
|
+
v-for="swap in swaps"
|
|
101
|
+
:key="swap.id"
|
|
102
|
+
:title="`${tr(swap.shift.teamName)} \xB7 ${format.range(swap.shift.startsAt, swap.shift.endsAt)}`"
|
|
103
|
+
:description="t('swaps.from', 'From {name} \xB7 {schedule}', { name: swap.owner.name ?? '', schedule: tr(swap.shift.scheduleName) })"
|
|
104
|
+
>
|
|
105
|
+
<template #actions>
|
|
106
|
+
<div class="flex items-center gap-2">
|
|
107
|
+
<UBadge
|
|
108
|
+
color="neutral"
|
|
109
|
+
variant="subtle"
|
|
110
|
+
:label="swap.kind === 'trade' ? t('swapKinds.trade', 'Trade') : t('swapKinds.release', 'Give away')"
|
|
111
|
+
/>
|
|
112
|
+
<UBadge
|
|
113
|
+
v-if="swap.myOffer"
|
|
114
|
+
color="primary"
|
|
115
|
+
variant="subtle"
|
|
116
|
+
:label="t(`offerStatuses.${swap.myOffer.status}`, SHIFT_SWAP_OFFER_STATUS_LABELS[swap.myOffer.status])"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
<UAlert
|
|
121
|
+
v-if="swap.settings.coverage === 'all'"
|
|
122
|
+
class="mb-3"
|
|
123
|
+
color="info"
|
|
124
|
+
variant="subtle"
|
|
125
|
+
icon="i-lucide-info"
|
|
126
|
+
:title="t('shift.tradeOnly', 'Trade only: you must work all your shifts.')"
|
|
127
|
+
/>
|
|
128
|
+
<p
|
|
129
|
+
v-if="swap.wantedShift && !swap.myOffer"
|
|
130
|
+
class="text-muted mb-3 text-sm"
|
|
131
|
+
>
|
|
132
|
+
{{ t("swaps.wants", "Wants your shift on {team}, {when}", { team: tr(swap.wantedShift.teamName), when: format.range(swap.wantedShift.startsAt, swap.wantedShift.endsAt) }) }}
|
|
133
|
+
</p>
|
|
134
|
+
<div
|
|
135
|
+
v-if="!swap.myOffer && swap.kind === 'trade'"
|
|
136
|
+
class="flex flex-wrap items-end gap-2"
|
|
137
|
+
>
|
|
138
|
+
<UFormField
|
|
139
|
+
:label="t('swaps.giveBack', 'You give in return')"
|
|
140
|
+
:description="givingOptions(swap).length ? void 0 : t('swaps.nothingToTrade', 'You have no upcoming shift to trade.')"
|
|
141
|
+
required
|
|
142
|
+
class="min-w-64 flex-1"
|
|
143
|
+
>
|
|
144
|
+
<USelect
|
|
145
|
+
v-model="giving[swap.id]"
|
|
146
|
+
:items="givingOptions(swap)"
|
|
147
|
+
:placeholder="t('swaps.pickShift', 'Choose one of your shifts')"
|
|
148
|
+
:disabled="!givingOptions(swap).length"
|
|
149
|
+
class="w-full"
|
|
150
|
+
/>
|
|
151
|
+
</UFormField>
|
|
152
|
+
<UButton
|
|
153
|
+
:loading="busy"
|
|
154
|
+
:disabled="!giving[swap.id] && !swap.wantedAssignmentId"
|
|
155
|
+
:label="t('swaps.tradeAction', 'Offer a trade')"
|
|
156
|
+
@click="offer(swap)"
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
<div
|
|
160
|
+
v-else-if="!swap.myOffer"
|
|
161
|
+
class="flex justify-end"
|
|
162
|
+
>
|
|
163
|
+
<UButton
|
|
164
|
+
:loading="busy"
|
|
165
|
+
:label="t('swaps.offerAction', 'Take the shift over')"
|
|
166
|
+
@click="offer(swap)"
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
<div
|
|
170
|
+
v-else
|
|
171
|
+
class="flex items-center justify-between gap-2"
|
|
172
|
+
>
|
|
173
|
+
<span class="text-muted text-sm">
|
|
174
|
+
{{ swap.myOffer.offeredShift ? t("swaps.youGive", "You give {team}, {when}", { team: tr(swap.myOffer.offeredShift.teamName), when: format.range(swap.myOffer.offeredShift.startsAt, swap.myOffer.offeredShift.endsAt) }) : t("swaps.youTake", "You take the shift over") }}
|
|
175
|
+
</span>
|
|
176
|
+
<UButton
|
|
177
|
+
color="neutral"
|
|
178
|
+
variant="outline"
|
|
179
|
+
size="sm"
|
|
180
|
+
:loading="busy"
|
|
181
|
+
:label="t('swaps.withdrawOffer', 'Withdraw offer')"
|
|
182
|
+
@click="withdraw(swap)"
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
</SectionCard>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</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;
|
|
@@ -358,12 +358,6 @@
|
|
|
358
358
|
"viewExceptions": "Undtagelser ({count})",
|
|
359
359
|
"viewShifts": "Alle vagter"
|
|
360
360
|
},
|
|
361
|
-
"menu": {
|
|
362
|
-
"mine": {
|
|
363
|
-
"description": "Dine vagter, dit QR-pas og bytter.",
|
|
364
|
-
"label": "Mine vagter"
|
|
365
|
-
}
|
|
366
|
-
},
|
|
367
361
|
"mine": {
|
|
368
362
|
"description": "Dine vagter, dit check-in-pas og dine bytter.",
|
|
369
363
|
"empty": "Ingen vagter endnu",
|
|
@@ -377,7 +371,8 @@
|
|
|
377
371
|
"showAll": "Vis alle dage",
|
|
378
372
|
"showPast": "Vis {count} tidligere vagter",
|
|
379
373
|
"title": "Mine vagter",
|
|
380
|
-
"today": "I dag"
|
|
374
|
+
"today": "I dag",
|
|
375
|
+
"calendar": "Kalender"
|
|
381
376
|
},
|
|
382
377
|
"mobile": {
|
|
383
378
|
"tab": "Vagter"
|
|
@@ -621,6 +616,12 @@
|
|
|
621
616
|
"min_rest": "For lidt hvile mellem to vagter.",
|
|
622
617
|
"overlap": "Har en anden vagt på samme tid.",
|
|
623
618
|
"shift_full": "Vagten er fuld."
|
|
619
|
+
},
|
|
620
|
+
"home": {
|
|
621
|
+
"tabs": {
|
|
622
|
+
"shifts": "Mine vagter",
|
|
623
|
+
"swaps": "Bytter"
|
|
624
|
+
}
|
|
624
625
|
}
|
|
625
626
|
}
|
|
626
627
|
}
|
|
@@ -358,12 +358,6 @@
|
|
|
358
358
|
"viewExceptions": "Exceptions ({count})",
|
|
359
359
|
"viewShifts": "All shifts"
|
|
360
360
|
},
|
|
361
|
-
"menu": {
|
|
362
|
-
"mine": {
|
|
363
|
-
"description": "Your shifts, your QR pass and swaps.",
|
|
364
|
-
"label": "My shifts"
|
|
365
|
-
}
|
|
366
|
-
},
|
|
367
361
|
"mine": {
|
|
368
362
|
"description": "Your shifts, your check-in pass and your swaps.",
|
|
369
363
|
"empty": "No shifts yet",
|
|
@@ -377,7 +371,8 @@
|
|
|
377
371
|
"showAll": "Show all days",
|
|
378
372
|
"showPast": "Show {count} past shifts",
|
|
379
373
|
"title": "My shifts",
|
|
380
|
-
"today": "Today"
|
|
374
|
+
"today": "Today",
|
|
375
|
+
"calendar": "Calendar"
|
|
381
376
|
},
|
|
382
377
|
"mobile": {
|
|
383
378
|
"tab": "Shifts"
|
|
@@ -621,6 +616,12 @@
|
|
|
621
616
|
"min_rest": "Too little rest between two shifts.",
|
|
622
617
|
"overlap": "Works another shift at the same time.",
|
|
623
618
|
"shift_full": "The shift is full."
|
|
619
|
+
},
|
|
620
|
+
"home": {
|
|
621
|
+
"tabs": {
|
|
622
|
+
"shifts": "My shifts",
|
|
623
|
+
"swaps": "Swaps"
|
|
624
|
+
}
|
|
624
625
|
}
|
|
625
626
|
}
|
|
626
627
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { translate } from "../../utils/index.js";
|
|
1
|
+
import { shiftsMinePath, shiftsSwapsPath, translate } from "../../utils/index.js";
|
|
2
2
|
import { formatShiftWhen } from "../reminder-email.js";
|
|
3
3
|
import { buildShiftSwapEmail } from "../swap-email.js";
|
|
4
4
|
import { shiftsConfig, shiftsLocaleOf, shiftsUsersById } from "./shifts-core.js";
|
|
@@ -20,7 +20,7 @@ export async function shiftsSendSwapEmail(event, kind, input) {
|
|
|
20
20
|
shiftsWarnedNoOrigin = true;
|
|
21
21
|
console.warn("[shifts] no site origin is configured: swap emails go out without a link");
|
|
22
22
|
}
|
|
23
|
-
const path = kind === "pending" ? pages?.lead?.replace(":teamId", encodeURIComponent(input.teamId ?? swap.shift.teamId)) : to === swap.owner.userId && kind !== "completed" && pages?.shift ? pages.shift.replace(":assignmentId", encodeURIComponent(swap.assignmentId)) : kind === "completed" ? pages
|
|
23
|
+
const path = kind === "pending" ? pages?.lead?.replace(":teamId", encodeURIComponent(input.teamId ?? swap.shift.teamId)) : to === swap.owner.userId && kind !== "completed" && pages?.shift ? pages.shift.replace(":assignmentId", encodeURIComponent(swap.assignmentId)) : kind === "completed" ? shiftsMinePath(pages) : shiftsSwapsPath(pages);
|
|
24
24
|
const notification = buildShiftSwapEmail({
|
|
25
25
|
kind,
|
|
26
26
|
email: recipient?.email ?? null,
|
|
@@ -199,12 +199,12 @@ export declare const shiftsOfferParams: z.ZodObject<{
|
|
|
199
199
|
export declare const shiftsSwapsQuery: z.ZodObject<{
|
|
200
200
|
operationId: z.ZodOptional<z.ZodString>;
|
|
201
201
|
status: z.ZodOptional<z.ZodEnum<{
|
|
202
|
-
open: "open";
|
|
203
|
-
completed: "completed";
|
|
204
202
|
cancelled: "cancelled";
|
|
203
|
+
open: "open";
|
|
205
204
|
offered: "offered";
|
|
206
205
|
accepted: "accepted";
|
|
207
206
|
pending_approval: "pending_approval";
|
|
207
|
+
completed: "completed";
|
|
208
208
|
rejected: "rejected";
|
|
209
209
|
}>>;
|
|
210
210
|
}, z.core.$strip>;
|
|
@@ -307,12 +307,12 @@ export declare const shiftsSelfCheckInInput: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
307
307
|
/** The query of `GET /api/shifts/teams/:teamId/swaps`. */
|
|
308
308
|
export declare const shiftsTeamSwapsQuery: z.ZodObject<{
|
|
309
309
|
status: z.ZodOptional<z.ZodEnum<{
|
|
310
|
-
open: "open";
|
|
311
|
-
completed: "completed";
|
|
312
310
|
cancelled: "cancelled";
|
|
311
|
+
open: "open";
|
|
313
312
|
offered: "offered";
|
|
314
313
|
accepted: "accepted";
|
|
315
314
|
pending_approval: "pending_approval";
|
|
315
|
+
completed: "completed";
|
|
316
316
|
rejected: "rejected";
|
|
317
317
|
}>>;
|
|
318
318
|
}, z.core.$strip>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The configured page paths (`public.shifts.pages`). `home` is the crew home of `@frigear-nu/crew`, whose My shifts and
|
|
3
|
+
* Swaps tabs (`crew.dashboard`) stand in for the `shifts` and `swaps` pages when they are not there.
|
|
4
|
+
*/
|
|
2
5
|
export type ShiftsPages = {
|
|
3
6
|
shifts?: string;
|
|
4
7
|
shift?: string;
|
|
@@ -6,7 +9,17 @@ export type ShiftsPages = {
|
|
|
6
9
|
checkIn?: string;
|
|
7
10
|
lead?: string;
|
|
8
11
|
station?: string;
|
|
12
|
+
home?: string;
|
|
13
|
+
};
|
|
14
|
+
/** The ids of shifts' tabs on the crew home page (`crew.dashboard`): `?tab=shifts`, `?tab=swaps`. */
|
|
15
|
+
export declare const SHIFTS_HOME_TAB: {
|
|
16
|
+
readonly shifts: "shifts";
|
|
17
|
+
readonly swaps: "swaps";
|
|
9
18
|
};
|
|
19
|
+
/** My shifts: the page when there is one, else the My shifts tab of the crew home (`undefined`: neither). */
|
|
20
|
+
export declare const shiftsMinePath: (pages: ShiftsPages | undefined) => string | undefined;
|
|
21
|
+
/** The swaps: the page when there is one, else the Swaps tab of the crew home (`undefined`: neither). */
|
|
22
|
+
export declare const shiftsSwapsPath: (pages: ShiftsPages | undefined) => string | undefined;
|
|
10
23
|
/** The default page paths, as `true` resolves them. */
|
|
11
24
|
export declare const SHIFTS_DEFAULT_PAGES: {
|
|
12
25
|
readonly shifts: "/shifts";
|
|
@@ -18,7 +31,8 @@ export declare const SHIFTS_DEFAULT_PAGES: {
|
|
|
18
31
|
};
|
|
19
32
|
/**
|
|
20
33
|
* Builds every link to a shifts page through `localize` (the active locale's prefix, see `useLocaleLink` of
|
|
21
|
-
* `@frigear-nu/ui`).
|
|
34
|
+
* `@frigear-nu/ui`). My shifts and the swaps link to their tab of the crew home when they have no page. A page that is
|
|
35
|
+
* turned off still gets a link on its default path; callers decide from `pages`.
|
|
22
36
|
*/
|
|
23
37
|
export declare function createShiftsLinks(pages: ShiftsPages | undefined, localize: (path: string) => string): {
|
|
24
38
|
shifts: () => string;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export const SHIFTS_HOME_TAB = { shifts: "shifts", swaps: "swaps" };
|
|
2
|
+
export const shiftsMinePath = (pages) => pages?.shifts || (pages?.home ? `${pages.home}?tab=${SHIFTS_HOME_TAB.shifts}` : void 0);
|
|
3
|
+
export const shiftsSwapsPath = (pages) => pages?.swaps || (pages?.home ? `${pages.home}?tab=${SHIFTS_HOME_TAB.swaps}` : void 0);
|
|
1
4
|
export const SHIFTS_DEFAULT_PAGES = {
|
|
2
5
|
shifts: "/shifts",
|
|
3
6
|
shift: "/shifts/:assignmentId",
|
|
@@ -8,9 +11,9 @@ export const SHIFTS_DEFAULT_PAGES = {
|
|
|
8
11
|
};
|
|
9
12
|
export function createShiftsLinks(pages, localize) {
|
|
10
13
|
return {
|
|
11
|
-
shifts: () => localize(pages
|
|
14
|
+
shifts: () => localize(shiftsMinePath(pages) || SHIFTS_DEFAULT_PAGES.shifts),
|
|
12
15
|
shift: (assignmentId) => localize((pages?.shift || SHIFTS_DEFAULT_PAGES.shift).replace(":assignmentId", encodeURIComponent(assignmentId))),
|
|
13
|
-
swaps: () => localize(pages
|
|
16
|
+
swaps: () => localize(shiftsSwapsPath(pages) || SHIFTS_DEFAULT_PAGES.swaps),
|
|
14
17
|
checkIn: (teamId) => localize((pages?.checkIn || SHIFTS_DEFAULT_PAGES.checkIn).replace(":teamId", encodeURIComponent(teamId))),
|
|
15
18
|
lead: (teamId) => localize((pages?.lead || SHIFTS_DEFAULT_PAGES.lead).replace(":teamId", encodeURIComponent(teamId))),
|
|
16
19
|
station: (stationId) => localize((pages?.station || SHIFTS_DEFAULT_PAGES.station).replace(":stationId", encodeURIComponent(stationId)))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/shifts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Shifts for the frigear ecosystem: schedules, shift roles, assignment, swaps, QR check-in and who is on shift now, per operation, built on crew and teams.",
|
|
5
5
|
"homepage": "https://docs.frigear.dev/modules/volunteering/shifts",
|
|
6
6
|
"repository": {
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@frigear-nu/auth": "^0.6.4",
|
|
39
|
-
"@frigear-nu/crew": "^0.
|
|
40
|
-
"@frigear-nu/maps": "^0.0.
|
|
41
|
-
"@frigear-nu/module-kit": "^1.3.
|
|
39
|
+
"@frigear-nu/crew": "^0.1.0",
|
|
40
|
+
"@frigear-nu/maps": "^0.0.1",
|
|
41
|
+
"@frigear-nu/module-kit": "^1.3.8",
|
|
42
42
|
"@frigear-nu/notify": "^0.2.6",
|
|
43
|
-
"@frigear-nu/operations": "^0.
|
|
44
|
-
"@frigear-nu/teams": "^0.
|
|
45
|
-
"@frigear-nu/ui": "^0.2.
|
|
43
|
+
"@frigear-nu/operations": "^0.1.0",
|
|
44
|
+
"@frigear-nu/teams": "^0.1.0",
|
|
45
|
+
"@frigear-nu/ui": "^0.2.8",
|
|
46
46
|
"@frigear-nu/users": "^3.1.2",
|
|
47
47
|
"@libsql/client": "^0.18.0",
|
|
48
48
|
"@nuxt/kit": "^4.6.4",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"zod": "^4.6.7"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@frigear-nu/admin": "^0.5.
|
|
59
|
-
"@frigear-nu/dashboard": "^0.
|
|
60
|
-
"@frigear-nu/email-templates": "^0.1.
|
|
58
|
+
"@frigear-nu/admin": "^0.5.1",
|
|
59
|
+
"@frigear-nu/dashboard": "^0.1.0",
|
|
60
|
+
"@frigear-nu/email-templates": "^0.1.2",
|
|
61
61
|
"@frigear-nu/menu": "^0.4.0",
|
|
62
62
|
"@frigear-nu/mobile": "^0.6.2",
|
|
63
|
-
"@frigear-nu/widget": "^0.4.
|
|
63
|
+
"@frigear-nu/widget": "^0.4.1",
|
|
64
64
|
"@nuxt/ui": "^4.12.0",
|
|
65
65
|
"@nuxthub/core": "^0.10.12"
|
|
66
66
|
},
|
|
@@ -88,15 +88,15 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
-
"@frigear-nu/admin": "^0.5.
|
|
92
|
-
"@frigear-nu/dashboard": "^0.
|
|
93
|
-
"@frigear-nu/email-templates": "^0.1.
|
|
94
|
-
"@frigear-nu/forms": "^0.5.
|
|
91
|
+
"@frigear-nu/admin": "^0.5.1",
|
|
92
|
+
"@frigear-nu/dashboard": "^0.1.0",
|
|
93
|
+
"@frigear-nu/email-templates": "^0.1.2",
|
|
94
|
+
"@frigear-nu/forms": "^0.5.1",
|
|
95
95
|
"@frigear-nu/menu": "^0.4.0",
|
|
96
96
|
"@frigear-nu/mobile": "^0.6.2",
|
|
97
|
-
"@frigear-nu/preferences": "^0.3.
|
|
97
|
+
"@frigear-nu/preferences": "^0.3.2",
|
|
98
98
|
"@frigear-nu/push": "^0.1.0",
|
|
99
|
-
"@frigear-nu/widget": "^0.4.
|
|
99
|
+
"@frigear-nu/widget": "^0.4.1",
|
|
100
100
|
"@nuxt/devtools": "^4.2.0",
|
|
101
101
|
"@nuxt/eslint-config": "^1.17.0",
|
|
102
102
|
"@nuxt/module-builder": "^1.0.4",
|
package/dist/runtime/menus.d.ts
DELETED
package/dist/runtime/menus.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineMenuItem, defineMenuSource, extendMenuItem } from "@frigear-nu/menu/utils";
|
|
2
|
-
import { useRuntimeConfig } from "#imports";
|
|
3
|
-
export default defineMenuSource(() => {
|
|
4
|
-
const config = useRuntimeConfig().public.shifts;
|
|
5
|
-
if (config?.pages?.shifts) {
|
|
6
|
-
extendMenuItem("account", defineMenuItem({
|
|
7
|
-
id: "shifts-mine",
|
|
8
|
-
label: "My shifts",
|
|
9
|
-
labelKey: "shifts.menu.mine.label",
|
|
10
|
-
description: "Your shifts, your QR pass and swaps.",
|
|
11
|
-
descriptionKey: "shifts.menu.mine.description",
|
|
12
|
-
icon: "i-lucide-calendar-clock",
|
|
13
|
-
to: config.pages.shifts,
|
|
14
|
-
order: 43
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
});
|