@7365admin1/layer-common 4.9.1-staging.310 → 4.9.1

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 (36) hide show
  1. package/CHANGELOG.md +14 -4
  2. package/components/CameraForm.vue +3 -460
  3. package/components/CameraMain.vue +1 -118
  4. package/components/DashboardMain.vue +5 -17
  5. package/components/EntryPass/QrTemplatePreview.vue +25 -21
  6. package/components/Facility/BookingSetup.vue +0 -63
  7. package/components/HidIntercomManagement.vue +43 -193
  8. package/components/HidReaderUserRoster.vue +2 -32
  9. package/components/HidUserEnrollment.vue +212 -771
  10. package/components/InvitationClientForm.vue +1 -19
  11. package/components/Layout/NavigationDrawer.vue +2 -8
  12. package/components/MemberMain.vue +1 -10
  13. package/components/RolePermissionMain.vue +2 -7
  14. package/components/VehicleForm.vue +3 -11
  15. package/components/VisitorManagement.vue +5 -267
  16. package/composables/useFacility.ts +0 -11
  17. package/composables/useHidAmico.ts +0 -97
  18. package/composables/useHidNavigation.ts +1 -25
  19. package/composables/useLocalSetup.ts +0 -7
  20. package/composables/useMember.ts +0 -11
  21. package/composables/usePeople.ts +0 -19
  22. package/composables/useSiteSettings.ts +2 -114
  23. package/composables/useWebUsb.ts +11 -14
  24. package/package.json +1 -1
  25. package/plugins/secure-member.client.ts +2 -66
  26. package/types/facility.d.ts +0 -4
  27. package/types/people.d.ts +1 -4
  28. package/utils/materialSymbols.ts +0 -3
  29. package/utils/org-modules.ts +0 -26
  30. package/utils/role.ts +0 -18
  31. package/components/CameraPlateSyncDialog.vue +0 -626
  32. package/components/HidProfileQrCode.vue +0 -323
  33. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
  34. package/utils/anpr-direction.ts +0 -70
  35. package/utils/camera-plate-sync.ts +0 -141
  36. package/utils/module-routes.ts +0 -128
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9b38fcf: Checklist: the tick that finishes a set now always opens the photo dialog.
8
+ A set holding a rejected unit counts as finished once every unit is approved
9
+ or rejected (the server's rule), and roles without add-remarks get the dialog
10
+ too, without the remarks field, instead of an auto-approve the server refuses.
11
+ A server photo refusal on a single tick opens the dialog instead of an error.
12
+
3
13
  ## 4.9.0
4
14
 
5
15
  ### Minor Changes
@@ -1031,11 +1041,11 @@
1031
1041
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
1032
1042
  own rule from two endpoints the console already calls, unprojected:
1033
1043
 
1034
- GET /api/members/user/:user/app/admin the Seven365 staff membership
1035
- GET /api/roles/id/:role that membership's role document
1044
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
1045
+ GET /api/roles/id/:role that membership's role document
1036
1046
 
1037
- owner = member.type === "admin" && role.type === "admin" && role.default === true
1038
- staff = member.type === "admin" && role.type === "admin"
1047
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
1048
+ staff = member.type === "admin" && role.type === "admin"
1039
1049
 
1040
1050
  `role.default` is the marker because it is the only property of a platform
1041
1051
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -126,17 +126,6 @@
126
126
  density="comfortable"
127
127
  :rules="[requiredRule]"
128
128
  />
129
-
130
- <!-- Saving writes the site's vehicles to the camera, one plate at
131
- a time - say so, because it can take a while. -->
132
- <v-alert
133
- v-if="fillNotice"
134
- class="mb-4"
135
- variant="tonal"
136
- density="compact"
137
- type="info"
138
- :text="fillNotice"
139
- />
140
129
  </v-col>
141
130
 
142
131
  <!-- <v-col v-if="isANPR" cols="12">
@@ -216,135 +205,12 @@
216
205
  </v-col>
217
206
  </v-row>
218
207
  </v-card-actions>
219
-
220
- <!-- Changing a camera to Exit empties its allowed list and blocklist, and
221
- an Entry / Both / Residents camera changed to Visitors empties its
222
- allowed list - on the camera itself. Ask before saving; the API refuses
223
- the change without this confirmation. -->
224
- <v-dialog v-model="confirmClear" persistent width="540">
225
- <DialogReusablePrompt
226
- :prompt-title="clearPromptTitle"
227
- :message="clearPromptMessage"
228
- confirm-label="Yes, change and clear"
229
- confirm-button-color="red"
230
- :loading="disable"
231
- @close="confirmClear = false"
232
- @proceed="save({ confirmClearCameraLists: true })"
233
- />
234
- </v-dialog>
235
-
236
- <!-- A new Entry / Both / Residents / Visitors camera, or a type change
237
- that means the camera should now hold plates it did not (Visitors or
238
- Exit to Entry / Both / Residents, Exit to Visitors): ask first whether
239
- to add the site's vehicles to it now. "Not now" saves the camera
240
- only; its vehicles can be added later with Sync vehicles in the
241
- camera list. -->
242
- <v-dialog v-model="askAddVehicles" persistent width="540">
243
- <v-card class="screen-modal" width="100%" :disabled="disable" :loading="disable">
244
- <v-card-text class="screen-modal__body pa-5 my-5 px-7 text-center">
245
- <span class="screen-card-title d-block">
246
- Add this site's vehicles to the camera now?
247
- </span>
248
- <span class="d-block mt-5">{{ addVehiclesMessage }}</span>
249
- </v-card-text>
250
-
251
- <div class="screen-modal__footer">
252
- <v-btn
253
- class="screen-btn-ghost"
254
- variant="outlined"
255
- :disabled="disable"
256
- @click="askAddVehicles = false"
257
- >
258
- Cancel
259
- </v-btn>
260
- <v-btn
261
- class="text-none"
262
- variant="outlined"
263
- :loading="disable"
264
- @click="saveWithoutVehicles"
265
- >
266
- {{ prop.mode === "edit" ? "Not now, save changes only" : "Not now, add camera only" }}
267
- </v-btn>
268
- <v-btn
269
- class="text-none screen-btn-primary"
270
- variant="flat"
271
- :disabled="disable"
272
- @click="addVehiclesNow"
273
- >
274
- Yes, add vehicles
275
- </v-btn>
276
- </div>
277
- </v-card>
278
- </v-dialog>
279
-
280
- <!-- A new ANPR camera may already hold plates - old ones, or ones added on
281
- the camera's own page. Ask whether to clear them before the site's
282
- vehicles are added; keeping them is the safe default. -->
283
- <v-dialog v-model="askClearOnAdd" persistent width="540">
284
- <v-card class="screen-modal" width="100%" :disabled="disable" :loading="disable">
285
- <v-card-text class="screen-modal__body pa-5 my-5 px-7 text-center">
286
- <span class="screen-card-title d-block">
287
- Clear this camera's plate lists first?
288
- </span>
289
- <span class="d-block mt-5">{{ clearOnAddMessage }}</span>
290
- </v-card-text>
291
-
292
- <div class="screen-modal__footer">
293
- <v-btn
294
- class="screen-btn-ghost"
295
- variant="outlined"
296
- :disabled="disable"
297
- @click="askClearOnAdd = false"
298
- >
299
- Cancel
300
- </v-btn>
301
- <v-btn
302
- class="text-none"
303
- variant="outlined"
304
- :disabled="disable"
305
- @click="startSync(false)"
306
- >
307
- No, keep them
308
- </v-btn>
309
- <v-btn
310
- class="text-none"
311
- variant="flat"
312
- color="red"
313
- :disabled="disable"
314
- @click="startSync(true)"
315
- >
316
- Yes, clear all
317
- </v-btn>
318
- </div>
319
- </v-card>
320
- </v-dialog>
321
-
322
- <!-- Then the site's vehicles go on the camera one plate at a time, with
323
- each plate's progress shown. A new camera is saved by Done; an edited
324
- one has already been saved (with its new type) and is synced by id.
325
- Closed only by Done (or Cancel, once something has gone wrong) -
326
- never by a click outside it. -->
327
- <v-dialog v-model="syncOpen" persistent width="960" scrollable>
328
- <CameraPlateSyncDialog
329
- v-if="syncOpen && syncCamera"
330
- :site="prop.site"
331
- :camera="syncCamera"
332
- :camera-id="syncCameraId"
333
- :clear-lists="syncClear"
334
- @done="handleSyncDone"
335
- @cancel="handleSyncCancel"
336
- />
337
- </v-dialog>
338
208
  </v-card>
339
209
  </template>
340
210
 
341
211
  <script setup lang="ts">
342
212
  import useSiteSettings from "../composables/useSiteSettings";
343
213
  import { cameraErrorConverter } from "../utils/data";
344
- import {
345
- listsClearedByDirectionChange,
346
- listsFilledByDirectionChange,
347
- } from "../utils/anpr-direction";
348
214
 
349
215
  const prop = defineProps({
350
216
  title: {
@@ -591,308 +457,17 @@ const hasChanges = computed(() => {
591
457
  return true;
592
458
  });
593
459
 
594
- /* ---------------------- plate lists on a changed camera -------------------- */
595
-
596
- const confirmClear = ref(false);
597
-
598
- /** Which of the camera's plate lists this edit would empty, if any. */
599
- const listsToClear = computed(() =>
600
- prop.mode === "edit" && isANPR.value
601
- ? listsClearedByDirectionChange(
602
- prop.camera?.direction,
603
- camera.value.direction
604
- )
605
- : { allow: false, block: false }
606
- );
607
-
608
- function directionLabel(value?: string) {
609
- return (
610
- anprDirectionOptions.value.find((option) => option.value === value)
611
- ?.title ?? value ?? ""
612
- );
613
- }
614
-
615
- const clearPromptTitle = computed(
616
- () =>
617
- `Change this camera from ${directionLabel(
618
- prop.camera?.direction
619
- )} to ${directionLabel(camera.value.direction)}?`
620
- );
621
-
622
- const clearPromptMessage = computed(() =>
623
- listsToClear.value.block
624
- ? "Every plate on this camera's allowed list AND its blocklist will be " +
625
- "cleared from the camera, including plates added directly on it, " +
626
- "because Exit cameras must not hold any. Whitelist and season pass " +
627
- "vehicles will no longer be let in through this camera. Vehicle " +
628
- "records and the plates on your other cameras are not affected."
629
- : "Every plate on this camera's allowed list will be cleared from the " +
630
- "camera, including plates added directly on it, because Visitors " +
631
- "cameras must not hold whitelist or season pass plates. Those vehicles " +
632
- "will no longer be let in through this camera. Blocked plates stay on " +
633
- "it. Vehicle records and the plates on your other cameras are not " +
634
- "affected."
635
- );
636
-
637
- /** Which lists saving will FILL with the site's vehicles, if any. */
638
- /**
639
- * An inactive camera being switched back on. Every vehicle add, edit and
640
- * delete skips inactive cameras (they are the ones taken out of service), so
641
- * this one missed everything done while it was off - vehicles added then are
642
- * not on it, and vehicles deleted then are still on it. It is offered the
643
- * same sync as a new camera.
644
- */
645
- const isReactivating = computed(
646
- () =>
647
- prop.mode === "edit" &&
648
- prop.camera?.status === "inactive" &&
649
- camera.value.status !== "inactive"
650
- );
651
-
652
- const listsToFill = computed(() => {
653
- if (!isANPR.value || camera.value.status === "inactive") {
654
- return { allow: false, block: false };
655
- }
656
- return listsFilledByDirectionChange(
657
- prop.mode === "edit" && !isReactivating.value
658
- ? prop.camera?.direction
659
- : "",
660
- camera.value.direction
661
- );
662
- });
663
-
664
- /**
665
- * Everything a camera of the chosen type holds, for the questions below: an
666
- * edited camera is synced as a whole once its type is saved - the plates it
667
- * already has are kept (or cleared, if the person says so) and the rest added.
668
- */
669
- const plateSetWords = computed(() => {
670
- const { allow, block } = listsFilledByDirectionChange(
671
- "",
672
- camera.value.direction
673
- );
674
- return allow && block
675
- ? "every whitelist, season pass and blocked plate at this site"
676
- : allow
677
- ? "every whitelist and season pass plate at this site"
678
- : block
679
- ? "every blocked plate at this site"
680
- : "";
681
- });
682
-
683
- const fillNotice = computed(() => {
684
- // A new camera is asked about on Submit instead - see `askAddVehicles`.
685
- if (prop.mode !== "edit") return "";
686
-
687
- const { allow, block } = listsToFill.value;
688
- if (!allow && !block) return "";
689
-
690
- if (isReactivating.value) {
691
- return (
692
- `This camera was inactive, so vehicles added, changed or deleted in the ` +
693
- `meantime are not up to date on it. When you save, you will be asked ` +
694
- `whether to bring it up to date now or later.`
695
- );
696
- }
697
-
698
- return (
699
- `As ${directionLabel(camera.value.direction)}, this camera holds ` +
700
- `${plateSetWords.value}. When you save, you will be asked whether to ` +
701
- `add them to this camera now or later.`
702
- );
703
- });
704
-
705
- /* ------------------------- clearing a new camera -------------------------- */
706
-
707
- const askAddVehicles = ref(false);
708
- const askClearOnAdd = ref(false);
709
-
710
- /** What "Add vehicles now?" is asking about, for this camera's type. */
711
- const addVehiclesMessage = computed(
712
- () =>
713
- `Yes adds ${plateSetWords.value} to this camera now, one plate at a ` +
714
- `time, and you can watch each one go on. ` +
715
- (prop.mode === "edit"
716
- ? `Not now saves your changes only - `
717
- : `Not now adds the camera only - `) +
718
- `you can add them later with Sync vehicles in the camera list.`
719
- );
720
-
721
- /** Yes: carry on to "clear the camera's lists first?", then the sync. */
722
- function addVehiclesNow() {
723
- askAddVehicles.value = false;
724
- askClearOnAdd.value = true;
725
- }
726
-
727
- /** Not now: save the camera without touching the device. */
728
- async function saveWithoutVehicles() {
729
- if (prop.mode === "edit") {
730
- await save({ skipPlateSync: true });
731
- askAddVehicles.value = false;
732
- return;
733
- }
734
-
735
- disable.value = true;
736
- camera.value.guardPost = camera.value.guardPost ?? 0;
737
-
738
- try {
739
- const res = await addCamera({
740
- ...camera.value,
741
- ...addressPayload(),
742
- skipPlateSync: true,
743
- });
744
- emit(
745
- "success",
746
- `${res?.message ?? "ANPR camera added."} Its vehicles were not added ` +
747
- `yet - use Sync vehicles in the camera list to add them.`,
748
- { clearedLists: [] }
749
- );
750
- } catch (error: any) {
751
- emit("error", cameraErrorConverter(error, prop.type));
752
- } finally {
753
- disable.value = false;
754
- askAddVehicles.value = false;
755
- }
756
- }
757
-
758
- /* The plate-by-plate fill, and the save, happen in `CameraPlateSyncDialog`. */
759
- const syncOpen = ref(false);
760
- const syncClear = ref(false);
761
- const syncCamera = ref<Record<string, any> | null>(null);
762
- /** Set when syncing a camera that is already saved (an edited one). */
763
- const syncCameraId = ref("");
764
-
765
- /**
766
- * Open the plate-by-plate sync. A NEW camera is saved by the sync dialog's
767
- * Done. An EDITED camera is saved first - its new type, without filling it -
768
- * and then synced by its id, so the plates go on one at a time with the
769
- * person watching, exactly as for a new camera.
770
- */
771
- async function startSync(clear: boolean) {
772
- camera.value.guardPost = camera.value.guardPost ?? 0;
773
-
774
- if (prop.mode === "edit") {
775
- const saved = await save({ skipPlateSync: true, emitSuccess: false });
776
- if (!saved) return;
777
- syncCameraId.value = String(camera.value._id ?? "");
778
- } else {
779
- syncCameraId.value = "";
780
- }
781
-
782
- syncCamera.value = { ...camera.value, ...addressPayload() };
783
- syncClear.value = clear;
784
- askClearOnAdd.value = false;
785
- syncOpen.value = true;
786
- }
787
-
788
- function handleSyncDone(
789
- message: string,
790
- detail: { clearedLists?: string[]; addedPlates?: Record<string, number> }
791
- ) {
792
- syncOpen.value = false;
793
- emit(
794
- "success",
795
- prop.mode === "edit" ? `The camera was updated. ${message}` : message,
796
- detail
797
- );
798
- }
799
-
800
- /**
801
- * Cancel, offered only once something went wrong. A new camera was not
802
- * saved, so the form is simply back. An edited camera already carries its new
803
- * type, so say so and close.
804
- */
805
- function handleSyncCancel() {
806
- syncOpen.value = false;
807
- if (prop.mode !== "edit") return;
808
- emit(
809
- "success",
810
- `The camera was updated, but its vehicles were not all added - use ` +
811
- `Sync vehicles in the camera list to add them.`,
812
- { clearedLists: [] }
813
- );
814
- }
815
-
816
- /** A new, active ANPR camera: the device is written to, so ask first. */
817
- const isNewActiveAnpr = computed(
818
- () =>
819
- prop.mode !== "edit" &&
820
- isANPR.value &&
821
- camera.value.status !== "inactive"
822
- );
823
-
824
- const clearOnAddMessage = computed(() => {
825
- const what = plateSetWords.value;
826
-
827
- return (
828
- (isReactivating.value
829
- ? `This camera was inactive, so it may still hold plates of vehicles ` +
830
- `deleted or blocked in the meantime - Yes is recommended. `
831
- : "") +
832
- `Yes removes every plate already saved on this camera's allowed list and ` +
833
- `blocklist - old plates and plates added directly on the camera. No ` +
834
- `leaves them on the camera.` +
835
- (what
836
- ? ` Either way, ${what} is then added to it, one plate at a time, and ` +
837
- `you can watch each one go on.`
838
- : ` Exit cameras receive no vehicle plates.`)
839
- );
840
- });
841
-
842
- function submit() {
843
- if (listsToClear.value.allow || listsToClear.value.block) {
844
- confirmClear.value = true;
845
- return;
846
- }
847
-
848
- // A new camera that receives plates, or a type change that means the
849
- // camera should now hold plates it did not: ask whether to add them now.
850
- if (listsToFill.value.allow || listsToFill.value.block) {
851
- askAddVehicles.value = true;
852
- return;
853
- }
854
-
855
- // A new Exit camera receives none, so only the clear question applies.
856
- if (isNewActiveAnpr.value) {
857
- askClearOnAdd.value = true;
858
- return;
859
- }
860
-
861
- return save();
862
- }
863
-
864
- /**
865
- * Save the form. Returns whether it saved. `skipPlateSync` saves a type change
866
- * without filling the camera (the vehicles are added by the sync dialog, or
867
- * later); `emitSuccess: false` leaves the form open for that sync dialog.
868
- */
869
- async function save(
870
- options: {
871
- confirmClearCameraLists?: boolean;
872
- skipPlateSync?: boolean;
873
- emitSuccess?: boolean;
874
- } = {}
875
- ): Promise<boolean> {
876
- const emitSuccess = options.emitSuccess !== false;
460
+ async function submit() {
877
461
  disable.value = true;
878
462
  camera.value.guardPost = camera.value.guardPost ?? 0;
879
463
 
880
464
  try {
881
465
  if (prop.mode === "add") {
882
- const res = await addCamera({ ...camera.value, ...addressPayload() });
883
-
884
- // Says what was cleared and written on the new camera.
885
- if (res?.addedPlates || res?.clearedLists) {
886
- emit("success", res?.message ?? "", {
887
- clearedLists: res?.clearedLists ?? [],
888
- addedPlates: res?.addedPlates,
889
- });
890
- return true;
891
- }
466
+ await addCamera({ ...camera.value, ...addressPayload() });
892
467
  }
893
468
 
894
469
  if (prop.mode === "edit") {
895
- const res = await updateSiteCamera(camera.value._id ?? "", {
470
+ await updateSiteCamera(camera.value._id ?? "", {
896
471
  ...addressPayload(),
897
472
  username: camera.value.username,
898
473
  password: camera.value.password,
@@ -901,46 +476,14 @@ async function save(
901
476
  direction: camera.value.direction,
902
477
  status: camera.value.status,
903
478
  name: camera.value.name,
904
- ...(options.confirmClearCameraLists
905
- ? { confirmClearCameraLists: true }
906
- : {}),
907
- ...(options.skipPlateSync ? { skipPlateSync: true } : {}),
908
479
  });
909
-
910
- // The sync dialog carries on from here and reports when it is done.
911
- if (!emitSuccess) return true;
912
-
913
- // Not now: the type is saved, the vehicles are not on the camera yet.
914
- if (options.skipPlateSync) {
915
- emit(
916
- "success",
917
- `${res?.message ?? "Camera updated."} Its vehicles were not added ` +
918
- `yet - use Sync vehicles in the camera list to add them.`,
919
- { clearedLists: [] }
920
- );
921
- return true;
922
- }
923
-
924
- // Says which lists were cleared on the camera, or how many plates were
925
- // written to it, so the list can show it.
926
- if (options.confirmClearCameraLists || res?.addedPlates) {
927
- emit("success", res?.message ?? "", {
928
- clearedLists: res?.clearedLists ?? [],
929
- addedPlates: res?.addedPlates,
930
- });
931
- return true;
932
- }
933
480
  }
934
481
 
935
482
  emit("success", `${prop.title} added successfully!`);
936
- return true;
937
483
  } catch (error: any) {
938
484
  emit("error", cameraErrorConverter(error, prop.type));
939
- return false;
940
485
  } finally {
941
486
  disable.value = false;
942
- confirmClear.value = false;
943
- askClearOnAdd.value = false;
944
487
  }
945
488
  }
946
489
 
@@ -207,14 +207,6 @@
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
-
218
210
  <v-list-item @click="openDialogDelete()" class="text-red">
219
211
  <v-list-item-title class="text-subtitle-2">
220
212
  Delete
@@ -235,53 +227,6 @@
235
227
  style="z-index: 3000"
236
228
  />
237
229
 
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
-
285
230
  <v-dialog v-model="dialogDelete" persistent width="540">
286
231
  <v-card width="100%">
287
232
  <v-card-text
@@ -332,10 +277,6 @@
332
277
  import type { PropType } from "vue";
333
278
  import useSiteSettings from "../composables/useSiteSettings";
334
279
  import { cameraErrorConverter } from "../utils/data";
335
- import {
336
- isAllowCameraDirection,
337
- isBlockCameraDirection,
338
- } from "../utils/anpr-direction";
339
280
 
340
281
  const events = defineEmits(["update:value", "row-click"]);
341
282
 
@@ -542,17 +483,7 @@ function handleError(msg: string) {
542
483
  showMessage(msg, "error");
543
484
  }
544
485
 
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
-
486
+ function handleSuccess() {
556
487
  if (dialogAdd.value) dialogAdd.value = false;
557
488
 
558
489
  if (dialogEdit.value) dialogEdit.value = false;
@@ -594,54 +525,6 @@ function handleRowClick(_: any, data: any) {
594
525
  camera.value = JSON.parse(JSON.stringify(data.item));
595
526
  }
596
527
 
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
-
645
528
  async function submitDelete() {
646
529
  try {
647
530
  await deleteSiteCameraById(camera.value._id ?? "");