@7365admin1/layer-common 4.7.3 → 4.8.1-staging.304
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.
- package/CHANGELOG.md +25 -4
- package/components/EntryPass/QrTemplatePreview.vue +21 -25
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/HidIntercomManagement.vue +193 -43
- package/components/HidProfileQrCode.vue +323 -0
- package/components/HidReaderUserRoster.vue +32 -2
- package/components/HidUserEnrollment.vue +771 -212
- package/components/InvitationClientForm.vue +19 -1
- package/components/RolePermissionFormPreviewUpdate.vue +45 -0
- package/components/RolePermissionMain.vue +20 -0
- package/components/VisitorManagement.vue +267 -5
- package/composables/useCleaningPermission.ts +40 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +97 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/useLandscapingPermission.ts +35 -0
- package/composables/usePeople.ts +19 -0
- package/composables/useWebUsb.ts +14 -11
- package/package.json +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
- package/types/facility.d.ts +4 -0
- package/types/people.d.ts +4 -1
- package/utils/materialSymbols.ts +3 -0
- package/utils/org-modules.ts +86 -8
|
@@ -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-
|
|
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
|
},
|
|
@@ -39,6 +39,41 @@ export default function useLandscapingPermission() {
|
|
|
39
39
|
work_orders: workOrderPermissions,
|
|
40
40
|
"bulletin-board": bulletinBoardPermissions,
|
|
41
41
|
"service-provider-mgmt": serviceProviderPermissions,
|
|
42
|
+
// Owner decision 3A, 2026-09-11: Emergency Contacts is offered in the
|
|
43
|
+
// Landscape role editor. Exactly the seven actions `constants/permissions.ts`
|
|
44
|
+
// defines; descriptions from `usePropertyPermission`. The long spelling
|
|
45
|
+
// `see-all-emergency-contacts` is deliberately NOT added -- the landscape app
|
|
46
|
+
// already accepts `see-all`, and a second "see all" row would only confuse.
|
|
47
|
+
"emergency-contact": {
|
|
48
|
+
"see-all": {
|
|
49
|
+
check: true,
|
|
50
|
+
description: "Allows the user to view the list of all emergency contacts.",
|
|
51
|
+
},
|
|
52
|
+
"see-details": {
|
|
53
|
+
check: true,
|
|
54
|
+
description: "Allows the user to view the details of a specific emergency contact.",
|
|
55
|
+
},
|
|
56
|
+
"add-emergency-contact": {
|
|
57
|
+
check: true,
|
|
58
|
+
description: "Allows the user to add a new emergency contact to the system.",
|
|
59
|
+
},
|
|
60
|
+
"update-emergency-contact": {
|
|
61
|
+
check: true,
|
|
62
|
+
description: "Allows the user to update emergency contact details.",
|
|
63
|
+
},
|
|
64
|
+
"delete-emergency-contact": {
|
|
65
|
+
check: true,
|
|
66
|
+
description: "Allows the user to remove an emergency contact from the system permanently.",
|
|
67
|
+
},
|
|
68
|
+
"add-emergency-contact-category": {
|
|
69
|
+
check: true,
|
|
70
|
+
description: "Allows the user to add a new emergency contact category to the system.",
|
|
71
|
+
},
|
|
72
|
+
"delete-emergency-contact-category": {
|
|
73
|
+
check: true,
|
|
74
|
+
description: "Allows the user to delete an emergency contact category from the system.",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
42
77
|
inventory: {
|
|
43
78
|
"view-inventory": {
|
|
44
79
|
check: true,
|
package/composables/usePeople.ts
CHANGED
|
@@ -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,
|
package/composables/useWebUsb.ts
CHANGED
|
@@ -345,16 +345,19 @@ export default function useWebUsb() {
|
|
|
345
345
|
70,
|
|
346
346
|
);
|
|
347
347
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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,
|
|
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
|
|
405
|
-
*
|
|
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.
|
|
5
|
+
"version": "4.8.1-staging.304",
|
|
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.",
|
|
@@ -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>
|
package/types/facility.d.ts
CHANGED
|
@@ -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,14 @@ declare type TPeople = {
|
|
|
22
22
|
email?: string;
|
|
23
23
|
files?: { name: string, id: string }[];
|
|
24
24
|
isOwner?: boolean;
|
|
25
|
+
// Link to this person's `users` row. Empty for the person types that carry
|
|
26
|
+
// no login, and empty for a resident whose account was never written.
|
|
27
|
+
user?: string;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
declare type TPlateNumber = { plateNumber: string, recNo: string, _id?: string, status: "active" | "deleted" | "pending", type: TVehicleType };
|
|
28
31
|
|
|
29
32
|
|
|
30
|
-
declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string }
|
|
33
|
+
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 }
|
|
31
34
|
|
|
32
35
|
declare type TPeopleType = "guest" | "resident" | "tenant"
|
package/utils/materialSymbols.ts
CHANGED
|
@@ -242,6 +242,9 @@ export const MDI_TO_SYMBOL: Record<string, string> = {
|
|
|
242
242
|
"mdi-link-variant": "link",
|
|
243
243
|
"mdi-lan-connect": "lan",
|
|
244
244
|
"mdi-lan-disconnect": "link_off", // NEAREST: no disconnected-LAN glyph
|
|
245
|
+
"mdi-lan-check": "network_check",
|
|
246
|
+
"mdi-dialpad": "dialpad",
|
|
247
|
+
"mdi-headset": "headset_mic",
|
|
245
248
|
"mdi-bluetooth": "bluetooth",
|
|
246
249
|
"mdi-nfc": "nfc",
|
|
247
250
|
|
package/utils/org-modules.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The client half of `core src/utils/org-modules.util.ts`, and deliberately a
|
|
5
5
|
* COPY rather than an import: this package cannot depend on `@7365admin1/core`
|
|
6
6
|
* (it is the frontend layer, and `core` is a server package). The copy is
|
|
7
|
-
*
|
|
7
|
+
* short and fails open, and `test/org-module-catalogue.test.mjs` pins it
|
|
8
8
|
* against the same cases the server's tests use.
|
|
9
9
|
*
|
|
10
10
|
* ## What this is for
|
|
@@ -29,7 +29,75 @@
|
|
|
29
29
|
* would empty the role editor for every client the moment it deployed. It fails
|
|
30
30
|
* open on every uncertainty — a missing list, a non-array, an unreadable key,
|
|
31
31
|
* and a list that matches nothing at all.
|
|
32
|
+
*
|
|
33
|
+
* ## Spelling groups and the always-allowed set (plan S2, 2026-09-11)
|
|
34
|
+
*
|
|
35
|
+
* Both only WIDEN. A module is offered if the list names it under ANY spelling
|
|
36
|
+
* of the same module, and the modules every client needs to run its own
|
|
37
|
+
* organisation are offered whatever the list says.
|
|
32
38
|
*/
|
|
39
|
+
import { LEGACY_PERMISSION_ALIASES } from "../constants/permissions.ts";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Offered to every client whatever its module list says: without them a client
|
|
43
|
+
* cannot manage its own people, roles, sites or billing. Same set as core's
|
|
44
|
+
* `ALWAYS_ALLOWED` (defined in `org-modules.util.ts`, re-exported from
|
|
45
|
+
* `module-gate.util.ts`).
|
|
46
|
+
*/
|
|
47
|
+
export const ALWAYS_ALLOWED_MODULES: readonly string[] = Object.freeze([
|
|
48
|
+
"sites",
|
|
49
|
+
"subscriptions",
|
|
50
|
+
"customers",
|
|
51
|
+
"payment-methods",
|
|
52
|
+
"members",
|
|
53
|
+
"invitations",
|
|
54
|
+
"roles",
|
|
55
|
+
"roles-and-permissions",
|
|
56
|
+
"site-settings",
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The one pair the alias map does not carry. iMA365 gates Online Forms on
|
|
61
|
+
* `online-forms` while roles hold `online-form-configuration` (production,
|
|
62
|
+
* 2026-09-10: 33 roles against 1), and the app already treats the two as one
|
|
63
|
+
* module (`permission.utils.ts` RESOURCE_ALIASES). Both keys exist in the
|
|
64
|
+
* catalogues; grouping them only widens. core `SPELLING_GROUPS` (defined in
|
|
65
|
+
* `org-modules.util.ts`, re-exported from `module-gate.util.ts`) carries the
|
|
66
|
+
* same pair.
|
|
67
|
+
*/
|
|
68
|
+
const EXTRA_SPELLING_GROUPS: readonly (readonly [string, ...string[]])[] = [
|
|
69
|
+
["online-form-configuration", "online-forms"],
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Resource keys that are the SAME module under different spellings — e.g.
|
|
74
|
+
* `workOrder` / `work_order` / `work-orders` / `work_orders`.
|
|
75
|
+
*
|
|
76
|
+
* DERIVED from `LEGACY_PERMISSION_ALIASES` (every alias whose resource differs
|
|
77
|
+
* from its canonical resource), never hand-written, so a spelling cannot be
|
|
78
|
+
* invented here and a new alias is picked up without touching this file.
|
|
79
|
+
*/
|
|
80
|
+
export const MODULE_SPELLING_GROUPS: readonly (readonly string[])[] = (() => {
|
|
81
|
+
const groups = new Map<string, Set<string>>();
|
|
82
|
+
for (const [legacy, canonical] of Object.entries(LEGACY_PERMISSION_ALIASES)) {
|
|
83
|
+
const from = legacy.split(":")[0];
|
|
84
|
+
const to = canonical.split(":")[0];
|
|
85
|
+
if (from === to) continue;
|
|
86
|
+
const group = groups.get(to) ?? new Set([to]);
|
|
87
|
+
group.add(from);
|
|
88
|
+
groups.set(to, group);
|
|
89
|
+
}
|
|
90
|
+
for (const [canonical, ...others] of EXTRA_SPELLING_GROUPS) {
|
|
91
|
+
const group = groups.get(canonical) ?? new Set([canonical]);
|
|
92
|
+
others.forEach((key) => group.add(key));
|
|
93
|
+
groups.set(canonical, group);
|
|
94
|
+
}
|
|
95
|
+
return Object.freeze([...groups.values()].map((group) => Object.freeze([...group])));
|
|
96
|
+
})();
|
|
97
|
+
|
|
98
|
+
function spellingsOf(key: string): readonly string[] {
|
|
99
|
+
return MODULE_SPELLING_GROUPS.find((group) => group.includes(key)) ?? [key];
|
|
100
|
+
}
|
|
33
101
|
|
|
34
102
|
/** May this client's role editor OFFER this module? Fails open. */
|
|
35
103
|
export function orgAllowsModule(
|
|
@@ -40,8 +108,9 @@ export function orgAllowsModule(
|
|
|
40
108
|
|
|
41
109
|
const key = typeof resource === "string" ? resource.trim() : "";
|
|
42
110
|
if (!key) return true;
|
|
111
|
+
if (ALWAYS_ALLOWED_MODULES.includes(key)) return true;
|
|
43
112
|
|
|
44
|
-
return modules.includes(
|
|
113
|
+
return spellingsOf(key).some((spelling) => modules.includes(spelling));
|
|
45
114
|
}
|
|
46
115
|
|
|
47
116
|
/**
|
|
@@ -58,19 +127,28 @@ export function catalogueForOrg<T extends Record<string, unknown>>(
|
|
|
58
127
|
if (!Array.isArray(modules) || modules.length === 0) return catalogue;
|
|
59
128
|
if (!catalogue || typeof catalogue !== "object") return catalogue;
|
|
60
129
|
|
|
61
|
-
const narrowed: Record<string, unknown> = {};
|
|
62
|
-
for (const [resource, actions] of Object.entries(catalogue)) {
|
|
63
|
-
if (orgAllowsModule(modules, resource)) narrowed[resource] = actions;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
130
|
/*
|
|
67
131
|
* A list that matched NOTHING shows the whole catalogue rather than an empty
|
|
68
132
|
* one. A blank role editor is indistinguishable from a broken screen, and the
|
|
69
133
|
* likeliest cause of matching nothing is a console typo or a catalogue whose
|
|
70
134
|
* resource keys were renamed — neither of which should take the editor away
|
|
71
135
|
* from the client.
|
|
136
|
+
*
|
|
137
|
+
* "Matched" is decided on the list AS TYPED — the rule from before the
|
|
138
|
+
* spelling groups and the always-allowed set existed. Deciding it on the
|
|
139
|
+
* widened rule would let `members` (in every catalogue) turn this fallback
|
|
140
|
+
* into a narrowed editor; this way both additions can only ADD.
|
|
72
141
|
*/
|
|
73
|
-
|
|
142
|
+
const matchedAsTyped = Object.keys(catalogue).some(
|
|
143
|
+
(resource) => !resource.trim() || modules.includes(resource.trim()),
|
|
144
|
+
);
|
|
145
|
+
if (!matchedAsTyped) return catalogue;
|
|
146
|
+
|
|
147
|
+
const narrowed: Record<string, unknown> = {};
|
|
148
|
+
for (const [resource, actions] of Object.entries(catalogue)) {
|
|
149
|
+
if (orgAllowsModule(modules, resource)) narrowed[resource] = actions;
|
|
150
|
+
}
|
|
151
|
+
return narrowed as T;
|
|
74
152
|
}
|
|
75
153
|
|
|
76
154
|
/**
|