@7365admin1/layer-common 4.97.1-staging.678 → 4.97.1-staging.680

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.
@@ -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>
@@ -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: "Administrator", value: "administrator" },
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: activeTab.value,
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="HID Users"
5
+ title="People I manage"
5
6
  :headers="headers"
6
- :items="users"
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="users"
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" : "HID Users"
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
@@ -80,6 +80,12 @@
80
80
  <v-btn class="text-none screen-btn-primary" variant="flat" @click="loadStores">Try again</v-btn>
81
81
  </AppCard>
82
82
 
83
+ <!-- The MA reading a provider's stock: nothing to set up here, so say so plainly. -->
84
+ <AppCard v-else-if="ownerService && !store" class="pa-6" data-test="provider-inventory-empty">
85
+ <div class="text-h6 mb-2">No stock list from this provider yet</div>
86
+ <p class="text-body-2">This provider has not set up its own store at this property, or your role cannot view inventory.</p>
87
+ </AppCard>
88
+
83
89
  <!-- No store yet: one clear next step, or one clear explanation. -->
84
90
  <!-- Also open when a provider sets up its own store beside the main store (scenario 3). -->
85
91
  <AppCard v-else-if="!store || showSetup" class="pa-6">
@@ -196,6 +202,7 @@ import {
196
202
  inventoryManagedBy,
197
203
  inventorySiteOptions,
198
204
  inventoryStoreLabel,
205
+ inventoryStoresFor,
199
206
  inventorySuppliesText,
200
207
  inventorySupplySites,
201
208
  inventoryTwoStoresText,
@@ -208,6 +215,12 @@ import useLocalAuth from "../composables/useLocalAuth";
208
215
  const props = defineProps({
209
216
  orgId: { type: String, required: true },
210
217
  siteId: { type: String, required: true },
218
+ /**
219
+ * The managing agent reading one provider's stock at its site (owner 13 Nov 2026): that
220
+ * provider's service key ("cleaning", "mne", "pest", "pool", "landscape"). Shows only that
221
+ * provider's store(s), view only - the API grants the MA nothing but the stock list there.
222
+ */
223
+ ownerService: { type: String, default: "" },
211
224
  });
212
225
 
213
226
  const movedFromEquipment = useRoute().query.moved === "equipment";
@@ -241,7 +254,7 @@ provide(
241
254
  computed(() => stores.value.find((s) => s.owner === true && !s.main) ?? null),
242
255
  );
243
256
  // Scenario 3: a provider at a property with a main store may add its own store; offered only when it has none here.
244
- const canSetUpOwnStore = computed(() => canManageInventory.value && !stores.value.some((s) => s.owner === true));
257
+ const canSetUpOwnStore = computed(() => !props.ownerService && canManageInventory.value && !stores.value.some((s) => s.owner === true));
245
258
  function openOwnStoreSetup() {
246
259
  // Never "Main Store": that is the property manager's store in every label.
247
260
  Object.assign(setup, { name: "Our Store", sites: [props.siteId] });
@@ -267,7 +280,7 @@ const storeSites = computed(() =>
267
280
  );
268
281
 
269
282
  // Another organisation's (main) store: the person requests from it and manages nothing there.
270
- const requestOnly = computed(() => Boolean(store.value && store.value.owner === false));
283
+ const requestOnly = computed(() => Boolean(!props.ownerService && store.value && store.value.owner === false));
271
284
  const managedBy = computed(() => (store.value ? inventoryManagedBy(store.value) : ""));
272
285
 
273
286
  const subtitle = computed(() => {
@@ -315,7 +328,7 @@ async function loadStores() {
315
328
  loading.value = true;
316
329
  loadError.value = "";
317
330
  try {
318
- stores.value = (await getStores(props.siteId)) ?? [];
331
+ stores.value = inventoryStoresFor((await getStores(props.siteId)) ?? [], props.ownerService);
319
332
  const fromLink = stores.value.find((s) => s._id === linked.storeId);
320
333
  linked.storeId = "";
321
334
  if (fromLink) storeId.value = fromLink._id;
@@ -5,11 +5,16 @@
5
5
  :org-id="orgId"
6
6
  :site="site"
7
7
  :service-type="serviceType"
8
- :text="embedded ? '' : FEATURE_SUBTITLE"
8
+ :text="embedded ? '' : readOnly ? READ_ONLY_SUBTITLE : FEATURE_SUBTITLE"
9
+ :read-only="readOnly"
9
10
  :how-title="embedded ? '' : 'How extra checks work'"
10
11
  how-key="extra-visits"
11
12
  >
12
13
  <ol class="sg-steps">
14
+ <li v-if="readOnly">
15
+ You can view this provider's extra checks here. Only the
16
+ provider can add, change, pause or delete them.
17
+ </li>
13
18
  <li>
14
19
  Every night the app makes the <strong>Daily Checklist</strong>
15
20
  for every area on this site. You do not need to do anything for
@@ -69,7 +74,8 @@
69
74
  <template #no-data>
70
75
  <div class="st-empty">
71
76
  <strong>No extra checks yet.</strong>
72
- <span>
77
+ <span v-if="readOnly">This provider has not added any extra checks at this site.</span>
78
+ <span v-else>
73
79
  Your Daily Checklist already covers the normal rounds. Add an
74
80
  extra check when an area needs one more check at a set time -
75
81
  for example "Lunch toilet check, Lobby Toilets, 2:00 pm every
@@ -511,8 +517,14 @@ const props = defineProps({
511
517
  canViewScheduleTaskDetails: { type: Boolean, default: false },
512
518
  /** Inside the Task Calendar page: its one help box replaces this page's own. */
513
519
  embedded: { type: Boolean, default: false },
520
+ /** The managing agent viewing a provider's extra checks (owner 13 Nov 2026): view-only wording. Pass every can-create/update/delete false. */
521
+ readOnly: { type: Boolean, default: false },
522
+ /** Where "open checklist" goes, relative to /[org]/[site]/, for an app whose Daily Checklist lives elsewhere (PM: services/<slug>/checklist). */
523
+ scheduleRoute: { type: String, default: "" },
514
524
  });
515
525
 
526
+ const READ_ONLY_SUBTITLE = "The provider's own checks at a set time, on top of the daily rounds. View only.";
527
+
516
528
  const { formatDate, debounce } = useUtils();
517
529
  const {
518
530
  getScheduleTasks,
@@ -530,7 +542,7 @@ const canViewScheduleTaskDetails = computed(
530
542
  () => props.canViewScheduleTaskDetails
531
543
  );
532
544
 
533
- const checklistRoute = scheduleNameFor(props.serviceType).route;
545
+ const checklistRoute = props.scheduleRoute || scheduleNameFor(props.serviceType).route;
534
546
 
535
547
  /** Opens the Daily Checklist filtered to the day this extra check was last added. */
536
548
  function openChecklist(row: Record<string, any>) {
@@ -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
- title: "HID Reader",
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",
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.678",
5
+ "version": "4.97.1-staging.680",
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
+ }
@@ -4,7 +4,7 @@
4
4
  * same kind (e.g. staff of several organisations at one property), each one
5
5
  * also names its organisation so the buttons can be told apart.
6
6
  */
7
- type TStoreLike = { ownerType: string; orgName?: string; main?: boolean; owner?: boolean; ownerServiceLabel?: string };
7
+ type TStoreLike = { ownerType: string; orgName?: string; main?: boolean; owner?: boolean; ownerService?: string | null; ownerServiceLabel?: string };
8
8
 
9
9
  /** "This store supplies: Winsland House I and Winsland House II" for a store that supplies several sites. */
10
10
  export function inventorySuppliesText(names: string[]) {
@@ -133,3 +133,16 @@ export function inventorySitePickerItems(
133
133
  return by ? { ...o, props: { disabled: true, subtitle: `Already supplied by ${by}` } } : { ...o };
134
134
  });
135
135
  }
136
+
137
+ /**
138
+ * Which of the site's stores a screen shows. The managing agent may VIEW each
139
+ * provider's store at its site (API-core, owner 13 Nov 2026); those appear
140
+ * only on the provider's own Inventory page under Services (`ownerService` =
141
+ * the provider's service key, e.g. "cleaning", "mne"), never in the MA's own
142
+ * Inventory. Without `ownerService` the list is what it was before: the main
143
+ * store and the person's own company stores.
144
+ */
145
+ export function inventoryStoresFor<T extends TStoreLike>(stores: T[], ownerService = ""): T[] {
146
+ if (ownerService) return stores.filter((s) => !s.main && s.owner === false && s.ownerService === ownerService);
147
+ return stores.filter((s) => s.main || s.owner !== false);
148
+ }