@7365admin1/layer-common 4.21.3 → 4.21.4-staging.340

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 (39) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/components/AnprCameraBadge.vue +220 -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/Input/NRICNumber.vue +14 -2
  16. package/components/InvitationClientForm.vue +19 -1
  17. package/components/PlateNumberDisplay.vue +105 -1
  18. package/components/VehicleForm.vue +324 -3
  19. package/components/VehicleManagement.vue +346 -51
  20. package/components/VisitorManagement.vue +434 -5
  21. package/composables/useAccessManagement.ts +5 -0
  22. package/composables/useDocument.ts +7 -0
  23. package/composables/useFacility.ts +11 -0
  24. package/composables/useHidAmico.ts +97 -0
  25. package/composables/useHidNavigation.ts +25 -1
  26. package/composables/usePeople.ts +19 -0
  27. package/composables/useVehicle.ts +101 -1
  28. package/composables/useWebUsb.ts +14 -11
  29. package/package.json +1 -1
  30. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  31. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  32. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  33. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  34. package/types/document.d.ts +14 -0
  35. package/types/facility.d.ts +4 -0
  36. package/types/people.d.ts +5 -2
  37. package/types/vehicle.d.ts +57 -2
  38. package/utils/hid-permission-assignments.ts +190 -0
  39. package/utils/vehicle-actions.ts +45 -17
@@ -742,11 +742,35 @@
742
742
  class="visitor-preview__row"
743
743
  >
744
744
  <div class="visitor-preview__label">{{ label }}</div>
745
- <div
746
- v-tooltip:top="selectedVisitorObject[key]"
747
- class="visitor-preview__value"
748
- >
749
- {{ maskNRIC(selectedVisitorObject[key]) }}
745
+ <div>
746
+ <!-- Was a hover tooltip on the value: the full NRIC only
747
+ reachable by hovering, which says nothing is there to
748
+ reach and cannot be reached at all on a touch screen.
749
+ The eye alone, at the 14px the Incident Report screens
750
+ draw it, is a 14px target - the floor is 24px. So the
751
+ NUMBER is the control and the eye is its affordance:
752
+ the whole masked value is pressable, which makes the
753
+ target the width of the digits rather than of a glyph,
754
+ and being a real `button` it also takes a tab stop,
755
+ which a `v-icon` with a click handler never did. -->
756
+ <button
757
+ type="button"
758
+ class="visitor-preview__reveal"
759
+ :aria-label="showVisitorNric ? 'Hide NRIC' : 'Show NRIC'"
760
+ :aria-pressed="showVisitorNric"
761
+ @click="showVisitorNric = !showVisitorNric"
762
+ >
763
+ <span class="visitor-preview__value">
764
+ {{
765
+ showVisitorNric
766
+ ? selectedVisitorObject[key]
767
+ : maskNRIC(selectedVisitorObject[key])
768
+ }}
769
+ </span>
770
+ <v-icon size="16" class="visitor-preview__eye">
771
+ {{ showVisitorNric ? "mdi-eye-off-outline" : "mdi-eye-outline" }}
772
+ </v-icon>
773
+ </button>
750
774
  </div>
751
775
  </div>
752
776
 
@@ -796,6 +820,123 @@
796
820
  </div>
797
821
  </div>
798
822
 
