@7365admin1/layer-common 3.0.7 → 3.0.8

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.
@@ -221,6 +221,64 @@ export function useCommonPermissions() {
221
221
  },
222
222
  }
223
223
 
224
+ const siteSettingsPermissions: Record<string, TPermission> = {
225
+ "manage-site-information": {
226
+ check: true,
227
+ description:
228
+ "Allows the user to manage site information.",
229
+ },
230
+ "manage-anpr-camera": {
231
+ check: true,
232
+ description:
233
+ "Allows the user to manage ANPR camera settings.",
234
+ },
235
+ "manage-cctv-camera": {
236
+ check: true,
237
+ description:
238
+ "Allows the user to manage CCTV camera settings.",
239
+ },
240
+ "manage-delivery-companies": {
241
+ check: true,
242
+ description:
243
+ "Allows the user to manage delivery companies.",
244
+ },
245
+ "manage-resident-visitors": {
246
+ check: true,
247
+ description:
248
+ "Allows the user to manage resident visitors.",
249
+ },
250
+ "manage-work-order-settings": {
251
+ check: true,
252
+ description: "Allows the user to manage work order settings.",
253
+ },
254
+ "manage-billing-and-soa-configuration": {
255
+ check: true,
256
+ description:
257
+ "Allows the user to manage billing and SOA configuration.",
258
+ },
259
+ "manage-nfc-management": {
260
+ check: true,
261
+ description:
262
+ "Allows the user to manage NFC management.",
263
+ },
264
+ "manage-nfc-patrol-settings": {
265
+ check: true,
266
+ description:
267
+ "Allows the user to manage NFC patrol settings.",
268
+ },
269
+ "manage-entry-pass": {
270
+ check: true,
271
+ description:
272
+ "Allows the user to manage entry passes.",
273
+ },
274
+ "manage-red-dot-settings": {
275
+ check: true,
276
+ description:
277
+ "Allows the user to manage red dot settings.",
278
+ },
279
+
280
+ }
281
+
224
282
  return {
225
283
  invitationPermissions,
226
284
  memberPermissions,
@@ -231,5 +289,6 @@ export function useCommonPermissions() {
231
289
  buildingManagementPermissions,
232
290
  buildingUnitManagementPermissions,
233
291
  bulletinBoardPermissions,
292
+ siteSettingsPermissions
234
293
  };
235
294
  }
@@ -103,6 +103,23 @@ export default function () {
103
103
  );
104
104
  }
105
105
 
106
+ function getDashboardSecurity(
107
+ site = "",
108
+ period: TDashboardValues = "today",
109
+ type = ""
110
+ ) {
111
+ return useNuxtApp().$api<Record<string, any>>(
112
+ `/api/dashboard/serviceType/security_agency/site/${site}`,
113
+ {
114
+ method: "GET",
115
+ query: {
116
+ period,
117
+ ...(type ? { type } : {}),
118
+ },
119
+ }
120
+ );
121
+ }
122
+
106
123
  return {
107
124
  getDashboardHygiene,
108
125
  getDashboardHygieneWeeklyActivity,
@@ -110,5 +127,6 @@ export default function () {
110
127
  getDashboardHygieneAttendance,
111
128
  getDashboardHygieneFeedbacks,
112
129
  getDashboardPropertyManagement,
130
+ getDashboardSecurity,
113
131
  };
114
132
  }
@@ -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
+ }
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.8",
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",
@@ -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;