@7365admin1/layer-common 4.5.1-staging.301 → 4.6.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 (36) hide show
  1. package/CHANGELOG.md +4 -56
  2. package/components/AreaChecklistHistoryLogs.vue +0 -81
  3. package/components/Chat/Bubbles.vue +30 -94
  4. package/components/Chat/Message.vue +67 -281
  5. package/components/Facility/BookingSetup.vue +0 -63
  6. package/components/FeedbackDetail.vue +1 -1
  7. package/components/HidIntercomManagement.vue +42 -145
  8. package/components/HidReaderUserRoster.vue +2 -32
  9. package/components/HidUserEnrollment.vue +212 -771
  10. package/components/InvitationClientForm.vue +1 -19
  11. package/components/ManageChecklistMain.vue +2 -34
  12. package/components/SwitchContext.vue +2 -46
  13. package/components/VisitorManagement.vue +5 -267
  14. package/components/WorkOrder/Detail.vue +1 -1
  15. package/composables/useCleaningPermission.ts +0 -5
  16. package/composables/useComment.ts +1 -9
  17. package/composables/useFacility.ts +0 -11
  18. package/composables/useHidAmico.ts +0 -73
  19. package/composables/useHidNavigation.ts +1 -25
  20. package/composables/useLandscapingPermission.ts +0 -5
  21. package/composables/useMechanicalElectricalPermission.ts +0 -6
  22. package/composables/usePeople.ts +0 -19
  23. package/composables/usePestControlPermission.ts +0 -5
  24. package/composables/usePoolMaintenancePermission.ts +0 -5
  25. package/composables/usePropertyPermission.ts +0 -5
  26. package/composables/useSecurityPermission.ts +0 -5
  27. package/package.json +1 -1
  28. package/types/cleaner-schedule.d.ts +0 -2
  29. package/types/comment.d.ts +0 -2
  30. package/types/facility.d.ts +0 -4
  31. package/types/people.d.ts +1 -4
  32. package/utils/materialSymbols.ts +0 -3
  33. package/components/HidProfileQrCode.vue +0 -323
  34. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
  35. package/utils/chat-sender.ts +0 -47
  36. package/utils/module-applications.ts +0 -146
@@ -132,18 +132,15 @@
132
132
  </template>
133
133
 
134
134
  <template #[`item.contactStatus`]="{ item }">
135
- <span class="contact-status-cell">
136
- <StatusChip :status="getContactReaderStatus(item)" />
137
- <v-btn
138
- icon="mdi-refresh"
139
- size="x-small"
140
- variant="text"
141
- class="contact-status-refresh"
142
- aria-label="Check reader SIP status"
143
- :loading="testingContactReaderId === item.readerId"
144
- @click="testContactSipStatus(item)"
145
- />
146
- </span>
135
+ <v-btn
136
+ size="small"
137
+ variant="outlined"
138
+ class="text-none"
139
+ :loading="testingContactReaderId === item.readerId"
140
+ @click="testContactSipStatus(item)"
141
+ >
142
+ {{ getContactReaderStatus(item) }}
143
+ </v-btn>
147
144
  </template>
148
145
 
149
146
  <template #[`item.action-table`]="{ item }">
@@ -151,26 +148,24 @@
151
148
  <template #activator="{ props: menuProps }">
152
149
  <AppButton v-bind="menuProps" variant="row" icon="mdi-dots-vertical" />
153
150
  </template>
154
- <v-list v-if="activeTab === 'intercom'" density="compact" class="screen-menu">
155
- <v-list-item class="screen-menu__item" title="View" prepend-icon="mdi-eye" @click="openViewDialog(item)" />
151
+ <v-list v-if="activeTab === 'intercom'" density="compact" class="row-menu">
152
+ <v-list-item title="View" @click="openViewDialog(item)" />
156
153
  <v-list-item
157
- class="screen-menu__item"
158
154
  title="Test Connection with SIP"
159
- prepend-icon="mdi-lan-check"
160
155
  :disabled="testingSipReaderId === item.reader._id"
161
156
  @click="testSipConnection(item)"
162
157
  />