823
+ <!--
824
+ THE CONTRACTOR'S PARTY.
825
+
826
+ The list row has always said `( +2 members)` beside the name
827
+ and then had nowhere to send you for the names themselves. The
828
+ block spans both columns rather than sitting in the 116px
829
+ value track: a member is a record, not a value, and several of
830
+ them in a 250px column is unreadable.
831
+
832
+ Read off `selectedVisitorDataObject` (the raw row) and not
833
+ `selectedVisitorObject`, which filters itself down to
834
+ `typeFieldMap` plus five fixed keys - `members` is on neither
835
+ list, and widening that computed would change what four other
836
+ dialogs on this screen see.
837
+ -->
838
+ <div
839
+ v-else-if="key === 'members' && selectedVisitorMembers.length"
840
+ class="visitor-preview__row visitor-preview__row--block"
841
+ >
842
+ <div class="visitor-preview__label">
843
+ {{ label }} ({{ selectedVisitorMembers.length }})
844
+ </div>
845
+ <div class="visitor-preview__members">
846
+ <div
847
+ v-for="(member, index) in selectedVisitorMembers"
848
+ :key="member?.nric || member?.name || index"
849
+ class="visitor-preview__member"
850
+ >
851
+ <div class="visitor-preview__value">
852
+ {{ member?.name || "N/A" }}
853
+ </div>
854
+ <template v-for="field in memberDetailFields" :key="field.key">
855
+ <div
856
+ v-if="member?.[field.key]"
857
+ class="visitor-preview__member-line"
858
+ >
859
+ <span class="visitor-preview__member-key">
860
+ {{ field.label }}
861
+ </span>
862
+ <!-- A member's NRIC is the same class of data as the
863
+ visitor's, so it gets the same control. Each
864
+ member reveals separately - one toggle for the
865
+ whole card would show three people's NRICs to
866
+ read one. -->
867
+ <button
868
+ v-if="field.key === 'nric'"
869
+ type="button"
870
+ class="visitor-preview__reveal"
871
+ :aria-label="
872
+ isMemberNricShown(index)
873
+ ? `Hide NRIC for ${member?.name || 'this member'}`
874
+ : `Show NRIC for ${member?.name || 'this member'}`
875
+ "
876
+ :aria-pressed="isMemberNricShown(index)"
877
+ @click="toggleMemberNric(index)"
878
+ >
879
+ <span>
880
+ {{
881
+ isMemberNricShown(index)
882
+ ? member.nric
883
+ : maskNRIC(member.nric)
884
+ }}
885
+ </span>
886
+ <v-icon size="16" class="visitor-preview__eye">
887
+ {{
888
+ isMemberNricShown(index)
889
+ ? "mdi-eye-off-outline"
890
+ : "mdi-eye-outline"
891
+ }}
892
+ </v-icon>
893
+ </button>
894
+ <span v-else>{{ member[field.key] }}</span>
895
+ </div>
896
+ </template>
897
+ </div>
898
+ </div>
899
+ </div>
900
+
901
+ <!-- The vehicle number, with Block on its right: the Registered
902
+ tab only, for someone who may add vehicles. It opens the
903
+ Vehicle Mgmt Block Listed form with the category taken from
904
+ the transaction type. -->
905
+ <div
906
+ v-else-if="
907
+ key === 'plateNumber' &&
908
+ selectedVisitorObject[key] &&
909
+ canBlockSelectedVehicle
910
+ "
911
+ class="visitor-preview__row"
912
+ >
913
+ <div class="visitor-preview__label">{{ label }}</div>
914
+ <div class="visitor-preview__value d-flex align-center justify-space-between ga-2">
915
+ <span>{{ selectedVisitorObject[key] }}</span>
916
+ <!-- Already in Block Listed: greyed "Blocked" that only says so
917
+ when pressed, rather than opening the form again. -->
918
+ <AppButton
919
+ v-if="selectedPlateBlocked"
920
+ variant="ghost"
921
+ icon="mdi-cancel"
922
+ class="visitor-preview__blocked"
923
+ :aria-disabled="true"
924
+ @click="showMessage(`${selectedVisitorRow.plateNumber} is already in Block Listed.`, 'info')"
925
+ >
926
+ Blocked
927
+ </AppButton>
928
+ <AppButton
929
+ v-else
930
+ variant="err"
931
+ icon="mdi-cancel"
932
+ :disabled="checkingBlockedPlate"
933
+ @click="openBlockVehicle"
934
+ >
935
+ Block
936
+ </AppButton>
937
+ </div>
938
+ </div>
939
+
799
940
  <div
