@7365admin1/layer-common 4.34.0 → 4.34.1-staging.368

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 (44) hide show
  1. package/CHANGELOG.md +4 -37
  2. package/components/AccessCardAddForm.vue +5 -4
  3. package/components/AccessCardAssignToUnitForm.vue +3 -2
  4. package/components/AccessCardPreviewDialog.vue +4 -3
  5. package/components/Dialog/UpdateMoreAction.vue +11 -1
  6. package/components/DocumentForm.vue +407 -112
  7. package/components/DocumentManagement.vue +213 -12
  8. package/components/EntryPass/QrTemplatePreview.vue +21 -25
  9. package/components/EntryPassInformation.vue +119 -24
  10. package/components/Facility/BookingSetup.vue +63 -0
  11. package/components/HidAccessLogDashboard.vue +41 -8
  12. package/components/HidAccessPermissions.vue +424 -0
  13. package/components/HidIntercomManagement.vue +148 -14
  14. package/components/HidProfileQrCode.vue +332 -0
  15. package/components/HidQrCodeConfiguration.vue +17 -195
  16. package/components/HidReaderManagement.vue +306 -0
  17. package/components/HidReaderUserRoster.vue +44 -3
  18. package/components/HidUserEnrollment.vue +845 -155
  19. package/components/InvitationClientForm.vue +19 -1
  20. package/components/NotificationBell.vue +39 -3
  21. package/components/VisitorForm.vue +12 -0
  22. package/components/VisitorManagement.vue +267 -5
  23. package/composables/useAccessManagement.ts +5 -0
  24. package/composables/useDocument.ts +7 -0
  25. package/composables/useFacility.ts +11 -0
  26. package/composables/useHidAmico.ts +134 -0
  27. package/composables/useHidNavigation.ts +25 -1
  28. package/composables/useHidReaderSelection.ts +50 -0
  29. package/composables/usePeople.ts +19 -0
  30. package/composables/useSiteCategory.ts +45 -0
  31. package/composables/useSiteEntryPassSettings.ts +26 -0
  32. package/composables/useWebUsb.ts +14 -11
  33. package/package.json +1 -1
  34. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  35. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  36. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  37. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  38. package/types/document.d.ts +14 -0
  39. package/types/facility.d.ts +4 -0
  40. package/types/people.d.ts +28 -1
  41. package/utils/hid-permission-assignments.ts +190 -0
  42. package/utils/hid-reader-selection.ts +52 -0
  43. package/utils/notification-target.ts +75 -0
  44. package/utils/occupancy-role.ts +109 -0
