@7365admin1/layer-common 3.0.7 → 3.0.9

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 (39) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/components/CameraMain.vue +17 -1
  3. package/components/DashboardMain.vue +1854 -848
  4. package/components/EntryPassInformation.vue +60 -0
  5. package/components/HidAccessLogDashboard.vue +1691 -0
  6. package/components/HidEnabledGate.vue +51 -0
  7. package/components/HidIdentityMapping.vue +975 -0
  8. package/components/HidQrCodeConfiguration.vue +618 -0
  9. package/components/HidReaderForm.vue +246 -0
  10. package/components/HidReaderManagement.vue +1233 -0
  11. package/components/HidServiceSettingsPanel.vue +150 -0
  12. package/components/HidUserEnrollment.vue +1274 -0
  13. package/components/Layout/NavigationDrawer.vue +31 -1
  14. package/components/MemberInformation.vue +23 -15
  15. package/components/NavigationItem.vue +11 -4
  16. package/components/OnlineFormFill.vue +34 -0
  17. package/components/PassInformation.vue +73 -34
  18. package/components/SiteSettings.vue +60 -116
  19. package/components/VisitorForm.vue +815 -290
  20. package/components/VisitorFormSelection.vue +12 -2
  21. package/components/VisitorManagement.vue +652 -205
  22. package/composables/useCommonPermission.ts +59 -0
  23. package/composables/useDashboard.ts +46 -1
  24. package/composables/useHidAmico.ts +152 -0
  25. package/composables/useHidNavigation.ts +106 -0
  26. package/composables/useMember.ts +7 -1
  27. package/composables/useOptionalServices.ts +118 -0
  28. package/composables/useSettingsPermission.ts +138 -0
  29. package/composables/useSiteSettings.ts +1 -1
  30. package/composables/useUser.ts +1 -2
  31. package/nuxt.config.ts +1 -1
  32. package/package.json +3 -2
  33. package/pages/[org]/[site]/access-mgmt/access-logs/index.vue +21 -0
  34. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +21 -0
  35. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +21 -0
  36. package/pages/[org]/[site]/access-mgmt/hid-users/index.vue +21 -0
  37. package/pages/[org]/[site]/access-mgmt/identity-mapping/index.vue +21 -0
  38. package/types/local.d.ts +2 -1
  39. package/types/visitor.d.ts +4 -2
