@7365admin1/layer-common 4.96.0 → 4.97.1-staging.500

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +10 -4
  2. package/assets/css/primitives.css +57 -0
  3. package/assets/css/screens.css +8 -4
  4. package/components/AccessCardDetailsDialog.vue +59 -6
  5. package/components/AccessCardPreviewDialog.vue +371 -53
  6. package/components/AppSelect.vue +143 -4
  7. package/components/BuildingUnitFormEdit.vue +6 -0
  8. package/components/BuildingUnitManagement.vue +298 -0
  9. package/components/Dialog/UpdateMoreAction.vue +11 -1
  10. package/components/DocumentForm.vue +407 -112
  11. package/components/DocumentManagement.vue +213 -12
  12. package/components/Facility/BookingSetup.vue +63 -0
  13. package/components/HidAccessLogDashboard.vue +74 -17
  14. package/components/HidAccessPermissions.vue +424 -0
  15. package/components/HidIntercomManagement.vue +183 -14
  16. package/components/HidProfileQrCode.vue +332 -0
  17. package/components/HidQrCodeConfiguration.vue +17 -195
  18. package/components/HidReaderManagement.vue +398 -0
  19. package/components/HidReaderUserRoster.vue +44 -3
  20. package/components/HidUserEnrollment.vue +2239 -276
  21. package/components/InvitationClientForm.vue +19 -1
  22. package/components/Nfc/NFCPatrolRouteForm.vue +109 -58
  23. package/components/Nfc/NFCPatrolRouteMain.vue +3 -18
  24. package/components/Nfc/PatrolReport/PatrolActivityTable.vue +0 -8
  25. package/components/Nfc/PatrolReport/PatrolRouteSummary.vue +1 -1
  26. package/components/ServiceProviderMain.vue +48 -0
  27. package/components/SiteProviderChange.vue +371 -0
  28. package/components/TableMain.vue +22 -7
  29. package/components/VehicleQrStickerDialog.vue +64 -4
  30. package/components/VisitorForm.vue +12 -0
  31. package/components/VisitorManagement.vue +267 -5
  32. package/composables/useAccessManagement.ts +17 -1
  33. package/composables/useCustomerSite.ts +29 -0
  34. package/composables/useDocument.ts +7 -0
  35. package/composables/useFacility.ts +11 -0
  36. package/composables/useHidAmico.ts +165 -0
  37. package/composables/useHidNavigation.ts +25 -1
  38. package/composables/useHidReaderSelection.ts +50 -0
  39. package/composables/useMember.ts +12 -0
  40. package/composables/useNFCPatrolReport.ts +36 -32
  41. package/composables/useNFCPatrolReportFilters.ts +21 -3
  42. package/composables/useNFCPatrolRoute.ts +10 -3
  43. package/composables/usePeople.ts +19 -0
  44. package/composables/useServiceProvider.ts +45 -2
  45. package/composables/useSiteCategory.ts +45 -0
  46. package/package.json +1 -1
  47. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  48. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  49. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  50. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  51. package/types/document.d.ts +14 -0
  52. package/types/facility.d.ts +4 -0
  53. package/types/member.d.ts +4 -0
  54. package/types/nfc-patrol-report.ts +0 -2
  55. package/types/people.d.ts +28 -1
  56. package/types/service-provider.d.ts +5 -0
  57. package/types/site.d.ts +7 -1
  58. package/utils/hid-enrolment-subject.ts +344 -0
  59. package/utils/hid-permission-assignments.ts +198 -0
  60. package/utils/hid-reader-selection.ts +52 -0
  61. package/utils/nfc-patrol-time.ts +99 -0
  62. package/utils/occupancy-role.ts +109 -0
  63. package/utils/service-type.ts +30 -0
  64. package/utils/vehicle-qr-design.ts +304 -20
  65. package/utils/vehicle-qr-sticker.ts +126 -20
@@ -750,11 +750,35 @@
750
750
  class="visitor-preview__row"
