@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.
Files changed (32) hide show
  1. package/CHANGELOG.md +29 -4
  2. package/components/CameraForm.vue +460 -3
  3. package/components/CameraMain.vue +118 -1
  4. package/components/CameraPlateSyncDialog.vue +626 -0
  5. package/components/EntryPass/QrTemplatePreview.vue +21 -25
  6. package/components/Facility/BookingSetup.vue +63 -0
  7. package/components/HidIntercomManagement.vue +193 -43
  8. package/components/HidProfileQrCode.vue +323 -0
  9. package/components/HidReaderUserRoster.vue +32 -2
  10. package/components/HidUserEnrollment.vue +771 -212
  11. package/components/InvitationClientForm.vue +19 -1
  12. package/components/VehicleForm.vue +11 -3
  13. package/components/VisitorManagement.vue +267 -5
  14. package/composables/useFacility.ts +11 -0
  15. package/composables/useHidAmico.ts +97 -0
  16. package/composables/useHidNavigation.ts +25 -1
  17. package/composables/useMechanicalElectricalPermission.ts +5 -1
  18. package/composables/usePeople.ts +19 -0
  19. package/composables/usePestControlPermission.ts +39 -0
  20. package/composables/usePoolMaintenancePermission.ts +39 -0
  21. package/composables/usePropertyPermission.ts +9 -0
  22. package/composables/useSecurityPermission.ts +118 -0
  23. package/composables/useSiteSettings.ts +114 -2
  24. package/composables/useWebUsb.ts +14 -11
  25. package/constants/permissions.ts +5 -0
  26. package/package.json +1 -1
  27. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  28. package/types/facility.d.ts +4 -0
  29. package/types/people.d.ts +4 -1
  30. package/utils/anpr-direction.ts +70 -0
  31. package/utils/camera-plate-sync.ts +141 -0
  32. package/utils/materialSymbols.ts +3 -0
@@ -207,6 +207,14 @@
207
207
  </v-list-item-title>
208
208
  </v-list-item>
209
209
 
210
+ <!-- Add the site's vehicles to a camera that was added
211
+ without them, or put its plates back. -->
212
+ <v-list-item v-if="canSyncVehicles" @click="openSyncVehicles()">
213
+ <v-list-item-title class="text-subtitle-2">
214
+ Sync vehicles
215
+ </v-list-item-title>
216
+ </v-list-item>
217
+
210
218
  <v-list-item @click="openDialogDelete()" class="text-red">
211
219
  <v-list-item-title class="text-subtitle-2">
212
220
  Delete
@@ -227,6 +235,53 @@
227
235
  style="z-index: 3000"
228
236
  />
229
237
 
238
+ <!-- Sync vehicles, step 1: clear the camera's lists first, or keep them. -->
239
+ <v-dialog v-model="dialogSyncAsk" persistent width="540">
240
+ <v-card class="screen-modal" width="100%">
241
+ <v-card-text class="screen-modal__body pa-5 my-5 px-7 text-center">
242
+ <span class="screen-card-title d-block">
243
+ Clear this camera's plate lists first?
244
+ </span>
245
+ <span class="d-block mt-5">{{ syncAskMessage }}</span>
246
+ </v-card-text>
247
+
248
+ <div class="screen-modal__footer">
249
+ <v-btn
250
+ class="screen-btn-ghost"
251
+ variant="outlined"
252
+ @click="dialogSyncAsk = false"
253
+ >
254
+ Cancel
255
+ </v-btn>
256
+ <v-btn class="text-none" variant="outlined" @click="startSyncVehicles(false)">
257
+ No, keep them
258
+ </v-btn>
259
+ <v-btn
260
+ class="text-none"
261
+ variant="flat"
262
+ color="red"
263
+ @click="startSyncVehicles(true)"
264
+ >
265
+ Yes, clear all
266
+ </v-btn>
267
+ </div>
268
+ </v-card>
269
+ </v-dialog>
270
+
271
+ <!-- Sync vehicles, step 2: plate by plate, with progress. Closed only by
272
+ Done (or Cancel, once something has gone wrong). -->
273
+ <v-dialog v-model="dialogSync" persistent width="960" scrollable>
274
+ <CameraPlateSyncDialog
275
+ v-if="dialogSync"
276
+ :site="prop.site"
277
+ :camera="camera"
278
+ :camera-id="camera._id ?? ''"
279
+ :clear-lists="syncClear"
280
+ @done="handleSyncDone"
281
+ @cancel="dialogSync = false"
282
+ />
283
+ </v-dialog>
284
+
230
285
  <v-dialog v-model="dialogDelete" persistent width="540">
