@thekestongroup/ui 0.2.1 → 0.4.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/README.md +98 -31
- package/dist/components/Age/Age.vue.d.ts +19 -0
- package/dist/components/AppShell/AppShell.vue.d.ts +108 -0
- package/dist/components/Avatar/Avatar.vue.d.ts +34 -0
- package/dist/components/AvatarGroup/AvatarGroup.vue.d.ts +25 -0
- package/dist/components/Badge/Badge.vue.d.ts +41 -0
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +39 -0
- package/dist/components/Button/Button.vue.d.ts +69 -0
- package/dist/components/Calendar/Calendar.vue.d.ts +34 -0
- package/dist/components/Card/Card.vue.d.ts +56 -0
- package/dist/components/Checkbox/Checkbox.vue.d.ts +40 -0
- package/dist/components/Checklist/Checklist.vue.d.ts +18 -0
- package/dist/components/Chip/Chip.vue.d.ts +44 -0
- package/dist/components/Divider/Divider.vue.d.ts +36 -0
- package/dist/components/EmptyState/EmptyState.vue.d.ts +55 -0
- package/dist/components/{ToastItem.vue.d.ts → FormField/FieldMessage.vue.d.ts} +10 -2
- package/dist/components/FormField/FormField.vue.d.ts +61 -0
- package/dist/components/Header/Header.vue.d.ts +104 -0
- package/dist/components/InfoTip/InfoTip.vue.d.ts +20 -0
- package/dist/components/Input/Input.vue.d.ts +56 -0
- package/dist/components/InputCode/InputCode.vue.d.ts +53 -0
- package/dist/components/InputDate/InputDate.vue.d.ts +49 -0
- package/dist/components/InputNumber/InputNumber.vue.d.ts +44 -0
- package/dist/components/InputPassword/InputPassword.vue.d.ts +51 -0
- package/dist/components/InputRichText/InputRichText.vue.d.ts +44 -0
- package/dist/components/Link/Link.vue.d.ts +39 -0
- package/dist/components/Notification/Notification.vue.d.ts +62 -0
- package/dist/components/Notification/NotificationPane.vue.d.ts +38 -0
- package/dist/components/Notification/Toaster.vue.d.ts +51 -0
- package/dist/components/Notification/notification.samples.d.ts +3 -0
- package/dist/components/Notification/notifications.d.ts +115 -0
- package/dist/components/PageHeader/PageHeader.vue.d.ts +43 -0
- package/dist/components/Popover/Popover.vue.d.ts +83 -0
- package/dist/components/Popover/popover.d.ts +16 -0
- package/dist/components/Progress/Progress.vue.d.ts +26 -0
- package/dist/components/RadioGroup/RadioGroup.vue.d.ts +45 -0
- package/dist/components/RelativeTime/RelativeTime.vue.d.ts +22 -0
- package/dist/components/Select/Select.vue.d.ts +110 -0
- package/dist/components/Sidebar/Sidebar.vue.d.ts +106 -0
- package/dist/components/Sidebar/sidebar.d.ts +10 -0
- package/dist/components/Slideover/Slideover.vue.d.ts +125 -0
- package/dist/components/Spinner/Spinner.vue.d.ts +30 -0
- package/dist/components/StatTile/StatTile.vue.d.ts +46 -0
- package/dist/components/SummaryList/SummaryList.vue.d.ts +62 -0
- package/dist/components/Switch/Switch.vue.d.ts +39 -0
- package/dist/components/Table/Table.vue.d.ts +82 -0
- package/dist/components/Table/table.d.ts +36 -0
- package/dist/components/Tooltip/Tooltip.vue.d.ts +46 -0
- package/dist/index.d.ts +91 -25
- package/dist/keston-ui.js +5030 -14786
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/dates.d.ts +27 -0
- package/dist/lib/initials.d.ts +2 -0
- package/dist/lib/parseDate.d.ts +44 -0
- package/dist/lib/useNow.d.ts +3 -0
- package/package.json +57 -24
- package/src/components/.gitkeep +0 -0
- package/src/components/Age/Age.stories.ts +24 -0
- package/src/components/Age/Age.vue +56 -0
- package/src/components/AppShell/AppShell.stories.ts +124 -0
- package/src/components/AppShell/AppShell.vue +221 -0
- package/src/components/Avatar/Avatar.stories.ts +56 -0
- package/src/components/Avatar/Avatar.vue +118 -0
- package/src/components/AvatarGroup/AvatarGroup.stories.ts +47 -0
- package/src/components/AvatarGroup/AvatarGroup.vue +97 -0
- package/src/components/Badge/Badge.stories.ts +92 -0
- package/src/components/Badge/Badge.vue +67 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.ts +58 -0
- package/src/components/Breadcrumb/Breadcrumb.vue +109 -0
- package/src/components/Button/Button.mdx +79 -0
- package/src/components/Button/Button.stories.ts +207 -0
- package/src/components/Button/Button.vue +266 -0
- package/src/components/Calendar/Calendar.stories.ts +51 -0
- package/src/components/Calendar/Calendar.vue +364 -0
- package/src/components/Card/Card.stories.ts +109 -0
- package/src/components/Card/Card.vue +115 -0
- package/src/components/Checkbox/Checkbox.stories.ts +102 -0
- package/src/components/Checkbox/Checkbox.vue +102 -0
- package/src/components/Checklist/Checklist.stories.ts +67 -0
- package/src/components/Checklist/Checklist.vue +38 -0
- package/src/components/Chip/Chip.stories.ts +71 -0
- package/src/components/Chip/Chip.vue +86 -0
- package/src/components/Divider/Divider.stories.ts +57 -0
- package/src/components/Divider/Divider.vue +58 -0
- package/src/components/EmptyState/EmptyState.stories.ts +99 -0
- package/src/components/EmptyState/EmptyState.vue +87 -0
- package/src/components/FormField/FieldMessage.vue +81 -0
- package/src/components/FormField/FormField.stories.ts +55 -0
- package/src/components/FormField/FormField.vue +160 -0
- package/src/components/Header/Header.stories.ts +168 -0
- package/src/components/Header/Header.vue +232 -0
- package/src/components/InfoTip/InfoTip.stories.ts +63 -0
- package/src/components/InfoTip/InfoTip.vue +50 -0
- package/src/components/Input/Input.stories.ts +206 -0
- package/src/components/Input/Input.vue +90 -0
- package/src/components/InputCode/InputCode.stories.ts +85 -0
- package/src/components/InputCode/InputCode.vue +145 -0
- package/src/components/InputDate/InputDate.stories.ts +58 -0
- package/src/components/InputDate/InputDate.vue +258 -0
- package/src/components/InputNumber/InputNumber.stories.ts +63 -0
- package/src/components/InputNumber/InputNumber.vue +109 -0
- package/src/components/InputPassword/InputPassword.stories.ts +105 -0
- package/src/components/InputPassword/InputPassword.vue +132 -0
- package/src/components/InputRichText/InputRichText.stories.ts +100 -0
- package/src/components/InputRichText/InputRichText.vue +194 -0
- package/src/components/Link/Link.stories.ts +73 -0
- package/src/components/Link/Link.vue +56 -0
- package/src/components/Notification/Notification.stories.ts +196 -0
- package/src/components/Notification/Notification.vue +136 -0
- package/src/components/Notification/NotificationPane.vue +186 -0
- package/src/components/Notification/Toaster.vue +446 -0
- package/src/components/Notification/notification.samples.ts +45 -0
- package/src/components/Notification/notifications.test.ts +99 -0
- package/src/components/Notification/notifications.ts +172 -0
- package/src/components/PageHeader/PageHeader.stories.ts +79 -0
- package/src/components/PageHeader/PageHeader.vue +66 -0
- package/src/components/Popover/Popover.stories.ts +135 -0
- package/src/components/Popover/Popover.vue +192 -0
- package/src/components/Popover/popover.ts +20 -0
- package/src/components/Progress/Progress.stories.ts +74 -0
- package/src/components/Progress/Progress.vue +75 -0
- package/src/components/RadioGroup/RadioGroup.stories.ts +90 -0
- package/src/components/RadioGroup/RadioGroup.vue +132 -0
- package/src/components/RelativeTime/RelativeTime.stories.ts +74 -0
- package/src/components/RelativeTime/RelativeTime.vue +51 -0
- package/src/components/Select/Select.mdx +202 -0
- package/src/components/Select/Select.stories.ts +223 -0
- package/src/components/Select/Select.vue +630 -0
- package/src/components/Sidebar/Sidebar.stories.ts +192 -0
- package/src/components/Sidebar/Sidebar.vue +382 -0
- package/src/components/Sidebar/sidebar.ts +20 -0
- package/src/components/Slideover/Slideover.stories.ts +225 -0
- package/src/components/Slideover/Slideover.vue +365 -0
- package/src/components/Spinner/Spinner.stories.ts +79 -0
- package/src/components/Spinner/Spinner.vue +97 -0
- package/src/components/StatTile/StatTile.stories.ts +75 -0
- package/src/components/StatTile/StatTile.vue +89 -0
- package/src/components/SummaryList/SummaryList.stories.ts +103 -0
- package/src/components/SummaryList/SummaryList.vue +127 -0
- package/src/components/Switch/Switch.stories.ts +100 -0
- package/src/components/Switch/Switch.vue +96 -0
- package/src/components/Table/Table.stories.ts +212 -0
- package/src/components/Table/Table.vue +223 -0
- package/src/components/Table/table.test.ts +65 -0
- package/src/components/Table/table.ts +70 -0
- package/src/components/Tooltip/Tooltip.stories.ts +57 -0
- package/src/components/Tooltip/Tooltip.vue +86 -0
- package/src/examples/AppPages.stories.ts +500 -0
- package/src/examples/FormLayout.stories.ts +185 -0
- package/src/examples/KestonIdPages.stories.ts +415 -0
- package/src/examples/SchoolPages.stories.ts +665 -0
- package/src/index.ts +116 -36
- package/src/lib/cn.ts +4 -0
- package/src/lib/dates.test.ts +68 -0
- package/src/lib/dates.ts +86 -0
- package/src/lib/initials.ts +8 -0
- package/src/lib/parseDate.test.ts +331 -0
- package/src/lib/parseDate.ts +561 -0
- package/src/lib/useNow.ts +20 -0
- package/src/styles/theme.css +101 -0
- package/dist/components/AppLauncher.vue.d.ts +0 -10
- package/dist/components/Avatar.vue.d.ts +0 -16
- package/dist/components/Button.vue.d.ts +0 -27
- package/dist/components/Checkbox.vue.d.ts +0 -18
- package/dist/components/CloseButton.vue.d.ts +0 -6
- package/dist/components/Dialog.vue.d.ts +0 -23
- package/dist/components/Drawer.vue.d.ts +0 -34
- package/dist/components/DropdownMenu.vue.d.ts +0 -21
- package/dist/components/DropdownMenuItem.vue.d.ts +0 -19
- package/dist/components/DropdownMenuSeparator.vue.d.ts +0 -6
- package/dist/components/Input.vue.d.ts +0 -14
- package/dist/components/Label.vue.d.ts +0 -16
- package/dist/components/NotificationsMenu.vue.d.ts +0 -3
- package/dist/components/Popover.vue.d.ts +0 -23
- package/dist/components/ProfileSwitcher.vue.d.ts +0 -24
- package/dist/components/Select.vue.d.ts +0 -28
- package/dist/components/Separator.vue.d.ts +0 -11
- package/dist/components/ToastRenderer.vue.d.ts +0 -3
- package/dist/components/Toaster.vue.d.ts +0 -3
- package/dist/components/Tooltip.vue.d.ts +0 -23
- package/dist/components/TopBar.vue.d.ts +0 -34
- package/dist/favicon-old.svg +0 -1
- package/dist/favicon.svg +0 -1
- package/dist/keston-ui.cjs +0 -15
- package/dist/lib/toast.d.ts +0 -29
- package/dist/lib/types.d.ts +0 -5
- package/src/components/AppLauncher.vue +0 -63
- package/src/components/Avatar.vue +0 -51
- package/src/components/Button.vue +0 -54
- package/src/components/Checkbox.vue +0 -47
- package/src/components/CloseButton.vue +0 -24
- package/src/components/Dialog.vue +0 -65
- package/src/components/Drawer.vue +0 -202
- package/src/components/DropdownMenu.vue +0 -41
- package/src/components/DropdownMenuItem.vue +0 -28
- package/src/components/DropdownMenuSeparator.vue +0 -12
- package/src/components/Input.vue +0 -21
- package/src/components/Label.vue +0 -15
- package/src/components/NotificationsMenu.vue +0 -115
- package/src/components/Popover.vue +0 -46
- package/src/components/ProfileSwitcher.vue +0 -113
- package/src/components/Select.vue +0 -97
- package/src/components/Separator.vue +0 -30
- package/src/components/ToastItem.vue +0 -158
- package/src/components/ToastRenderer.vue +0 -113
- package/src/components/Toaster.vue +0 -11
- package/src/components/Tooltip.vue +0 -48
- package/src/components/TopBar.vue +0 -52
- package/src/lib/toast.ts +0 -95
- package/src/lib/types.ts +0 -5
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
+
import {
|
|
3
|
+
CalendarDays,
|
|
4
|
+
ClipboardCheck,
|
|
5
|
+
FileText,
|
|
6
|
+
Inbox,
|
|
7
|
+
LayoutDashboard,
|
|
8
|
+
Mail,
|
|
9
|
+
Pencil,
|
|
10
|
+
Phone,
|
|
11
|
+
Settings,
|
|
12
|
+
Users,
|
|
13
|
+
} from "@lucide/vue";
|
|
14
|
+
import { computed, reactive, ref, watch } from "vue";
|
|
15
|
+
import Age from "../components/Age/Age.vue";
|
|
16
|
+
import AppShell from "../components/AppShell/AppShell.vue";
|
|
17
|
+
import Avatar from "../components/Avatar/Avatar.vue";
|
|
18
|
+
import Badge, { type BadgeProps } from "../components/Badge/Badge.vue";
|
|
19
|
+
import Button, { type ButtonStatus } from "../components/Button/Button.vue";
|
|
20
|
+
import Calendar from "../components/Calendar/Calendar.vue";
|
|
21
|
+
import Card from "../components/Card/Card.vue";
|
|
22
|
+
import Checkbox from "../components/Checkbox/Checkbox.vue";
|
|
23
|
+
import Checklist from "../components/Checklist/Checklist.vue";
|
|
24
|
+
import Divider from "../components/Divider/Divider.vue";
|
|
25
|
+
import InfoTip from "../components/InfoTip/InfoTip.vue";
|
|
26
|
+
import InputRichText, { type InputRichTextProps } from "../components/InputRichText/InputRichText.vue";
|
|
27
|
+
import NotificationPane from "../components/Notification/NotificationPane.vue";
|
|
28
|
+
import Toaster from "../components/Notification/Toaster.vue";
|
|
29
|
+
import { createNotifications } from "../components/Notification/notifications";
|
|
30
|
+
import { sampleNotifications } from "../components/Notification/notification.samples";
|
|
31
|
+
import PageHeader from "../components/PageHeader/PageHeader.vue";
|
|
32
|
+
import RadioGroup from "../components/RadioGroup/RadioGroup.vue";
|
|
33
|
+
import RelativeTime from "../components/RelativeTime/RelativeTime.vue";
|
|
34
|
+
import Select from "../components/Select/Select.vue";
|
|
35
|
+
import Slideover from "../components/Slideover/Slideover.vue";
|
|
36
|
+
import StatTile from "../components/StatTile/StatTile.vue";
|
|
37
|
+
import SummaryList from "../components/SummaryList/SummaryList.vue";
|
|
38
|
+
import Switch, { type SwitchProps } from "../components/Switch/Switch.vue";
|
|
39
|
+
import Table from "../components/Table/Table.vue";
|
|
40
|
+
import type { TableColumn } from "../components/Table/table";
|
|
41
|
+
import type { SidebarSection } from "../components/Sidebar/Sidebar.vue";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* More whole pages, each built only from library components: a student's
|
|
45
|
+
* record, reviewing an application, booking an interview, and notification
|
|
46
|
+
* settings. Not part of the library itself.
|
|
47
|
+
*/
|
|
48
|
+
const meta = {
|
|
49
|
+
title: "Examples/School pages",
|
|
50
|
+
parameters: { layout: "fullscreen" },
|
|
51
|
+
} satisfies Meta;
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
const user = { name: "Ben Smith", email: "ben.smith@keston.school", organisation: "The Keston School" };
|
|
57
|
+
|
|
58
|
+
const shared = {
|
|
59
|
+
AppShell,
|
|
60
|
+
NotificationPane,
|
|
61
|
+
Toaster,
|
|
62
|
+
PageHeader,
|
|
63
|
+
Button,
|
|
64
|
+
Card,
|
|
65
|
+
Badge,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const bell = `<template #header-trailing><NotificationPane :notifications="notifications" /></template>`;
|
|
69
|
+
const toaster = `<Toaster :notifications="notifications" />`;
|
|
70
|
+
|
|
71
|
+
/** The sidebar with one page marked as current. */
|
|
72
|
+
function sidebar(sections: SidebarSection[], current: string): SidebarSection[] {
|
|
73
|
+
return sections.map((section) => ({
|
|
74
|
+
...section,
|
|
75
|
+
items: section.items.map((item) => ({ ...item, active: item.label === current })),
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const studentsSidebar: SidebarSection[] = [
|
|
80
|
+
{
|
|
81
|
+
items: [
|
|
82
|
+
{ label: "Home", icon: LayoutDashboard },
|
|
83
|
+
{ label: "Students", icon: Users },
|
|
84
|
+
{ label: "Attendance", icon: ClipboardCheck },
|
|
85
|
+
{ label: "Documents", icon: FileText },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{ label: "Admin", items: [{ label: "Settings", icon: Settings }] },
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const admissionsSidebar: SidebarSection[] = [
|
|
92
|
+
{
|
|
93
|
+
items: [
|
|
94
|
+
{ label: "Dashboard", icon: LayoutDashboard },
|
|
95
|
+
{ label: "Applications", icon: Inbox, badge: 12 },
|
|
96
|
+
{ label: "Interviews", icon: CalendarDays },
|
|
97
|
+
{ label: "Offers", icon: ClipboardCheck },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{ label: "Admin", items: [{ label: "Settings", icon: Settings }] },
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
// Fixed "now", so relative times read the same every time the story opens.
|
|
104
|
+
const now = new Date(2026, 10, 11, 14, 30);
|
|
105
|
+
const hoursAgo = (h: number) => new Date(now.getTime() - h * 3_600_000);
|
|
106
|
+
|
|
107
|
+
// ── Student record ──────────────────────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* One student's record: who they are, how they're doing, who to contact,
|
|
111
|
+
* and staff notes that save as you type. The page header carries the
|
|
112
|
+
* student's photo (initials here), year and house; the rest is Cards on a
|
|
113
|
+
* two-column grid that stacks on narrow screens.
|
|
114
|
+
*/
|
|
115
|
+
export const StudentRecord: Story = {
|
|
116
|
+
render: () => ({
|
|
117
|
+
components: { ...shared, Age, Avatar, Divider, InfoTip, InputRichText, RelativeTime, StatTile, SummaryList, Mail, Pencil, Phone },
|
|
118
|
+
setup() {
|
|
119
|
+
const notifications = createNotifications(sampleNotifications());
|
|
120
|
+
const student = { name: "Ada Okafor", role: "Year 9 · Hawking House" };
|
|
121
|
+
|
|
122
|
+
const details = [
|
|
123
|
+
{ label: "Date of birth", value: "26 January 2012" },
|
|
124
|
+
{ label: "Tutor group", value: "9H2 · Mr Patel" },
|
|
125
|
+
{ label: "House", value: "Hawking" },
|
|
126
|
+
{ label: "Student ID", value: "KS-20491" },
|
|
127
|
+
{ label: "Free school meals", value: "Yes", description: "Eligible since September 2024" },
|
|
128
|
+
{ label: "Medical", value: "Nut allergy", description: "Carries an adrenaline pen" },
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
const contacts = [
|
|
132
|
+
{ name: "Grace Okafor", relation: "Mother · lives with Ada", phone: "07700 900184", email: "grace.okafor@example.com", primary: true },
|
|
133
|
+
{ name: "Daniel Okafor", relation: "Father", phone: "07700 900662", email: "d.okafor@example.com", primary: false },
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
const activity = [
|
|
137
|
+
{ text: "Merit for science homework", by: "Ms Hughes", at: hoursAgo(3) },
|
|
138
|
+
{ text: "Late to registration (bus)", by: "Mr Patel", at: hoursAgo(27) },
|
|
139
|
+
{ text: "Medical form updated", by: "Grace Okafor", at: hoursAgo(75) },
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
// Notes save a moment after typing stops.
|
|
143
|
+
const notes = ref(
|
|
144
|
+
"<p>Settled in well after moving from Riverside. <strong>Nut allergy</strong>: kitchen and trip leaders told.</p><p>Mum prefers calls after 3pm, <em>not</em> on Fridays.</p>",
|
|
145
|
+
);
|
|
146
|
+
const notesStatus = ref<InputRichTextProps["status"]>();
|
|
147
|
+
const notesText = ref<string>();
|
|
148
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
149
|
+
watch(notes, () => {
|
|
150
|
+
clearTimeout(timer);
|
|
151
|
+
notesStatus.value = "loading";
|
|
152
|
+
notesText.value = "Saving…";
|
|
153
|
+
timer = setTimeout(() => {
|
|
154
|
+
notesStatus.value = "success";
|
|
155
|
+
notesText.value = "Saved";
|
|
156
|
+
}, 900);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
nav: sidebar(studentsSidebar, "Students"),
|
|
161
|
+
user,
|
|
162
|
+
notifications,
|
|
163
|
+
student,
|
|
164
|
+
details,
|
|
165
|
+
contacts,
|
|
166
|
+
activity,
|
|
167
|
+
notes,
|
|
168
|
+
notesStatus,
|
|
169
|
+
notesText,
|
|
170
|
+
now,
|
|
171
|
+
trail: [{ label: "Students", href: "#" }, { label: "Year 9", href: "#" }, { label: "Ada Okafor" }],
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
template: `
|
|
175
|
+
<AppShell title="Keston Students" :sections="nav" :user="user">
|
|
176
|
+
${bell}
|
|
177
|
+
<div class="flex flex-col gap-6 p-4 sm:p-6">
|
|
178
|
+
<PageHeader :title="student.name" :breadcrumb="trail">
|
|
179
|
+
<template #badge>
|
|
180
|
+
<Badge color="blue">Year 9</Badge>
|
|
181
|
+
</template>
|
|
182
|
+
<template #description>
|
|
183
|
+
<span class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
|
184
|
+
<span>Hawking House</span>
|
|
185
|
+
<span aria-hidden="true">·</span>
|
|
186
|
+
<span>Age <Age birth-date="2012-01-26" :now="now" /></span>
|
|
187
|
+
</span>
|
|
188
|
+
</template>
|
|
189
|
+
<template #actions>
|
|
190
|
+
<Button><template #leading><Mail /></template>Email family</Button>
|
|
191
|
+
<Button variant="primary"><template #leading><Pencil /></template>Edit details</Button>
|
|
192
|
+
</template>
|
|
193
|
+
</PageHeader>
|
|
194
|
+
|
|
195
|
+
<div class="@container">
|
|
196
|
+
<div class="grid grid-cols-1 items-start gap-6 @4xl:grid-cols-[minmax(0,1fr)_20rem]">
|
|
197
|
+
<div class="flex flex-col gap-6">
|
|
198
|
+
<!-- This term at a glance -->
|
|
199
|
+
<div class="grid grid-cols-1 gap-4 @lg:grid-cols-3">
|
|
200
|
+
<StatTile label="Attendance" value="96.4%" change="+1.2%" change-label="on last term" trend="up">
|
|
201
|
+
<template #footer>
|
|
202
|
+
<span class="flex items-center gap-1 text-xs text-black/65">
|
|
203
|
+
This term
|
|
204
|
+
<InfoTip label="About attendance" text="Sessions attended as a share of possible sessions. Authorised absences count against it." />
|
|
205
|
+
</span>
|
|
206
|
+
</template>
|
|
207
|
+
</StatTile>
|
|
208
|
+
<StatTile label="Merits" value="14" change="+3" change-label="this week" trend="up" />
|
|
209
|
+
<StatTile label="Late marks" value="2" trend="flat" />
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<Card title="Details">
|
|
213
|
+
<SummaryList :items="details" />
|
|
214
|
+
</Card>
|
|
215
|
+
|
|
216
|
+
<Card title="Staff notes" description="Seen by staff only, not by the family.">
|
|
217
|
+
<InputRichText
|
|
218
|
+
v-model="notes"
|
|
219
|
+
label="Notes on Ada Okafor"
|
|
220
|
+
:status="notesStatus"
|
|
221
|
+
:status-text="notesText"
|
|
222
|
+
placeholder="Add a note…"
|
|
223
|
+
/>
|
|
224
|
+
</Card>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<div class="flex flex-col gap-6">
|
|
228
|
+
<Card title="Contacts" padding="sm">
|
|
229
|
+
<template v-for="(contact, i) in contacts" :key="contact.name">
|
|
230
|
+
<Divider v-if="i > 0" />
|
|
231
|
+
<div class="flex flex-col gap-2">
|
|
232
|
+
<div class="flex items-center gap-2">
|
|
233
|
+
<Avatar :user="{ name: contact.name }" size="sm" decorative />
|
|
234
|
+
<div class="flex min-w-0 flex-col">
|
|
235
|
+
<span class="flex items-center gap-2 text-sm font-bold">
|
|
236
|
+
{{ contact.name }}
|
|
237
|
+
<Badge v-if="contact.primary" size="sm">Primary</Badge>
|
|
238
|
+
</span>
|
|
239
|
+
<span class="text-xs text-black/65">{{ contact.relation }}</span>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
<div class="flex flex-wrap gap-2">
|
|
243
|
+
<Button size="sm"><template #leading><Phone /></template>{{ contact.phone }}</Button>
|
|
244
|
+
<Button size="sm"><template #leading><Mail /></template>Email</Button>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</template>
|
|
248
|
+
</Card>
|
|
249
|
+
|
|
250
|
+
<Card title="Recent activity" padding="sm">
|
|
251
|
+
<ul class="flex flex-col gap-3 text-sm">
|
|
252
|
+
<li v-for="item in activity" :key="item.text" class="flex flex-col gap-0.5">
|
|
253
|
+
<span>{{ item.text }}</span>
|
|
254
|
+
<span class="text-xs text-black/65">{{ item.by }} · <RelativeTime :date="item.at" :now="now" /></span>
|
|
255
|
+
</li>
|
|
256
|
+
</ul>
|
|
257
|
+
</Card>
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
</AppShell>
|
|
263
|
+
${toaster}`,
|
|
264
|
+
}),
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// ── Application review ──────────────────────────────────────────────────────
|
|
268
|
+
|
|
269
|
+
type Status = "New" | "Awaiting documents" | "Interview" | "Offered" | "Declined";
|
|
270
|
+
const statusColour: Record<Status, BadgeProps["color"]> = {
|
|
271
|
+
New: "blue",
|
|
272
|
+
"Awaiting documents": "yellow",
|
|
273
|
+
Interview: "blue",
|
|
274
|
+
Offered: "green",
|
|
275
|
+
Declined: "basic",
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
interface Application {
|
|
279
|
+
id: string;
|
|
280
|
+
name: string;
|
|
281
|
+
entry: string;
|
|
282
|
+
submitted: Date;
|
|
283
|
+
status: Status;
|
|
284
|
+
documents: { address: boolean; report: boolean; medical: boolean };
|
|
285
|
+
sibling: boolean;
|
|
286
|
+
currentSchool: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Working through applications: a sortable Table, and "Review" opens a
|
|
291
|
+
* Slideover with the application, which documents are in, a decision, and
|
|
292
|
+
* notes. Recording a decision updates the row and confirms with a toast.
|
|
293
|
+
*/
|
|
294
|
+
export const ApplicationReview: Story = {
|
|
295
|
+
render: () => ({
|
|
296
|
+
components: { ...shared, Checkbox, Checklist, InputRichText, RadioGroup, RelativeTime, Slideover, StatTile, SummaryList, Table },
|
|
297
|
+
setup() {
|
|
298
|
+
const notifications = createNotifications(sampleNotifications());
|
|
299
|
+
const application = (
|
|
300
|
+
id: string, name: string, entry: string, hours: number, status: Status,
|
|
301
|
+
documents: Application["documents"], sibling: boolean, currentSchool: string,
|
|
302
|
+
): Application => ({ id, name, entry, submitted: hoursAgo(hours), status, documents, sibling, currentSchool });
|
|
303
|
+
|
|
304
|
+
const all = { address: true, report: true, medical: true };
|
|
305
|
+
const applications = reactive<Application[]>([
|
|
306
|
+
application("A-1042", "Ethan Clarke", "Year 7, Sept 2027", 2, "New", all, true, "St Mary's Primary"),
|
|
307
|
+
application("A-1041", "Maya Patel", "Year 7, Sept 2027", 20, "Awaiting documents", { address: true, report: false, medical: false }, false, "Riverside Primary"),
|
|
308
|
+
application("A-1039", "Noah Wilson", "Year 12, Sept 2027", 50, "Interview", all, false, "Northfield Academy"),
|
|
309
|
+
application("A-1036", "Isla Hughes", "Year 7, Sept 2027", 96, "Offered", all, true, "Oak Lane Primary"),
|
|
310
|
+
application("A-1031", "Leo Thompson", "Year 9, Jan 2027", 170, "Declined", { address: true, report: true, medical: false }, false, "Home educated"),
|
|
311
|
+
application("A-1030", "Zara Ahmed", "Year 7, Sept 2027", 190, "New", { address: true, report: true, medical: false }, false, "St Mary's Primary"),
|
|
312
|
+
]);
|
|
313
|
+
|
|
314
|
+
const columns: TableColumn<Application>[] = [
|
|
315
|
+
{ key: "name", label: "Applicant", rowHeader: true, sortable: true },
|
|
316
|
+
{ key: "entry", label: "Entry", sortable: true },
|
|
317
|
+
{ key: "submitted", label: "Submitted", sortable: true, sortValue: (row) => row.submitted.getTime() },
|
|
318
|
+
{ key: "status", label: "Status", sortable: true },
|
|
319
|
+
{ key: "review", label: "Review", hideLabel: true, align: "end" },
|
|
320
|
+
];
|
|
321
|
+
const sort = ref({ key: "submitted", direction: "desc" as const });
|
|
322
|
+
|
|
323
|
+
const count = (status: Status) => applications.filter((a) => a.status === status).length;
|
|
324
|
+
const stats = computed(() => [
|
|
325
|
+
{ label: "New", value: count("New") },
|
|
326
|
+
{ label: "Awaiting documents", value: count("Awaiting documents") },
|
|
327
|
+
{ label: "Interviews booked", value: count("Interview") },
|
|
328
|
+
]);
|
|
329
|
+
|
|
330
|
+
// ── The application being reviewed
|
|
331
|
+
const open = ref(false);
|
|
332
|
+
const reviewing = ref<Application>();
|
|
333
|
+
const decision = ref<string>();
|
|
334
|
+
const notes = ref("");
|
|
335
|
+
const tellFamily = ref(true);
|
|
336
|
+
const tried = ref(false);
|
|
337
|
+
const saving = ref<ButtonStatus>("idle");
|
|
338
|
+
|
|
339
|
+
function review(row: Application) {
|
|
340
|
+
reviewing.value = row;
|
|
341
|
+
decision.value = undefined;
|
|
342
|
+
notes.value = "";
|
|
343
|
+
tellFamily.value = true;
|
|
344
|
+
tried.value = false;
|
|
345
|
+
saving.value = "idle";
|
|
346
|
+
open.value = true;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const summary = computed(() => {
|
|
350
|
+
const a = reviewing.value;
|
|
351
|
+
if (!a) return [];
|
|
352
|
+
return [
|
|
353
|
+
{ label: "Entry", value: a.entry },
|
|
354
|
+
{ label: "Current school", value: a.currentSchool },
|
|
355
|
+
{ label: "Sibling at Keston", value: a.sibling ? "Yes" : "No", description: a.sibling ? "Priority under the admissions policy" : undefined },
|
|
356
|
+
{ label: "Reference", value: a.id },
|
|
357
|
+
];
|
|
358
|
+
});
|
|
359
|
+
const documents = computed(() => {
|
|
360
|
+
const d = reviewing.value?.documents;
|
|
361
|
+
if (!d) return [];
|
|
362
|
+
return [
|
|
363
|
+
{ label: "Proof of address", done: d.address },
|
|
364
|
+
{ label: "School report", done: d.report },
|
|
365
|
+
{ label: "Medical form", done: d.medical },
|
|
366
|
+
];
|
|
367
|
+
});
|
|
368
|
+
const missing = computed(() => documents.value.filter((d) => !d.done).length);
|
|
369
|
+
|
|
370
|
+
const decisions = computed(() => [
|
|
371
|
+
{ label: "Invite to interview", value: "Interview", description: "The family is sent a link to book a slot" },
|
|
372
|
+
{ label: "Make an offer", value: "Offered", description: "Offers can be made without an interview for Year 7" },
|
|
373
|
+
{
|
|
374
|
+
label: "Ask for documents",
|
|
375
|
+
value: "Awaiting documents",
|
|
376
|
+
description: missing.value ? `${missing.value} missing` : "Nothing is missing",
|
|
377
|
+
disabled: !missing.value,
|
|
378
|
+
},
|
|
379
|
+
{ label: "Decline", value: "Declined", description: "Explain why in the notes; the family sees a standard letter" },
|
|
380
|
+
]);
|
|
381
|
+
const decisionError = computed(() => (tried.value && !decision.value ? "Choose a decision" : undefined));
|
|
382
|
+
const notesError = computed(() =>
|
|
383
|
+
tried.value && decision.value === "Declined" && !notes.value ? "Add a note explaining why" : undefined,
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
function record() {
|
|
387
|
+
tried.value = true;
|
|
388
|
+
if (decisionError.value || notesError.value) return;
|
|
389
|
+
saving.value = "loading";
|
|
390
|
+
setTimeout(() => {
|
|
391
|
+
const a = reviewing.value!;
|
|
392
|
+
a.status = decision.value as Status;
|
|
393
|
+
saving.value = "success";
|
|
394
|
+
setTimeout(() => {
|
|
395
|
+
open.value = false;
|
|
396
|
+
notifications.notify({
|
|
397
|
+
type: "success",
|
|
398
|
+
title: `${a.name}: ${a.status === "Interview" ? "invited to interview" : a.status.toLowerCase()}`,
|
|
399
|
+
description: tellFamily.value ? "The family has been emailed." : "The family hasn't been told yet.",
|
|
400
|
+
});
|
|
401
|
+
}, 600);
|
|
402
|
+
}, 900);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return {
|
|
406
|
+
nav: sidebar(admissionsSidebar, "Applications"),
|
|
407
|
+
user, notifications, applications, columns, sort, stats, statusColour, now,
|
|
408
|
+
open, reviewing, decision, decisions, notes, tellFamily, saving, summary, documents, decisionError, notesError, review, record,
|
|
409
|
+
};
|
|
410
|
+
},
|
|
411
|
+
template: `
|
|
412
|
+
<AppShell title="Keston Admissions" :sections="nav" :user="user">
|
|
413
|
+
${bell}
|
|
414
|
+
<div class="flex flex-col gap-6 p-4 sm:p-6">
|
|
415
|
+
<PageHeader title="Applications" description="Applications for entry in 2027. Newest first." />
|
|
416
|
+
|
|
417
|
+
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
|
|
418
|
+
<StatTile v-for="stat in stats" :key="stat.label" v-bind="stat" />
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<Card padding="none">
|
|
422
|
+
<Table v-model:sort="sort" :columns="columns" :rows="applications" row-key="id" caption="Applications">
|
|
423
|
+
<template #cell-submitted="{ row }"><span class="text-black/65"><RelativeTime :date="row.submitted" :now="now" /></span></template>
|
|
424
|
+
<template #cell-status="{ row }"><Badge :color="statusColour[row.status]" size="sm">{{ row.status }}</Badge></template>
|
|
425
|
+
<template #cell-review="{ row }">
|
|
426
|
+
<Button size="sm" :aria-label="'Review ' + row.name" @click="review(row)">Review</Button>
|
|
427
|
+
</template>
|
|
428
|
+
</Table>
|
|
429
|
+
</Card>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<Slideover
|
|
433
|
+
v-model:open="open"
|
|
434
|
+
:title="reviewing?.name"
|
|
435
|
+
:description="reviewing ? reviewing.entry + ' · submitted ' + reviewing.submitted.toLocaleDateString('en-GB', { dateStyle: 'long' }) : ''"
|
|
436
|
+
>
|
|
437
|
+
<template #body>
|
|
438
|
+
<div v-if="reviewing" class="flex flex-col gap-6">
|
|
439
|
+
<SummaryList :items="summary" layout="compact" />
|
|
440
|
+
|
|
441
|
+
<div class="flex flex-col gap-2">
|
|
442
|
+
<h3 class="text-sm font-bold">Documents</h3>
|
|
443
|
+
<Checklist :items="documents" />
|
|
444
|
+
</div>
|
|
445
|
+
|
|
446
|
+
<RadioGroup v-model="decision" label="Decision" :options="decisions" :error-text="decisionError" required />
|
|
447
|
+
|
|
448
|
+
<InputRichText v-model="notes" label="Notes" helper="Seen by admissions staff only." placeholder="Why this decision?" :error-text="notesError" />
|
|
449
|
+
|
|
450
|
+
<Checkbox v-model="tellFamily" label="Email the family now" description="Otherwise they're told when decisions are published on 1 March." />
|
|
451
|
+
</div>
|
|
452
|
+
</template>
|
|
453
|
+
<template #footer="{ close }">
|
|
454
|
+
<Button @click="close">Cancel</Button>
|
|
455
|
+
<Button variant="primary" v-model:status="saving" loading-text="Saving…" success-text="Saved" @click="record">Record decision</Button>
|
|
456
|
+
</template>
|
|
457
|
+
</Slideover>
|
|
458
|
+
</AppShell>
|
|
459
|
+
${toaster}`,
|
|
460
|
+
}),
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
// ── Interview booking ───────────────────────────────────────────────────────
|
|
464
|
+
|
|
465
|
+
const slotTimes = ["09:00", "09:45", "10:30", "11:15", "13:30", "14:15", "15:00"];
|
|
466
|
+
// Which slots are already taken, by day of the month (fake data).
|
|
467
|
+
const taken = (day: number) => slotTimes.filter((_, i) => (day * 3 + i) % 4 === 0);
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Booking an interview: choose a day on the Calendar (weekdays this term
|
|
471
|
+
* only), then a free slot and who's interviewing. The summary follows along,
|
|
472
|
+
* and booking confirms with a toast.
|
|
473
|
+
*/
|
|
474
|
+
export const InterviewBooking: Story = {
|
|
475
|
+
render: () => ({
|
|
476
|
+
components: { ...shared, Calendar, Checkbox, RadioGroup, Select, SummaryList },
|
|
477
|
+
setup() {
|
|
478
|
+
const notifications = createNotifications(sampleNotifications());
|
|
479
|
+
const day = ref<string>("2026-11-18");
|
|
480
|
+
const slot = ref<string>();
|
|
481
|
+
const interviewer = ref<string>();
|
|
482
|
+
const virtual = ref(false);
|
|
483
|
+
const tried = ref(false);
|
|
484
|
+
const status = ref<ButtonStatus>("idle");
|
|
485
|
+
|
|
486
|
+
const date = computed(() => (day.value ? new Date(day.value + "T00:00") : undefined));
|
|
487
|
+
const weekend = computed(() => !!date.value && [0, 6].includes(date.value.getDay()));
|
|
488
|
+
const dayLabel = computed(() => date.value?.toLocaleDateString("en-GB", { weekday: "long", day: "numeric", month: "long" }));
|
|
489
|
+
|
|
490
|
+
const slots = computed(() => {
|
|
491
|
+
if (!date.value || weekend.value) return [];
|
|
492
|
+
const busy = taken(date.value.getDate());
|
|
493
|
+
return slotTimes.map((time) => ({
|
|
494
|
+
label: time,
|
|
495
|
+
value: time,
|
|
496
|
+
description: busy.includes(time) ? "Booked" : "45 minutes",
|
|
497
|
+
disabled: busy.includes(time),
|
|
498
|
+
}));
|
|
499
|
+
});
|
|
500
|
+
watch(day, () => (slot.value = undefined));
|
|
501
|
+
|
|
502
|
+
const interviewers = [
|
|
503
|
+
{ label: "Mrs Hughes", value: "hughes", description: "Head of Year 7" },
|
|
504
|
+
{ label: "Mr Patel", value: "patel", description: "Deputy Head" },
|
|
505
|
+
{ label: "Ms Clarke", value: "clarke", description: "Head of Sixth Form" },
|
|
506
|
+
];
|
|
507
|
+
|
|
508
|
+
const summary = computed(() => [
|
|
509
|
+
{ label: "Applicant", value: "Noah Wilson" },
|
|
510
|
+
{ label: "Day", value: dayLabel.value ?? null },
|
|
511
|
+
{ label: "Time", value: slot.value ?? null },
|
|
512
|
+
{ label: "Interviewer", value: interviewers.find((i) => i.value === interviewer.value)?.label ?? null },
|
|
513
|
+
{ label: "Where", value: virtual.value ? "Video call" : "Main reception" },
|
|
514
|
+
]);
|
|
515
|
+
|
|
516
|
+
const slotError = computed(() => (tried.value && !slot.value ? "Choose a time" : undefined));
|
|
517
|
+
const interviewerError = computed(() => (tried.value && !interviewer.value ? "Choose who's interviewing" : undefined));
|
|
518
|
+
|
|
519
|
+
function book() {
|
|
520
|
+
tried.value = true;
|
|
521
|
+
if (slotError.value || interviewerError.value) return;
|
|
522
|
+
status.value = "loading";
|
|
523
|
+
setTimeout(() => {
|
|
524
|
+
status.value = "success";
|
|
525
|
+
notifications.notify({ type: "success", title: "Interview booked", description: `Noah Wilson, ${dayLabel.value} at ${slot.value}. The family has been emailed.` });
|
|
526
|
+
}, 900);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return {
|
|
530
|
+
nav: sidebar(admissionsSidebar, "Interviews"),
|
|
531
|
+
user, notifications, day, slot, slots, weekend, dayLabel, interviewer, interviewers, virtual, summary, slotError, interviewerError, status, book,
|
|
532
|
+
trail: [{ label: "Interviews", href: "#" }, { label: "Book an interview" }],
|
|
533
|
+
};
|
|
534
|
+
},
|
|
535
|
+
template: `
|
|
536
|
+
<AppShell title="Keston Admissions" :sections="nav" :user="user">
|
|
537
|
+
${bell}
|
|
538
|
+
<div class="flex flex-col gap-6 p-4 sm:p-6">
|
|
539
|
+
<PageHeader title="Book an interview" description="Noah Wilson · Year 12, September 2027" :breadcrumb="trail" />
|
|
540
|
+
|
|
541
|
+
<div class="@container">
|
|
542
|
+
<div class="grid grid-cols-1 items-start gap-6 @4xl:grid-cols-[18rem_minmax(0,1fr)_18rem]">
|
|
543
|
+
<!-- A fixed column: a Card is a size container, so it can't be
|
|
544
|
+
sized by its content (the calendar) in an auto column. -->
|
|
545
|
+
<Card title="Day">
|
|
546
|
+
<Calendar v-model="day" min="2026-11-12" max="2026-12-18" />
|
|
547
|
+
</Card>
|
|
548
|
+
|
|
549
|
+
<Card :title="dayLabel ? 'Times on ' + dayLabel : 'Times'">
|
|
550
|
+
<p v-if="weekend" class="text-sm text-black/65">No interviews at weekends. Choose a weekday.</p>
|
|
551
|
+
<template v-else>
|
|
552
|
+
<RadioGroup v-model="slot" label="Time" :options="slots" :error-text="slotError" />
|
|
553
|
+
<Select v-model="interviewer" label="Interviewer" :options="interviewers" placeholder="Choose…" :error-text="interviewerError" />
|
|
554
|
+
<Checkbox v-model="virtual" label="Video call" description="The link is sent with the confirmation." />
|
|
555
|
+
</template>
|
|
556
|
+
</Card>
|
|
557
|
+
|
|
558
|
+
<Card as="aside" title="Booking" padding="sm" class="@4xl:sticky @4xl:top-18">
|
|
559
|
+
<SummaryList :items="summary" layout="compact" />
|
|
560
|
+
<Button variant="primary" class="w-full" :disabled="weekend" v-model:status="status" loading-text="Booking…" success-text="Booked" @click="book">
|
|
561
|
+
Book interview
|
|
562
|
+
</Button>
|
|
563
|
+
</Card>
|
|
564
|
+
</div>
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
567
|
+
</AppShell>
|
|
568
|
+
${toaster}`,
|
|
569
|
+
}),
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
// ── Notification settings ───────────────────────────────────────────────────
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* A settings page of Switches that save as soon as they're flipped (every
|
|
576
|
+
* fourth save fails, to show the error), with a RadioGroup for how often
|
|
577
|
+
* the summary email comes. No Save button: each setting confirms itself.
|
|
578
|
+
*/
|
|
579
|
+
export const NotificationSettings: Story = {
|
|
580
|
+
render: () => ({
|
|
581
|
+
components: { ...shared, RadioGroup, Switch },
|
|
582
|
+
setup() {
|
|
583
|
+
const notifications = createNotifications(sampleNotifications());
|
|
584
|
+
|
|
585
|
+
type Setting = { key: string; label: string; description: string; on: boolean; status?: SwitchProps["status"]; statusText?: string };
|
|
586
|
+
const groups = reactive([
|
|
587
|
+
{
|
|
588
|
+
title: "Applications",
|
|
589
|
+
settings: [
|
|
590
|
+
{ key: "new", label: "New applications", description: "As soon as one is submitted.", on: true },
|
|
591
|
+
{ key: "documents", label: "Documents uploaded", description: "When a family uploads something you asked for.", on: true },
|
|
592
|
+
{ key: "withdrawn", label: "Applications withdrawn", description: "", on: false },
|
|
593
|
+
] as Setting[],
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
title: "Interviews",
|
|
597
|
+
settings: [
|
|
598
|
+
{ key: "booked", label: "Interviews booked", description: "When a family books one of your slots.", on: true },
|
|
599
|
+
{ key: "reminder", label: "Reminders", description: "The day before, at 8am.", on: true },
|
|
600
|
+
] as Setting[],
|
|
601
|
+
},
|
|
602
|
+
]);
|
|
603
|
+
|
|
604
|
+
let saves = 0;
|
|
605
|
+
function save(setting: Setting, next: boolean) {
|
|
606
|
+
setting.status = "loading";
|
|
607
|
+
setting.statusText = "Saving…";
|
|
608
|
+
setTimeout(() => {
|
|
609
|
+
if (++saves % 4 === 0) {
|
|
610
|
+
setting.on = !next;
|
|
611
|
+
setting.status = "error";
|
|
612
|
+
setting.statusText = "Couldn't save. Try again.";
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
setting.status = "success";
|
|
616
|
+
setting.statusText = "Saved";
|
|
617
|
+
setTimeout(() => {
|
|
618
|
+
if (setting.status === "success") setting.status = setting.statusText = undefined;
|
|
619
|
+
}, 2000);
|
|
620
|
+
}, 700);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
const digest = ref("daily");
|
|
624
|
+
const digestOptions = [
|
|
625
|
+
{ label: "Every morning", value: "daily", description: "At 7am, if anything happened" },
|
|
626
|
+
{ label: "Every Monday", value: "weekly" },
|
|
627
|
+
{ label: "Never", value: "never", description: "You'll still get the notifications above" },
|
|
628
|
+
];
|
|
629
|
+
watch(digest, () => notifications.notify({ type: "success", title: "Summary email updated", compact: true }));
|
|
630
|
+
|
|
631
|
+
return {
|
|
632
|
+
nav: sidebar(admissionsSidebar, "Settings"),
|
|
633
|
+
user, notifications, groups, save, digest, digestOptions,
|
|
634
|
+
trail: [{ label: "Settings", href: "#" }, { label: "Notifications" }],
|
|
635
|
+
};
|
|
636
|
+
},
|
|
637
|
+
template: `
|
|
638
|
+
<AppShell title="Keston Admissions" :sections="nav" :user="user">
|
|
639
|
+
${bell}
|
|
640
|
+
<div class="flex max-w-3xl flex-col gap-6 p-4 sm:p-6">
|
|
641
|
+
<PageHeader title="Notifications" description="What you're told about, and how. These are just for you." :breadcrumb="trail" />
|
|
642
|
+
|
|
643
|
+
<Card v-for="group in groups" :key="group.title" :title="group.title">
|
|
644
|
+
<div class="flex flex-col gap-4">
|
|
645
|
+
<Switch
|
|
646
|
+
v-for="setting in group.settings"
|
|
647
|
+
:key="setting.key"
|
|
648
|
+
v-model="setting.on"
|
|
649
|
+
:label="setting.label"
|
|
650
|
+
:description="setting.description || undefined"
|
|
651
|
+
:status="setting.status"
|
|
652
|
+
:status-text="setting.statusText"
|
|
653
|
+
@update:model-value="save(setting, $event)"
|
|
654
|
+
/>
|
|
655
|
+
</div>
|
|
656
|
+
</Card>
|
|
657
|
+
|
|
658
|
+
<Card title="Summary email">
|
|
659
|
+
<RadioGroup v-model="digest" label="How often" :options="digestOptions" />
|
|
660
|
+
</Card>
|
|
661
|
+
</div>
|
|
662
|
+
</AppShell>
|
|
663
|
+
${toaster}`,
|
|
664
|
+
}),
|
|
665
|
+
};
|