@7365admin1/layer-common 4.97.0 → 4.97.1-staging.501

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 (62) hide show
  1. package/CHANGELOG.md +4 -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 +532 -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 +2242 -279
  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/VisitorForm.vue +12 -0
  30. package/components/VisitorManagement.vue +267 -5
  31. package/composables/useAccessManagement.ts +17 -1
  32. package/composables/useCustomerSite.ts +29 -0
  33. package/composables/useDocument.ts +7 -0
  34. package/composables/useFacility.ts +11 -0
  35. package/composables/useHidAmico.ts +165 -0
  36. package/composables/useHidNavigation.ts +25 -1
  37. package/composables/useHidReaderSelection.ts +50 -0
  38. package/composables/useMember.ts +12 -0
  39. package/composables/useNFCPatrolReport.ts +36 -32
  40. package/composables/useNFCPatrolReportFilters.ts +21 -3
  41. package/composables/useNFCPatrolRoute.ts +10 -3
  42. package/composables/usePeople.ts +19 -0
  43. package/composables/useServiceProvider.ts +45 -2
  44. package/composables/useSiteCategory.ts +45 -0
  45. package/package.json +1 -1
  46. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  47. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  48. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  49. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  50. package/types/document.d.ts +14 -0
  51. package/types/facility.d.ts +4 -0
  52. package/types/member.d.ts +4 -0
  53. package/types/nfc-patrol-report.ts +0 -2
  54. package/types/people.d.ts +28 -1
  55. package/types/service-provider.d.ts +5 -0
  56. package/types/site.d.ts +7 -1
  57. package/utils/hid-enrolment-subject.ts +366 -0
  58. package/utils/hid-permission-assignments.ts +259 -0
  59. package/utils/hid-reader-selection.ts +52 -0
  60. package/utils/nfc-patrol-time.ts +99 -0
  61. package/utils/occupancy-role.ts +109 -0
  62. package/utils/service-type.ts +30 -0