@@ -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,18 @@ 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
+ extension: string;
165
+ username: string;
166
+ status: string;
167
+ provisionedAt: string;
168
+ };
169
+
142
170
  /**
143
171
  * True only for the specific validation error an API that predates core #1878
144
172
  * returns when the discover body carries `site`. Deliberately narrow: after
@@ -166,6 +194,36 @@ export default function useHidAmico() {
166
194
  });
167
195
  }
168
196
 
197
+ /**
198
+ * The signed-in member's own QR code on one reader.
199
+ *
200
+ * No user id in the path: the server takes the caller from the session, so
201
+ * these cannot be pointed at somebody else. `assigned` in the response says
202
+ * whether the HID permissions screen actually admits this member to the
203
+ * reader - issuing a code does not grant access, and the screen has to be
204
+ * able to say so.
205
+ */
206
+ function getProfileQr(readerId: string) {
207
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
208
+ `${basePath}/readers/${readerId}/profile-qr`,
209
+ { method: "GET" },
210
+ );
211
+ }
212
+
213
+ function issueProfileQr(readerId: string) {
214
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
215
+ `${basePath}/readers/${readerId}/profile-qr`,
216
+ { method: "POST" },
217
+ );
218
+ }
219
+
220
+ function deleteProfileQr(readerId: string) {
221
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
222
+ `${basePath}/readers/${readerId}/profile-qr`,
223
+ { method: "DELETE" },
224
+ );
225
+ }
226
+
169
227
  function createReader(payload: HidReaderPayload) {
170
228
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers`, {
171
229
  method: "POST",
@@ -257,6 +315,22 @@ export default function useHidAmico() {
257
315
  });
258
316
  }
259
317
 
318
+ /**
319
+ * Which credentials a reader accepts at the door.
320
+ *
321
+ * Separate from `setReaderConfiguration` on purpose. That one is the generic
322
+ * configuration endpoint, gated by an allowlist of writable objects; this is
323
+ * a dedicated route that validates the four methods against the reader's own
324
+ * `capabilities` and confirms the write by reading the device back, so a
325
+ * refusal here names the credential the hardware would not take.
326
+ */
327
+ function setReaderIdentificationMethods(readerId: string, payload: HidApiRecord) {
328
+ return useNuxtApp().$api<HidApiRecord>(
329
+ `${basePath}/readers/${readerId}/identification-methods`,
330
+ { method: "PUT", body: payload },
331
+ );
332
+ }
333
+
260
334
  function getIdentities(readerId: string, query: HidApiRecord = {}) {
261
335
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers/${readerId}/identities`, {
262
336
  method: "GET",
@@ -414,6 +488,27 @@ export default function useHidAmico() {
414
488
  );
415
489
  }
416
490
 
491
+ function getUserPasswordStatus(readerId: string, hidUserId: string | number) {
492
+ return useNuxtApp().$api<HidApiRecord>(
493
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
494
+ { method: "GET" },
495
+ );
496
+ }
497
+
498
+ function setUserPassword(readerId: string, hidUserId: string | number, password: string) {
499
+ return useNuxtApp().$api<HidApiRecord>(
500
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
501
+ { method: "PUT", body: { password } },
502
+ );
503
+ }
504
+
505
+ function deleteUserPassword(readerId: string, hidUserId: string | number) {
506
+ return useNuxtApp().$api<HidApiRecord>(
507
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
508
+ { method: "DELETE" },
509
+ );
510
+ }
511
+
417
512
  function deleteUserPin(readerId: string, hidUserId: string | number) {
418
513
  return useNuxtApp().$api<{ data: { pinEnrolled: boolean } }>(
419
514
  `${basePath}/readers/${readerId}/users/${hidUserId}/pin`,
@@ -474,6 +569,36 @@ export default function useHidAmico() {
474
569
  );
475
570
  }
476
571
 
572
+ function getSipAccounts(siteId: string, orgId: string) {
573
+ return useNuxtApp().$api<{ data: HidSipAccountListItem[] }>(
574
+ `${basePath}/sites/${siteId}/intercom/sip-accounts`,
575
+ { method: "GET", query: { orgId } },
576
+ );
577
+ }
578
+
579
+ /**
580
+ * Wake the resident's phone for a call the web phone has just placed.
581
+ *
582
+ * The SIP INVITE is the call and travels over the WebSocket, not through the
583
+ * API; this only rings the resident's mobile so somebody is there to answer
584
+ * it. It is therefore fired after the INVITE and never awaited in a way that
585
+ * could fail the call — see `startWebCall` in `HidIntercomManagement.vue`.
586
+ *
587
+ * `notified: false` with a reason is a normal response, not an error: staff
588
+ * extensions and external SIP addresses have no resident behind them.
589
+ */
590
+ function notifyIntercomCall(
591
+ siteId: string,
592
+ payload: { orgId: string; destination: string; callId: string; readerId?: string },
593
+ ) {
594
+ return useNuxtApp().$api<{
595
+ data: { notified: boolean; delivered?: number; reason?: string };
596
+ }>(
597
+ `${basePath}/sites/${siteId}/intercom/notify-call`,
598
+ { method: "POST", body: payload },
599
+ );
600
+ }
601
+
477
602
  function getPermissionCandidates(
478
603
  siteId: string,
479
604
  query: {
@@ -505,6 +630,9 @@ export default function useHidAmico() {
505
630
 
506
631
  return {
507
632
  getReaders,
633
+ getProfileQr,
634
+ issueProfileQr,
635
+ deleteProfileQr,
508
636
  discoverReader,
509
637
  createReader,
510
638
  updateReader,
@@ -519,6 +647,7 @@ export default function useHidAmico() {
519
647
  issueVisitorQr,
520
648
  getReaderConfiguration,
521
649
  setReaderConfiguration,
650
+ setReaderIdentificationMethods,
522
651
  getLogs,
523
652
  setUserImage,
524
653
  deleteUserImage,
@@ -530,6 +659,9 @@ export default function useHidAmico() {
530
659
  getUserPinStatus,
531
660
  setUserPin,
532
661
  deleteUserPin,
662
+ getUserPasswordStatus,
663
+ setUserPassword,
664
+ deleteUserPassword,
533
665
  getIdentities,
534
666
  getReaderUsers,
535
667
  getReaderAccessLogs,
@@ -540,6 +672,8 @@ export default function useHidAmico() {
540
672
  makeIntercomCall,
541
673
  finalizeIntercomCall,
542
674
  ensureSipAccount,
675
+ getSipAccounts,
676
+ notifyIntercomCall,
543
677
  getSitePermissions,
544
678
  getPermissionCandidates,
545
679
  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
  },
@@ -0,0 +1,50 @@
1
+ import {
2
+ EMPTY_HID_READER_CHOICE,
3
+ resolveHidReaderId,
4
+ type HidReaderChoice,
5
+ } from "../utils/hid-reader-selection";
6
+
7
+ /**
8
+ * ONE HID READER CHOICE, SHARED BY EVERY HID SCREEN.
9
+ *
10
+ * Declared at MODULE scope on purpose. Each screen held its own `ref("")`, and
11
+ * because the HID screens are separate pages the ref was rebuilt on every
12
+ * navigation — HID Reader Users, HID Cards, Access Logs and HID QR Code each
13
+ * reset to the first reader no matter what had just been picked next door.
14
+ *
15
+ * A module-scoped ref is enough because moving between those pages is a ROUTE
16
+ * change, not a page load: the menu's items carry a `route` and
17
+ * `NavigationItem.vue` renders them through `:to`, so vue-router handles them
18
+ * and this module is never re-evaluated.
19
+ *
20
+ * Deliberately NOT persisted. `localStorage` would carry the choice through a
21
+ * hard refresh as well, which is a real but much smaller benefit than the
22
+ * navigation case, and it is worth adding only once somebody has felt the
23
+ * absence. See `utils/hid-reader-selection.ts` for the staleness rule that
24
+ * would have to hold either way.
25
+ *
26
+ * Intercom keeps its own reader and is not wired to this. Its question is which
27
+ * panel you are calling, not which door you are administering, and joining them
28
+ * would mean switching reader on Access Logs changed who you would dial.
29
+ */
30
+ const choice = ref<HidReaderChoice>({ ...EMPTY_HID_READER_CHOICE });
31
+
32
+ export default function useHidReaderSelection() {
33
+ /** Remember a choice. The site travels with it; an id alone means nothing. */
34
+ function selectHidReader(siteId: string, readerId: string) {
35
+ choice.value = { siteId: String(siteId ?? ""), readerId: String(readerId ?? "") };
36
+ }
37
+
38
+ /**
39
+ * The reader this screen should show, given the readers it just loaded.
40
+ *
41
+ * Call it after the reader list arrives, and write the answer back with
42
+ * `selectHidReader` so the screens agree on what "current" means even when
43
+ * one of them had to fall back to the first reader.
44
+ */
45
+ function resolveForSite(siteId: string, readers: readonly { _id?: unknown }[]) {
46
+ return resolveHidReaderId(siteId, readers, choice.value);
47
+ }
48
+
49
+ return { choice, selectHidReader, resolveForSite };
50
+ }
@@ -115,6 +115,24 @@ export default function () {
115
115
  });
116
116
  }
117
117
 
118
+ /**
119
+ * The blocks, levels and units at a site that actually have an occupant.
120
+ * The other half of the unit picker: this narrows the cascade, then
121
+ * `getPeopleByUnit` answers "which person in this unit?".
122
+ */
123
+ async function getOccupiedStructure(
124
+ site: string,
125
+ { type = "", status = "active", block = "", level = "" } = {}
126
+ ) {
127
+ return await useNuxtApp().$api<Record<string, any>>(
128
+ `/api/people/site/${site}/occupied-structure`,
129
+ {
130
+ method: "GET",
131
+ query: { type, status, block, level },
132
+ }
133
+ );
134
+ }
135
+
118
136
  async function getPeopleByUnit(
119
137
  _id: string,
120
138
  { status = "active", type = "" } = {}
@@ -148,6 +166,7 @@ export default function () {
148
166
  findPersonByPlateNumberMultipleResult,
149
167
  findPersonByContact,
150
168
  getPeopleByUnit,
169
+ getOccupiedStructure,
151
170
  searchCompanyList,
152
171
  findUsersByPlateNumber,
153
172
  reviewResidentPerson,
@@ -0,0 +1,45 @@
1
+ /**
2
+ * THE CATEGORY OF THE SITE THE USER IS CURRENTLY IN.
3
+ *
4
+ * One shared answer, published once by the application's layout from the site
5
+ * it already loaded for the switcher, and read by anything that has to behave
6
+ * differently on a commercial or industrial site - the business Add Tenant
7
+ * form, the tenant list. Publishing it rather than re-fetching it per
8
+ * component means no two screens can disagree about which site this is.
9
+ *
10
+ * READ FROM THE CUSTOMER-SITE RECORD, NOT THE SITE RECORD. Both carry a
11
+ * `category` and `customer-site.service` keeps them equal (it writes the site
12
+ * on create and on update), but `siteSchema` DEFAULTS the site's own copy to
13
+ * `commercial` - so a site created without an explicit category reads back as
14
+ * commercial there even when it is a residential estate. The customer-site
15
+ * copy has no default: it is either the category somebody chose or nothing.
16
+ *
17
+ * An empty category means "not published yet" or "never set", and every
18
+ * caller must behave as it did before this existed - never assume commercial
19
+ * from silence.
20
+ */
21
+ const BUSINESS_SITE_CATEGORIES: string[] = ["commercial", "industrial"];
22
+
23
+ export default function useSiteCategory() {
24
+ const siteCategory = useState<string>("current-site-category", () => "");
25
+
26
+ function setSiteCategory(value?: string | null) {
27
+ siteCategory.value = typeof value === "string" ? value : "";
28
+ }
29
+
30
+ /**
31
+ * The categories whose units are LET TO A BUSINESS rather than lived in.
32
+ *
33
+ * These are the sites where a unit has an owner, an occupier and often a
34
+ * person in charge who is neither, so they are the sites that ask for a
35
+ * tenant's standing and print it back (see `OCCUPANCY_ROLE_OPTIONS`).
36
+ *
37
+ * The category never changes what the APPLICATION is called: the rail says
38
+ * Property Management on every site it serves.
39
+ */
40
+ const isBusinessSite = computed(() =>
41
+ BUSINESS_SITE_CATEGORIES.includes(siteCategory.value),
42
+ );
43
+
44
+ return { siteCategory, isBusinessSite, setSiteCategory };
45
+ }
@@ -27,9 +27,35 @@ export default function useSiteEntryPassSettings() {
27
27
  );
28
28
  }
29
29
 
30
+ /**
31
+ * The encrypted ACM URL the access-card screens hand to API-core, which
32
+ * decrypts it and sends the ACM commands to that host.
33
+ *
34
+ * Resolves the site's own "Enter entrypass URL" setting first, the way
35
+ * `VisitorForm` does for contractor passes. The access-card forms used to
36
+ * call `/api/encrypt-acm-url` with no `url`, so every site's door/lift
37
+ * levels and access groups came from the route's hardcoded default host
38
+ * whatever the site had configured. A site with no URL set, or whose
39
+ * settings cannot be read, still gets that default.
40
+ */
41
+ async function getEncryptedAcmUrl(siteId: string): Promise<string> {
42
+ let rawUrl = "";
43
+ try {
44
+ const settings: any = await getBySiteId(siteId);
45
+ rawUrl = String(settings?.data?.settings?.url ?? "").trim();
46
+ } catch {
47
+ // No entry pass settings for this site yet - the default host applies.
48
+ }
49
+ const { encrypted } = await $fetch<{ encrypted: string }>(
50
+ `/api/encrypt-acm-url${rawUrl ? `?url=${encodeURIComponent(rawUrl)}` : ""}`,
51
+ );
52
+ return encrypted;
53
+ }
54
+
30
55
  return {
31
56
  getBySiteId,
32
57
  getById,
33
58
  save,
59
+ getEncryptedAcmUrl,
34
60
  };
35
61
  }
@@ -345,16 +345,19 @@ export default function useWebUsb() {
345
345
  70,
346
346
  );
347
347
 
348
- const qrSmall = 140;
349
- const qrCenter = 250;
350
- const margin = 20;
351
- const qrCanvas = await QRCode.toCanvas(qrUrlImage, { width: qrCenter });
348
+ // The pass used to print five copies of the same QR - four 140px ones at
349
+ // the corners around a 250px centre - so a strip could be cut apart. It now
350
+ // prints a single large QR filling that same band (y 90 to 440, above the
351
+ // company name at y 470), which scans far more reliably on a thermal print.
352
+ // Generated at the size it is drawn at: the old corner copies were
353
+ // downscaled from the 250px canvas, which softened their modules.
354
+ const qrSize = 350;
355
+ const qrCanvas = await QRCode.toCanvas(qrUrlImage, {
356
+ width: qrSize,
357
+ margin: 1,
358
+ });
352
359
 
353
- ctx.drawImage(qrCanvas, margin, 90, qrSmall, qrSmall);
354
- ctx.drawImage(qrCanvas, canvas.width - qrSmall - margin, 90, qrSmall, qrSmall);
355
- ctx.drawImage(qrCanvas, (canvas.width - qrCenter) / 2, 110, qrCenter, qrCenter);
356
- ctx.drawImage(qrCanvas, margin, 300, qrSmall, qrSmall);
357
- ctx.drawImage(qrCanvas, canvas.width - qrSmall - margin, 300, qrSmall, qrSmall);
360
+ ctx.drawImage(qrCanvas, (canvas.width - qrSize) / 2, 90, qrSize, qrSize);
358
361
 
359
362
  ctx.font = "25px Arial";
360
363
  ctx.fillText(companyName || "", canvas.width / 2, 470);
@@ -401,8 +404,8 @@ export default function useWebUsb() {
401
404
  /**
402
405
  * The self-service onboarding QR: one large QR code, a "SCAN QR CODE"-style
403
406
  * subtext, and a dark site-name banner along the bottom - a single-purpose
404
- * gate sign, not the multi-copy visitor-pass receipt `createReceiptLayout`
405
- * produces (that one prints several QRs to be cut apart and handed out).
407
+ * gate sign, not the visitor-pass receipt `createReceiptLayout` produces
408
+ * (that one pairs its QR with company, date, access and instruction lines).
406
409
  */
407
410
  async function createOnboardingQrLayout(
408
411
  qrUrlImage: string,
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.34.0",
5
+ "version": "4.34.1-staging.368",
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.",
@@ -5,7 +5,7 @@
5
5
  :org="orgId"
6
6
  message="Enable HID as a service for this site before managing HID users."
7
7
  >
8
- <HidUserEnrollment :site="siteId" />
8
+ <HidUserEnrollment :site="siteId" :org="orgId" />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -5,7 +5,7 @@
5
5
  :org="orgId"
6
6
  message="Enable HID as a service for this site before managing physical HID cards."
7
7
  >
8
- <HidUserEnrollment :site="siteId" card-management />
8
+ <HidUserEnrollment :site="siteId" :org="orgId" card-management />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <HidEnabledGate
4
+ :site="siteId"
5
+ :org="orgId"
6
+ message="Enable HID as a service for this site before generating a QR code."
7
+ >
8
+ <HidProfileQrCode :site="siteId" />
9
+ </HidEnabledGate>
10
+ </v-container>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ definePageMeta({
15
+ layout: "default",
16
+ middleware: ["01-auth", "02-org"],
17
+ memberOnly: true,
18
+ });
19
+
20
+ const route = useRoute();
21
+ const siteId = computed(() => String(route.params.site ?? ""));
22
+ const orgId = computed(() => String(route.params.org ?? ""));
23
+ </script>
@@ -5,7 +5,7 @@
5
5
  :org="orgId"
6
6
  message="Enable HID as a service for this site before managing HID readers."
7
7
  >
8
- <HidReaderManagement :site="siteId" />
8
+ <HidReaderManagement :site="siteId" :org="orgId" />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -3,4 +3,18 @@ declare type TDocument = {
3
3
  name: string;
4
4
  attachment: string;
5
5
  type: string;
6
+ /**
7
+ * Set at upload or renewal, absent when the document never expires.
8
+ *
9
+ * An ISO instant on the way out of the API and a `YYYY-MM-DD` string on the
10
+ * way back in, which is what `InputDatePicker` binds to - hence the loose
11
+ * type rather than `string`.
12
+ */
13
+ expiryDate?: string | Date | null;
14
+ remarks?: string;
15
+ size?: number;
16
+ parentId?: string | null;
17
+ createdAt?: string | Date;
18
+ updatedAt?: string | Date;
19
+ status?: string;
6
20
  };
@@ -73,6 +73,10 @@ declare type TFacility = {
73
73
  hourInterval?: number;
74
74
  isBookingFeeEnabled: boolean;
75
75
  isGuestEnabled: boolean;
76
+ /** Residents may complete this facility's checklist themselves. */
77
+ isResidentChecklistEnabled?: boolean;
78
+ /** Security may complete it. Mutually exclusive with the above. */
79
+ isSecurityChecklistEnabled?: boolean;
76
80
  bookingAmount: number | null;
77
81
  peakBookingFeeAmount?: number | null;
78
82
  bookingFeeGuestAmount?: number | null;
package/types/people.d.ts CHANGED
@@ -22,11 +22,38 @@ declare type TPeople = {
22
22
  email?: string;
23
23
  files?: { name: string, id: string }[];
24
24
  isOwner?: boolean;
25
+ /**
26
+ * Owner / occupant / person-in-charge, as the BUSINESS people form asks it.
27
+ * Absent on everyone else - `isOwner` is still the flag that decides unit
28
+ * ownership, and the server derives it from this when it is sent. See
29
+ * `OccupancyRoles` in core's `person.model.ts`.
30
+ */
31
+ occupancyRole?: TOccupancyRole;
32
+ // Link to this person's `users` row. Empty for the person types that carry
33
+ // no login, and empty for a resident whose account was never written.
34
+ user?: string;
35
+ };
36
+
37
+ declare type TOccupancyRole = "owner" | "occupant" | "person-in-charge";
38
+
39
+ /** One standing and everything the product says about it. See `utils/occupancy-role.ts`. */
40
+ declare type TOccupancyRoleOption = {
41
+ value: TOccupancyRole;
42
+ /** The label a stored role is printed with. */
43
+ title: string;
44
+ /** The row menu's wording. */
45
+ action: string;
46
+ /** The confirmation's heading and its sentence. */
47
+ prompt: string;
48
+ description: string;
25
49
  };
26
50
 
27
51
  declare type TPlateNumber = { plateNumber: string, recNo?: string, _id?: string, status: TVehicleStatus, type: TVehicleType, anprCameras?: TVehicleAnprCamera[] };
28
52
 
29
53
 
30
- declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string }
54
+ // `""` is the FORM's "nothing picked yet" - it is stripped from the payload
55
+ // before it is sent, because absence is what the server reads as "never
56
+ // asked". See `PeopleFormMgmt.vue`.
57
+ declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string; user?: string; occupancyRole?: TOccupancyRole | "" }
31
58
 
32
59
  declare type TPeopleType = "guest" | "resident" | "tenant"