751
751
  >
752
752
  <div class="visitor-preview__label">{{ label }}</div>
753
- <div
754
- v-tooltip:top="selectedVisitorObject[key]"
755
- class="visitor-preview__value"
756
- >
757
- {{ maskNRIC(selectedVisitorObject[key]) }}
753
+ <div>
754
+ <!-- Was a hover tooltip on the value: the full NRIC only
755
+ reachable by hovering, which says nothing is there to
756
+ reach and cannot be reached at all on a touch screen.
757
+ The eye alone, at the 14px the Incident Report screens
758
+ draw it, is a 14px target - the floor is 24px. So the
759
+ NUMBER is the control and the eye is its affordance:
760
+ the whole masked value is pressable, which makes the
761
+ target the width of the digits rather than of a glyph,
762
+ and being a real `button` it also takes a tab stop,
763
+ which a `v-icon` with a click handler never did. -->
764
+ <button
765
+ type="button"
766
+ class="visitor-preview__reveal"
767
+ :aria-label="showVisitorNric ? 'Hide NRIC' : 'Show NRIC'"
768
+ :aria-pressed="showVisitorNric"
769
+ @click="showVisitorNric = !showVisitorNric"
770
+ >
771
+ <span class="visitor-preview__value">
772
+ {{
773
+ showVisitorNric
774
+ ? selectedVisitorObject[key]
775
+ : maskNRIC(selectedVisitorObject[key])
776
+ }}
777
+ </span>
778
+ <v-icon size="16" class="visitor-preview__eye">
779
+ {{ showVisitorNric ? "mdi-eye-off-outline" : "mdi-eye-outline" }}
780
+ </v-icon>
781
+ </button>
758
782
  </div>
759
783
  </div>
760
784
 
@@ -804,6 +828,84 @@
804
828
  </div>
805
829
  </div>
806
830
 
831
+ <!--
832
+ THE CONTRACTOR'S PARTY.
833
+
834
+ The list row has always said `( +2 members)` beside the name
835
+ and then had nowhere to send you for the names themselves. The
836
+ block spans both columns rather than sitting in the 116px
837
+ value track: a member is a record, not a value, and several of
838
+ them in a 250px column is unreadable.
839
+
840
+ Read off `selectedVisitorDataObject` (the raw row) and not
841
+ `selectedVisitorObject`, which filters itself down to
842
+ `typeFieldMap` plus five fixed keys - `members` is on neither
843
+ list, and widening that computed would change what four other
844
+ dialogs on this screen see.
845
+ -->
846
+ <div
847
+ v-else-if="key === 'members' && selectedVisitorMembers.length"
848
+ class="visitor-preview__row visitor-preview__row--block"
849
+ >
850
+ <div class="visitor-preview__label">
851
+ {{ label }} ({{ selectedVisitorMembers.length }})
852
+ </div>
853
+ <div class="visitor-preview__members">
854
+ <div
855
+ v-for="(member, index) in selectedVisitorMembers"
856
+ :key="member?.nric || member?.name || index"
857
+ class="visitor-preview__member"
858
+ >
859
+ <div class="visitor-preview__value">
860
+ {{ member?.name || "N/A" }}
861
+ </div>
862
+ <template v-for="field in memberDetailFields" :key="field.key">
863
+ <div
864
+ v-if="member?.[field.key]"
865
+ class="visitor-preview__member-line"
866
+ >
867
+ <span class="visitor-preview__member-key">
868
+ {{ field.label }}
869
+ </span>
870
+ <!-- A member's NRIC is the same class of data as the
871
+ visitor's, so it gets the same control. Each
872
+ member reveals separately - one toggle for the
873
+ whole card would show three people's NRICs to
874
+ read one. -->
875
+ <button
876
+ v-if="field.key === 'nric'"
877
+ type="button"
878
+ class="visitor-preview__reveal"
879
+ :aria-label="
880
+ isMemberNricShown(index)
881
+ ? `Hide NRIC for ${member?.name || 'this member'}`
882
+ : `Show NRIC for ${member?.name || 'this member'}`
883
+ "
884
+ :aria-pressed="isMemberNricShown(index)"
885
+ @click="toggleMemberNric(index)"
886
+ >
887
+ <span>
888
+ {{
889
+ isMemberNricShown(index)
890
+ ? member.nric
891
+ : maskNRIC(member.nric)
892
+ }}
893
+ </span>
894
+ <v-icon size="16" class="visitor-preview__eye">
895
+ {{
896
+ isMemberNricShown(index)
897
+ ? "mdi-eye-off-outline"
898
+ : "mdi-eye-outline"
899
+ }}
900
+ </v-icon>
901
+ </button>
902
+ <span v-else>{{ member[field.key] }}</span>
903
+ </div>
904
+ </template>
905
+ </div>
906
+ </div>
907
+ </div>
908
+
807
909
  <!-- The vehicle number, with Block on its right: the Registered
