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

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.
@@ -79,7 +79,7 @@
79
79
 
80
80
  <div v-if="details.userCred.nric">
81
81
  <div class="card-details__label">NRIC</div>
82
- <div class="card-details__value">{{ details.userCred.nric }}</div>
82
+ <div class="card-details__value">{{ maskNRIC(details.userCred.nric) }}</div>
83
83
  </div>
84
84
 
85
85
  <div v-if="details.userCred.contact">
@@ -162,7 +162,7 @@
162
162
  <template v-if="entry.type === 'assigned' || entry.visitorId">
163
163
  <div class="card-details__value">{{ entry.name ?? "N/A" }}</div>
164
164
  <div class="card-details__sub">
165
- <span v-if="entry.nric">NRIC: {{ entry.nric }}</span>
165
+ <span v-if="entry.nric">NRIC: {{ maskNRIC(entry.nric) }}</span>
166
166
  <span v-if="entry.contact" class="ml-2">· {{ entry.contact }}</span>
167
167
  <span v-if="entry.email && !entry.nric && !entry.contact">{{ entry.email }}</span>
168
168
  </div>
@@ -193,6 +193,7 @@
193
193
  </template>
194
194
 
195
195
  <script setup lang="ts">
196
+ const { maskNRIC } = useUtils();
196
197
  const props = defineProps({
197
198
  modelValue: {
198
199
  type: Boolean,
@@ -163,6 +163,8 @@
163
163
  <TableMain :headers="vehicleHeaders" :show-header="true" :page="vehiclePage" :pages="vehicleTotalPages"
164
164
  :pageRange="vehiclePageRange" :items="unitVehicleItems" @refresh="getUnitVehiclesRefresh" @update:page="handleUpdateVehiclePage">
165
165
 
166
+ <template #item.nric="{ value }">{{ maskNRIC(value) || "-" }}</template>
167
+
166
168
  <template #item.status="{value}">
167
169
  <v-chip :color="formatVehicleStatus(value).color" class="ma-0" small>
168
170
  {{ formatVehicleStatus(value).label }}
@@ -404,7 +406,7 @@ const validForm = ref(false);
404
406
 
405
407
  const { getAll } = useBuilding();
406
408
  const { getPeopleByUnit, updateById: updatePeopleById } = usePeople();
407
- const { debounce } = useUtils();
409
+ const { debounce, maskNRIC } = useUtils();
408
410
  const { searchMultipleVehiclesByUnitId, formatVehicleStatus } = useVehicle();
409
411
 
410
412
  const loading = reactive({
@@ -114,7 +114,7 @@
114
114
  <div class="nric-selected-person d-flex align-center justify-space-between ga-3 mb-5">
115
115
  <span>{{ memberSelectedSearchResult.name || "Unknown" }}</span>
116
116
  <span class="text-no-wrap">
117
- NRIC: {{ memberSelectedSearchResult.nric || "N/A" }}
117
+ NRIC: {{ maskNRIC(memberSelectedSearchResult.nric) || "N/A" }}
118
118
  </span>
119
119
  </div>
120
120
 
@@ -214,7 +214,7 @@ const props = defineProps({
214
214
  },
215
215
  });
216
216
 
217
- const { requiredRule, debounce } = useUtils();
217
+ const { requiredRule, debounce, maskNRIC } = useUtils();
218
218
  const { getPassKeysByPageSearch } = usePassKey();
219
219
  const {
220
220
  findPersonByNRICMultipleResult,
@@ -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) {
@@ -19,6 +19,8 @@
19
19
  </span>
20
20
  </template>
21
21
 
22
+ <template #item.nric="{ value }">{{ maskNRIC(value) || "-" }}</template>
23
+
22
24
  <template #item.actions="{ item }">
23
25
  <AppButton variant="ghost" @click="handleSelectUser(item)">Select</AppButton>
24
26
  </template>
@@ -37,6 +39,7 @@
37
39
  </template>
38
40
 
39
41
  <script setup lang="ts">
42
+ const { maskNRIC } = useUtils();
40
43
 
41
44
  const prop = defineProps({
42
45
  vehicleNumber: {
@@ -476,7 +476,7 @@
476
476
  </v-list-item-title>
477
477
 
478
478
  <v-list-item-subtitle>
479
- NRIC: {{ v.nric || "-" }}
479
+ NRIC: {{ maskNRIC(v.nric) || "-" }}
480
480
  </v-list-item-subtitle>
481
481
 
482
482
  <div class="mt-1 d-flex flex-wrap ga-1">
@@ -581,7 +581,7 @@ const prop = defineProps({
581
581
  },
582
582
  });
583
583
 
584
- const { requiredRule, debounce } = useUtils();
584
+ const { requiredRule, debounce, maskNRIC } = useUtils();
585
585
  const {
586
586
  addVehicle,
587
587
  getCustomSeasonPassTypes,
@@ -311,7 +311,7 @@
311
311
  <div class="screen-modal__body nric-options-body">
312
312
  <div class="nric-selected-person d-flex align-center justify-space-between ga-3 mb-5">
313
313
  <span>{{ selectedNricSearchResult.name || "Unknown" }}</span>
314
- <span v-if="!visitor.nric || currentAutofillSource === 'nric'" class="text-no-wrap">NRIC: {{ selectedNricSearchResult.nric || "N/A" }}</span>
314
+ <span v-if="!visitor.nric || currentAutofillSource === 'nric'" class="text-no-wrap">NRIC: {{ maskNRIC(selectedNricSearchResult.nric) || "N/A" }}</span>
315
315
  </div>
316
316
 
317
317
  <template v-if="(!visitor.contact || currentAutofillSource === 'contact') && selectedNricContactOptions.length >= 1">
@@ -355,7 +355,7 @@
355
355
  </p>
356
356
 
357
357
  <div class="checkout-dialog__subject">
358
- <div v-if="!skipNonCheckedOutNric">NRIC: {{ visitor.nric || "N/A" }}</div>
358
+ <div v-if="!skipNonCheckedOutNric">NRIC: {{ maskNRIC(visitor.nric) || "N/A" }}</div>
359
359
  <div>Phone Number: {{ visitor.contact || "N/A" }}</div>
360
360
  </div>
361
361
 
@@ -422,7 +422,7 @@
422
422
  <div class="visitor-form__footer" v-if="!skipNonCheckedOutNric">
423
423
  <v-btn class="screen-btn-primary" variant="flat" :loading="loading.searchingNonCheckedOut"
424
424
  @click="handleSkipNricNonCheckedOut">
425
- Skip NRIC: {{ visitor.nric || "N/A" }}
425
+ Skip NRIC: {{ maskNRIC(visitor.nric) || "N/A" }}
426
426
  </v-btn>
427
427
  </div>
428
428
  </v-card>
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
  <div class="visitor-summary__cell">
28
28
  <div class="visitor-summary__label">NRIC</div>
29
- <div class="visitor-summary__value">{{ item?.nric || "N/A" }}</div>
29
+ <div class="visitor-summary__value">{{ maskNRIC(item?.nric) || "N/A" }}</div>
30
30
  </div>
31
31
  </div>
32
32
 
@@ -49,6 +49,7 @@
49
49
  </template>
50
50
 
51
51
  <script setup lang="ts">
52
+ const { maskNRIC } = useUtils();
52
53
  const props = defineProps<{
53
54
  item: any;
54
55
  }>();
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.540",
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 =