@7365admin1/layer-common 4.97.1-staging.538 → 4.97.1-staging.539

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.
@@ -6,17 +6,43 @@
6
6
  >
7
7
  <v-row no-gutters>
8
8
  <v-col cols="12">
9
- <v-row no-gutters class="d-flex align-center ga-2 justify-end">
10
- <span class="d-flex ga-2 align-center">
11
- <p>Allow Opening Barrier via Plate Number?</p>
9
+ <!-- Which QR code types a resident's visitor invitation can carry. -->
10
+ <template v-for="option in visitorQrCodes" :key="option.type">
11
+ <div class="d-flex align-center justify-space-between py-3">
12
+ <div>
13
+ <div class="text-body-2 font-weight-medium">{{ visitorQrLabels[option.type].title }}</div>
14
+ <p class="text-caption text-medium-emphasis mt-1 mb-0">
15
+ {{ visitorQrLabels[option.type].description }}
16
+ </p>
17
+ </div>
12
18
  <v-switch
13
- v-model="isAllowPlateNumberOpenBarrier"
14
- hide-details
19
+ v-model="option.isEnabled"
15
20
  color="success"
16
- size="large"
21
+ inset
22
+ density="compact"
23
+ hide-details
24
+ class="flex-grow-0 ml-4"
17
25
  />
18
- </span>
19
- </v-row>
26
+ </div>
27
+ <v-divider />
28
+ </template>
29
+ <div class="d-flex align-center justify-space-between py-3">
30
+ <div>
31
+ <div class="text-body-2 font-weight-medium">Allow Opening Barrier via Plate Number?</div>
32
+ <p class="text-caption text-medium-emphasis mt-1 mb-0">
33
+ When enabled, the barrier can be opened for visitors by matching their vehicle plate number.
34
+ </p>
35
+ </div>
36
+ <v-switch
37
+ v-model="isAllowPlateNumberOpenBarrier"
38
+ color="success"
39
+ inset
40
+ density="compact"
41
+ hide-details
42
+ class="flex-grow-0 ml-4"
43
+ />
44
+ </div>
45
+ <v-divider class="mb-4" />
20
46
  <v-row
21
47
  no-gutters
22
48
  class="d-flex align-center ga-2 justify-space-between"
@@ -220,6 +246,26 @@ const isAllowPlateNumberOpenBarrier = ref(false);
220
246
  const autoApproveOvernightParking = ref(false);
221
247
  const isHydrating = ref(true);
222
248
 
249
+ const visitorQrLabels: Record<TVisitorQrCodeType, { title: string; description: string }> = {
250
+ hid: {
251
+ title: "HID QR Code Visitor Invitation",
252
+ description: "When enabled, HID QR codes will be generated for visitor invitations instead of standard entry pass QR codes.",
253
+ },
254
+ entryPass: {
255
+ title: "Entry Pass QR Code Visitor Invitation",
256
+ description: "When enabled, entry pass QR codes will be generated for visitor invitations.",
257
+ },
258
+ security: {
259
+ title: "Security QR Code Visitor Invitation",
260
+ description: "When enabled, security QR codes will be generated for visitor invitations.",
261
+ },
262
+ };
263
+ const visitorQrCodes = ref<TVisitorQrCode[]>([
264
+ { type: "hid", isEnabled: false },
265
+ { type: "security", isEnabled: false },
266
+ { type: "entryPass", isEnabled: false },
267
+ ]);
268
+
223
269
  const { requiredRule } = useUtils();
224
270
  const { generateTimeSlots, generateTimeSlotsFromStart } = useFacilityUtils();
225
271
  const { currentUser } = useLocalAuth();
@@ -290,6 +336,13 @@ watch(
290
336
  autoApproveOvernightParking.value =
291
337
  data?.autoApproveOvernightParking === true ||
292
338
  data?.isAutoApproved === true;
339
+ // Set in place so the toggle watcher only fires on a real change.
340
+ visitorQrCodes.value.forEach((option) => {
341
+ const saved = (data?.visitorQrCodes as TVisitorQrCode[] | undefined)?.find(
342
+ (q) => q.type === option.type
343
+ );
344
+ option.isEnabled = saved?.isEnabled === true;
345
+ });
293
346
  setTimeout(() => {
294
347
  isHydrating.value = false;
295
348
  }, 500);
@@ -374,7 +427,7 @@ watch(
374
427
  isAllowPlateNumberOpenBarrier,
375
428
  (newValue, oldValue) => {
376
429
  if (oldValue === newValue || isHydrating.value) return;
377
- handleSave("toggle");
430
+ handleSave("toggle", "Plate number barrier setting updated successfully.");
378
431
  },
379
432
  { immediate: false }
380
433
  );
@@ -388,7 +441,19 @@ watch(
388
441
  { immediate: false }
389
442
  );
390
443
 
391
- async function handleSave(action: "toggle" | "save") {
444
+ watch(
445
+ visitorQrCodes,
446
+ () => {
447
+ if (isHydrating.value) return;
448
+ handleSave("toggle", "Visitor QR settings updated successfully.");
449
+ },
450
+ { deep: true }
451
+ );
452
+
453
+ async function handleSave(
454
+ action: "toggle" | "save",
455
+ successMessage = "Overnight parking settings updated successfully."
456
+ ) {
392
457
  if (!isValid.value && action === "save") {
393
458
  message.value = "Please fill in all required fields.";
394
459
  messageColor.value = "error";
@@ -403,6 +468,7 @@ async function handleSave(action: "toggle" | "save") {
403
468
  isAllowPlateNumberOpenBarrier: isAllowPlateNumberOpenBarrier.value,
404
469
  autoApproveOvernightParking: autoApproveOvernightParking.value,
405
470
  isAutoApproved: autoApproveOvernightParking.value,
471
+ visitorQrCodes: visitorQrCodes.value.map(({ type, isEnabled }) => ({ type, isEnabled })),
406
472
  updatedBy: updatedByValue.value,
407
473
  };
408
474
 
@@ -414,7 +480,7 @@ async function handleSave(action: "toggle" | "save") {
414
480
  userType.value
415
481
  );
416
482
  refreshAvailability();
417
- message.value = "Overnight parking settings updated successfully.";
483
+ message.value = successMessage;
418
484
  messageColor.value = "success";
419
485
  messageSnackbar.value = true;
420
486
  } catch (error) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.97.1-staging.538",
5
+ "version": "4.97.1-staging.539",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -14,6 +14,14 @@ declare type TOvernightParkingAvailability = {
14
14
  sunday: TOvernightParkingDay;
15
15
  isAllowPlateNumberOpenBarrier?: boolean;
16
16
  autoApproveOvernightParking?: boolean;
17
+ visitorQrCodes?: TVisitorQrCode[];
18
+ };
19
+
20
+ declare type TVisitorQrCodeType = "hid" | "entryPass" | "security";
21
+
22
+ declare type TVisitorQrCode = {
23
+ type: TVisitorQrCodeType;
24
+ isEnabled: boolean;
17
25
  };
18
26
 
19
27
  declare type TOvernightParkingRequestStatus =