@7365admin1/layer-common 1.10.0 → 1.10.2
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.
- package/CHANGELOG.md +12 -0
- package/components/AcceptDialog.vue +44 -0
- package/components/AccessCard/AvailableStats.vue +55 -0
- package/components/AccessCardAddForm.vue +284 -19
- package/components/AccessCardAssignToUnitForm.vue +440 -0
- package/components/AccessManagement.vue +218 -85
- package/components/AddSupplyForm.vue +165 -0
- package/components/AreaChecklistHistoryLogs.vue +235 -0
- package/components/AreaChecklistHistoryMain.vue +176 -0
- package/components/AreaFormDialog.vue +266 -0
- package/components/AreaMain.vue +863 -0
- package/components/AttendanceCheckInOutDialog.vue +416 -0
- package/components/AttendanceDetailsDialog.vue +184 -0
- package/components/AttendanceMain.vue +155 -0
- package/components/AttendanceMapSearchDialog.vue +393 -0
- package/components/AttendanceSettingsDialog.vue +398 -0
- package/components/BuildingManagement/buildings.vue +5 -5
- package/components/BuildingManagement/units.vue +5 -5
- package/components/BulletinBoardManagement.vue +322 -0
- package/components/ChecklistItemRow.vue +54 -0
- package/components/CheckoutItemMain.vue +705 -0
- package/components/CleaningScheduleMain.vue +271 -0
- package/components/DocumentManagement.vue +4 -0
- package/components/EntryPass/QrTemplatePreview.vue +104 -0
- package/components/EntryPassMain.vue +252 -200
- package/components/HygieneUpdateMoreAction.vue +238 -0
- package/components/ManageChecklistMain.vue +384 -0
- package/components/MemberMain.vue +48 -20
- package/components/MyAttendanceMain.vue +224 -0
- package/components/OnlineFormsConfiguration.vue +9 -2
- package/components/PhotoUpload.vue +410 -0
- package/components/ScheduleAreaMain.vue +313 -0
- package/components/ScheduleTaskAreaFormDialog.vue +144 -0
- package/components/ScheduleTaskAreaUpdateMoreAction.vue +109 -0
- package/components/ScheduleTaskForm.vue +471 -0
- package/components/ScheduleTaskMain.vue +345 -0
- package/components/ScheduleTastTicketMain.vue +182 -0
- package/components/SignaturePad.vue +17 -5
- package/components/StockCard.vue +191 -0
- package/components/SupplyManagementMain.vue +557 -0
- package/components/TableHygiene.vue +617 -0
- package/components/UnitMain.vue +451 -0
- package/components/VisitorManagement.vue +28 -15
- package/composables/useAccessManagement.ts +163 -0
- package/composables/useAreaPermission.ts +51 -0
- package/composables/useAreas.ts +99 -0
- package/composables/useAttendance.ts +89 -0
- package/composables/useAttendancePermission.ts +68 -0
- package/composables/useBuilding.ts +2 -2
- package/composables/useBuildingUnit.ts +2 -2
- package/composables/useBulletin.ts +82 -0
- package/composables/useCard.ts +2 -0
- package/composables/useCheckout.ts +61 -0
- package/composables/useCheckoutPermission.ts +80 -0
- package/composables/useCleaningPermission.ts +229 -0
- package/composables/useCleaningSchedulePermission.ts +58 -0
- package/composables/useCleaningSchedules.ts +233 -0
- package/composables/useCountry.ts +8 -0
- package/composables/useDashboardData.ts +2 -2
- package/composables/useFeedback.ts +1 -1
- package/composables/useLocation.ts +78 -0
- package/composables/useOnlineForm.ts +16 -9
- package/composables/usePeople.ts +87 -72
- package/composables/useQR.ts +29 -0
- package/composables/useScheduleTask.ts +89 -0
- package/composables/useScheduleTaskArea.ts +85 -0
- package/composables/useScheduleTaskPermission.ts +68 -0
- package/composables/useSiteEntryPassSettings.ts +4 -15
- package/composables/useStock.ts +45 -0
- package/composables/useSupply.ts +63 -0
- package/composables/useSupplyPermission.ts +92 -0
- package/composables/useUnitPermission.ts +51 -0
- package/composables/useUnits.ts +82 -0
- package/composables/useWebUsb.ts +389 -0
- package/composables/useWorkOrder.ts +1 -1
- package/nuxt.config.ts +3 -0
- package/package.json +4 -1
- package/types/area.d.ts +22 -0
- package/types/attendance.d.ts +38 -0
- package/types/checkout-item.d.ts +27 -0
- package/types/cleaner-schedule.d.ts +54 -0
- package/types/location.d.ts +42 -0
- package/types/schedule-task.d.ts +18 -0
- package/types/stock.d.ts +16 -0
- package/types/supply.d.ts +11 -0
- package/utils/acm-crypto.ts +30 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export function useCheckoutPermission() {
|
|
2
|
+
const { hasPermission } = usePermission();
|
|
3
|
+
const { permissions } = useCleaningPermission();
|
|
4
|
+
const { userAppRole } = useLocalSetup();
|
|
5
|
+
|
|
6
|
+
const canViewAllCheckouts = computed(() => {
|
|
7
|
+
if (!userAppRole.value) return true;
|
|
8
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
9
|
+
return hasPermission(
|
|
10
|
+
userAppRole.value,
|
|
11
|
+
permissions,
|
|
12
|
+
"checkout-item-mgmt",
|
|
13
|
+
"see-all-checkouts"
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const canCreateCheckout = computed(() => {
|
|
18
|
+
if (!userAppRole.value) return true;
|
|
19
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
20
|
+
return hasPermission(
|
|
21
|
+
userAppRole.value,
|
|
22
|
+
permissions,
|
|
23
|
+
"checkout-item-mgmt",
|
|
24
|
+
"create-checkout"
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const canUpdateCheckout = computed(() => {
|
|
29
|
+
if (!userAppRole.value) return true;
|
|
30
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
31
|
+
return hasPermission(
|
|
32
|
+
userAppRole.value,
|
|
33
|
+
permissions,
|
|
34
|
+
"checkout-item-mgmt",
|
|
35
|
+
"update-checkout"
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const canApproveCheckout = computed(() => {
|
|
40
|
+
if (!userAppRole.value) return true;
|
|
41
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
42
|
+
return hasPermission(
|
|
43
|
+
userAppRole.value,
|
|
44
|
+
permissions,
|
|
45
|
+
"checkout-item-mgmt",
|
|
46
|
+
"approve-checkout"
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const canDisapproveCheckout = computed(() => {
|
|
51
|
+
if (!userAppRole.value) return true;
|
|
52
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
53
|
+
return hasPermission(
|
|
54
|
+
userAppRole.value,
|
|
55
|
+
permissions,
|
|
56
|
+
"checkout-item-mgmt",
|
|
57
|
+
"disapprove-checkout"
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const canViewCheckoutDetails = computed(() => {
|
|
62
|
+
if (!userAppRole.value) return true;
|
|
63
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
64
|
+
return hasPermission(
|
|
65
|
+
userAppRole.value,
|
|
66
|
+
permissions,
|
|
67
|
+
"checkout-item-mgmt",
|
|
68
|
+
"view-checkout-details"
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
canViewAllCheckouts,
|
|
74
|
+
canCreateCheckout,
|
|
75
|
+
canUpdateCheckout,
|
|
76
|
+
canApproveCheckout,
|
|
77
|
+
canDisapproveCheckout,
|
|
78
|
+
canViewCheckoutDetails,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
export default function useCleaningPermission() {
|
|
2
|
+
const {
|
|
3
|
+
rolePermissions,
|
|
4
|
+
memberPermissions,
|
|
5
|
+
feedbackPermissions,
|
|
6
|
+
workOrderPermissions,
|
|
7
|
+
invitationPermissions,
|
|
8
|
+
} = useCommonPermissions();
|
|
9
|
+
const permissions: TPermissions = {
|
|
10
|
+
members: memberPermissions,
|
|
11
|
+
feedbacks: feedbackPermissions,
|
|
12
|
+
work_order: workOrderPermissions,
|
|
13
|
+
roles: rolePermissions,
|
|
14
|
+
invitations: invitationPermissions,
|
|
15
|
+
inventory: {
|
|
16
|
+
"view-inventory": {
|
|
17
|
+
check: true,
|
|
18
|
+
description: "Allows the user to view the inventory list.",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
// area management permissions
|
|
22
|
+
"area-mgmt": {
|
|
23
|
+
"see-all-areas": {
|
|
24
|
+
check: true,
|
|
25
|
+
description:
|
|
26
|
+
"Allows the user to view the list of all areas for a site.",
|
|
27
|
+
},
|
|
28
|
+
"add-area": {
|
|
29
|
+
check: true,
|
|
30
|
+
description: "Allows the user to create/add an area to a site.",
|
|
31
|
+
},
|
|
32
|
+
"update-area": {
|
|
33
|
+
check: true,
|
|
34
|
+
description: "Allows the user to update/edit area details.",
|
|
35
|
+
},
|
|
36
|
+
"import-areas": {
|
|
37
|
+
check: true,
|
|
38
|
+
description: "Allows the user to import/upload areas via CSV/XLSX.",
|
|
39
|
+
},
|
|
40
|
+
"see-area-details": {
|
|
41
|
+
check: true,
|
|
42
|
+
description:
|
|
43
|
+
"Allows the user to view detailed information for an area.",
|
|
44
|
+
},
|
|
45
|
+
"delete-area": {
|
|
46
|
+
check: true,
|
|
47
|
+
description: "Allows the user to delete/remove an area.",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
// unit management permissions
|
|
51
|
+
"unit-mgmt": {
|
|
52
|
+
"see-all-units": {
|
|
53
|
+
check: true,
|
|
54
|
+
description:
|
|
55
|
+
"Allows the user to view the list of all units for a site.",
|
|
56
|
+
},
|
|
57
|
+
"add-unit": {
|
|
58
|
+
check: true,
|
|
59
|
+
description: "Allows the user to create/add a unit to a site.",
|
|
60
|
+
},
|
|
61
|
+
"update-unit": {
|
|
62
|
+
check: true,
|
|
63
|
+
description: "Allows the user to update/edit unit details.",
|
|
64
|
+
},
|
|
65
|
+
"import-units": {
|
|
66
|
+
check: true,
|
|
67
|
+
description: "Allows the user to import/upload units via CSV/XLSX.",
|
|
68
|
+
},
|
|
69
|
+
"see-unit-details": {
|
|
70
|
+
check: true,
|
|
71
|
+
description: "Allows the user to view detailed information for a unit.",
|
|
72
|
+
},
|
|
73
|
+
"delete-unit": {
|
|
74
|
+
check: true,
|
|
75
|
+
description: "Allows the user to delete/remove a unit.",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
// cleaning schedule management permissions
|
|
79
|
+
"cleaning-schedule-mgmt": {
|
|
80
|
+
"see-all-schedules": {
|
|
81
|
+
check: true,
|
|
82
|
+
description:
|
|
83
|
+
"Allows the user to view the list of all cleaning schedules.",
|
|
84
|
+
},
|
|
85
|
+
"see-schedule-details": {
|
|
86
|
+
check: true,
|
|
87
|
+
description:
|
|
88
|
+
"Allows the user to view detailed information for a cleaning schedule.",
|
|
89
|
+
},
|
|
90
|
+
"download-schedule": {
|
|
91
|
+
check: true,
|
|
92
|
+
description: "Allows the user to download cleaning schedule data.",
|
|
93
|
+
},
|
|
94
|
+
"manage-schedule-tasks": {
|
|
95
|
+
check: true,
|
|
96
|
+
description:
|
|
97
|
+
"Allows the user to manage and update cleaning schedule tasks.",
|
|
98
|
+
},
|
|
99
|
+
"generate-checklist": {
|
|
100
|
+
check: true,
|
|
101
|
+
description: "Allows the user to generate new cleaning checklists.",
|
|
102
|
+
},
|
|
103
|
+
"view-history": {
|
|
104
|
+
check: true,
|
|
105
|
+
description: "Allows the user to view cleaning schedule history.",
|
|
106
|
+
},
|
|
107
|
+
"add-remarks": {
|
|
108
|
+
check: true,
|
|
109
|
+
description: "Allows the user to add remarks to cleaning tasks.",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
// schedule task management permissions
|
|
113
|
+
"schedule-task-mgmt": {
|
|
114
|
+
"see-all-schedule-tasks": {
|
|
115
|
+
check: true,
|
|
116
|
+
description: "Allows the user to view the list of all schedule tasks.",
|
|
117
|
+
},
|
|
118
|
+
"add-schedule-task": {
|
|
119
|
+
check: true,
|
|
120
|
+
description: "Allows the user to create/add a new schedule task.",
|
|
121
|
+
},
|
|
122
|
+
"update-schedule-task": {
|
|
123
|
+
check: true,
|
|
124
|
+
description: "Allows the user to update/edit schedule task details.",
|
|
125
|
+
},
|
|
126
|
+
"delete-schedule-task": {
|
|
127
|
+
check: true,
|
|
128
|
+
description: "Allows the user to delete/remove a schedule task.",
|
|
129
|
+
},
|
|
130
|
+
"see-schedule-task-details": {
|
|
131
|
+
check: true,
|
|
132
|
+
description:
|
|
133
|
+
"Allows the user to view detailed information for a schedule task.",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
// attendance management permissions
|
|
137
|
+
"attendance-mgmt": {
|
|
138
|
+
"see-all-attendance": {
|
|
139
|
+
check: true,
|
|
140
|
+
description:
|
|
141
|
+
"Allows the user to view all team members' attendance records.",
|
|
142
|
+
},
|
|
143
|
+
"see-attendance-details": {
|
|
144
|
+
check: true,
|
|
145
|
+
description:
|
|
146
|
+
"Allows the user to view detailed information for an attendance record.",
|
|
147
|
+
},
|
|
148
|
+
"manage-attendance-settings": {
|
|
149
|
+
check: true,
|
|
150
|
+
description:
|
|
151
|
+
"Allows the user to configure and manage attendance settings.",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
// my attendance permissions
|
|
155
|
+
"my-attendance": {
|
|
156
|
+
"see-own-attendance": {
|
|
157
|
+
check: true,
|
|
158
|
+
description: "Allows the user to view their own attendance records.",
|
|
159
|
+
},
|
|
160
|
+
"check-in-out": {
|
|
161
|
+
check: true,
|
|
162
|
+
description: "Allows the user to check in and check out.",
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
// supply management permissions
|
|
166
|
+
"supply-mgmt": {
|
|
167
|
+
"see-all-supplies": {
|
|
168
|
+
check: true,
|
|
169
|
+
description: "Allows the user to view the list of all supplies.",
|
|
170
|
+
},
|
|
171
|
+
"add-supply": {
|
|
172
|
+
check: true,
|
|
173
|
+
description: "Allows the user to create/add a new supply item.",
|
|
174
|
+
},
|
|
175
|
+
"update-supply": {
|
|
176
|
+
check: true,
|
|
177
|
+
description: "Allows the user to update/edit supply details.",
|
|
178
|
+
},
|
|
179
|
+
"delete-supply": {
|
|
180
|
+
check: true,
|
|
181
|
+
description: "Allows the user to delete/remove a supply item.",
|
|
182
|
+
},
|
|
183
|
+
"add-stock": {
|
|
184
|
+
check: true,
|
|
185
|
+
description: "Allows the user to add stock to supply items.",
|
|
186
|
+
},
|
|
187
|
+
"view-stock": {
|
|
188
|
+
check: true,
|
|
189
|
+
description: "Allows the user to view stock history and details.",
|
|
190
|
+
},
|
|
191
|
+
"checkout-item": {
|
|
192
|
+
check: true,
|
|
193
|
+
description: "Allows the user to checkout supply items.",
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
// checkout item management permissions
|
|
197
|
+
"checkout-item-mgmt": {
|
|
198
|
+
"see-all-checkouts": {
|
|
199
|
+
check: true,
|
|
200
|
+
description: "Allows the user to view all item checkouts.",
|
|
201
|
+
},
|
|
202
|
+
"create-checkout": {
|
|
203
|
+
check: true,
|
|
204
|
+
description: "Allows the user to create new item checkouts.",
|
|
205
|
+
},
|
|
206
|
+
"update-checkout": {
|
|
207
|
+
check: true,
|
|
208
|
+
description: "Allows the user to update/edit item checkouts.",
|
|
209
|
+
},
|
|
210
|
+
"approve-checkout": {
|
|
211
|
+
check: true,
|
|
212
|
+
description: "Allows the user to approve item checkouts.",
|
|
213
|
+
},
|
|
214
|
+
"disapprove-checkout": {
|
|
215
|
+
check: true,
|
|
216
|
+
description: "Allows the user to disapprove item checkouts.",
|
|
217
|
+
},
|
|
218
|
+
"view-checkout-details": {
|
|
219
|
+
check: true,
|
|
220
|
+
description:
|
|
221
|
+
"Allows the user to view detailed information for item checkouts.",
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
permissions,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function useCleaningSchedulePermission() {
|
|
2
|
+
const { hasPermission } = usePermission();
|
|
3
|
+
const { permissions } = useCleaningPermission();
|
|
4
|
+
|
|
5
|
+
const { userAppRole } = useLocalSetup();
|
|
6
|
+
|
|
7
|
+
const canViewSchedules = computed(() => {
|
|
8
|
+
if (!userAppRole.value) return true;
|
|
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 true;
|
|
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 true;
|
|
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 true;
|
|
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 true;
|
|
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 true;
|
|
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 true;
|
|
45
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
46
|
+
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "add-remarks");
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
canViewSchedules,
|
|
51
|
+
canViewScheduleDetails,
|
|
52
|
+
canDownloadSchedule,
|
|
53
|
+
canManageScheduleTasks,
|
|
54
|
+
canGenerateChecklist,
|
|
55
|
+
canViewHistory,
|
|
56
|
+
canAddRemarks,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
export default function useCleaningSchedules() {
|
|
2
|
+
const _cleanerChecklists = ref({
|
|
3
|
+
_id: "",
|
|
4
|
+
date: "",
|
|
5
|
+
status: [],
|
|
6
|
+
createdAt: "",
|
|
7
|
+
updatedAt: "",
|
|
8
|
+
attachments: [],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
async function getCleaningSchedules({
|
|
12
|
+
site = "",
|
|
13
|
+
search = "",
|
|
14
|
+
page = 1,
|
|
15
|
+
limit = 10,
|
|
16
|
+
startDate = "",
|
|
17
|
+
endDate = "",
|
|
18
|
+
status = "",
|
|
19
|
+
} = {}) {
|
|
20
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
21
|
+
`/api/hygiene-parent-checklist/site/${site}`,
|
|
22
|
+
{
|
|
23
|
+
method: "GET",
|
|
24
|
+
query: {
|
|
25
|
+
search,
|
|
26
|
+
page,
|
|
27
|
+
limit,
|
|
28
|
+
startDate,
|
|
29
|
+
endDate,
|
|
30
|
+
status,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function getScheduleAreas({
|
|
37
|
+
scheduleAreaId = "",
|
|
38
|
+
page = 1,
|
|
39
|
+
limit = 10,
|
|
40
|
+
search = "",
|
|
41
|
+
status = "",
|
|
42
|
+
type = "",
|
|
43
|
+
} = {}) {
|
|
44
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
45
|
+
`/api/hygiene-area-checklist/schedule/${scheduleAreaId}`,
|
|
46
|
+
{
|
|
47
|
+
method: "GET",
|
|
48
|
+
query: {
|
|
49
|
+
search,
|
|
50
|
+
page,
|
|
51
|
+
limit,
|
|
52
|
+
status,
|
|
53
|
+
type,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function acceptAreaChecklist(id: string) {
|
|
60
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
61
|
+
`/api/hygiene-area-checklist/id/${id}/accept`,
|
|
62
|
+
{
|
|
63
|
+
method: "PATCH",
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function getUnitCleanerChecklist({
|
|
69
|
+
scheduleAreaId = "",
|
|
70
|
+
page = 1,
|
|
71
|
+
limit = 10,
|
|
72
|
+
search = "",
|
|
73
|
+
} = {}) {
|
|
74
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
75
|
+
`/api/hygiene-area-checklist/id/${scheduleAreaId}/units`,
|
|
76
|
+
{
|
|
77
|
+
method: "GET",
|
|
78
|
+
query: {
|
|
79
|
+
search,
|
|
80
|
+
page,
|
|
81
|
+
limit,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function updateUnitChecklist(
|
|
88
|
+
checklistId: string,
|
|
89
|
+
unitId: string,
|
|
90
|
+
set: number,
|
|
91
|
+
decision: "approve" | "reject",
|
|
92
|
+
remarks?: string,
|
|
93
|
+
attachment?: string[],
|
|
94
|
+
) {
|
|
95
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
96
|
+
`/api/hygiene-area-checklist/id/${checklistId}/set/${set}/units/${unitId}/${decision}`,
|
|
97
|
+
{
|
|
98
|
+
method: "PATCH",
|
|
99
|
+
body: { remarks, attachment },
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function updateAreaChecklistStatus(
|
|
105
|
+
id: string,
|
|
106
|
+
status: "complete" | "submit",
|
|
107
|
+
signature: string,
|
|
108
|
+
) {
|
|
109
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
110
|
+
`/api/hygiene-area-checklist/id/${id}/${status}`,
|
|
111
|
+
{
|
|
112
|
+
method: "PATCH",
|
|
113
|
+
body: { signature },
|
|
114
|
+
},
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function uploadAreaChecklistAttachment(id: string, attachments: string[]) {
|
|
119
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
120
|
+
`/api/hygiene-area-checklist/id/${id}/upload`,
|
|
121
|
+
{
|
|
122
|
+
method: "PATCH",
|
|
123
|
+
body: { attachments },
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function generateChecklist(site: string, parentChecklistId: string) {
|
|
129
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
130
|
+
`/api/hygiene-area-checklist/site/${site}/schedule/${parentChecklistId}`,
|
|
131
|
+
{
|
|
132
|
+
method: "POST",
|
|
133
|
+
},
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function getAreaChecklistHistory({
|
|
138
|
+
parentChecklistId = "",
|
|
139
|
+
page = 1,
|
|
140
|
+
limit = 10,
|
|
141
|
+
search = "",
|
|
142
|
+
status = "",
|
|
143
|
+
} = {}) {
|
|
144
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
145
|
+
`/api/hygiene-area-checklist/schedule/${parentChecklistId}/history`,
|
|
146
|
+
{
|
|
147
|
+
method: "GET",
|
|
148
|
+
query: { page, limit, search, status },
|
|
149
|
+
},
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function getAreaChecklistHistoryById(id: string) {
|
|
154
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
155
|
+
`/api/hygiene-area-checklist/id/${id}/history`,
|
|
156
|
+
{
|
|
157
|
+
method: "GET",
|
|
158
|
+
},
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function exportAreas(site: string) {
|
|
163
|
+
const res = await useNuxtApp().$api<Blob | MediaSource>(
|
|
164
|
+
`/api/hygiene-area/site/${site}/download`,
|
|
165
|
+
{
|
|
166
|
+
method: "GET",
|
|
167
|
+
},
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
if (!res) throw new Error("Error downloading areas");
|
|
171
|
+
|
|
172
|
+
const date = new Date();
|
|
173
|
+
const formattedDate = `${String(date.getMonth() + 1).padStart(
|
|
174
|
+
2,
|
|
175
|
+
"0",
|
|
176
|
+
)}-${String(date.getDate()).padStart(2, "0")}-${date.getFullYear()}`;
|
|
177
|
+
|
|
178
|
+
const downloadUrl = window.URL.createObjectURL(res);
|
|
179
|
+
const a = document.createElement("a");
|
|
180
|
+
a.href = downloadUrl;
|
|
181
|
+
a.download = `areas-${formattedDate}.xlsx`;
|
|
182
|
+
document.body.appendChild(a);
|
|
183
|
+
a.click();
|
|
184
|
+
document.body.removeChild(a);
|
|
185
|
+
window.URL.revokeObjectURL(downloadUrl);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async function downloadChecklistPdf(scheduleId: string) {
|
|
189
|
+
const res = await useNuxtApp().$api<Blob | MediaSource>(
|
|
190
|
+
`/api/hygiene-area-checklist/schedule/${scheduleId}/pdf`,
|
|
191
|
+
{
|
|
192
|
+
method: "GET",
|
|
193
|
+
responseType: "blob",
|
|
194
|
+
},
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
if (!res) throw new Error("Error downloading checklist PDF");
|
|
198
|
+
|
|
199
|
+
const date = new Date();
|
|
200
|
+
const formattedDate = `${String(date.getDate()).padStart(2, "0")}_${String(
|
|
201
|
+
date.getMonth() + 1,
|
|
202
|
+
).padStart(2, "0")}_${date.getFullYear()} ${String(
|
|
203
|
+
date.getHours(),
|
|
204
|
+
).padStart(2, "0")}_${String(date.getMinutes()).padStart(2, "0")}`;
|
|
205
|
+
|
|
206
|
+
const downloadUrl = window.URL.createObjectURL(res);
|
|
207
|
+
const a = document.createElement("a");
|
|
208
|
+
a.href = downloadUrl;
|
|
209
|
+
a.download = `CHECKLIST_DOWNLOADED_${formattedDate}.pdf`;
|
|
210
|
+
a.target = "_blank";
|
|
211
|
+
a.rel = "noopener noreferrer";
|
|
212
|
+
document.body.appendChild(a);
|
|
213
|
+
a.click();
|
|
214
|
+
document.body.removeChild(a);
|
|
215
|
+
setTimeout(() => window.URL.revokeObjectURL(downloadUrl), 1000);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return {
|
|
219
|
+
_cleanerChecklists,
|
|
220
|
+
getCleaningSchedules,
|
|
221
|
+
getScheduleAreas,
|
|
222
|
+
acceptAreaChecklist,
|
|
223
|
+
updateUnitChecklist,
|
|
224
|
+
getUnitCleanerChecklist,
|
|
225
|
+
updateAreaChecklistStatus,
|
|
226
|
+
uploadAreaChecklistAttachment,
|
|
227
|
+
generateChecklist,
|
|
228
|
+
getAreaChecklistHistory,
|
|
229
|
+
getAreaChecklistHistoryById,
|
|
230
|
+
exportAreas,
|
|
231
|
+
downloadChecklistPdf,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
@@ -145,7 +145,7 @@ const dashboardDataMap: Record<string, ModuleData> = {
|
|
|
145
145
|
color: '#7E57C2',
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
|
-
title: '
|
|
148
|
+
title: 'Checkout Items',
|
|
149
149
|
value: 19,
|
|
150
150
|
percentage: 5.1,
|
|
151
151
|
isPositive: true,
|
|
@@ -167,7 +167,7 @@ const dashboardDataMap: Record<string, ModuleData> = {
|
|
|
167
167
|
'Schedule Task Ticket',
|
|
168
168
|
'Attendance',
|
|
169
169
|
'Supply Management',
|
|
170
|
-
'
|
|
170
|
+
'Checkout Items',
|
|
171
171
|
'Cleaning Schedule - Checklist, Area, Unit',
|
|
172
172
|
],
|
|
173
173
|
},
|