@7365admin1/layer-common 3.0.18 → 3.0.20

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.
@@ -291,7 +291,7 @@
291
291
  autocomplete="off"
292
292
  :disabled="!visitor.block"
293
293
  :key="
294
- levelListDataPending ? 'level-list-pending' : 'level-list-ready'
294
+ levelsDataPending ? 'level-list-pending' : 'level-list-ready'
295
295
  "
296
296
  :loading="levelsDataPending"
297
297
  @update:model-value="handleChangeLevel"
@@ -308,9 +308,7 @@
308
308
  item-title="title"
309
309
  item-value="value"
310
310
  :disabled="!visitor.level"
311
- :key="
312
- unitListDataPending ? 'unit-list-pending' : 'unit-list-ready'
313
- "
311
+ :key="unitsDataPending ? 'unit-list-pending' : 'unit-list-ready'"
314
312
  :loading="unitsDataPending"
315
313
  :rules="[requiredRule]"
316
314
  @update:model-value="handleUpdateUnit"
@@ -344,7 +342,7 @@
344
342
  </v-col>
345
343
 
346
344
  <v-col
347
- v-if="(withStep2 || withStep3) && contractorStep === 2"
345
+ v-show="(withStep2 || withStep3) && contractorStep === 2"
348
346
  cols="12"
349
347
  >
350
348
  <PassInformation
@@ -355,6 +353,7 @@
355
353
  :contractor-type="visitor.contractorType"
356
354
  :hide-keys="!showShowKeysField"
357
355
  :passKeys="visitor.passKeys"
356
+ :clearable="true"
358
357
  />
359
358
  <EntryPassInformation
360
359
  v-if="showEntryPassInformation"
@@ -371,13 +370,14 @@
371
370
  />
372
371
  </v-col>
373
372
 
374
- <v-col v-if="withStep3 && contractorStep === 3" cols="12">
373
+ <v-col v-show="withStep3 && contractorStep === 3" cols="12">
375
374
  <MemberInformation
376
375
  v-model="visitor.members"
377
376
  :type="prop.type"
378
377
  :contractor-type="visitor.contractorType"
379
378
  :site="prop.site"
380
379
  :selected-visitor-pass="visitor.visitorPass"
380
+ :clearable="true"
381
381
  />
382
382
  </v-col>
383
383
 
@@ -710,7 +710,9 @@ const hidQrPrinterConfig = computed(() => {
710
710
  });
711
711
 
712
712
  const hasHidQrPrinterConfig = computed(() => {
713
- return Boolean(hidQrPrinterConfig.value?.vendorId && hidQrPrinterConfig.value?.productId);
713
+ return Boolean(
714
+ hidQrPrinterConfig.value?.vendorId && hidQrPrinterConfig.value?.productId
715
+ );
714
716
  });
715
717
 