808
910
  tab only, for someone who may add vehicles. It opens the
809
911
  Vehicle Mgmt Block Listed form with the category taken from
@@ -2124,6 +2226,71 @@ const isSelectedVisitorPendingApproval = computed(
2124
2226
  () => selectedVisitorStatus.value === "pending"
2125
2227
  );
2126
2228
 
2229
+ /**
2230
+ * The members a contractor brought with them. Not gated on the Guests tab: the
2231
+ * list row's own `( +N members)` count is not either, and a contractor with a
2232
+ * party has one wherever the screen shows it.
2233
+ *
2234
+ * Blank entries are dropped rather than drawn as an empty card - the payload
2235
+ * carries `""` for every detail nobody filled in, so a member with no name and
2236
+ * no details would otherwise render as a bare inset box.
2237
+ */
2238
+ const selectedVisitorMembers = computed<Record<string, any>[]>(() => {
2239
+ const members = selectedVisitorDataObject.value?.members;
2240
+ if (!Array.isArray(members)) return [];
2241
+
2242
+ return members.filter(
2243
+ (member: Record<string, any>) =>
2244
+ member?.name || member?.nric || member?.contact || member?.plateNumber
2245
+ );
2246
+ });
2247
+
2248
+ /**
2249
+ * WHICH NRICs ARE UNCOVERED RIGHT NOW.
2250
+ *
2251
+ * Per member and not per card, so revealing one person's number does not
2252
+ * uncover the rest of the party's. Both are cleared when the dialog closes -
2253
+ * a preview must not open on the next visitor with the last one's NRIC
2254
+ * already showing, and it is the same `selectedVisitorId` that would carry it
2255
+ * across if the same row were reopened.
2256
+ */
2257
+ const showVisitorNric = ref(false);
2258
+ const shownMemberNrics = ref<number[]>([]);
2259
+
2260
+ function isMemberNricShown(index: number) {
2261
+ return shownMemberNrics.value.includes(index);
2262
+ }
2263
+
2264
+ function toggleMemberNric(index: number) {
2265
+ shownMemberNrics.value = isMemberNricShown(index)
2266
+ ? shownMemberNrics.value.filter((x) => x !== index)
2267
+ : [...shownMemberNrics.value, index];
2268
+ }
2269
+
2270
+ watch(
2271
+ () => dialog.viewVisitor,
2272
+ (open) => {
2273
+ if (open) return;
2274
+ showVisitorNric.value = false;
2275
+ shownMemberNrics.value = [];
2276
+ }
2277
+ );
2278
+
2279
+ /**
2280
+ * What a member row prints under the name, in order. `plateNumber` is in here
2281
+ * because the API returns it on `members[]` even though neither
2282
+ * `TMemberInfo` (this package) nor `TContractorMembers` (API-core's visitor
2283
+ * model, name and nric only) declares it - the two types have drifted from the
2284
+ * document and from each other. Reading the key defensively costs nothing and
2285
+ * shows the vehicle a member actually arrived in; the types are somebody's to
2286
+ * reconcile separately.
2287
+ */
2288
+ const memberDetailFields = [
2289
+ { key: "nric", label: "NRIC" },
2290
+ { key: "contact", label: "Contact" },
2291
+ { key: "plateNumber", label: "Vehicle" },
2292
+ ] as const;
2293
+
2127
2294
  const formatType = (item: any) =>