231
286
  <v-card width="100%">
232
287
  <v-card-text
@@ -277,6 +332,10 @@
277
332
  import type { PropType } from "vue";
278
333
  import useSiteSettings from "../composables/useSiteSettings";
279
334
  import { cameraErrorConverter } from "../utils/data";
335
+ import {
336
+ isAllowCameraDirection,
337
+ isBlockCameraDirection,
338
+ } from "../utils/anpr-direction";
280
339
 
281
340
  const events = defineEmits(["update:value", "row-click"]);
282
341
 
@@ -483,7 +542,17 @@ function handleError(msg: string) {
483
542
  showMessage(msg, "error");
484
543
  }
485
544
 
486
- function handleSuccess() {
545
+ function handleSuccess(
546
+ msg?: string,
547
+ detail?: {
548
+ clearedLists?: string[];
549
+ addedPlates?: Record<string, number>;
550
+ }
551
+ ) {
552
+ // Only a save that cleared a camera's plate lists, or wrote the site's
553
+ // vehicles to it, reports back - say so, so the person knows it happened.
554
+ if (detail && msg) showMessage(msg, "success");
555
+
487
556
  if (dialogAdd.value) dialogAdd.value = false;
488
557
 
489
558
  if (dialogEdit.value) dialogEdit.value = false;
@@ -525,6 +594,54 @@ function handleRowClick(_: any, data: any) {
525
594
  camera.value = JSON.parse(JSON.stringify(data.item));
526
595
  }
527
596
 
597
+ /* ------------------------------ Sync vehicles ----------------------------- */
598
+
599
+ const dialogSyncAsk = ref(false);
600
+ const dialogSync = ref(false);
601
+ const syncClear = ref(false);
602
+
603
+ /** An active ANPR camera of a type that receives plates (not Exit). */
604
+ const canSyncVehicles = computed(
605
+ () =>
606
+ camera.value.type === "anpr" &&
607
+ camera.value.status !== "inactive" &&
608
+ Boolean(camera.value._id) &&
609
+ isBlockCameraDirection(camera.value.direction)
610
+ );
611
+
612
+ const syncAskMessage = computed(() => {
613
+ const what = isAllowCameraDirection(camera.value.direction)
614
+ ? "every whitelist, season pass and blocked plate at this site"
615
+ : "every blocked plate at this site";
616
+ return (
617
+ `The site's vehicles - ${what} - are added to this camera one plate at ` +
618
+ `a time. Yes first removes every plate on its allowed list and ` +
619
+ `blocklist, including plates added directly on the camera; until a ` +
620
+ `vehicle's plate is back on, that vehicle is not let in through this ` +
621
+ `camera. No keeps what is on the camera and adds only the plates it is ` +
622
+ `missing.`
623
+ );
624
+ });
625
+
626
+ function openSyncVehicles() {
627
+ dialogPreview.value = false;
628
+ dialogSyncAsk.value = true;
629
+ }
630
+
631
+ function startSyncVehicles(clear: boolean) {
632
+ syncClear.value = clear;
633
+ dialogSyncAsk.value = false;
634
+ dialogSync.value = true;
635
+ }
636
+
637
+ function handleSyncDone(
638
+ msg: string,
639
+ detail: { clearedLists?: string[]; addedPlates?: Record<string, number> }
640
+ ) {
641
+ dialogSync.value = false;
642
+ handleSuccess(msg, detail);
643
+ }
644
+
528
645
  async function submitDelete() {
529
646
  try {
530
647
  await deleteSiteCameraById(camera.value._id ?? "");