@7365admin1/layer-common 4.22.0 → 4.22.1-staging.352

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 (46) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/components/AccessCardAddForm.vue +5 -4
  3. package/components/AccessCardAssignToUnitForm.vue +3 -2
  4. package/components/AccessCardPreviewDialog.vue +4 -3
  5. package/components/Dialog/UpdateMoreAction.vue +11 -1
  6. package/components/DocumentForm.vue +407 -112
  7. package/components/DocumentManagement.vue +213 -12
  8. package/components/EntryPass/QrTemplatePreview.vue +21 -25
  9. package/components/EntryPassInformation.vue +119 -24
  10. package/components/Facility/BookingSetup.vue +63 -0
  11. package/components/HidAccessLogDashboard.vue +29 -5
  12. package/components/HidAccessPermissions.vue +424 -0
  13. package/components/HidIntercomManagement.vue +148 -14
  14. package/components/HidProfileQrCode.vue +323 -0
  15. package/components/HidReaderManagement.vue +26 -0
  16. package/components/HidReaderUserRoster.vue +32 -2
  17. package/components/HidUserEnrollment.vue +833 -152
  18. package/components/InvitationClientForm.vue +19 -1
  19. package/components/Robot/Fleet.vue +709 -0
  20. package/components/Robot/Form.vue +256 -0
  21. package/components/Robot/Map3D.vue +421 -0
  22. package/components/Robot/Plans.vue +63 -0
  23. package/components/Robot/SpotClean.vue +174 -0
  24. package/components/VisitorManagement.vue +267 -5
  25. package/composables/useAccessManagement.ts +5 -0
  26. package/composables/useDocument.ts +7 -0
  27. package/composables/useFacility.ts +11 -0
  28. package/composables/useHidAmico.ts +117 -0
  29. package/composables/useHidNavigation.ts +25 -1
  30. package/composables/usePeople.ts +19 -0
  31. package/composables/useRobots.ts +236 -0
  32. package/composables/useSiteCategory.ts +45 -0
  33. package/composables/useSiteEntryPassSettings.ts +26 -0
  34. package/composables/useWebUsb.ts +14 -11
  35. package/package.json +2 -2
  36. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  37. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  38. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  39. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  40. package/types/document.d.ts +14 -0
  41. package/types/facility.d.ts +4 -0
  42. package/types/people.d.ts +28 -1
  43. package/utils/building-map.ts +398 -0
  44. package/utils/hid-permission-assignments.ts +190 -0
  45. package/utils/occupancy-role.ts +109 -0
  46. package/utils/robot-display.ts +212 -0
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div class="pa-4">
3
+ <div v-if="loading" class="py-6 text-center">
4
+ <v-progress-circular indeterminate size="28" />
5
+ </div>
6
+ <v-alert v-else-if="error" type="error" variant="tonal" :text="error" />
7
+ <div v-else-if="!plans.length" class="py-6 text-center text-body-2 text-medium-emphasis">
8
+ This robot has no cleaning schedule.
9
+ </div>
10
+ <v-list v-else density="compact" class="pa-0">
11
+ <v-list-item v-for="(plan, i) in plans" :key="plan.planId ?? i" class="px-0">
12
+ <v-list-item-title class="font-weight-medium">
13
+ {{ plan.summary.days }} · {{ plan.summary.time }}
14
+ <v-chip
15
+ size="x-small"
16
+ label
17
+ variant="tonal"
18
+ class="ml-2"
19
+ :color="plan.summary.enabled ? 'success' : 'default'"
20
+ >
21
+ {{ plan.summary.enabled ? "On" : "Off" }}
22
+ </v-chip>
23
+ </v-list-item-title>
24
+ <v-list-item-subtitle>
25
+ {{ plan.summary.jobs.join(" · ") || "No jobs in this plan" }}
26
+ </v-list-item-subtitle>
27
+ </v-list-item>
28
+ </v-list>
29
+ <!--
30
+ Read-only on purpose: the schedule lives in the robot maker's cloud, and no
31
+ brand's adapter offers editing it through this platform yet.
32
+ -->
33
+ <p class="text-caption text-medium-emphasis mt-3 mb-0">
34
+ Schedules are set in the robot maker's own app and shown here as they are.
35
+ </p>
36
+ </div>
37
+ </template>
38
+
39
+ <script lang="ts" setup>
40
+ /** The cleaning schedule a robot's cloud holds, shown read-only. */
41
+ import { planSummary, robotErrorMessage } from "../../utils/robot-display";
42
+
43
+ const props = defineProps<{ robotId: string }>();
44
+ const { getRobotPlans } = useRobots();
45
+
46
+ const plans = ref<Array<Record<string, any>>>([]);
47
+ const loading = ref(true);
48
+ const error = ref("");
49
+
50
+ onMounted(async () => {
51
+ try {
52
+ const res = await getRobotPlans(props.robotId);
53
+ plans.value = (res?.items ?? []).map((p: Record<string, any>) => ({
54
+ ...p,
55
+ summary: planSummary(p),
56
+ }));
57
+ } catch (e) {
58
+ error.value = robotErrorMessage(e, "Could not load this robot's schedule.");
59
+ } finally {
60
+ loading.value = false;
61
+ }
62
+ });
63
+ </script>
@@ -0,0 +1,174 @@
1
+ <template>
2
+ <div class="pa-4">
3
+ <AppSelect
4
+ v-if="maps.length > 1"
5
+ v-model="floorNo"
6
+ :items="floorOptions"
7
+ item-title="title"
8
+ item-value="value"
9
+ label="Level"
10
+ density="compact"
11
+ hide-details
12
+ class="mb-3"
13
+ style="max-width: 220px"
14
+ />
15
+ <div v-if="loading" class="py-6 text-center">
16
+ <v-progress-circular indeterminate size="28" />
17
+ </div>
18
+ <v-alert v-else-if="error" type="error" variant="tonal" :text="error" />
19
+ <template v-else>
20
+ <p class="text-body-2 text-medium-emphasis mb-2">
21
+ Click the spot on the floor plan you want cleaned.
22
+ </p>
23
+ <div class="spot-plan">
24
+ <img
25
+ ref="img"
26
+ :src="imageUrl"
27
+ alt="Floor plan"
28
+ class="spot-plan__img"
29
+ @click="pick"
30
+ />
31
+ <div
32
+ v-if="picked"
33
+ class="spot-plan__marker"
34
+ :style="{ left: `${picked.left}%`, top: `${picked.top}%` }"
35
+ />
36
+ </div>
37
+ </template>
38
+ <div class="d-flex justify-end ga-2 mt-3">
39
+ <AppButton variant="text" :disabled="sending" @click="$emit('close')">Close</AppButton>
40
+ <AppButton :loading="sending" :disabled="!picked" @click="send">Clean this spot</AppButton>
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script lang="ts" setup>
46
+ /**
47
+ * Spot cleaning by clicking the robot's own floor plan.
48
+ *
49
+ * The click is taken in the plan's PIXELS - the frame the spot command uses -
50
+ * so no metre conversion happens here. Offered only for brands declaring
51
+ * `spotClean`; the server refuses the rest by name as well.
52
+ */
53
+ import { robotErrorMessage, spotPolygon } from "../../utils/robot-display";
54
+
55
+ const props = defineProps<{ robotId: string; robotName?: string }>();
56
+ const emit = defineEmits<{ close: []; sent: [message: string] }>();
57
+
58
+ const { getRobotMaps, getRobotMapImages, sendRobotCommand } = useRobots();
59
+
60
+ const maps = ref<Array<Record<string, any>>>([]);
61
+ const floorNo = ref<number | null>(null);
62
+ const imageUrl = ref("");
63
+ const img = ref<HTMLImageElement | null>(null);
64
+ const picked = ref<{ x: number; y: number; left: number; top: number } | null>(null);
65
+ const loading = ref(true);
66
+ const sending = ref(false);
67
+ const error = ref("");
68
+
69
+ const floorOptions = computed(() =>
70
+ maps.value.map((m) => ({ title: m.mapName?.trim() || `Floor ${m.floorNo}`, value: m.floorNo })),
71
+ );
72
+
73
+ async function loadImage() {
74
+ const map = maps.value.find((m) => m.floorNo === floorNo.value);
75
+ picked.value = null;
76
+ imageUrl.value = "";
77
+ if (!map?.backgroundFileKey) {
78
+ error.value = "This floor has no plan image.";
79
+ return;
80
+ }
81
+ const files = await getRobotMapImages(props.robotId, [map.backgroundFileKey]);
82
+ imageUrl.value = files?.items?.find((f: any) => f.fileKey === map.backgroundFileKey)?.url ?? "";
83
+ if (!imageUrl.value) error.value = "The floor plan image could not be fetched.";
84
+ }
85
+
86
+ onMounted(async () => {
87
+ try {
88
+ const res = await getRobotMaps(props.robotId);
89
+ maps.value = res?.items ?? [];
90
+ if (!maps.value.length) {
91
+ error.value = "This robot has no floor maps yet.";
92
+ return;
93
+ }
94
+ floorNo.value = maps.value[0].floorNo;
95
+ await loadImage();
96
+ } catch (e) {
97
+ error.value = robotErrorMessage(e, "Could not load this robot's floor plan.");
98
+ } finally {
99
+ loading.value = false;
100
+ }
101
+ });
102
+
103
+ watch(floorNo, async (next, prev) => {
104
+ if (prev === null || next === prev) return;
105
+ loading.value = true;
106
+ error.value = "";
107
+ try {
108
+ await loadImage();
109
+ } catch (e) {
110
+ error.value = robotErrorMessage(e, "Could not load this floor.");
111
+ } finally {
112
+ loading.value = false;
113
+ }
114
+ });
115
+
116
+ /** Screen point to plan pixel: the image is scaled to fit, its pixels are not. */
117
+ function pick(event: MouseEvent) {
118
+ const el = img.value;
119
+ if (!el || !el.naturalWidth) return;
120
+ const rect = el.getBoundingClientRect();
121
+ const fx = (event.clientX - rect.left) / rect.width;
122
+ const fy = (event.clientY - rect.top) / rect.height;
123
+ picked.value = {
124
+ x: fx * el.naturalWidth,
125
+ y: fy * el.naturalHeight,
126
+ left: fx * 100,
127
+ top: fy * 100,
128
+ };
129
+ }
130
+
131
+ async function send() {
132
+ const el = img.value;
133
+ if (!picked.value || !el) return;
134
+ sending.value = true;
135
+ try {
136
+ await sendRobotCommand(props.robotId, {
137
+ kind: "spot",
138
+ points: spotPolygon(picked.value.x, picked.value.y, {
139
+ width: el.naturalWidth,
140
+ height: el.naturalHeight,
141
+ }),
142
+ });
143
+ emit("sent", `${props.robotName ?? "The robot"} has been sent to clean that spot.`);
144
+ } catch (e) {
145
+ error.value = robotErrorMessage(e);
146
+ } finally {
147
+ sending.value = false;
148
+ }
149
+ }
150
+ </script>
151
+
152
+ <style scoped>
153
+ .spot-plan {
154
+ position: relative;
155
+ width: 100%;
156
+ }
157
+ .spot-plan__img {
158
+ display: block;
159
+ width: 100%;
160
+ cursor: crosshair;
161
+ image-rendering: pixelated;
162
+ border: 1px solid rgba(0, 0, 0, 0.12);
163
+ }
164
+ .spot-plan__marker {
165
+ position: absolute;
166
+ width: 14px;
167
+ height: 14px;
168
+ margin: -7px 0 0 -7px;
169
+ border-radius: 50%;
170
+ background: #ff5a1f;
171
+ box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.3);
172
+ pointer-events: none;
173
+ }
174
+ </style>
@@ -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,84 @@
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
+
799
901
  <!-- The vehicle number, with Block on its right: the Registered
