@7365admin1/layer-common 4.32.1-staging.365 → 4.33.0

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 (54) hide show
  1. package/CHANGELOG.md +10 -4
  2. package/components/AccessCardAddForm.vue +4 -5
  3. package/components/AccessCardAssignToUnitForm.vue +2 -3
  4. package/components/AccessCardPreviewDialog.vue +3 -4
  5. package/components/Dialog/DeleteConfirmation.vue +2 -17
  6. package/components/Dialog/ReusablePrompt.vue +3 -26
  7. package/components/Dialog/UpdateMoreAction.vue +1 -11
  8. package/components/DocumentForm.vue +112 -407
  9. package/components/DocumentManagement.vue +12 -213
  10. package/components/EntryPass/QrTemplatePreview.vue +25 -21
  11. package/components/EntryPassInformation.vue +24 -119
  12. package/components/Facility/BookingSetup.vue +0 -63
  13. package/components/HidAccessLogDashboard.vue +8 -41
  14. package/components/HidIntercomManagement.vue +14 -148
  15. package/components/HidReaderManagement.vue +0 -26
  16. package/components/HidReaderUserRoster.vue +3 -44
  17. package/components/HidUserEnrollment.vue +155 -845
  18. package/components/InvitationClientForm.vue +1 -19
  19. package/components/NotificationBell.vue +3 -39
  20. package/components/VehicleForm.vue +2 -45
  21. package/components/VehicleManagement.vue +10 -95
  22. package/components/VisitorManagement.vue +5 -267
  23. package/composables/useAccessManagement.ts +0 -5
  24. package/composables/useCleaningPermission.ts +4 -4
  25. package/composables/useCommonPermission.ts +0 -16
  26. package/composables/useDocument.ts +0 -7
  27. package/composables/useFacility.ts +0 -11
  28. package/composables/useHidAmico.ts +0 -117
  29. package/composables/useHidNavigation.ts +1 -25
  30. package/composables/useLandscapingPermission.ts +4 -4
  31. package/composables/useMechanicalElectricalPermission.ts +4 -4
  32. package/composables/usePeople.ts +0 -19
  33. package/composables/usePestControlPermission.ts +4 -4
  34. package/composables/usePoolMaintenancePermission.ts +4 -4
  35. package/composables/useSecurityPermission.ts +10 -4
  36. package/composables/useSiteEntryPassSettings.ts +0 -26
  37. package/composables/useWebUsb.ts +11 -14
  38. package/package.json +1 -1
  39. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  40. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  41. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  42. package/types/document.d.ts +0 -14
  43. package/types/facility.d.ts +0 -4
  44. package/types/people.d.ts +1 -28
  45. package/utils/vehicle-actions.ts +4 -12
  46. package/components/HidAccessPermissions.vue +0 -424
  47. package/components/HidProfileQrCode.vue +0 -332
  48. package/composables/useHidReaderSelection.ts +0 -50
  49. package/composables/useSiteCategory.ts +0 -45
  50. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
  51. package/utils/hid-permission-assignments.ts +0 -190
  52. package/utils/hid-reader-selection.ts +0 -52
  53. package/utils/notification-target.ts +0 -75
  54. package/utils/occupancy-role.ts +0 -109
@@ -376,7 +376,6 @@ const visitorRecords = ref<Record<string, HidAccessRecord>>({});
376
376
  const logs = ref<HidAccessRecord[]>([]);
377
377
  const liveAccessLogs = ref<HidAccessRecord[]>([]);
378
378
  const administratorUserIds = ref<Set<number>>(new Set());
379
- const { selectHidReader, resolveForSite } = useHidReaderSelection();
380
379
  const selectedReaderId = ref("");
381
380
  const activeTab = ref<AccessTab>("all");
382
381
  const search = ref("");
@@ -402,10 +401,7 @@ const exportForm = reactive({
402
401
  });
403
402
 
404
403
  const statusOptions = ["Authorized", "Not Authorized", "Unknown"];
405
- const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card", "Intercom"];
406
-
407
- /** The persisted event the resident app records when it opens a door on a call. */
408
- const INTERCOM_DOOR_OPEN_EVENT = "intercom_door_open";
404
+ const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card"];
409
405
  const accessMethodOptions = ["All", ...accessMethodFilterOptions];
