@7365admin1/layer-common 4.178.0 → 4.179.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/CHANGELOG.md +11 -4
- package/components/AccessCardDetailsDialog.vue +13 -0
- package/components/AccessOwner/Badge.vue +26 -0
- package/components/AccessOwner/Chips.vue +28 -0
- package/components/AccessOwner/MyAccessCard.vue +48 -0
- package/components/AttendanceMain.vue +7 -1
- package/components/CleaningScheduleMain.vue +8 -1
- package/components/DashboardMain.vue +9 -2
- package/components/HidAccessLogDashboard.vue +43 -7
- package/components/HidReaderUserRoster.vue +18 -2
- package/components/HidUserEnrollment.vue +37 -2
- package/components/ManageChecklistMain.vue +7 -1
- package/components/ScheduleAreaMain.vue +7 -1
- package/components/ScheduleGuide.vue +3 -1
- package/composables/useHidAmico.ts +1 -1
- package/composables/useHidNavigation.ts +6 -1
- package/composables/usePropertyPermission.ts +19 -0
- package/package.json +1 -1
- package/utils/access-ownership.ts +73 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.179.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ebe3e0e: HID / Entrypass: tell the user's own access apart from access the site issued. HID Reader Users, HID Cards, the HID users roster and Access Logs get a "Whose access" column (Me / Resident / Staff / Contractor / Service Provider / Visitor / Management) and a filter chip row; the user lists show a "My access" card for the signed-in user's own credential above a "People I manage" table, plus an "Issued by" column (name and date, "Not recorded" for older records). Access Logs: "Administrator" tab renamed "Reader admin", new Staff and Contractor tabs. Entrypass card details show Whose access and Issued by. In the Security app the HID menu group is titled "Site Access (managed by the site)".
|
|
8
|
+
- f3c4d60: Managing agent's view of the providers at a site: `readOnly` on `CleaningScheduleMain`, `ScheduleAreaMain`, `ScheduleGuide` and `AttendanceMain` (hides the setup link and the attendance Settings button), a `routes` override on `DashboardMain` for an app whose checklist/attendance pages live elsewhere, and two view-only keys in the Property Management role catalogue (`cleaning-schedule-mgmt:see-all-schedules`, `attendance-mgmt:see-all-attendance`).
|
|
9
|
+
|
|
3
10
|
## 4.178.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -3953,11 +3960,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
|
|
|
3953
3960
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
3954
3961
|
own rule from two endpoints the console already calls, unprojected:
|
|
3955
3962
|
|
|
3956
|
-
|
|
3957
|
-
|
|
3963
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
3964
|
+
GET /api/roles/id/:role that membership's role document
|
|
3958
3965
|
|
|
3959
|
-
|
|
3960
|
-
|
|
3966
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
3967
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
3961
3968
|
|
|
3962
3969
|
`role.default` is the marker because it is the only property of a platform
|
|
3963
3970
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -65,6 +65,17 @@
|
|
|
65
65
|
<div class="card-details__value">{{ holderType }}</div>
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
|
+
<!-- Own card, or one the site issued to somebody (owner 2026-11-13). -->
|
|
69
|
+
<div v-if="details.userId">
|
|
70
|
+
<div class="card-details__label">Whose access</div>
|
|
71
|
+
<div class="card-details__value">{{ accessOwnerLabel(details, currentUser?._id) }}</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div>
|
|
75
|
+
<div class="card-details__label">Issued by</div>
|
|
76
|
+
<div class="card-details__value">{{ issuedByLabel(details) }}</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
68
79
|
<!-- Visitor / Resident Credentials -->
|
|
69
80
|
<template v-if="details.userCred">
|
|
70
81
|
<v-divider />
|
|
@@ -266,6 +277,8 @@ const holderState = computed<"named" | "assigned" | "unassigned">(() => {
|
|
|
266
277
|
*
|
|
267
278
|
* Falls back to `userType` so nothing disappears in the meantime.
|
|
268
279
|
*/
|
|
280
|
+
const { currentUser } = useLocalAuth();
|
|
281
|
+
|
|
269
282
|
const holderType = computed(
|
|
270
283
|
() => details.value?.holderType ?? details.value?.userType ?? "",
|
|
271
284
|
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="access-owner-badge" :class="{ 'access-owner-badge--me': label === 'Me' }">
|
|
3
|
+
{{ label }}
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
defineProps<{ label: string }>();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.access-owner-badge {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
padding: 1px 8px;
|
|
15
|
+
border-radius: 999px;
|
|
16
|
+
border: 1px solid rgba(var(--v-theme-on-surface), 0.24);
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
line-height: 18px;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
}
|
|
21
|
+
.access-owner-badge--me {
|
|
22
|
+
border-color: rgb(var(--v-theme-primary));
|
|
23
|
+
color: rgb(var(--v-theme-primary));
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Whose access: the signed-in user's own, or a person the site manages.
|
|
3
|
+
Filters the rows already on screen. -->
|
|
4
|
+
<v-chip-group
|
|
5
|
+
:model-value="modelValue"
|
|
6
|
+
class="access-owner-chips"
|
|
7
|
+
selected-class="text-primary"
|
|
8
|
+
mandatory
|
|
9
|
+
aria-label="Whose access"
|
|
10
|
+
@update:model-value="emit('update:modelValue', $event ?? 'all')"
|
|
11
|
+
>
|
|
12
|
+
<v-chip value="all" size="small" variant="outlined">All</v-chip>
|
|
13
|
+
<v-chip
|
|
14
|
+
v-for="label in ACCESS_OWNER_LABELS"
|
|
15
|
+
:key="label"
|
|
16
|
+
:value="label"
|
|
17
|
+
size="small"
|
|
18
|
+
variant="outlined"
|
|
19
|
+
>
|
|
20
|
+
{{ label }}
|
|
21
|
+
</v-chip>
|
|
22
|
+
</v-chip-group>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
defineProps<{ modelValue: string }>();
|
|
27
|
+
const emit = defineEmits<{ "update:modelValue": [value: string] }>();
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- The signed-in user's OWN access on this reader, kept apart from the
|
|
3
|
+
people the site manages (owner 2026-11-13). Hidden when the user holds
|
|
4
|
+
none on the rows loaded. -->
|
|
5
|
+
<v-card v-if="record" flat border class="my-access-card mb-4">
|
|
6
|
+
<v-card-item>
|
|
7
|
+
<v-card-title class="text-subtitle-1 font-weight-bold">My access</v-card-title>
|
|
8
|
+
<v-card-subtitle>Your own credential on this reader - not one you issued to someone else.</v-card-subtitle>
|
|
9
|
+
</v-card-item>
|
|
10
|
+
<v-card-text class="my-access-card__body">
|
|
11
|
+
<span><strong>{{ name }}</strong></span>
|
|
12
|
+
<span v-if="uid">UID {{ uid }}</span>
|
|
13
|
+
<span>Face: {{ faceEnrolled ? "Enrolled" : "Not enrolled" }}</span>
|
|
14
|
+
<NuxtLink v-if="qrRoute" :to="qrRoute">Show my HID QR code</NuxtLink>
|
|
15
|
+
</v-card-text>
|
|
16
|
+
</v-card>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
records: Array<Record<string, unknown>>;
|
|
22
|
+
org?: string;
|
|
23
|
+
site?: string;
|
|
24
|
+
}>();
|
|
25
|
+
|
|
26
|
+
const { currentUser } = useLocalAuth();
|
|
27
|
+
const record = computed(() =>
|
|
28
|
+
props.records.find((row) => accessOwnerLabel(row, currentUser.value?._id) === "Me"),
|
|
29
|
+
);
|
|
30
|
+
const metadata = computed(() => (record.value?.metadata ?? {}) as Record<string, unknown>);
|
|
31
|
+
const name = computed(() => String(metadata.value.name || record.value?.name || "Me"));
|
|
32
|
+
const uid = computed(() => String(record.value?.hidUserId ?? ""));
|
|
33
|
+
const faceEnrolled = computed(() => Boolean(metadata.value.facialEnrolled || metadata.value.facialData));
|
|
34
|
+
const qrRoute = computed(() =>
|
|
35
|
+
props.org && props.site
|
|
36
|
+
? { name: "org-site-access-mgmt-hid-qr-code", params: { org: props.org, site: props.site } }
|
|
37
|
+
: null,
|
|
38
|
+
);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<style scoped>
|
|
42
|
+
.my-access-card__body {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-wrap: wrap;
|
|
45
|
+
gap: 8px 20px;
|
|
46
|
+
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
Export CSV
|
|
43
43
|
</v-btn>
|
|
44
44
|
<v-btn
|
|
45
|
-
v-if="canManageAttendanceSettings || canManageSiteDeviceMode"
|
|
45
|
+
v-if="!readOnly && (canManageAttendanceSettings || canManageSiteDeviceMode)"
|
|
46
46
|
variant="outlined"
|
|
47
47
|
class="text-none screen-btn-ghost"
|
|
48
48
|
@click="dialogShowSettings = true"
|
|
@@ -131,6 +131,12 @@ const props = defineProps({
|
|
|
131
131
|
canViewAllAttendance: { type: Boolean, default: false },
|
|
132
132
|
canViewAttendanceDetails: { type: Boolean, default: false },
|
|
133
133
|
canManageAttendanceSettings: { type: Boolean, default: false },
|
|
134
|
+
/**
|
|
135
|
+
* View-only screen (the managing agent's view of a provider's attendance).
|
|
136
|
+
* Hides Settings even for a `*` role, whose site-device-mode right comes from
|
|
137
|
+
* `useAttendancePermission` (the provider apps' catalogue), not from a prop.
|
|
138
|
+
*/
|
|
139
|
+
readOnly: { type: Boolean, default: false },
|
|
134
140
|
});
|
|
135
141
|
|
|
136
142
|
const canViewAllAttendance = computed(() => props.canViewAllAttendance);
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
:site="site"
|
|
8
8
|
:service-type="serviceType"
|
|
9
9
|
:schedule-route="scheduleRoute"
|
|
10
|
+
:read-only="readOnly"
|
|
10
11
|
text="The app makes a new checklist for every area automatically each midnight. Staff tick off each unit on their mobile app; you follow progress here."
|
|
11
12
|
how-title="How the Daily Checklist works"
|
|
12
13
|
how-key="daily-checklist"
|
|
@@ -28,7 +29,11 @@
|
|
|
28
29
|
reaches zero the day's list closes: it becomes view-only, and any
|
|
29
30
|
unit not ticked counts as <strong>Missed</strong>.
|
|
30
31
|
</li>
|
|
31
|
-
<li>
|
|
32
|
+
<li v-if="readOnly">
|
|
33
|
+
Click a row to see its areas, then an area to see each unit — who
|
|
34
|
+
did it, when, remarks and photos.
|
|
35
|
+
</li>
|
|
36
|
+
<li v-else>
|
|
32
37
|
Click a row to see its areas, then an area to see each unit,
|
|
33
38
|
send a unit back (<strong>Needs redo</strong>) or add a remark.
|
|
34
39
|
</li>
|
|
@@ -205,6 +210,8 @@ const props = defineProps({
|
|
|
205
210
|
canDownloadSchedule: { type: Boolean, default: false },
|
|
206
211
|
canManageScheduleTasks: { type: Boolean, default: false },
|
|
207
212
|
canGenerateChecklist: { type: Boolean, default: false },
|
|
213
|
+
/** View-only screen (the managing agent's view): hides the setup link. Pass every can-manage flag false too. */
|
|
214
|
+
readOnly: { type: Boolean, default: false },
|
|
208
215
|
});
|
|
209
216
|
|
|
210
217
|
// "Daily Checklist – Cleaning" / "– Landscape" / "– Pest" / "– Pool" / "– Technician"
|
|
@@ -1365,6 +1365,13 @@ const props = defineProps({
|
|
|
1365
1365
|
orgSlug: { type: String, default: "" },
|
|
1366
1366
|
siteSlug: { type: String, default: "" },
|
|
1367
1367
|
printMode: { type: Boolean, default: false },
|
|
1368
|
+
/**
|
|
1369
|
+
* Where a tile's "view all" / row click goes, by route key (`attendance`,
|
|
1370
|
+
* `scheduleTask`, `feedbacks`, ...), relative to `/{org}/{site}/`. Overrides
|
|
1371
|
+
* the built-in paths for an app whose pages live elsewhere - e.g. Property
|
|
1372
|
+
* Management shows a provider's Daily Checklist under `services/cleaning/checklist`.
|
|
1373
|
+
*/
|
|
1374
|
+
routes: { type: Object as () => Record<string, string>, default: () => ({}) },
|
|
1368
1375
|
});
|
|
1369
1376
|
|
|
1370
1377
|
const emit = defineEmits<{
|
|
@@ -3602,7 +3609,7 @@ function goToDashboardRoute(routeKey: string) {
|
|
|
3602
3609
|
calendar: "calendar",
|
|
3603
3610
|
"incident-reports": "incident-reports",
|
|
3604
3611
|
};
|
|
3605
|
-
const path = pathMap[routeKey] || routeKey;
|
|
3612
|
+
const path = props.routes[routeKey] || pathMap[routeKey] || routeKey;
|
|
3606
3613
|
router.push(`/${props.orgId}/${props.site}/${path}`);
|
|
3607
3614
|
}
|
|
3608
3615
|
|
|
@@ -3620,7 +3627,7 @@ function goToListItem(item: TaskItem | FeedbackItem, routeKey: string) {
|
|
|
3620
3627
|
feedbacks: "feedbacks",
|
|
3621
3628
|
scheduleTask: getSchedulePath(),
|
|
3622
3629
|
};
|
|
3623
|
-
const path = pathMap[routeKey] || routeKey;
|
|
3630
|
+
const path = props.routes[routeKey] || pathMap[routeKey] || routeKey;
|
|
3624
3631
|
const scheduleId = item.raw?.schedule?._id || item.raw?.schedule;
|
|
3625
3632
|
if (routeKey === "scheduleTask" && scheduleId) {
|
|
3626
3633
|
router.push(`/${props.orgId}/${props.site}/${path}/${scheduleId}/${id}`);
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
clearable
|
|
85
85
|
@update:model-value="reloadDashboardFromFirstPage"
|
|
86
86
|
/>
|
|
87
|
+
<AccessOwnerChips v-model="ownerFilter" />
|
|
87
88
|
</div>
|
|
88
89
|
</template>
|
|
89
90
|
|
|
@@ -103,6 +104,10 @@
|
|
|
103
104
|
</span>
|
|
104
105
|
</template>
|
|
105
106
|
|
|
107
|
+
<template #[`item.owner`]="{ item }">
|
|
108
|
+
<AccessOwnerBadge :label="item.owner" />
|
|
109
|
+
</template>
|
|
110
|
+
|
|
106
111
|
<template #[`item.hidUserId`]="{ item }">
|
|
107
112
|
<span class="app-cell--num">{{ item.hidUserId }}</span>
|
|
108
113
|
</template>
|
|
@@ -297,14 +302,16 @@ const props = defineProps({
|
|
|
297
302
|
},
|
|
298
303
|
});
|
|
299
304
|
|
|
300
|
-
type AccessTab = "all" | "visitor" | "administrator";
|
|
301
|
-
type IdentityCategory = "resident" | "visitor" | "administrator";
|
|
305
|
+
type AccessTab = "all" | "visitor" | "staff" | "contractor" | "administrator";
|
|
306
|
+
type IdentityCategory = "resident" | "staff" | "contractor" | "visitor" | "administrator";
|
|
302
307
|
type AuthorizationStatus = "Authorized" | "Not Authorized" | "Unknown";
|
|
303
308
|
type AccessRow = {
|
|
304
309
|
key: string;
|
|
305
310
|
identityKey: string;
|
|
306
311
|
identityType?: string;
|
|
307
312
|
visitorId?: string;
|
|
313
|
+
/** Whose access: "Me" or the kind of person the site issued it to. */
|
|
314
|
+
owner: string;
|
|
308
315
|
name: string;
|
|
309
316
|
hidUserId: string;
|
|
310
317
|
facialData: string;
|
|
@@ -379,6 +386,8 @@ const administratorUserIds = ref<Set<number>>(new Set());
|
|
|
379
386
|
const { selectHidReader, resolveForSite } = useHidReaderSelection();
|
|
380
387
|
const selectedReaderId = ref("");
|
|
381
388
|
const activeTab = ref<AccessTab>("all");
|
|
389
|
+
const ownerFilter = ref("all");
|
|
390
|
+
const { currentUser } = useLocalAuth();
|
|
382
391
|
const search = ref("");
|
|
383
392
|
const status = ref("");
|
|
384
393
|
const accessMethod = ref("");
|
|
@@ -471,6 +480,7 @@ const selectedHistoryRows = computed<AccessRow[]>(() => {
|
|
|
471
480
|
lastAccessDate: parseDate(getLogAccessDateValue(log)),
|
|
472
481
|
readerLocation: getLogReaderLocation(log),
|
|
473
482
|
mappingStatus: selectedHistoryRow.value?.mappingStatus || "Unmapped",
|
|
483
|
+
owner: selectedHistoryRow.value?.owner || "—",
|
|
474
484
|
...getAuthorizationStatus(log.payload || log, log),
|
|
475
485
|
}));
|
|
476
486
|
|
|
@@ -486,6 +496,7 @@ const selectedHistoryRows = computed<AccessRow[]>(() => {
|
|
|
486
496
|
lastAccessDate: parseDate(getAccessLogTime(log, {})),
|
|
487
497
|
readerLocation: selectedReader.value?.location || "N/A",
|
|
488
498
|
mappingStatus: selectedHistoryRow.value?.mappingStatus || "Unmapped",
|
|
499
|
+
owner: selectedHistoryRow.value?.owner || "—",
|
|
489
500
|
...getAuthorizationStatus(log, {}),
|
|
490
501
|
}));
|
|
491
502
|
|
|
@@ -511,8 +522,9 @@ const filteredRows = computed(() => {
|
|
|
511
522
|
|
|
512
523
|
const matchesStatus = !status.value || row.status === status.value;
|
|
513
524
|
const matchesMethod = !accessMethod.value || row.method === accessMethod.value;
|
|
525
|
+
const matchesOwner = ownerFilter.value === "all" || row.owner === ownerFilter.value;
|
|
514
526
|
|
|
515
|
-
return matchesSearch && matchesStatus && matchesMethod;
|
|
527
|
+
return matchesSearch && matchesStatus && matchesMethod && matchesOwner;
|
|
516
528
|
});
|
|
517
529
|
});
|
|
518
530
|
|
|
@@ -523,7 +535,11 @@ const filteredRows = computed(() => {
|
|
|
523
535
|
const tabOptions: Array<{ label: string; value: AccessTab }> = [
|
|
524
536
|
{ label: "All", value: "all" },
|
|
525
537
|
{ label: "Visitor", value: "visitor" },
|
|
526
|
-
{ label: "
|
|
538
|
+
{ label: "Staff", value: "staff" },
|
|
539
|
+
{ label: "Contractor", value: "contractor" },
|
|
540
|
+
// The reader's own administrator flag (who may configure the reader), not
|
|
541
|
+
// the site's management staff.
|
|
542
|
+
{ label: "Reader admin", value: "administrator" },
|
|
527
543
|
];
|
|
528
544
|
|
|
529
545
|
/**
|
|
@@ -534,6 +550,7 @@ const tabOptions: Array<{ label: string; value: AccessTab }> = [
|
|
|
534
550
|
*/
|
|
535
551
|
const logHeaders = [
|
|
536
552
|
{ title: "Amico Name", value: "name", sortable: false },
|
|
553
|
+
{ title: "Whose access", value: "owner", sortable: false },
|
|
537
554
|
{ title: "UID", value: "hidUserId", sortable: false },
|
|
538
555
|
{ title: "Access Method", value: "method", sortable: false },
|
|
539
556
|
{ title: "Access Date and Time", value: "lastAccessTime", sortable: false },
|
|
@@ -636,7 +653,7 @@ async function loadDashboard() {
|
|
|
636
653
|
"intercom door-open logs",
|
|
637
654
|
),
|
|
638
655
|
loadDashboardSource(
|
|
639
|
-
getReaderAccessLogs(selectedReaderId.value, {
|
|
656
|
+
withAccessLogTabFallback((tab) => getReaderAccessLogs(selectedReaderId.value, {
|
|
640
657
|
page: page.value,
|
|
641
658
|
limit,
|
|
642
659
|
search: search.value.trim(),
|
|
@@ -654,8 +671,8 @@ async function loadDashboard() {
|
|
|
654
671
|
: accessMethod.value === "PIN"
|
|
655
672
|
? "pin"
|
|
656
673
|
: accessMethod.value === "Card" ? "card" : "",
|
|
657
|
-
tab
|
|
658
|
-
}),
|
|
674
|
+
tab,
|
|
675
|
+
})),
|
|
659
676
|
{ items: [], pages: 1, pageRange: "0-0 of 0" },
|
|
660
677
|
"live access logs",
|
|
661
678
|
),
|
|
@@ -721,6 +738,17 @@ async function loadDashboard() {
|
|
|
721
738
|
}
|
|
722
739
|
}
|
|
723
740
|
|
|
741
|
+
/**
|
|
742
|
+
* Staff and Contractor are newer server tabs. An API that has not deployed them
|
|
743
|
+
* refuses the value, so ask for "all" instead; `isVisibleForActiveTab` then
|
|
744
|
+
* keeps only the tab's rows on screen.
|
|
745
|
+
*/
|
|
746
|
+
function withAccessLogTabFallback<T>(request: (tab: AccessTab) => Promise<T>): Promise<T> {
|
|
747
|
+
const tab = activeTab.value;
|
|
748
|
+
const call = request(tab);
|
|
749
|
+
return tab === "staff" || tab === "contractor" ? call.catch(() => request("all")) : call;
|
|
750
|
+
}
|
|
751
|
+
|
|
724
752
|
async function loadDashboardSource<T>(request: Promise<T>, fallback: T, label: string): Promise<T> {
|
|
725
753
|
try {
|
|
726
754
|
return await request;
|
|
@@ -777,6 +805,9 @@ function classifyIdentity(identity?: Record<string, unknown>, row?: AccessRow):
|
|
|
777
805
|
const hidUserId = toHidNumericId(identity?.hidUserId ?? row?.identityKey.split("|")[0]);
|
|
778
806
|
if (hidUserId && administratorUserIds.value.has(hidUserId)) return "administrator";
|
|
779
807
|
if (row?.identityType === "visitor" || row?.visitorId || isVisitorIdentity(identity)) return "visitor";
|
|
808
|
+
// Staff and contractors used to fall through to "resident".
|
|
809
|
+
const type = String(toUnknownRecord(identity?.identity).type ?? identity?.type ?? row?.identityType ?? "");
|
|
810
|
+
if (type === "staff" || type === "contractor") return type;
|
|
780
811
|
return "resident";
|
|
781
812
|
}
|
|
782
813
|
|
|
@@ -1117,6 +1148,11 @@ function mapAccessLogToRow(rawLog: HidAccessRecord, event: HidAccessRecord, inde
|
|
|
1117
1148
|
? classifyIdentity(identity)
|
|
1118
1149
|
: String(eventIdentity.type || "").toLowerCase() || undefined,
|
|
1119
1150
|
visitorId: String(identity?.visitor || eventIdentity.visitor || "") || undefined,
|
|
1151
|
+
owner: accessOwnerLabel(
|
|
1152
|
+
identity || eventIdentity,
|
|
1153
|
+
currentUser.value?._id,
|
|
1154
|
+
identity && isVisitorIdentity(identity) ? "Visitor" : "—",
|
|
1155
|
+
),
|
|
1120
1156
|
name: getRawLogName(rawLog, event, identity),
|
|
1121
1157
|
hidUserId: formatHidUid(rawLog.user_id ?? rawLog.userId ?? rawLog.hidUserId ?? identity?.hidUserId),
|
|
1122
1158
|
facialData: identity ? getFacialData(identity) : "N/A",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section class="hid-reader-user-roster">
|
|
3
|
+
<AccessOwnerMyAccessCard :records="users" :org="String(route.params.org ?? '')" :site="props.site" />
|
|
3
4
|
<TableMain
|
|
4
|
-
title="
|
|
5
|
+
title="People I manage"
|
|
5
6
|
:headers="headers"
|
|
6
|
-
:items="
|
|
7
|
+
:items="visibleUsers"
|
|
7
8
|
:loading="loading"
|
|
8
9
|
:items-per-page="-1"
|
|
9
10
|
:page="page"
|
|
@@ -35,9 +36,14 @@
|
|
|
35
36
|
:items="userTypeOptions"
|
|
36
37
|
@update:model-value="reloadFromFirstPage"
|
|
37
38
|
/>
|
|
39
|
+
<AccessOwnerChips v-model="ownerFilter" />
|
|
38
40
|
</div>
|
|
39
41
|
</template>
|
|
40
42
|
|
|
43
|
+
<template #[`item.owner`]="{ item }">
|
|
44
|
+
<AccessOwnerBadge :label="ownerOf(item)" />
|
|
45
|
+
</template>
|
|
46
|
+
|
|
41
47
|
<template #[`item.name`]="{ item }">
|
|
42
48
|
<span class="app-cell--strong">{{ getRawName(item) }}</span>
|
|
43
49
|
</template>
|
|
@@ -201,6 +207,15 @@ type HidReaderUser = Record<string, unknown> & {
|
|
|
201
207
|
};
|
|
202
208
|
|
|
203
209
|
const { canManageHidUsers } = useHidAccessPermission();
|
|
210
|
+
const route = useRoute();
|
|
211
|
+
const { currentUser } = useLocalAuth();
|
|
212
|
+
// Whose access: own ("Me") or a person the site manages. Filters this page.
|
|
213
|
+
const ownerFilter = ref("all");
|
|
214
|
+
const ownerOf = (user: HidReaderUser) =>
|
|
215
|
+
accessOwnerLabel(user, currentUser.value?._id, isVisitor(user) ? "Visitor" : "—");
|
|
216
|
+
const visibleUsers = computed(() =>
|
|
217
|
+
ownerFilter.value === "all" ? users.value : users.value.filter((user) => ownerOf(user) === ownerFilter.value),
|
|
218
|
+
);
|
|
204
219
|
const {
|
|
205
220
|
getReaders,
|
|
206
221
|
getReaderUsers,
|
|
@@ -234,6 +249,7 @@ const snackbar = reactive({ show: false, color: "success", message: "" });
|
|
|
234
249
|
const headers = [
|
|
235
250
|
{ title: "Amico Name", value: "name", sortable: false },
|
|
236
251
|
{ title: "Type", value: "userType", sortable: false },
|
|
252
|
+
{ title: "Whose access", value: "owner", sortable: false },
|
|
237
253
|
{ title: "UID", value: "hidUserId", sortable: false },
|
|
238
254
|
{ title: "Registration No.", value: "registration", sortable: false },
|
|
239
255
|
{ title: "Facial Data", value: "facialData", sortable: false },
|
|
@@ -39,10 +39,12 @@
|
|
|
39
39
|
{{ selectedReader.portalName || "Not configured" }}
|
|
40
40
|
</v-alert>
|
|
41
41
|
|
|
42
|
+
<AccessOwnerMyAccessCard :records="users" :org="props.org" :site="props.site" />
|
|
43
|
+
|
|
42
44
|
<TableMain
|
|
43
45
|
:title="tableTitle"
|
|
44
46
|
:headers="tableHeaders"
|
|
45
|
-
:items="
|
|
47
|
+
:items="visibleUsers"
|
|
46
48
|
:loading="loading"
|
|
47
49
|
:items-per-page="-1"
|
|
48
50
|
:page="page"
|
|
@@ -86,6 +88,7 @@
|
|
|
86
88
|
clearable
|
|
87
89
|
@update:model-value="reloadUsersFromFirstPage"
|
|
88
90
|
/>
|
|
91
|
+
<AccessOwnerChips v-model="ownerFilter" />
|
|
89
92
|
</div>
|
|
90
93
|
</template>
|
|
91
94
|
|
|
@@ -93,6 +96,16 @@
|
|
|
93
96
|
<span class="app-cell--strong">{{ getName(item) }}</span>
|
|
94
97
|
</template>
|
|
95
98
|
|
|
99
|
+
<template #[`item.owner`]="{ item }">
|
|
100
|
+
<AccessOwnerBadge :label="ownerOf(item)" />
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<!-- Who issued it: the card's issuer on HID Cards, else who enrolled the
|
|
104
|
+
person. "Not recorded" for records issued before this was kept. -->
|
|
105
|
+
<template #[`item.issuedBy`]="{ item }">
|
|
106
|
+
<span class="app-cell--muted">{{ issuedByOf(item) }}</span>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
96
109
|
<!-- Client requirement (2026-08-26): the face photo is not shown once
|
|
97
110
|
registration is complete. The column reports enrollment STATE only --
|
|
98
111
|
the reader holds the image and the biometric template, we hold neither. -->
|
|
@@ -2476,23 +2489,45 @@ const statusOptions = ["Mapped", "Unmapped"];
|
|
|
2476
2489
|
*/
|
|
2477
2490
|
const userHeaders = [
|
|
2478
2491
|
{ title: "Name", value: "name", sortable: false },
|
|
2492
|
+
{ title: "Whose access", value: "owner", sortable: false },
|
|
2479
2493
|
{ title: "Facial Data", value: "facialData", sortable: false },
|
|
2480
2494
|
{ title: "UID", value: "hidUserId", sortable: false },
|
|
2481
2495
|
// Reads in the same order the dialog asks for them: UID then registration.
|
|
2482
2496
|
{ title: "Registration No.", value: "registration", sortable: false },
|
|
2483
2497
|
{ title: "Status", value: "status", sortable: false },
|
|
2498
|
+
{ title: "Issued by", value: "issuedBy", sortable: false },
|
|
2484
2499
|
{ title: "", value: "action-table", sortable: false },
|
|
2485
2500
|
];
|
|
2486
2501
|
|
|
2487
2502
|
const cardHeaders = [
|
|
2488
2503
|
{ title: "Name", value: "name", sortable: false },
|
|
2504
|
+
{ title: "Whose access", value: "owner", sortable: false },
|
|
2489
2505
|
{ title: "UID", value: "hidUserId", sortable: false },
|
|
2490
2506
|
{ title: "Physical HID Cards", value: "cards", sortable: false },
|
|
2507
|
+
{ title: "Issued by", value: "issuedBy", sortable: false },
|
|
2491
2508
|
{ title: "", value: "action-table", sortable: false },
|
|
2492
2509
|
];
|
|
2493
2510
|
|
|
2511
|
+
// "People I manage": the signed-in user's own access sits in the My access
|
|
2512
|
+
// card above, so the table is everybody the site issued access to.
|
|
2494
2513
|
const tableTitle = computed(() =>
|
|
2495
|
-
props.cardManagement ? "HID Cards" : "
|
|
2514
|
+
props.cardManagement ? "HID Cards - people I manage" : "People I manage"
|
|
2515
|
+
);
|
|
2516
|
+
|
|
2517
|
+
const { currentUser } = useLocalAuth();
|
|
2518
|
+
const ownerFilter = ref("all");
|
|
2519
|
+
function ownerOf(user: HidUser) {
|
|
2520
|
+
return accessOwnerLabel(user, currentUser.value?._id);
|
|
2521
|
+
}
|
|
2522
|
+
function issuedByOf(user: HidUser) {
|
|
2523
|
+
const identity = toRecord(user.identity);
|
|
2524
|
+
const card = toRecord(identity.cardIssued);
|
|
2525
|
+
return props.cardManagement && card.issuedByName ? issuedByLabel(card) : issuedByLabel(identity);
|
|
2526
|
+
}
|
|
2527
|
+
const visibleUsers = computed(() =>
|
|
2528
|
+
ownerFilter.value === "all"
|
|
2529
|
+
? users.value
|
|
2530
|
+
: users.value.filter((user) => ownerOf(user) === ownerFilter.value)
|
|
2496
2531
|
);
|
|
2497
2532
|
const tableHeaders = computed(() =>
|
|
2498
2533
|
props.cardManagement ? cardHeaders : userHeaders
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
</StatusChip>
|
|
17
17
|
</v-col>
|
|
18
18
|
</v-row>
|
|
19
|
-
<p class="checklist-intro" data-test="checklist-intro">
|
|
19
|
+
<p v-if="readOnly" class="checklist-intro" data-test="checklist-intro">
|
|
20
|
+
Each visit lists this area's units as the provider's staff ticked them.
|
|
21
|
+
A visit marked "Extra check" was added from the Task Calendar.
|
|
22
|
+
</p>
|
|
23
|
+
<p v-else class="checklist-intro" data-test="checklist-intro">
|
|
20
24
|
Each visit lists this area's units. Staff tick them on their phone; here
|
|
21
25
|
you can mark a unit <strong>Done</strong> (✓) or send it back with
|
|
22
26
|
<strong>Needs redo</strong> (✗, with a remark). The last unit of a
|
|
@@ -487,6 +491,8 @@ const props = defineProps({
|
|
|
487
491
|
serviceType: { type: String, default: "" },
|
|
488
492
|
canAddRemarks: { type: Boolean, default: false },
|
|
489
493
|
canManageScheduleTasks: { type: Boolean, default: false },
|
|
494
|
+
/** View-only screen (the managing agent's view): view-only intro. Pass both can-flags false too. */
|
|
495
|
+
readOnly: { type: Boolean, default: false },
|
|
490
496
|
});
|
|
491
497
|
|
|
492
498
|
const { getUnitCleanerChecklist, updateUnitChecklist } = useCleaningSchedules();
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
:site="site"
|
|
7
7
|
:service-type="serviceType"
|
|
8
8
|
:schedule-route="scheduleRoute"
|
|
9
|
-
|
|
9
|
+
:read-only="readOnly"
|
|
10
|
+
:text="guideText"
|
|
10
11
|
/>
|
|
11
12
|
<!--
|
|
12
13
|
DV-0998 / DV-1003: an area set up during the day is not on that day's
|
|
@@ -194,10 +195,15 @@ const props = defineProps({
|
|
|
194
195
|
// Common / Toilet is a cleaning distinction; apps without it hide the Type
|
|
195
196
|
// filter and column (saved `type` values are untouched).
|
|
196
197
|
showAreaType: { type: Boolean, default: true },
|
|
198
|
+
/** View-only screen (the managing agent's view): hides the setup link. Pass every can-manage flag false too. */
|
|
199
|
+
readOnly: { type: Boolean, default: false },
|
|
197
200
|
});
|
|
198
201
|
|
|
199
202
|
// "Daily Checklist – Cleaning" / "– Landscape" / ... (same title as the day list)
|
|
200
203
|
const pageTitle = dailyChecklistTitle(props.serviceType);
|
|
204
|
+
const guideText = props.readOnly
|
|
205
|
+
? "These are the areas on this day's checklist. Click an area to see each unit. Visits today counts the area's normal visits plus any extra checks added today."
|
|
206
|
+
: "These are the areas on this day's checklist. Click an area to see each unit, tick it as done, or send it back to be redone. Visits today counts the area's normal visits plus any extra checks added today.";
|
|
201
207
|
|
|
202
208
|
const submitting = ref(false);
|
|
203
209
|
const message = ref("");
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<ul class="schedule-guide__list">
|
|
44
44
|
<li v-for="p in problems" :key="p">{{ p }}</li>
|
|
45
45
|
</ul>
|
|
46
|
-
<template #append>
|
|
46
|
+
<template v-if="!readOnly" #append>
|
|
47
47
|
<v-btn
|
|
48
48
|
:to="areaLink"
|
|
49
49
|
variant="outlined"
|
|
@@ -71,6 +71,8 @@ const props = defineProps({
|
|
|
71
71
|
howTitle: { type: String, default: "" },
|
|
72
72
|
/** Remembers open/closed per panel on this browser. */
|
|
73
73
|
howKey: { type: String, default: "" },
|
|
74
|
+
/** View-only screen (e.g. the managing agent's view): no "Set up Areas and Units" link. */
|
|
75
|
+
readOnly: { type: Boolean, default: false },
|
|
74
76
|
});
|
|
75
77
|
|
|
76
78
|
const HOW_STORE = () => `schedule-guide-how:${props.howKey || props.howTitle}`;
|
|
@@ -398,7 +398,7 @@ export default function useHidAmico() {
|
|
|
398
398
|
search?: string;
|
|
399
399
|
status?: "authorized" | "not_authorized" | "unknown" | "";
|
|
400
400
|
method?: "facial" | "qr_code" | "id_password" | "pin" | "card" | "";
|
|
401
|
-
tab?: "all" | "unmapped" | "mapped" | "resident" | "visitor" | "administrator";
|
|
401
|
+
tab?: "all" | "unmapped" | "mapped" | "resident" | "staff" | "contractor" | "visitor" | "administrator";
|
|
402
402
|
} = {}) {
|
|
403
403
|
return useNuxtApp().$api<HidCollectionResponse>(`${basePath}/readers/${readerId}/access-logs`, {
|
|
404
404
|
method: "GET",
|
|
@@ -42,7 +42,12 @@ export default function useHidNavigation() {
|
|
|
42
42
|
*/
|
|
43
43
|
function getHidFaceReaderMenu({ org, site }: HidNavigationParams) {
|
|
44
44
|
return {
|
|
45
|
-
|
|
45
|
+
// The Security app shows the SITE's access records, issued and managed by
|
|
46
|
+
// the site's HID administrators - not the guard's own pass (that is
|
|
47
|
+
// "My Access" in iSecure365). Owner 2026-11-13.
|
|
48
|
+
title: useRuntimeConfig().public.APP === "security_agency"
|
|
49
|
+
? "Site Access (managed by the site)"
|
|
50
|
+
: "HID Reader",
|
|
46
51
|
children: [
|
|
47
52
|
{
|
|
48
53
|
title: "Face Reader",
|
|
@@ -669,6 +669,25 @@ export default function usePropertyPermission() {
|
|
|
669
669
|
},
|
|
670
670
|
"robot-mgmt": robotPermissions,
|
|
671
671
|
"cctv-engine": cctvEnginePermissions,
|
|
672
|
+
// The managing agent's VIEW of the providers at the site (owner, 13 Nov 2026):
|
|
673
|
+
// "Services at this site" > Cleaning / M&E / Pest Control / Pool / Garden >
|
|
674
|
+
// Dashboard, Daily Checklist, Attendance. View only - the strings are the
|
|
675
|
+
// providers' own "see all" keys, which API-core's staff-lists guard and the
|
|
676
|
+
// dashboard tiles already accept, so no new string is invented.
|
|
677
|
+
"cleaning-schedule-mgmt": {
|
|
678
|
+
"see-all-schedules": {
|
|
679
|
+
check: true,
|
|
680
|
+
description:
|
|
681
|
+
"Allows the user to view the service providers' daily checklists at the site (areas, units and history). View only.",
|
|
682
|
+
},
|
|
683
|
+
},
|
|
684
|
+
"attendance-mgmt": {
|
|
685
|
+
"see-all-attendance": {
|
|
686
|
+
check: true,
|
|
687
|
+
description:
|
|
688
|
+
"Allows the user to view the service providers' staff attendance at the site. View only.",
|
|
689
|
+
},
|
|
690
|
+
},
|
|
672
691
|
"site-settings": siteSettingsPermissions
|
|
673
692
|
};
|
|
674
693
|
|
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.
|
|
5
|
+
"version": "4.179.0",
|
|
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.",
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHOSE ACCESS IS THIS - the signed-in user's own, or one the site issued to a
|
|
3
|
+
* person it manages (owner 2026-11-13: "distinguish if that Access is the own
|
|
4
|
+
* user access or the access that the MA given to their staff/tenant/resident").
|
|
5
|
+
*
|
|
6
|
+
* Reads the identity the API attaches to a reader user / access log
|
|
7
|
+
* (`identity.type`, `identity.user`, `identity.serviceProvider`) or an
|
|
8
|
+
* Entrypass card (`holderType`, `userId`). Anything it cannot place is "—".
|
|
9
|
+
*/
|
|
10
|
+
export const ACCESS_OWNER_LABELS = [
|
|
11
|
+
"Me",
|
|
12
|
+
"Resident",
|
|
13
|
+
"Staff",
|
|
14
|
+
"Contractor",
|
|
15
|
+
"Service Provider",
|
|
16
|
+
"Visitor",
|
|
17
|
+
"Management",
|
|
18
|
+
] as const;
|
|
19
|
+
|
|
20
|
+
export type AccessOwnerLabel = (typeof ACCESS_OWNER_LABELS)[number] | "—";
|
|
21
|
+
|
|
22
|
+
type Rec = Record<string, unknown>;
|
|
23
|
+
|
|
24
|
+
const asRec = (value: unknown): Rec =>
|
|
25
|
+
value && typeof value === "object" ? (value as Rec) : {};
|
|
26
|
+
const text = (value: unknown) => (value === undefined || value === null ? "" : String(value).trim());
|
|
27
|
+
|
|
28
|
+
const TYPE_LABELS: Record<string, AccessOwnerLabel> = {
|
|
29
|
+
resident: "Resident",
|
|
30
|
+
tenant: "Resident",
|
|
31
|
+
"visitor/resident": "Resident",
|
|
32
|
+
residents: "Resident",
|
|
33
|
+
staff: "Staff",
|
|
34
|
+
contractor: "Contractor",
|
|
35
|
+
visitor: "Visitor",
|
|
36
|
+
admin: "Management",
|
|
37
|
+
management: "Management",
|
|
38
|
+
property_management: "Management",
|
|
39
|
+
"service provider": "Service Provider",
|
|
40
|
+
service_provider: "Service Provider",
|
|
41
|
+
providers: "Service Provider",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** `fallback` is used when the record carries no type (e.g. a device-only visitor row). */
|
|
45
|
+
export function accessOwnerLabel(
|
|
46
|
+
record: unknown,
|
|
47
|
+
myUserId: unknown,
|
|
48
|
+
fallback: AccessOwnerLabel = "—",
|
|
49
|
+
): AccessOwnerLabel {
|
|
50
|
+
const row = asRec(record);
|
|
51
|
+
const identity = { ...row, ...asRec(row.identity) };
|
|
52
|
+
const me = text(myUserId);
|
|
53
|
+
const owner = text(identity.user) || text(row.userId);
|
|
54
|
+
if (me && owner === me) return "Me";
|
|
55
|
+
|
|
56
|
+
const type = (text(identity.type) || text(row.holderType)).toLowerCase();
|
|
57
|
+
if (type === "contractor" && identity.serviceProvider === true) return "Service Provider";
|
|
58
|
+
return TYPE_LABELS[type] ?? fallback;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** "Name · 13 Nov 2026", or "Not recorded" for records issued before this was kept. */
|
|
62
|
+
export function issuedByLabel(record: unknown): string {
|
|
63
|
+
const row = asRec(record);
|
|
64
|
+
const name = text(row.issuedByName);
|
|
65
|
+
const at = text(row.issuedAt);
|
|
66
|
+
if (!name && !at) return "Not recorded";
|
|
67
|
+
const date = at ? new Date(at) : null;
|
|
68
|
+
const when =
|
|
69
|
+
date && !Number.isNaN(date.getTime())
|
|
70
|
+
? date.toLocaleDateString("en-SG", { day: "numeric", month: "short", year: "numeric" })
|
|
71
|
+
: "";
|
|
72
|
+
return [name || "Unknown", when].filter(Boolean).join(" · ");
|
|
73
|
+
}
|