@7365admin1/layer-common 3.0.30-staging.7 → 3.0.30-staging.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.
|
@@ -1545,30 +1545,16 @@ 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
|
-
|
|
1562
1548
|
const propertyWidgetPermissions: Record<string, string[]> = {
|
|
1563
1549
|
workOrders: [
|
|
1564
|
-
"
|
|
1550
|
+
"work_orders:see-all-work-orders",
|
|
1565
1551
|
"work-order:see-all-work-orders",
|
|
1566
1552
|
],
|
|
1567
1553
|
incidents: ["incident-reports:see-incident-reports"],
|
|
1568
1554
|
visitors: ["visitorManagement:see-all-visitor"],
|
|
1569
1555
|
facilityBookings: ["facility-booking-mgmt:see-all-facility-booking"],
|
|
1570
1556
|
activity: [
|
|
1571
|
-
"
|
|
1557
|
+
"work_orders:see-all-work-orders",
|
|
1572
1558
|
"work-order:see-all-work-orders",
|
|
1573
1559
|
],
|
|
1574
1560
|
upcomingEvents: ["event-mgmt:see-all-event"],
|
|
@@ -1578,7 +1564,7 @@ const propertyWidgetPermissions: Record<string, string[]> = {
|
|
|
1578
1564
|
"facility-booking-mgmt:see-all-facility-booking",
|
|
1579
1565
|
],
|
|
1580
1566
|
workOrderStatus: [
|
|
1581
|
-
"
|
|
1567
|
+
"work_orders:see-all-work-orders",
|
|
1582
1568
|
"work-order:see-all-work-orders",
|
|
1583
1569
|
],
|
|
1584
1570
|
feedbacks: ["feedbacks:see-all-feedback"],
|
|
@@ -1587,27 +1573,30 @@ const propertyWidgetPermissions: Record<string, string[]> = {
|
|
|
1587
1573
|
|
|
1588
1574
|
const moduleWidgetPermissions: Record<string, string[]> = {
|
|
1589
1575
|
openWorkOrder: [
|
|
1576
|
+
"work_orders:see-all-work-orders",
|
|
1590
1577
|
"work_order:see-all-work-orders",
|
|
1591
1578
|
"work-order:see-all-work-orders",
|
|
1592
1579
|
"work-orders:see-all-work-orders",
|
|
1593
1580
|
],
|
|
1594
1581
|
workOrders: [
|
|
1582
|
+
"work_orders:see-all-work-orders",
|
|
1595
1583
|
"work_order:see-all-work-orders",
|
|
1596
1584
|
"work-order:see-all-work-orders",
|
|
1597
1585
|
"work-orders:see-all-work-orders",
|
|
1598
1586
|
],
|
|
1599
1587
|
activity: [
|
|
1588
|
+
"work_orders:see-all-work-orders",
|
|
1600
1589
|
"work_order:see-all-work-orders",
|
|
1601
1590
|
"work-order:see-all-work-orders",
|
|
1602
1591
|
"work-orders:see-all-work-orders",
|
|
1592
|
+
"work_orders:see-all-work-orders",
|
|
1603
1593
|
],
|
|
1604
|
-
|
|
1605
|
-
"
|
|
1606
|
-
"
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
"
|
|
1610
|
-
"schedule-task-mgmt:see-all-schedule-tasks",
|
|
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",
|
|
1611
1600
|
],
|
|
1612
1601
|
staffStatus: ["attendance-mgmt:see-all-attendance"],
|
|
1613
1602
|
attendance: ["attendance-mgmt:see-all-attendance"],
|
|
@@ -1630,9 +1619,14 @@ const moduleWidgetPermissions: Record<string, string[]> = {
|
|
|
1630
1619
|
activePatrol: ["virtual-patrol:see-all-virtual-patrol-logs"],
|
|
1631
1620
|
};
|
|
1632
1621
|
|
|
1622
|
+
function hasSchedulePermission(permissions: string[], action: string) {
|
|
1623
|
+
return permissions.some((permission) =>
|
|
1624
|
+
permission.endsWith(`-schedule-mgmt:${action}`)
|
|
1625
|
+
);
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1633
1628
|
function canViewWidget(key: string) {
|
|
1634
1629
|
const permissions = userAppRole.value?.permissions;
|
|
1635
|
-
const dashboardPermission = dashboardWidgetPermissions[key];
|
|
1636
1630
|
const modulePermissions = isPropertyMode.value
|
|
1637
1631
|
? propertyWidgetPermissions[key]
|
|
1638
1632
|
: moduleWidgetPermissions[key];
|
|
@@ -1640,20 +1634,22 @@ function canViewWidget(key: string) {
|
|
|
1640
1634
|
if (!permissions) return true;
|
|
1641
1635
|
if (permissions.includes("*")) return true;
|
|
1642
1636
|
|
|
1637
|
+
if (
|
|
1638
|
+
!isPropertyMode.value &&
|
|
1639
|
+
["taskSchedule", "taskCompleted"].includes(key)
|
|
1640
|
+
) {
|
|
1641
|
+
return hasSchedulePermission(permissions, "see-all-schedules");
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1643
1644
|
if (isPropertyMode.value && modulePermissions) {
|
|
1644
1645
|
return modulePermissions.some((permission) =>
|
|
1645
1646
|
permissions.includes(permission)
|
|
1646
1647
|
);
|
|
1647
1648
|
}
|
|
1648
1649
|
|
|
1649
|
-
if (
|
|
1650
|
-
return (
|
|
1651
|
-
|
|
1652
|
-
Boolean(
|
|
1653
|
-
modulePermissions?.some((permission) =>
|
|
1654
|
-
permissions.includes(permission)
|
|
1655
|
-
)
|
|
1656
|
-
)
|
|
1650
|
+
if (modulePermissions) {
|
|
1651
|
+
return modulePermissions.some((permission) =>
|
|
1652
|
+
permissions.includes(permission)
|
|
1657
1653
|
);
|
|
1658
1654
|
}
|
|
1659
1655
|
|
|
@@ -305,31 +305,38 @@
|
|
|
305
305
|
|
|
306
306
|
<v-divider />
|
|
307
307
|
|
|
308
|
-
<v-
|
|
309
|
-
<v-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
class="
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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>
|
|
333
340
|
</v-card>
|
|
334
341
|
</v-dialog>
|
|
335
342
|
|
|
@@ -59,6 +59,21 @@
|
|
|
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
|
+
|
|
62
77
|
<v-dialog v-model="photoOptionsDialog" max-width="420">
|
|
63
78
|
<v-card>
|
|
64
79
|
<v-card-title class="d-flex align-center pa-4">
|
|
@@ -196,6 +211,8 @@ const photos = ref<string[]>([...props.modelValue]);
|
|
|
196
211
|
const photosIds = ref<string[]>([...props.photoIds]);
|
|
197
212
|
const photoOptionsDialog = ref(false);
|
|
198
213
|
const showCameraDialog = ref(false);
|
|
214
|
+
const showPhotoPreview = ref(false);
|
|
215
|
+
const selectedPhoto = ref("");
|
|
199
216
|
const videoRef = ref<HTMLVideoElement | null>(null);
|
|
200
217
|
const canvasRef = ref<HTMLCanvasElement | null>(null);
|
|
201
218
|
const fileInputRef = ref<HTMLInputElement | null>(null);
|
|
@@ -205,10 +222,8 @@ const uploading = ref(false);
|
|
|
205
222
|
const { addFile } = useFile();
|
|
206
223
|
|
|
207
224
|
function viewPhoto(photoData: string) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
link.target = "_blank";
|
|
211
|
-
link.click();
|
|
225
|
+
selectedPhoto.value = photoData;
|
|
226
|
+
showPhotoPreview.value = true;
|
|
212
227
|
}
|
|
213
228
|
|
|
214
229
|
watch(
|
|
@@ -1,58 +1,23 @@
|
|
|
1
1
|
export function useCleaningSchedulePermission() {
|
|
2
|
-
const { hasPermission } = usePermission();
|
|
3
|
-
const { permissions } = useCleaningPermission();
|
|
4
|
-
|
|
5
2
|
const { userAppRole } = useLocalSetup();
|
|
6
3
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
});
|
|
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
|
+
});
|
|
48
13
|
|
|
49
14
|
return {
|
|
50
|
-
canViewSchedules,
|
|
51
|
-
canViewScheduleDetails,
|
|
52
|
-
canDownloadSchedule,
|
|
53
|
-
canManageScheduleTasks,
|
|
54
|
-
canGenerateChecklist,
|
|
55
|
-
canViewHistory,
|
|
56
|
-
canAddRemarks,
|
|
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"),
|
|
57
22
|
};
|
|
58
23
|
}
|