800
941
  v-else-if="selectedVisitorObject[key]"
801
942
  class="visitor-preview__row"
@@ -817,6 +958,24 @@
817
958
  </VehicleUpdateMoreAction>
818
959
  </v-dialog>
819
960
 
961
+ <v-dialog v-model="dialog.blockVehicle" width="450" persistent>
962
+ <VehicleForm
963
+ v-if="dialog.blockVehicle"
964
+ type="blocklist"
965
+ mode="add"
966
+ :site="siteId"
967
+ :org="orgId"
968
+ :vehicle-data="blockVehicleData"
969
+ :preset-category="blockVehicleCategory"
970
+ :prefill-plate="blockVehiclePlate"
971
+ :preset-location="blockVehicleLocation"
972
+ @done="handleBlockVehicleDone"
973
+ @back="dialog.blockVehicle = false"
974
+ @close="dialog.blockVehicle = false"
975
+ @close:all="dialog.blockVehicle = false"
976
+ />
977
+ </v-dialog>
978
+
820
979
  <v-dialog v-model="dialog.snapshotImage" max-width="700">
821
980
  <v-card>
822
981
  <v-card-title class="d-flex justify-space-between align-center">
@@ -1423,6 +1582,11 @@ const props = defineProps({
1423
1582
  type: Boolean,
1424
1583
  default: false,
1425
1584
  },
1585
+ /** May add vehicles - shows Block beside a Registered visitor's vehicle number. */
1586
+ canBlockVehicle: {
1587
+ type: Boolean,
1588
+ default: false,
1589
+ },
1426
1590
  });
1427
1591
 
1428
1592
  const { authenticate, currentUser } = useLocalAuth();
@@ -1610,8 +1774,107 @@ const dialog = reactive({
1610
1774
  approveRejectOvernightParkingRequestDialog: false,
1611
1775
  returnNfcCard: false,
1612
1776
  approveRejectVisitorDialog: false,
1777
+ blockVehicle: false,
1613
1778
  });
1614
1779
 
