@7365admin1/layer-common 4.32.1-staging.366 → 4.33.1

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 (54) hide show
  1. package/CHANGELOG.md +16 -4
  2. package/components/AccessCardAddForm.vue +4 -5
  3. package/components/AccessCardAssignToUnitForm.vue +2 -3
  4. package/components/AccessCardPreviewDialog.vue +3 -4
  5. package/components/Dialog/DeleteConfirmation.vue +2 -17
  6. package/components/Dialog/ReusablePrompt.vue +3 -26
  7. package/components/Dialog/UpdateMoreAction.vue +1 -11
  8. package/components/DocumentForm.vue +112 -407
  9. package/components/DocumentManagement.vue +12 -213
  10. package/components/EntryPass/QrTemplatePreview.vue +25 -21
  11. package/components/EntryPassInformation.vue +24 -119
  12. package/components/Facility/BookingSetup.vue +0 -63
  13. package/components/HidAccessLogDashboard.vue +8 -41
  14. package/components/HidIntercomManagement.vue +14 -148
  15. package/components/HidReaderManagement.vue +0 -26
  16. package/components/HidReaderUserRoster.vue +3 -44
  17. package/components/HidUserEnrollment.vue +155 -845
  18. package/components/InvitationClientForm.vue +1 -19
  19. package/components/NotificationBell.vue +3 -39
  20. package/components/VehicleForm.vue +2 -45
  21. package/components/VehicleManagement.vue +10 -95
  22. package/components/VisitorManagement.vue +5 -267
  23. package/composables/useAccessManagement.ts +0 -5
  24. package/composables/useCleaningPermission.ts +4 -4
  25. package/composables/useCommonPermission.ts +0 -16
  26. package/composables/useDocument.ts +0 -7
  27. package/composables/useFacility.ts +0 -11
  28. package/composables/useHidAmico.ts +0 -117
  29. package/composables/useHidNavigation.ts +1 -25
  30. package/composables/useLandscapingPermission.ts +4 -4
  31. package/composables/useMechanicalElectricalPermission.ts +4 -4
  32. package/composables/usePeople.ts +0 -19
  33. package/composables/usePestControlPermission.ts +4 -4
  34. package/composables/usePoolMaintenancePermission.ts +4 -4
  35. package/composables/useSecurityPermission.ts +10 -4
  36. package/composables/useSiteEntryPassSettings.ts +0 -26
  37. package/composables/useWebUsb.ts +11 -14
  38. package/package.json +1 -1
  39. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  40. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  41. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  42. package/types/document.d.ts +0 -14
  43. package/types/facility.d.ts +0 -4
  44. package/types/people.d.ts +1 -28
  45. package/utils/vehicle-actions.ts +4 -12
  46. package/components/HidAccessPermissions.vue +0 -424
  47. package/components/HidProfileQrCode.vue +0 -332
  48. package/composables/useHidReaderSelection.ts +0 -50
  49. package/composables/useSiteCategory.ts +0 -45
  50. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
  51. package/utils/hid-permission-assignments.ts +0 -190
  52. package/utils/hid-reader-selection.ts +0 -52
  53. package/utils/notification-target.ts +0 -75
  54. package/utils/occupancy-role.ts +0 -109
