@7365admin1/layer-common 1.10.9 → 1.10.10

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.
@@ -0,0 +1,48 @@
1
+ import { useCommonPermissions } from "./useCommonPermission";
2
+
3
+ export function useBulletinBoardPermission() {
4
+ const { hasPermission } = usePermission();
5
+ const { bulletinBoardPermissions: permissions } = useCommonPermissions();
6
+
7
+ const { userAppRole } = useLocalSetup();
8
+
9
+ const canViewBulletinBoard = computed(() => {
10
+ if (!userAppRole.value) return true;
11
+ if (userAppRole.value.permissions.includes("*")) return true;
12
+ return hasPermission(userAppRole.value, permissions, "bulletin-board", "see-all-bulletin-boards");
13
+ });
14
+
15
+ const canCreateBulletinBoard = computed(() => {
16
+ if (!userAppRole.value) return true;
17
+ if (userAppRole.value.permissions.includes("*")) return true;
18
+ return hasPermission(userAppRole.value, permissions, "bulletin-board", "add-bulletin-board");
19
+ });
20
+
21
+ const canUpdateBulletinBoard = computed(() => {
22
+ if (!userAppRole.value) return true;
23
+ if (userAppRole.value.permissions.includes("*")) return true;
24
+ return hasPermission(userAppRole.value, permissions, "bulletin-board", "update-bulletin-board");
25
+ });
26
+
27
+ const canViewBulletinBoardDetails = computed(() => {
28
+ if (!userAppRole.value) return true;
29
+ if (userAppRole.value.permissions.includes("*")) return true;
30
+ return hasPermission(userAppRole.value, permissions, "bulletin-board", "see-bulletin-board-details");
31
+ });
32
+
33
+
34
+
35
+ const canDeleteBulletinBoard = computed(() => {
36
+ if (!userAppRole.value) return true;
37
+ if (userAppRole.value.permissions.includes("*")) return true;
38
+ return hasPermission(userAppRole.value, permissions, "bulletin-board", "delete-bulletin-board");
39
+ });
40
+
41
+ return {
42
+ canViewBulletinBoard,
43
+ canCreateBulletinBoard,
44
+ canUpdateBulletinBoard,
45
+ canViewBulletinBoardDetails,
46
+ canDeleteBulletinBoard,
47
+ };
48
+ }
@@ -5,6 +5,7 @@ export default function useCleaningPermission() {
5
5
  feedbackPermissions,
6
6
  workOrderPermissions,
7
7
  invitationPermissions,
8
+ bulletinBoardPermissions,
8
9
  } = useCommonPermissions();
