@7365admin1/layer-common 3.0.30-staging.9 → 3.0.30

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 (25) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/components/DashboardMain.vue +33 -29
  3. package/components/InvitationMain.vue +3 -4
  4. package/components/ManageChecklistMain.vue +25 -32
  5. package/components/PhotoUpload.vue +4 -19
  6. package/components/VisitorForm.vue +3 -11
  7. package/composables/useCleaningSchedulePermission.ts +51 -16
  8. package/package.json +1 -1
  9. package/types/customer.d.ts +1 -2
  10. /package/components/{Nfc → NFC}/NFCPatrolReportMain.vue +0 -0
  11. /package/components/{Nfc → NFC}/NFCPatrolRouteForm.vue +0 -0
  12. /package/components/{Nfc → NFC}/NFCPatrolRouteMain.vue +0 -0
  13. /package/components/{Nfc → NFC}/NFCPatrolSettings.vue +0 -0
  14. /package/components/{Nfc → NFC}/NFCTagForm.vue +0 -0
  15. /package/components/{Nfc → NFC}/NFCTagMain.vue +0 -0
  16. /package/components/{Nfc → NFC}/PatrolReport/DailyReportTab.vue +0 -0
  17. /package/components/{Nfc → NFC}/PatrolReport/MonthlyReportTab.vue +0 -0
  18. /package/components/{Nfc → NFC}/PatrolReport/PatrolActivityTable.vue +0 -0
  19. /package/components/{Nfc → NFC}/PatrolReport/PatrolReportTab.vue +0 -0
  20. /package/components/{Nfc → NFC}/PatrolReport/PatrolRouteSummary.vue +0 -0
  21. /package/components/{Nfc → NFC}/PatrolReport/RemarksDialog.vue +0 -0
  22. /package/components/{Nfc → NFC}/PatrolReport/ReportEmptyState.vue +0 -0
  23. /package/components/{Nfc → NFC}/PatrolReport/ReportFilters.vue +0 -0
  24. /package/components/{Nfc → NFC}/PatrolReport/ReportLocationHeader.vue +0 -0
  25. /package/components/{Nfc → NFC}/PatrolReport/SummaryReportTable.vue +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 3.0.30
4
+
5
+ ### Patch Changes
6
+
7
+ - afdccc4: Build for Leftover changes from Benar's PR
8
+
3
9
  ## 3.0.29
4
10
 
5
11
  ### Patch Changes
@@ -1545,16 +1545,30 @@ const { userAppRole } = useLocalSetup();
1545
1545
  const { downloadPDF } = usePDFDownload();
1546
1546
  const route = useRoute();
1547
1547
 