@@ -0,0 +1,138 @@
1
+ import { useCommonPermissions } from "./useCommonPermission";
2
+
3
+ export function useSettingsPermission() {
4
+ const { hasPermission } = usePermission();
5
+ const { siteSettingsPermissions: permissions } = useCommonPermissions();
6
+ const { userAppRole } = useLocalSetup();
7
+
8
+ const canManageSiteInformation = computed(() => {
9
+ if (!userAppRole.value) return true;
10
+ if (userAppRole.value.permissions.includes("*")) return true;
11
+ return hasPermission(
12
+ userAppRole.value,
13
+ permissions,
14
+ "site-settings",
15
+ "manage-site-information",
16
+ );
17
+ });
18
+ const canManageANPRCamera = computed(() => {
19
+ if (!userAppRole.value) return true;
20
+ if (userAppRole.value.permissions.includes("*")) return true;
21
+ return hasPermission(
22
+ userAppRole.value,
23
+ permissions,
24
+ "site-settings",
25
+ "manage-anpr-camera",
26
+ );
27
+ });
28
+ const canManageCCTVCamera = computed(() => {
29
+ if (!userAppRole.value) return true;
30
+ if (userAppRole.value.permissions.includes("*")) return true;
31
+ return hasPermission(
32
+ userAppRole.value,
33
+ permissions,
34
+ "site-settings",
35
+ "manage-cctv-camera",
36
+ );
37
+ });
38
+ const canManageDeliveryCompanies = computed(() => {
39
+ if (!userAppRole.value) return true;
40
+ if (userAppRole.value.permissions.includes("*")) return true;
41
+ return hasPermission(
42
+ userAppRole.value,
43
+ permissions,
44
+ "site-settings",
45
+ "manage-delivery-companies",
46
+ );
47
+ });
48
+ const canManageResidentVisitors = computed(() => {
49
+ if (!userAppRole.value) return true;
50
+ if (userAppRole.value.permissions.includes("*")) return true;
51
+ return hasPermission(
52
+ userAppRole.value,
53
+ permissions,
54
+ "site-settings",
55
+ "manage-resident-visitors",
56
+ );
57
+ });
58
+ const canManageWorkOrderSettings = computed(() => {
59
+ if (!userAppRole.value) return true;
60
+ if (userAppRole.value.permissions.includes("*")) return true;
61
+ return hasPermission(
62
+ userAppRole.value,
63
+ permissions,
64
+ "site-settings",
65
+ "manage-work-order-settings",
66
+ );
67
+ });
68
+ const canManageBillingAndSOAConfiguration = computed(() => {
69
+ if (!userAppRole.value) return true;
70
+ if (userAppRole.value.permissions.includes("*")) return true;
71
+ return hasPermission(
72
+ userAppRole.value,
73
+ permissions,
74
+ "site-settings",
75
+ "manage-billing-and-soa-configuration",
76
+ );
77
+ });
78
+ const canManageNFCManagement = computed(() => {
79
+ if (!userAppRole.value) return true;
80
+ if (userAppRole.value.permissions.includes("*")) return true;
81
+ return hasPermission(
82
+ userAppRole.value,
83
+ permissions,
84
+ "site-settings",
85
+ "manage-nfc-management",
86
+ );
87
+ });
88
+ const canManageNFCPatrolSettings = computed(() => {
89
+ if (!userAppRole.value) return true;
90
+ if (userAppRole.value.permissions.includes("*")) return true;
91
+ return hasPermission(
92
+ userAppRole.value,
93
+ permissions,
94
+ "site-settings",
95
+ "manage-nfc-patrol-settings",
96
+ );
97
+ });
98
+ const canManageEntryPass = computed(() => {
99
+ if (!userAppRole.value) return true;
100
+ if (userAppRole.value.permissions.includes("*")) return true;
101
+ return hasPermission(
102
+ userAppRole.value,
103
+ permissions,
104
+ "site-settings",
105
+ "manage-entry-pass",
106
+ );
107
+ });
108
+ const canManageRedDotSettings = computed(() => {
109
+ if (!userAppRole.value) return true;
110
+ if (userAppRole.value.permissions.includes("*")) return true;
111
+ return hasPermission(
112
+ userAppRole.value,
113
+ permissions,
114
+ "site-settings",
115
+ "manage-red-dot-settings",
116
+ );
117
+ });
118
+
119
+ const canManageSiteSettings = computed(() => {
120
+ return canManageSiteInformation.value || canManageANPRCamera.value || canManageCCTVCamera.value || canManageDeliveryCompanies.value || canManageResidentVisitors.value || canManageWorkOrderSettings.value || canManageBillingAndSOAConfiguration.value || canManageNFCManagement.value || canManageNFCPatrolSettings.value || canManageEntryPass.value || canManageRedDotSettings.value
121
+ })
122
+
123
+ return {
124
+ canManageSiteInformation,
125
+ canManageANPRCamera,
126
+ canManageCCTVCamera,
127
+ canManageDeliveryCompanies,
128
+ canManageResidentVisitors,
129
+ canManageWorkOrderSettings,
130
+ canManageBillingAndSOAConfiguration,
131
+ canManageNFCManagement,
132
+ canManageNFCPatrolSettings,
133
+ canManageEntryPass,
134
+ canManageRedDotSettings,
135
+ canManageSiteSettings
136
+
137
+ };
138
+ }
@@ -38,7 +38,7 @@ export default function () {
38
38
  }