1780
+ /* ---- Block a visitor's vehicle ------------------------------------------ */
1781
+
1782
+ /** The row itself: the preview object keeps only the fields it prints. */
1783
+ const selectedVisitorRow = computed<Record<string, any>>(
1784
+ () => items.value.find((x: any) => x?._id === selectedVisitorId.value) ?? {}
1785
+ );
1786
+
1787
+ /**
1788
+ * The Block Listed category for a visitor transaction type: a guest is a
1789
+ * visitor; contractor, delivery, pick-up and drop-off stay as they are.
1790
+ */
1791
+ function blockCategoryForVisitorType(type: unknown): string {
1792
+ const value = String(type ?? "").toLowerCase();
1793
+ if (["contractor", "delivery", "pick-up", "drop-off"].includes(value)) return value;
1794
+ return "visitor";
1795
+ }
1796
+
1797
+ const canBlockSelectedVehicle = computed(() => {
1798
+ if (!props.canBlockVehicle || activeTab.value !== "registered") return false;
1799
+ const row = selectedVisitorRow.value;
1800
+ const type = String(row?.type ?? "");
1801
+ return !!row?.plateNumber && type !== "resident" && type !== "tenant";
1802
+ });
1803
+
1804
+ const blockVehiclePlate = ref("");
1805
+ const blockVehicleCategory = ref("");
1806
+ const blockVehicleData = ref<Record<string, any>>({});
1807
+ const blockVehicleLocation = ref<Record<string, any> | null>(null);
1808
+
1809
+ /** An id and a name from a visitor field that may be an object or an id. */
1810
+ function locationPart(value: any, fallbackName = "") {
1811
+ if (!value && !fallbackName) return undefined;
1812
+ const id = typeof value === "object" && value ? String(value._id ?? "") : String(value ?? "");
1813
+ const name = (typeof value === "object" && value ? String(value.name ?? "") : "") || fallbackName;
1814
+ return id || name ? { id, name } : undefined;
1815
+ }
1816
+
1817
+ function openBlockVehicle() {
1818
+ const row = selectedVisitorRow.value;
1819
+ blockVehiclePlate.value = String(row?.plateNumber ?? "").trim().toUpperCase();
1820
+ blockVehicleCategory.value = blockCategoryForVisitorType(row?.type);
1821
+ // The visit's block / level / unit, saved on the vehicle and shown read-only.
1822
+ blockVehicleLocation.value = {
1823
+ block: locationPart(row?.block),
1824
+ level: locationPart(row?.level),
1825
+ unit: locationPart(row?.unit, String(row?.unitName ?? "")),
1826
+ };
1827
+ // Remarks are left empty: the reason for blocking is not the visit's remarks.
1828
+ blockVehicleData.value = {
1829
+ name: row?.name ?? "",
1830
+ nric: row?.nric ?? "",
1831
+ phoneNumber: row?.contact ?? "",
1832
+ remarks: "",
1833
+ };
1834
+ dialog.blockVehicle = true;
1835
+ }
1836
+
1837
+ /**
1838
+ * Whether the previewed plate is already in Block Listed (status "blocked"),
1839
+ * asked of the server each time the Preview opens and after a block.
1840
+ */
1841
+ const { checkExistingPlates } = useVehicle();
1842
+ const selectedPlateBlocked = ref(false);
1843
+ const checkingBlockedPlate = ref(false);
1844
+
1845
+ async function refreshSelectedPlateBlocked() {
1846
+ selectedPlateBlocked.value = false;
1847
+ const plate = String(selectedVisitorRow.value?.plateNumber ?? "").trim();
1848
+ if (!plate || !canBlockSelectedVehicle.value) return;
1849
+ checkingBlockedPlate.value = true;
1850
+ try {
1851
+ const res = await checkExistingPlates({ site: siteId, plateNumbers: [plate] });
1852
+ // Only if the Preview still shows the same plate when the answer arrives.
1853
+ if (String(selectedVisitorRow.value?.plateNumber ?? "").trim() !== plate) return;
1854
+ selectedPlateBlocked.value = (res?.items ?? []).some(
1855
+ (item) => item.status === "blocked"
1856
+ );
1857
+ } catch {
1858
+ // Unknown: leave Block available; the form says if the plate exists.
1859
+ } finally {
1860
+ checkingBlockedPlate.value = false;
1861
+ }
1862
+ }
1863
+
1864
+ watch(
1865
+ () => [dialog.viewVisitor, selectedVisitorId.value],
1866
+ ([open]) => {
1867
+ if (open) refreshSelectedPlateBlocked();
1868
+ }
1869
+ );
1870
+
1871
+ function handleBlockVehicleDone() {
1872
+ dialog.blockVehicle = false;
1873
+ // The form closes and the Preview's button turns to "Blocked".
1874
+ refreshSelectedPlateBlocked();
1875
+ showMessage(`Vehicle ${blockVehiclePlate.value} is now in Block Listed.`, "success");
1876
+ }
1877
+
1615
1878
  const snapshotImageUrl = ref("");
1616
1879
  const remarksType = ref<"checkIn" | "checkOut">("checkIn");
1617
1880
  const remarksInput = ref("");
@@ -1898,6 +2161,71 @@ const isSelectedVisitorPendingApproval = computed(
1898
2161
  () => selectedVisitorStatus.value === "pending"
1899
2162
  );
1900
2163
 
