@7365admin1/layer-common 3.2.1-staging.71 → 3.2.1

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 +6 -0
  2. package/components/EntryPassInformation.vue +4 -4
  3. package/components/HidAccessLogDashboard.vue +44 -119
  4. package/components/HidIdentityMapping.vue +975 -0
  5. package/components/HidIntercomManagement.vue +201 -808
  6. package/components/HidQrCodeConfiguration.vue +95 -907
  7. package/components/HidServiceSettingsPanel.vue +1 -20
  8. package/components/HidUserEnrollment.vue +81 -392
  9. package/components/Layout/NavigationDrawer.vue +2 -43
  10. package/components/NavigationItem.vue +0 -9
  11. package/components/Nfc/NFCPatrolRouteMain.vue +7 -52
  12. package/components/OnlineFormConfigurationForm.vue +224 -620
  13. package/components/OnlineFormFill.vue +8 -36
  14. package/components/OnlineFormsConfiguration.vue +2 -6
  15. package/components/QrTemplate/CreditCardLandscape.vue +12 -19
  16. package/components/QrTemplate/PrintDialog.vue +196 -209
  17. package/components/SiteSettings.vue +2 -4
  18. package/components/VisitorForm.vue +78 -201
  19. package/components/VisitorManagement.vue +1 -0
  20. package/components/VisitorSocketPopUp.vue +2 -56
  21. package/composables/useHidAmico.ts +0 -127
  22. package/composables/useHidNavigation.ts +7 -0
  23. package/composables/useOnlineFormPages.ts +0 -2
  24. package/composables/useSiteSettings.ts +0 -50
  25. package/composables/useVisitorSocket.ts +0 -26
  26. package/composables/useWebUsb.ts +37 -127
  27. package/middleware/member.ts +4 -0
  28. package/package.json +1 -3
  29. package/pages/[org]/[site]/access-mgmt/identity-mapping/index.vue +23 -0
  30. package/pages/[org]/[site]/access-mgmt/intercom/index.vue +1 -1
  31. package/plugins/secure-member.client.ts +56 -21
  32. package/plugins/vuetify.ts +9 -37
  33. package/types/site.d.ts +0 -71
  34. package/.changeset/camera-wall-gated-endpoint.md +0 -47
  35. package/.changeset/camera-wall-plain-english.md +0 -60
  36. package/.changeset/camera-wall-selection-and-guidance.md +0 -65
  37. package/.changeset/dark-primary-contrast.md +0 -39
  38. package/components/CameraWall.vue +0 -1034
  39. package/components/CameraWallTile.vue +0 -818
  40. package/components/HidCameraCaptureDialog.vue +0 -199
  41. package/composables/useSipWebPhone.ts +0 -311
  42. package/test/visitor-socket.test.mjs +0 -36
  43. package/utils/camera-wall.test.ts +0 -571
  44. package/utils/camera-wall.ts +0 -926
  45. package/utils/theme.test.ts +0 -201
  46. package/utils/theme.ts +0 -136
@@ -52,7 +52,7 @@
52
52
  <v-col cols="12" class="d-flex align-center">
53
53
  <v-autocomplete
54
54
  :items="