39
39
  async function updateSitebyId(
40
40
  siteId: string,
41
- payload: { field?: string; value?: number, deliveryCompanyList?: string[] }
41
+ payload: Record<string, any>
42
42
  ) {
43
43
  return await useNuxtApp().$api<Record<string, any>>(
44
44
  `/api/sites/id/${siteId}`,
@@ -123,13 +123,12 @@ export default function useUser() {
123
123
 
124
124
  function getUsers({
125
125
  status = "active",
126
- type = "",
127
126
  search = "",
128
127
  page = 1,
129
128
  } = {}) {
130
129
  return useNuxtApp().$api<Record<string, any>>("/api/users", {
131
130
  method: "GET",
132
- query: { status, search, page, type },
131
+ query: { status, search, page },
133
132
  });
134
133
  }
135
134
 
package/nuxt.config.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import vuetify, { transformAssetUrls } from "vite-plugin-vuetify";
3
3
  export default defineNuxtConfig({
4
4
  ssr: false,
5
- devtools: { enabled: true },
5
+ devtools: { enabled: false },
6
6
  build: {
7
7
  transpile: ["vuetify"],
8
8
  },
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.7",
5
+ "version": "3.0.9",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -32,7 +32,7 @@
32
32
  "@iconify/vue": "^5.0.0",
33
33
  "@mdi/font": "^7.4.47",
34
34
  "@types/qrcode": "^1.5.6",
35
- "ckeditor5": "^47.2.0",
35
+ "ckeditor5": "47.4.0",
36
36
  "html2pdf.js": "^0.10.2",
37
37
  "html5-qrcode": "^2.3.8",
38
38
  "moment-timezone": "^0.6.0",
@@ -46,6 +46,7 @@
46
46
  "zod": "^3.24.2"
47
47
  },
48
48
  "resolutions": {
49
+ "lodash-es": "4.17.21",
49
50
  "rollup-plugin-visualizer": "6.0.11"
50
51
  }
51
52
  }
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <HidEnabledGate
4
+ :site="siteId"
5
+ :org="orgId"
6
+ message="Enable HID as a service for this site before viewing access logs."
7
+ >
8
+ <HidAccessLogDashboard :site="siteId" />
9
+ </HidEnabledGate>
10
+ </v-container>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ definePageMeta({
15
+ layout: "default",
16
+ });
17
+
18
+ const route = useRoute();
19
+ const siteId = computed(() => String(route.params.site ?? ""));
20
+ const orgId = computed(() => String(route.params.org ?? ""));
21
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <HidEnabledGate
4
+ :site="siteId"
5
+ :org="orgId"
6
+ message="Enable HID as a service for this site before managing HID administrators."
7
+ >
8
+ <HidUserEnrollment :site="siteId" identity-type="admin" />
9
+ </HidEnabledGate>
10
+ </v-container>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ definePageMeta({
15
+ layout: "default",
16
+ });
17
+
18
+ const route = useRoute();
19
+ const siteId = computed(() => String(route.params.site ?? ""));
20
+ const orgId = computed(() => String(route.params.org ?? ""));
21
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <HidEnabledGate
4
+ :site="siteId"
5
+ :org="orgId"
6
+ message="Enable HID as a service for this site before managing HID readers."
7
+ >
8
+ <HidReaderManagement :site="siteId" />
9
+ </HidEnabledGate>
10
+ </v-container>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ definePageMeta({
15
+ layout: "default",
16
+ });
17
+
18
+ const route = useRoute();
19
+ const siteId = computed(() => String(route.params.site ?? ""));
20
+ const orgId = computed(() => String(route.params.org ?? ""));
21
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <HidEnabledGate
4
+ :site="siteId"
5
+ :org="orgId"
6
+ message="Enable HID as a service for this site before managing HID users."
7
+ >
8
+ <HidUserEnrollment :site="siteId" />
9
+ </HidEnabledGate>
10
+ </v-container>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ definePageMeta({
15
+ layout: "default",
16
+ });
17
+
18
+ const route = useRoute();
19
+ const siteId = computed(() => String(route.params.site ?? ""));
20
+ const orgId = computed(() => String(route.params.org ?? ""));
21
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <HidEnabledGate
4
+ :site="siteId"
5
+ :org="orgId"
6
+ message="Enable HID as a service for this site before mapping identities."
7
+ >
8
+ <HidIdentityMapping :site="siteId" :org="orgId" />
9
+ </HidEnabledGate>
10
+ </v-container>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ definePageMeta({
15
+ layout: "default",
16
+ });
17
+
18
+ const route = useRoute();
19
+ const siteId = computed(() => String(route.params.site ?? ""));
20
+ const orgId = computed(() => String(route.params.org ?? ""));
21
+ </script>
package/types/local.d.ts CHANGED
@@ -5,7 +5,8 @@ declare type TToken = {
5
5
  };
6
6
 
7
7
  declare type TNavigationRoute = {
8
- name: string;
8
+ name?: string;
9
+ path?: string;
9
10
  params?: TKeyValuePair;
10
11
  query?: TKeyValuePair;
11
12
  };
@@ -31,6 +31,7 @@ declare type TVisitor = {
31
31
  passKeys?: TPassKeyPayload[];
32
32
  checkInRemarks?: string;
33
33
  checkOutRemarks?: string;
34
+ createdBy?: string;
34
35
  };
35
36
 
36
37
  declare type TVisitorType =
@@ -66,6 +67,7 @@ declare type TVisitorPayload = Pick<
66
67
  | "passKeys"
67
68
  | "checkInRemarks"
68
69
  | "checkOutRemarks"
70
+ | "createdBy"
69
71
  > & {
70
72
  members?: TMemberInfo[];
71
73
  };
@@ -80,8 +82,8 @@ declare type TMemberInfo = {
80
82
  nric: string;
81
83
  visitorPass?: { keyId: string }[];
82
84
  passKeys?: TPassKeyPayload[];
83
- contact: string
84
- }
85
+ contact: string;
86
+ };
85
87
 
86
88
  declare type TPassKeyPayload = {
87
89
  keyId: string;