@7365admin1/layer-common 4.5.0 → 4.5.1-staging.293
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/Facility/BookingSetup.vue +63 -0
- package/components/HidIntercomManagement.vue +145 -42
- package/components/HidUserEnrollment.vue +712 -147
- package/components/InvitationClientForm.vue +19 -1
- package/components/RolePermissionFormCreate.vue +110 -13
- package/components/RolePermissionFormPreviewUpdate.vue +99 -13
- package/components/VisitorManagement.vue +267 -5
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +24 -0
- package/composables/useHidNavigation.ts +16 -0
- package/composables/usePeople.ts +19 -0
- package/package.json +1 -1
- package/types/facility.d.ts +4 -0
- package/utils/materialSymbols.ts +3 -0
|
@@ -251,9 +251,27 @@ watch(
|
|
|
251
251
|
const roles = ref<any[]>([])
|
|
252
252
|
const { getRoles } = useRole()
|
|
253
253
|
|
|
254
|
+
/*
|
|
255
|
+
* `type` is the ROLE type, not the service the client subscribes to, and the
|
|
256
|
+
* only caller (`ClientMain.vue` "Invite Client") passes no `app` prop -- so
|
|
257
|
+
* this sent `type: ""` and the endpoint applied no type filter at all. The
|
|
258
|
+
* dropdown therefore listed every org-less role of every type, which includes
|
|
259
|
+
* the platform's OWN staff roles (`type: "admin"` -- the two rows the console's
|
|
260
|
+
* `/super-admin/role-permissions` screen edits). Offering a Seven365 console
|
|
261
|
+
* staff role on a CLIENT invitation is the defect.
|
|
262
|
+
*
|
|
263
|
+
* A client admin's role is `type: "organization"`, which is what the client
|
|
264
|
+
* roles screen (`org/[organization]/roles-permissions.vue`) already lists. This
|
|
265
|
+
* narrows to exactly that. It is a narrowing of this one picker only: no role
|
|
266
|
+
* changes, no permission changes, and the org-less `organization` roles that
|
|
267
|
+
* were already being picked are all still offered.
|
|
268
|
+
*
|
|
269
|
+
* Keying off the selected service instead would empty the dropdown -- no
|
|
270
|
+
* org-less role carries a service type -- so `props.app` is not the filter.
|
|
271
|
+
*/
|
|
254
272
|
const { data: roleData, refresh: refreshRoles } = await useLazyAsyncData(
|
|
255
273
|
"roles",
|
|
256
|
-
() => getRoles({ org: org.value?._id, type:
|
|
274
|
+
() => getRoles({ org: org.value?._id, type: "organization", limit: 50 }),
|
|
257
275
|
{ watch: [() => props.app] }
|
|
258
276
|
)
|
|
259
277
|
|
|
@@ -46,10 +46,38 @@
|
|
|
46
46
|
</AppButton>
|
|
47
47
|
</v-col>
|
|
48
48
|
|
|
49
|
+
<v-col cols="12">
|
|
50
|
+
<!--
|
|
51
|
+
R5: a client builds a role out of up to 47 modules in a modal.
|
|
52
|
+
Matches the NAMES a person reads as well as the raw keys, so
|
|
53
|
+
"statements" and "soa" both find `SOA-mgmt`.
|
|
54
|
+
|
|
55
|
+
Display only - a permission ticked and then filtered out of view
|
|
56
|
+
is still ticked and still saved.
|
|
57
|
+
-->
|
|
58
|
+
<v-text-field
|
|
59
|
+
v-model="moduleSearch"
|
|
60
|
+
class="filter-field"
|
|
61
|
+
density="comfortable"
|
|
62
|
+
placeholder="Search modules and permissions"
|
|
63
|
+
prepend-inner-icon="mdi-magnify"
|
|
64
|
+
clearable
|
|
65
|
+
hide-details
|
|
66
|
+
/>
|
|
67
|
+
</v-col>
|
|
68
|
+
|
|
49
69
|
<v-col cols="12" class="mt-3">
|
|
50
70
|
<div class="role-create__list">
|
|
71
|
+
<div
|
|
72
|
+
v-if="!hasVisiblePermissions"
|
|
73
|
+
class="pa-6 text-center text-body-2 text-medium-emphasis"
|
|
74
|
+
>
|
|
75
|
+
No module matches “{{ moduleSearch }}”. Anything you
|
|
76
|
+
have already ticked is still selected and will still be saved.
|
|
77
|
+
</div>
|
|
78
|
+
|
|
51
79
|
<template
|
|
52
|
-
v-for="(actions, resourceKey, resourceIndex) in
|
|
80
|
+
v-for="(actions, resourceKey, resourceIndex) in visiblePermissions"
|
|
53
81
|
:key="resourceKey"
|
|
54
82
|
>
|
|
55
83
|
<v-divider v-if="resourceIndex > 0" />
|
|
@@ -235,27 +263,44 @@ function toggleAction(resource: string, action: string, value: boolean | null) {
|
|
|
235
263
|
}
|
|
236
264
|
|
|
237
265
|
function toggleSelectAll(value: boolean) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
266
|
+
/*
|
|
267
|
+
* Select All acts on what is SHOWN. With no search that is the whole
|
|
268
|
+
* catalogue, so this is unchanged for every screen that works today; with a
|
|
269
|
+
* search active it does what the words on the button say.
|
|
270
|
+
*
|
|
271
|
+
* Unselect All is the half that matters: it used to write `selected: []`,
|
|
272
|
+
* which with a search active would silently discard every tick outside the
|
|
273
|
+
* filter. It now removes only the visible keys.
|
|
274
|
+
*/
|
|
275
|
+
const perms = visiblePermissions.value;
|
|
244
276
|
if (!perms) return;
|
|
245
277
|
|
|
246
|
-
const
|
|
247
|
-
const
|
|
278
|
+
const visibleKeys: string[] = [];
|
|
279
|
+
const visibleResources: string[] = [];
|
|
248
280
|
|
|
249
281
|
for (const [resource, actions] of Object.entries(perms)) {
|
|
250
282
|
if (!resource || !actions || typeof actions !== "object") continue;
|
|
251
|
-
|
|
283
|
+
visibleResources.push(resource);
|
|
252
284
|
for (const action of Object.keys(actions)) {
|
|
253
|
-
if (action)
|
|
285
|
+
if (action) visibleKeys.push(`${resource}:${action}`);
|
|
254
286
|
}
|
|
255
287
|
}
|
|
256
288
|
|
|
289
|
+
const { selected, enabled } = permState.value;
|
|
290
|
+
|
|
291
|
+
if (!value) {
|
|
292
|
+
permState.value = {
|
|
293
|
+
selected: selected.filter((key) => !visibleKeys.includes(key)),
|
|
294
|
+
enabled: enabled.filter((resource) => !visibleResources.includes(resource)),
|
|
295
|
+
};
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
257
299
|
// 1 assignment to trigger reactivity only once
|
|
258
|
-
permState.value = {
|
|
300
|
+
permState.value = {
|
|
301
|
+
selected: [...new Set([...selected, ...visibleKeys])],
|
|
302
|
+
enabled: [...new Set([...enabled, ...visibleResources])],
|
|
303
|
+
};
|
|
259
304
|
}
|
|
260
305
|
|
|
261
306
|
const siteName = ref("");
|
|
@@ -307,10 +352,61 @@ async function submit() {
|
|
|
307
352
|
function cancel() {
|
|
308
353
|
name.value = "";
|
|
309
354
|
permState.value = { selected: [], enabled: [] };
|
|
355
|
+
// A query left behind would greet the next person with a filtered list and
|
|
356
|
+
// no obvious reason for it.
|
|
357
|
+
moduleSearch.value = "";
|
|
310
358
|
message.value = "";
|
|
311
359
|
emit("cancel");
|
|
312
360
|
}
|
|
313
361
|
|
|
362
|
+
/*
|
|
363
|
+
* FINDING A MODULE IN A LIST OF 47 — owner requirement R5, 2026-09-10.
|
|
364
|
+
*
|
|
365
|
+
* A client builds a role out of the whole catalogue: up to 47 modules and about
|
|
366
|
+
* 127 actions, in a modal. Production has 238 distinct role names across 390
|
|
367
|
+
* roles, every one assembled by scrolling that list.
|
|
368
|
+
*
|
|
369
|
+
* The search matches the NAMES a person reads (`formatResourceLabel` /
|
|
370
|
+
* `formatActionLabel`) as well as the raw keys, so typing "statements" finds
|
|
371
|
+
* `SOA-mgmt` and typing "soa" finds it too.
|
|
372
|
+
*
|
|
373
|
+
* ## It filters the DISPLAY only
|
|
374
|
+
*
|
|
375
|
+
* `permState.selected` is what gets saved (`permissions: permState.value.selected`),
|
|
376
|
+
* and the search never touches it. A permission ticked and then filtered out of
|
|
377
|
+
* view is still ticked and still saved — losing a tick because somebody typed in
|
|
378
|
+
* a box would be far worse than the scrolling this replaces.
|
|
379
|
+
*/
|
|
380
|
+
const moduleSearch = ref("");
|
|
381
|
+
|
|
382
|
+
/** `safePermissions`, narrowed to what the search box matches. */
|
|
383
|
+
const visiblePermissions = computed(() => {
|
|
384
|
+
const query = moduleSearch.value.trim().toLowerCase();
|
|
385
|
+
const all = safePermissions.value;
|
|
386
|
+
if (!query) return all;
|
|
387
|
+
|
|
388
|
+
const matches: Record<string, any> = {};
|
|
389
|
+
for (const [resource, actions] of Object.entries(all)) {
|
|
390
|
+
const haystack = [
|
|
391
|
+
resource,
|
|
392
|
+
formatResourceLabel(resource),
|
|
393
|
+
...Object.keys(actions ?? {}).flatMap((action) => [
|
|
394
|
+
action,
|
|
395
|
+
formatActionLabel(action),
|
|
396
|
+
]),
|
|
397
|
+
]
|
|
398
|
+
.join(" ")
|
|
399
|
+
.toLowerCase();
|
|
400
|
+
|
|
401
|
+
if (haystack.includes(query)) matches[resource] = actions;
|
|
402
|
+
}
|
|
403
|
+
return matches;
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
const hasVisiblePermissions = computed(
|
|
407
|
+
() => Object.keys(visiblePermissions.value).length > 0
|
|
408
|
+
);
|
|
409
|
+
|
|
314
410
|
const safePermissions = computed(() => {
|
|
315
411
|
const p = props.permissions || {};
|
|
316
412
|
const cleaned: Record<string, any> = {};
|
|
@@ -327,7 +423,8 @@ const safePermissions = computed(() => {
|
|
|
327
423
|
});
|
|
328
424
|
|
|
329
425
|
const isAllSelected = computed(() => {
|
|
330
|
-
|
|
426
|
+
// The VISIBLE set, so the button's label describes the button's effect.
|
|
427
|
+
const perms = visiblePermissions.value;
|
|
331
428
|
const allKeys: string[] = [];
|
|
332
429
|
|
|
333
430
|
Object.entries(perms).forEach(([resource, actions]) => {
|
|
@@ -15,9 +15,32 @@
|
|
|
15
15
|
>
|
|
16
16
|
{{ isAllSelected ? "Unselect All" : "Select All" }}
|
|
17
17
|
</AppButton>
|
|
18
|
+
<!--
|
|
19
|
+
R5: the same search the create dialog has. Display only - a
|
|
20
|
+
permission ticked and then filtered out of view is still ticked
|
|
21
|
+
and still saved.
|
|
22
|
+
-->
|
|
23
|
+
<v-text-field
|
|
24
|
+
v-model="moduleSearch"
|
|
25
|
+
class="filter-field mb-2"
|
|
26
|
+
density="comfortable"
|
|
27
|
+
placeholder="Search modules and permissions"
|
|
28
|
+
prepend-inner-icon="mdi-magnify"
|
|
29
|
+
clearable
|
|
30
|
+
hide-details
|
|
31
|
+
/>
|
|
32
|
+
|
|
18
33
|
<div class="role-perm__list">
|
|
34
|
+
<div
|
|
35
|
+
v-if="!hasVisiblePermissions"
|
|
36
|
+
class="pa-6 text-center text-body-2 text-medium-emphasis"
|
|
37
|
+
>
|
|
38
|
+
No module matches “{{ moduleSearch }}”. Anything this
|
|
39
|
+
role already holds is untouched and will still be saved.
|
|
40
|
+
</div>
|
|
41
|
+
|
|
19
42
|
<template
|
|
20
|
-
v-for="(actions, resourceKey, resourceIndex) in
|
|
43
|
+
v-for="(actions, resourceKey, resourceIndex) in visiblePermissions"
|
|
21
44
|
:key="resourceKey"
|
|
22
45
|
>
|
|
23
46
|
<v-divider v-if="resourceIndex > 0" />
|
|
@@ -233,11 +256,60 @@ function toggleAction(resource: string, action: string, value: boolean | null) {
|
|
|
233
256
|
|
|
234
257
|
const safePermissions = computed(() => props.permissions || {});
|
|
235
258
|
|
|
259
|
+
/*
|
|
260
|
+
* FINDING A MODULE IN A LIST OF 47 — owner requirement R5, 2026-09-10. The same
|
|
261
|
+
* search the create dialog has, and deliberately the same rule: the two dialogs
|
|
262
|
+
* render the same tree, and a client who learns one must not find the other
|
|
263
|
+
* behaving differently.
|
|
264
|
+
*
|
|
265
|
+
* Matches the NAMES a person reads as well as the raw keys, so "statements" and
|
|
266
|
+
* "soa" both find `SOA-mgmt`.
|
|
267
|
+
*
|
|
268
|
+
* FILTERS THE DISPLAY ONLY. `definedModel` is what gets saved, and the search
|
|
269
|
+
* never touches it — a permission ticked and then filtered out of view is still
|
|
270
|
+
* ticked and still saved. That matters more here than in the create dialog:
|
|
271
|
+
* this one is editing a role somebody already relies on.
|
|
272
|
+
*/
|
|
273
|
+
const moduleSearch = ref("");
|
|
274
|
+
|
|
275
|
+
const visiblePermissions = computed(() => {
|
|
276
|
+
const query = moduleSearch.value.trim().toLowerCase();
|
|
277
|
+
const all = safePermissions.value;
|
|
278
|
+
if (!query) return all;
|
|
279
|
+
|
|
280
|
+
const matches: Record<string, any> = {};
|
|
281
|
+
for (const [resource, actions] of Object.entries(all)) {
|
|
282
|
+
const haystack = [
|
|
283
|
+
resource,
|
|
284
|
+
formatResourceLabel(resource),
|
|
285
|
+
...Object.keys((actions as Record<string, unknown>) ?? {}).flatMap(
|
|
286
|
+
(action) => [action, formatActionLabel(action)]
|
|
287
|
+
),
|
|
288
|
+
]
|
|
289
|
+
.join(" ")
|
|
290
|
+
.toLowerCase();
|
|
291
|
+
|
|
292
|
+
if (haystack.includes(query)) matches[resource] = actions;
|
|
293
|
+
}
|
|
294
|
+
return matches;
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
const hasVisiblePermissions = computed(
|
|
298
|
+
() => Object.keys(visiblePermissions.value).length > 0
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
/** The `resource:action` keys currently on screen. */
|
|
302
|
+
const visibleKeys = computed(() =>
|
|
303
|
+
Object.entries(visiblePermissions.value).flatMap(([resource, actions]) =>
|
|
304
|
+
Object.keys((actions as Record<string, unknown>) || {}).map(
|
|
305
|
+
(action) => `${resource}:${action}`
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
);
|
|
309
|
+
|
|
236
310
|
const isAllSelected = computed(() => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
Object.keys(actions || {}).map((action) => `${resource}:${action}`)
|
|
240
|
-
);
|
|
311
|
+
// The VISIBLE set, so the button's label describes the button's effect.
|
|
312
|
+
const keys = visibleKeys.value;
|
|
241
313
|
return (
|
|
242
314
|
keys.length > 0 &&
|
|
243
315
|
keys.every((key) => holdsPermission(definedModel.value, key))
|
|
@@ -245,17 +317,31 @@ const isAllSelected = computed(() => {
|
|
|
245
317
|
});
|
|
246
318
|
|
|
247
319
|
function toggleSelectAll(value: boolean) {
|
|
320
|
+
/*
|
|
321
|
+
* Acts on what is SHOWN. With no search that is the whole catalogue, so this
|
|
322
|
+
* is unchanged for every screen that works today.
|
|
323
|
+
*
|
|
324
|
+
* Unselect All is the half that matters: it used to write `[]`, which with a
|
|
325
|
+
* search active would silently discard every permission the role holds
|
|
326
|
+
* outside the filter — on a role somebody is already using.
|
|
327
|
+
*/
|
|
328
|
+
const keys = visibleKeys.value;
|
|
329
|
+
const resources = Object.keys(visiblePermissions.value);
|
|
330
|
+
|
|
248
331
|
if (!value) {
|
|
249
|
-
definedModel.value =
|
|
250
|
-
|
|
332
|
+
definedModel.value = definedModel.value.filter(
|
|
333
|
+
(key) => !keys.includes(key)
|
|
334
|
+
);
|
|
335
|
+
expandedResources.value = expandedResources.value.filter(
|
|
336
|
+
(resource) => !resources.includes(resource)
|
|
337
|
+
);
|
|
251
338
|
return;
|
|
252
339
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
expandedResources.value = Object.keys(safePermissions.value);
|
|
340
|
+
|
|
341
|
+
definedModel.value = [...new Set([...definedModel.value, ...keys])];
|
|
342
|
+
expandedResources.value = [
|
|
343
|
+
...new Set([...expandedResources.value, ...resources]),
|
|
344
|
+
];
|
|
259
345
|
}
|
|
260
346
|
|
|
261
347
|
const emit = defineEmits(["success", "cancel"]);
|
|
@@ -742,11 +742,35 @@
|
|
|
742
742
|
class="visitor-preview__row"
|
|
743
743
|
>
|
|
744
744
|
<div class="visitor-preview__label">{{ label }}</div>
|
|
745
|
-
<div
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
745
|
+
<div>
|
|
746
|
+
<!-- Was a hover tooltip on the value: the full NRIC only
|
|
747
|
+
reachable by hovering, which says nothing is there to
|
|
748
|
+
reach and cannot be reached at all on a touch screen.
|
|
749
|
+
The eye alone, at the 14px the Incident Report screens
|
|
750
|
+
draw it, is a 14px target - the floor is 24px. So the
|
|
751
|
+
NUMBER is the control and the eye is its affordance:
|
|
752
|
+
the whole masked value is pressable, which makes the
|
|
753
|
+
target the width of the digits rather than of a glyph,
|
|
754
|
+
and being a real `button` it also takes a tab stop,
|
|
755
|
+
which a `v-icon` with a click handler never did. -->
|
|
756
|
+
<button
|
|
757
|
+
type="button"
|
|
758
|
+
class="visitor-preview__reveal"
|
|
759
|
+
:aria-label="showVisitorNric ? 'Hide NRIC' : 'Show NRIC'"
|
|
760
|
+
:aria-pressed="showVisitorNric"
|
|
761
|
+
@click="showVisitorNric = !showVisitorNric"
|
|
762
|
+
>
|
|
763
|
+
<span class="visitor-preview__value">
|
|
764
|
+
{{
|
|
765
|
+
showVisitorNric
|
|
766
|
+
? selectedVisitorObject[key]
|
|
767
|
+
: maskNRIC(selectedVisitorObject[key])
|
|
768
|
+
}}
|
|
769
|
+
</span>
|
|
770
|
+
<v-icon size="16" class="visitor-preview__eye">
|
|
771
|
+
{{ showVisitorNric ? "mdi-eye-off-outline" : "mdi-eye-outline" }}
|
|
772
|
+
</v-icon>
|
|
773
|
+
</button>
|
|
750
774
|
</div>
|
|
751
775
|
</div>
|
|
752
776
|
|
|
@@ -796,6 +820,84 @@
|
|
|
796
820
|
</div>
|
|
797
821
|
</div>
|
|
798
822
|
|
|
823
|
+
<!--
|
|
824
|
+
THE CONTRACTOR'S PARTY.
|
|
825
|
+
|
|
826
|
+
The list row has always said `( +2 members)` beside the name
|
|
827
|
+
and then had nowhere to send you for the names themselves. The
|
|
828
|
+
block spans both columns rather than sitting in the 116px
|
|
829
|
+
value track: a member is a record, not a value, and several of
|
|
830
|
+
them in a 250px column is unreadable.
|
|
831
|
+
|
|
832
|
+
Read off `selectedVisitorDataObject` (the raw row) and not
|
|
833
|
+
`selectedVisitorObject`, which filters itself down to
|
|
834
|
+
`typeFieldMap` plus five fixed keys - `members` is on neither
|
|
835
|
+
list, and widening that computed would change what four other
|
|
836
|
+
dialogs on this screen see.
|
|
837
|
+
-->
|
|
838
|
+
<div
|
|
839
|
+
v-else-if="key === 'members' && selectedVisitorMembers.length"
|
|
840
|
+
class="visitor-preview__row visitor-preview__row--block"
|
|
841
|
+
>
|
|
842
|
+
<div class="visitor-preview__label">
|
|
843
|
+
{{ label }} ({{ selectedVisitorMembers.length }})
|
|
844
|
+
</div>
|
|
845
|
+
<div class="visitor-preview__members">
|
|
846
|
+
<div
|
|
847
|
+
v-for="(member, index) in selectedVisitorMembers"
|
|
848
|
+
:key="member?.nric || member?.name || index"
|
|
849
|
+
class="visitor-preview__member"
|
|
850
|
+
>
|
|
851
|
+
<div class="visitor-preview__value">
|
|
852
|
+
{{ member?.name || "N/A" }}
|
|
853
|
+
</div>
|
|
854
|
+
<template v-for="field in memberDetailFields" :key="field.key">
|
|
855
|
+
<div
|
|
856
|
+
v-if="member?.[field.key]"
|
|
857
|
+
class="visitor-preview__member-line"
|
|
858
|
+
>
|
|
859
|
+
<span class="visitor-preview__member-key">
|
|
860
|
+
{{ field.label }}
|
|
861
|
+
</span>
|
|
862
|
+
<!-- A member's NRIC is the same class of data as the
|
|
863
|
+
visitor's, so it gets the same control. Each
|
|
864
|
+
member reveals separately - one toggle for the
|
|
865
|
+
whole card would show three people's NRICs to
|
|
866
|
+
read one. -->
|
|
867
|
+
<button
|
|
868
|
+
v-if="field.key === 'nric'"
|
|
869
|
+
type="button"
|
|
870
|
+
class="visitor-preview__reveal"
|
|
871
|
+
:aria-label="
|
|
872
|
+
isMemberNricShown(index)
|
|
873
|
+
? `Hide NRIC for ${member?.name || 'this member'}`
|
|
874
|
+
: `Show NRIC for ${member?.name || 'this member'}`
|
|
875
|
+
"
|
|
876
|
+
:aria-pressed="isMemberNricShown(index)"
|
|
877
|
+
@click="toggleMemberNric(index)"
|
|
878
|
+
>
|
|
879
|
+
<span>
|
|
880
|
+
{{
|
|
881
|
+
isMemberNricShown(index)
|
|
882
|
+
? member.nric
|
|
883
|
+
: maskNRIC(member.nric)
|
|
884
|
+
}}
|
|
885
|
+
</span>
|
|
886
|
+
<v-icon size="16" class="visitor-preview__eye">
|
|
887
|
+
{{
|
|
888
|
+
isMemberNricShown(index)
|
|
889
|
+
? "mdi-eye-off-outline"
|
|
890
|
+
: "mdi-eye-outline"
|
|
891
|
+
}}
|
|
892
|
+
</v-icon>
|
|
893
|
+
</button>
|
|
894
|
+
<span v-else>{{ member[field.key] }}</span>
|
|
895
|
+
</div>
|
|
896
|
+
</template>
|
|
897
|
+
</div>
|
|
898
|
+
</div>
|
|
899
|
+
</div>
|
|
900
|
+
|
|
799
901
|
<div
|
|
800
902
|
v-else-if="selectedVisitorObject[key]"
|
|
801
903
|
class="visitor-preview__row"
|
|
@@ -1898,6 +2000,71 @@ const isSelectedVisitorPendingApproval = computed(
|
|
|
1898
2000
|
() => selectedVisitorStatus.value === "pending"
|
|
1899
2001
|
);
|
|
1900
2002
|
|
|
2003
|
+
/**
|
|
2004
|
+
* The members a contractor brought with them. Not gated on the Guests tab: the
|
|
2005
|
+
* list row's own `( +N members)` count is not either, and a contractor with a
|
|
2006
|
+
* party has one wherever the screen shows it.
|
|
2007
|
+
*
|
|
2008
|
+
* Blank entries are dropped rather than drawn as an empty card - the payload
|
|
2009
|
+
* carries `""` for every detail nobody filled in, so a member with no name and
|
|
2010
|
+
* no details would otherwise render as a bare inset box.
|
|
2011
|
+
*/
|
|
2012
|
+
const selectedVisitorMembers = computed<Record<string, any>[]>(() => {
|
|
2013
|
+
const members = selectedVisitorDataObject.value?.members;
|
|
2014
|
+
if (!Array.isArray(members)) return [];
|
|
2015
|
+
|
|
2016
|
+
return members.filter(
|
|
2017
|
+
(member: Record<string, any>) =>
|
|
2018
|
+
member?.name || member?.nric || member?.contact || member?.plateNumber
|
|
2019
|
+
);
|
|
2020
|
+
});
|
|
2021
|
+
|
|
2022
|
+
/**
|
|
2023
|
+
* WHICH NRICs ARE UNCOVERED RIGHT NOW.
|
|
2024
|
+
*
|
|
2025
|
+
* Per member and not per card, so revealing one person's number does not
|
|
2026
|
+
* uncover the rest of the party's. Both are cleared when the dialog closes -
|
|
2027
|
+
* a preview must not open on the next visitor with the last one's NRIC
|
|
2028
|
+
* already showing, and it is the same `selectedVisitorId` that would carry it
|
|
2029
|
+
* across if the same row were reopened.
|
|
2030
|
+
*/
|
|
2031
|
+
const showVisitorNric = ref(false);
|
|
2032
|
+
const shownMemberNrics = ref<number[]>([]);
|
|
2033
|
+
|
|
2034
|
+
function isMemberNricShown(index: number) {
|
|
2035
|
+
return shownMemberNrics.value.includes(index);
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
function toggleMemberNric(index: number) {
|
|
2039
|
+
shownMemberNrics.value = isMemberNricShown(index)
|
|
2040
|
+
? shownMemberNrics.value.filter((x) => x !== index)
|
|
2041
|
+
: [...shownMemberNrics.value, index];
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
watch(
|
|
2045
|
+
() => dialog.viewVisitor,
|
|
2046
|
+
(open) => {
|
|
2047
|
+
if (open) return;
|
|
2048
|
+
showVisitorNric.value = false;
|
|
2049
|
+
shownMemberNrics.value = [];
|
|
2050
|
+
}
|
|
2051
|
+
);
|
|
2052
|
+
|
|
2053
|
+
/**
|
|
2054
|
+
* What a member row prints under the name, in order. `plateNumber` is in here
|
|
2055
|
+
* because the API returns it on `members[]` even though neither
|
|
2056
|
+
* `TMemberInfo` (this package) nor `TContractorMembers` (API-core's visitor
|
|
2057
|
+
* model, name and nric only) declares it - the two types have drifted from the
|
|
2058
|
+
* document and from each other. Reading the key defensively costs nothing and
|
|
2059
|
+
* shows the vehicle a member actually arrived in; the types are somebody's to
|
|
2060
|
+
* reconcile separately.
|
|
2061
|
+
*/
|
|
2062
|
+
const memberDetailFields = [
|
|
2063
|
+
{ key: "nric", label: "NRIC" },
|
|
2064
|
+
{ key: "contact", label: "Contact" },
|
|
2065
|
+
{ key: "plateNumber", label: "Vehicle" },
|
|
2066
|
+
] as const;
|
|
2067
|
+
|
|
1901
2068
|
const formatType = (item: any) =>
|
|
1902
2069
|
(item.deliveryType ? item.deliveryType + "-" : "") + item.type;
|
|
1903
2070
|
|
|
@@ -1911,6 +2078,7 @@ const formattedFields = {
|
|
|
1911
2078
|
level: "Level",
|
|
1912
2079
|
unit: "Unit",
|
|
1913
2080
|
purpose: "Purpose",
|
|
2081
|
+
members: "Members",
|
|
1914
2082
|
checkIn: "Check In",
|
|
1915
2083
|
snapshotEntryImage: "Entry Image",
|
|
1916
2084
|
checkOut: "Check Out",
|
|
@@ -2889,6 +3057,100 @@ watchEffect(async () => {
|
|
|
2889
3057
|
word-break: break-word;
|
|
2890
3058
|
}
|
|
2891
3059
|
|
|
3060
|
+
/* A row whose value is a set of records rather than a value - it drops the
|
|
3061
|
+
two-column grid and runs the full width of the card body. */
|
|
3062
|
+
.visitor-preview__row--block {
|
|
3063
|
+
display: block;
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
.visitor-preview__members {
|
|
3067
|
+
display: flex;
|
|
3068
|
+
flex-direction: column;
|
|
3069
|
+
gap: 8px;
|
|
3070
|
+
margin-top: 8px;
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
/*
|
|
3074
|
+
* An added member reads as an inset on the card it sits in - `--hover` on
|
|
3075
|
+
* `--border` at the inner radius. Those are `Card/MemberInfoSummary`'s three
|
|
3076
|
+
* decisions, unchanged, so a member looks the same in the preview as it does
|
|
3077
|
+
* in the form that created it. Only the TYPE differs: that card still prints
|
|
3078
|
+
* `<strong>Label:</strong> value`, which is the pattern this dialog just moved
|
|
3079
|
+
* off, so the lines below are set on the scale rather than inherited.
|
|
3080
|
+
*/
|
|
3081
|
+
.visitor-preview__member {
|
|
3082
|
+
padding: 9px 12px;
|
|
3083
|
+
border: 1px solid var(--border);
|
|
3084
|
+
border-radius: var(--r-inner);
|
|
3085
|
+
background: var(--hover);
|
|
3086
|
+
}
|
|
3087
|
+
|
|
3088
|
+
.visitor-preview__member-line {
|
|
3089
|
+
display: flex;
|
|
3090
|
+
gap: 8px;
|
|
3091
|
+
margin-top: 3px;
|
|
3092
|
+
font-size: var(--fs-breadcrumb);
|
|
3093
|
+
color: var(--text2);
|
|
3094
|
+
word-break: break-word;
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
.visitor-preview__member-key {
|
|
3098
|
+
flex: 0 0 52px;
|
|
3099
|
+
color: var(--muted);
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
/*
|
|
3103
|
+
* THE NRIC REVEAL.
|
|
3104
|
+
*
|
|
3105
|
+
* The pressable thing is the masked number, not the glyph beside it: an eye on
|
|
3106
|
+
* its own is a 14-16px target where 24px is the floor, and on a 12.5px member
|
|
3107
|
+
* line an `AppButton variant="icon"` - the layer's 32px icon square - would
|
|
3108
|
+
* make the NRIC line half again the height of the Contact line under it.
|
|
3109
|
+
* Pressing the digits gives a target the width of the value at no cost to the
|
|
3110
|
+
* rhythm, and reads the right way round: the number is what changes.
|
|
3111
|
+
*
|
|
3112
|
+
* It inherits its type rather than setting any, so the visitor's NRIC stays on
|
|
3113
|
+
* `--fs-cell` and a member's on the `--fs-breadcrumb` of the line it sits in.
|
|
3114
|
+
* The negative margin pays back the padding, so a revealed value starts on the
|
|
3115
|
+
* same left edge as every other value in the card.
|
|
3116
|
+
*/
|
|
3117
|
+
.visitor-preview__reveal {
|
|
3118
|
+
display: inline-flex;
|
|
3119
|
+
align-items: center;
|
|
3120
|
+
gap: 6px;
|
|
3121
|
+
margin: -3px -7px;
|
|
3122
|
+
padding: 3px 7px;
|
|
3123
|
+
border: none;
|
|
3124
|
+
border-radius: var(--r-inner-sm);
|
|
3125
|
+
background: transparent;
|
|
3126
|
+
font: inherit;
|
|
3127
|
+
color: inherit;
|
|
3128
|
+
text-align: left;
|
|
3129
|
+
cursor: pointer;
|
|
3130
|
+
transition: background var(--motion) ease;
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
.visitor-preview__reveal:hover {
|
|
3134
|
+
background: var(--hover);
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
.visitor-preview__reveal:focus-visible {
|
|
3138
|
+
outline: 2px solid var(--accent);
|
|
3139
|
+
outline-offset: 1px;
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
/* The design's interactive ink - not Vuetify's fixed blue, which is one colour
|
|
3143
|
+
on both themes. `affectedEntities` gives its NRIC eye the same value. */
|
|
3144
|
+
.visitor-preview__eye {
|
|
3145
|
+
color: var(--accent-text);
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3149
|
+
.visitor-preview__reveal {
|
|
3150
|
+
transition: none;
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
|
|
2892
3154
|
/* The width the type filter carried as `max-width="200"` on the v-select. */
|
|
2893
3155
|
.visitor-type-filter {
|
|
2894
3156
|
max-width: 200px;
|
|
@@ -76,6 +76,8 @@ export default function usetFacility() {
|
|
|
76
76
|
hourInterval?: number;
|
|
77
77
|
isBookingFeeEnabled: boolean;
|
|
78
78
|
isGuestEnabled: boolean;
|
|
79
|
+
isResidentChecklistEnabled: boolean;
|
|
80
|
+
isSecurityChecklistEnabled: boolean;
|
|
79
81
|
bookingAmount: number | null;
|
|
80
82
|
peakBookingFeeAmount?: number | null;
|
|
81
83
|
bookingFeeGuestAmount?: number | null;
|
|
@@ -173,6 +175,8 @@ export default function usetFacility() {
|
|
|
173
175
|
hourInterval = 1,
|
|
174
176
|
isBookingFeeEnabled = false,
|
|
175
177
|
isGuestEnabled = false,
|
|
178
|
+
isResidentChecklistEnabled = false,
|
|
179
|
+
isSecurityChecklistEnabled = false,
|
|
176
180
|
bookingAmount = 0,
|
|
177
181
|
peakBookingFeeAmount = 0,
|
|
178
182
|
bookingFeeGuestAmount = 0,
|
|
@@ -236,6 +240,13 @@ export default function usetFacility() {
|
|
|
236
240
|
this.hourInterval = hourInterval;
|
|
237
241
|
this.isBookingFeeEnabled = isBookingFeeEnabled;
|
|
238
242
|
this.isGuestEnabled = isGuestEnabled;
|
|
243
|
+
// Exactly one owner, always. `isResidentChecklistEnabled` is the flag
|
|
244
|
+
// the apps gate on, so it decides, and security is its complement —
|
|
245
|
+
// stored rather than computed so each app can read its own flag without
|
|
246
|
+
// knowing the rule. A facility predating both fields lands on security,
|
|
247
|
+
// which is how every one of them already behaved.
|
|
248
|
+
this.isResidentChecklistEnabled = isResidentChecklistEnabled === true;
|
|
249
|
+
this.isSecurityChecklistEnabled = !this.isResidentChecklistEnabled;
|
|
239
250
|
this.bookingAmount = bookingAmount;
|
|
240
251
|
this.peakBookingFeeAmount = peakBookingFeeAmount;
|
|
241
252
|
this.bookingFeeGuestAmount = bookingFeeGuestAmount;
|