@7365admin1/layer-common 3.0.6 → 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
  }
@@ -17,12 +17,16 @@ export default function () {
17
17
 
18
18
  function getDashboardHygieneWeeklyActivity(
19
19
  site = "",
20
- serviceType: TServiceType = "cleaning_services"
20
+ serviceType: TServiceType = "cleaning_services",
21
+ period?: TDashboardValues
21
22
  ) {
22
23
  return useNuxtApp().$api<THygieneWeeklyActivityItem[]>(
23
24
  `/api/dashboard/serviceType/${serviceType}/site/${site}/weekly-activity`,
24
25
  {
25
26
  method: "GET",
27
+ query: {
28
+ period,
29
+ },
26
30
  }
27
31
  );
28
32
  }
@@ -80,11 +84,49 @@ export default function () {
80
84
  );
81
85
  }
82
86
 
87
+ function getDashboardPropertyManagement(
88
+ site = "",
89
+ period: TDashboardValues = "today",
90
+ type = "",
91
+ facility = ""
92
+ ) {
93
+ return useNuxtApp().$api<Record<string, any>>(
94
+ `/api/dashboard/serviceType/property_management_agency/site/${site}`,
95
+ {
96
+ method: "GET",
97
+ query: {
98
+ period,
99
+ ...(type ? { type } : {}),
100
+ ...(facility ? { facility } : {}),
101
+ },
102
+ }
103
+ );
104
+ }
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
+
83
123
  return {
84
124
  getDashboardHygiene,
85
125
  getDashboardHygieneWeeklyActivity,
86
126
  getDashboardHygieneTaskSchedule,
87
127
  getDashboardHygieneAttendance,
88
128
  getDashboardHygieneFeedbacks,
129
+ getDashboardPropertyManagement,
130
+ getDashboardSecurity,
89
131
  };
90
132
  }
@@ -46,22 +46,32 @@ export default function useOnlineForm() {
46
46
  query: { id },
47
47
  });
48
48
  }
49
+ function getFormEntryById(id: string) {
50
+ return useNuxtApp().$api<Record<string, any>>(`/api/form-entries/id/${id}`, {
51
+ method: "GET",
52
+ });
53
+ }
54
+ function updateFormEntryById(id: string, value: any) {
55
+ return useNuxtApp().$api<Record<string, any>>(`/api/form-entries/id/${id}`, {
56
+ method: "PUT",
57
+ body: value,
58
+ });
59
+ }
49
60
  function getAllBySiteId(
50
61
  siteId: string,
51
- { page = 1, search = "", limit = 10, status = "active" }
62
+ { page = 1, search = "", limit = 10, status = "", org = "" } = {}
52
63
  ) {
53
- return useNuxtApp().$api<Record<string, any>>(
54
- `/api/online-forms/site/${siteId}`,
55
- {
56
- method: "GET",
57
- query: {
58
- page,
59
- search,
60
- limit,
61
- status,
62
- },
63
- }
64
- );
64
+ return useNuxtApp().$api<Record<string, any>>(`/api/form-entries`, {
65
+ method: "GET",
66
+ query: {
67
+ page,
68
+ search,
69
+ limit,
70
+ status,
71
+ org,
72
+ site: siteId,
73
+ },
74
+ });
65
75
  }
66
76
  return {
67
77
  getAll,
@@ -70,5 +80,7 @@ export default function useOnlineForm() {
70
80
  updateOnlineFormById,
71
81
  deleteOnlineFormById,
72
82
  getAllBySiteId,
83
+ getFormEntryById,
84
+ updateFormEntryById,
73
85
  };
74
86
  }
@@ -17,7 +17,7 @@ export type FormBlock =
17
17
  | { type: "address"; to: string }
18
18
  | { type: "row"; fields: FormFieldDef[] }
19
19
  | { type: "field"; field: FormFieldDef }
20
- | { type: "checkbox-group"; title?: string; items: CheckboxItemDef[] }
20
+ | { type: "checkbox-group"; title?: string; single?: boolean; items: CheckboxItemDef[] }
21
21
  | { type: "paragraph"; text: string }
22
22
  | { type: "section-header"; text: string }
23
23
  | { type: "divider" }
@@ -506,7 +506,7 @@ const formPages: Record<string, FormDefinition> = {
506
506
  },
507
507
 
508
508
  "Application for Booking of Rooftop Bar/Dining": {
509
- title: "APPLICATION FOR BOOKING OF ROOFTOP BAR/DINNING",
509
+ title: "APPLICATION FOR BOOKING OF ROOFTOP BAR/DINING",
510
510
  blocks: [
511
511
  { type: "address", to: "{siteName}" },
512
512
  { type: "row", fields: [
@@ -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.6",
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",
@@ -30,6 +30,7 @@ declare type TDashboardMetric = {
30
30
  outOfStock?: number;
31
31
  completed?: number;
32
32
  total?: number;
33
+ items?: { name: string; qty: number }[];
33
34
  };
34
35
 
35
36
  declare type THygieneDashboardData = {
@@ -74,4 +75,3 @@ declare type THygienePaginatedResponse<T> = {
74
75
  pages: number;
75
76
  pageRange: string;
76
77
  };
77
-
@@ -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;