9
10
  const permissions: TPermissions = {
10
11
  members: memberPermissions,
@@ -12,6 +13,7 @@ export default function useCleaningPermission() {
12
13
  work_order: workOrderPermissions,
13
14
  roles: rolePermissions,
14
15
  invitations: invitationPermissions,
16
+ "bulletin-board": bulletinBoardPermissions,
15
17
  inventory: {
16
18
  "view-inventory": {
17
19
  check: true,
@@ -192,8 +192,35 @@ export function useCommonPermissions() {
192
192
  description:
193
193
  "Allows the user to remove a building unit from the system permanently.",
194
194
  },
195
+
195
196
  };
196
197
 
198
+
199
+ const bulletinBoardPermissions: Record<string, TPermission> = {
200
+ "add-bulletin-board": {
201
+ check: true,
202
+ description: "Allows the user to add a new bulletin board to the system.",
203
+ },
204
+ "see-all-bulletin-boards": {
205
+ check: true,
206
+ description: "Allows the user to view the list of all bulletin boards.",
207
+ },
208
+ "see-bulletin-board-details": {
209
+ check: true,
210
+ description:
211
+ "Allows the user to view the details of a specific bulletin board.",
212
+ },
213
+ "update-bulletin-board": {
214
+ check: true,
215
+ description: "Allows the user to update bulletin board details.",
216
+ },
217
+ "delete-bulletin-board": {
218
+ check: true,
219
+ description:
220
+ "Allows the user to remove a bulletin board from the system permanently.",
221
+ },
222
+ }
223
+
197
224
  return {
198
225
  invitationPermissions,
199
226
  memberPermissions,
@@ -202,6 +229,7 @@ export function useCommonPermissions() {
202
229
  workOrderPermissions,
203
230
  visitorManagementPermissions,
204
231
  buildingManagementPermissions,
205
- buildingUnitManagementPermissions
232
+ buildingUnitManagementPermissions,
233
+ bulletinBoardPermissions,
206
234
  };
207
235
  }
@@ -1,5 +1,6 @@
1
1
  export default function useFile() {
2
2
  const baseUrl = useRuntimeConfig().public.API_DO_STORAGE_ENDPOINT;
3
+ const baseUrlAnpr = useRuntimeConfig().public.API_DO_STORAGE_ENDPOINT_ANPR;
3
4
 
4
5
  function addFile(file: File | null) {
5
6
  if (!file) {
@@ -19,6 +20,10 @@ export default function useFile() {
19
20
  return `${baseUrl}/${id}`;
20
21
  }
21
22
 
23
+ function getFileUrlAnpr(id: string) {
24
+ return `${baseUrlAnpr}/${id}`;
25
+ }
26
+
22
27
  async function urlToFile(url: string, filename: string): Promise<File> {
23
28
  const response = await fetch(url);
24
29
  const blob = await response.blob();
@@ -49,5 +54,6 @@ export default function useFile() {
49
54
  urlToFile,
50
55
  getFileUrl,
51
56
  getFileById,
57
+ getFileUrlAnpr
52
58
  };
53
59
  }
@@ -38,7 +38,7 @@ export default function () {
38
38
  }
39
39
  async function updateSitebyId(
40
40
  siteId: string,
41
- payload: { field: string; value: number }
41
+ payload: { field?: string; value?: number, deliveryCompanyList?: string[] }
42
42
  ) {
43
43
  return await useNuxtApp().$api<Record<string, any>>(
44
44
  `/api/sites/id/${siteId}`,
@@ -13,11 +13,11 @@ export default function () {
13
13
  { label: "Drop-Off", value: "drop-off" },
14
14
  ];
15
15
 
16
- const typeFieldMap: Record<TVisitorType, (keyof TVisitorPayload)[]> = {
16
+ const typeFieldMap: Record<TVisitorType, (keyof TVisitorPayload | 'delivery-company')[]> = {
17
17
  guest: ['name', 'nric', 'contact', 'block', 'plateNumber', 'level', 'unit' , 'unitName', 'remarks'],
18
18
  contractor: ['contractorType', 'name', 'nric', 'company', 'contact', 'plateNumber', 'block', 'level', 'unit', 'unitName', 'remarks'],
19
19
  'walk-in': ['name', 'company', 'nric', 'contact', 'block', 'level', 'unit' , 'unitName', 'remarks'],
20
- delivery: ['attachments', 'name', 'deliveryType', 'company', 'nric', 'contact', 'plateNumber', 'block', 'level', 'unit' , 'unitName', 'remarks'],
20
+ delivery: ['attachments', 'name', 'deliveryType', 'delivery-company', 'nric', 'contact', 'plateNumber', 'block', 'level', 'unit' , 'unitName', 'remarks'],
21
21
  'pick-up': ['plateNumber', 'block', 'remarks'],
22
22
  'drop-off': ['plateNumber', 'block', 'remarks'],
23
23
  }
@@ -33,7 +33,7 @@ export default function () {
33
33
  type GetVisitorsParams = {
34
34
  page?: number
35
35
  limit?: number
36
- // sort?: "asc" | "desc"
36
+ order?: "asc" | "desc"
37
37
  search?: string
38
38
  org?: string
39
39
  site?: string
@@ -48,7 +48,7 @@ export default function () {
48
48
  async function getVisitors({
49
49
  page = 1,
50
50
  limit = 10,
51
- // sort = "asc",
51
+ order = "desc",
52
52
  search = "",
53
53
  org = "",
54
54
  site = "",
@@ -75,7 +75,8 @@ export default function () {
75
75
  type,
76
76
  status,
77
77
  checkedOut,
78
- plateNumber
78
+ plateNumber,
79
+ order
79
80
  },
80
81
  }
81
82
  );
@@ -0,0 +1,12 @@
1
+ export const APP_CONSTANTS = {
2
+ PROPERTY_MANAGEMENT: "property_management_agency",
3
+ HYGIENE: "cleaning_services",
4
+ SECURITY: "security_agency",
5
+ MECHANICAL_ELECTRICAL: "mechanical_electrical",
6
+ RESIDENT: "resident",
7
+ LANDSCAPING: "landscaping_services",
8
+ PEST_CONTROL: "pest_control_services",
9
+ POOL_MAINTENANCE: "pool_maintenance_services"
10
+
11
+
12
+ }
package/nuxt.config.ts CHANGED
@@ -17,6 +17,8 @@ export default defineNuxtConfig({
17
17
  APP: (process.env.APP as string) ?? "App",
18
18
  API_DO_STORAGE_ENDPOINT:
19
19
  (process.env.API_DO_STORAGE_ENDPOINT as string) ?? "",
20
+ API_DO_STORAGE_ENDPOINT_ANPR:
21
+ (process.env.API_DO_STORAGE_ENDPOINT_ANPR as string) ?? "",
20
22
  APP_NAME: (process.env.APP_NAME as string) ?? "App",
21
23
  APP_NAME_ROUTE: (process.env.APP_NAME_ROUTE as string) ?? "index",
22
24
  APP_MAIN: (process.env.APP_MAIN as string) ?? "",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.10.9",
5
+ "version": "1.10.10",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -38,6 +38,7 @@
38
38
  "qrcode": "^1.5.4",
39
39
  "qrcode.vue": "^3.4.1",
40
40
  "sass": "^1.80.6",
41
+ "vue-draggable-next": "^2.3.0",
41
42
  "vue3-signature": "^0.2.4",
42
43
  "zod": "^3.24.2"
43
44
  }
@@ -0,0 +1,5 @@
1
+ import { VueDraggableNext } from 'vue-draggable-next'
2
+
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ nuxtApp.vueApp.component('draggable', VueDraggableNext)
5
+ })
package/types/site.d.ts CHANGED
@@ -24,5 +24,6 @@ declare type TSite = {
24
24
  state?: string;
25
25
  postalCode: string;
26
26
  country: string;
27
- }
27
+ },
28
+ deliveryCompanyList: string[];
28
29
  };