163
- <v-list-item class="screen-menu__item" title="Call Settings" prepend-icon="mdi-cog" @click="openCallDialog(item)" />
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)" />
158
+ <v-list-item title="Call Settings" @click="openCallDialog(item)" />
159
+ <v-list-item title="Dial Code" @click="openDialCodeDialog(item)" />
160
+ <v-list-item title="Make a call" @click="openMakeCallDialog(item)" />
161
+ <v-list-item title="Web call" @click="openWebPhoneDialog(item)" />
167
162
  </v-list>
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)" />
170
- <v-list-item class="screen-menu__item" title="Check reader SIP status" prepend-icon="mdi-lan-check" @click="testContactSipStatus(item)" />
171
- <v-list-item class="screen-menu__item" title="View" prepend-icon="mdi-eye" @click="openContactView(item)" />
172
- <v-list-item class="screen-menu__item" title="Edit" prepend-icon="mdi-pencil" @click="openContactDialog(item)" />
173
- <v-list-item class="screen-menu__item screen-menu__item--danger" title="Delete" prepend-icon="mdi-delete-outline" @click="openDeleteContact(item)" />
163
+ <v-list v-else density="compact" class="row-menu">
164
+ <v-list-item title="Call" prepend-icon="mdi-phone" @click="openContactCall(item)" />
165
+ <v-list-item title="Check reader SIP status" prepend-icon="mdi-lan-check" @click="testContactSipStatus(item)" />
166
+ <v-list-item title="View" @click="openContactView(item)" />
167
+ <v-list-item title="Edit" @click="openContactDialog(item)" />
168
+ <v-list-item title="Delete" @click="openDeleteContact(item)" />
174
169
  </v-list>
175
170
  </v-menu>
176
171
  </template>
@@ -579,7 +574,7 @@
579
574
  </v-dialog>
580
575
 
581
576
  <v-dialog v-model="contactDialog" max-width="360" persistent>
582
- <v-card class="form-dialog contact-dialog" rounded="lg">
577
+ <v-card class="form-dialog" rounded="lg">
583
578
  <v-card-title class="dialog-title">{{ contactForm.id ? 'Edit Contact' : 'Add Contact' }}</v-card-title>
584
579
  <v-card-text class="dialog-body">
585
580
  <FieldLabel text="HID Reader" required />
@@ -589,10 +584,9 @@
589
584
  :disabled="Boolean(contactForm.id)"
590
585
  />
591
586
  <FieldLabel text="Name" required />
592
- <AppField v-model="contactForm.name" placeholder="Name shown on calls" class="my-3" />
593
- <FieldLabel text="Address" required />
594
- <AppField v-model="contactForm.serverAddress" :placeholder="contactAddressPlaceholder" />
595
- <p class="field-hint">{{ contactAddressHint }}</p>
587
+ <AppField v-model="contactForm.name" placeholder="Enter name" />
588
+ <FieldLabel text="SIP Number / Address" required />
589
+ <AppField v-model="contactForm.serverAddress" placeholder="7100 or user@example.com" />
596
590
  </v-card-text>
597
591
  <v-card-actions class="dialog-actions pa-0">
598
592
  <v-btn class="text-none action-cancel" variant="flat" height="44" @click="contactDialog = false">Cancel</v-btn>
@@ -964,26 +958,6 @@ const webPhoneButtonClass = computed(() => ({
964
958
  "has-incoming-call": webPhone.callState.value === "incoming",
965
959
  }));
966
960
  const isPeerToPeerMode = computed(() => sipForm.operatingMode === "peer-to-peer");
967
-
968
- /**
969
- * The user guide (6.3 Intercom contacts) gives a contact ONE address field
970
- * whose meaning follows the reader's operating mode: an extension number in
971
- * SIP Client mode, a local IP address in Peer-to-Peer mode. The reader chosen
972
- * in the contact dialog decides which one the field asks for.
973
- */
974
- const contactReaderRow = computed(() =>
975
- intercomRows.value.find((row) => row.reader._id === contactForm.readerId)
976
- );
977
- const isContactReaderPeerToPeer = computed(() => contactReaderRow.value?.operatingMode === "Peer-to-Peer");
978
- const contactAddressPlaceholder = computed(() => (isContactReaderPeerToPeer.value ? "192.168.0.129" : "7100"));
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
- });
987
961
  const areSipCredentialFieldsDisabled = computed(() => !sipForm.enabled || isPeerToPeerMode.value);