2128
2295
  (item.deliveryType ? item.deliveryType + "-" : "") + item.type;
2129
2296
 
@@ -2137,6 +2304,7 @@ const formattedFields = {
2137
2304
  level: "Level",
2138
2305
  unit: "Unit",
2139
2306
  purpose: "Purpose",
2307
+ members: "Members",
2140
2308
  checkIn: "Check In",
2141
2309
  snapshotEntryImage: "Entry Image",
2142
2310
  checkOut: "Check Out",
@@ -3143,6 +3311,100 @@ watchEffect(async () => {
3143
3311
  word-break: break-word;
3144
3312
  }
3145
3313
 
3314
+ /* A row whose value is a set of records rather than a value - it drops the
3315
+ two-column grid and runs the full width of the card body. */
3316
+ .visitor-preview__row--block {
3317
+ display: block;
3318
+ }
3319
+
3320
+ .visitor-preview__members {
3321
+ display: flex;
3322
+ flex-direction: column;
3323
+ gap: 8px;
3324
+ margin-top: 8px;
3325
+ }
3326
+
3327
+ /*
3328
+ * An added member reads as an inset on the card it sits in - `--hover` on
3329
+ * `--border` at the inner radius. Those are `Card/MemberInfoSummary`'s three
3330
+ * decisions, unchanged, so a member looks the same in the preview as it does
3331
+ * in the form that created it. Only the TYPE differs: that card still prints
3332
+ * `<strong>Label:</strong> value`, which is the pattern this dialog just moved
3333
+ * off, so the lines below are set on the scale rather than inherited.
3334
+ */
3335
+ .visitor-preview__member {
3336
+ padding: 9px 12px;
3337
+ border: 1px solid var(--border);
3338
+ border-radius: var(--r-inner);
3339
+ background: var(--hover);
3340
+ }
3341
+
3342
+ .visitor-preview__member-line {
3343
+ display: flex;
3344
+ gap: 8px;
3345
+ margin-top: 3px;
3346
+ font-size: var(--fs-breadcrumb);
3347
+ color: var(--text2);
3348
+ word-break: break-word;
3349
+ }
3350
+
3351
+ .visitor-preview__member-key {
3352
+ flex: 0 0 52px;
3353
+ color: var(--muted);
3354
+ }
3355
+
3356
+ /*
3357
+ * THE NRIC REVEAL.
3358
+ *
3359
+ * The pressable thing is the masked number, not the glyph beside it: an eye on
3360
+ * its own is a 14-16px target where 24px is the floor, and on a 12.5px member
3361
+ * line an `AppButton variant="icon"` - the layer's 32px icon square - would
3362
+ * make the NRIC line half again the height of the Contact line under it.
3363
+ * Pressing the digits gives a target the width of the value at no cost to the
3364
+ * rhythm, and reads the right way round: the number is what changes.
3365
+ *
3366
+ * It inherits its type rather than setting any, so the visitor's NRIC stays on
3367
+ * `--fs-cell` and a member's on the `--fs-breadcrumb` of the line it sits in.
3368
+ * The negative margin pays back the padding, so a revealed value starts on the
3369
+ * same left edge as every other value in the card.
3370
+ */
3371
+ .visitor-preview__reveal {
3372
+ display: inline-flex;
3373
+ align-items: center;
3374
+ gap: 6px;
3375
+ margin: -3px -7px;
3376
+ padding: 3px 7px;
3377
+ border: none;
3378
+ border-radius: var(--r-inner-sm);
3379
+ background: transparent;
3380
+ font: inherit;
3381
+ color: inherit;
3382
+ text-align: left;
3383
+ cursor: pointer;
3384
+ transition: background var(--motion) ease;
3385
+ }
3386
+
3387
+ .visitor-preview__reveal:hover {
3388
+ background: var(--hover);
3389
+ }
3390
+
3391
+ .visitor-preview__reveal:focus-visible {
3392
+ outline: 2px solid var(--accent);
3393
+ outline-offset: 1px;
3394
+ }
3395
+
3396
+ /* The design's interactive ink - not Vuetify's fixed blue, which is one colour
3397
+ on both themes. `affectedEntities` gives its NRIC eye the same value. */
3398
+ .visitor-preview__eye {
3399
+ color: var(--accent-text);
3400
+ }
3401
+
3402
+ @media (prefers-reduced-motion: reduce) {
3403
+ .visitor-preview__reveal {
3404
+ transition: none;
3405
+ }
3406
+ }
3407
+
3146
3408
  /* The width the type filter carried as `max-width="200"` on the v-select. */
3147
3409
  .visitor-type-filter {
3148
3410
  max-width: 200px;
@@ -319,7 +319,23 @@ export default function useAccessManagement() {
319
319
  );
320
320
  }
321
321
 
322
- function assignUser(payload: { assignees: string[]; unit: string; type: string; acm_url: string; id?: string }) {
322
+ /**
323
+ * `holderType` is the GROUP the card was given from — "Visitor/Resident",
324
+ * "Management" or "Service Provider" (core `EAccessCardHolderTypes`).
325
+ *
326
+ * It is what lets the server resolve the holder afterwards: `assignees`
327
+ * carries a `users` id for a resident, but a membership id for a service
328
+ * provider, and only the group says which collection to look in. Omit it and
329
+ * the card stores `holderType: null`, so card details cannot name the holder.
330
+ */
331
+ function assignUser(payload: {
332
+ assignees: string[];
333
+ unit: string;
334
+ type: string;
335
+ acm_url: string;
336
+ id?: string;
337
+ holderType?: "Visitor/Resident" | "Management" | "Service Provider";
338
+ }) {
323
339
  return useNuxtApp().$api<Record<string, any>>(
324
340
  `/api/access-management/assign-user`,
325
341
  { method: "POST", body: payload }
@@ -86,7 +86,36 @@ async function deleteById(id: string) {
86
86
  );
87
87
  }
88
88
 
89
+ // Change provider at a site / change site owner (owner 2026-10-05).
90
+ type TProviderChangeInput = {
91
+ site: string;
92
+ kind: "provider" | "owner";
93
+ from: string;
94
+ to?: string | null;
95
+ endDate?: string | null;
96
+ };
97
+ function previewProviderChange(body: TProviderChangeInput) {
98
+ return useNuxtApp().$api<Record<string, any>>("/api/customer-sites/provider-changes/preview", { method: "POST", body });
99
+ }
100
+ function applyProviderChange(body: TProviderChangeInput) {
101
+ return useNuxtApp().$api<Record<string, any>>("/api/customer-sites/provider-changes", { method: "POST", body });
102
+ }
103
+ function listProviderChanges(site: string) {
104
+ return useNuxtApp().$api<Record<string, any>[]>("/api/customer-sites/provider-changes", { method: "GET", query: { site } });
105
+ }
106
+ function undoProviderChange(id: string) {
107
+ return useNuxtApp().$api<Record<string, any>>(`/api/customer-sites/provider-changes/${id}/undo`, { method: "POST" });
108
+ }
109
+ function cancelProviderChange(id: string) {
110
+ return useNuxtApp().$api<Record<string, any>>(`/api/customer-sites/provider-changes/${id}/cancel`, { method: "POST" });
111
+ }
112
+
89
113
  return {
114
+ previewProviderChange,
115
+ applyProviderChange,
116
+ listProviderChanges,
117
+ undoProviderChange,
118
+ cancelProviderChange,
90
119
  add,
91
120
  getAll,
92
121
  addViaInvite,
@@ -6,6 +6,7 @@ export default function useDocument() {
6
6
  type = "all",
7
7
  site = "",
8
8
  parentId = "",
9
+ expiry = "all",
9
10
  }: {
10
11
  page?: number;
11
12
  search?: string;
@@ -13,6 +14,11 @@ export default function useDocument() {
13
14
  type?: string;
14
15
  site?: string;
15
16
  parentId?: string;
17
+ /**
18
+ * Which tab is asking: "active" for Documents, "expired" for
19
+ * Document (Expired). Defaults to "all" so existing callers are unaffected.
20
+ */
21
+ expiry?: string;
16
22
  } = {}) {
17
23
  const query: Record<string, any> = {
18
24
  page,
@@ -21,6 +27,7 @@ export default function useDocument() {
21
27
  type,
22
28
  site,
23
29
  parentId,
30
+ expiry,
24
31
  };
25
32
 
26
33
  return useNuxtApp().$api<Record<string, any>>(`/api/documents`, {
@@ -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;
@@ -28,6 +28,22 @@ export type HidReaderPayload = {
28
28
  lastCallbackType?: string;
29
29
  };
30
30
 
31
+ export type HidProfileQr = {
32
+ readerId: string;
33
+ userId: string;
34
+ memberId: string;
35
+ hidUserId: string;
36
+ registration: string;
37
+ readerName: string;
38
+ portalName: string;
39
+ qrEnabled: boolean;
40
+ issued: boolean;
41
+ qrValue: string;
42
+ issuedAt: string;
43
+ /** null when the permission lookup itself failed, so "unknown" stays distinct from "no". */
44
+ assigned: boolean | null;
45
+ };
46
+
31
47
  type HidIdentityPayload = {
32
48
  site?: string;
33
49
  hidUserId?: string | number;
@@ -139,6 +155,28 @@ export type HidSipAccountData = {
139
155
  provisionedAt: string;
140
156
  };
141
157
 
158
+ /** One row of the site's SIP account list - who owns the extension, never its password. */
159
+ export type HidSipAccountListItem = {
160
+ _id: string;
161
+ userId: string;
162
+ name: string;
163
+ email: string;
164
+ /**
165
+ * What the owner is called after their name on the contact list: their
166
+ * "Blk 1/Level 1/Unit 1" when they live here, and their membership type -
167
+ * "Security Agency" - when they do not. "" only when the site knows neither.
168
+ *
169
+ * Optional because an API still on the `@7365admin1/core` release that
170
+ * predates it answers without the field; the contact picker falls back to the
171
+ * bare name rather than showing a dangling separator.
172
+ */
173
+ unitLabel?: string;
174
+ extension: string;
175
+ username: string;
176
+ status: string;
177
+ provisionedAt: string;
178
+ };
179
+
142
180
  /**
143
181
  * True only for the specific validation error an API that predates core #1878
144
182
  * returns when the discover body carries `site`. Deliberately narrow: after
@@ -166,6 +204,36 @@ export default function useHidAmico() {
166
204
  });
167
205
  }
168
206
 
207
+ /**
208
+ * The signed-in member's own QR code on one reader.
209
+ *
210
+ * No user id in the path: the server takes the caller from the session, so
211
+ * these cannot be pointed at somebody else. `assigned` in the response says
212
+ * whether the HID permissions screen actually admits this member to the
213
+ * reader - issuing a code does not grant access, and the screen has to be
214
+ * able to say so.
215
+ */
216
+ function getProfileQr(readerId: string) {
217
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
218
+ `${basePath}/readers/${readerId}/profile-qr`,
219
+ { method: "GET" },
220
+ );
221
+ }
222
+
223
+ function issueProfileQr(readerId: string) {
224
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
225
+ `${basePath}/readers/${readerId}/profile-qr`,
226
+ { method: "POST" },
227
+ );
228
+ }
229
+
230
+ function deleteProfileQr(readerId: string) {
231
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
232
+ `${basePath}/readers/${readerId}/profile-qr`,
233
+ { method: "DELETE" },
234
+ );
235
+ }
236
+
169
237
  function createReader(payload: HidReaderPayload) {
170
238
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers`, {
171
239
  method: "POST",
@@ -257,6 +325,36 @@ export default function useHidAmico() {
257
325
  });
258
326
  }
259
327
 
328
+ /**
329
+ * Which credentials a reader accepts at the door.
330
+ *
331
+ * Separate from `setReaderConfiguration` on purpose. That one is the generic
332
+ * configuration endpoint, gated by an allowlist of writable objects; this is
333
+ * a dedicated route that validates the four methods against the reader's own
334
+ * `capabilities` and confirms the write by reading the device back, so a
335
+ * refusal here names the credential the hardware would not take.
336
+ */
337
+ function setReaderIdentificationMethods(readerId: string, payload: HidApiRecord) {
338
+ return useNuxtApp().$api<HidApiRecord>(
339
+ `${basePath}/readers/${readerId}/identification-methods`,
340
+ { method: "PUT", body: payload },
341
+ );
342
+ }
343
+
344
+ /**
345
+ * Put a reader back to the settings iService holds for it.
346
+ *
347
+ * A POST rather than a GET because it WRITES: reading the reader's
348
+ * configuration is only the first half, and anything that drifted is
349
+ * re-applied before this returns.
350
+ */
351
+ function reconcileReaderIdentificationMethods(readerId: string) {
352
+ return useNuxtApp().$api<HidApiRecord>(
353
+ `${basePath}/readers/${readerId}/identification-methods/reconcile`,
354
+ { method: "POST" },
355
+ );
356
+ }
357
+
260
358
  function getIdentities(readerId: string, query: HidApiRecord = {}) {
261
359
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers/${readerId}/identities`, {
262
360
  method: "GET",
@@ -414,6 +512,27 @@ export default function useHidAmico() {
414
512
  );
415
513
  }
416
514
 
515
+ function getUserPasswordStatus(readerId: string, hidUserId: string | number) {
516
+ return useNuxtApp().$api<HidApiRecord>(
517
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
518
+ { method: "GET" },
519
+ );
520
+ }
521
+
522
+ function setUserPassword(readerId: string, hidUserId: string | number, password: string) {
523
+ return useNuxtApp().$api<HidApiRecord>(
524
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
525
+ { method: "PUT", body: { password } },
526
+ );
527
+ }
528
+
529
+ function deleteUserPassword(readerId: string, hidUserId: string | number) {
530
+ return useNuxtApp().$api<HidApiRecord>(
531
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
532
+ { method: "DELETE" },
533
+ );
534
+ }
535
+
417
536
  function deleteUserPin(readerId: string, hidUserId: string | number) {
418
537
  return useNuxtApp().$api<{ data: { pinEnrolled: boolean } }>(
419
538
  `${basePath}/readers/${readerId}/users/${hidUserId}/pin`,
@@ -474,6 +593,42 @@ export default function useHidAmico() {
474
593
  );
475
594
  }
476
595
 
596
+ /**
597
+ * The site's SIP accounts for the intercom contact picker. Site-scoped only:
598
+ * the organisation never decided who may read this — the site guard does —
599
+ * and sending one narrowed the list on a customer site whose accounts were
600
+ * provisioned by a managing agent.
601
+ */
602
+ function getSipAccounts(siteId: string) {
603
+ return useNuxtApp().$api<{ data: HidSipAccountListItem[] }>(
604
+ `${basePath}/sites/${siteId}/intercom/sip-accounts`,
605
+ { method: "GET" },
606
+ );
607
+ }
608
+
609
+ /**
610
+ * Wake the resident's phone for a call the web phone has just placed.
611
+ *
612
+ * The SIP INVITE is the call and travels over the WebSocket, not through the
613
+ * API; this only rings the resident's mobile so somebody is there to answer
614
+ * it. It is therefore fired after the INVITE and never awaited in a way that
615
+ * could fail the call — see `startWebCall` in `HidIntercomManagement.vue`.
616
+ *
617
+ * `notified: false` with a reason is a normal response, not an error: staff
618
+ * extensions and external SIP addresses have no resident behind them.
619
+ */
620
+ function notifyIntercomCall(
621
+ siteId: string,
622
+ payload: { orgId: string; destination: string; callId: string; readerId?: string },
623
+ ) {
624
+ return useNuxtApp().$api<{
625
+ data: { notified: boolean; delivered?: number; reason?: string };
626
+ }>(
627
+ `${basePath}/sites/${siteId}/intercom/notify-call`,
628
+ { method: "POST", body: payload },
629
+ );
630
+ }
631
+
477
632
  function getPermissionCandidates(
478
633
  siteId: string,
479
634
  query: {
@@ -505,6 +660,9 @@ export default function useHidAmico() {
505
660
 
506
661
  return {
507
662
  getReaders,
663
+ getProfileQr,
664
+ issueProfileQr,
665
+ deleteProfileQr,
508
666
  discoverReader,
509
667
  createReader,
510
668
  updateReader,
@@ -519,6 +677,8 @@ export default function useHidAmico() {
519
677
  issueVisitorQr,
520
678
  getReaderConfiguration,
521
679
  setReaderConfiguration,
680
+ setReaderIdentificationMethods,
681
+ reconcileReaderIdentificationMethods,
522
682
  getLogs,
523
683
  setUserImage,
524
684
  deleteUserImage,
@@ -530,6 +690,9 @@ export default function useHidAmico() {
530
690
  getUserPinStatus,
531
691
  setUserPin,
532
692
  deleteUserPin,
693
+ getUserPasswordStatus,
694
+ setUserPassword,
695
+ deleteUserPassword,
533
696
  getIdentities,
534
697
  getReaderUsers,
535
698
  getReaderAccessLogs,
@@ -540,6 +703,8 @@ export default function useHidAmico() {
540
703
  makeIntercomCall,
541
704
  finalizeIntercomCall,
542
705
  ensureSipAccount,
706
+ getSipAccounts,
707
+ notifyIntercomCall,
543
708
  getSitePermissions,
544
709
  getPermissionCandidates,
545
710
  updateSitePermissions,
@@ -46,9 +46,33 @@ export default function useHidNavigation() {
46
46
  },
47
47
  },
48
48
  {
49
+ // "HID Reader Users" now points at `access-mgmt/administrator`, not at
50
+ // `access-mgmt/hid-users`.
51
+ //
52
+ // Both routes mount a roster of the reader's users, but only this one
53
+ // can act on them. `administrator` renders HidUserEnrollment WITHOUT
54
+ // `card-management`, and that prop is what gates the Enroll action:
55
+ // <template v-if="!props.cardManagement" #actions>
56
+ // `hid-users` renders HidReaderUserRoster, which is read-only apart
57
+ // from PIN management. So the menu entry with this name used to lead
58
+ // to the screen that cannot enrol, while the screen that can was
59
+ // reachable only by typing the URL.
60
+ //
61
+ // `hid-users` is left in place and simply unlisted - the same state
62
+ // `administrator` was in - so any existing link to it still resolves.
49
63
  title: "HID Reader Users",
50
64
  route: {
51
- name: "org-site-access-mgmt-hid-users",
65
+ name: "org-site-access-mgmt-administrator",
66
+ params: { org, site },
67
+ },
68
+ },
69
+ {
70
+ // The signed-in member's own pass, not somebody else's. Every other
71
+ // entry in this group acts on a resident or a visitor; this one has
72
+ // no subject but the caller.
73
+ title: "HID QR Code",
74
+ route: {
75
+ name: "org-site-access-mgmt-hid-qr-code",
52
76
  params: { org, site },
53
77
  },
54
78
  },