800
902
  tab only, for someone who may add vehicles. It opens the
801
903
  Vehicle Mgmt Block Listed form with the category taken from
@@ -2088,6 +2190,71 @@ const isSelectedVisitorPendingApproval = computed(
2088
2190
  () => selectedVisitorStatus.value === "pending"
2089
2191
  );
2090
2192
 
2193
+ /**
2194
+ * The members a contractor brought with them. Not gated on the Guests tab: the
2195
+ * list row's own `( +N members)` count is not either, and a contractor with a
2196
+ * party has one wherever the screen shows it.
2197
+ *
2198
+ * Blank entries are dropped rather than drawn as an empty card - the payload
2199
+ * carries `""` for every detail nobody filled in, so a member with no name and
2200
+ * no details would otherwise render as a bare inset box.
2201
+ */
2202
+ const selectedVisitorMembers = computed<Record<string, any>[]>(() => {
2203
+ const members = selectedVisitorDataObject.value?.members;
2204
+ if (!Array.isArray(members)) return [];
2205
+
2206
+ return members.filter(
2207
+ (member: Record<string, any>) =>
2208
+ member?.name || member?.nric || member?.contact || member?.plateNumber
2209
+ );
2210
+ });
2211
+
2212
+ /**
2213
+ * WHICH NRICs ARE UNCOVERED RIGHT NOW.
2214
+ *
2215
+ * Per member and not per card, so revealing one person's number does not
2216
+ * uncover the rest of the party's. Both are cleared when the dialog closes -
2217
+ * a preview must not open on the next visitor with the last one's NRIC
2218
+ * already showing, and it is the same `selectedVisitorId` that would carry it
2219
+ * across if the same row were reopened.
2220
+ */
2221
+ const showVisitorNric = ref(false);
2222
+ const shownMemberNrics = ref<number[]>([]);
2223
+
2224
+ function isMemberNricShown(index: number) {
2225
+ return shownMemberNrics.value.includes(index);
2226
+ }
2227
+
2228
+ function toggleMemberNric(index: number) {
2229
+ shownMemberNrics.value = isMemberNricShown(index)
2230
+ ? shownMemberNrics.value.filter((x) => x !== index)
2231
+ : [...shownMemberNrics.value, index];
2232
+ }
2233
+
2234
+ watch(
2235
+ () => dialog.viewVisitor,
2236
+ (open) => {
2237
+ if (open) return;
2238
+ showVisitorNric.value = false;
2239
+ shownMemberNrics.value = [];
2240
+ }
2241
+ );
2242
+
2243
+ /**
2244
+ * What a member row prints under the name, in order. `plateNumber` is in here
2245
+ * because the API returns it on `members[]` even though neither
2246
+ * `TMemberInfo` (this package) nor `TContractorMembers` (API-core's visitor
2247
+ * model, name and nric only) declares it - the two types have drifted from the
2248
+ * document and from each other. Reading the key defensively costs nothing and
2249
+ * shows the vehicle a member actually arrived in; the types are somebody's to
2250
+ * reconcile separately.
2251
+ */
2252
+ const memberDetailFields = [
2253
+ { key: "nric", label: "NRIC" },
2254
+ { key: "contact", label: "Contact" },
2255
+ { key: "plateNumber", label: "Vehicle" },
2256
+ ] as const;
2257
+
2091
2258
  const formatType = (item: any) =>
