@7365admin1/layer-common 4.21.3 → 4.21.4-staging.339
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 +4 -4
- package/components/AnprCameraBadge.vue +142 -0
- package/components/DocumentForm.vue +407 -112
- package/components/DocumentManagement.vue +213 -12
- package/components/EntryPass/QrTemplatePreview.vue +21 -25
- package/components/EntryPassInformation.vue +119 -24
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/HidAccessLogDashboard.vue +29 -5
- package/components/HidAccessPermissions.vue +424 -0
- package/components/HidIntercomManagement.vue +48 -1
- package/components/HidProfileQrCode.vue +323 -0
- package/components/HidReaderManagement.vue +26 -0
- package/components/HidReaderUserRoster.vue +32 -2
- package/components/HidUserEnrollment.vue +833 -152
- package/components/InvitationClientForm.vue +19 -1
- package/components/PlateNumberDisplay.vue +91 -1
- package/components/VehicleForm.vue +246 -2
- package/components/VehicleManagement.vue +302 -51
- package/components/VisitorManagement.vue +357 -5
- package/composables/useAccessManagement.ts +5 -0
- package/composables/useDocument.ts +7 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +97 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/usePeople.ts +19 -0
- package/composables/useVehicle.ts +83 -1
- package/composables/useWebUsb.ts +14 -11
- package/package.json +1 -1
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/types/document.d.ts +14 -0
- package/types/facility.d.ts +4 -0
- package/types/people.d.ts +5 -2
- package/types/vehicle.d.ts +57 -2
- package/utils/hid-permission-assignments.ts +190 -0
- package/utils/vehicle-actions.ts +45 -17
package/utils/vehicle-actions.ts
CHANGED
|
@@ -19,7 +19,8 @@ export type VehicleActionKey =
|
|
|
19
19
|
| "edit"
|
|
20
20
|
| "approve"
|
|
21
21
|
| "restore"
|
|
22
|
-
| "
|
|
22
|
+
| "block"
|
|
23
|
+
| "unblock"
|
|
23
24
|
| "delete";
|
|
24
25
|
|
|
25
26
|
export type VehicleActionPermissions = {
|
|
@@ -44,11 +45,22 @@ export type VehicleActionPlate = {
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* The statuses, as the server now writes them:
|
|
49
|
+
*
|
|
50
|
+
* - active whitelisted, on the cameras' allowed list
|
|
51
|
+
* - temporary a season pass - whitelisted until its end date
|
|
52
|
+
* - blocked on every camera's blocklist (category "Block Listed")
|
|
53
|
+
* - unblocked off every blocklist and on no allowed list; the record stays
|
|
54
|
+
* - pending waiting for approval
|
|
55
|
+
* - deleted soft-deleted
|
|
56
|
+
* - inactive / rejected older records, restorable
|
|
57
|
+
*
|
|
58
|
+
* A site holds a plate ONCE whatever its status, so a vehicle that is not
|
|
59
|
+
* working any more is put back from its own record (Restore / Block) rather
|
|
60
|
+
* than added again.
|
|
50
61
|
*/
|
|
51
|
-
const
|
|
62
|
+
const LIVE_ALLOWED = new Set(["active", "temporary"]);
|
|
63
|
+
const RESTORABLE = new Set(["deleted", "inactive", "rejected"]);
|
|
52
64
|
|
|
53
65
|
export function vehiclePlateActions(
|
|
54
66
|
plate: VehicleActionPlate | null | undefined,
|
|
@@ -59,14 +71,19 @@ export function vehiclePlateActions(
|
|
|
59
71
|
const status = String(plate.status ?? "").toLowerCase();
|
|
60
72
|
const type = String(plate.type ?? "").toLowerCase();
|
|
61
73
|
|
|
62
|
-
|
|
74
|
+
// Records written before the new statuses carried "active" on a blocklist
|
|
75
|
+
// vehicle; they are blocked on the cameras all the same.
|
|
76
|
+
const isBlocked =
|
|
77
|
+
status === "blocked" || (status === "active" && type === "blocklist");
|
|
78
|
+
const isAllowed = LIVE_ALLOWED.has(status) && !isBlocked;
|
|
63
79
|
const isPending = status === "pending";
|
|
80
|
+
const isUnblocked = status === "unblocked";
|
|
64
81
|
const isRestorable = RESTORABLE.has(status);
|
|
65
|
-
const isTogglableType = type === "whitelist" || type === "blocklist";
|
|
66
82
|
|
|
83
|
+
const canUpdate = !!permissions.canUpdateVehicle;
|
|
67
84
|
const actions: VehicleAction[] = [];
|
|
68
85
|
|
|
69
|
-
if (
|
|
86
|
+
if (canUpdate && (isAllowed || isBlocked)) {
|
|
70
87
|
actions.push({ key: "edit", title: "Edit Vehicle", icon: "mdi-pencil" });
|
|
71
88
|
}
|
|
72
89
|
|
|
@@ -80,27 +97,38 @@ export function vehiclePlateActions(
|
|
|
80
97
|
}
|
|
81
98
|
|
|
82
99
|
// Restore is deliberately NOT gated on `canUpdateVehicle`: it was ungated
|
|
83
|
-
// before
|
|
84
|
-
// What changes is that a blocked vehicle now offers it at all.
|
|
100
|
+
// before and narrowing a gate is a separate, role-data decision.
|
|
85
101
|
if (isRestorable) {
|
|
86
102
|
actions.push({
|
|
87
103
|
key: "restore",
|
|
88
|
-
title:
|
|
104
|
+
title: "Restore",
|
|
89
105
|
icon: "mdi-restore",
|
|
90
106
|
color: "warning",
|
|
91
107
|
});
|
|
92
108
|
}
|
|
93
109
|
|
|
94
|
-
|
|
110
|
+
// Any record that is not already blocked (and is not waiting for approval)
|
|
111
|
+
// can be blocked - including an unblocked or deleted one, which is how the
|
|
112
|
+
// same plate is blocked again without a second record.
|
|
113
|
+
if (canUpdate && (isAllowed || isUnblocked || isRestorable)) {
|
|
114
|
+
actions.push({
|
|
115
|
+
key: "block",
|
|
116
|
+
title: "Block",
|
|
117
|
+
icon: "mdi-cancel",
|
|
118
|
+
color: "error",
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (canUpdate && isBlocked) {
|
|
95
123
|
actions.push({
|
|
96
|
-
key: "
|
|
97
|
-
title:
|
|
98
|
-
icon: "mdi-
|
|
99
|
-
color:
|
|
124
|
+
key: "unblock",
|
|
125
|
+
title: "Unblock",
|
|
126
|
+
icon: "mdi-lock-open-variant",
|
|
127
|
+
color: "primary",
|
|
100
128
|
});
|
|
101
129
|
}
|
|
102
130
|
|
|
103
|
-
if (permissions.canDeleteVehicle &&
|
|
131
|
+
if (permissions.canDeleteVehicle && (isAllowed || isBlocked)) {
|
|
104
132
|
actions.push({
|
|
105
133
|
key: "delete",
|
|
106
134
|
title: "Delete",
|