@7365admin1/layer-common 4.8.1 → 4.9.1-staging.306
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 +29 -4
- package/components/CameraForm.vue +460 -3
- package/components/CameraMain.vue +118 -1
- package/components/CameraPlateSyncDialog.vue +626 -0
- 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/VehicleForm.vue +11 -3
- package/components/VisitorManagement.vue +267 -5
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +97 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/useMechanicalElectricalPermission.ts +5 -1
- package/composables/usePeople.ts +19 -0
- package/composables/usePestControlPermission.ts +39 -0
- package/composables/usePoolMaintenancePermission.ts +39 -0
- package/composables/usePropertyPermission.ts +9 -0
- package/composables/useSecurityPermission.ts +118 -0
- package/composables/useSiteSettings.ts +114 -2
- package/composables/useWebUsb.ts +14 -11
- package/constants/permissions.ts +5 -0
- 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/anpr-direction.ts +70 -0
- package/utils/camera-plate-sync.ts +141 -0
- package/utils/materialSymbols.ts +3 -0
|
@@ -39,6 +39,45 @@ export default function usePoolMaintenancePermission() {
|
|
|
39
39
|
work_orders: workOrderPermissions,
|
|
40
40
|
"bulletin-board": bulletinBoardPermissions,
|
|
41
41
|
"service-provider-mgmt": serviceProviderPermissions,
|
|
42
|
+
// Owner answer Q5, 2026-09-11: Emergency Contacts is offered in the Pool
|
|
43
|
+
// maintenance role editor. Exactly the seven actions
|
|
44
|
+
// `constants/permissions.ts` defines, copied from `useCleaningPermission`
|
|
45
|
+
// (decision 3A). The long spelling `see-all-emergency-contacts` is
|
|
46
|
+
// deliberately NOT added. Catalogue-only: an unticked action stays refused.
|
|
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:
|
|
55
|
+
"Allows the user to view the details of a specific emergency contact.",
|
|
56
|
+
},
|
|
57
|
+
"add-emergency-contact": {
|
|
58
|
+
check: true,
|
|
59
|
+
description: "Allows the user to add a new emergency contact to the system.",
|
|
60
|
+
},
|
|
61
|
+
"update-emergency-contact": {
|
|
62
|
+
check: true,
|
|
63
|
+
description: "Allows the user to update emergency contact details.",
|
|
64
|
+
},
|
|
65
|
+
"delete-emergency-contact": {
|
|
66
|
+
check: true,
|
|
67
|
+
description:
|
|
68
|
+
"Allows the user to remove an emergency contact from the system permanently.",
|
|
69
|
+
},
|
|
70
|
+
"add-emergency-contact-category": {
|
|
71
|
+
check: true,
|
|
72
|
+
description:
|
|
73
|
+
"Allows the user to add a new emergency contact category to the system.",
|
|
74
|
+
},
|
|
75
|
+
"delete-emergency-contact-category": {
|
|
76
|
+
check: true,
|
|
77
|
+
description:
|
|
78
|
+
"Allows the user to delete an emergency contact category from the system.",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
42
81
|
|
|
43
82
|
"site-settings": {
|
|
44
83
|
"can-view-site-settings": {
|
|
@@ -511,6 +511,15 @@ export default function usePropertyPermission() {
|
|
|
511
511
|
"Allows the user to view the site's cameras. (Legacy name — this is the camera wall.)",
|
|
512
512
|
},
|
|
513
513
|
},
|
|
514
|
+
// NEW, owner answer Q9, 2026-09-11 — the iMA365 CCTV tile's own right.
|
|
515
|
+
// Same string and description as `useSecurityPermission`. Catalogue-only:
|
|
516
|
+
// nothing reads it yet, and the four `virtual-patrol:` strings above stay.
|
|
517
|
+
"cctv-mgmt": {
|
|
518
|
+
"see-all-cctv": {
|
|
519
|
+
check: true,
|
|
520
|
+
description: "Allows the user to view the site's CCTV cameras.",
|
|
521
|
+
},
|
|
522
|
+
},
|
|
514
523
|
"nfc-patrol": {
|
|
515
524
|
"see-all-nfc-patrol": {
|
|
516
525
|
check: true,
|
|
@@ -427,6 +427,12 @@ export default function useSecurityPermission() {
|
|
|
427
427
|
description:
|
|
428
428
|
"Allows the user to view the details of a specific incident report.",
|
|
429
429
|
},
|
|
430
|
+
// Owner answer Q10, 2026-09-11. Property's spelling and description,
|
|
431
|
+
// verbatim; the iSecure365 mobile app already accepts this string.
|
|
432
|
+
"review-incident-report": {
|
|
433
|
+
check: true,
|
|
434
|
+
description: "Allows the user to approve or reject incident report.",
|
|
435
|
+
},
|
|
430
436
|
"delete-incident-report": {
|
|
431
437
|
check: true,
|
|
432
438
|
description:
|
|
@@ -590,6 +596,118 @@ export default function useSecurityPermission() {
|
|
|
590
596
|
"Allows the user to open the notification feed on the iSecure365 mobile app.",
|
|
591
597
|
},
|
|
592
598
|
},
|
|
599
|
+
|
|
600
|
+
/*
|
|
601
|
+
* THE GUARD APP'S TILES THAT NO ROLE COULD BE GRANTED — owner answers Q5,
|
|
602
|
+
* Q9 and Q10, 2026-09-11: "tiles with no permission: build them".
|
|
603
|
+
*
|
|
604
|
+
* Every string below already exists verbatim in another application's
|
|
605
|
+
* catalogue (Property, or Cleaning for the 3A emergency set) and is copied
|
|
606
|
+
* from there, spelling and description. Two are new, and only two:
|
|
607
|
+
* `nfc-patrol:start-nfc-patrol` (mirrors `start-virtual-patrol-route`) and
|
|
608
|
+
* `cctv-mgmt:see-all-cctv` (today only `site-settings:manage-cctv-camera`,
|
|
609
|
+
* a setup action, exists). Pinned by `test/no-duplicate-spelling.test.mjs`.
|
|
610
|
+
*
|
|
611
|
+
* Catalogue-only: this widens what the role editor may OFFER and grants
|
|
612
|
+
* nobody anything. No gate reads these here yet.
|
|
613
|
+
*/
|
|
614
|
+
"emergency-contact": {
|
|
615
|
+
"see-all": {
|
|
616
|
+
check: true,
|
|
617
|
+
description: "Allows the user to view the list of all emergency contacts.",
|
|
618
|
+
},
|
|
619
|
+
"see-details": {
|
|
620
|
+
check: true,
|
|
621
|
+
description:
|
|
622
|
+
"Allows the user to view the details of a specific emergency contact.",
|
|
623
|
+
},
|
|
624
|
+
"add-emergency-contact": {
|
|
625
|
+
check: true,
|
|
626
|
+
description: "Allows the user to add a new emergency contact to the system.",
|
|
627
|
+
},
|
|
628
|
+
"update-emergency-contact": {
|
|
629
|
+
check: true,
|
|
630
|
+
description: "Allows the user to update emergency contact details.",
|
|
631
|
+
},
|
|
632
|
+
"delete-emergency-contact": {
|
|
633
|
+
check: true,
|
|
634
|
+
description:
|
|
635
|
+
"Allows the user to remove an emergency contact from the system permanently.",
|
|
636
|
+
},
|
|
637
|
+
"add-emergency-contact-category": {
|
|
638
|
+
check: true,
|
|
639
|
+
description:
|
|
640
|
+
"Allows the user to add a new emergency contact category to the system.",
|
|
641
|
+
},
|
|
642
|
+
"delete-emergency-contact-category": {
|
|
643
|
+
check: true,
|
|
644
|
+
description:
|
|
645
|
+
"Allows the user to delete an emergency contact category from the system.",
|
|
646
|
+
},
|
|
647
|
+
},
|
|
648
|
+
"facility-booking-mgmt": {
|
|
649
|
+
"add-facility-booking": {
|
|
650
|
+
check: true,
|
|
651
|
+
description:
|
|
652
|
+
"Allows the user to add a new facility-booking to the system.",
|
|
653
|
+
},
|
|
654
|
+
"see-all-facility-booking": {
|
|
655
|
+
check: true,
|
|
656
|
+
description: "Allows the user to view the list of all facilities.",
|
|
657
|
+
},
|
|
658
|
+
"see-facility-booking-details": {
|
|
659
|
+
check: true,
|
|
660
|
+
description:
|
|
661
|
+
"Allows the user to view the details of a specific facility-booking.",
|
|
662
|
+
},
|
|
663
|
+
"update-facility-booking": {
|
|
664
|
+
check: true,
|
|
665
|
+
description: "Allows the user to update facility-booking details.",
|
|
666
|
+
},
|
|
667
|
+
"delete-facility-booking": {
|
|
668
|
+
check: true,
|
|
669
|
+
description:
|
|
670
|
+
"Allows the user to remove a facility-booking from the system permanently.",
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
// Property's descriptions minus its "Checked by the iMA365 mobile app."
|
|
674
|
+
// sentence, which is not true of this application.
|
|
675
|
+
"passes-and-keys-mgmt": {
|
|
676
|
+
"see-all-passes-and-keys": {
|
|
677
|
+
check: true,
|
|
678
|
+
description:
|
|
679
|
+
"Allows the user to view the list of all passes and keys on mobile.",
|
|
680
|
+
},
|
|
681
|
+
},
|
|
682
|
+
"resident-transactions": {
|
|
683
|
+
"see-all-resident-transactions": {
|
|
684
|
+
check: true,
|
|
685
|
+
description:
|
|
686
|
+
"Allows the user to view the list of all resident transactions on mobile.",
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
"nfc-patrol": {
|
|
690
|
+
"see-all-nfc-patrol": {
|
|
691
|
+
check: true,
|
|
692
|
+
description:
|
|
693
|
+
"Allows the user to view created routes and patrol logs.",
|
|
694
|
+
},
|
|
695
|
+
// NEW. Mirrors `virtual-patrol:start-virtual-patrol-route`.
|
|
696
|
+
"start-nfc-patrol": {
|
|
697
|
+
check: true,
|
|
698
|
+
description:
|
|
699
|
+
"Allows the user to start NFC patrolling on a specific route.",
|
|
700
|
+
},
|
|
701
|
+
},
|
|
702
|
+
// NEW. Seeing the CCTV wall, as distinct from setting cameras up
|
|
703
|
+
// (`site-settings:manage-cctv-camera`).
|
|
704
|
+
"cctv-mgmt": {
|
|
705
|
+
"see-all-cctv": {
|
|
706
|
+
check: true,
|
|
707
|
+
description: "Allows the user to view the site's CCTV cameras.",
|
|
708
|
+
},
|
|
709
|
+
},
|
|
710
|
+
|
|
593
711
|
members: memberPermissions,
|
|
594
712
|
invitations: invitationPermissions,
|
|
595
713
|
roles: rolePermissions,
|
|
@@ -48,7 +48,22 @@ export default function () {
|
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
|
-
async function addCamera(
|
|
51
|
+
async function addCamera(
|
|
52
|
+
camera: TSiteCamera &
|
|
53
|
+
TCameraByRecorder & {
|
|
54
|
+
/**
|
|
55
|
+
* Clear the new ANPR camera's allowed list and blocklist on the device
|
|
56
|
+
* before the site's vehicles are added. Absent means keep them.
|
|
57
|
+
*/
|
|
58
|
+
clearCameraLists?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The add-camera screen has already cleared and filled the camera
|
|
61
|
+
* itself (`clearNewCamera` / `addNewCameraPlate`), so saving must not
|
|
62
|
+
* touch the device again.
|
|
63
|
+
*/
|
|
64
|
+
skipPlateSync?: boolean;
|
|
65
|
+
}
|
|
66
|
+
) {
|
|
52
67
|
return await useNuxtApp().$api<Record<string, any>>(`/api/site-cameras`, {
|
|
53
68
|
method: "POST",
|
|
54
69
|
body: camera,
|
|
@@ -85,6 +100,83 @@ export default function () {
|
|
|
85
100
|
* Try an address before saving it. Read-only, and it runs on the server —
|
|
86
101
|
* the browser never touches a recorder and never sees a credential.
|
|
87
102
|
*/
|
|
103
|
+
/* ---- filling a NEW ANPR camera, before it is saved ---- */
|
|
104
|
+
|
|
105
|
+
type TNewCameraDevice = {
|
|
106
|
+
host: string;
|
|
107
|
+
username: string;
|
|
108
|
+
password: string;
|
|
109
|
+
name?: string;
|
|
110
|
+
direction: string;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** The plates a new camera of this type receives, blocked ones first. */
|
|
114
|
+
async function getNewCameraPlates(
|
|
115
|
+
siteId: string,
|
|
116
|
+
query: { host: string; direction: string }
|
|
117
|
+
) {
|
|
118
|
+
return await useNuxtApp().$api<{ items: Array<Record<string, any>> }>(
|
|
119
|
+
`/api/site-cameras/site/${siteId}/new-camera/plates`,
|
|
120
|
+
{ method: "GET", query }
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Empty the new camera's allowed list and blocklist on the device. */
|
|
125
|
+
async function clearNewCamera(siteId: string, device: TNewCameraDevice) {
|
|
126
|
+
return await useNuxtApp().$api<Record<string, any>>(
|
|
127
|
+
`/api/site-cameras/site/${siteId}/new-camera/clear`,
|
|
128
|
+
{ method: "POST", body: device }
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Write ONE vehicle's plate to the new camera. Answers `{ ok: false, reason,
|
|
134
|
+
* kind }` when the camera refuses it.
|
|
135
|
+
*/
|
|
136
|
+
async function addNewCameraPlate(
|
|
137
|
+
siteId: string,
|
|
138
|
+
device: TNewCameraDevice,
|
|
139
|
+
plate: { vehicle: string; list: "allowed" | "blocked"; onlyIfMissing?: boolean }
|
|
140
|
+
) {
|
|
141
|
+
return await useNuxtApp().$api<{ ok: boolean; reason?: string; kind?: string }>(
|
|
142
|
+
`/api/site-cameras/site/${siteId}/new-camera/plate`,
|
|
143
|
+
{ method: "POST", body: { ...device, ...plate } }
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* ---- "Sync vehicles": filling a camera that is already saved ---- */
|
|
148
|
+
|
|
149
|
+
/** The plates this saved camera receives, blocked ones first. */
|
|
150
|
+
async function getCameraPlates(cameraId: string) {
|
|
151
|
+
return await useNuxtApp().$api<{ items: Array<Record<string, any>> }>(
|
|
152
|
+
`/api/site-cameras/id/${cameraId}/plates`,
|
|
153
|
+
{ method: "GET" }
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Empty the saved camera's allowed list and blocklist on the device. */
|
|
158
|
+
async function clearCamera(cameraId: string) {
|
|
159
|
+
return await useNuxtApp().$api<Record<string, any>>(
|
|
160
|
+
`/api/site-cameras/id/${cameraId}/clear`,
|
|
161
|
+
{ method: "POST" }
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Write ONE vehicle's plate to the saved camera. The server uses the
|
|
167
|
+
* camera's stored login. Answers `{ ok: false, reason, kind }` when the
|
|
168
|
+
* camera refuses it.
|
|
169
|
+
*/
|
|
170
|
+
async function addCameraPlate(
|
|
171
|
+
cameraId: string,
|
|
172
|
+
plate: { vehicle: string; list: "allowed" | "blocked"; onlyIfMissing?: boolean }
|
|
173
|
+
) {
|
|
174
|
+
return await useNuxtApp().$api<{ ok: boolean; reason?: string; kind?: string }>(
|
|
175
|
+
`/api/site-cameras/id/${cameraId}/plate`,
|
|
176
|
+
{ method: "POST", body: plate }
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
88
180
|
async function testSiteCamera(
|
|
89
181
|
siteId: string,
|
|
90
182
|
payload: { host?: string } & TCameraByRecorder
|
|
@@ -112,7 +204,21 @@ export default function () {
|
|
|
112
204
|
| "status"
|
|
113
205
|
>
|
|
114
206
|
> &
|
|
115
|
-
TCameraByRecorder
|
|
207
|
+
TCameraByRecorder & {
|
|
208
|
+
/**
|
|
209
|
+
* The person confirmed that this type change clears the camera's
|
|
210
|
+
* plate lists on the camera itself (to Exit: allowed list and
|
|
211
|
+
* blocklist; Entry / Both / Residents to Visitors: allowed list).
|
|
212
|
+
* Without it the API refuses that change.
|
|
213
|
+
*/
|
|
214
|
+
confirmClearCameraLists?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Save a type change that would fill the camera (to Entry / Both /
|
|
217
|
+
* Residents, or Exit to Visitors) without filling it: the vehicles
|
|
218
|
+
* are added afterwards with "Sync vehicles", or not now.
|
|
219
|
+
*/
|
|
220
|
+
skipPlateSync?: boolean;
|
|
221
|
+
}
|
|
116
222
|
) {
|
|
117
223
|
return await useNuxtApp().$api<Record<string, any>>(
|
|
118
224
|
`/api/site-cameras/id/${id}`,
|
|
@@ -303,6 +409,12 @@ export default function () {
|
|
|
303
409
|
updateSite,
|
|
304
410
|
addCamera,
|
|
305
411
|
testSiteCamera,
|
|
412
|
+
getNewCameraPlates,
|
|
413
|
+
clearNewCamera,
|
|
414
|
+
addNewCameraPlate,
|
|
415
|
+
getCameraPlates,
|
|
416
|
+
clearCamera,
|
|
417
|
+
addCameraPlate,
|
|
306
418
|
getAllSiteCameras,
|
|
307
419
|
bulkImportSiteCameras,
|
|
308
420
|
getSiteWall,
|
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/constants/permissions.ts
CHANGED
|
@@ -327,7 +327,12 @@ export const PERMISSIONS = {
|
|
|
327
327
|
"add-nfc-patrol",
|
|
328
328
|
"update-nfc-patrol",
|
|
329
329
|
"delete-nfc-patrol",
|
|
330
|
+
// Owner answer Q10, 2026-09-11. Mirrors `start-virtual-patrol-route`.
|
|
331
|
+
"start-nfc-patrol",
|
|
330
332
|
],
|
|
333
|
+
// Owner answer Q9, 2026-09-11: seeing the CCTV wall. Distinct from
|
|
334
|
+
// `site-settings:manage-cctv-camera`, which is camera setup.
|
|
335
|
+
"cctv-mgmt": ["see-all-cctv"],
|
|
331
336
|
"billing-mgmt": [
|
|
332
337
|
"see-all-billing-summary",
|
|
333
338
|
"see-all-billing-items",
|
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.9.1-staging.306",
|
|
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"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANPR camera types ("direction") that carry whitelist and season pass plates.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `ALLOW_CAMERA_DIRECTIONS` in iservice365-core
|
|
5
|
+
* (`src/utils/anpr-plate.util.ts`): an allowed plate is written to every Entry,
|
|
6
|
+
* Both Entry and Exit, and Residents camera, and never to Visitors or Exit.
|
|
7
|
+
*/
|
|
8
|
+
export const ALLOW_CAMERA_DIRECTIONS = ["entry", "both", "residents"];
|
|
9
|
+
|
|
10
|
+
export const isAllowCameraDirection = (direction: unknown): boolean =>
|
|
11
|
+
ALLOW_CAMERA_DIRECTIONS.includes(
|
|
12
|
+
String(direction ?? "").trim().toLowerCase(),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
/** ANPR camera types that carry blocked plates: every type except Exit. */
|
|
16
|
+
export const BLOCK_CAMERA_DIRECTIONS = ["entry", "both", "residents", "visitors"];
|
|
17
|
+
|
|
18
|
+
export const isBlockCameraDirection = (direction: unknown): boolean =>
|
|
19
|
+
BLOCK_CAMERA_DIRECTIONS.includes(
|
|
20
|
+
String(direction ?? "").trim().toLowerCase(),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Which of a camera's plate lists are FILLED with the site's vehicles when it
|
|
25
|
+
* is added (`from` empty) or its type changes - the lists the new type holds
|
|
26
|
+
* and the old one did not. Mirrors `listsFilledByDirectionChange` in
|
|
27
|
+
* iservice365-core. Nothing to confirm (nothing is removed), but saving takes
|
|
28
|
+
* longer, so the form says so.
|
|
29
|
+
*/
|
|
30
|
+
export const listsFilledByDirectionChange = (
|
|
31
|
+
from: unknown,
|
|
32
|
+
to: unknown,
|
|
33
|
+
): { allow: boolean; block: boolean } => {
|
|
34
|
+
const before = String(from ?? "").trim().toLowerCase();
|
|
35
|
+
const after = String(to ?? "").trim().toLowerCase();
|
|
36
|
+
|
|
37
|
+
if (!after || after === before) return { allow: false, block: false };
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
allow: isAllowCameraDirection(after) && !isAllowCameraDirection(before),
|
|
41
|
+
block: isBlockCameraDirection(after) && !isBlockCameraDirection(before),
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Which of a camera's plate lists a type change empties, on the camera itself
|
|
47
|
+
* - every plate on the list, including ones added directly on the camera.
|
|
48
|
+
* Mirrors `listsClearedByDirectionChange` in iservice365-core, which refuses
|
|
49
|
+
* the change unless it is confirmed, so the form asks first.
|
|
50
|
+
*
|
|
51
|
+
* - To Exit: the allowed list and the blocklist.
|
|
52
|
+
* - Entry / Both / Residents to Visitors: the allowed list.
|
|
53
|
+
* - Anything else: nothing.
|
|
54
|
+
*/
|
|
55
|
+
export const listsClearedByDirectionChange = (
|
|
56
|
+
from: unknown,
|
|
57
|
+
to: unknown,
|
|
58
|
+
): { allow: boolean; block: boolean } => {
|
|
59
|
+
const before = String(from ?? "").trim().toLowerCase();
|
|
60
|
+
const after = String(to ?? "").trim().toLowerCase();
|
|
61
|
+
|
|
62
|
+
if (!after || after === before) return { allow: false, block: false };
|
|
63
|
+
|
|
64
|
+
if (after === "exit") return { allow: true, block: true };
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
allow: isAllowCameraDirection(before) && !isAllowCameraDirection(after),
|
|
68
|
+
block: false,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing a new ANPR camera's plates one at a time from the add-camera screen.
|
|
3
|
+
*
|
|
4
|
+
* The screen shows every plate the camera will receive with its own progress -
|
|
5
|
+
* pending, adding, added, failed - and lets the person retry. The rules for
|
|
6
|
+
* WHEN to stop live here, apart from the component, so they can be tested:
|
|
7
|
+
*
|
|
8
|
+
* - between plates, when the person presses Stop;
|
|
9
|
+
* - at once, when the camera refuses the LOGIN or the permission. Every further
|
|
10
|
+
* attempt would be another failed login, and a Dahua unit locks the account
|
|
11
|
+
* for 30 minutes after 3 failed logins in 30 seconds;
|
|
12
|
+
* - after 3 plates in a row fail for any other reason - the camera has most
|
|
13
|
+
* likely gone away, and each attempt waits for a timeout.
|
|
14
|
+
*
|
|
15
|
+
* Whatever is not attempted stays "pending", and Retry carries on with the
|
|
16
|
+
* failed and pending plates.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export type PlateSyncStatus = "pending" | "adding" | "added" | "failed";
|
|
20
|
+
|
|
21
|
+
export type PlateSyncRow = {
|
|
22
|
+
id: string;
|
|
23
|
+
vehicle: string;
|
|
24
|
+
list: "allowed" | "blocked";
|
|
25
|
+
plateNumber: string;
|
|
26
|
+
name: string;
|
|
27
|
+
block: string;
|
|
28
|
+
level: string;
|
|
29
|
+
unit: string;
|
|
30
|
+
kind: string;
|
|
31
|
+
status: PlateSyncStatus;
|
|
32
|
+
error?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** What writing one plate answered. `kind` as the API classifies a refusal. */
|
|
36
|
+
export type PlateWriteAnswer = {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
reason?: string;
|
|
39
|
+
kind?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type PlateQueueStop = "done" | "requested" | "login" | "failures";
|
|
43
|
+
|
|
44
|
+
export const MAX_FAILURES_IN_A_ROW = 3;
|
|
45
|
+
|
|
46
|
+
export function plateSyncCounts(rows: PlateSyncRow[]) {
|
|
47
|
+
let added = 0;
|
|
48
|
+
let failed = 0;
|
|
49
|
+
let pending = 0;
|
|
50
|
+
for (const row of rows) {
|
|
51
|
+
if (row.status === "added") added++;
|
|
52
|
+
else if (row.status === "failed") failed++;
|
|
53
|
+
else pending++;
|
|
54
|
+
}
|
|
55
|
+
return { total: rows.length, added, failed, pending };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type PlateSyncCounts = ReturnType<typeof plateSyncCounts>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The same counts, kept apart for the allowed list (whitelist, season pass)
|
|
62
|
+
* and the blocklist - a failed blocked plate is a car that can still get in,
|
|
63
|
+
* which is not the same as a resident who cannot.
|
|
64
|
+
*/
|
|
65
|
+
export function plateSyncCountsByList(rows: PlateSyncRow[]): {
|
|
66
|
+
allowed: PlateSyncCounts;
|
|
67
|
+
blocked: PlateSyncCounts;
|
|
68
|
+
} {
|
|
69
|
+
return {
|
|
70
|
+
allowed: plateSyncCounts(rows.filter((row) => row.list !== "blocked")),
|
|
71
|
+
blocked: plateSyncCounts(rows.filter((row) => row.list === "blocked")),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The plates Retry carries on with: every failed one and every pending one. */
|
|
76
|
+
export function rowsToRetry(rows: PlateSyncRow[]): PlateSyncRow[] {
|
|
77
|
+
return rows.filter((row) => row.status === "failed" || row.status === "pending");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Write `targets` one at a time, in order, updating each row's `status` (and
|
|
82
|
+
* `error`) in place. `write` may answer `{ ok: false }` or throw - both mark
|
|
83
|
+
* the row failed. Returns why it stopped, and the sentence to show for it.
|
|
84
|
+
*/
|
|
85
|
+
export async function runPlateQueue(
|
|
86
|
+
targets: PlateSyncRow[],
|
|
87
|
+
write: (row: PlateSyncRow) => Promise<PlateWriteAnswer>,
|
|
88
|
+
options: { shouldStop?: () => boolean } = {},
|
|
89
|
+
): Promise<{ stopped: PlateQueueStop; message: string }> {
|
|
90
|
+
let failuresInARow = 0;
|
|
91
|
+
|
|
92
|
+
for (const row of targets) {
|
|
93
|
+
if (options.shouldStop?.()) {
|
|
94
|
+
return {
|
|
95
|
+
stopped: "requested",
|
|
96
|
+
message: "Stopped. Press Retry to carry on with the pending and failed plates.",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
row.status = "adding";
|
|
101
|
+
row.error = "";
|
|
102
|
+
|
|
103
|
+
let answer: PlateWriteAnswer;
|
|
104
|
+
try {
|
|
105
|
+
answer = await write(row);
|
|
106
|
+
} catch (error: any) {
|
|
107
|
+
answer = { ok: false, reason: String(error?.message ?? error ?? "") };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (answer?.ok) {
|
|
111
|
+
row.status = "added";
|
|
112
|
+
failuresInARow = 0;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
row.status = "failed";
|
|
117
|
+
row.error = answer?.reason || "The plate could not be added.";
|
|
118
|
+
failuresInARow++;
|
|
119
|
+
|
|
120
|
+
if (answer?.kind === "challenge" || answer?.kind === "rejected") {
|
|
121
|
+
return {
|
|
122
|
+
stopped: "login",
|
|
123
|
+
message:
|
|
124
|
+
`Stopped: ${row.error.replace(/\.\s*$/, "")}. Check the camera's ` +
|
|
125
|
+
`username and password, then press Retry.`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (failuresInARow >= MAX_FAILURES_IN_A_ROW) {
|
|
130
|
+
return {
|
|
131
|
+
stopped: "failures",
|
|
132
|
+
message:
|
|
133
|
+
`Stopped after ${MAX_FAILURES_IN_A_ROW} plates in a row could not ` +
|
|
134
|
+
`be added. Check that the camera is switched on and reachable, then ` +
|
|
135
|
+
`press Retry.`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return { stopped: "done", message: "" };
|
|
141
|
+
}
|
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
|
|