55
- templateOptions.filter(
55
+ localTemplateList.filter(
56
56
  (item) => !['All', 'Manually Added'].includes(item.name)
57
57
  )
58
58
  "
@@ -238,7 +238,7 @@
238
238
  >
239
239
  <v-autocomplete
240
240
  label="Start"
241
- :items="passRangeOptions"
241
+ :items="resultKeys2"
242
242
  item-title="text"
243
243
  item-value="value"
244
244
  v-model="startRange"
@@ -319,7 +319,7 @@
319
319
  <v-row no-gutters dense>
320
320
  <v-col cols="12">
321
321
  <v-data-iterator
322
- :items="keyListResult?.items || []"
322
+ :items="resultKeys2?.items"
323
323
  :items-per-page="selectedPageRange"
324
324
  >
325
325
  <template v-slot:header>
@@ -697,7 +697,7 @@
697
697
  </v-col>
698
698
 
699
699
  <v-col cols="3" class="text-end">
700
- <span>{{ keyListResult?.pageRange }}</span>
700
+ <span>{{ resultKeys2?.pageRange }}</span>
701
701
  <v-btn
702
702
  density="compact"
703
703
  variant="text"
@@ -731,7 +731,14 @@
731
731
  <v-btn
732
732
  color="primary"
733
733
  @click="printContent"
734
- :disabled="isPrintDisabled"
734
+ :disabled="
735
+ tab !== 'key'
736
+ ? !selectedChoicePaperSizeOrientation ||
737
+ !selectedTemplate?._id ||
738
+ !startRange ||
739
+ !endRange
740
+ : !selectedKeysToPrint.length
741
+ "
735
742
  >
736
743
  Print
737
744
  </v-btn>
@@ -773,18 +780,6 @@
773
780
  </template>
774
781
 
775
782
  <script setup lang="ts">
776
- type TemplateOption = {
777
- _id?: string | null;
778
- name: string;
779
- prefixPass?: string;
780
- prefixKey?: string;
781
- };
782
-
783
- type PassRangeOption = {
784
- text: string;
785
- value: string;
786
- };
787
-
788
783
  const { templateQrCode, getTemplatesByPageSearch } = useTemplateReusable();
789
784
 
790
785
  const {
@@ -799,7 +794,7 @@ const {
799
794
 
800
795
  const props = defineProps<{
801
796
  open: Boolean;
802
- templateList: Array<TemplateOption>;
797
+ templateList: Array;
803
798
  template: any;
804
799
  type: any;
805
800
  orientation: any;
@@ -807,147 +802,90 @@ const props = defineProps<{
807
802
  }>();
808
803
 
809
804
  const route = useRoute();
810
- const router = useRouter();
805
+
811
806
  const emit = defineEmits(["update:close"]);
812
807
 
813
808
  const selectedChoicePaperSizeOrientation = ref<any>(null);
814
- const passRangeOptions = ref<PassRangeOption[]>([]);
809
+
810
+ const resultKeys2 = ref<any>([]);
815
811
  const startRange = ref<any>(null);
816
812
  const endRange = ref<any>(null);
817
813
  const prefixAndName = ref<string>("");
818
814
 
819
815
  const snackbarStartRange = ref<boolean>(false);
816
+
820
817
  const isFetchingTemplates = ref<boolean>(false);
821
818
  const isFetchingPassKeys = ref<boolean>(false);
819
+
822
820
  const resultPass = ref<any>(null);
823
821
 
824
822
  const searchKey = ref("");
825
823
  const totalPages = ref(0);
826
- const page = ref(1);
827
824
  const canNextPage = computed(() => totalPages.value > page.value);
828
825
  const canPrevPage = computed(() => page.value <= 1);
829
826
  const pageRanges = ref([10, 25, 50, 100, 500, 1000]);
830
827
  const selectedPageRange = ref(10);
831
828
 
832
829
  const selectAll = ref(false);
833
- const templateOptions = ref<TemplateOption[]>([]);
834
- const keyListResult = ref<any>({
835
- items: [],
836
- pages: 0,
837
- pageRange: "-- - -- of --",
838
- });
839
- const message = ref("");
840
- const messageColor = ref("");
841
- const messageSnackbar = ref(false);
842
-
843
- const isPassTab = computed(() => tab.value === "pass");
844
- const isKeyTab = computed(() => tab.value === "key");
845
- const selectedTemplateId = computed(
846
- () => selectedTemplate.value?._id ?? props.template?._id ?? null
847
- );
848
- const isPrintDisabled = computed(() =>
849
- isKeyTab.value
850
- ? !selectedKeysToPrint.value.length
851
- : !selectedChoicePaperSizeOrientation.value ||
852
- !selectedTemplateId.value ||
853
- !startRange.value ||
854
- !endRange.value
855
- );
830
+ const localTemplateList = ref([]);
856
831
 
857
832
  watch(
858
833
  () => props.templateList,
859
834
  (newVal) => {
860
- templateOptions.value = Array.isArray(newVal)
861
- ? newVal.map((item) => ({
862
- _id: item?._id ?? null,
863
- name: item?.name ?? "",
864
- prefixPass: item?.prefixPass,
865
- prefixKey: item?.prefixKey,
866
- }))
867
- : [];
868
- },
869
- { immediate: true }
835
+ localTemplateList.value = newVal;
836
+ }
870
837
  );
871
838
 
872
- function resetPrintState() {
873
- selectedChoicePaperSizeOrientation.value = null;
874
- passRangeOptions.value = [];
875
- startRange.value = null;
876
- endRange.value = null;
877
- prefixAndName.value = "";
878
- selectAll.value = false;
879
- keyListResult.value = {
880
- items: [],
881
- pages: 0,
882
- pageRange: "-- - -- of --",
883
- };
884
- }
885
-
886
- function getTemplateOptionItems(items: Array<any> = []) {
887
- return items.map((item) => ({
888
- _id: item?._id ?? null,
889
- name: item?.name ?? "",
890
- prefixPass: item?.prefixPass,
891
- prefixKey: item?.prefixKey,
892
- }));
893
- }
894
-
895
- function mapPassRangeItems(items: Array<any> = []) {
896
- return items
897
- .map((item: any) => ({
898
- text: item?.prefixAndName ?? item?.name ?? "N/A",
899
- value: item?.name ?? "",
900
- }))
901
- .filter((item) => item.value)
902
- .sort((firstItem, secondItem) => {
903
- const numericValueOfFirstItem = Number(
904
- firstItem.value.replace(/\D/g, "")
905
- );
906
- const numericValueOfSecondItem = Number(
907
- secondItem.value.replace(/\D/g, "")
908
- );
909
-
910
- return numericValueOfFirstItem - numericValueOfSecondItem;
911
- });
912
- }
913
-
914
- function normalizePassNumberValue(value: string | null | undefined) {
915
- const rawValue = (value ?? "").toString().trim();
916
- if (!rawValue) return "";
917
-
918
- const match = rawValue.match(/^(.*?)(\d+)$/);
919
- if (!match) return rawValue;
920
-
921
- const prefix = match[1].replace(/\s+/g, "").toUpperCase();
922
- const numericPart = match[2];
923
-
924
- return `${prefix}${numericPart}`;
925
- }
926
-
927
- function getPassNumberPrefix(value: string | null | undefined) {
928
- const normalizedValue = normalizePassNumberValue(value);
929
-
930
- return normalizedValue.replace(/\d+$/, "").replace(/\s+/g, "").toUpperCase();
931
- }
932
-
933
- function syncPrefixFromSelection() {
934
- const selectedRangeOption = passRangeOptions.value.find(
935
- (item) => item.value === startRange.value
936
- );
937
- const fallbackOption = selectedRangeOption ?? passRangeOptions.value[0];
938
-
939
- prefixAndName.value = getPassNumberPrefix(
940
- fallbackOption?.text ?? fallbackOption?.value ?? ""
941
- );
942
- }
943
-
944
- function showMessage(msg: string, color: string) {
945
- message.value = msg;
946
- messageColor.value = color;
947
- messageSnackbar.value = true;
948
- }
949
-
950
- const searchTemplate = async (query: string) => {
839
+ // interset start
840
+
841
+ // const page = ref(1); // replace with your actual page value
842
+ // const totalNumberOfPagesTemplateList = ref(1); // replace with your actual total number of pages value
843
+
844
+ // const endIntersectTemplateList = async (isIntersecting) => {
845
+ // await getTemplateNameLists(page.value);
846
+ // if (isIntersecting && !isFetchingTemplates.value) {
847
+ // page.value += 1;
848
+ // await getTemplateNameLists(page.value);
849
+ // }
850
+ // };
851
+
852
+ // const getTemplateNameLists = async (page = 1, query = "") => {
853
+ // isFetchingTemplates.value = true;
854
+
855
+ // const result = await getTemplatesByPageSearch({
856
+ // sites: [route.params.site as string],
857
+ // limit: 10,
858
+ // page: page,
859
+ // statuses: ["active"],
860
+ // search: query,
861
+ // });
862
+
863
+ // totalNumberOfPagesTemplateList.value = result?.pages;
864
+ // if (result?.items.length) {
865
+ // const newItems = result?.items.map((item) => ({
866
+ // _id: item._id,
867
+ // name: item.name,
868
+ // prefixPass: item.prefixPass,
869
+ // prefixKey: item.prefixKey,
870
+ // }));
871
+
872
+ // if (page === 1) {
873
+ // newItems.unshift({ _id: null, name: "All" });
874
+ // newItems.push({ _id: "Manually Added", name: "Manually Added" });
875
+ // }
876
+
877
+ // // Only add new items if they don't already exist in the list
878
+ // newItems.forEach((newItem) => {
879
+ // if (!localTemplateList.value.find((item) => item._id === newItem._id)) {
880
+ // localTemplateList.value.push(newItem);
881
+ // }
882
+ // });
883
+ // }
884
+
885
+ // isFetchingTemplates.value = false;
886
+ // };
887
+
888
+ const searchTemplate = async (query) => {
951
889
  isFetchingTemplates.value = true;
952
890
 
953
891
  const result = await getTemplatesByPageSearch({
@@ -958,25 +896,34 @@ const searchTemplate = async (query: string) => {
958
896
  search: query,
959
897
  });
960
898
 
961
- templateOptions.value = getTemplateOptionItems(result?.items ?? []);
962
- templateOptions.value.unshift({ _id: null, name: "All" });
963
- templateOptions.value.push({ _id: "Manually Added", name: "Manually Added" });
899
+ if (result?.items.length) {
900
+ props.templateList = result?.items.map((item) => ({
901
+ _id: item._id,
902
+ name: item.name,
903
+ prefixPass: item.prefixPass,
904
+ prefixKey: item.prefixKey,
905
+ }));
906
+
907
+ props.templateList.unshift({ _id: null, name: "All" });
908
+ props.templateList.push({ _id: "Manually Added", name: "Manually Added" });
909
+ }
964
910
 
965
911
  isFetchingTemplates.value = false;
966
912
  };
913
+ //end intersect
967
914
 
968
915
  async function selectAllKeys() {
969
916
  if (selectAll.value) {
970
- selectedKeysToPrint.value = keyListResult.value?.items ?? [];
917
+ selectedKeysToPrint.value = resultKeys2.value?.items;
971
918
  } else {
972
919
  selectedKeysToPrint.value = [];
973
920
  }
974
921
  }
975
922
 
976
- const closeDialog = async (type?: string, tabType?: string) => {
923
+ const closeDialog = async (type?: string, tab?: string) => {
977
924
  await emit("update:close", false);
978
- if (type === "generate") {
979
- if (tabType === "pass") {
925
+ if (type == "generate") {
926
+ if (tab == "pass") {
980
927
  dialog.value = true;
981
928
  dialogType.value = "generate";
982
929
  generatePass.value = true;
@@ -988,23 +935,28 @@ const closeDialog = async (type?: string, tabType?: string) => {
988
935
  },
989
936
  });
990
937
  }
991
- resetPrintState();
938
+ selectedChoicePaperSizeOrientation.value = null;
939
+ resultKeys2.value = [];
992
940
  snackbarStartRange.value = false;
993
941
  }
994
942
  };
995
943
 
996
944
  const fetchTemplateData = async (inputStatus: any) => {
997
945
  isFetchingTemplates.value = true;
998
- resetPrintState();
946
+ selectedChoicePaperSizeOrientation.value = null;
947
+
948
+ startRange.value = null;
949
+ endRange.value = null;
950
+ resultKeys2.value = [];
999
951
 
1000
952
  const id = selectedTemplate.value
1001
953
  ? selectedTemplate.value?._id
1002
- : props.template?._id;
954
+ : props.template._id;
1003
955
 
1004
956
  const status = route.query.status as string;
1005
957
  const finalStatus =
1006
958
  typeof inputStatus === "string" ? inputStatus : String(inputStatus);
1007
- const site = route.params.site as string;
959
+ let site = route.params.site as string;
1008
960
  const data = await getTemplatesByPageSearch({
1009
961
  _id: id,
1010
962
  sites: [site],
@@ -1012,7 +964,7 @@ const fetchTemplateData = async (inputStatus: any) => {
1012
964
  statuses: [finalStatus ? finalStatus : status],
1013
965
  });
1014
966
 
1015
- templateQrCode.value = data?.items?.[0] ?? null;
967
+ templateQrCode.value = data?.items[0];
1016
968
 
1017
969
  isFetchingTemplates.value = false;
1018
970
  };
@@ -1020,44 +972,47 @@ const fetchTemplateData = async (inputStatus: any) => {
1020
972
  watch(
1021
973
  () => props.open,
1022
974
  async (newVal: any) => {
1023
- if (!newVal) return;
1024
-
1025
- selectAll.value = false;
1026
- selectedTemplate.value =
1027
- props.template?.name !== "All" ? props.template : null;
1028
-
1029
- if (isKeyTab.value) {
1030
- selectedKeysToPrint.value = [];
1031
- isFetchingPassKeys.value = true;
1032
- keyListResult.value = await getPassKeysByPageSearch({
1033
- sites: [route.params.site as string],
1034
- template: null,
1035
- passOrKey: tab.value,
1036
- passTypes: ["pass-key"],
1037
- sortBy: { column: "createdAt", order: "1" },
1038
- limit: 10,
1039
- });
1040
-
1041
- totalPages.value = keyListResult.value?.pages ?? 0;
1042
- isFetchingPassKeys.value = false;
1043
- } else {
1044
- selectedChoicePaperSizeOrientation.value = props.orientation;
1045
- await fetchTemplateData("active");
975
+ if (newVal) {
976
+ selectAll.value = false;
977
+ if (props.template.name !== "All") {
978
+ selectedTemplate.value = props.template;
979
+ } else {
980
+ selectedTemplate.value = null;
981
+ }
982
+ if (tab.value == "key") {
983
+ selectedKeysToPrint.value = [];
984
+ isFetchingPassKeys.value = true;
985
+ resultKeys2.value = await getPassKeysByPageSearch({
986
+ sites: [route.params.site as string],
987
+ template: null,
988
+ passOrKey: tab.value,
989
+ passTypes: ["pass-key"],
990
+ sortBy: { column: "createdAt", order: "1" },
991
+ limit: 10,
992
+ });
993
+
994
+ totalPages.value = resultKeys2.value.pages;
995
+ isFetchingPassKeys.value = false;
996
+ } else {
997
+ selectedChoicePaperSizeOrientation.value = props.orientation;
998
+ await fetchTemplateData("active");
999
+ }
1046
1000
  }
1047
1001
  },
1048
1002
  { immediate: true }
1049
1003
  );
1050
1004
 
1005
+ const router = useRouter();
1006
+
1051
1007
  const printContent = () => {
1052
- const printRangeStart = startRange.value?.toString() ?? "";
1053
- const printRangeEnd = endRange.value?.toString() ?? "";
1054
- const printOrientation = isPassTab.value
1055
- ? selectedChoicePaperSizeOrientation.value
1056
- : "KeyCard";
1008
+ const printRangeStart = startRange.value;
1009
+ const printRangeEnd = endRange.value;
1010
+ const printOrientation =
1011
+ tab.value !== "key" ? selectedChoicePaperSizeOrientation.value : "KeyCard";
1057
1012
  const status = (route.query.status as string) || "active";
1058
1013
  const templateParam =
1059
1014
  (route.query.template as string) || (selectedTemplate.value?._id as string);
1060
- const prefix = getPassNumberPrefix(prefixAndName.value);
1015
+ const prefix = prefixAndName.value;
1061
1016
 
1062
1017
  const url = router.resolve({
1063
1018
  name: "org-site-keys-visitor-printQr",
@@ -1073,89 +1028,121 @@ const printContent = () => {
1073
1028
  },
1074
1029
  }).href;
1075
1030
 
1076
- if (printOrientation === "KeyCard") {
1031
+ if (printOrientation == "KeyCard") {
1077
1032
  localStorage.setItem(
1078
1033
  "selectedKeysToPrint",
1079
1034
  JSON.stringify(selectedKeysToPrint.value)
1080
1035
  );
1081
1036
  }
1082
1037
 
1038
+ // Open the URL in a new tab
1083
1039
  setTimeout(() => {
1084
1040
  window.open(url, "_blank");
1085
1041
  }, 500);
1086
1042
  };
1087
1043
 
1088
1044
  watch(selectedChoicePaperSizeOrientation, async (newVal: any) => {
1089
- if (!isPassTab.value) return;
1090
- if (!newVal || !selectedTemplateId.value) {
1091
- passRangeOptions.value = [];
1092
- prefixAndName.value = "";
1093
- startRange.value = null;
1094
- endRange.value = null;
1095
- return;
1096
- }
1045
+ resultKeys2.value = [];
1046
+ const id = selectedTemplate.value
1047
+ ? selectedTemplate.value?._id
1048
+ : props.template._id;
1097
1049
 
1098
1050
  isFetchingPassKeys.value = true;
1099
1051
 
1100
1052
  resultPass.value = await getPassKeysByPageSearch({
1101
1053
  sites: [route.params.site as string],
1102
- template: selectedTemplateId.value,
1054
+ template: id,
1103
1055
  passOrKey: tab.value,
1104
1056
  passTypes: ["visitor-pass", "agent-pass", "contractor-pass"],
1105
1057
  limit: 2000,
1106
1058
  sortBy: { column: "prefixAndName", order: "1" },
1107
1059
  });
1108
1060
 
1109
- passRangeOptions.value = mapPassRangeItems(resultPass?.value?.items ?? []);
1061
+ resultKeys2.value = resultPass?.value.items.map((item: any) => ({
1062
+ text: item.prefixAndName,
1063
+ value: item.name,
1064
+ }));
1110
1065
 
1111
- if (passRangeOptions.value.length > 0) {
1112
- syncPrefixFromSelection();
1113
- } else {
1114
- prefixAndName.value = "";
1066
+ if (resultKeys2.value.length > 0) {
1067
+ prefixAndName.value = resultKeys2.value[0].text
1068
+ .replace(/\d/g, "")
1069
+ .toUpperCase();
1115
1070
  }
1116
1071
 
1117
- startRange.value = props.start?.toString() ?? null;
1118
- syncPrefixFromSelection();
1072
+ resultKeys2.value = resultPass?.value.items.map((item: any) => ({
1073
+ text: item.prefixAndName,
1074
+ value: item.name,
1075
+ }));
1076
+
1077
+ if (resultKeys2.value.length > 0) {
1078
+ prefixAndName.value = resultKeys2.value[0].text
1079
+ .replace(/\d/g, "")
1080
+ .toUpperCase();
1081
+ }
1082
+
1083
+ resultKeys2.value.sort(
1084
+ (firstItem: { value: string }, secondItem: { value: string }) => {
1085
+ const numericValueOfFirstItem = Number(
1086
+ firstItem.value.replace(/\D/g, "")
1087
+ );
1088
+ const numericValueOfSecondItem = Number(
1089
+ secondItem.value.replace(/\D/g, "")
1090
+ );
1091
+
1092
+ return numericValueOfFirstItem - numericValueOfSecondItem;
1093
+ }
1094
+ );
1095
+
1096
+ startRange.value = props.start.toString();
1119
1097
  isFetchingPassKeys.value = false;
1120
1098
  });
1121
1099
 
1100
+ const page = ref(1);
1101
+
1122
1102
  watch(startRange, (newVal: any, oldVal: any) => {
1123
1103
  if (newVal !== oldVal) {
1124
1104
  endRange.value = newVal;
1125
- syncPrefixFromSelection();
1126
1105
  }
1127
1106
  });
1128
1107
 
1129
1108
  const endRangeKeys = computed(() => {
1130
- return passRangeOptions.value.filter(
1131
- (item: PassRangeOption) => item.value >= (startRange.value ?? "")
1109
+ return resultKeys2.value.filter(
1110
+ (item: any) => item.value >= startRange.value
1132
1111
  );
1133
1112
  });
1113
+ const message = ref("");
1114
+ const messageColor = ref("");
1115
+ const messageSnackbar = ref(false);
1116
+
1117
+ function showMessage(msg: string, color: string) {
1118
+ message.value = msg;
1119
+ messageColor.value = color;
1120
+ messageSnackbar.value = true;
1121
+ }
1134
1122
 
1135
1123
  const showSnackbarEndRange = () => {
1136
- if (passRangeOptions.value.length === 0) {
1124
+ if (resultKeys2.value.length === 0) {
1137
1125
  showMessage(
1138
1126
  !startRange.value
1139
1127
  ? "Please select a start range first."
1140
- : `No ${
1141
- tab.value === "key" ? "Key" : "Pass"
1142
- } found. Please try to generate first.`,
1128
+ : `No ${tab.value == "key" ? "Key" : "Pass"} found. Please try to
1129
+ generate first.`,
1143
1130
  "error"
1144
1131
  );
1145
1132
  }
1146
1133
  };
1147
-
1148
1134
  const showSnackbarStartRange = () => {
1149
- if (passRangeOptions.value.length === 0) {
1135
+ if (resultKeys2.value.length === 0) {
1150
1136
  snackbarStartRange.value = true;
1151
1137
  }
1152
1138
  };
1153
1139
 
1140
+ // if print key
1154
1141
  async function onSearch() {
1155
1142
  isFetchingPassKeys.value = true;
1156
1143
  try {
1157
1144
  page.value = 1;
1158
- keyListResult.value = await getPassKeysByPageSearch({
1145
+ resultKeys2.value = await getPassKeysByPageSearch({
1159
1146
  sites: [route.params.site as string],
1160
1147
  search: searchKey.value,
1161
1148
  template: null,
@@ -1165,8 +1152,8 @@ async function onSearch() {
1165
1152
  sortBy: { column: "createdAt", order: "1" },
1166
1153
  page: page.value,
1167
1154
  });
1168
- totalPages.value = keyListResult.value?.pages ?? 0;
1169
- } catch (error: any) {
1155
+ totalPages.value = resultKeys2.value.pages;
1156
+ } catch (error) {
1170
1157
  showMessage(errorConverter(error), "error");
1171
1158
  } finally {
1172
1159
  isFetchingPassKeys.value = false;
@@ -1175,7 +1162,7 @@ async function onSearch() {
1175
1162
 
1176
1163
  async function updateItemsPerPage() {
1177
1164
  isFetchingPassKeys.value = true;
1178
- keyListResult.value = await getPassKeysByPageSearch({
1165
+ resultKeys2.value = await getPassKeysByPageSearch({
1179
1166
  sites: [route.params.site as string],
1180
1167
  template: null,
1181
1168
  passOrKey: "key",
@@ -1184,14 +1171,14 @@ async function updateItemsPerPage() {
1184
1171
  page: page.value,
1185
1172
  limit: selectedPageRange.value,
1186
1173
  });
1187
- totalPages.value = keyListResult.value?.pages ?? 0;
1174
+ totalPages.value = resultKeys2.value.pages;
1188
1175
  isFetchingPassKeys.value = false;
1189
1176
  }
1190
1177
 
1191
1178
  async function prevPage() {
1192
1179
  isFetchingPassKeys.value = true;
1193
1180
  page.value -= 1;
1194
- keyListResult.value = await getPassKeysByPageSearch({
1181
+ resultKeys2.value = await getPassKeysByPageSearch({
1195
1182
  sites: [route.params.site as string],
1196
1183
  search: searchKey.value,
1197
1184
  template: null,
@@ -1202,14 +1189,14 @@ async function prevPage() {
1202
1189
  limit: selectedPageRange.value,
1203
1190
  });
1204
1191
 
1205
- totalPages.value = keyListResult.value?.pages ?? 0;
1192
+ totalPages.value = resultKeys2.value.pages;
1206
1193
  isFetchingPassKeys.value = false;
1207
1194
  }
1208
1195
 
1209
1196
  async function nextPage() {
1210
1197
  isFetchingPassKeys.value = true;
1211
1198
  page.value += 1;
1212
- keyListResult.value = await getPassKeysByPageSearch({
1199
+ resultKeys2.value = await getPassKeysByPageSearch({
1213
1200
  sites: [route.params.site as string],
1214
1201
  search: searchKey.value,
1215
1202
  template: null,
@@ -1220,7 +1207,7 @@ async function nextPage() {
1220
1207
  limit: selectedPageRange.value,
1221
1208
  });
1222
1209
 
1223
- totalPages.value = keyListResult.value?.pages ?? 0;
1210
+ totalPages.value = resultKeys2.value.pages;
1224
1211
  isFetchingPassKeys.value = false;
1225
1212
  }
1226
1213
  </script>
@@ -163,7 +163,7 @@
163
163
  @refresh="refreshSiteData"
164
164
  />
165
165
  <v-divider class="my-4" />
166
- <HidQrCodeConfiguration :site="siteId" :org="orgId" />
166
+ <HidQrCodeConfiguration :site="siteId" />
167
167
  </v-expansion-panel-text>
168
168
  </v-expansion-panel>
169
169
 
@@ -266,9 +266,7 @@ const { data: siteData, refresh: refreshSiteData } = await useLazyAsyncData(
266
266
  `site-${props.siteId}`,
267
267
  () => getSiteById(props.siteId)
268
268
  );
269
- const orgId = computed(
270
- () => props.orgId || String((siteData.value as TSite | null)?.orgId ?? "")
271
- );
269
+ const orgId = computed(() => props.orgId || String((siteData.value as any)?.orgId ?? ""));
272
270
 
273
271
  watch(
274
272
  siteData,