2164
+ /**
2165
+ * The members a contractor brought with them. Not gated on the Guests tab: the
2166
+ * list row's own `( +N members)` count is not either, and a contractor with a
2167
+ * party has one wherever the screen shows it.
2168
+ *
2169
+ * Blank entries are dropped rather than drawn as an empty card - the payload
2170
+ * carries `""` for every detail nobody filled in, so a member with no name and
2171
+ * no details would otherwise render as a bare inset box.
2172
+ */
2173
+ const selectedVisitorMembers = computed<Record<string, any>[]>(() => {
2174
+ const members = selectedVisitorDataObject.value?.members;
2175
+ if (!Array.isArray(members)) return [];
2176
+
2177
+ return members.filter(
2178
+ (member: Record<string, any>) =>
2179
+ member?.name || member?.nric || member?.contact || member?.plateNumber
2180
+ );
2181
+ });
2182
+
2183
+ /**
2184
+ * WHICH NRICs ARE UNCOVERED RIGHT NOW.
2185
+ *
2186
+ * Per member and not per card, so revealing one person's number does not
2187
+ * uncover the rest of the party's. Both are cleared when the dialog closes -
2188
+ * a preview must not open on the next visitor with the last one's NRIC
2189
+ * already showing, and it is the same `selectedVisitorId` that would carry it
2190
+ * across if the same row were reopened.
2191
+ */
2192
+ const showVisitorNric = ref(false);
2193
+ const shownMemberNrics = ref<number[]>([]);
2194
+
2195
+ function isMemberNricShown(index: number) {
2196
+ return shownMemberNrics.value.includes(index);
2197
+ }
2198
+
2199
+ function toggleMemberNric(index: number) {
2200
+ shownMemberNrics.value = isMemberNricShown(index)
2201
+ ? shownMemberNrics.value.filter((x) => x !== index)
2202
+ : [...shownMemberNrics.value, index];
2203
+ }
2204
+
2205
+ watch(
2206
+ () => dialog.viewVisitor,
2207
+ (open) => {
2208
+ if (open) return;
2209
+ showVisitorNric.value = false;
2210
+ shownMemberNrics.value = [];
2211
+ }
2212
+ );
2213
+
2214
+ /**
2215
+ * What a member row prints under the name, in order. `plateNumber` is in here
2216
+ * because the API returns it on `members[]` even though neither
2217
+ * `TMemberInfo` (this package) nor `TContractorMembers` (API-core's visitor
2218
+ * model, name and nric only) declares it - the two types have drifted from the
2219
+ * document and from each other. Reading the key defensively costs nothing and
2220
+ * shows the vehicle a member actually arrived in; the types are somebody's to
2221
+ * reconcile separately.
2222
+ */
2223
+ const memberDetailFields = [
2224
+ { key: "nric", label: "NRIC" },
2225
+ { key: "contact", label: "Contact" },
2226
+ { key: "plateNumber", label: "Vehicle" },
2227
+ ] as const;
2228
+
1901
2229
  const formatType = (item: any) =>
1902
2230
  (item.deliveryType ? item.deliveryType + "-" : "") + item.type;
1903
2231
 