@@ -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
+ }
@@ -70,6 +70,8 @@ export default function useMember() {
70
70
  status = "active",
71
71
  siteId = "",
72
72
  roleState = "",
73
+ /** A building unit id, or "none": members on no unit yet. */
74
+ unit = "",
73
75
  people = false,
74
76
  } = {}) {
75
77
  const query: Record<string, any> = { page, limit, type, status };
@@ -83,6 +85,7 @@ export default function useMember() {
83
85
  if (user) query.user = user;
84
86
  if (org) query.org = org;
85
87
  if (siteId) query.siteId = siteId;
88
+ if (unit) query.unit = unit;
86
89
  return useNuxtApp().$api<Record<string, any>>("/api/members", {
87
90
  method: "GET",
88
91
  query,
@@ -158,6 +161,14 @@ export default function useMember() {
158
161
  });
159
162
  }
160
163
 
164
+ /** Attach a member to a building unit, or detach them (`unit` ""). */
165
+ function updateMemberUnit(id: string, unit: string) {
166
+ return useNuxtApp().$api<Record<string, any>>("/api/members/unit", {
167
+ method: "PUT",
168
+ body: { id, unit },
169
+ });
170
+ }
171
+
161
172
  function getByUserTypeOrg(user: string, type: string, org: string) {
162
173
  return useNuxtApp().$api<TMember>(
163
174
  `/api/members/user/${user}/app/${type}/org`,
@@ -226,6 +237,7 @@ export default function useMember() {
226
237
  undoCrossSiteRoleFix,
227
238
  getSiteAccess,
228
239
  saveSiteAccess,
240
+ updateMemberUnit,
229
241
  members,
230
242
  member,
231
243
  page,
@@ -5,6 +5,12 @@ import type {
5
5
  } from "../types/nfc-patrol-report";
6
6
  import useNFCPatrolLog from "./useNFCPatrolLog";
7
7
  import useSite from "./useSite";
8
+ import {
9
+ actualPatrolSpan,
10
+ checkpointClock,
11
+ clockTime,
12
+ DEFAULT_PATROL_TIMEZONE,
13
+ } from "../utils/nfc-patrol-time";
8
14
 
9
15
  interface NFCPatrolLogListResponse {
10
16
  items?: Record<string, any>[];
@@ -12,9 +18,6 @@ interface NFCPatrolLogListResponse {
12
18
  pageRange?: string;
13
19
  }
14
20
 
15
- function formatTime(iso?: string) {
16
- return iso ? iso.slice(11, 16) : "-";
17
- }
18
21
  function formatDuration(totalMinutes: number) {
19
22
  if (totalMinutes < 60) return `${totalMinutes} mins`;
20
23
 
@@ -25,7 +28,7 @@ function formatTime(iso?: string) {
25
28
  return `${hrs} hrs ${mins} mins`;
26
29
  }
27
30
 
28
- function diffMinutes(startIso?: string, endIso?: string) {
31
+ function diffMinutes(startIso?: string | Date, endIso?: string | Date) {
29
32
  if (!startIso || !endIso) return "-";
30
33
  const totalMinutes = Math.max(
31
34
  0,
@@ -38,43 +41,40 @@ function formatTime(iso?: string) {
38
41
  function mapLogToPatrolReport(
39
42
  log: Record<string, any>,
40
43
  location: NFCPatrolReport["location"],
44
+ siteTimezone?: string,
41
45
  ): NFCPatrolReport {
42
46
  const checkpoints: Record<string, any>[] = log.checkPoints ?? [];
43
- const actualStart = checkpoints[0]?.startDateTime ?? log.startDateTime;
44
- const actualEnd = checkpoints[checkpoints.length - 1]?.endDateTime ?? log.endDateTime;
45
-
46
- const totalTravelMinutes = checkpoints.reduce(
47
- (sum, cp) => sum + (Number(cp.travelTime) || 0),
48
- 0,
49
- );
50
-
51
- const activities: NFCPatrolActivity[] = checkpoints.map((cp) => ({
52
- id: cp.nfcTag_id,
53
- checkpoint: cp.nfcTag_name,
54
- guardName: log.sign?.guardName,
55
- guardSignatureFileId: log.sign?.guardSignatureFileId,
56
- startTime: formatTime(cp.startDateTime),
57
- endTime: formatTime(cp.endDateTime),
58
- actualTime: diffMinutes(cp.startDateTime, cp.endDateTime),
59
- expectedTime: formatDuration(cp.travelTime),
60
- status: cp.status,
61
- remarks: cp.skippedRemarks && cp.skippedRemarks !== "N/A" ? cp.skippedRemarks : undefined,
62
- }));
47
+ const timezone = log.timezone || siteTimezone || DEFAULT_PATROL_TIMEZONE;
48
+ const actual = actualPatrolSpan(log);
49
+
50
+ const activities: NFCPatrolActivity[] = checkpoints.map((cp) => {
51
+ const clock = checkpointClock(log, cp, siteTimezone);
52
+ return {
53
+ id: cp.nfcTag_id,
54
+ checkpoint: cp.nfcTag_name,
55
+ guardName: log.sign?.guardName,
56
+ guardSignatureFileId: log.sign?.guardSignatureFileId,
57
+ startTime: clock.start,
58
+ endTime: clock.end,
59
+ status: cp.status,
60
+ remarks: cp.skippedRemarks && cp.skippedRemarks !== "N/A" ? cp.skippedRemarks : undefined,
61
+ };
62
+ });
63
63
 
64
64
  return {
65
65
  location,
66
66
  routeSummary: {
67
67
  routeName: log.route?.name,
68
- tolerance: totalTravelMinutes,
68
+ tolerance: Number(log.route?.tolerance) || 0,
69
69
  schedule: {
70
70
  start: log.route?.startTime,
71
71
  end: log.route?.endTime,
72
72
  totalTime: diffMinutes(log.startDateTime, log.endDateTime),
73
73
  },
74
74
  actual: {
75
- start: formatTime(actualStart),
76
- end: formatTime(actualEnd),
77
- totalTime: diffMinutes(actualStart, actualEnd),
75
+ start: clockTime(actual.start, timezone),
76
+ end: clockTime(actual.end, timezone),
77
+ totalTime: diffMinutes(actual.start, actual.end),
78
78
  },
79
79
  },
80
80
  activities,
@@ -128,10 +128,14 @@ export function useNFCPatrolReport(
128
128
  const log = logsRes.items?.[0];
129
129
 
130
130
  if (log) {
131
- report.value = mapLogToPatrolReport(log, {
132
- name: siteInfo.name,
133
- address: buildAddress(siteInfo.address),
134
- });
131
+ report.value = mapLogToPatrolReport(
132
+ log,
133
+ {
134
+ name: siteInfo.name,
135
+ address: buildAddress(siteInfo.address),
136
+ },
137
+ (siteInfo as { timezone?: string }).timezone,
138
+ );
135
139
  } else {
136
140
  report.value = null;
137
141
  notFound.value = true;
@@ -31,9 +31,27 @@ export function useNFCPatrolReportFilters(site: string) {
31
31
  loading.value = true;
32
32
 
33
33
  try {
34
- const response = await getPatrolRoutes({ site, page: 1, limit: 100 });
35
- const routes = (response.items ?? []).map((route: Record<string, any>) => ({
36
- title: route.name,
34
+ // Deleted routes too, labelled, so their past patrols can still be
35
+ // reported on. An API from before route deletion refuses the parameter
36
+ // with a 400: ask again without it, and the list is what it was.
37
+ const response = await getPatrolRoutes({
38
+ site,
39
+ page: 1,
40
+ limit: 100,
41
+ includeDeleted: true,
42
+ }).catch((error: any) => {
43
+ const status = Number(error?.statusCode ?? error?.response?.status ?? 0);
44
+ if (status !== 400) throw error;
45
+ return getPatrolRoutes({ site, page: 1, limit: 100 });
46
+ });
47
+ const items: Array<Record<string, any>> = response.items ?? [];
48
+ const isDeleted = (route: Record<string, any>) => route.status === "Deleted";
49
+ // Routes still in use first, so the report opens on one of them.
50
+ const routes = [
51
+ ...items.filter((route) => !isDeleted(route)),
52
+ ...items.filter(isDeleted),
53
+ ].map((route) => ({
54
+ title: isDeleted(route) ? `${route.name} (deleted)` : route.name,
37
55
  value: route._id,
38
56
  startTimes: route.startTimes ?? [],
39
57
  }));
@@ -4,17 +4,24 @@ export default function useNFCPatrolRoute() {
4
4
  limit = 20,
5
5
  site = "",
6
6
  search = "",
7
+ includeDeleted = false,
7
8
  } = {}) {
8
9
  const query: Record<string, any> = {
9
10
  page,
10
11
  limit,
11
12
  site,
12
13
  };
13
-
14
+
14
15
  // Only include search parameter if it has a value
15
16
  if (search) {
16
17
  query.search = search;
17
18
  }
19
+
20
+ // Deleted routes are left out unless asked for; only the patrol log
21
+ // report's route picker asks, so their past patrols stay reachable.
22
+ if (includeDeleted) {
23
+ query.includeDeleted = true;
24
+ }
18
25
 
19
26
  return useNuxtApp().$api<Record<string, any>>(`/api/nfc-patrol-route`, {
20
27
  method: "GET",
@@ -28,7 +35,7 @@ export default function useNFCPatrolRoute() {
28
35
  tolerance: string;
29
36
  days: number[];
30
37
  startTimes: string[];
31
- checkPoints: Array<{ nfcTag_id: string; travelTime: number }>;
38
+ checkPoints: Array<{ nfcTag_id: string }>;
32
39
  site: string;
33
40
  }) {
34
41
  return useNuxtApp().$api<Record<string, any>>("/api/nfc-patrol-route", {
@@ -57,7 +64,7 @@ export default function useNFCPatrolRoute() {
57
64
  tolerance: string;
58
65
  days: number[];
59
66
  startTimes: string[];
60
- checkPoints: Array<{ nfcTag_id: string; travelTime: number }>;
67
+ checkPoints: Array<{ nfcTag_id: string }>;
61
68
  site: string;
62
69
  }
63
70
  ) {
@@ -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,
@@ -15,6 +15,21 @@ export type TSiteProviderMember = {
15
15
  lastLoginAt?: string | null;
16
16
  /** a subcontractor: the provider that brought its company onto the site */
17
17
  invitedVia?: string;
18
+ /** The building unit this person is attached to (a unit's Management tab). */
19
+ unit?: string | null;
20
+ unitName?: string;
21
+ /**
22
+ * The person's user account. Anything acting on the PERSON needs this rather
23
+ * than `_id`, which identifies the membership: an access card carries it as
24
+ * `userId`, and HID reader access is bound by it -
25
+ * `resolvePermissionUserBindings` drops every subject without one.
26
+ *
27
+ * Returned from core 3.130. Before that the repository projected it and the
28
+ * service layer dropped it, so against an older API it is absent on every
29
+ * row - `providerAccountsKnown` is how the HID enrolment screen tells the two
30
+ * apart rather than reading an absence as "nobody has an account".
31
+ */
32
+ user?: string | null;
18
33
  };
19
34
 
20
35
  export type TSiteProviderCompany = {
@@ -90,6 +105,8 @@ export default function useServiceProvider() {
90
105
  status = "",
91
106
  /** "engagements": also providers engaged through an accepted invitation. */
92
107
  include = "",
108
+ /** A building unit id, or "none": providers on no unit yet. */
109
+ unit = "",
93
110
  } = {}) {
94
111
  return useNuxtApp().$api<Record<string, any>>("/api/service-providers", {
95
112
  method: "GET",
@@ -102,6 +119,7 @@ export default function useServiceProvider() {
102
119
  siteId,
103
120
  ...(status ? { status } : {}),
104
121
  ...(include ? { include } : {}),
122
+ ...(unit ? { unit } : {}),
105
123
  },
106
124
  });
107
125
  }
@@ -269,6 +287,17 @@ export default function useServiceProvider() {
269
287
  );
270
288
  }
271
289
 
290
+ /** Attach a provider to a building unit, or detach it (`unit` ""). */
291
+ async function updateUnit(id: string, unit: string) {
292
+ return useNuxtApp().$api<Record<string, any>>(
293
+ `/api/service-providers/${id}/unit`,
294
+ {
295
+ method: "PATCH",
296
+ body: { unit },
297
+ }
298
+ );
299
+ }
300
+
272
301
  async function getByEmail({
273
302
  email = "",
274
303
  orgId = "",
@@ -293,17 +322,29 @@ export default function useServiceProvider() {
293
322
  * Members > Service Providers: the provider people with access to this
294
323
  * site, and one entry per provider company with its head count. The
295
324
  * site's own organisation only - the server refuses anyone else.
325
+ * `unit`: a building unit id, or "none" (people on no unit yet).
296
326
  */
297
- function getSiteMembers(siteId: string): Promise<{
327
+ function getSiteMembers(siteId: string, unit = ""): Promise<{
298
328
  items: TSiteProviderMember[];
299
329
  companies: TSiteProviderCompany[];
300
330
  }> {
301
331
  return useNuxtApp().$api("/api/service-providers/site-members", {
302
332
  method: "GET",
303
- query: { siteId },
333
+ query: { siteId, ...(unit ? { unit } : {}) },
304
334
  });
305
335
  }
306
336
 
337
+ /** Attach one of those people to a building unit, or detach them (`unit` ""). */
338
+ function updateSiteMemberUnit(id: string, unit: string) {
339
+ return useNuxtApp().$api<Record<string, any>>(
340
+ `/api/service-providers/site-members/${id}/unit`,
341
+ {
342
+ method: "PATCH",
343
+ body: { unit },
344
+ }
345
+ );
346
+ }
347
+
307
348
  /** The same list as an Excel file, under the same filters. */
308
349
  function exportSiteMembers(
309
350
  siteId: string,
@@ -320,6 +361,7 @@ export default function useServiceProvider() {
320
361
 
321
362
  return {
322
363
  getSiteMembers,
364
+ updateSiteMemberUnit,
323
365
  exportSiteMembers,
324
366
  serviceProviders,
325
367
  serviceProvider,
@@ -338,6 +380,7 @@ export default function useServiceProvider() {
338
380
  add,
339
381
  addViaInvite,
340
382
  updateStatus,
383
+ updateUnit,
341
384
  getByEmail,
342
385
  };
343
386
  }
@@ -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
+ }
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.0",
5
+ "version": "4.97.1-staging.501",
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/member.d.ts CHANGED
@@ -10,6 +10,10 @@ declare type TMember = {
10
10
  customerOrgId?: string;
11
11
  customerSiteId?: string;
12
12
  status?: string;
13
+ email?: string;
14
+ /** The building unit this member manages (a unit's Management tab). */
15
+ unit?: string | null;
16
+ unitName?: string;
13
17
  createdAt?: string;
14
18
  updatedAt?: string;
15
19
  deletedAt?: string;
@@ -51,8 +51,6 @@ export interface NFCPatrolActivity {
51
51
  guardSignatureFileId?: string;
52
52
  startTime: string;
53
53
  endTime: string;
54
- actualTime: string;
55
- expectedTime: string;
56
54
  status: NFCPatrolActivityStatus;
57
55
  remarks?: string;
58
56
  }
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"
@@ -7,6 +7,11 @@ declare type TServiceProvider = {
7
7
  serviceProviderOrgId: string;
8
8
  type: string;
9
9
  nature: string;
10
+ status?: string;
11
+ email?: string;
12
+ /** The building unit this provider serves (a unit's Management tab). */
13
+ unit?: string | null;
14
+ unitName?: string;
10
15
  };
11
16
 
12
17
  declare type TServiceProviderName = {
package/types/site.d.ts CHANGED
@@ -5,7 +5,10 @@ declare type THidQrCodeFormat = "0" | "1" | "2";
5
5
  declare type THidPermissionCategory =
6
6
  | "resident"
7
7
  | "property_management"
8
- | "service_provider";
8
+ /** A provider COMPANY - granting one admits every active member of that org. */
9
+ | "service_provider"
10
+ /** ONE PERSON from a provider company, by their membership at this site. */
11
+ | "service_provider_member";
9
12
 
10
13
  declare type THidPermissionAssignment = {
11
14
  subjectId: string;
@@ -27,7 +30,10 @@ declare type THidSitePermissions = {
27
30
  counts: {
28
31
  resident: number;
29
32
  propertyManagement: number;
33
+ /** Provider COMPANIES granted. */
30
34
  serviceProvider: number;
35
+ /** Named provider people granted. Counted apart from the companies. */
36
+ serviceProviderMember: number;
31
37
  intercom: number;
32
38
  };
33
39
  };