@7365admin1/layer-common 4.97.1-staging.545 → 4.97.1-staging.547
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/DataRetentionBanner.vue +73 -0
- package/components/SiteDataRetention.vue +55 -188
- package/components/SiteSettingsVisitorRegistration.vue +22 -9
- package/components/VisitorForm.vue +5 -1
- package/composables/useDataRetention.ts +8 -2
- package/composables/useVisitor.ts +5 -2
- package/package.json +1 -1
- package/utils/notification-target.ts +12 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
Scheduled data removal at the selected site (owner 2026-10-14). Shown to
|
|
4
|
+
the people who work the site, never residents (the server answers nothing
|
|
5
|
+
to them), and only for a removal that will really happen: Seven365 Admin
|
|
6
|
+
allowed deletion at this site and the site's admins were already told.
|
|
7
|
+
A site with no data retention never shows it - the request answers
|
|
8
|
+
`{ banner: null }`.
|
|
9
|
+
-->
|
|
10
|
+
<v-alert
|
|
11
|
+
v-if="banner"
|
|
12
|
+
type="warning"
|
|
13
|
+
variant="tonal"
|
|
14
|
+
density="comfortable"
|
|
15
|
+
class="drb mb-3"
|
|
16
|
+
icon="mdi-delete-clock-outline"
|
|
17
|
+
data-test="drb"
|
|
18
|
+
>
|
|
19
|
+
<div class="drb__text">{{ banner.message }}</div>
|
|
20
|
+
<button type="button" class="drb__toggle" :aria-expanded="open" data-test="drb-details" @click="open = !open">
|
|
21
|
+
{{ open ? "Hide details" : "Details" }}
|
|
22
|
+
</button>
|
|
23
|
+
<div v-if="open" class="drb__details" data-test="drb-details-body">
|
|
24
|
+
<ul class="drb__list">
|
|
25
|
+
<li v-for="i in banner.items" :key="i.dataType">
|
|
26
|
+
{{ i.label }}: {{ Number(i.count).toLocaleString("en-SG") }} created before {{ day(i.cutoff) }}
|
|
27
|
+
</li>
|
|
28
|
+
</ul>
|
|
29
|
+
<div>
|
|
30
|
+
Only finished records are deleted (closed feedback and work orders, visitors who have checked out, decided
|
|
31
|
+
incident reports, past days' occurrence books). Use each list's export to keep a copy. To postpone this, contact
|
|
32
|
+
Seven365.
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</v-alert>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
/** The selected site. Anything that is not a site id shows nothing. */
|
|
41
|
+
siteId: { type: String, default: "" },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const { getDataRetentionBanner } = useDataRetention();
|
|
45
|
+
const banner = ref<Record<string, any> | null>(null);
|
|
46
|
+
const open = ref(false);
|
|
47
|
+
|
|
48
|
+
const day = (d: string) =>
|
|
49
|
+
new Date(d).toLocaleDateString("en-SG", { day: "numeric", month: "short", year: "numeric", timeZone: "Asia/Singapore" });
|
|
50
|
+
|
|
51
|
+
async function load(site: string) {
|
|
52
|
+
banner.value = null;
|
|
53
|
+
open.value = false;
|
|
54
|
+
if (!/^[a-f0-9]{24}$/i.test(site)) return;
|
|
55
|
+
try {
|
|
56
|
+
const res = await getDataRetentionBanner(site);
|
|
57
|
+
// A late answer for a site the user already left is dropped.
|
|
58
|
+
if (props.siteId === site) banner.value = res?.banner ?? null;
|
|
59
|
+
} catch {
|
|
60
|
+
// Not reachable, a resident, or an older server: no banner.
|
|
61
|
+
banner.value = null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
watch(() => props.siteId, (s) => load(s), { immediate: true });
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
.drb__text { word-break: break-word; }
|
|
70
|
+
.drb__toggle { text-decoration: underline; font-weight: 600; margin-top: 4px; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; }
|
|
71
|
+
.drb__details { margin-top: 8px; font-size: 13px; }
|
|
72
|
+
.drb__list { padding-left: 18px; margin-bottom: 6px; }
|
|
73
|
+
</style>
|
|
@@ -1,94 +1,48 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!--
|
|
3
|
-
Data retention (PDPA), per site
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
certificate. Who may change it is decided by the server (the site's owning
|
|
8
|
-
organisation, or Seven365).
|
|
3
|
+
Data retention (PDPA), per site. Since 2026-10-14 (owner) it is managed by
|
|
4
|
+
the Seven365 Super Admin in Seven365 Admin; here it is a read-only summary
|
|
5
|
+
for the site's managers: the rules, the dates, and every removal with its
|
|
6
|
+
certificate. A site that never had it switched on keeps everything, as today.
|
|
9
7
|
-->
|
|
10
8
|
<div class="sdr" data-test="sdr">
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
everything is kept.
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<v-switch
|
|
17
|
-
:model-value="enabled"
|
|
18
|
-
color="primary"
|
|
19
|
-
inset
|
|
20
|
-
hide-details
|
|
21
|
-
label="Remove old records automatically"
|
|
22
|
-
:disabled="!canEdit || saving"
|
|
23
|
-
data-test="sdr-enabled"
|
|
24
|
-
@update:model-value="onToggle"
|
|
25
|
-
/>
|
|
26
|
-
<div v-if="!canEdit" class="sdr-sub" data-test="sdr-owner-only">
|
|
27
|
-
Only the client that owns this site can change data retention.
|
|
9
|
+
<div class="sdr-managed" data-test="sdr-managed">
|
|
10
|
+
Managed by Seven365 Admin. To change how long this site keeps its records, contact Seven365.
|
|
28
11
|
</div>
|
|
29
|
-
<div class="sdr-sub">Before anything is removed, your site admins get a notice with a link to download the records.</div>
|
|
30
12
|
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
<div class="sdr-
|
|
34
|
-
|
|
35
|
-
|
|
13
|
+
<div v-if="!metadata" class="sdr-sub">Loading...</div>
|
|
14
|
+
<template v-else-if="!setting.enabled">
|
|
15
|
+
<div class="sdr-label">Off</div>
|
|
16
|
+
<div class="sdr-sub" data-test="sdr-off">Every record at this site is kept. Nothing is deleted automatically.</div>
|
|
17
|
+
</template>
|
|
18
|
+
<template v-else>
|
|
19
|
+
<div class="sdr-label">On</div>
|
|
20
|
+
<div class="sdr-sub" data-test="sdr-deletion">
|
|
21
|
+
{{
|
|
22
|
+
setting.deletionApproved
|
|
23
|
+
? "Old records are permanently deleted on the dates below."
|
|
24
|
+
: "Requested - waiting for Seven365 approval. Nothing is warned about or deleted until Seven365 approves it."
|
|
25
|
+
}}
|
|
36
26
|
</div>
|
|
37
|
-
|
|
27
|
+
|
|
28
|
+
<div class="sdr-label">How long each kind of record is kept</div>
|
|
29
|
+
<div v-for="t in RETENTION_TYPES" :key="t.value" class="sdr-row" :data-test="`sdr-rule-${t.value}`">
|
|
38
30
|
<span class="sdr-row__name">{{ t.label }}</span>
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
suffix="months"
|
|
45
|
-
density="compact"
|
|
46
|
-
variant="outlined"
|
|
47
|
-
hide-details="auto"
|
|
48
|
-
placeholder="Keep"
|
|
49
|
-
class="sdr-row__field"
|
|
50
|
-
:disabled="!canEdit || saving"
|
|
51
|
-
:rules="[monthRule]"
|
|
52
|
-
:aria-label="`Keep ${t.label} for how many months`"
|
|
53
|
-
:data-test="`sdr-months-${t.value}`"
|
|
54
|
-
/>
|
|
31
|
+
<span>{{ keep(t.value) }}</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="sdr-sub mt-2">
|
|
34
|
+
Only finished records are deleted: closed feedback and work orders, visitors who have checked out, decided
|
|
35
|
+
incident reports and past days' occurrence books.
|
|
55
36
|
</div>
|
|
56
37
|
|
|
57
|
-
<div class="sdr-label">
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
suffix="days"
|
|
64
|
-
density="compact"
|
|
65
|
-
variant="outlined"
|
|
66
|
-
hide-details="auto"
|
|
67
|
-
class="sdr-row__field"
|
|
68
|
-
:disabled="!canEdit || saving"
|
|
69
|
-
:rules="[noticeRule]"
|
|
70
|
-
aria-label="Days of notice before removal"
|
|
71
|
-
data-test="sdr-notice"
|
|
72
|
-
/>
|
|
73
|
-
<div class="sdr-sub">Between 7 and 90 days. Records are removed only after this notice.</div>
|
|
38
|
+
<div class="sdr-label">Dates</div>
|
|
39
|
+
<div class="sdr-sub">Your site admins are told {{ setting.noticeDays ?? 14 }} days before each deletion, and reminded the day before.</div>
|
|
40
|
+
<div v-if="setting.startFrom" class="sdr-sub" data-test="sdr-start">Nothing is deleted before {{ day(setting.startFrom) }}.</div>
|
|
41
|
+
<div v-if="pending" class="sdr-sub" data-test="sdr-next">
|
|
42
|
+
<strong>{{ setting.deletionApproved ? "Next deletion" : "Warning sent for" }}: {{ day(pending.dueAt) }}</strong>
|
|
43
|
+
</div>
|
|
74
44
|
</template>
|
|
75
45
|
|
|
76
|
-
<div class="sdr-actions">
|
|
77
|
-
<v-btn class="screen-btn-ghost" variant="outlined" :loading="previewing" :disabled="!enabled || !rules.length" data-test="sdr-preview" @click="runPreview">
|
|
78
|
-
Preview
|
|
79
|
-
</v-btn>
|
|
80
|
-
<v-btn class="screen-btn-primary" variant="flat" color="primary-button" :loading="saving" :disabled="!metadata || !canEdit || !valid || !dirty" data-test="sdr-save" @click="save">
|
|
81
|
-
Save
|
|
82
|
-
</v-btn>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<div v-if="preview" class="sdr-box" data-test="sdr-preview-result">
|
|
86
|
-
<div class="sdr-box__title">If this ran today, it would remove:</div>
|
|
87
|
-
<ul class="sdr-list">
|
|
88
|
-
<li v-for="i in preview.items" :key="i.dataType">{{ i.count }} {{ i.label.toLowerCase() }} created before {{ day(i.cutoff) }}</li>
|
|
89
|
-
</ul>
|
|
90
|
-
<div class="sdr-sub">Nothing is removed by Preview. The first removal comes only after the notice above.</div>
|
|
91
|
-
</div>
|
|
92
46
|
<div v-if="error" class="sdr-error" role="alert">{{ error }}</div>
|
|
93
47
|
|
|
94
48
|
<div class="sdr-label mt-6">Data removal records</div>
|
|
@@ -115,127 +69,45 @@
|
|
|
115
69
|
</v-btn>
|
|
116
70
|
</div>
|
|
117
71
|
</div>
|
|
118
|
-
|
|
119
|
-
<ConfirmDialog v-model="confirmOn">
|
|
120
|
-
<template #title>Remove old records automatically?</template>
|
|
121
|
-
<template #description>
|
|
122
|
-
Records older than the times you set will be permanently deleted at this site. Your site admins will be told
|
|
123
|
-
{{ noticeNumber }} days before each removal, with a link to download them first. Deleted records cannot be
|
|
124
|
-
brought back.
|
|
125
|
-
</template>
|
|
126
|
-
<template #footer>
|
|
127
|
-
<v-btn class="screen-btn-ghost" variant="outlined" @click="confirmOn = false">Cancel</v-btn>
|
|
128
|
-
<v-btn class="screen-btn-primary" variant="flat" color="primary-button" data-test="sdr-confirm" @click="turnOn">
|
|
129
|
-
Turn on
|
|
130
|
-
</v-btn>
|
|
131
|
-
</template>
|
|
132
|
-
</ConfirmDialog>
|
|
133
72
|
</template>
|
|
134
73
|
|
|
135
74
|
<script lang="ts" setup>
|
|
136
|
-
import { RETENTION_TYPES
|
|
75
|
+
import { RETENTION_TYPES } from "../composables/useDataRetention";
|
|
137
76
|
|
|
138
77
|
const props = defineProps({
|
|
139
78
|
siteId: { type: String, required: true },
|
|
140
|
-
/** The site's stored metadata (`{}` once read for a site with none; null = not read yet
|
|
79
|
+
/** The site's stored metadata (`{}` once read for a site with none; null = not read yet). */
|
|
141
80
|
metadata: { type: Object as PropType<Record<string, any> | null>, default: null },
|
|
142
|
-
/**
|
|
81
|
+
/** No longer used: the summary is read-only for everyone. Kept so a host that still passes it renders as before. */
|
|
143
82
|
canEdit: { type: Boolean, default: false },
|
|
144
83
|
});
|
|
145
|
-
const emit = defineEmits<{ (e: "saved"): void; (e: "error", message: string): void }>();
|
|
146
84
|
|
|
147
|
-
const {
|
|
148
|
-
const { previewDataRetention, listDataPurgeRecords, downloadDataPurgeCertificate } = useDataRetention();
|
|
85
|
+
const { listDataPurgeRecords, downloadDataPurgeCertificate } = useDataRetention();
|
|
149
86
|
|
|
150
|
-
const enabled = ref(false);
|
|
151
|
-
const months = reactive<Record<string, string | number>>({});
|
|
152
|
-
const noticeDays = ref<string | number>(14);
|
|
153
|
-
const saving = ref(false);
|
|
154
|
-
const previewing = ref(false);
|
|
155
|
-
const preview = ref<Record<string, any> | null>(null);
|
|
156
|
-
const error = ref("");
|
|
157
|
-
const confirmOn = ref(false);
|
|
158
87
|
const records = ref<Record<string, any>[]>([]);
|
|
159
88
|
const recordsLoading = ref(false);
|
|
160
89
|
const downloading = ref("");
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
function load(meta: Record<string, any> | null) {
|
|
164
|
-
const d = meta?.dataRetention ?? {};
|
|
165
|
-
enabled.value = d.enabled === true;
|
|
166
|
-
for (const t of RETENTION_TYPES) months[t.value] = "";
|
|
167
|
-
for (const r of Array.isArray(d.rules) ? d.rules : []) months[r.dataType] = r.keepMonths;
|
|
168
|
-
noticeDays.value = d.noticeDays ?? 14;
|
|
169
|
-
stored.value = JSON.stringify(value());
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const toInt = (v: unknown) => (v === "" || v === null || v === undefined ? null : Number(v));
|
|
173
|
-
const monthRule = (v: unknown) => {
|
|
174
|
-
const n = toInt(v);
|
|
175
|
-
return n === null || (Number.isInteger(n) && n >= 1 && n <= 120) || "1 to 120 months, or blank";
|
|
176
|
-
};
|
|
177
|
-
const noticeRule = (v: unknown) => {
|
|
178
|
-
const n = toInt(v);
|
|
179
|
-
return (n !== null && Number.isInteger(n) && n >= 7 && n <= 90) || "7 to 90 days";
|
|
180
|
-
};
|
|
181
|
-
const noticeNumber = computed(() => toInt(noticeDays.value) ?? 14);
|
|
182
|
-
|
|
183
|
-
const rules = computed<TRetentionRule[]>(() =>
|
|
184
|
-
RETENTION_TYPES.map((t) => ({ dataType: t.value, keepMonths: toInt(months[t.value]) as number })).filter((r) => r.keepMonths !== null),
|
|
185
|
-
);
|
|
186
|
-
const valid = computed(
|
|
187
|
-
() => RETENTION_TYPES.every((t) => monthRule(months[t.value]) === true) && (!enabled.value || noticeRule(noticeDays.value) === true),
|
|
188
|
-
);
|
|
189
|
-
function value() {
|
|
190
|
-
return enabled.value
|
|
191
|
-
? { enabled: true, rules: rules.value, noticeDays: toInt(noticeDays.value) ?? 14 }
|
|
192
|
-
: { enabled: false, rules: rules.value, ...(toInt(noticeDays.value) ? { noticeDays: toInt(noticeDays.value) } : {}) };
|
|
193
|
-
}
|
|
194
|
-
const dirty = computed(() => JSON.stringify(value()) !== stored.value);
|
|
195
|
-
|
|
196
|
-
watch(() => props.metadata, (m) => load(m), { immediate: true });
|
|
90
|
+
const error = ref("");
|
|
197
91
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
92
|
+
const setting = computed<Record<string, any>>(() => {
|
|
93
|
+
const d = props.metadata?.dataRetention;
|
|
94
|
+
return d && d.enabled === true ? d : { enabled: false };
|
|
95
|
+
});
|
|
96
|
+
const pending = computed(() => records.value.find((r) => r.status === "pending") ?? null);
|
|
202
97
|
|
|
203
|
-
function
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
else enabled.value = false;
|
|
98
|
+
function keep(type: string) {
|
|
99
|
+
const r = (setting.value.rules ?? []).find((x: any) => x.dataType === type);
|
|
100
|
+
return r ? `${r.keepMonths} month${r.keepMonths === 1 ? "" : "s"}` : "Kept";
|
|
207
101
|
}
|
|
208
102
|
|
|
209
103
|
const message = (e: any) => e?.data?.message || e?.message || "Something went wrong. Please try again.";
|
|
210
|
-
const day = (d: string) =>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
await saveSiteFeature(props.siteId, "dataRetention", value());
|
|
218
|
-
stored.value = JSON.stringify(value());
|
|
219
|
-
emit("saved");
|
|
220
|
-
} catch (e) {
|
|
221
|
-
error.value = message(e);
|
|
222
|
-
emit("error", error.value);
|
|
223
|
-
} finally {
|
|
224
|
-
saving.value = false;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
async function runPreview() {
|
|
229
|
-
previewing.value = true;
|
|
230
|
-
error.value = "";
|
|
231
|
-
try {
|
|
232
|
-
preview.value = await previewDataRetention(props.siteId, { rules: rules.value });
|
|
233
|
-
} catch (e) {
|
|
234
|
-
error.value = message(e);
|
|
235
|
-
} finally {
|
|
236
|
-
previewing.value = false;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
104
|
+
const day = (d: string) =>
|
|
105
|
+
new Date(/^\d{4}-\d{2}-\d{2}$/.test(d) ? `${d}T00:00:00+08:00` : d).toLocaleDateString("en-SG", {
|
|
106
|
+
day: "numeric",
|
|
107
|
+
month: "short",
|
|
108
|
+
year: "numeric",
|
|
109
|
+
timeZone: "Asia/Singapore",
|
|
110
|
+
});
|
|
239
111
|
|
|
240
112
|
function statusText(r: Record<string, any>) {
|
|
241
113
|
if (r.status === "pending") return `Removal planned for ${day(r.dueAt)}`;
|
|
@@ -271,16 +143,11 @@ onMounted(loadRecords);
|
|
|
271
143
|
</script>
|
|
272
144
|
|
|
273
145
|
<style scoped>
|
|
274
|
-
.sdr-
|
|
146
|
+
.sdr-managed { font-weight: 600; margin-bottom: 8px; }
|
|
275
147
|
.sdr-sub { font-size: 13px; opacity: 0.75; margin-bottom: 8px; }
|
|
276
148
|
.sdr-label { font-weight: 600; margin-top: 16px; }
|
|
277
|
-
.sdr-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
|
|
149
|
+
.sdr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
|
|
278
150
|
.sdr-row__name { flex: 1 1 160px; min-width: 140px; }
|
|
279
|
-
.sdr-row__field { flex: 0 1 180px; max-width: 180px; min-width: 140px; }
|
|
280
|
-
.sdr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
|
|
281
|
-
.sdr-box { border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 8px; padding: 12px; margin-top: 12px; }
|
|
282
|
-
.sdr-box__title { font-weight: 600; margin-bottom: 4px; }
|
|
283
|
-
.sdr-list { padding-left: 18px; margin-bottom: 6px; }
|
|
284
151
|
.sdr-error { color: rgb(var(--v-theme-error)); margin-top: 8px; }
|
|
285
152
|
.sdr-record { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.08); word-break: break-word; }
|
|
286
153
|
</style>
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
that never saved them shows "as usual" everywhere and behaves as today.
|
|
5
5
|
-->
|
|
6
6
|
<div data-test="visitor-registration-settings">
|
|
7
|
-
<v-
|
|
8
|
-
v-model="
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<v-select
|
|
8
|
+
v-model="nric"
|
|
9
|
+
:items="nricItems"
|
|
10
|
+
label="NRIC / FIN"
|
|
11
|
+
density="comfortable"
|
|
12
|
+
variant="outlined"
|
|
11
13
|
hide-details
|
|
12
14
|
:disabled="saving || !canManage"
|
|
13
15
|
data-test="visitor-fields-nric"
|
|
14
16
|
/>
|
|
15
|
-
<p class="text-caption text-medium-emphasis mb-4">
|
|
16
|
-
|
|
17
|
+
<p class="text-caption text-medium-emphasis mt-1 mb-4" data-test="visitor-fields-nric-help">
|
|
18
|
+
{{ nricHelp[nric] }} Existing records are not changed.
|
|
17
19
|
</p>
|
|
18
20
|
|
|
19
21
|
<v-select
|
|
@@ -70,6 +72,17 @@ const props = defineProps({
|
|
|
70
72
|
});
|
|
71
73
|
const emit = defineEmits<{ (e: "saved"): void; (e: "message", text: string, color: string): void }>();
|
|
72
74
|
|
|
75
|
+
const nricItems = [
|
|
76
|
+
{ title: "Ask and keep in full (as usual)", value: "default" },
|
|
77
|
+
{ title: "Ask, but keep only the last 4 characters", value: "last4" },
|
|
78
|
+
{ title: "Don't ask", value: "hidden" },
|
|
79
|
+
];
|
|
80
|
+
const nricHelp: Record<string, string> = {
|
|
81
|
+
default: "The full ID number is saved, and staff can find a returning visitor by typing it.",
|
|
82
|
+
last4:
|
|
83
|
+
"The full number is still typed at registration, but only the last 4 characters are saved (e.g. *****567A), for data protection. Returning visitors are then found by those last 4 characters, so check the name before using a suggestion.",
|
|
84
|
+
hidden: "Choose this if your site does not collect ID numbers.",
|
|
85
|
+
};
|
|
73
86
|
const contactItems = [
|
|
74
87
|
{ title: "Ask as usual", value: "default" },
|
|
75
88
|
{ title: "Don't ask", value: "hidden" },
|
|
@@ -80,7 +93,7 @@ const vehicleItems = [
|
|
|
80
93
|
{ title: "Always required", value: "required" },
|
|
81
94
|
];
|
|
82
95
|
|
|
83
|
-
const
|
|
96
|
+
const nric = ref<"default" | "hidden" | "last4">("default");
|
|
84
97
|
const contact = ref("default");
|
|
85
98
|
const vehicle = ref("default");
|
|
86
99
|
const saving = ref(false);
|
|
@@ -89,7 +102,7 @@ watch(
|
|
|
89
102
|
() => props.siteData,
|
|
90
103
|
(site) => {
|
|
91
104
|
const v = getVisitorFieldSwitches(site);
|
|
92
|
-
|
|
105
|
+
nric.value = v.nric;
|
|
93
106
|
contact.value = v.contact;
|
|
94
107
|
vehicle.value = v.vehicle;
|
|
95
108
|
},
|
|
@@ -103,7 +116,7 @@ async function save() {
|
|
|
103
116
|
saving.value = true;
|
|
104
117
|
try {
|
|
105
118
|
await saveSiteFeature(props.siteId, "visitorFields", {
|
|
106
|
-
nric:
|
|
119
|
+
nric: nric.value,
|
|
107
120
|
contact: contact.value,
|
|
108
121
|
vehicle: vehicle.value,
|
|
109
122
|
});
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
</div>
|
|
49
49
|
</v-list>
|
|
50
50
|
</v-menu>
|
|
51
|
+
<p v-if="visitorFieldSwitches.nric === 'last4'" class="text-caption text-medium-emphasis mt-1"
|
|
52
|
+
data-test="visitor-nric-last4-hint">
|
|
53
|
+
{{ NRIC_LAST4_HINT }}
|
|
54
|
+
</p>
|
|
51
55
|
</v-col>
|
|
52
56
|
</v-row>
|
|
53
57
|
</v-col>
|
|
@@ -613,7 +617,7 @@ import useUtils from "../composables/useUtils";
|
|
|
613
617
|
import useSiteSettings from "../composables/useSiteSettings";
|
|
614
618
|
import useLocalAuth from "../composables/useLocalAuth";
|
|
615
619
|
import useBuilding from "../composables/useBuilding";
|
|
616
|
-
import useVisitor, { getVisitorFieldSwitches, VEHICLE_REQUIRED_MESSAGE } from "../composables/useVisitor";
|
|
620
|
+
import useVisitor, { getVisitorFieldSwitches, NRIC_LAST4_HINT, VEHICLE_REQUIRED_MESSAGE } from "../composables/useVisitor";
|
|
617
621
|
import useSiteEntryPassSettings from "../composables/useSiteEntryPassSettings";
|
|
618
622
|
import useAccessManagement from "../composables/useAccessManagement";
|
|
619
623
|
import usePeople from "../composables/usePeople";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PDPA data retention per site (`/api/data-retention`, API-core). The setting
|
|
3
|
-
* itself is one site switch (`metadata.dataRetention
|
|
3
|
+
* itself is one site switch (`metadata.dataRetention`), managed by the Seven365
|
|
4
|
+
* Super Admin in Seven365 Admin since 2026-10-14; the apps only read it.
|
|
4
5
|
* Documents are not part of data retention in this version.
|
|
5
6
|
*/
|
|
6
7
|
export type TRetentionRule = { dataType: string; keepMonths: number };
|
|
@@ -39,5 +40,10 @@ export default function useDataRetention() {
|
|
|
39
40
|
window.URL.revokeObjectURL(url);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
/** A scheduled removal at the site, for the people who work it (`{ banner: null }` when none). */
|
|
44
|
+
function getDataRetentionBanner(site: string) {
|
|
45
|
+
return api()<{ banner: Record<string, any> | null }>("/api/data-retention/banner", { method: "GET", query: { site } });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { previewDataRetention, listDataPurgeRecords, downloadDataPurgeCertificate, getDataRetentionBanner };
|
|
43
49
|
}
|
|
@@ -279,7 +279,7 @@ export default function () {
|
|
|
279
279
|
* Anything a site never saved reads as "default" = today's form.
|
|
280
280
|
*/
|
|
281
281
|
export type TVisitorFieldSwitches = {
|
|
282
|
-
nric: "default" | "hidden";
|
|
282
|
+
nric: "default" | "hidden" | "last4";
|
|
283
283
|
contact: "default" | "hidden" | "required";
|
|
284
284
|
vehicle: "default" | "required";
|
|
285
285
|
};
|
|
@@ -287,11 +287,14 @@ export type TVisitorFieldSwitches = {
|
|
|
287
287
|
export function getVisitorFieldSwitches(site: any): TVisitorFieldSwitches {
|
|
288
288
|
const v = site?.metadata?.visitorFields ?? {};
|
|
289
289
|
return {
|
|
290
|
-
nric: v.nric === "hidden"
|
|
290
|
+
nric: v.nric === "hidden" || v.nric === "last4" ? v.nric : "default",
|
|
291
291
|
contact: v.contact === "hidden" || v.contact === "required" ? v.contact : "default",
|
|
292
292
|
vehicle: v.vehicle === "required" ? "required" : "default",
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
/** Shown under the NRIC field on a "keep only the last 4" site. */
|
|
297
|
+
export const NRIC_LAST4_HINT = "Only the last 4 characters will be kept.";
|
|
298
|
+
|
|
296
299
|
/** Same words as the server's refusal, so the guard reads one message. */
|
|
297
300
|
export const VEHICLE_REQUIRED_MESSAGE = "This site requires a vehicle number for every visitor.";
|
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.547",
|
|
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.",
|
|
@@ -214,6 +214,18 @@ const SITE_PAGES: Record<string, TSitePage[]> = {
|
|
|
214
214
|
* opened nothing at all. Adding it repairs those too, not only the new alerts.
|
|
215
215
|
*/
|
|
216
216
|
"security-ops": [{ apps: ["security"], page: () => "security-ops" }],
|
|
217
|
+
/**
|
|
218
|
+
* Security Ops: a client meeting was scheduled, moved or called off, or one
|
|
219
|
+
* is happening today.
|
|
220
|
+
*
|
|
221
|
+
* ITS OWN KIND, NOT `security-ops`, because the two land in different places:
|
|
222
|
+
* an action belongs to the register and a meeting belongs to the meeting
|
|
223
|
+
* record. The web has no per-meeting page, so this opens Ops Review, where
|
|
224
|
+
* the meetings tab lists them; the phone, which does have one, opens the
|
|
225
|
+
* meeting itself. Same kind, different answer per surface, which is what this
|
|
226
|
+
* table is for.
|
|
227
|
+
*/
|
|
228
|
+
"client-meeting": [{ apps: ["security"], page: () => "security-ops" }],
|
|
217
229
|
};
|
|
218
230
|
SITE_PAGES.myVisitors = SITE_PAGES.visitors;
|
|
219
231
|
|