@@ -1911,6 +2239,7 @@ const formattedFields = {
1911
2239
  level: "Level",
1912
2240
  unit: "Unit",
1913
2241
  purpose: "Purpose",
2242
+ members: "Members",
1914
2243
  checkIn: "Check In",
1915
2244
  snapshotEntryImage: "Entry Image",
1916
2245
  checkOut: "Check Out",
@@ -2889,6 +3218,100 @@ watchEffect(async () => {
2889
3218
  word-break: break-word;
2890
3219
  }
2891
3220
 
3221
+ /* A row whose value is a set of records rather than a value - it drops the
3222
+ two-column grid and runs the full width of the card body. */
3223
+ .visitor-preview__row--block {
3224
+ display: block;
3225
+ }
3226
+
3227
+ .visitor-preview__members {
3228
+ display: flex;
3229
+ flex-direction: column;
3230
+ gap: 8px;
3231
+ margin-top: 8px;
3232
+ }
3233
+
3234
+ /*
3235
+ * An added member reads as an inset on the card it sits in - `--hover` on
3236
+ * `--border` at the inner radius. Those are `Card/MemberInfoSummary`'s three
3237
+ * decisions, unchanged, so a member looks the same in the preview as it does
3238
+ * in the form that created it. Only the TYPE differs: that card still prints
3239
+ * `<strong>Label:</strong> value`, which is the pattern this dialog just moved
3240
+ * off, so the lines below are set on the scale rather than inherited.
3241
+ */
3242
+ .visitor-preview__member {
3243
+ padding: 9px 12px;
3244
+ border: 1px solid var(--border);
3245
+ border-radius: var(--r-inner);
3246
+ background: var(--hover);
3247
+ }
3248
+
3249
+ .visitor-preview__member-line {
3250
+ display: flex;
3251
+ gap: 8px;
3252
+ margin-top: 3px;
3253
+ font-size: var(--fs-breadcrumb);
3254
+ color: var(--text2);
3255
+ word-break: break-word;
3256
+ }
3257
+
3258
+ .visitor-preview__member-key {
3259
+ flex: 0 0 52px;
3260
+ color: var(--muted);
3261
+ }
3262
+
3263
+ /*
3264
+ * THE NRIC REVEAL.
3265
+ *
3266
+ * The pressable thing is the masked number, not the glyph beside it: an eye on
3267
+ * its own is a 14-16px target where 24px is the floor, and on a 12.5px member
3268
+ * line an `AppButton variant="icon"` - the layer's 32px icon square - would
3269
+ * make the NRIC line half again the height of the Contact line under it.
3270
+ * Pressing the digits gives a target the width of the value at no cost to the
3271
+ * rhythm, and reads the right way round: the number is what changes.
3272
+ *
3273
+ * It inherits its type rather than setting any, so the visitor's NRIC stays on
3274
+ * `--fs-cell` and a member's on the `--fs-breadcrumb` of the line it sits in.
3275
+ * The negative margin pays back the padding, so a revealed value starts on the
3276
+ * same left edge as every other value in the card.
3277
+ */
3278
+ .visitor-preview__reveal {
3279
+ display: inline-flex;
3280
+ align-items: center;
3281
+ gap: 6px;
3282
+ margin: -3px -7px;
3283
+ padding: 3px 7px;
3284
+ border: none;
3285
+ border-radius: var(--r-inner-sm);
3286
+ background: transparent;
3287
+ font: inherit;
3288
+ color: inherit;
3289
+ text-align: left;
3290
+ cursor: pointer;
3291
+ transition: background var(--motion) ease;
3292
+ }
3293
+
3294
+ .visitor-preview__reveal:hover {
3295
+ background: var(--hover);
3296
+ }
3297
+
3298
+ .visitor-preview__reveal:focus-visible {
3299
+ outline: 2px solid var(--accent);
3300
+ outline-offset: 1px;
3301
+ }
3302
+
3303
+ /* The design's interactive ink - not Vuetify's fixed blue, which is one colour
3304
+ on both themes. `affectedEntities` gives its NRIC eye the same value. */
3305
+ .visitor-preview__eye {
3306
+ color: var(--accent-text);
3307
+ }
3308
+
3309
+ @media (prefers-reduced-motion: reduce) {
3310
+ .visitor-preview__reveal {
3311
+ transition: none;
3312
+ }
3313
+ }
3314
+
2892
3315
  /* The width the type filter carried as `max-width="200"` on the v-select. */
2893
3316
  .visitor-type-filter {
2894
3317
  max-width: 200px;
@@ -2900,4 +3323,10 @@ watchEffect(async () => {
2900
3323
  border: 1px solid #dce3e8;
2901
3324
  background: #fff;
2902
3325
  }
3326
+
3327
+ /* Looks disabled, but still answers a click with "already in Block Listed". */
3328
+ .visitor-preview__blocked {
3329
+ opacity: 0.55;
3330
+ cursor: not-allowed;
3331
+ }
2903
3332
  </style>
@@ -228,7 +228,11 @@ export default function useAccessManagement() {
228
228
  unitId: string;
229
229
  page?: number;
230
230
  limit?: number;
231
+ /** Card-number search. Sent only when non-empty; API-core does not read
232
+ * it yet, so until it does the list comes back unfiltered. */
233
+ search?: string;
231
234
  }) {
235
+ const search = params.search?.trim();
232
236
  return useNuxtApp().$api<Record<string, any>>(
233
237
  `/api/access-management/available-card-contractor/${params.type}`,
234
238
  {
@@ -238,6 +242,7 @@ export default function useAccessManagement() {
238
242
  unitId: params.unitId,
239
243
  page: params.page ?? 1,
240
244
  limit: params.limit ?? 100,
245
+ ...(search ? { search } : {}),
241
246
  },
242
247
  }
243
248
  );
@@ -6,6 +6,7 @@ export default function useDocument() {
6
6
  type = "all",
7
7
  site = "",
8
8
  parentId = "",
9
+ expiry = "all",
9
10
  }: {
10
11
  page?: number;
11
12
  search?: string;
@@ -13,6 +14,11 @@ export default function useDocument() {
13
14
  type?: string;
14
15
  site?: string;
15
16
  parentId?: string;
17
+ /**
18
+ * Which tab is asking: "active" for Documents, "expired" for
19
+ * Document (Expired). Defaults to "all" so existing callers are unaffected.
20
+ */
21
+ expiry?: string;
16
22
  } = {}) {
17
23
  const query: Record<string, any> = {
18
24
  page,
@@ -21,6 +27,7 @@ export default function useDocument() {
21
27
  type,
22
28
  site,
23
29
  parentId,
30
+ expiry,
24
31
  };
25
32
 
26
33
  return useNuxtApp().$api<Record<string, any>>(`/api/documents`, {
@@ -76,6 +76,8 @@ export default function usetFacility() {
76
76
  hourInterval?: number;
77
77
  isBookingFeeEnabled: boolean;
78
78
  isGuestEnabled: boolean;
79
+ isResidentChecklistEnabled: boolean;
80
+ isSecurityChecklistEnabled: boolean;
79
81
  bookingAmount: number | null;
80
82
  peakBookingFeeAmount?: number | null;
81
83
  bookingFeeGuestAmount?: number | null;
@@ -173,6 +175,8 @@ export default function usetFacility() {
173
175
  hourInterval = 1,
174
176
  isBookingFeeEnabled = false,
175
177
  isGuestEnabled = false,
178
+ isResidentChecklistEnabled = false,
179
+ isSecurityChecklistEnabled = false,
176
180
  bookingAmount = 0,
177
181
  peakBookingFeeAmount = 0,
178
182
  bookingFeeGuestAmount = 0,
@@ -236,6 +240,13 @@ export default function usetFacility() {
236
240
  this.hourInterval = hourInterval;
237
241
  this.isBookingFeeEnabled = isBookingFeeEnabled;
238
242
  this.isGuestEnabled = isGuestEnabled;
243
+ // Exactly one owner, always. `isResidentChecklistEnabled` is the flag
244
+ // the apps gate on, so it decides, and security is its complement —
245
+ // stored rather than computed so each app can read its own flag without
246
+ // knowing the rule. A facility predating both fields lands on security,
247
+ // which is how every one of them already behaved.
248
+ this.isResidentChecklistEnabled = isResidentChecklistEnabled === true;
249
+ this.isSecurityChecklistEnabled = !this.isResidentChecklistEnabled;
239
250
  this.bookingAmount = bookingAmount;
240
251
  this.peakBookingFeeAmount = peakBookingFeeAmount;
241
252
  this.bookingFeeGuestAmount = bookingFeeGuestAmount;