2092
2259
  (item.deliveryType ? item.deliveryType + "-" : "") + item.type;
2093
2260
 
@@ -2101,6 +2268,7 @@ const formattedFields = {
2101
2268
  level: "Level",
2102
2269
  unit: "Unit",
2103
2270
  purpose: "Purpose",
2271
+ members: "Members",
2104
2272
  checkIn: "Check In",
2105
2273
  snapshotEntryImage: "Entry Image",
2106
2274
  checkOut: "Check Out",
@@ -3092,6 +3260,100 @@ watchEffect(async () => {
3092
3260
  word-break: break-word;
3093
3261
  }
3094
3262
 
3263
+ /* A row whose value is a set of records rather than a value - it drops the
3264
+ two-column grid and runs the full width of the card body. */
3265
+ .visitor-preview__row--block {
3266
+ display: block;
3267
+ }
3268
+
3269
+ .visitor-preview__members {
3270
+ display: flex;
3271
+ flex-direction: column;
3272
+ gap: 8px;
3273
+ margin-top: 8px;
3274
+ }
3275
+
3276
+ /*
3277
+ * An added member reads as an inset on the card it sits in - `--hover` on
3278
+ * `--border` at the inner radius. Those are `Card/MemberInfoSummary`'s three
3279
+ * decisions, unchanged, so a member looks the same in the preview as it does
3280
+ * in the form that created it. Only the TYPE differs: that card still prints
3281
+ * `<strong>Label:</strong> value`, which is the pattern this dialog just moved
3282
+ * off, so the lines below are set on the scale rather than inherited.
3283
+ */
3284
+ .visitor-preview__member {
3285
+ padding: 9px 12px;
3286
+ border: 1px solid var(--border);
3287
+ border-radius: var(--r-inner);
3288
+ background: var(--hover);
3289
+ }
3290
+
3291
+ .visitor-preview__member-line {
3292
+ display: flex;
3293
+ gap: 8px;
3294
+ margin-top: 3px;
3295
+ font-size: var(--fs-breadcrumb);
3296
+ color: var(--text2);
3297
+ word-break: break-word;
3298
+ }
3299
+
3300
+ .visitor-preview__member-key {
3301
+ flex: 0 0 52px;
3302
+ color: var(--muted);
3303
+ }
3304
+
3305
+ /*
3306
+ * THE NRIC REVEAL.
3307
+ *
3308
+ * The pressable thing is the masked number, not the glyph beside it: an eye on
3309
+ * its own is a 14-16px target where 24px is the floor, and on a 12.5px member
3310
+ * line an `AppButton variant="icon"` - the layer's 32px icon square - would
3311
+ * make the NRIC line half again the height of the Contact line under it.
3312
+ * Pressing the digits gives a target the width of the value at no cost to the
3313
+ * rhythm, and reads the right way round: the number is what changes.
3314
+ *
3315
+ * It inherits its type rather than setting any, so the visitor's NRIC stays on
3316
+ * `--fs-cell` and a member's on the `--fs-breadcrumb` of the line it sits in.
3317
+ * The negative margin pays back the padding, so a revealed value starts on the
3318
+ * same left edge as every other value in the card.
3319
+ */
3320
+ .visitor-preview__reveal {
3321
+ display: inline-flex;
3322
+ align-items: center;
3323
+ gap: 6px;
3324
+ margin: -3px -7px;
3325
+ padding: 3px 7px;
3326
+ border: none;
3327
+ border-radius: var(--r-inner-sm);
3328
+ background: transparent;
3329
+ font: inherit;
3330
+ color: inherit;
3331
+ text-align: left;
3332
+ cursor: pointer;
3333
+ transition: background var(--motion) ease;
3334
+ }
3335
+
3336
+ .visitor-preview__reveal:hover {
3337
+ background: var(--hover);
3338
+ }
3339
+
3340
+ .visitor-preview__reveal:focus-visible {
3341
+ outline: 2px solid var(--accent);
3342
+ outline-offset: 1px;
3343
+ }
3344
+
3345
+ /* The design's interactive ink - not Vuetify's fixed blue, which is one colour
3346
+ on both themes. `affectedEntities` gives its NRIC eye the same value. */
3347
+ .visitor-preview__eye {
3348
+ color: var(--accent-text);
3349
+ }
3350
+
3351
+ @media (prefers-reduced-motion: reduce) {
3352
+ .visitor-preview__reveal {
3353
+ transition: none;
3354
+ }
3355
+ }
3356
+
3095
3357
  /* The width the type filter carried as `max-width="200"` on the v-select. */
3096
3358
  .visitor-type-filter {
3097
3359
  max-width: 200px;
@@ -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;