@7365admin1/layer-common 4.90.2-staging.490 → 4.90.2

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 (67) hide show
  1. package/CHANGELOG.md +10 -4
  2. package/assets/css/primitives.css +0 -57
  3. package/assets/css/screens.css +4 -8
  4. package/components/AccessCardDetailsDialog.vue +6 -59
  5. package/components/AccessCardPreviewDialog.vue +53 -371
  6. package/components/AppSelect.vue +4 -143
  7. package/components/BuildingUnitFormEdit.vue +0 -6
  8. package/components/Dialog/UpdateMoreAction.vue +1 -11
  9. package/components/DocumentForm.vue +112 -407
  10. package/components/DocumentManagement.vue +12 -213
  11. package/components/Facility/BookingSetup.vue +0 -63
  12. package/components/HidAccessLogDashboard.vue +17 -74
  13. package/components/HidIntercomManagement.vue +14 -183
  14. package/components/HidQrCodeConfiguration.vue +195 -17
  15. package/components/HidReaderManagement.vue +0 -398
  16. package/components/HidReaderUserRoster.vue +3 -44
  17. package/components/HidUserEnrollment.vue +292 -2255
  18. package/components/InvitationClientForm.vue +1 -19
  19. package/components/InvitationForm.vue +4 -31
  20. package/components/InvitationMain.vue +22 -124
  21. package/components/MemberInformation.vue +4 -4
  22. package/components/PassInformation.vue +2 -2
  23. package/components/SiteSettings.vue +0 -48
  24. package/components/TableMain.vue +7 -22
  25. package/components/VehicleManagement.vue +5 -80
  26. package/components/VisitorForm.vue +19 -65
  27. package/components/VisitorManagement.vue +5 -267
  28. package/composables/useAccessManagement.ts +1 -17
  29. package/composables/useDocument.ts +0 -7
  30. package/composables/useFacility.ts +0 -11
  31. package/composables/useHidAmico.ts +0 -165
  32. package/composables/useHidNavigation.ts +1 -25
  33. package/composables/useMember.ts +0 -12
  34. package/composables/useNFCPatrolReportFilters.ts +3 -21
  35. package/composables/useNFCPatrolRoute.ts +1 -8
  36. package/composables/usePeople.ts +0 -19
  37. package/composables/useServiceProvider.ts +2 -45
  38. package/composables/useSettingsPermission.ts +0 -14
  39. package/composables/useUser.ts +2 -6
  40. package/composables/useVehicle.ts +1 -40
  41. package/composables/useVerification.ts +0 -3
  42. package/middleware/01.auth.ts +7 -3
  43. package/package.json +1 -1
  44. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  45. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  46. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  47. package/types/document.d.ts +0 -14
  48. package/types/facility.d.ts +0 -4
  49. package/types/member.d.ts +0 -4
  50. package/types/people.d.ts +1 -28
  51. package/types/service-provider.d.ts +0 -5
  52. package/types/site.d.ts +1 -7
  53. package/components/BuildingUnitManagement.vue +0 -298
  54. package/components/HidAccessPermissions.vue +0 -424
  55. package/components/HidProfileQrCode.vue +0 -332
  56. package/components/VehicleQrStickerDialog.vue +0 -249
  57. package/composables/useHidReaderSelection.ts +0 -50
  58. package/composables/useSiteCategory.ts +0 -45
  59. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
  60. package/utils/hid-enrolment-subject.ts +0 -344
  61. package/utils/hid-permission-assignments.ts +0 -198
  62. package/utils/hid-reader-selection.ts +0 -52
  63. package/utils/invite-group.ts +0 -61
  64. package/utils/invite-sites.ts +0 -25
  65. package/utils/occupancy-role.ts +0 -109
  66. package/utils/service-type.ts +0 -30
  67. package/utils/vehicle-qr-sticker.ts +0 -184