410
406
 
411
407
  const readerOptions = computed(() =>
@@ -593,11 +589,9 @@ async function loadReaders() {
593
589
  if (!props.site) return;
594
590
  const response = await getReaders({ site: props.site, page: 1, limit: 100 });
595
591
  readers.value = response?.items ?? response?.data?.items ?? response?.data?.readers ?? [];
596
- /* Shared with every other HID screen — see `useHidReaderSelection`. The
597
- resolver refuses a remembered reader that is not this site's, so a site
598
- switch or a deleted reader falls back to the first rather than querying
599
- an id the site does not own. */
600
- selectedReaderId.value = resolveForSite(props.site, readers.value);
592
+ if (!selectedReaderId.value && readers.value.length) {
593
+ selectedReaderId.value = readers.value[0]._id;
594
+ }
601
595
  }
602
596
 
603
597
  async function loadDashboard() {
@@ -612,7 +606,7 @@ async function loadDashboard() {
612
606
  resetDashboardData();
613
607
  try {
614
608
  const isVisitorTab = activeTab.value === "visitor";
615
- const [logResponse, intercomLogResponse, hidAccessLogResponse, visitorResponse, readerUserResponse] = await Promise.all([
609
+ const [logResponse, hidAccessLogResponse, visitorResponse, readerUserResponse] = await Promise.all([
616
610
  loadDashboardSource(
617
611
  getLogs(selectedReaderId.value, {
618
612
  page: page.value,
@@ -621,20 +615,6 @@ async function loadDashboard() {
621
615
  null,
622
616
  "persisted access logs",
623
617
  ),
624
- // Door opens from the resident app during an intercom call. The reader
625
- // never logs a DTMF door open, so these exist only as persisted events
626
- // and are fetched by type: the general page above is shared with every
627
- // other event the reader emits and is dropped whenever the reader has
628
- // live logs, which it always has.
629
- loadDashboardSource(
630
- getLogs(selectedReaderId.value, {
631
- page: page.value,
632
- limit,
633
- type: INTERCOM_DOOR_OPEN_EVENT,
634
- }),
635
- null,
636
- "intercom door-open logs",
637
- ),
638
618
  loadDashboardSource(
639
619
  getReaderAccessLogs(selectedReaderId.value, {
640
620
  page: page.value,
@@ -701,14 +681,9 @@ async function loadDashboard() {
701
681
  // identity metadata here: it can contain a stale photo from another user.
702
682
  allIdentities.value = readerUsers;
703
683
  identities.value = readerUsers;
704
- const intercomItems = intercomLogResponse?.items ?? intercomLogResponse?.data?.items ?? intercomLogResponse?.data?.logs ?? [];
705
- logs.value = [
706
- ...(liveItems.length
707
- ? []
708
- : logResponse?.items ?? logResponse?.data?.items ?? logResponse?.data?.logs ?? []),
709
- // Always kept: the reader has no live counterpart for these.
710
- ...intercomItems,
711
- ];
684
+ logs.value = liveItems.length
685
+ ? []
686
+ : logResponse?.items ?? logResponse?.data?.items ?? logResponse?.data?.logs ?? [];
712
687
  liveAccessLogs.value = liveItems;
713
688
  serverPages.value = Number(hidAccessLogResponse?.pages ?? hidAccessLogResponse?.data?.pages ?? 1);
714
689
  serverPageRange.value = String(
@@ -844,8 +819,6 @@ function getAccessMethod(identity: HidAccessRecord, log?: HidAccessRecord) {
844
819
  id_password: "ID and Password",
845
820
  pin: "PIN",
846
821
  card: "Card",
847
- // Set by the API on intercom_door_open events; no reader field implies it.
848
- intercom: "Intercom",
849
822
  };
850
823
  const normalizedMethod = String(payload.normalizedMethod || "");
851
824
  if (normalizedMethodLabels[normalizedMethod]) return normalizedMethodLabels[normalizedMethod];
@@ -1575,12 +1548,6 @@ function escapeHtml(value: unknown) {
1575
1548
  .replace(/"/g, "&quot;")
1576
1549
  .replace(/'/g, "&#039;");
1577
1550
  }
1578
-
1579
- /* Publish every change, including the seed above: a screen that had to fall
1580
- back to the first reader should leave the others agreeing with it. */
1581
- watch(selectedReaderId, (value) => {
1582
- if (value) selectHidReader(props.site, value);
1583
- });
1584
1551
  </script>
1585
1552
 
1586
1553
  <style scoped>
@@ -162,8 +162,11 @@
162
162
  />
163
163
  <v-list-item class="screen-menu__item" title="Call Settings" prepend-icon="mdi-cog" @click="openCallDialog(item)" />
164
164
  <v-list-item class="screen-menu__item" title="Dial Code" prepend-icon="mdi-dialpad" @click="openDialCodeDialog(item)" />
165
+ <v-list-item class="screen-menu__item" title="Make a call" prepend-icon="mdi-phone" @click="openMakeCallDialog(item)" />
166
+ <v-list-item class="screen-menu__item" title="Web call" prepend-icon="mdi-headset" @click="openWebPhoneDialog(item)" />
165
167
  </v-list>
166
168
  <v-list v-else density="compact" class="screen-menu">
169
+ <v-list-item class="screen-menu__item" title="Call" prepend-icon="mdi-phone" @click="openContactCall(item)" />
167
170
  <v-list-item class="screen-menu__item" title="Check reader SIP status" prepend-icon="mdi-lan-check" @click="testContactSipStatus(item)" />
168
171
  <v-list-item class="screen-menu__item" title="View" prepend-icon="mdi-eye" @click="openContactView(item)" />
169
172
  <v-list-item class="screen-menu__item" title="Edit" prepend-icon="mdi-pencil" @click="openContactDialog(item)" />
@@ -586,31 +589,9 @@
586
589
  :disabled="Boolean(contactForm.id)"
587
590
  />
588
591
  <FieldLabel text="Name" required />
589
- <!-- The name is picked from the site's SIP accounts (`hid-sip-accounts`)
590
- rather than typed, so a contact always names a person who holds an
591
- extension. The model stays the plain name string the reader stores,
592
- so `saveContact` is unchanged; an existing contact whose name is not
593
- in the list still displays it (AppSelect falls back to the raw value). -->
594
- <AppSelect
595
- v-model="contactForm.name"
596
- :items="sipAccountOptions"
597
- :disabled="sipAccountsLoading"
598
- :placeholder="sipAccountsLoading ? 'Loading SIP accounts…' : 'Name shown on calls'"
599
- class="my-3"
600
- @update:model-value="applySipAccountToContact"
601
- />
602
- <p v-if="sipAccountsError" class="field-hint field-hint--error">{{ sipAccountsError }}</p>
603
- <p v-else-if="!sipAccountsLoading && !sipAccounts.length" class="field-hint">
604
- No SIP accounts on this site yet. An account is created the first time a user opens Web Call.
605
- </p>
592
+ <AppField v-model="contactForm.name" placeholder="Name shown on calls" class="my-3" />
606
593
  <FieldLabel text="Address" required />
607
- <!-- Always read-only: it shows the extension of the chosen SIP account
608
- and is never typed into. -->
609
- <AppField
610
- v-model="contactForm.serverAddress"
611
- :placeholder="contactAddressPlaceholder"
612
- disabled
613
- />
594
+ <AppField v-model="contactForm.serverAddress" :placeholder="contactAddressPlaceholder" />
614
595
  <p class="field-hint">{{ contactAddressHint }}</p>
615
596
  </v-card-text>
616
597
  <v-card-actions class="dialog-actions pa-0">
@@ -655,8 +636,6 @@
655
636
  </template>
656
637
 
657
638
  <script setup lang="ts">
658
- import type { HidSipAccountListItem } from "../composables/useHidAmico";
659
-
660
639
  const props = defineProps({
661
640
  org: {
662
641
  type: String,
@@ -753,8 +732,6 @@ const {
753
732
  makeIntercomCall,
754
733
  finalizeIntercomCall,
755
734
  ensureSipAccount,
756
- getSipAccounts,
757
- notifyIntercomCall,
758
735
  } = useHidAmico();
759
736
 
760
737
  const activeTab = ref<IntercomTab>("intercom");
@@ -783,11 +760,6 @@ const webPhoneActionLoading = ref(false);
783
760
  const sipAccount = ref<SipAccount | null>(null);
784
761
  const sipAccountLoading = ref(false);
785
762
  const sipAccountError = ref("");
786
- // The site's SIP account list for the contact dialog's name picker. Distinct
787
- // from `sipAccount` above, which is the CALLER's own account for the web phone.
788
- const sipAccounts = ref<HidSipAccountListItem[]>([]);
789
- const sipAccountsLoading = ref(false);
790
- const sipAccountsError = ref("");
791
763
  const remoteVideoEl = ref<HTMLVideoElement | null>(null);
792
764
  const remoteAudioEl = ref<HTMLAudioElement | null>(null);
793
765
  const webPhone = useSipWebPhone();
@@ -892,31 +864,6 @@ const readerOptions = computed(() => readers.value.map((reader) => ({
892
864
  value: reader._id,
893
865
  })));
894
866
 
895
- /**
896
- * The contact name picker. `value` is the bare name because that is what the
897
- * reader stores and what `saveContact` sends; the extension goes into the
898
- * Address field, not the label. A name that already sits on the contact being
899
- * edited but is no longer in the SIP list is kept as an option so the picker
900
- * does not silently drop it.
901
- */
902
- const sipAccountOptions = computed(() => {
903
- const options: Array<{ title: string; value: string }> = sipAccounts.value
904
- .filter((account: HidSipAccountListItem) => account.name)
905
- .map((account: HidSipAccountListItem) => ({ title: account.name, value: account.name }));
906
- const current = contactForm.name.trim();
907
- if (current && !options.some((option) => option.value === current)) {
908
- options.unshift({ title: current, value: current });
909
- }
910
- return options;
911
- });
912
-
913
- /** The SIP account behind the picked name, or null for a legacy / unpicked name. */
914
- const selectedSipAccount = computed(() => {
915
- const name = contactForm.name.trim();
916
- const match = sipAccounts.value.find((account: HidSipAccountListItem) => account.name === name);
917
- return (match ?? null) as HidSipAccountListItem | null;
918
- });
919
-
920
867
  const visibleRows = computed(() => activeTab.value === "intercom" ? filteredIntercomRows.value : filteredContacts.value);
921
868
  const pages = computed(() => Math.max(1, Math.ceil(visibleRows.value.length / limit)));
922
869
  const pageRange = computed(() => {
@@ -1029,11 +976,14 @@ const contactReaderRow = computed(() =>
1029
976
  );
1030
977
  const isContactReaderPeerToPeer = computed(() => contactReaderRow.value?.operatingMode === "Peer-to-Peer");
1031
978
  const contactAddressPlaceholder = computed(() => (isContactReaderPeerToPeer.value ? "192.168.0.129" : "7100"));
1032
- const contactAddressHint = computed(() => (
1033
- selectedSipAccount.value
1034
- ? "Extension of the selected SIP account."
1035
- : "Filled from the SIP account of the name selected above."
1036
- ));
979
+ const contactAddressHint = computed(() => {
980
+ if (!contactReaderRow.value) {
981
+ return "Extension number (SIP Client) or local IP address (Peer-to-Peer), depending on the reader's operating mode.";
982
+ }
983
+ return isContactReaderPeerToPeer.value
984
+ ? "Peer-to-Peer mode: enter the contact's local IP address."
985
+ : "SIP Client mode: enter the contact's extension number.";
986
+ });
1037
987
  const areSipCredentialFieldsDisabled = computed(() => !sipForm.enabled || isPeerToPeerMode.value);
1038
988
  const intercomDetailSections = computed(() => {
1039
989
  const row = selectedRow.value;
@@ -1449,37 +1399,6 @@ async function loadSipAccount() {
1449
1399
  }
1450
1400
  }
1451
1401
 
1452
- async function loadSipAccounts() {
1453
- if (!props.org || !props.site) return;
1454
-
1455
- sipAccountsLoading.value = true;
1456
- sipAccountsError.value = "";
1457
- try {
1458
- const response = await getSipAccounts(props.site, props.org);
1459
- const rows = toRecord(response).data;
1460
- sipAccounts.value = Array.isArray(rows) ? rows as HidSipAccountListItem[] : [];
1461
- // An existing contact opened before the list arrived: once its name is
1462
- // matched to an account, show that account's extension in the locked field.
1463
- applySipAccountToContact(contactForm.name.trim());
1464
- } catch (error: unknown) {
1465
- sipAccounts.value = [];
1466
- sipAccountsError.value = getErrorMessage(error);
1467
- } finally {
1468
- sipAccountsLoading.value = false;
1469
- }
1470
- }
1471
-
1472
- /**
1473
- * Picking a SIP account sets the address to its extension. The Address field
1474
- * is always disabled, so this is the only way it gets a value; a name that is
1475
- * not an account (a legacy contact) leaves whatever address it already had.
1476
- */
1477
- function applySipAccountToContact(name: string) {
1478
- const account = sipAccounts.value.find((item: HidSipAccountListItem) => item.name === name);
1479
- if (!account) return;
1480
- contactForm.serverAddress = account.extension;
1481
- }
1482
-
1483
1402
  async function connectWebPhone() {
1484
1403
  const account = sipAccount.value;
1485
1404
  if (!account) {
@@ -1523,10 +1442,8 @@ async function disconnectWebPhone() {
1523
1442
 
1524
1443
  async function startWebCall() {
1525
1444
  webPhoneActionLoading.value = true;
1526
- const destination = webPhoneForm.destination;
1527
1445
  try {
1528
- await webPhone.call(destination);
1529
- void ringResidentPhone(destination);
1446
+ await webPhone.call(webPhoneForm.destination);
1530
1447
  } catch (error: unknown) {
1531
1448
  showMessage(getErrorMessage(error), "error");
1532
1449
  } finally {
@@ -1534,50 +1451,6 @@ async function startWebCall() {
1534
1451
  }
1535
1452
  }
1536
1453
 
1537
- /**
1538
- * Wake the called resident's mobile so they are there to answer.
1539
- *
1540
- * Deliberately fired AFTER the INVITE and never awaited. The SIP leg is the
1541
- * call: it is already ringing by the time this runs, and a resident whose
1542
- * phone is asleep is the only thing this fixes. So a failure here is logged
1543
- * and dropped rather than shown — telling the operator "call failed" for a
1544
- * call that is ringing would be worse than a silent miss.
1545
- *
1546
- * A destination with no resident behind it (a staff extension, an external SIP
1547
- * address) comes back `notified: false` with a reason and is not an error.
1548
- */
1549
- async function ringResidentPhone(destination: string) {
1550
- if (!props.org || !props.site) return;
1551
-
1552
- try {
1553
- // No `readerId`: this call came from the web phone, not a door station.
1554
- // The reader selected in the table above is whatever the operator happens
1555
- // to be looking at, and sending it would tell the resident's app the call
1556
- // arrived at a door it never touched.
1557
- await notifyIntercomCall(props.site, {
1558
- orgId: props.org,
1559
- destination,
1560
- callId: createCallId(),
1561
- });
1562
- } catch (error: unknown) {
1563
- console.warn("[intercom] could not send the incoming-call push", error);
1564
- }
1565
- }
1566
-
1567
- /**
1568
- * A per-call id, so a second push for the same call replaces the first on the
1569
- * resident's lock screen rather than stacking a second ringing card.
1570
- * `randomUUID` needs a secure context, which the web phone already requires —
1571
- * getUserMedia does not run without one — but the fallback keeps a call from
1572
- * failing on that account alone.
1573
- */
1574
- function createCallId() {
1575
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
1576
- return crypto.randomUUID();
1577
- }
1578
- return `call-${Date.now()}-${Math.random().toString(16).slice(2)}`;
1579
- }
1580
-
1581
1454
  async function answerWebCall() {
1582
1455
  webPhoneActionLoading.value = true;
1583
1456
  try {
@@ -1635,9 +1508,6 @@ function openContactDialog(contact?: ContactRow) {
1635
1508
  contactForm.location = contact?.location === "N/A" ? "" : contact?.location || selectedReader?.location || "";
1636
1509
  contactForm.serverAddress = contact?.serverAddress === "N/A" ? "" : contact?.serverAddress || "";
1637
1510
  contactDialog.value = true;
1638
- // Fetched on every open, not cached: an account is provisioned the first
1639
- // time a user opens Web Call, so the list can grow between two dialogs.
1640
- void loadSipAccounts();
1641
1511
  }
1642
1512
 
1643
1513
  function openContactView(contact: ContactRow) {
@@ -2226,10 +2096,6 @@ export default {
2226
2096
  line-height: 1.4;
2227
2097
  }
2228
2098
 
2229
- .field-hint--error {
2230
- color: var(--err);
2231
- }
2232
-
2233
2099
  .sip-settings-dialog .field-label {
2234
2100
  margin-top: 14px;
2235
2101
  }
@@ -87,7 +87,6 @@
87
87
 
88
88
  <v-list density="compact" min-width="180">
89
89
  <v-list-item title="View" @click="openView(item)" />
90
- <v-list-item title="Access Permissions" @click="openPermissions(item)" />
91
90
  <v-list-item title="Sync HID Reader" @click="openSyncConfirm(item)" />
92
91
  <v-list-item title="Test Connection" @click="openTestConfirm(item)" />
93
92
  <v-list-item title="Edit" @click="openEdit(item)" />
@@ -242,18 +241,6 @@
242
241
  </v-card-actions>
243
242
  </v-card>
244
243
  </v-dialog>
245
-
246
- <!-- Who may actually pass this reader. Enrolment makes a person
247
- RECOGNISABLE; this is what puts them in the group the access rule is
248
- attached to, and without it a recognised person is refused at the
249
- door. Reloads the list on save so the reader's own counts stay true. -->
250
- <HidAccessPermissions
251
- v-model="permissionsDialog"
252
- :site="props.site"
253
- :org="props.org"
254
- :reader="selectedReader"
255
- @saved="loadReaders"
256
- />
257
244
  </section>
258
245
  </template>
259
246
 
@@ -335,13 +322,6 @@ const props = defineProps({
335
322
  type: String,
336
323
  required: true,
337
324
  },
338
- // The permission endpoints are org-scoped (`assertOrganizationSiteAccess`),
339
- // and this component previously had no reason to know the org. Passed from
340
- // the page, as `HidQrCodeConfiguration` already does.
341
- org: {
342
- type: String,
343
- required: true,
344
- },
345
325
  });
346
326
 
347
327
  const {
@@ -367,7 +347,6 @@ const viewDialog = ref(false);
367
347
  const confirmDialog = ref(false);
368
348
  const resultDialog = ref(false);
369
349
  const selectedReader = ref<HidRecord | null>(null);
370
- const permissionsDialog = ref(false);
371
350
  const pendingAction = ref<"test" | "sync" | "delete" | null>(null);
372
351
  const actionStage = ref<"confirm" | "review" | "loading">("confirm");
373
352
  const resultSuccess = ref(true);
@@ -505,11 +484,6 @@ function openView(reader: HidRecord) {
505
484
  viewDialog.value = true;
506
485
  }
507
486
 
508
- function openPermissions(reader: HidRecord) {
509
- selectedReader.value = reader;
510
- permissionsDialog.value = true;
511
- }
512
-
513
487
  function openTestConfirm(reader?: HidRecord | null) {
514
488
  if (reader) selectedReader.value = reader;
515
489
  pendingAction.value = "test";
@@ -27,7 +27,7 @@
27
27
  v-model="search"
28
28
  search
29
29
  placeholder="Search Amico user, UID or registration"
30
- @keyup.enter="onSearchSubmit"
30
+ @keyup.enter="reloadFromFirstPage"
31
31
  />
32
32
  <AppSelect
33
33
  v-model="userType"
@@ -208,7 +208,6 @@ const {
208
208
  } = useHidAmico();
209
209
  const readers = ref<HidReader[]>([]);
210
210
  const users = ref<HidReaderUser[]>([]);
211
- const { selectHidReader, resolveForSite } = useHidReaderSelection();
212
211
  const selectedReaderId = ref("");
213
212
  const search = ref("");
214
213
  const userType = ref<"all" | "user" | "visitor">("all");
@@ -271,11 +270,7 @@ async function loadReaders() {
271
270
  readers.value = (Array.isArray(items) ? items : [])
272
271
  .map(toReader)
273
272
  .filter((reader): reader is HidReader => reader !== null);
274
- /* Shared with every other HID screen — see `useHidReaderSelection`. The
275
- resolver refuses a remembered reader that is not this site's, so a site
276
- switch or a deleted reader falls back to the first rather than querying
277
- an id the site does not own. */
278
- selectedReaderId.value = resolveForSite(props.site, readers.value);
273
+ if (!selectedReaderId.value && readers.value.length) selectedReaderId.value = readers.value[0]._id;
279
274
  } catch (error: unknown) {
280
275
  readers.value = [];
281
276
  showToast(getErrorMessage(error), "error");
@@ -289,8 +284,6 @@ async function loadUsers() {
289
284
  return;
290
285
  }
291
286
 
292
- const sequence = loadUsersSequence.value + 1;
293
- loadUsersSequence.value = sequence;
294
287
  loading.value = true;
295
288
  try {
296
289
  let clientFiltersUserType = false;
@@ -326,7 +319,6 @@ async function loadUsers() {
326
319
  const pageItems = clientFiltersUserType
327
320
  ? matchingItems.slice(pageStart, pageStart + 10)
328
321
  : matchingItems;
329
- if (sequence !== loadUsersSequence.value) return;
330
322
  users.value = pageItems.map(toReaderUser);
331
323
  total.value = clientFiltersUserType
332
324
  ? matchingItems.length
@@ -338,15 +330,13 @@ async function loadUsers() {
338
330
  ? ""
339
331
  : toText(response.pageRange ?? data.pageRange);
340
332
  } catch (error: unknown) {
341
- if (sequence !== loadUsersSequence.value) return;
342
333
  users.value = [];
343
334
  total.value = 0;
344
335
  pages.value = 1;
345
336
  serverPageRange.value = "";
346
337
  showToast(getErrorMessage(error), "error");
347
338
  } finally {
348
- // Only the newest load owns the spinner.
349
- if (sequence === loadUsersSequence.value) loading.value = false;
339
+ loading.value = false;
350
340
  }
351
341
  }
352
342
 
@@ -360,31 +350,6 @@ function reloadFromFirstPage() {
360
350
  loadUsers();
361
351
  }
362
352
 
363
- /**
364
- * Typing is the search. It used to reload on `@keyup.enter` and on nothing
365
- * else, so unless you guessed Enter was required the screen sent no request at
366
- * all. Debounced, because each reload is a login/load/logout round trip to a
367
- * reader over a VPN; Enter still works and skips the wait.
368
- */
369
- const SEARCH_DEBOUNCE_MS = 400;
370
- let searchDebounce: ReturnType<typeof setTimeout> | undefined;
371
-
372
- function onSearchInput() {
373
- clearTimeout(searchDebounce);
374
- searchDebounce = setTimeout(reloadFromFirstPage, SEARCH_DEBOUNCE_MS);
375
- }
376
-
377
- function onSearchSubmit() {
378
- clearTimeout(searchDebounce);
379
- reloadFromFirstPage();
380
- }
381
-
382
- watch(search, onSearchInput);
383
- onBeforeUnmount(() => clearTimeout(searchDebounce));
384
-
385
- /** Discards a load whose answer arrives after a newer one started. */
386
- const loadUsersSequence = ref(0);
387
-
388
353
  function hasFacialData(user: HidReaderUser) {
389
354
  return user.metadata?.facialEnrolled === true || Boolean(toText(user.metadata?.facialData));
390
355
  }
@@ -546,12 +511,6 @@ function toNumber(value: unknown, fallback: number) {
546
511
  const number = Number(value);
547
512
  return Number.isFinite(number) ? number : fallback;
548
513
  }
549
-
550
- /* Publish every change, including the seed above: a screen that had to fall
551
- back to the first reader should leave the others agreeing with it. */
552
- watch(selectedReaderId, (value) => {
553
- if (value) selectHidReader(props.site, value);
554
- });
555
514
  </script>
556
515
 
557
516
  <style scoped>