@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,163 @@
|
|
|
1
|
+
export default function useAccessManagement() {
|
|
2
|
+
function getDoorAccessLevels(acmUrl?: string) {
|
|
3
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
4
|
+
`/api/access-management/door-access-levels`,
|
|
5
|
+
{
|
|
6
|
+
method: "GET",
|
|
7
|
+
query: {
|
|
8
|
+
...(acmUrl ? { acm_url: acmUrl } : {}),
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function getLiftAccessLevels(acmUrl?: string) {
|
|
15
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
16
|
+
`/api/access-management/lift-access-levels`,
|
|
17
|
+
{
|
|
18
|
+
method: "GET",
|
|
19
|
+
query: {
|
|
20
|
+
...(acmUrl ? { acm_url: acmUrl } : {}),
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getAccessGroups(acmUrl?: string) {
|
|
27
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
28
|
+
`/api/access-management/access-groups`,
|
|
29
|
+
{
|
|
30
|
+
method: "GET",
|
|
31
|
+
query: {
|
|
32
|
+
...(acmUrl ? { acm_url: acmUrl } : {}),
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function addPhysicalCard(payload: Record<string, any>) {
|
|
39
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
40
|
+
`/api/access-management/physical-card`,
|
|
41
|
+
{
|
|
42
|
+
method: "POST",
|
|
43
|
+
body: payload,
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function addNonPhysicalCard(payload: Record<string, any>) {
|
|
49
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
50
|
+
`/api/access-management/non-physical-card`,
|
|
51
|
+
{
|
|
52
|
+
method: "POST",
|
|
53
|
+
body: payload,
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getAllAccessCardsCounts(params: {
|
|
59
|
+
site: string;
|
|
60
|
+
userType: string;
|
|
61
|
+
}) {
|
|
62
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
63
|
+
`/api/access-management/all-access-cards-counts`,
|
|
64
|
+
{
|
|
65
|
+
method: "GET",
|
|
66
|
+
query: {
|
|
67
|
+
site: params.site,
|
|
68
|
+
userType: params.userType,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getUserTypeAccessCards(params: {
|
|
75
|
+
page?: number;
|
|
76
|
+
limit?: number;
|
|
77
|
+
search?: string;
|
|
78
|
+
organization?: string;
|
|
79
|
+
userType?: string;
|
|
80
|
+
site?: string;
|
|
81
|
+
} = {}) {
|
|
82
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
83
|
+
`/api/access-management/user-type-access-cards`,
|
|
84
|
+
{
|
|
85
|
+
method: "GET",
|
|
86
|
+
query: {
|
|
87
|
+
...(params.page ? { page: params.page } : {}),
|
|
88
|
+
...(params.limit ? { limit: params.limit } : {}),
|
|
89
|
+
...(params.search ? { search: params.search } : {}),
|
|
90
|
+
...(params.organization ? { organization: params.organization } : {}),
|
|
91
|
+
...(params.userType ? { userType: params.userType } : {}),
|
|
92
|
+
...(params.site ? { site: params.site } : {}),
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function bulkPhysicalAccessCard(params: { site: string; file: File }) {
|
|
99
|
+
const formData = new FormData();
|
|
100
|
+
formData.append("file", params.file);
|
|
101
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
102
|
+
`/api/access-management/bulk-upload`,
|
|
103
|
+
{
|
|
104
|
+
method: "POST",
|
|
105
|
+
query: { site: params.site },
|
|
106
|
+
body: formData,
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getAvailableAccessCards(params: {
|
|
112
|
+
site: string;
|
|
113
|
+
userType: string;
|
|
114
|
+
type: string;
|
|
115
|
+
accessLevel: string;
|
|
116
|
+
liftAccessLevel: string;
|
|
117
|
+
}) {
|
|
118
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
119
|
+
`/api/access-management/access-and-lift-cards`,
|
|
120
|
+
{
|
|
121
|
+
method: "GET",
|
|
122
|
+
query: {
|
|
123
|
+
site: params.site,
|
|
124
|
+
userType: params.userType,
|
|
125
|
+
type: params.type,
|
|
126
|
+
accessLevel: params.accessLevel,
|
|
127
|
+
liftAccessLevel: params.liftAccessLevel,
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function assignAccessCard(payload: {
|
|
134
|
+
units: string[];
|
|
135
|
+
quantity: number;
|
|
136
|
+
type: string;
|
|
137
|
+
site: string;
|
|
138
|
+
userType: string;
|
|
139
|
+
accessLevel: string;
|
|
140
|
+
liftAccessLevel: string;
|
|
141
|
+
}) {
|
|
142
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
143
|
+
`/api/access-management/assign-access-card`,
|
|
144
|
+
{
|
|
145
|
+
method: "POST",
|
|
146
|
+
body: payload,
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
getDoorAccessLevels,
|
|
153
|
+
getLiftAccessLevels,
|
|
154
|
+
getAccessGroups,
|
|
155
|
+
addPhysicalCard,
|
|
156
|
+
addNonPhysicalCard,
|
|
157
|
+
getUserTypeAccessCards,
|
|
158
|
+
getAllAccessCardsCounts,
|
|
159
|
+
bulkPhysicalAccessCard,
|
|
160
|
+
assignAccessCard,
|
|
161
|
+
getAvailableAccessCards,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function useAreaPermission() {
|
|
2
|
+
const { hasPermission } = usePermission();
|
|
3
|
+
const { permissions } = useCleaningPermission();
|
|
4
|
+
|
|
5
|
+
const { userAppRole } = useLocalSetup();
|
|
6
|
+
|
|
7
|
+
const canViewAreas = computed(() => {
|
|
8
|
+
if (!userAppRole.value) return true;
|
|
9
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
10
|
+
return hasPermission(userAppRole.value, permissions, "area-mgmt", "see-all-areas");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const canCreateArea = computed(() => {
|
|
14
|
+
if (!userAppRole.value) return true;
|
|
15
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
16
|
+
return hasPermission(userAppRole.value, permissions, "area-mgmt", "add-area");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const canUpdateArea = computed(() => {
|
|
20
|
+
if (!userAppRole.value) return true;
|
|
21
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
22
|
+
return hasPermission(userAppRole.value, permissions, "area-mgmt", "update-area");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const canViewAreaDetails = computed(() => {
|
|
26
|
+
if (!userAppRole.value) return true;
|
|
27
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
28
|
+
return hasPermission(userAppRole.value, permissions, "area-mgmt", "see-area-details");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const canImportArea = computed(() => {
|
|
32
|
+
if (!userAppRole.value) return true;
|
|
33
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
34
|
+
return hasPermission(userAppRole.value, permissions, "area-mgmt", "import-areas");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const canDeleteArea = computed(() => {
|
|
38
|
+
if (!userAppRole.value) return true;
|
|
39
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
40
|
+
return hasPermission(userAppRole.value, permissions, "area-mgmt", "delete-area");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
canViewAreas,
|
|
45
|
+
canCreateArea,
|
|
46
|
+
canUpdateArea,
|
|
47
|
+
canViewAreaDetails,
|
|
48
|
+
canImportArea,
|
|
49
|
+
canDeleteArea,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export default function useAreas() {
|
|
2
|
+
async function getAreas({
|
|
3
|
+
site = "",
|
|
4
|
+
search = "",
|
|
5
|
+
page = 1,
|
|
6
|
+
limit = 10,
|
|
7
|
+
type = "",
|
|
8
|
+
} = {}) {
|
|
9
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
10
|
+
`/api/hygiene-areas/site/${site}`,
|
|
11
|
+
{
|
|
12
|
+
method: "GET",
|
|
13
|
+
query: {
|
|
14
|
+
search,
|
|
15
|
+
page,
|
|
16
|
+
limit,
|
|
17
|
+
type,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function createArea(payload: TAreaCreate, site: string) {
|
|
24
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
25
|
+
`/api/hygiene-areas/site/${site}`,
|
|
26
|
+
{
|
|
27
|
+
method: "POST",
|
|
28
|
+
body: {
|
|
29
|
+
name: payload.name,
|
|
30
|
+
set: payload.set,
|
|
31
|
+
type: payload.type,
|
|
32
|
+
units: payload.units,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function updateArea(id: string, payload: TAreaCreate) {
|
|
39
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
40
|
+
`/api/hygiene-areas/id/${id}`,
|
|
41
|
+
{
|
|
42
|
+
method: "PATCH",
|
|
43
|
+
body: {
|
|
44
|
+
name: payload.name,
|
|
45
|
+
set: payload.set,
|
|
46
|
+
type: payload.type,
|
|
47
|
+
units: payload.units,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function deleteArea(id: string) {
|
|
54
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
55
|
+
`/api/hygiene-areas/id/${id}`,
|
|
56
|
+
{
|
|
57
|
+
method: "DELETE",
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getAreaById(id: string) {
|
|
63
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
64
|
+
`/api/hygiene-areas/id/${id}`,
|
|
65
|
+
{
|
|
66
|
+
method: "GET",
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function uploadAreas(file: File, site: string) {
|
|
72
|
+
const formData = new FormData();
|
|
73
|
+
formData.append("file", file);
|
|
74
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
75
|
+
`/api/hygiene-areas/site/${site}/upload`,
|
|
76
|
+
{
|
|
77
|
+
method: "POST",
|
|
78
|
+
body: formData,
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function exportAreas(site: string) {
|
|
84
|
+
return useNuxtApp().$api<Blob>(`/api/hygiene-areas/site/${site}/download`, {
|
|
85
|
+
method: "GET",
|
|
86
|
+
responseType: "blob",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
getAreas,
|
|
92
|
+
createArea,
|
|
93
|
+
updateArea,
|
|
94
|
+
deleteArea,
|
|
95
|
+
getAreaById,
|
|
96
|
+
uploadAreas,
|
|
97
|
+
exportAreas,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export default function useAttendance() {
|
|
2
|
+
function getAttendances({
|
|
3
|
+
site = "",
|
|
4
|
+
page = 1,
|
|
5
|
+
limit = 10,
|
|
6
|
+
search = "",
|
|
7
|
+
} = {}) {
|
|
8
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
9
|
+
`/api/attendances/site/${site}`,
|
|
10
|
+
{
|
|
11
|
+
method: "GET",
|
|
12
|
+
query: { page, limit, search },
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getMyAttendances({
|
|
18
|
+
site = "",
|
|
19
|
+
page = 1,
|
|
20
|
+
limit = 10,
|
|
21
|
+
search = "",
|
|
22
|
+
} = {}) {
|
|
23
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
24
|
+
`/api/attendances/site/${site}/user`,
|
|
25
|
+
{
|
|
26
|
+
method: "GET",
|
|
27
|
+
query: { page, limit, search },
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getMyAttendanceById(id: string) {
|
|
33
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/attendances/id/${id}`, {
|
|
34
|
+
method: "GET",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function checkIn(site: string, payload: TAttendanceCheckIn) {
|
|
39
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
40
|
+
`/api/attendances/site/${site}/check-in`,
|
|
41
|
+
{
|
|
42
|
+
method: "POST",
|
|
43
|
+
body: payload,
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function checkOut(id: string, payload: TAttendanceCheckOut) {
|
|
49
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
50
|
+
`/api/attendances/id/${id}/check-out`,
|
|
51
|
+
{
|
|
52
|
+
method: "PUT",
|
|
53
|
+
body: payload,
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getAttendanceSettings(site: string) {
|
|
59
|
+
return useNuxtApp().$api<TAttendanceSettings>(
|
|
60
|
+
`/api/attendance-settings/site/${site}`,
|
|
61
|
+
{
|
|
62
|
+
method: "GET",
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function updateAttendanceSettings(
|
|
68
|
+
site: string,
|
|
69
|
+
payload: TAttendanceSettings
|
|
70
|
+
) {
|
|
71
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
72
|
+
`/api/attendance-settings/site/${site}`,
|
|
73
|
+
{
|
|
74
|
+
method: "PUT",
|
|
75
|
+
body: payload,
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
getAttendances,
|
|
82
|
+
getMyAttendances,
|
|
83
|
+
getMyAttendanceById,
|
|
84
|
+
checkIn,
|
|
85
|
+
checkOut,
|
|
86
|
+
getAttendanceSettings,
|
|
87
|
+
updateAttendanceSettings,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export function useAttendancePermission() {
|
|
2
|
+
const { hasPermission } = usePermission();
|
|
3
|
+
const { permissions } = useCleaningPermission();
|
|
4
|
+
const { userAppRole } = useLocalSetup();
|
|
5
|
+
|
|
6
|
+
const canViewAllAttendance = computed(() => {
|
|
7
|
+
if (!userAppRole.value) return true;
|
|
8
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
9
|
+
return hasPermission(
|
|
10
|
+
userAppRole.value,
|
|
11
|
+
permissions,
|
|
12
|
+
"attendance-mgmt",
|
|
13
|
+
"see-all-attendance"
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const canViewAttendanceDetails = computed(() => {
|
|
18
|
+
if (!userAppRole.value) return true;
|
|
19
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
20
|
+
return hasPermission(
|
|
21
|
+
userAppRole.value,
|
|
22
|
+
permissions,
|
|
23
|
+
"attendance-mgmt",
|
|
24
|
+
"see-attendance-details"
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const canManageAttendanceSettings = computed(() => {
|
|
29
|
+
if (!userAppRole.value) return true;
|
|
30
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
31
|
+
return hasPermission(
|
|
32
|
+
userAppRole.value,
|
|
33
|
+
permissions,
|
|
34
|
+
"attendance-mgmt",
|
|
35
|
+
"manage-attendance-settings"
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const canViewOwnAttendance = computed(() => {
|
|
40
|
+
if (!userAppRole.value) return true;
|
|
41
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
42
|
+
return hasPermission(
|
|
43
|
+
userAppRole.value,
|
|
44
|
+
permissions,
|
|
45
|
+
"my-attendance",
|
|
46
|
+
"see-own-attendance"
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const canCheckInOut = computed(() => {
|
|
51
|
+
if (!userAppRole.value) return true;
|
|
52
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
53
|
+
return hasPermission(
|
|
54
|
+
userAppRole.value,
|
|
55
|
+
permissions,
|
|
56
|
+
"my-attendance",
|
|
57
|
+
"check-in-out"
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
canViewAllAttendance,
|
|
63
|
+
canViewAttendanceDetails,
|
|
64
|
+
canManageAttendanceSettings,
|
|
65
|
+
canViewOwnAttendance,
|
|
66
|
+
canCheckInOut,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -231,8 +231,8 @@ export default function useBuilding() {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
function deleteById(id: string) {
|
|
234
|
-
return useNuxtApp().$api(`/api/buildings
|
|
235
|
-
method: "
|
|
234
|
+
return useNuxtApp().$api(`/api/buildings/${id}`, {
|
|
235
|
+
method: "PUT",
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
|
|
@@ -90,8 +90,8 @@ export default function useBuildingUnit() {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
function deleteById(id: string) {
|
|
93
|
-
return useNuxtApp().$api(`/api/building-units
|
|
94
|
-
method: "
|
|
93
|
+
return useNuxtApp().$api(`/api/building-units/${id}`, {
|
|
94
|
+
method: "PUT",
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export default function(){
|
|
2
|
+
|
|
3
|
+
const recipientList: { title: string, value: TAnnouncementRecipients }[] = [
|
|
4
|
+
{ title: "Admin", value: "admin" },
|
|
5
|
+
{ title: "Management Agency", value: "organization" },
|
|
6
|
+
{ title: "Site Personnel", value: "site" },
|
|
7
|
+
{ title: "Service Provider", value: "service-provider" },
|
|
8
|
+
{ title: "Service Provider Member", value: "service-provider-member" },
|
|
9
|
+
{ title: "Resident", value: "resident" }
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
async function add(payload: Partial<TCreateAnnouncementPayload>) {
|
|
13
|
+
return await useNuxtApp().$api<Record<string, any>>("/api/bulletin-boards", {
|
|
14
|
+
method: "POST",
|
|
15
|
+
body: payload,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function update(bulletinId: string, payload: Partial<TCreateAnnouncementPayload>) {
|
|
20
|
+
return await useNuxtApp().$api<Record<string, any>>(`/api/bulletin-boards/id/${bulletinId}`, {
|
|
21
|
+
method: "PUT",
|
|
22
|
+
body: payload,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type TGetAllParams = {
|
|
27
|
+
page?: number;
|
|
28
|
+
limit?: number;
|
|
29
|
+
sort?: 'asc' | 'desc';
|
|
30
|
+
site?: string;
|
|
31
|
+
status?: TAnnouncementStatus;
|
|
32
|
+
search?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function getAll({
|
|
36
|
+
page = 1,
|
|
37
|
+
limit = 10,
|
|
38
|
+
sort = "asc",
|
|
39
|
+
site,
|
|
40
|
+
status,
|
|
41
|
+
search
|
|
42
|
+
} : TGetAllParams) {
|
|
43
|
+
return await useNuxtApp().$api<Record<string, any>>(
|
|
44
|
+
"/api/bulletin-boards",
|
|
45
|
+
{
|
|
46
|
+
method: "GET",
|
|
47
|
+
query: {
|
|
48
|
+
page,
|
|
49
|
+
limit,
|
|
50
|
+
sort,
|
|
51
|
+
site,
|
|
52
|
+
status,
|
|
53
|
+
search
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function getBulletinById(bulletinId: string) {
|
|
61
|
+
return await useNuxtApp().$api<Record<string, any>>(`/api/bulletin-boards/id/${bulletinId}`, {
|
|
62
|
+
method: "GET",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function deleteBulletinById(bulletinId: string) {
|
|
67
|
+
return await useNuxtApp().$api<Record<string, any>>(`/api/bulletin-boards/${bulletinId}`, {
|
|
68
|
+
method: "PUT",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
recipientList,
|
|
75
|
+
add,
|
|
76
|
+
update,
|
|
77
|
+
getAll,
|
|
78
|
+
getBulletinById,
|
|
79
|
+
deleteBulletinById
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
}
|
package/composables/useCard.ts
CHANGED
|
@@ -5,6 +5,7 @@ export default function useCard() {
|
|
|
5
5
|
limit = 10,
|
|
6
6
|
status = "active",
|
|
7
7
|
site = "",
|
|
8
|
+
assignFilter = "available",
|
|
8
9
|
} = {}) {
|
|
9
10
|
return useNuxtApp().$api<Record<string, any>>(`/api/cards`, {
|
|
10
11
|
method: "GET",
|
|
@@ -14,6 +15,7 @@ export default function useCard() {
|
|
|
14
15
|
limit,
|
|
15
16
|
status,
|
|
16
17
|
site,
|
|
18
|
+
assignFilter,
|
|
17
19
|
},
|
|
18
20
|
});
|
|
19
21
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export default function useCheckout() {
|
|
2
|
+
function getCheckoutItems({
|
|
3
|
+
page = 1,
|
|
4
|
+
search = "",
|
|
5
|
+
limit = 10,
|
|
6
|
+
site = "",
|
|
7
|
+
} = {}) {
|
|
8
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
9
|
+
`/api/hygiene-checkout-items/site/${site}`,
|
|
10
|
+
{
|
|
11
|
+
method: "GET",
|
|
12
|
+
query: { page, search, limit, site },
|
|
13
|
+
},
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getCheckoutItemById(id: string) {
|
|
18
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
19
|
+
`/api/hygiene-checkout-items/id/${id}`,
|
|
20
|
+
{
|
|
21
|
+
method: "GET",
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function checkoutItems(site: string, payload: TCheckoutItemCreate) {
|
|
27
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
28
|
+
`/api/hygiene-checkout-items/site/${site}/batch`,
|
|
29
|
+
{
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: payload,
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function approveItem(id: string) {
|
|
37
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
38
|
+
`/api/hygiene-checkout-items/id/${id}/approve`,
|
|
39
|
+
{
|
|
40
|
+
method: "PATCH",
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function disapproveItem(id: string, remarks: string) {
|
|
46
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
47
|
+
`/api/hygiene-checkout-items/id/${id}/disapprove`,
|
|
48
|
+
{
|
|
49
|
+
method: "PATCH",
|
|
50
|
+
body: { remarks },
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
getCheckoutItems,
|
|
56
|
+
getCheckoutItemById,
|
|
57
|
+
checkoutItems,
|
|
58
|
+
approveItem,
|
|
59
|
+
disapproveItem,
|
|
60
|
+
};
|
|
61
|
+
}
|