988
962
  const intercomDetailSections = computed(() => {
989
963
  const row = selectedRow.value;
@@ -1492,14 +1466,7 @@ function toggleWebMute() {
1492
1466
  }
1493
1467
  }
1494
1468
 
1495
- function hasReaderContactId(contact: ContactRow) {
1496
- if (contact.id !== undefined) return true;
1497
- showMessage("This contact has no identifier on the HID reader. Refresh the list and try again.", "error");
1498
- return false;
1499
- }
1500
-
1501
1469
  function openContactDialog(contact?: ContactRow) {
1502
- if (contact && !hasReaderContactId(contact)) return;
1503
1470
  selectedContact.value = contact || null;
1504
1471
  contactForm.id = contact?.id;
1505
1472
  contactForm.readerId = contact?.readerId || selectedReaderId.value || readers.value[0]?._id || "";
@@ -1549,20 +1516,10 @@ function openContactCall(contact: ContactRow) {
1549
1516
  }
1550
1517
 
1551
1518
  function openDeleteContact(contact: ContactRow) {
1552
- if (!hasReaderContactId(contact)) return;
1553
1519
  selectedContact.value = contact;
1554
1520
  deleteContactDialog.value = true;
1555
1521
  }
1556
1522
 
1557
- /**
1558
- * modify_objects and destroy_objects answer { changes: n } (API guide, Modify
1559
- * Objects / Delete Objects). Zero means the where clause matched nothing on the
1560
- * reader - typically a contact already removed from the touchscreen.
1561
- */
1562
- function readChanges(response: unknown) {
1563
- return toNumber(toRecord(toRecord(response).data ?? response).changes, Number.NaN);
1564
- }
1565
-
1566
1523
  async function saveSipSettings() {
1567
1524
  if (!selectedRow.value) return;
1568
1525
  const isPeerToPeer = sipForm.operatingMode === "peer-to-peer";
@@ -1663,17 +1620,6 @@ function isSipCallTarget(value = "") {
1663
1620
  return /^(?:sip:)?[A-Za-z0-9_.+-]+(?:@[A-Za-z0-9.-]+(?::\d{1,5})?)?$/.test(value.trim());
1664
1621
  }
1665
1622
 
1666
- function isIpv4Address(value = "") {
1667
- const [host, port, ...rest] = value.trim().split(":");
1668
- if (rest.length || (port !== undefined && !/^\d{1,5}$/.test(port))) return false;
1669
- const octets = host.split(".");
1670
- return octets.length === 4 && octets.every((octet) => /^\d{1,3}$/.test(octet) && Number(octet) <= 255);
1671
- }
1672
-
1673
- function isContactAddress(value: string, peerToPeer: boolean) {
1674
- return peerToPeer ? isIpv4Address(value) : isSipCallTarget(value);
1675
- }
1676
-
1677
1623
  async function runHangupCall() {
1678
1624
  if (!selectedRow.value) return;
1679
1625
  hangingUp.value = true;
@@ -1762,20 +1708,15 @@ async function saveContact() {
1762
1708
  return;
1763
1709
  }
1764
1710
 
1765
- if (!isContactAddress(contactForm.serverAddress, isContactReaderPeerToPeer.value)) {
1766
- showMessage(
1767
- isContactReaderPeerToPeer.value
1768
- ? "Enter the contact's local IPv4 address for a Peer-to-Peer reader."
1769
- : "Enter a valid extension number or SIP address.",
1770
- "warning",
1771
- );
1711
+ if (!isSipCallTarget(contactForm.serverAddress)) {
1712
+ showMessage("Enter a valid extension, SIP address, or IPv4 address.", "warning");
1772
1713
  return;
1773
1714
  }
1774
1715
 
1775
1716
  contactsSaving.value = true;
1776
1717
  try {
1777
- if (contactForm.id !== undefined) {
1778
- const response = await runObjectOperation(contactForm.readerId, {
1718
+ if (contactForm.id) {
1719
+ await runObjectOperation(contactForm.readerId, {
1779
1720
  operation: "modify",
1780
1721
  object: "contacts",
1781
1722
  values: {
@@ -1784,14 +1725,8 @@ async function saveContact() {
1784
1725
  },
1785
1726
  where: { contacts: { id: contactForm.id } },
1786
1727
  });
1787
- if (readChanges(response) === 0) {
1788
- contactDialog.value = false;
1789
- await loadContacts();
1790
- showMessage("The HID reader no longer has this contact. The list has been refreshed.", "warning");
1791
- return;
1792
- }
1793
1728
  } else {
1794
- const response = await runObjectOperation(contactForm.readerId, {
1729
+ await runObjectOperation(contactForm.readerId, {
1795
1730
  operation: "create",
1796
1731
  object: "contacts",
1797
1732
  values: [{
@@ -1799,15 +1734,6 @@ async function saveContact() {
1799
1734
  number: contactForm.serverAddress.trim(),
1800
1735
  }],
1801
1736
  });
1802
- // create_objects answers { ids: [...] } with the id of each created
1803
- // object. No id means the reader accepted the request but created nothing.
1804
- const created = toRecord(response?.data ?? response).ids;
1805
- if (!Array.isArray(created) || created.length === 0) {
1806
- contactDialog.value = false;
1807
- await loadContacts();
1808
- showMessage("The HID reader did not confirm the new contact. Check the contact list.", "warning");
1809
- return;
1810
- }
1811
1737
  }
1812
1738
  contactDialog.value = false;
1813
1739
  await loadContacts();
@@ -1820,21 +1746,16 @@ async function saveContact() {
1820
1746
  }
1821
1747
 
1822
1748
  async function deleteContact() {
1823
- const contact = selectedContact.value;
1824
- if (!contact || !hasReaderContactId(contact)) return;
1749
+ if (!selectedContact.value?.id) return;
1825
1750
  contactsSaving.value = true;
1826
1751
  try {
1827
- const response = await runObjectOperation(contact.readerId, {
1752
+ await runObjectOperation(selectedContact.value.readerId, {
1828
1753
  operation: "destroy",
1829
1754
  object: "contacts",
1830
- where: { contacts: { id: contact.id } },
1755
+ where: { contacts: { id: selectedContact.value.id } },
1831
1756
  });
1832
1757
  deleteContactDialog.value = false;
1833
1758
  await loadContacts();
1834
- if (readChanges(response) === 0) {
1835
- showMessage("The HID reader had already removed this contact. The list has been refreshed.", "warning");
1836
- return;
1837
- }
1838
1759
  showMessage("Intercom contact deleted.", "success");
1839
1760
  } catch (error: unknown) {
1840
1761
  showMessage(getErrorMessage(error), "error");
@@ -2022,14 +1943,9 @@ export default {
2022
1943
 
2023
1944
 
2024
1945
 
2025
- .contact-status-cell {
2026
- display: inline-flex;
2027
- align-items: center;
2028
- gap: 4px;
2029
- }
2030
-
2031
- .contact-status-refresh {
2032
- color: var(--text2);
1946
+ .row-menu {
1947
+ min-width: 160px;
1948
+ border-radius: 6px;
2033
1949
  }
2034
1950
 
2035
1951
  .link-text {
@@ -2089,27 +2005,10 @@ export default {
2089
2005
  color: var(--err);
2090
2006
  }
2091
2007
 
2092
- .field-hint {
2093
- margin: 6px 0 0;
2094
- color: var(--text2);
2095
- font-size: 11px;
2096
- line-height: 1.4;
2097
- }
2098
-
2099
2008
  .sip-settings-dialog .field-label {
2100
2009
  margin-top: 14px;
2101
2010
  }
2102
2011
 
2103
- /* Room between the contact dialog's three inputs; the first label sits
2104
- against the body padding. */
2105
- .contact-dialog .field-label {
2106
- margin-top: 18px;
2107
- }
2108
-
2109
- .contact-dialog .field-label:first-child {
2110
- margin-top: 0;
2111
- }
2112
-
2113
2012
  .sip-label {
2114
2013
  margin: 12px 0 6px;
2115
2014
  color: var(--text);
@@ -2807,18 +2706,14 @@ export default {
2807
2706
  margin-top: 0;
2808
2707
  }
2809
2708
 
2810
- .detail-dialog .dialog-title {
2811
- font-size: var(--fs-card-title);
2812
- }
2813
-
2814
2709
  .detail-row {
2815
2710
  display: flex;
2816
2711
  align-items: center;
2817
2712
  justify-content: space-between;
2818
2713
  gap: 16px;
2819
- min-height: 32px;
2714
+ min-height: 26px;
2820
2715
  color: var(--muted);
2821
- font-size: var(--fs-cell);
2716
+ font-size: 11px;
2822
2717
  }
2823
2718
 
2824
2719
  .detail-row strong {
@@ -2830,11 +2725,13 @@ export default {
2830
2725
  .dialog-actions {
2831
2726
  display: grid;
2832
2727
  grid-template-columns: 1fr 1fr;
2833
- gap: 0;
2834
- min-height: 0;
2835
2728
  border-top: 1px solid var(--border);
2836
2729
  }
2837
2730
 
2731
+ .sip-settings-dialog .dialog-actions {
2732
+ min-height: 46px;
2733
+ }
2734
+
2838
2735
  /* The split footer bar, as panels 2, 4 and 5 keep it: the SHAPE is the
2839
2736
  screen's own (the handoff draws no such bar); only the colours change. The
2840
2737
  navy was a fixed hex that sat on the dark card unchanged. */
@@ -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"
@@ -284,8 +284,6 @@ async function loadUsers() {
284
284
  return;
285
285
  }
286
286
 
287
- const sequence = loadUsersSequence.value + 1;
288
- loadUsersSequence.value = sequence;
289
287
  loading.value = true;
290
288
  try {
291
289
  let clientFiltersUserType = false;
@@ -321,7 +319,6 @@ async function loadUsers() {
321
319
  const pageItems = clientFiltersUserType
322
320
  ? matchingItems.slice(pageStart, pageStart + 10)
323
321
  : matchingItems;
324
- if (sequence !== loadUsersSequence.value) return;
325
322
  users.value = pageItems.map(toReaderUser);
326
323
  total.value = clientFiltersUserType
327
324
  ? matchingItems.length
@@ -333,15 +330,13 @@ async function loadUsers() {
333
330
  ? ""
334
331
  : toText(response.pageRange ?? data.pageRange);
335
332
  } catch (error: unknown) {
336
- if (sequence !== loadUsersSequence.value) return;
337
333
  users.value = [];
338
334
  total.value = 0;
339
335
  pages.value = 1;
340
336
  serverPageRange.value = "";
341
337
  showToast(getErrorMessage(error), "error");
342
338
  } finally {
343
- // Only the newest load owns the spinner.
344
- if (sequence === loadUsersSequence.value) loading.value = false;
339
+ loading.value = false;
345
340
  }
346
341
  }
347
342
 
@@ -355,31 +350,6 @@ function reloadFromFirstPage() {
355
350
  loadUsers();
356
351
  }
357
352
 
358
- /**
359
- * Typing is the search. It used to reload on `@keyup.enter` and on nothing
360
- * else, so unless you guessed Enter was required the screen sent no request at
361
- * all. Debounced, because each reload is a login/load/logout round trip to a
362
- * reader over a VPN; Enter still works and skips the wait.
363
- */
364
- const SEARCH_DEBOUNCE_MS = 400;
365
- let searchDebounce: ReturnType<typeof setTimeout> | undefined;
366
-
367
- function onSearchInput() {
368
- clearTimeout(searchDebounce);
369
- searchDebounce = setTimeout(reloadFromFirstPage, SEARCH_DEBOUNCE_MS);
370
- }
371
-
372
- function onSearchSubmit() {
373
- clearTimeout(searchDebounce);
374
- reloadFromFirstPage();
375
- }
376
-
377
- watch(search, onSearchInput);
378
- onBeforeUnmount(() => clearTimeout(searchDebounce));
379
-
380
- /** Discards a load whose answer arrives after a newer one started. */
381
- const loadUsersSequence = ref(0);
382
-
383
353
  function hasFacialData(user: HidReaderUser) {
384
354
  return user.metadata?.facialEnrolled === true || Boolean(toText(user.metadata?.facialData));
385
355
  }