@7365admin1/layer-common 4.97.1-staging.519 → 4.97.1-staging.520
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/components/BulletinBoardForm.vue +112 -0
- package/components/BulletinBoardView.vue +2 -0
- package/components/BulletinEventRsvp.vue +126 -0
- package/components/SiteSettings.vue +4 -0
- package/components/VehicleManagement.vue +4 -1
- package/package.json +1 -1
- package/types/bulletin-board.d.ts +11 -1
|
@@ -103,10 +103,75 @@
|
|
|
103
103
|
/>
|
|
104
104
|
</v-col>
|
|
105
105
|
|
|
106
|
+
<!-- Event with RSVP (owner 2026-10-07, 1PAM: "Mooncake Festival - time, RSVP, RSVP closes"). -->
|
|
107
|
+
<v-col cols="12" class="mt-2">
|
|
108
|
+
<v-checkbox
|
|
109
|
+
v-model="eventForm.enabled"
|
|
110
|
+
hide-details
|
|
111
|
+
label="This announcement is an event people can attend"
|
|
112
|
+
data-test="bulletin-event-toggle"
|
|
113
|
+
/>
|
|
114
|
+
<p class="text-caption text-medium-emphasis ml-10 mb-2">
|
|
115
|
+
For example a festival, a briefing or a gathering. The date, time and place are shown on the
|
|
116
|
+
announcement in the residents' and service providers' apps.
|
|
117
|
+
</p>
|
|
118
|
+
</v-col>
|
|
119
|
+
<template v-if="eventForm.enabled">
|
|
120
|
+
<v-col cols="12" md="6" class="pr-md-2">
|
|
121
|
+
<InputLabel title="Event starts" required />
|
|
122
|
+
<InputDateTimePicker v-model:utc="eventForm.startAt" :rules="[eventStartRule]" />
|
|
123
|
+
</v-col>
|
|
124
|
+
<v-col cols="12" md="6" class="pl-md-2">
|
|
125
|
+
<InputLabel title="Event ends (optional)" />
|
|
126
|
+
<InputDateTimePicker v-model:utc="eventForm.endAt" :rules="[eventEndRule]" />
|
|
127
|
+
</v-col>
|
|
128
|
+
<v-col cols="12">
|
|
129
|
+
<InputLabel title="Venue (optional)" />
|
|
130
|
+
<v-text-field v-model.trim="eventForm.venue" density="compact" placeholder="e.g. Function Room, Block 2" maxlength="200" />
|
|
131
|
+
</v-col>
|
|
132
|
+
<v-col cols="12">
|
|
133
|
+
<v-checkbox
|
|
134
|
+
v-model="eventForm.rsvp"
|
|
135
|
+
hide-details
|
|
136
|
+
label="Ask residents to RSVP (Going / Not going)"
|
|
137
|
+
data-test="bulletin-rsvp-toggle"
|
|
138
|
+
/>
|
|
139
|
+
<p class="text-caption text-medium-emphasis ml-10 mb-2">
|
|
140
|
+
Residents answer in the Service365 app and say how many people are coming. You see every answer, with
|
|
141
|
+
the unit, when you open this announcement.
|
|
142
|
+
</p>
|
|
143
|
+
<p v-if="eventForm.rsvp && !bulletinForm.recipients.includes('resident')" class="text-caption text-warning ml-10 mb-2">
|
|
144
|
+
Add "Resident" to the recipients so residents can see and answer it.
|
|
145
|
+
</p>
|
|
146
|
+
</v-col>
|
|
147
|
+
<template v-if="eventForm.rsvp">
|
|
148
|
+
<v-col cols="12" md="6" class="pr-md-2">
|
|
149
|
+
<InputLabel title="RSVP closes (optional)" />
|
|
150
|
+
<InputDateTimePicker v-model:utc="eventForm.rsvpClosesAt" :rules="[rsvpCloseRule]" />
|
|
151
|
+
<p class="text-caption text-medium-emphasis">Leave empty to take answers until the event starts.</p>
|
|
152
|
+
</v-col>
|
|
153
|
+
<v-col cols="12" md="6" class="pl-md-2">
|
|
154
|
+
<InputLabel title="Places available (optional)" />
|
|
155
|
+
<v-text-field
|
|
156
|
+
v-model.number="eventForm.capacity"
|
|
157
|
+
type="number"
|
|
158
|
+
min="1"
|
|
159
|
+
density="compact"
|
|
160
|
+
:rules="[capacityRule]"
|
|
161
|
+
hint="Total people across all units. Leave empty for no limit."
|
|
162
|
+
persistent-hint
|
|
163
|
+
/>
|
|
164
|
+
</v-col>
|
|
165
|
+
</template>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
106
168
|
<v-col cols="12">
|
|
107
169
|
<v-col cols="12" class="font-weight-bold text-h6"
|
|
108
170
|
>Attachments</v-col
|
|
109
171
|
>
|
|
172
|
+
<v-col cols="12" class="text-caption text-medium-emphasis py-0">
|
|
173
|
+
Photos, videos and documents, up to 25 MB each.
|
|
174
|
+
</v-col>
|
|
110
175
|
<v-col cols="12">
|
|
111
176
|
<!-- Was `color="primary-button"` on an OUTLINED button, i.e. a
|
|
112
177
|
FILL token used as ink - the exact case `utils/theme.ts`
|
|
@@ -228,6 +293,42 @@ const bulletinForm = reactive<TCreateAnnouncementPayload>({
|
|
|
228
293
|
|
|
229
294
|
const emit = defineEmits(["close", "done"]);
|
|
230
295
|
|
|
296
|
+
const eventForm = reactive({
|
|
297
|
+
enabled: false,
|
|
298
|
+
startAt: "",
|
|
299
|
+
endAt: "",
|
|
300
|
+
venue: "",
|
|
301
|
+
rsvp: false,
|
|
302
|
+
rsvpClosesAt: "",
|
|
303
|
+
capacity: null as number | null,
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
function eventStartRule(v: string) {
|
|
307
|
+
return !eventForm.enabled || !!v || "Please choose when the event starts";
|
|
308
|
+
}
|
|
309
|
+
function eventEndRule(v: string) {
|
|
310
|
+
return !v || !eventForm.startAt || new Date(v) > new Date(eventForm.startAt) || "The event must end after it starts";
|
|
311
|
+
}
|
|
312
|
+
function rsvpCloseRule(v: string) {
|
|
313
|
+
return !v || !eventForm.startAt || new Date(v) <= new Date(eventForm.startAt) || "RSVP must close before the event starts";
|
|
314
|
+
}
|
|
315
|
+
function capacityRule(v: any) {
|
|
316
|
+
return v === null || v === "" || v === undefined || (Number.isInteger(Number(v)) && Number(v) >= 1) || "Enter a whole number of 1 or more";
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** What is sent: no event = `null`, so turning the event off on edit clears it. */
|
|
320
|
+
function eventPayload() {
|
|
321
|
+
if (!eventForm.enabled) return null;
|
|
322
|
+
return {
|
|
323
|
+
startAt: eventForm.startAt,
|
|
324
|
+
endAt: eventForm.endAt || null,
|
|
325
|
+
venue: eventForm.venue || "",
|
|
326
|
+
rsvp: eventForm.rsvp,
|
|
327
|
+
rsvpClosesAt: eventForm.rsvp ? eventForm.rsvpClosesAt || null : null,
|
|
328
|
+
capacity: eventForm.rsvp && eventForm.capacity ? Number(eventForm.capacity) : null,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
231
332
|
const validForm = ref(false);
|
|
232
333
|
const formRef = ref<HTMLFormElement>();
|
|
233
334
|
const formKey = ref(0);
|
|
@@ -289,6 +390,16 @@ watch(
|
|
|
289
390
|
bulletinForm.endDate = newData?.endDate;
|
|
290
391
|
bulletinForm.file = newData?.file;
|
|
291
392
|
bulletinForm.recipients = newData?.recipients;
|
|
393
|
+
const ev = newData?.event;
|
|
394
|
+
Object.assign(eventForm, {
|
|
395
|
+
enabled: !!ev?.startAt,
|
|
396
|
+
startAt: ev?.startAt ?? "",
|
|
397
|
+
endAt: ev?.endAt ?? "",
|
|
398
|
+
venue: ev?.venue ?? "",
|
|
399
|
+
rsvp: !!ev?.rsvp,
|
|
400
|
+
rsvpClosesAt: ev?.rsvpClosesAt ?? "",
|
|
401
|
+
capacity: ev?.capacity ?? null,
|
|
402
|
+
});
|
|
292
403
|
|
|
293
404
|
// mapped rawFileArray
|
|
294
405
|
|
|
@@ -393,6 +504,7 @@ async function onSubmit() {
|
|
|
393
504
|
const { site, ...rest } = bulletinForm;
|
|
394
505
|
payload = rest;
|
|
395
506
|
}
|
|
507
|
+
(payload as any).event = eventPayload();
|
|
396
508
|
|
|
397
509
|
try {
|
|
398
510
|
loading.processing = true;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
The event part of an announcement (owner 2026-10-07, 1PAM "Mooncake
|
|
4
|
+
Festival"): when, where, and - for the estate team - who is coming.
|
|
5
|
+
Residents answer in the Service365 app; this only reads the answers.
|
|
6
|
+
-->
|
|
7
|
+
<v-col v-if="event?.startAt" cols="12" class="mb-5" data-test="bulletin-event">
|
|
8
|
+
<v-row no-gutters>
|
|
9
|
+
<v-col class="font-weight-bold">Event:</v-col>
|
|
10
|
+
<v-col cols="9" class="px-10">
|
|
11
|
+
<div>{{ when }}</div>
|
|
12
|
+
<div v-if="event.venue" class="text-medium-emphasis">{{ event.venue }}</div>
|
|
13
|
+
|
|
14
|
+
<template v-if="event.rsvp">
|
|
15
|
+
<div class="text-caption text-medium-emphasis mt-1">
|
|
16
|
+
RSVP {{ closed ? "closed" : "open" }} {{ closed ? "on" : "until" }} {{ fmt(event.rsvpClosesAt || event.startAt) }}{{
|
|
17
|
+
event.capacity ? ` · ${event.capacity} places` : " · no limit on places"
|
|
18
|
+
}}
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<template v-if="canSeeAnswers">
|
|
22
|
+
<v-alert v-if="error" type="error" variant="tonal" density="compact" class="mt-3">{{ error }}</v-alert>
|
|
23
|
+
<div v-else-if="loading" class="text-caption mt-3">Loading answers...</div>
|
|
24
|
+
<template v-else-if="summary">
|
|
25
|
+
<div class="d-flex flex-wrap ga-2 mt-3" data-test="bulletin-rsvp-summary">
|
|
26
|
+
<v-chip size="small" color="success" variant="tonal">
|
|
27
|
+
Going: {{ summary.goingPeople }} {{ summary.goingPeople === 1 ? "person" : "people" }} ({{ summary.goingHouseholds }}
|
|
28
|
+
{{ summary.goingHouseholds === 1 ? "unit" : "units" }})
|
|
29
|
+
</v-chip>
|
|
30
|
+
<v-chip size="small" variant="tonal">Not going: {{ summary.notGoing }}</v-chip>
|
|
31
|
+
<v-chip v-if="summary.capacity" size="small" variant="tonal">
|
|
32
|
+
Places left: {{ Math.max(summary.capacity - summary.goingPeople, 0) }}
|
|
33
|
+
</v-chip>
|
|
34
|
+
<v-btn
|
|
35
|
+
v-if="items.length"
|
|
36
|
+
size="small"
|
|
37
|
+
variant="outlined"
|
|
38
|
+
class="text-none screen-btn-ghost"
|
|
39
|
+
prepend-icon="mdi-download"
|
|
40
|
+
data-test="bulletin-rsvp-export"
|
|
41
|
+
@click="exportCsv"
|
|
42
|
+
>
|
|
43
|
+
Download list (CSV)
|
|
44
|
+
</v-btn>
|
|
45
|
+
</div>
|
|
46
|
+
<p v-if="!items.length" class="text-caption text-medium-emphasis mt-2">
|
|
47
|
+
No answers yet. Residents answer in the Service365 app.
|
|
48
|
+
</p>
|
|
49
|
+
<v-table v-else density="compact" class="mt-2 border rounded">
|
|
50
|
+
<thead>
|
|
51
|
+
<tr><th>Unit</th><th>Name</th><th>Answer</th><th>People</th><th>Answered</th></tr>
|
|
52
|
+
</thead>
|
|
53
|
+
<tbody>
|
|
54
|
+
<tr v-for="r in items" :key="r._id">
|
|
55
|
+
<td>{{ r.unit || "-" }}</td>
|
|
56
|
+
<td>{{ r.name || r.email || "-" }}</td>
|
|
57
|
+
<td>{{ r.response === "going" ? "Going" : "Not going" }}</td>
|
|
58
|
+
<td>{{ r.response === "going" ? r.attendees : "-" }}</td>
|
|
59
|
+
<td>{{ fmt(r.updatedAt) }}</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</tbody>
|
|
62
|
+
</v-table>
|
|
63
|
+
</template>
|
|
64
|
+
</template>
|
|
65
|
+
</template>
|
|
66
|
+
</v-col>
|
|
67
|
+
</v-row>
|
|
68
|
+
</v-col>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
const props = defineProps({
|
|
73
|
+
announcement: { type: Object as PropType<Record<string, any> | null>, default: null },
|
|
74
|
+
/** The estate team (bulletin edit right) sees who answered. */
|
|
75
|
+
canSeeAnswers: { type: Boolean, default: false },
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const event = computed(() => props.announcement?.event ?? null);
|
|
79
|
+
const items = ref<Record<string, any>[]>([]);
|
|
80
|
+
const summary = ref<Record<string, any> | null>(null);
|
|
81
|
+
const loading = ref(false);
|
|
82
|
+
const error = ref("");
|
|
83
|
+
|
|
84
|
+
const fmt = (v: any) =>
|
|
85
|
+
v ? new Date(v).toLocaleString(undefined, { day: "numeric", month: "short", year: "numeric", hour: "numeric", minute: "2-digit" }) : "";
|
|
86
|
+
const when = computed(() => {
|
|
87
|
+
const e = event.value;
|
|
88
|
+
if (!e?.startAt) return "";
|
|
89
|
+
return e.endAt ? `${fmt(e.startAt)} - ${fmt(e.endAt)}` : fmt(e.startAt);
|
|
90
|
+
});
|
|
91
|
+
const closed = computed(() => {
|
|
92
|
+
const at = event.value?.rsvpClosesAt || event.value?.startAt;
|
|
93
|
+
return !!at && new Date(at) < new Date();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
async function load() {
|
|
97
|
+
items.value = [];
|
|
98
|
+
summary.value = null;
|
|
99
|
+
error.value = "";
|
|
100
|
+
if (!event.value?.rsvp || !props.canSeeAnswers || !props.announcement?._id) return;
|
|
101
|
+
loading.value = true;
|
|
102
|
+
try {
|
|
103
|
+
const res: any = await useNuxtApp().$api(`/api/bulletin-boards/id/${props.announcement._id}/rsvps`);
|
|
104
|
+
items.value = res?.items ?? [];
|
|
105
|
+
summary.value = res?.summary ?? null;
|
|
106
|
+
} catch (e: any) {
|
|
107
|
+
error.value = e?.data?.message || "The answers could not be loaded. Please try again.";
|
|
108
|
+
} finally {
|
|
109
|
+
loading.value = false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
watch(() => [props.announcement?._id, props.canSeeAnswers], load, { immediate: true });
|
|
113
|
+
|
|
114
|
+
function exportCsv() {
|
|
115
|
+
const q = (v: any) => `"${String(v ?? "").replace(/"/g, '""')}"`;
|
|
116
|
+
const rows = [["Unit", "Name", "Email", "Answer", "People", "Answered"]].concat(
|
|
117
|
+
items.value.map((r) => [r.unit, r.name, r.email, r.response === "going" ? "Going" : "Not going", r.response === "going" ? r.attendees : 0, fmt(r.updatedAt)]),
|
|
118
|
+
);
|
|
119
|
+
const blob = new Blob([rows.map((r) => r.map(q).join(",")).join("\n")], { type: "text/csv" });
|
|
120
|
+
const a = document.createElement("a");
|
|
121
|
+
a.href = URL.createObjectURL(blob);
|
|
122
|
+
a.download = `rsvp-${String(props.announcement?.title || "event").replace(/[^A-Za-z0-9]+/g, "-")}.csv`;
|
|
123
|
+
a.click();
|
|
124
|
+
setTimeout(() => URL.revokeObjectURL(a.href), 5000);
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
</v-col>
|
|
64
64
|
<v-col cols="12" lg="6" class="mt-2 pl-lg-2">
|
|
65
65
|
<InputLabel title="Site Documents" class="d-block mb-1" />
|
|
66
|
+
<p class="text-caption text-medium-emphasis mb-2">
|
|
67
|
+
Every resident of this site can open these in the Service365 app (About this site) - for example
|
|
68
|
+
by-laws, house rules or the site plan. Documents for one unit only go on that unit instead.
|
|
69
|
+
</p>
|
|
66
70
|
<InputFileV2 v-model="siteDocuments" :multiple="true" accept="*/*" title="Upload documents"
|
|
67
71
|
:height="104" />
|
|
68
72
|
</v-col>
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
heading. Same handler, same permission gate.
|
|
7
7
|
-->
|
|
8
8
|
<v-col cols="12">
|
|
9
|
-
<PageHeader
|
|
9
|
+
<PageHeader
|
|
10
|
+
title="Vehicle Mgmt"
|
|
11
|
+
subtitle="The register of residents' and visitors' vehicles. Works with or without number-plate (LPR) cameras - cameras only add automatic plate matching at the gate."
|
|
12
|
+
>
|
|
10
13
|
<template #actions>
|
|
11
14
|
<AppButton v-if="qrStickersOn" icon="mdi-qrcode" variant="ghost" @click="openStickerDialog()">
|
|
12
15
|
Print QR stickers
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.520",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -12,6 +12,16 @@ declare interface TAnnouncement {
|
|
|
12
12
|
startDate: string;
|
|
13
13
|
endDate: string;
|
|
14
14
|
status: TAnnouncementStatus
|
|
15
|
+
event?: TAnnouncementEvent | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare interface TAnnouncementEvent {
|
|
19
|
+
startAt: string;
|
|
20
|
+
endAt?: string | null;
|
|
21
|
+
venue?: string;
|
|
22
|
+
rsvp?: boolean;
|
|
23
|
+
rsvpClosesAt?: string | null;
|
|
24
|
+
capacity?: number | null;
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
declare interface TAnnouncementFile {
|
|
@@ -24,6 +34,6 @@ declare type TAnnouncementRecipients = "resident" | "security_agency" | "cleanin
|
|
|
24
34
|
|
|
25
35
|
|
|
26
36
|
|
|
27
|
-
declare type TCreateAnnouncementPayload = Pick<TAnnouncement, "recipients" | "file" | "site" | "noExpiration" | "startDate" | "endDate" | "content" | "title">
|
|
37
|
+
declare type TCreateAnnouncementPayload = Pick<TAnnouncement, "recipients" | "file" | "site" | "noExpiration" | "startDate" | "endDate" | "content" | "title"> & { event?: TAnnouncementEvent | null }
|
|
28
38
|
|
|
29
39
|
declare type TAnnouncementStatus = "active" | "expired"
|