@@ -115,24 +115,6 @@ 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
-
136
118
  async function getPeopleByUnit(
137
119
  _id: string,
138
120
  { status = "active", type = "" } = {}
@@ -166,7 +148,6 @@ export default function () {
166
148
  findPersonByPlateNumberMultipleResult,
167
149
  findPersonByContact,
168
150
  getPeopleByUnit,
169
- getOccupiedStructure,
170
151
  searchCompanyList,
171
152
  findUsersByPlateNumber,
172
153
  reviewResidentPerson,
@@ -25,8 +25,8 @@ export default function usePestControlPermission() {
25
25
  invitationPermissions,
26
26
  memberPermissions,
27
27
  rolePermissions,
28
- tradeFeedbackPermissions,
29
- tradeWorkOrderPermissions,
28
+ feedbackPermissions,
29
+ workOrderPermissions,
30
30
  bulletinBoardPermissions,
31
31
  serviceProviderPermissions,
32
32
 
@@ -37,8 +37,8 @@ export default function usePestControlPermission() {
37
37
  members: memberPermissions,
38
38
  roles: rolePermissions,
39
39
  invitations: invitationPermissions,
40
- feedbacks: tradeFeedbackPermissions,
41
- work_orders: tradeWorkOrderPermissions,
40
+ feedbacks: feedbackPermissions,
41
+ work_orders: workOrderPermissions,
42
42
  "bulletin-board": bulletinBoardPermissions,
43
43
  "service-provider-mgmt": serviceProviderPermissions,
44
44
  // Owner answer Q5, 2026-09-11: Emergency Contacts is offered in the Pest
@@ -25,8 +25,8 @@ export default function usePoolMaintenancePermission() {
25
25
  invitationPermissions,
26
26
  memberPermissions,
27
27
  rolePermissions,
28
- tradeFeedbackPermissions,
29
- tradeWorkOrderPermissions,
28
+ feedbackPermissions,
29
+ workOrderPermissions,
30
30
  bulletinBoardPermissions,
31
31
  serviceProviderPermissions,
32
32
 
@@ -37,8 +37,8 @@ export default function usePoolMaintenancePermission() {
37
37
  members: memberPermissions,
38
38
  roles: rolePermissions,
39
39
  invitations: invitationPermissions,
40
- feedbacks: tradeFeedbackPermissions,
41
- work_orders: tradeWorkOrderPermissions,
40
+ feedbacks: feedbackPermissions,
41
+ work_orders: workOrderPermissions,
42
42
  "bulletin-board": bulletinBoardPermissions,
43
43
  "service-provider-mgmt": serviceProviderPermissions,
44
44
  // Owner answer Q5, 2026-09-11: Emergency Contacts is offered in the Pool
@@ -63,8 +63,11 @@ export default function useSecurityPermission() {
63
63
  check: true,
64
64
  description: "Allows the user to update feedback details.",
65
65
  },
66
- // No "delete-feedback": deleting a feedback is for Property Management
67
- // and the feedback's creator only - the same rule as work orders.
66
+ "delete-feedback": {
67
+ check: true,
68
+ description:
69
+ "Allows the user to remove a feedback from the system permanently.",
70
+ },
68
71
  },
69
72
 
70
73
  work_orders: {
@@ -85,8 +88,11 @@ export default function useSecurityPermission() {
85
88
  check: true,
86
89
  description: "Allows the user to update work-order details.",
87
90
  },
88
- // No "delete-work-order": deleting a work order is for Property
89
- // Management and the work order's creator only (Harris, 2026-09-23).
91
+ "delete-work-order": {
92
+ check: true,
93
+ description:
94
+ "Allows the user to remove a work-order from the system permanently.",
95
+ },
90
96
  },
91
97
 
92
98
  "building-mgmt": {
@@ -27,35 +27,9 @@ 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
-
55
30
  return {
56
31
  getBySiteId,
57
32
  getById,
58
33
  save,
59
- getEncryptedAcmUrl,
60
34
  };
61
35
  }
@@ -345,19 +345,16 @@ export default function useWebUsb() {
345
345
  70,
346
346
  );
347
347
 
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
- });
348
+ const qrSmall = 140;
349
+ const qrCenter = 250;
350
+ const margin = 20;
351
+ const qrCanvas = await QRCode.toCanvas(qrUrlImage, { width: qrCenter });
359
352
 
360
- ctx.drawImage(qrCanvas, (canvas.width - qrSize) / 2, 90, qrSize, qrSize);
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);
361
358
 
362
359
  ctx.font = "25px Arial";
363
360
  ctx.fillText(companyName || "", canvas.width / 2, 470);
@@ -404,8 +401,8 @@ export default function useWebUsb() {
404
401
  /**
405
402
  * The self-service onboarding QR: one large QR code, a "SCAN QR CODE"-style
406
403
  * subtext, and a dark site-name banner along the bottom - a single-purpose
407
- * gate sign, not the visitor-pass receipt `createReceiptLayout` produces
408
- * (that one pairs its QR with company, date, access and instruction lines).
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).
409
406
  */
410
407
  async function createOnboardingQrLayout(
411
408
  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.32.1-staging.366",
5
+ "version": "4.33.1",
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" :org="orgId" />
8
+ <HidUserEnrollment :site="siteId" />
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" :org="orgId" card-management />
8
+ <HidUserEnrollment :site="siteId" card-management />
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 HID readers."
7
7
  >
8
- <HidReaderManagement :site="siteId" :org="orgId" />
8
+ <HidReaderManagement :site="siteId" />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -3,18 +3,4 @@ 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;
20
6
  };
@@ -73,10 +73,6 @@ 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;
80
76
  bookingAmount: number | null;
81
77
  peakBookingFeeAmount?: number | null;
82
78
  bookingFeeGuestAmount?: number | null;
package/types/people.d.ts CHANGED
@@ -22,38 +22,11 @@ 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;
49
25
  };
50
26
 
51
27
  declare type TPlateNumber = { plateNumber: string, recNo?: string, _id?: string, status: TVehicleStatus, type: TVehicleType, anprCameras?: TVehicleAnprCamera[] };
52
28
 
53
29
 
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 | "" }
30
+ declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string }
58
31
 
59
32
  declare type TPeopleType = "guest" | "resident" | "tenant"
@@ -96,12 +96,9 @@ export function vehiclePlateActions(
96
96
  });
97
97
  }
98
98
 
99
- // Restore goes through the approve endpoint (`submitRestore` ->
100
- // `approveVehicle`), which the server gates on "Approve Vehicle" and refuses
101
- // with "You do not have permission to approve vehicles." without it. It
102
- // used to be offered to everyone, so a role without the right saw Restore,
103
- // pressed it and was refused - and it could not be hidden on that refusal.
104
- if (permissions.canApproveVehicle && isRestorable) {
99
+ // Restore is deliberately NOT gated on `canUpdateVehicle`: it was ungated
100
+ // before and narrowing a gate is a separate, role-data decision.
101
+ if (isRestorable) {
105
102
  actions.push({
106
103
  key: "restore",
107
104
  title: "Restore",
@@ -113,12 +110,7 @@ export function vehiclePlateActions(
113
110
  // Any record that is not already blocked (and is not waiting for approval)
114
111
  // can be blocked - including an unblocked or deleted one, which is how the
115
112
  // same plate is blocked again without a second record.
116
- // A deleted BLOCKLIST plate (Block Listed tab) is not offered Block: Restore
117
- // already puts it back on every camera's blocklist, so the two would do the
118
- // same thing. A deleted whitelist plate keeps Block - that turns it into a
119
- // blocked plate, which Restore (back to allowed) does not.
120
- const restoresToBlocked = isRestorable && type === "blocklist";
121
- if (canUpdate && (isAllowed || isUnblocked || (isRestorable && !restoresToBlocked))) {
113
+ if (canUpdate && (isAllowed || isUnblocked || isRestorable)) {
122
114
  actions.push({
123
115
  key: "block",
124
116
  title: "Block",