1548
+ const dashboardWidgetPermissions: Record<string, string> = {
1549
+ activity: "dashboard:view-activity",
1550
+ recentActivity: "dashboard:view-activity",
1551
+ taskSchedule: "dashboard:view-task-schedule",
1552
+ staffStatus: "dashboard:view-attendance-widget",
1553
+ attendance: "dashboard:view-attendance-widget",
1554
+ feedbacks: "dashboard:view-feedbacks-widget",
1555
+ workOrderStatus: "dashboard:view-work-order-status",
1556
+ activePatrol: "dashboard:view-active-patrol",
1557
+ upcomingEvents: "dashboard:view-upcoming-events",
1558
+ todayReminders: "dashboard:view-today-reminders",
1559
+ todayAttentions: "dashboard:view-today-attentions",
1560
+ };
1561
+
1548
1562
  const propertyWidgetPermissions: Record<string, string[]> = {
1549
1563
  workOrders: [
1550
- "work_orders:see-all-work-orders",
1564
+ "workOrder:see-all-work-orders",
1551
1565
  "work-order:see-all-work-orders",
1552
1566
  ],
1553
1567
  incidents: ["incident-reports:see-incident-reports"],
1554
1568
  visitors: ["visitorManagement:see-all-visitor"],
1555
1569
  facilityBookings: ["facility-booking-mgmt:see-all-facility-booking"],
1556
1570
  activity: [
1557
- "work_orders:see-all-work-orders",
1571
+ "workOrder:see-all-work-orders",
1558
1572
  "work-order:see-all-work-orders",
1559
1573
  ],
1560
1574
  upcomingEvents: ["event-mgmt:see-all-event"],
@@ -1564,7 +1578,7 @@ const propertyWidgetPermissions: Record<string, string[]> = {
1564
1578
  "facility-booking-mgmt:see-all-facility-booking",
1565
1579
  ],
1566
1580
  workOrderStatus: [
1567
- "work_orders:see-all-work-orders",
1581
+ "workOrder:see-all-work-orders",
1568
1582
  "work-order:see-all-work-orders",
1569
1583
  ],
1570
1584
  feedbacks: ["feedbacks:see-all-feedback"],
@@ -1573,30 +1587,27 @@ const propertyWidgetPermissions: Record<string, string[]> = {
1573
1587
 
1574
1588
  const moduleWidgetPermissions: Record<string, string[]> = {
1575
1589
  openWorkOrder: [
1576
- "work_orders:see-all-work-orders",
1577
1590
  "work_order:see-all-work-orders",
1578
1591
  "work-order:see-all-work-orders",
1579
1592
  "work-orders:see-all-work-orders",
1580
1593
  ],
1581
1594
  workOrders: [
1582
- "work_orders:see-all-work-orders",
1583
1595
  "work_order:see-all-work-orders",
1584
1596
  "work-order:see-all-work-orders",
1585
1597
  "work-orders:see-all-work-orders",
1586
1598
  ],
1587
1599
  activity: [
1588
- "work_orders:see-all-work-orders",
1589
1600
  "work_order:see-all-work-orders",
1590
1601
  "work-order:see-all-work-orders",
1591
1602
  "work-orders:see-all-work-orders",
1592
- "work_orders:see-all-work-orders",
1593
1603
  ],
1594
- recentActivity: [
1595
- "work_orders:see-all-work-orders",
1596
- "work_order:see-all-work-orders",
1597
- "work-order:see-all-work-orders",
1598
- "work-orders:see-all-work-orders",
1599
- "work_orders:see-all-work-orders",
1604
+ taskSchedule: [
1605
+ "cleaning-schedule-mgmt:see-all-schedules",
1606
+ "schedule-task-mgmt:see-all-schedule-tasks",
1607
+ ],
1608
+ taskCompleted: [
1609
+ "cleaning-schedule-mgmt:see-all-schedules",
1610
+ "schedule-task-mgmt:see-all-schedule-tasks",
1600
1611
  ],
1601
1612
  staffStatus: ["attendance-mgmt:see-all-attendance"],
1602
1613
  attendance: ["attendance-mgmt:see-all-attendance"],
@@ -1619,14 +1630,9 @@ const moduleWidgetPermissions: Record<string, string[]> = {
1619
1630
  activePatrol: ["virtual-patrol:see-all-virtual-patrol-logs"],
1620
1631
  };
1621
1632
 
1622
- function hasSchedulePermission(permissions: string[], action: string) {
1623
- return permissions.some((permission) =>
1624
- permission.endsWith(`-schedule-mgmt:${action}`)
1625
- );
1626
- }
1627
-
1628
1633
  function canViewWidget(key: string) {
1629
1634
  const permissions = userAppRole.value?.permissions;
1635
+ const dashboardPermission = dashboardWidgetPermissions[key];
1630
1636
  const modulePermissions = isPropertyMode.value
1631
1637
  ? propertyWidgetPermissions[key]
1632
1638
  : moduleWidgetPermissions[key];
@@ -1634,22 +1640,20 @@ function canViewWidget(key: string) {
1634
1640
  if (!permissions) return true;
1635
1641
  if (permissions.includes("*")) return true;
1636
1642
 
1637
- if (
1638
- !isPropertyMode.value &&
1639
- ["taskSchedule", "taskCompleted"].includes(key)
1640
- ) {
1641
- return hasSchedulePermission(permissions, "see-all-schedules");
1642
- }
1643
-
1644
1643
  if (isPropertyMode.value && modulePermissions) {
1645
1644
  return modulePermissions.some((permission) =>
1646
1645
  permissions.includes(permission)
1647
1646
  );
1648
1647
  }
1649
1648
 
1650
- if (modulePermissions) {
1651
- return modulePermissions.some((permission) =>
1652
- permissions.includes(permission)
1649
+ if (dashboardPermission || modulePermissions) {
1650
+ return (
1651
+ (dashboardPermission && permissions.includes(dashboardPermission)) ||
1652
+ Boolean(
1653
+ modulePermissions?.some((permission) =>
1654
+ permissions.includes(permission)
1655
+ )
1656
+ )
1653
1657
  );
1654
1658
  }
1655
1659
 
@@ -221,7 +221,7 @@ const headers = computed(() => {
221
221
  title: "Status",
222
222
  value: "status",
223
223
  },
224
-
224
+
225
225
  ];
226
226
 
227
227
  if (props.status === "pending" && props.cancelInvitation) {
@@ -270,11 +270,10 @@ const {
270
270
  page: page.value,
271
271
  status: props.status,
272
272
  search: headerSearch.value,
273
- // type: "user-invite,member-invite",
274
- type: "member-invite",
273
+ type: "user-invite,member-invite",
275
274
  app: props.app,
276
275
  orgId: props.org,
277
- // siteId: props.siteId,
276
+ siteId: props.siteId,
278
277
  }),
279
278
  {
280
279
  watch: [() => props.status]
@@ -305,38 +305,31 @@
305
305
 
306
306
  <v-divider />
307
307
 
308
- <v-toolbar class="pa-0" density="compact">
309
- <v-row no-gutters>
310
- <v-col cols="6" class="pa-0">
311
- <v-btn
312
- block
313
- variant="text"
314
- class="text-none"
315
- size="large"
316
- height="48"
317
- :disabled="rejectModal.submitting"
318
- @click="closeRejectDialog"
319
- >
320
- Cancel
321
- </v-btn>
322
- </v-col>
323
-
324
- <v-col cols="6" class="pa-0">
325
- <v-btn
326
- block
327
- variant="flat"
328
- color="black"
329
- class="text-none font-weight-bold rounded-0"
330
- height="48"
331
- :loading="rejectModal.submitting"
332
- :disabled="!isRejectModalValid || rejectModal.submitting"
333
- @click="submitRejectDialog"
334
- >
335
- Confirm
336
- </v-btn>
337
- </v-col>
338
- </v-row>
339
- </v-toolbar>
308
+ <v-card-actions class="pa-0">
309
+ <v-btn
310
+ color="grey"
311
+ variant="flat"
312
+ rounded="0"
313
+ class="flex-grow-1 text-none"
314
+ height="48"
315
+ :disabled="rejectModal.submitting"
316
+ @click="closeRejectDialog"
317
+ >
318
+ Cancel
319
+ </v-btn>
320
+ <v-btn
321
+ color="error"
322
+ variant="flat"
323
+ rounded="0"
324
+ class="flex-grow-1 text-none"
325
+ height="48"
326
+ :loading="rejectModal.submitting"
327
+ :disabled="!isRejectModalValid || rejectModal.submitting"
328
+ @click="submitRejectDialog"
329
+ >
330
+ Confirm
331
+ </v-btn>
332
+ </v-card-actions>
340
333
  </v-card>
341
334
  </v-dialog>
342
335
 
@@ -59,21 +59,6 @@
59
59
  </v-col>
60
60
  </v-row>
61
61
 
62
- <v-dialog v-model="showPhotoPreview" max-width="900">
63
- <v-card>
64
- <v-card-actions class="pa-2 justify-end">
65
- <v-btn
66
- icon="mdi-close"
67
- variant="text"
68
- @click="showPhotoPreview = false"
69
- />
70
- </v-card-actions>
71
- <v-card-text class="pa-2 pt-0">
72
- <v-img :src="selectedPhoto" contain max-height="80vh" />
73
- </v-card-text>
74
- </v-card>
75
- </v-dialog>
76
-
77
62
  <v-dialog v-model="photoOptionsDialog" max-width="420">
78
63
  <v-card>
79
64
  <v-card-title class="d-flex align-center pa-4">
@@ -211,8 +196,6 @@ const photos = ref<string[]>([...props.modelValue]);
211
196
  const photosIds = ref<string[]>([...props.photoIds]);
212
197
  const photoOptionsDialog = ref(false);
213
198
  const showCameraDialog = ref(false);
214
- const showPhotoPreview = ref(false);
215
- const selectedPhoto = ref("");
216
199
  const videoRef = ref<HTMLVideoElement | null>(null);
217
200
  const canvasRef = ref<HTMLCanvasElement | null>(null);
218
201
  const fileInputRef = ref<HTMLInputElement | null>(null);
@@ -222,8 +205,10 @@ const uploading = ref(false);
222
205
  const { addFile } = useFile();
223
206
 
224
207
  function viewPhoto(photoData: string) {
225
- selectedPhoto.value = photoData;
226
- showPhotoPreview.value = true;
208
+ const link = document.createElement("a");
209
+ link.href = photoData;
210
+ link.target = "_blank";
211
+ link.click();
227
212
  }
228
213
 
229
214
  watch(
@@ -66,7 +66,7 @@
66
66
  <v-list-item v-for="(item, index) in nricSearchResults" :key="item._id || index"
67
67
  @click="selectNricSearchResult(item)" class="cursor-pointer">
68
68
  <v-list-item-title>{{ item.name || 'Unknown' }}</v-list-item-title>
69
- <v-list-item-subtitle>NRIC: {{ item.nric }} | Contact No: {{ item.contact }} </v-list-item-subtitle>
69
+ <v-list-item-subtitle>{{ item.contact }}</v-list-item-subtitle>
70
70
  </v-list-item>
71
71
  </v-list>
72
72
  </v-menu>
@@ -155,13 +155,9 @@
155
155
  <v-col v-if="shouldShowField('plateNumber')" cols="12">
156
156
  <v-row>
157
157
  <v-col cols="12">
158
- <InputLabel class="text-capitalize" title="Vehicle Number" :required="isVehicleRequired" />
158
+ <InputLabel class="text-capitalize" title="Vehicle Number" required />
159
159
  <!-- <v-text-field v-model.trim.uppercase="visitor.plateNumber" density="comfortable" /> -->
160
- <InputVehicleNumber
161
- v-model="visitor.plateNumber"
162
- :rules="[isVehicleRequired ? requiredRule : () => true]"
163
- density="comfortable"
164
- />
160
+ <InputVehicleNumber v-model="visitor.plateNumber" density="comfortable" />
165
161
  </v-col>
166
162
  </v-row>
167
163
  </v-col>
@@ -639,10 +635,6 @@ const requireNRIC = computed(() => {
639
635
  return prop.type !== "walk-in" && prop.type !== "guest";
640
636
  });
641
637
 
642
- const isVehicleRequired = computed(() => {
643
- return ["guest", "drop-off", "pick-up"].includes(prop.type);
644
- });
645
-
646
638
  const hidQrCodePassConfig = computed(() => {
647
639
  return (siteData.value as any)?.metadata?.hidQrCodePass || {};
648
640
  });
@@ -1,23 +1,58 @@
1
1
  export function useCleaningSchedulePermission() {
2
+ const { hasPermission } = usePermission();
3
+ const { permissions } = useCleaningPermission();
4
+
2
5
  const { userAppRole } = useLocalSetup();
3
6
 
4
- const can = (action: string) =>
5
- computed(() => {
6
- const permissions = userAppRole.value?.permissions;
7
- if (!permissions) return false;
8
- if (permissions.includes("*")) return true;
9
- return permissions.some((permission) =>
10
- permission.endsWith(`-schedule-mgmt:${action}`),
11
- );
12
- });
7
+ const canViewSchedules = computed(() => {
8
+ if (!userAppRole.value) return false;
9
+ if (userAppRole.value.permissions.includes("*")) return true;
10
+ return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "see-all-schedules");
11
+ });
12
+
13
+ const canViewScheduleDetails = computed(() => {
14
+ if (!userAppRole.value) return false;
15
+ if (userAppRole.value.permissions.includes("*")) return true;
16
+ return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "see-schedule-details");
17
+ });
18
+
19
+ const canDownloadSchedule = computed(() => {
20
+ if (!userAppRole.value) return false;
21
+ if (userAppRole.value.permissions.includes("*")) return true;
22
+ return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "download-schedule");
23
+ });
24
+
25
+ const canManageScheduleTasks = computed(() => {
26
+ if (!userAppRole.value) return false;
27
+ if (userAppRole.value.permissions.includes("*")) return true;
28
+ return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "manage-schedule-tasks");
29
+ });
30
+
31
+ const canGenerateChecklist = computed(() => {
32
+ if (!userAppRole.value) return false;
33
+ if (userAppRole.value.permissions.includes("*")) return true;
34
+ return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "generate-checklist");
35
+ });
36
+
37
+ const canViewHistory = computed(() => {
38
+ if (!userAppRole.value) return false;
39
+ if (userAppRole.value.permissions.includes("*")) return true;
40
+ return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "view-history");
41
+ });
42
+
43
+ const canAddRemarks = computed(() => {
44
+ if (!userAppRole.value) return false;
45
+ if (userAppRole.value.permissions.includes("*")) return true;
46
+ return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "add-remarks");
47
+ });
13
48
 
14
49
  return {
15
- canViewSchedules: can("see-all-schedules"),
16
- canViewScheduleDetails: can("see-schedule-details"),
17
- canDownloadSchedule: can("download-schedule"),
18
- canManageScheduleTasks: can("manage-schedule-tasks"),
19
- canGenerateChecklist: can("generate-checklist"),
20
- canViewHistory: can("view-history"),
21
- canAddRemarks: can("add-remarks"),
50
+ canViewSchedules,
51
+ canViewScheduleDetails,
52
+ canDownloadSchedule,
53
+ canManageScheduleTasks,
54
+ canGenerateChecklist,
55
+ canViewHistory,
56
+ canAddRemarks,
22
57
  };
23
58
  }
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.30-staging.9",
5
+ "version": "3.0.30",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -41,5 +41,4 @@ type TSiteCategory =
41
41
  | "shopping_mall"
42
42
  | "mix_development"
43
43
  | "industrial"
44
- | "co_working"
45
- | "co_living";
44
+ | "co_working_co_living";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes