@7365admin1/layer-common 4.17.0 → 4.17.1-staging.331

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 (60) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/components/DocumentForm.vue +407 -112
  3. package/components/DocumentManagement.vue +213 -12
  4. package/components/EntryPass/QrTemplatePreview.vue +21 -25
  5. package/components/EntryPassInformation.vue +119 -24
  6. package/components/Facility/BookingSetup.vue +63 -0
  7. package/components/HidAccessPermissions.vue +424 -0
  8. package/components/HidIntercomManagement.vue +193 -43
  9. package/components/HidProfileQrCode.vue +323 -0
  10. package/components/HidReaderManagement.vue +26 -0
  11. package/components/HidReaderUserRoster.vue +32 -2
  12. package/components/HidUserEnrollment.vue +779 -213
  13. package/components/InventoryImportDialog.vue +117 -0
  14. package/components/InventoryItemDetail.vue +158 -0
  15. package/components/InventoryItemDialog.vue +125 -0
  16. package/components/InventoryLinesDialog.vue +288 -0
  17. package/components/InventoryMain.vue +226 -0
  18. package/components/InventoryMyStockTab.vue +114 -0
  19. package/components/InventoryPhotoInput.vue +70 -0
  20. package/components/InventoryReportsTab.vue +181 -0
  21. package/components/InventoryRequestsTab.vue +218 -0
  22. package/components/InventorySettingsTab.vue +94 -0
  23. package/components/InventoryStockTab.vue +177 -0
  24. package/components/InventoryTechniciansTab.vue +81 -0
  25. package/components/InventoryUsageDialog.vue +203 -0
  26. package/components/InvitationClientForm.vue +19 -1
  27. package/components/Layout/Header.vue +26 -0
  28. package/components/NotificationBell.vue +321 -0
  29. package/components/VisitorManagement.vue +267 -5
  30. package/composables/useAccessManagement.ts +5 -0
  31. package/composables/useCleaningPermission.ts +2 -7
  32. package/composables/useCommonPermission.ts +22 -0
  33. package/composables/useDocument.ts +7 -0
  34. package/composables/useFacility.ts +11 -0
  35. package/composables/useHidAmico.ts +97 -0
  36. package/composables/useHidNavigation.ts +25 -1
  37. package/composables/useInventory.ts +97 -0
  38. package/composables/useInventoryPermission.ts +31 -0
  39. package/composables/useLandscapingPermission.ts +2 -6
  40. package/composables/useMechanicalElectricalPermission.ts +2 -0
  41. package/composables/useNotification.ts +78 -0
  42. package/composables/usePeople.ts +19 -0
  43. package/composables/usePestControlPermission.ts +2 -0
  44. package/composables/usePoolMaintenancePermission.ts +2 -0
  45. package/composables/usePropertyPermission.ts +2 -0
  46. package/composables/useSecurityPermission.ts +10 -7
  47. package/composables/useWebUsb.ts +14 -11
  48. package/constants/permissions.ts +1 -1
  49. package/package.json +1 -1
  50. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  51. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  52. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  53. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  54. package/types/document.d.ts +14 -0
  55. package/types/facility.d.ts +4 -0
  56. package/types/inventory.d.ts +89 -0
  57. package/types/people.d.ts +4 -1
  58. package/utils/hid-permission-assignments.ts +190 -0
  59. package/utils/materialSymbols.ts +3 -0
  60. package/utils/module-routes.ts +1 -0
@@ -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;
@@ -166,6 +182,36 @@ export default function useHidAmico() {
166
182
  });
167
183
  }
168
184
 
