@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.
Files changed (38) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/components/AnprCameraBadge.vue +142 -0
  3. package/components/DocumentForm.vue +407 -112
  4. package/components/DocumentManagement.vue +213 -12
  5. package/components/EntryPass/QrTemplatePreview.vue +21 -25
  6. package/components/EntryPassInformation.vue +119 -24
  7. package/components/Facility/BookingSetup.vue +63 -0
  8. package/components/HidAccessLogDashboard.vue +29 -5
  9. package/components/HidAccessPermissions.vue +424 -0
  10. package/components/HidIntercomManagement.vue +48 -1
  11. package/components/HidProfileQrCode.vue +323 -0
  12. package/components/HidReaderManagement.vue +26 -0
  13. package/components/HidReaderUserRoster.vue +32 -2
  14. package/components/HidUserEnrollment.vue +833 -152
  15. package/components/InvitationClientForm.vue +19 -1
  16. package/components/PlateNumberDisplay.vue +91 -1
  17. package/components/VehicleForm.vue +246 -2
  18. package/components/VehicleManagement.vue +302 -51
  19. package/components/VisitorManagement.vue +357 -5
  20. package/composables/useAccessManagement.ts +5 -0
  21. package/composables/useDocument.ts +7 -0
  22. package/composables/useFacility.ts +11 -0
  23. package/composables/useHidAmico.ts +97 -0
  24. package/composables/useHidNavigation.ts +25 -1
  25. package/composables/usePeople.ts +19 -0
  26. package/composables/useVehicle.ts +83 -1
  27. package/composables/useWebUsb.ts +14 -11
  28. package/package.json +1 -1
  29. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  30. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  31. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  32. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  33. package/types/document.d.ts +14 -0
  34. package/types/facility.d.ts +4 -0
  35. package/types/people.d.ts +5 -2
  36. package/types/vehicle.d.ts +57 -2
  37. package/utils/hid-permission-assignments.ts +190 -0
  38. package/utils/vehicle-actions.ts +45 -17
@@ -19,7 +19,8 @@ export type VehicleActionKey =
19
19
  | "edit"
20
20
  | "approve"
21
21
  | "restore"
22
- | "toggle-type"
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
- * `inactive` is the status a blocked vehicle carries, and `deleted` is a
48
- * soft-deleted one. Both are "not currently working, and someone should be
49
- * able to put it back".
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 RESTORABLE = new Set(["inactive", "deleted", "rejected"]);
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
- const isActive = status === "active";
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 (permissions.canUpdateVehicle && isActive) {
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 this change and narrowing a gate is a separate, role-data decision.
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: status === "inactive" ? "Unblock" : "Restore",
104
+ title: "Restore",
89
105
  icon: "mdi-restore",
90
106
  color: "warning",
91
107
  });
92
108
  }
93
109
 
94
- if (permissions.canUpdateVehicle && isTogglableType && isActive) {
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: "toggle-type",
97
- title: type === "blocklist" ? "Unblock" : "Block",
98
- icon: "mdi-swap-horizontal",
99
- color: type === "blocklist" ? "primary" : "error",
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 && isActive) {
131
+ if (permissions.canDeleteVehicle && (isAllowed || isBlocked)) {
104
132
  actions.push({
105
133
  key: "delete",
106
134
  title: "Delete",