@@ -1,25 +0,0 @@
1
- /**
2
- * Which sites an "Invite member" request names (owner request 2026-10-02:
3
- * invite one person to several sites). One site keeps the old `siteId` shape;
4
- * 2 or more send `siteIds` (the server writes one invitation per site and
5
- * names every site in one e-mail).
6
- */
7
- export function inviteSitePayload(
8
- sites: string[],
9
- siteName = "",
10
- ): Record<string, unknown> {
11
- if (!sites.length) return {};
12
- if (sites.length === 1) {
13
- return { siteId: sites[0], ...(siteName && { siteName }) };
14
- }
15
- return { siteIds: sites };
16
- }
17
-
18
- /**
19
- * The one site a role is looked up for: the single chosen site, or "" for 2+
20
- * (a site role is valid at its own site only, so several sites offer
21
- * organisation roles only).
22
- */
23
- export function roleSiteFor(sites: string[]): string {
24
- return sites.length === 1 ? sites[0] : "";
25
- }
@@ -1,109 +0,0 @@
1
- /**
2
- * OWNER / OCCUPANT / PERSON IN CHARGE - the three standings a business
3
- * tenancy has, and everything the product says about them.
4
- *
5
- * One list, because three screens read it: the form that asks the question
6
- * (`PeopleFormMgmt`), the list and preview that print the answer back, and
7
- * the row menu that reassigns it (`people-mgmt`). The values are the ones the
8
- * server stores and validates - `OccupancyRoles` in core's `person.model.ts`
9
- * - so a value added on one side has to be added on the other.
10
- */
11
- export const OCCUPANCY_ROLE_OPTIONS: TOccupancyRoleOption[] = [
12
- {
13
- value: "owner",
14
- title: "Owner",
15
- action: "Assign Owner",
16
- prompt: "Assign Owner",
17
- description:
18
- "The legal titleholder or primary deed owner of the property.",
19
- },
20
- {
21
- value: "occupant",
22
- title: "Occupant",
23
- action: "Assign Occupant",
24
- prompt: "Assign Occupant",
25
- description:
26
- "The person currently living in, renting, or utilizing the physical unit.",
27
- },
28
- {
29
- value: "person-in-charge",
30
- title: "Person in Charge",
31
- action: "Assign Person in Charge",
32
- prompt: "Assign Person in Charge (PIC)",
33
- description:
34
- "The designated manager responsible for maintenance, emergencies, and daily operations.",
35
- },
36
- ];
37
-
38
- /**
39
- * The same three, in the order the ROW MENU draws them, which is not the
40
- * order the form's radio does. Derived rather than re-typed so the wording
41
- * cannot drift between the two.
42
- */
43
- export const OCCUPANCY_ROLE_ACTIONS: TOccupancyRoleOption[] = (
44
- ["person-in-charge", "owner", "occupant"] as TOccupancyRole[]
45
- ).map(
46
- (value) =>
47
- OCCUPANCY_ROLE_OPTIONS.find(
48
- (option) => option.value === value,
49
- ) as TOccupancyRoleOption,
50
- );
51
-
52
- /**
53
- * The label for a stored role, or "" for a person who was never asked - which
54
- * is everyone on a residential site and everyone saved before the question
55
- * existed. Callers decide what to print instead; nobody should print a raw
56
- * `person-in-charge` at a user.
57
- */
58
- export function occupancyRoleLabel(role?: string | null): string {
59
- return (
60
- OCCUPANCY_ROLE_OPTIONS.find((option) => option.value === role)?.title ?? ""
61
- );
62
- }
63
-
64
- /**
65
- * Does this person hold OWNER at their unit?
66
- *
67
- * The role when there is one, `isOwner` when there is not - the same test the
68
- * server applies (`holdsUnitOwner` in core's `unit-owner.util.ts`). A person
69
- * recorded before the role existed carries only the flag, and the people list
70
- * already prints them as "Owner".
71
- */
72
- export function holdsUnitOwner(person?: {
73
- occupancyRole?: string | null;
74
- isOwner?: boolean;
75
- }): boolean {
76
- if (!person) return false;
77
-
78
- if (person.occupancyRole) return person.occupancyRole === "owner";
79
-
80
- return person.isOwner === true;
81
- }
82
-
83
- /**
84
- * MUST THIS PERSON HAND THE UNIT OVER BEFORE THEY CAN BE DEACTIVATED?
85
- *
86
- * The owner of a unit does not leave while they still own it - the standing
87
- * moves to another tenant at the same block, level and unit first.
88
- *
89
- * Keyed to the ROLE and never to `isOwner`, exactly as the server keys it
90
- * (`mustHandOverBeforeDeactivating` in core): the flag is on every resident in
91
- * the estate, and no residential screen can change it, so a rule keyed to it
92
- * would trap records that can never satisfy it.
93
- */
94
- export function mustHandOverBeforeDeactivating(person?: {
95
- occupancyRole?: string | null;
96
- }): boolean {
97
- return person?.occupancyRole === "owner";
98
- }
99
-
100
- /**
101
- * Why a deactivation was held back. The SERVER carries the enforcing copy of
102
- * this rule and of these words (core `unit-owner.util.ts`); this one exists so
103
- * the console can say it before the round trip rather than after.
104
- */
105
- export function ownerHandoverRequiredMessage(name?: string): string {
106
- const who = name?.trim() ? `"${name.trim()}"` : "This person";
107
-
108
- return `${who} is the owner of this unit. Assign the owner role to another tenant at the same block, level and unit before deactivating them.`;
109
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * A SERVICE PROVIDER'S LINE OF BUSINESS, AS PEOPLE NAME IT.
3
- *
4
- * `/api/service-providers` returns the service CODE (`mechanical_electrical_services`),
5
- * which is a database value, not something to show an operator. This is the same
6
- * mapping `API-core src/utils/converter.ts spmServiceNewToOld` applies — copied
7
- * rather than imported, because that is a server package this layer does not
8
- * depend on.
9
- *
10
- * NOT the same labels as `utils/module-applications.ts APPLICATIONS`. Those name
11
- * the seven role-permission applications ("Mechanical & electrical", "Pest
12
- * control") and are keyed `mechanical-electrical`, not `*_services`. These are
13
- * the shorter names the service-provider screens use ("M&E", "Pest Control").
14
- *
15
- * An unknown code is returned untouched: a new service type shows as its raw
16
- * code, which is visibly odd, rather than vanishing from the row.
17
- */
18
- const SERVICE_TYPE_LABELS: Readonly<Record<string, string>> = Object.freeze({
19
- security_agency: "Security",
20
- cleaning_services: "Cleaning",
21
- pool_maintenance_services: "Pool Maintenance",
22
- pest_control_services: "Pest Control",
23
- landscaping_services: "Landscape",
24
- mechanical_electrical_services: "Mechanical & Electrical",
25
- });
26
-
27
- export function serviceTypeLabel(service: string | null | undefined): string {
28
- const code = String(service ?? "");
29
- return SERVICE_TYPE_LABELS[code] ?? code;
30
- }
@@ -1,184 +0,0 @@
1
- /**
2
- * Vehicle QR stickers - the pure parts (labels, selection, paging, print page).
3
- *
4
- * Kept free of Vue and of the QR library so `node --test` can run it. The
5
- * sticker itself carries NO resident detail: just the QR, the plate and the
6
- * Seven365 line. Block / level / unit / owner appear ONLY on the installer
7
- * strip under the dashed cut line, which is cut off before the sticker is
8
- * pasted on the car.
9
- */
10
-
11
- /** The server's most vehicles per request (POST /api/vehicles/qr/stickers). */
12
- export const STICKER_MAX_PER_REQUEST = 500;
13
-
14
- /** A4 sheet: 4 columns x 4 rows of 47 mm cells. */
15
- export const STICKER_COLUMNS = 4;
16
- export const STICKER_ROWS = 4;
17
- export const STICKERS_PER_PAGE = STICKER_COLUMNS * STICKER_ROWS;
18
-
19
- export type StickerItem = {
20
- vehicleId: string;
21
- qr: string;
22
- token?: string;
23
- block?: string;
24
- level?: string;
25
- unit?: string;
26
- plateNumber?: string;
27
- ownerName?: string;
28
- status?: string;
29
- };
30
-
31
- export type StickerPlateRow = {
32
- id: string;
33
- plateNumber: string;
34
- status: string;
35
- ownerName: string;
36
- unitLabel: string;
37
- };
38
-
39
- const text = (v: unknown) => (v == null ? "" : String(v).trim());
40
-
41
- /** "Blk 4 #02-01". Tolerates a unit that already carries its level ("02-01"). */
42
- export function stickerUnitLabel(parts: { block?: unknown; level?: unknown; unit?: unknown }): string {
43
- const block = text(parts.block).replace(/^(blk|block)\.?\s*/i, "");
44
- const level = text(parts.level).replace(/^(level|lvl|floor)\.?\s*/i, "");
45
- const unit = text(parts.unit).replace(/^(unit)\.?\s*/i, "").replace(/^#/, "");
46
- const home = unit.includes("-") || !level ? unit : `${level}-${unit}`;
47
- return [block ? `Blk ${block}` : "", home ? `#${home}` : ""].filter(Boolean).join(" ");
48
- }
49
-
50
- /** The installer strip under the cut line: where it goes and whose car. */
51
- export function installerLine(item: Pick<StickerItem, "block" | "level" | "unit" | "ownerName">): {
52
- place: string;
53
- owner: string;
54
- } {
55
- return { place: stickerUnitLabel(item), owner: text(item.ownerName) };
56
- }
57
-
58
- export type StickerWarning = { level: "error" | "warning"; text: string };
59
-
60
- /** What the preview says about a status. Null = nothing to warn about. */
61
- export function stickerWarning(status: unknown): StickerWarning | null {
62
- switch (text(status).toLowerCase()) {
63
- case "expired":
64
- return { level: "error", text: "Season pass expired" };
65
- case "blocklisted":
66
- return { level: "error", text: "On the blocklist" };
67
- case "inactive":
68
- return { level: "warning", text: "Vehicle is inactive" };
69
- case "pending":
70
- return { level: "warning", text: "Waiting for approval" };
71
- default:
72
- return null;
73
- }
74
- }
75
-
76
- /** Stickers that should NOT be ticked for printing until someone chooses to. */
77
- export function stickerStartsUnticked(status: unknown): boolean {
78
- return stickerWarning(status)?.level === "error" || text(status).toLowerCase() === "inactive";
79
- }
80
-
81
- /** The ids ticked by default in the preview. */
82
- export function defaultStickerIds(items: Pick<StickerItem, "vehicleId" | "status">[]): string[] {
83
- return items.filter((i) => !stickerStartsUnticked(i.status)).map((i) => i.vehicleId);
84
- }
85
-
86
- /** One selectable row per plate, from the list's grouped rows. */
87
- export function stickerPlateRows(rows: Array<Record<string, any>>): StickerPlateRow[] {
88
- const out: StickerPlateRow[] = [];
89
- for (const row of rows ?? []) {
90
- const plates: any[] = Array.isArray(row?.plates) && row.plates.length ? row.plates : [row];
91
- for (const plate of plates) {
92
- if (!plate?._id) continue;
93
- out.push({
94
- id: String(plate._id),
95
- plateNumber: text(plate.plateNumber),
96
- status: text(plate.status).toLowerCase(),
97
- ownerName: text(row?.name ?? plate.name),
98
- unitLabel: stickerUnitLabel({
99
- block: row?.block?.name ?? row?.block,
100
- level: row?.level?.name ?? row?.level,
101
- unit: row?.unit?.name ?? row?.unit,
102
- }),
103
- });
104
- }
105
- }
106
- return out;
107
- }
108
-
109
- /** Plates ticked on first open: live ones only (active / season pass). */
110
- export function defaultPlateIds(plates: StickerPlateRow[]): string[] {
111
- return plates.filter((p) => p.status === "active" || p.status === "temporary").map((p) => p.id);
112
- }
113
-
114
- /** Tick or untick a group of ids (e.g. "select all on this page"). */
115
- export function setIds(selected: string[], ids: string[], on: boolean): string[] {
116
- const rest = selected.filter((id) => !ids.includes(id));
117
- return on ? [...rest, ...ids] : rest;
118
- }
119
-
120
- /** The ids to send: unique, in order, at most what the server accepts. */
121
- export function idsForRequest(ids: string[]): { ids: string[]; dropped: number } {
122
- const unique = [...new Set(ids)];
123
- return { ids: unique.slice(0, STICKER_MAX_PER_REQUEST), dropped: Math.max(0, unique.length - STICKER_MAX_PER_REQUEST) };
124
- }
125
-
126
- /** Split into sheets. */
127
- export function stickerPages<T>(items: T[], perPage: number = STICKERS_PER_PAGE): T[][] {
128
- const pages: T[][] = [];
129
- for (let i = 0; i < items.length; i += perPage) pages.push(items.slice(i, i + perPage));
130
- return pages;
131
- }
132
-
133
- export function escapeHtml(value: unknown): string {
134
- return text(value)
135
- .replace(/&/g, "&amp;")
136
- .replace(/</g, "&lt;")
137
- .replace(/>/g, "&gt;")
138
- .replace(/"/g, "&quot;")
139
- .replace(/'/g, "&#39;");
140
- }
141
-
142
- const PRINT_CSS = `
143
- @page { size: A4; margin: 6mm; }
144
- * { box-sizing: border-box; }
145
- html, body { margin: 0; padding: 0; background: #fff; color: #111; font-family: Arial, Helvetica, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
146
- .page { display: grid; grid-template-columns: repeat(${STICKER_COLUMNS}, 47mm); gap: 2mm; justify-content: center; align-content: start; width: 198mm; height: 285mm; margin: 0 auto; break-after: page; }
147
- .page:last-child { break-after: auto; }
148
- .cell { width: 47mm; break-inside: avoid; }
149
- .card { width: 47mm; height: 58mm; border: 0.3mm solid #1a1a1a; border-radius: 3mm; padding: 2mm 2mm 1.6mm; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; }
150
- .qr { width: 32mm; height: 32mm; display: block; }
151
- .qr svg { width: 100%; height: 100%; display: block; }
152
- .plate { font-size: 13pt; font-weight: 800; letter-spacing: 0.3mm; line-height: 1.1; }
153
- .hint { font-size: 5.8pt; color: #333; line-height: 1.2; }
154
- .brand { display: flex; align-items: center; justify-content: center; gap: 1mm; font-size: 6pt; color: #222; border-top: 0.2mm solid #ccc; width: 100%; padding-top: 1mm; }
155
- .mark { width: 3.2mm; height: 3.2mm; border-radius: 0.8mm; background: #111; color: #fff; font-weight: 800; font-size: 5pt; line-height: 3.2mm; text-align: center; }
156
- .cut { margin-top: 1.2mm; border-top: 0.3mm dashed #666; padding-top: 1mm; font-size: 6.5pt; line-height: 1.25; color: #111; min-height: 8mm; }
157
- .cut .owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
158
- .cut .note { color: #666; font-size: 5.5pt; }
159
- @media screen { body { background: #e9e9e9; zoom: 0.75; padding: 4mm 0; } .page { background: #fff; margin-bottom: 4mm; height: auto; min-height: 285mm; box-shadow: 0 0 2mm rgba(0,0,0,.25); } }
160
- `;
161
-
162
- /**
163
- * One full HTML document: A4 sheets of stickers. `qrSvgs` is parallel to
164
- * `items` (the QR for each, already drawn). Every value is HTML-escaped - an
165
- * owner name is typed by a person.
166
- */
167
- export function buildStickerDocument(items: StickerItem[], qrSvgs: string[]): string {
168
- const cells = items.map((item, i) => {
169
- const { place, owner } = installerLine(item);
170
- return (
171
- `<div class="cell"><div class="card">` +
172
- `<div class="qr">${qrSvgs[i] ?? ""}</div>` +
173
- `<div class="plate">${escapeHtml(item.plateNumber)}</div>` +
174
- `<div class="hint">Scan with iSecure365 / iMA365</div>` +
175
- `<div class="brand"><span class="mark">7</span>Powered by Seven365</div>` +
176
- `</div>` +
177
- `<div class="cut"><div><b>${escapeHtml(place || "-")}</b></div>` +
178
- `<div class="owner">Owner: ${escapeHtml(owner || "-")}</div>` +
179
- `<div class="note">Installer: cut here, then paste on this car</div></div></div>`
180
- );
181
- });
182
- const pages = stickerPages(cells).map((p) => `<div class="page">${p.join("")}</div>`);
183
- return `<!doctype html><html><head><meta charset="utf-8"><title>Vehicle QR stickers</title><style>${PRINT_CSS}</style></head><body>${pages.join("")}</body></html>`;
184
- }