716
718
  const hidQrTemplate = computed(() => {
@@ -723,11 +725,17 @@ const hidQrValidityMinutes = computed(() => {
723
725
  });
724
726
 
725
727
  const hidQrCodePassAllowed = computed(() => {
726
- return hidQrCodePassEnabled.value && ["guest", "contractor", "walk-in"].includes(prop.type);
728
+ return (
729
+ hidQrCodePassEnabled.value &&
730
+ ["guest", "contractor", "walk-in"].includes(prop.type)
731
+ );
727
732
  });
728
733
 
729
734
  const showEntryPassInformation = computed(() => {
730
- return Boolean(entryPassSettings.value?.data?.settings?.nfcPass || hidQrCodePassAllowed.value);
735
+ return Boolean(
736
+ entryPassSettings.value?.data?.settings?.nfcPass ||
737
+ hidQrCodePassAllowed.value
738
+ );
731
739
  });
732
740
 
733
741
  const companyNames = ref<string[]>([]);
@@ -1297,11 +1305,17 @@ async function submit() {
1297
1305
 
1298
1306
  if (res) {
1299
1307
  if (passType.value === "HID_QR") {
1300
- const printed = await printHidQrCodePass(getVisitorIdFromResponse(res), false);
1308
+ const printed = await printHidQrCodePass(
1309
+ getVisitorIdFromResponse(res),
1310
+ false
1311
+ );
1301
1312
  if (!printed) return;
1302
1313
  }
1303
1314
 
1304
- if (prop.type === "contractor" && (passType.value === "QR" || passType.value === "NFC")) {
1315
+ if (
1316
+ prop.type === "contractor" &&
1317
+ (passType.value === "QR" || passType.value === "NFC")
1318
+ ) {
1305
1319
  const visitorId = res as unknown as string;
1306
1320
  const rawUrl = entryPassSettings.value?.data?.settings?.url;
1307
1321
  const { encrypted: acmUrl } = await $fetch<{ encrypted: string }>(
@@ -1453,14 +1467,16 @@ function getHidQrPrinterUsbIds() {
1453
1467
 
1454
1468
  function validateHidQrPrinterConfig() {
1455
1469
  if (!hasHidQrPrinterConfig.value) {
1456
- errorMessage.value = "No printer is configured on HID settings. Please configure the HID QR Code printer before continuing.";
1470
+ errorMessage.value =
1471
+ "No printer is configured on HID settings. Please configure the HID QR Code printer before continuing.";
1457
1472
  return false;
1458
1473
  }
1459
1474
 
1460
1475
  const { vendorId, productId } = getHidQrPrinterUsbIds();
1461
1476
 
1462
1477
  if (!Number.isFinite(vendorId) || !Number.isFinite(productId)) {
1463
- errorMessage.value = "Invalid HID QR Code printer configuration. Please check Vendor and Product ID in Settings.";
1478
+ errorMessage.value =
1479
+ "Invalid HID QR Code printer configuration. Please check Vendor and Product ID in Settings.";
1464
1480
  return false;
1465
1481
  }
1466
1482
 
@@ -1471,7 +1487,9 @@ function buildHidQrCodePayload(visitorId = "") {
1471
1487
  if (hidQrPrintPayload.value) return hidQrPrintPayload.value;
1472
1488
 
1473
1489
  const issuedAt = new Date();
1474
- const expiresAt = new Date(issuedAt.getTime() + hidQrValidityMinutes.value * 60 * 1000);
1490
+ const expiresAt = new Date(
1491
+ issuedAt.getTime() + hidQrValidityMinutes.value * 60 * 1000
1492
+ );
1475
1493
  const nonce =
1476
1494
  typeof crypto !== "undefined" && "randomUUID" in crypto
1477
1495
  ? crypto.randomUUID()
@@ -1502,9 +1520,14 @@ function buildHidQrCodePayload(visitorId = "") {
1502
1520
  }
1503
1521
 
1504
1522
  function buildVisitorAddress() {
1505
- const blockLabel = blocksArray.value.find((b: any) => b.value === visitor.block)?.title || "";
1506
- const levelLabel = levelsArray.value.find((l: any) => l.value === visitor.level)?.title || "";
1507
- const unitLabel = unitsArray.value.find((u: any) => u.value === visitor.unit)?.title || visitor.unitName || "";
1523
+ const blockLabel =
1524
+ blocksArray.value.find((b: any) => b.value === visitor.block)?.title || "";
1525
+ const levelLabel =
1526
+ levelsArray.value.find((l: any) => l.value === visitor.level)?.title || "";
1527
+ const unitLabel =
1528
+ unitsArray.value.find((u: any) => u.value === visitor.unit)?.title ||
1529
+ visitor.unitName ||
1530
+ "";
1508
1531
  return [blockLabel, levelLabel, unitLabel].filter(Boolean).join("/");
1509
1532
  }
1510
1533
 
@@ -1527,7 +1550,7 @@ async function printHidQrCodePass(visitorId = "", manageProcessing = true) {
1527
1550
  visitor.company || visitor.name || "",
1528
1551
  buildVisitorAddress(),
1529
1552
  hidQrTemplate.value?.header || "HID QR Code",
1530
- hidQrTemplate.value?.subtext || "Scan QR code for access",
1553
+ hidQrTemplate.value?.subtext || "Scan QR code for access"
1531
1554
  );
1532
1555
 
1533
1556
  if (!printResult?.success || printResult?.printTest?.success === false) {
@@ -236,6 +236,19 @@ export default function useBuilding() {
236
236
  });
237
237
  }
238
238
 
239
+ function uploadSpreadsheetBuilding(params: { site: string; file: File }) {
240
+ const formData = new FormData();
241
+ formData.append("file", params.file);
242
+
243
+ return useNuxtApp().$api<Record<string, any>>(
244
+ "/api/files/blocks/upload-spreadsheet",
245
+ {
246
+ method: "POST",
247
+ query: { site: params.site },
248
+ body: formData,
249
+ }
250
+ );
251
+ }
239
252
 
240
253
  function getBlocksSelection({siteId} : { siteId: string; }) {
241
254
  return useNuxtApp().$api(`/api/buildings/list/site/${siteId}`, {
@@ -272,6 +285,7 @@ export default function useBuilding() {
272
285
  updateBuildingField,
273
286
  deleteById,
274
287
  updateById,
288
+ uploadSpreadsheetBuilding,
275
289
  getBlocksSelection,
276
290
  getLevelsSelection,
277
291
  getUnitSelection
@@ -174,12 +174,13 @@ export default function useServiceProvider() {
174
174
  orgId = "",
175
175
  siteId = "",
176
176
  siteName = "",
177
+ inviteType=""
177
178
  } = {}) {
178
179
  return useNuxtApp().$api<Record<string, any>>(
179
180
  "/api/service-providers/invite",
180
181
  {
181
182
  method: "POST",
182
- body: { email, orgId, siteId, siteName },
183
+ body: { email, orgId, siteId, siteName, inviteType },
183
184
  }
184
185
  );
185
186
  }
@@ -110,25 +110,29 @@ export default function () {
110
110
  checkedOut,
111
111
  tab,
112
112
  }: GetVisitorsParams = {}) {
113
+ const query = Object.fromEntries(
114
+ Object.entries({
115
+ page,
116
+ limit,
117
+ search,
118
+ org,
119
+ site,
120
+ dateTo,
121
+ dateFrom,
122
+ type,
123
+ status,
124
+ checkedOut,
125
+ plateNumber,
126
+ order,
127
+ tab,
128
+ }).filter(([, value]) => value !== undefined && value !== null && value !== "")
129
+ );
130
+
113
131
  return await useNuxtApp().$api<Record<string, any>>(
114
132
  "/api/visitor-transactions",
115
133
  {
116
134
  method: "GET",
117
- query: {
118
- page,
119
- limit,
120
- search,
121
- org,
122
- site,
123
- dateTo,
124
- dateFrom,
125
- type,
126
- status,
127
- checkedOut,
128
- plateNumber,
129
- order,
130
- tab,
131
- },
135
+ query,
132
136
  }
133
137
  );
134
138
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "3.0.18",
5
+ "version": "3.0.20",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -5,7 +5,7 @@
5
5
  :org="orgId"
6
6
  message="Enable HID as a service for this site before viewing access logs."
7
7
  >
8
- <HidAccessLogDashboard :site="siteId" />
8
+ <HidAccessLogDashboard :org="orgId" :site="siteId" />
9
9
  </HidEnabledGate>
10
10
  </v-container>
11
11
  </template>
@@ -13,6 +13,8 @@
13
13
  <script setup lang="ts">
14
14
  definePageMeta({
15
15
  layout: "default",
16
+ middleware: ["01-auth", "02-org"],
17
+ memberOnly: true,
16
18
  });
17
19
 
18
20
  const route = useRoute();
@@ -81,7 +81,7 @@ declare type TDefaultOptionObj = {
81
81
  declare type TMemberInfo = {
82
82
  name: string;
83
83
  nric: string;
84
- visitorPass?: { keyId: string }[];
84
+ visitorPass?: TPassKeyPayload[];
85
85
  passKeys?: TPassKeyPayload[];
86
86
  contact: string;
87
87
  };