185
+ /**
186
+ * The signed-in member's own QR code on one reader.
187
+ *
188
+ * No user id in the path: the server takes the caller from the session, so
189
+ * these cannot be pointed at somebody else. `assigned` in the response says
190
+ * whether the HID permissions screen actually admits this member to the
191
+ * reader - issuing a code does not grant access, and the screen has to be
192
+ * able to say so.
193
+ */
194
+ function getProfileQr(readerId: string) {
195
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
196
+ `${basePath}/readers/${readerId}/profile-qr`,
197
+ { method: "GET" },
198
+ );
199
+ }
200
+
201
+ function issueProfileQr(readerId: string) {
202
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
203
+ `${basePath}/readers/${readerId}/profile-qr`,
204
+ { method: "POST" },
205
+ );
206
+ }
207
+
208
+ function deleteProfileQr(readerId: string) {
209
+ return useNuxtApp().$api<{ data: HidProfileQr }>(
210
+ `${basePath}/readers/${readerId}/profile-qr`,
211
+ { method: "DELETE" },
212
+ );
213
+ }
214
+
169
215
  function createReader(payload: HidReaderPayload) {
170
216
  return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers`, {
171
217
  method: "POST",
@@ -414,6 +460,27 @@ export default function useHidAmico() {
414
460
  );
415
461
  }
416
462
 
463
+ function getUserPasswordStatus(readerId: string, hidUserId: string | number) {
464
+ return useNuxtApp().$api<HidApiRecord>(
465
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
466
+ { method: "GET" },
467
+ );
468
+ }
469
+
470
+ function setUserPassword(readerId: string, hidUserId: string | number, password: string) {
471
+ return useNuxtApp().$api<HidApiRecord>(
472
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
473
+ { method: "PUT", body: { password } },
474
+ );
475
+ }
476
+
477
+ function deleteUserPassword(readerId: string, hidUserId: string | number) {
478
+ return useNuxtApp().$api<HidApiRecord>(
479
+ `${basePath}/readers/${readerId}/users/${hidUserId}/password`,
480
+ { method: "DELETE" },
481
+ );
482
+ }
483
+
417
484
  function deleteUserPin(readerId: string, hidUserId: string | number) {
418
485
  return useNuxtApp().$api<{ data: { pinEnrolled: boolean } }>(
419
486
  `${basePath}/readers/${readerId}/users/${hidUserId}/pin`,
@@ -474,6 +541,29 @@ export default function useHidAmico() {
474
541
  );
475
542
  }
476
543
 
544
+ /**
545
+ * Wake the resident's phone for a call the web phone has just placed.
546
+ *
547
+ * The SIP INVITE is the call and travels over the WebSocket, not through the
548
+ * API; this only rings the resident's mobile so somebody is there to answer
549
+ * it. It is therefore fired after the INVITE and never awaited in a way that
550
+ * could fail the call — see `startWebCall` in `HidIntercomManagement.vue`.
551
+ *
552
+ * `notified: false` with a reason is a normal response, not an error: staff
553
+ * extensions and external SIP addresses have no resident behind them.
554
+ */
555
+ function notifyIntercomCall(
556
+ siteId: string,
557
+ payload: { orgId: string; destination: string; callId: string; readerId?: string },
558
+ ) {
559
+ return useNuxtApp().$api<{
560
+ data: { notified: boolean; delivered?: number; reason?: string };
561
+ }>(
562
+ `${basePath}/sites/${siteId}/intercom/notify-call`,
563
+ { method: "POST", body: payload },
564
+ );
565
+ }
566
+
477
567
  function getPermissionCandidates(
478
568
  siteId: string,
479
569
  query: {
@@ -505,6 +595,9 @@ export default function useHidAmico() {
505
595
 
506
596
  return {
507
597
  getReaders,
598
+ getProfileQr,
599
+ issueProfileQr,
600
+ deleteProfileQr,
508
601
  discoverReader,
509
602
  createReader,
510
603
  updateReader,
@@ -530,6 +623,9 @@ export default function useHidAmico() {
530
623
  getUserPinStatus,
531
624
  setUserPin,
532
625
  deleteUserPin,
626
+ getUserPasswordStatus,
627
+ setUserPassword,
628
+ deleteUserPassword,
533
629
  getIdentities,
534
630
  getReaderUsers,
535
631
  getReaderAccessLogs,
@@ -540,6 +636,7 @@ export default function useHidAmico() {
540
636
  makeIntercomCall,
541
637
  finalizeIntercomCall,
542
638
  ensureSipAccount,
639
+ notifyIntercomCall,
543
640
  getSitePermissions,
544
641
  getPermissionCandidates,
545
642
  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,97 @@
1
+ /**
2
+ * Inventory API (`/api/inventory`). What a person may do in a store comes back
3
+ * on the store itself (`store.access`), decided by the server — screens show
4
+ * or hide actions from that, never from a guess on the client.
5
+ */
6
+ export default function useInventory() {
7
+ const api = <T = any>(url: string, options: Record<string, any> = {}) =>
8
+ useNuxtApp().$api<T>(`/api/inventory${url}`, options);
9
+
10
+ const typeLabels: Record<string, string> = {
11
+ opening: "Opening stock",
12
+ receive: "Received",
13
+ issue: "Issued",
14
+ use: "Used",
15
+ return: "Returned",
16
+ adjust: "Stock count",
17
+ };
18
+
19
+ return {
20
+ typeLabels,
21
+
22
+ getStores: (site: string) => api<TInventoryStore[]>("/stores", { query: { site } }),
23
+ createStore: (body: { org: string; sites: string[]; name: string }) =>
24
+ api<TInventoryStore>("/stores", { method: "POST", body }),
25
+ updateStore: (id: string, body: Partial<Pick<TInventoryStore, "name" | "sites" | "showInResidentApp" | "showCostInResidentApp">>) =>
26
+ api<TInventoryStore>(`/stores/${id}`, { method: "PATCH", body }),
27
+
28
+ getItems: (store: string, query: { page?: number; limit?: number; search?: string; lowStock?: boolean; includeInactive?: boolean }) =>
29
+ api<{ items: TInventoryItem[]; total: number; lowCount: number; page: number; pages: number }>(`/stores/${store}/items`, { query }),
30
+ createItem: (store: string, body: Record<string, any>) => api(`/stores/${store}/items`, { method: "POST", body }),
31
+ updateItem: (id: string, body: Record<string, any>) => api(`/items/${id}`, { method: "PATCH", body }),
32
+
33
+ receive: (store: string, body: Record<string, any>) => api(`/stores/${store}/receive`, { method: "POST", body }),
34
+ count: (store: string, body: { item: string; countedQty: number; reason: string }) =>
35
+ api(`/stores/${store}/counts`, { method: "POST", body }),
36
+ issue: (store: string, body: Record<string, any>) => api(`/stores/${store}/issue`, { method: "POST", body }),
37
+ receiveReturn: (store: string, body: Record<string, any>) => api(`/stores/${store}/returns`, { method: "POST", body }),
38
+ recordUsage: (store: string, body: Record<string, any>) => api(`/stores/${store}/usage`, { method: "POST", body }),
39
+
40
+ getRequests: (store: string, query: { page?: number; limit?: number; status?: string; mine?: boolean }) =>
41
+ api<{ items: TInventoryRequest[]; total: number; pendingCount: number; page: number; pages: number }>(`/stores/${store}/requests`, { query }),
42
+ createRequest: (store: string, body: Record<string, any>) => api(`/stores/${store}/requests`, { method: "POST", body }),
43
+ approveRequest: (id: string, body: { lines?: TInventoryLine[]; remarks?: string }) =>
44
+ api(`/requests/${id}/approve`, { method: "POST", body }),
45
+ rejectRequest: (id: string, remarks: string) => api(`/requests/${id}/reject`, { method: "POST", body: { remarks } }),
46
+ cancelRequest: (id: string) => api(`/requests/${id}/cancel`, { method: "POST" }),
47
+
48
+ getHoldings: (store: string, holder: string = "me") => api<TInventoryHolding[]>(`/stores/${store}/holdings`, { query: { holder } }),
49
+ getTransactions: (store: string, query: Record<string, any>) =>
50
+ api<{ items: TInventoryTransaction[]; total: number; page: number; pages: number }>(`/stores/${store}/transactions`, { query }),
51
+
52
+ getUnits: (store: string, site: string, search = "") =>
53
+ api<{ _id: string; name: string; tenantName: string }[]>(`/stores/${store}/units`, { query: { site, search } }),
54
+ getCommonAreas: (store: string, site: string) => api<string[]>(`/stores/${store}/common-areas`, { query: { site } }),
55
+ getPeople: (store: string, search = "") => api<{ _id: string; name: string; orgName: string }[]>(`/stores/${store}/people`, { query: { search } }),
56
+
57
+ getReport: (store: string, report: "movement" | "usage" | "technicians", query: TInventoryPeriod) =>
58
+ api<{ rows: any[]; totalQty?: number; totalCost?: number }>(`/stores/${store}/reports/${report}`, { query }),
59
+ exportReport: (store: string, report: string, query: TInventoryPeriod) =>
60
+ api<Blob>(`/stores/${store}/reports/${report}/export`, { query, responseType: "blob" }),
61
+ importTemplate: () => api<Blob>("/import-template", { responseType: "blob" }),
62
+ importItems: (store: string, file: File, commit: boolean) => {
63
+ const body = new FormData();
64
+ body.append("file", file);
65
+ return api<{ committed: boolean; ready: number; skipped: number; errors: number; rows: { row: number; name: string; status: string; message: string }[] }>(
66
+ `/stores/${store}/import`,
67
+ { method: "POST", body, query: { commit } },
68
+ );
69
+ },
70
+ };
71
+ }
72
+
73
+ /** Save a Blob as a file download in the browser. */
74
+ export function saveBlob(blob: Blob, filename: string) {
75
+ const url = URL.createObjectURL(blob);
76
+ const a = document.createElement("a");
77
+ a.href = url;
78
+ a.download = filename;
79
+ a.click();
80
+ URL.revokeObjectURL(url);
81
+ }
82
+
83
+ /**
84
+ * A date picked in a form, as the API wants it: omitted for today (the server
85
+ * stamps the current time), noon local time for an earlier day.
86
+ */
87
+ export function pickedDate(value: string) {
88
+ if (!value || value >= new Date().toLocaleDateString("en-CA")) return undefined;
89
+ return new Date(`${value}T12:00:00`).toISOString();
90
+ }
91
+
92
+ /** Start and end of a local calendar month, as ISO strings the API accepts. */
93
+ export function monthPeriod(date = new Date()) {
94
+ const from = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0, 0);
95
+ const to = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59, 999);
96
+ return { from: from.toISOString(), to: to.toISOString() };
97
+ }
@@ -0,0 +1,31 @@
1
+ import { useCommonPermissions } from "./useCommonPermission";
2
+ import { useLocalSetup } from "./useLocalSetup";
3
+ import usePermission from "./usePermission";
4
+ import { permissionsDenied } from "../utils/module-routes";
5
+
6
+ /**
7
+ * Whether to show the Inventory menu. Any one of the four inventory
8
+ * permissions is enough (an empty list or `*` grants all, the estate rule);
9
+ * which buttons appear inside the screen is decided by the API per store.
10
+ */
11
+ export default function useInventoryPermission() {
12
+ const { hasPermission } = usePermission();
13
+ const { inventoryPermissions } = useCommonPermissions();
14
+ const { userAppRole, userAppModulesDenied } = useLocalSetup();
15
+ const permissions = { inventory: inventoryPermissions };
16
+
17
+ const canSeeInventory = computed(() => {
18
+ const role = userAppRole.value;
19
+ if (!role) return false;
20
+ if (permissionsDenied(["inventory"], userAppModulesDenied?.value)) return false;
21
+ if (role.permissions.includes("*")) return true;
22
+ return (
23
+ hasPermission(role, permissions, "inventory", "view-inventory") ||
24
+ hasPermission(role, permissions, "inventory", "request-stock") ||
25
+ hasPermission(role, permissions, "inventory", "approve-requests") ||
26
+ hasPermission(role, permissions, "inventory", "manage-inventory")
27
+ );
28
+ });
29
+
30
+ return { canSeeInventory };
31
+ }
@@ -30,8 +30,10 @@ export default function useLandscapingPermission() {
30
30
  bulletinBoardPermissions,
31
31
  serviceProviderPermissions,
32
32
 
33
+ inventoryPermissions,
33
34
  } = useCommonPermissions();
34
35
  const permissions: TPermissions = {
36
+ inventory: inventoryPermissions,
35
37
  members: memberPermissions,
36
38
  roles: rolePermissions,
37
39
  invitations: invitationPermissions,
@@ -74,12 +76,6 @@ export default function useLandscapingPermission() {
74
76
  description: "Allows the user to delete an emergency contact category from the system.",
75
77
  },
76
78
  },
77
- inventory: {
78
- "view-inventory": {
79
- check: true,
80
- description: "Allows the user to view the inventory list.",
81
- },
82
- },
83
79
  // area management permissions
84
80
  "area-mgmt": {
85
81
  "see-all-areas": {
@@ -30,10 +30,12 @@ export default function useMechanicalElectricalPermission() {
30
30
  workOrderPermissions,
31
31
  bulletinBoardPermissions,
32
32
 
33
+ inventoryPermissions,
33
34
  } = useCommonPermissions();
34
35
  const { permissions: schedulePermissions } = useCleaningPermission();
35
36
 
36
37
  const permissions: TPermissions = {
38
+ inventory: inventoryPermissions,
37
39
  members: memberPermissions,
38
40
  roles: rolePermissions,
39
41
  invitations: invitationPermissions,
@@ -0,0 +1,78 @@
1
+ /**
2
+ * The web client for the in-app notification feed.
3
+ *
4
+ * The feed itself is not new - it has been written to for a while and read by
5
+ * the MA mobile app. Nothing on the web ever read it, which is why this is the
6
+ * first composable for it.
7
+ *
8
+ * `appSlug` is deliberately never sent. The inbox query applies that filter only
9
+ * when it is given one, so omitting it returns the rows written for the web
10
+ * (which carry no slug) alongside anything else addressed to this user, while a
11
+ * mobile client asking for its own slug still sees only its own.
12
+ */
13
+ export default function useNotification() {
14
+ function getAll({
15
+ page = 1,
16
+ limit = 10,
17
+ siteId = "",
18
+ hasRead,
19
+ search = "",
20
+ user = "",
21
+ }: {
22
+ page?: number;
23
+ limit?: number;
24
+ siteId?: string;
25
+ hasRead?: boolean;
26
+ search?: string;
27
+ user?: string;
28
+ } = {}) {
29
+ const query: Record<string, any> = { page, limit, search };
30
+
31
+ // Sent only when set. The list schema rejects a malformed id rather than
32
+ // ignoring it, and `hasRead` false is a real filter that `||` would drop.
33
+ if (siteId) query.siteId = siteId;
34
+ if (user) query.user = user;
35
+ if (hasRead !== undefined) query.hasRead = hasRead;
36
+
37
+ return useNuxtApp().$api<Record<string, any>>("/api/notifications", {
38
+ method: "GET",
39
+ query,
40
+ });
41
+ }
42
+
43
+ function getUnreadCount(user: string) {
44
+ return useNuxtApp().$api<Record<string, any>>(
45
+ "/api/notifications/unread-count",
46
+ {
47
+ method: "GET",
48
+ query: { user },
49
+ },
50
+ );
51
+ }
52
+
53
+ function markAsRead(id: string, user: string) {
54
+ return useNuxtApp().$api<Record<string, any>>(
55
+ `/api/notifications/${id}/${user}/read`,
56
+ {
57
+ method: "PATCH",
58
+ },
59
+ );
60
+ }
61
+
62
+ function markAllAsRead(user: string) {
63
+ return useNuxtApp().$api<Record<string, any>>(
64
+ "/api/notifications/read-all",
65
+ {
66
+ method: "PATCH",
67
+ query: { user },
68
+ },
69
+ );
70
+ }
71
+
72
+ return {
73
+ getAll,
74
+ getUnreadCount,
75
+ markAsRead,
76
+ markAllAsRead,
77
+ };
78
+ }
@@ -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,
@@ -30,8 +30,10 @@ export default function usePestControlPermission() {
30
30
  bulletinBoardPermissions,
31
31
  serviceProviderPermissions,
32
32
 
33
+ inventoryPermissions,
33
34
  } = useCommonPermissions();
34
35
  const permissions: TPermissions = {
36
+ inventory: inventoryPermissions,
35
37
  members: memberPermissions,
36
38
  roles: rolePermissions,
37
39
  invitations: invitationPermissions,
@@ -30,8 +30,10 @@ export default function usePoolMaintenancePermission() {
30
30
  bulletinBoardPermissions,
31
31
  serviceProviderPermissions,
32
32
 
33
+ inventoryPermissions,
33
34
  } = useCommonPermissions();
34
35
  const permissions: TPermissions = {
36
+ inventory: inventoryPermissions,
35
37
  members: memberPermissions,
36
38
  roles: rolePermissions,
37
39
  invitations: invitationPermissions,
@@ -41,10 +41,12 @@ export default function usePropertyPermission() {
41
41
  buildingUnitManagementPermissions,
42
42
  siteSettingsPermissions,
43
43
 
44
+ inventoryPermissions,
44
45
  } = useCommonPermissions();
45
46
 
46
47
 
47
48
  const permissions: TPermissions = {
49
+ inventory: inventoryPermissions,
48
50
  members: memberPermissions,
49
51
  roles: rolePermissions,
50
52
  invitations: invitationPermissions,
@@ -32,21 +32,24 @@ export default function useSecurityPermission() {
32
32
  siteSettingsPermissions,
33
33
  bulletinBoardPermissions,
34
34
 
35
+ inventoryPermissions,
35
36
  } = useCommonPermissions();
36
37
 
37
38
  const permissions: TPermissions = {
39
+ inventory: inventoryPermissions,
38
40
  feedbacks: {
39
41
  "add-feedback": {
40
42
  check: true,
41
43
  description: "Allows the user to add a new feedback to the system.",
42
44
  },
43
- "see-all-feedbacks": {
44
- check: true,
45
- description: "Allows the user to view the list of all feedbacks.",
46
- },
47
- // The spelling the great majority of live roles actually hold, and the
48
- // one the iSecure365 mobile app checks. Offered so an administrator can
49
- // reproduce an existing grant.
45
+ // ONE row for "see all feedbacks" (2026-09-17). The editor showed two -
46
+ // `see-all-feedbacks` and `see-all-feedback` - for the same right.
47
+ // Kept: `see-all-feedback`, the canonical spelling ~95 live roles hold and
48
+ // the iSecure365 app checks. Removed: the plural row. Roles that hold
49
+ // `feedbacks:see-all-feedbacks` (~8) are NOT un-granted: it stays in
50
+ // `LEGACY_PERMISSION_ALIASES`, so `hasPermission` still honours it and the
51
+ // edit dialog shows it ticked on this row (and unticking removes it).
52
+ // API-core and the mobile app accept both spellings too.
50
53
  "see-all-feedback": {
51
54
  check: true,
52
55
  description: "Allows the user to view the list of all feedbacks.",
@@ -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,
@@ -169,6 +169,7 @@ export const PERMISSIONS = {
169
169
  "import-units",
170
170
  "delete-unit",
171
171
  ],
172
+ inventory: ["view-inventory", "request-stock", "approve-requests", "manage-inventory"],
172
173
  "supply-mgmt": [
173
174
  "see-all-supplies",
174
175
  "add-supply",
@@ -199,7 +200,6 @@ export const PERMISSIONS = {
199
200
  "manage-attendance-settings",
200
201
  ],
201
202
  "my-attendance": ["see-own-attendance", "check-in-out"],
202
- inventory: ["view-inventory"],
203
203
  toilet_locations: ["create-toilet-location"],
204
204
 
205
205
  // ---- per-trade schedules ----
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.17.0",
5
+ "version": "4.17.1-staging.331",
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>