@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,78 @@
|
|
|
1
|
+
export default function useLocation() {
|
|
2
|
+
function getCountries() {
|
|
3
|
+
return useNuxtApp()
|
|
4
|
+
.$api<Record<string, any>>("/json/country.json", {
|
|
5
|
+
method: "GET",
|
|
6
|
+
})
|
|
7
|
+
.then((countries) =>
|
|
8
|
+
countries
|
|
9
|
+
.map((c: any) => c.name)
|
|
10
|
+
.sort((a: string, b: string) => a.localeCompare(b)),
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function getAddressByPostalCode(postalCode: string, country?: string) {
|
|
15
|
+
const countryISOMap: Record<string, string> = {
|
|
16
|
+
Singapore: "sg",
|
|
17
|
+
Malaysia: "my",
|
|
18
|
+
"United States": "us",
|
|
19
|
+
"United Kingdom": "gb",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const isoCode = country
|
|
23
|
+
? countryISOMap[country] || country.toLowerCase()
|
|
24
|
+
: undefined;
|
|
25
|
+
|
|
26
|
+
return useNuxtApp()
|
|
27
|
+
.$api<Record<string, any>[]>(
|
|
28
|
+
"https://nominatim.openstreetmap.org/search",
|
|
29
|
+
{
|
|
30
|
+
method: "GET",
|
|
31
|
+
query: {
|
|
32
|
+
postalcode: postalCode,
|
|
33
|
+
country: isoCode,
|
|
34
|
+
format: "json",
|
|
35
|
+
limit: 1,
|
|
36
|
+
addressdetails: 1,
|
|
37
|
+
},
|
|
38
|
+
headers: {
|
|
39
|
+
"User-Agent": "iService365-Hygiene-App",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
)
|
|
43
|
+
.then((data) => (data?.length ? data[0] : null));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function searchLocationByAddress({
|
|
47
|
+
postalCode,
|
|
48
|
+
city,
|
|
49
|
+
address,
|
|
50
|
+
country,
|
|
51
|
+
}: TLocationSearchParams) {
|
|
52
|
+
const searchParts = [postalCode, city, address, country].filter(Boolean);
|
|
53
|
+
|
|
54
|
+
return useNuxtApp()
|
|
55
|
+
.$api<Record<string, any>[]>(
|
|
56
|
+
"https://nominatim.openstreetmap.org/search",
|
|
57
|
+
{
|
|
58
|
+
method: "GET",
|
|
59
|
+
query: {
|
|
60
|
+
q: searchParts.join(", "),
|
|
61
|
+
format: "json",
|
|
62
|
+
limit: 1,
|
|
63
|
+
addressdetails: 1,
|
|
64
|
+
},
|
|
65
|
+
headers: {
|
|
66
|
+
"User-Agent": "iService365-Hygiene-App",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
)
|
|
70
|
+
.then((data) => (data?.length ? data[0] : null));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
getCountries,
|
|
75
|
+
getAddressByPostalCode,
|
|
76
|
+
searchLocationByAddress,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -24,19 +24,26 @@ export default function useOnlineForm() {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
function getOnlineFormById(id: string) {
|
|
27
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
28
|
+
`/api/online-forms/id/${id}`,
|
|
29
|
+
{
|
|
30
|
+
method: "GET",
|
|
31
|
+
}
|
|
32
|
+
);
|
|
30
33
|
}
|
|
31
34
|
function updateOnlineFormById(id: string, value: any) {
|
|
32
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
36
|
+
`/api/online-forms/id/${id}`,
|
|
37
|
+
{
|
|
38
|
+
method: "PUT",
|
|
39
|
+
body: value,
|
|
40
|
+
}
|
|
41
|
+
);
|
|
36
42
|
}
|
|
37
43
|
function deleteOnlineFormById(id: string) {
|
|
38
|
-
return useNuxtApp().$api(`/api/online-forms/
|
|
39
|
-
method: "
|
|
44
|
+
return useNuxtApp().$api(`/api/online-forms/deleted/online-form`, {
|
|
45
|
+
method: "PUT",
|
|
46
|
+
query: { id },
|
|
40
47
|
});
|
|
41
48
|
}
|
|
42
49
|
function getAllBySiteId(
|
package/composables/usePeople.ts
CHANGED
|
@@ -1,88 +1,103 @@
|
|
|
1
|
-
export default function(){
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
query: { page, limit, sort, search, org, site, dateTo, dateFrom, type }
|
|
19
|
-
});
|
|
1
|
+
export default function () {
|
|
2
|
+
async function getAll({
|
|
3
|
+
page = 1,
|
|
4
|
+
limit = 10,
|
|
5
|
+
sort = "asc",
|
|
6
|
+
search = "",
|
|
7
|
+
org = "",
|
|
8
|
+
site = "",
|
|
9
|
+
dateTo = "",
|
|
10
|
+
dateFrom = "",
|
|
11
|
+
type = "",
|
|
12
|
+
displayNoCheckOut = false,
|
|
13
|
+
} = {}) {
|
|
14
|
+
return await useNuxtApp().$api<Record<string, any>>("/api/people", {
|
|
15
|
+
method: "GET",
|
|
16
|
+
query: { page, limit, sort, search, org, site, dateTo, dateFrom, type },
|
|
17
|
+
});
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
async function findPersonByNRIC(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
async function findPersonByNRIC(
|
|
21
|
+
nric: string
|
|
22
|
+
): Promise<null | Partial<TPeople>> {
|
|
23
|
+
return await $fetch<Record<string, any>>(`/api/people/nric/${nric}`, {
|
|
24
|
+
method: "GET",
|
|
25
|
+
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async function findPersonByContact(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
async function findPersonByContact(
|
|
29
|
+
contact: string
|
|
30
|
+
): Promise<null | Partial<TPeople>> {
|
|
31
|
+
return await $fetch<Record<string, any>>(`/api/people/contact/${contact}`, {
|
|
32
|
+
method: "GET",
|
|
33
|
+
});
|
|
32
34
|
}
|
|
33
|
-
async function findUsersByPlateNumber(
|
|
34
|
-
|
|
35
|
+
async function findUsersByPlateNumber(
|
|
36
|
+
plateNumber: string
|
|
37
|
+
): Promise<null | Partial<TPeople>> {
|
|
38
|
+
return await $fetch<Record<string, any>>(
|
|
39
|
+
`/api/people/plateNumber/${plateNumber}`,
|
|
40
|
+
{
|
|
35
41
|
method: "GET",
|
|
36
|
-
query: { limit: 20 }
|
|
37
|
-
}
|
|
42
|
+
query: { limit: 20 },
|
|
43
|
+
}
|
|
44
|
+
);
|
|
38
45
|
}
|
|
39
46
|
|
|
40
|
-
async function searchCompanyList(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
async function searchCompanyList(
|
|
48
|
+
company: string
|
|
49
|
+
): Promise<null | Partial<TPeople>> {
|
|
50
|
+
return await $fetch<Record<string, any>>("/api/people/company", {
|
|
51
|
+
method: "GET",
|
|
52
|
+
query: { search: company },
|
|
53
|
+
});
|
|
45
54
|
}
|
|
46
55
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
async function create(payload: Partial<TPeoplePayload>) {
|
|
57
|
+
return await useNuxtApp().$api<Record<string, any>>("/api/people", {
|
|
58
|
+
method: "POST",
|
|
59
|
+
body: payload,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
async function updateById(_id: string, payload: Partial<TPeoplePayload>) {
|
|
64
|
+
return await useNuxtApp().$api<Record<string, any>>(
|
|
65
|
+
`/api/people/id/${_id}`,
|
|
66
|
+
{
|
|
56
67
|
method: "PUT",
|
|
57
68
|
body: payload,
|
|
58
|
-
}
|
|
59
|
-
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
60
72
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
async function deleteById(_id: string) {
|
|
74
|
+
return await useNuxtApp().$api<Record<string, any>>(`/api/people/${_id}`, {
|
|
75
|
+
method: "PUT",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
66
78
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
async function getPeopleByUnit(
|
|
80
|
+
_id: string,
|
|
81
|
+
{ status = "active", type = "resident" } = {}
|
|
82
|
+
) {
|
|
83
|
+
return await useNuxtApp().$api<Record<string, any>>(
|
|
84
|
+
`/api/people/unit/${_id}`,
|
|
85
|
+
{
|
|
86
|
+
method: "GET",
|
|
87
|
+
query: { status, type },
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
76
91
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
92
|
+
return {
|
|
93
|
+
create,
|
|
94
|
+
getAll,
|
|
95
|
+
updateById,
|
|
96
|
+
deleteById,
|
|
97
|
+
findPersonByNRIC,
|
|
98
|
+
findPersonByContact,
|
|
99
|
+
getPeopleByUnit,
|
|
100
|
+
searchCompanyList,
|
|
101
|
+
findUsersByPlateNumber,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default function useQR() {
|
|
2
|
+
async function downloadQR(url: string, filename: string = "qrcode") {
|
|
3
|
+
const res = await useNuxtApp().$api<Blob | MediaSource>(
|
|
4
|
+
`/api/hygiene-qr/generate`,
|
|
5
|
+
{
|
|
6
|
+
method: "GET",
|
|
7
|
+
query: {
|
|
8
|
+
url,
|
|
9
|
+
filename,
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
if (!res) throw new Error("Error downloading QR code");
|
|
15
|
+
|
|
16
|
+
const downloadUrl = window.URL.createObjectURL(res);
|
|
17
|
+
const a = document.createElement("a");
|
|
18
|
+
a.href = downloadUrl;
|
|
19
|
+
a.download = `${filename}.png`;
|
|
20
|
+
document.body.appendChild(a);
|
|
21
|
+
a.click();
|
|
22
|
+
document.body.removeChild(a);
|
|
23
|
+
window.URL.revokeObjectURL(downloadUrl);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
downloadQR,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export default function useScheduleTask() {
|
|
2
|
+
async function getScheduleTasks({
|
|
3
|
+
site = "",
|
|
4
|
+
search = "",
|
|
5
|
+
page = 1,
|
|
6
|
+
limit = 10,
|
|
7
|
+
} = {}) {
|
|
8
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
9
|
+
`/api/hygiene-schedule-tasks/site/${site}`,
|
|
10
|
+
{
|
|
11
|
+
method: "GET",
|
|
12
|
+
query: {
|
|
13
|
+
site,
|
|
14
|
+
search,
|
|
15
|
+
page,
|
|
16
|
+
limit,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getScheduleTaskById(id: string) {
|
|
23
|
+
return useNuxtApp().$api<TScheduleTask>(
|
|
24
|
+
`/api/hygiene-schedule-tasks/id/${id}`,
|
|
25
|
+
{
|
|
26
|
+
method: "GET",
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function createScheduleTask(payload: {
|
|
32
|
+
title: string;
|
|
33
|
+
time: string;
|
|
34
|
+
startDate?: string;
|
|
35
|
+
endDate?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
areas: { name: string; value: string }[];
|
|
38
|
+
site: string;
|
|
39
|
+
}) {
|
|
40
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
41
|
+
`/api/hygiene-schedule-tasks/site/${payload.site}`,
|
|
42
|
+
{
|
|
43
|
+
method: "POST",
|
|
44
|
+
body: {
|
|
45
|
+
title: payload.title,
|
|
46
|
+
time: payload.time,
|
|
47
|
+
startDate: payload.startDate,
|
|
48
|
+
endDate: payload.endDate,
|
|
49
|
+
description: payload.description,
|
|
50
|
+
areas: payload.areas,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function updateScheduleTask(
|
|
57
|
+
id: string,
|
|
58
|
+
payload: {
|
|
59
|
+
title: string;
|
|
60
|
+
time: string;
|
|
61
|
+
startDate?: string;
|
|
62
|
+
endDate?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
areas: { name: string; value: string }[];
|
|
65
|
+
},
|
|
66
|
+
) {
|
|
67
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
68
|
+
`/api/hygiene-schedule-tasks/id/${id}`,
|
|
69
|
+
{
|
|
70
|
+
method: "PATCH",
|
|
71
|
+
body: {
|
|
72
|
+
title: payload.title,
|
|
73
|
+
time: payload.time,
|
|
74
|
+
startDate: payload.startDate,
|
|
75
|
+
endDate: payload.endDate,
|
|
76
|
+
description: payload.description,
|
|
77
|
+
areas: payload.areas,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
getScheduleTasks,
|
|
85
|
+
createScheduleTask,
|
|
86
|
+
updateScheduleTask,
|
|
87
|
+
getScheduleTaskById,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export default function useScheduleTaskArea() {
|
|
2
|
+
async function getAreas({
|
|
3
|
+
site = "",
|
|
4
|
+
search = "",
|
|
5
|
+
page = 1,
|
|
6
|
+
limit = 10,
|
|
7
|
+
} = {}) {
|
|
8
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
9
|
+
"/api/hygiene-schedule-task-area",
|
|
10
|
+
{
|
|
11
|
+
method: "GET",
|
|
12
|
+
query: {
|
|
13
|
+
site,
|
|
14
|
+
search,
|
|
15
|
+
page,
|
|
16
|
+
limit,
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function createArea(name: string, site: string) {
|
|
23
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
24
|
+
"/api/hygiene-schedule-task-area",
|
|
25
|
+
{
|
|
26
|
+
method: "POST",
|
|
27
|
+
body: {
|
|
28
|
+
name,
|
|
29
|
+
site,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function updateArea(id: string, name: string) {
|
|
36
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
37
|
+
`/api/hygiene-schedule-task-area/id/${id}`,
|
|
38
|
+
{
|
|
39
|
+
method: "PATCH",
|
|
40
|
+
body: { name },
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function deleteArea(id: string) {
|
|
46
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
47
|
+
`/api/hygiene-schedule-task-area/id/${id}`,
|
|
48
|
+
{
|
|
49
|
+
method: "DELETE",
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function getAreaById(id: string) {
|
|
55
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
56
|
+
`/api/hygiene-schedule-task-area/id/${id}`,
|
|
57
|
+
{
|
|
58
|
+
method: "GET",
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function uploadAreas(file: File, site: string) {
|
|
64
|
+
const formData = new FormData();
|
|
65
|
+
formData.append("file", file);
|
|
66
|
+
formData.append("site", site);
|
|
67
|
+
|
|
68
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
69
|
+
"/api/hygiene-schedule-task-area/upload",
|
|
70
|
+
{
|
|
71
|
+
method: "POST",
|
|
72
|
+
body: formData,
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
getAreas,
|
|
79
|
+
createArea,
|
|
80
|
+
updateArea,
|
|
81
|
+
deleteArea,
|
|
82
|
+
getAreaById,
|
|
83
|
+
uploadAreas,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export default function useScheduleTaskPermission() {
|
|
2
|
+
const { hasPermission } = usePermission();
|
|
3
|
+
const { permissions } = useCleaningPermission();
|
|
4
|
+
const { userAppRole } = useLocalSetup();
|
|
5
|
+
|
|
6
|
+
const canViewScheduleTasks = computed(() => {
|
|
7
|
+
if (!userAppRole.value) return true;
|
|
8
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
9
|
+
return hasPermission(
|
|
10
|
+
userAppRole.value,
|
|
11
|
+
permissions,
|
|
12
|
+
"schedule-task-mgmt",
|
|
13
|
+
"see-all-schedule-tasks"
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const canCreateScheduleTask = computed(() => {
|
|
18
|
+
if (!userAppRole.value) return true;
|
|
19
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
20
|
+
return hasPermission(
|
|
21
|
+
userAppRole.value,
|
|
22
|
+
permissions,
|
|
23
|
+
"schedule-task-mgmt",
|
|
24
|
+
"add-schedule-task"
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const canUpdateScheduleTask = computed(() => {
|
|
29
|
+
if (!userAppRole.value) return true;
|
|
30
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
31
|
+
return hasPermission(
|
|
32
|
+
userAppRole.value,
|
|
33
|
+
permissions,
|
|
34
|
+
"schedule-task-mgmt",
|
|
35
|
+
"update-schedule-task"
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const canDeleteScheduleTask = computed(() => {
|
|
40
|
+
if (!userAppRole.value) return true;
|
|
41
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
42
|
+
return hasPermission(
|
|
43
|
+
userAppRole.value,
|
|
44
|
+
permissions,
|
|
45
|
+
"schedule-task-mgmt",
|
|
46
|
+
"delete-schedule-task"
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const canViewScheduleTaskDetails = computed(() => {
|
|
51
|
+
if (!userAppRole.value) return true;
|
|
52
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
53
|
+
return hasPermission(
|
|
54
|
+
userAppRole.value,
|
|
55
|
+
permissions,
|
|
56
|
+
"schedule-task-mgmt",
|
|
57
|
+
"see-schedule-task-details"
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
canViewScheduleTasks,
|
|
63
|
+
canCreateScheduleTask,
|
|
64
|
+
canUpdateScheduleTask,
|
|
65
|
+
canDeleteScheduleTask,
|
|
66
|
+
canViewScheduleTaskDetails,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default function useSiteEntryPassSettings() {
|
|
2
2
|
function getBySiteId(siteId: string) {
|
|
3
3
|
return useNuxtApp().$api<Record<string, any>>(
|
|
4
|
-
`/api/
|
|
4
|
+
`/api/access-management/settings/${siteId}`,
|
|
5
5
|
{
|
|
6
6
|
method: "GET",
|
|
7
7
|
}
|
|
@@ -17,9 +17,9 @@ export default function useSiteEntryPassSettings() {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function save(value: any) {
|
|
21
21
|
return useNuxtApp().$api<Record<string, any>>(
|
|
22
|
-
"/api/
|
|
22
|
+
"/api/access-management/settings",
|
|
23
23
|
{
|
|
24
24
|
method: "POST",
|
|
25
25
|
body: value,
|
|
@@ -27,20 +27,9 @@ export default function useSiteEntryPassSettings() {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function updateBySiteId(value: any, siteId: string) {
|
|
31
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
32
|
-
"/api/site-entrypass-settings/site/" + siteId,
|
|
33
|
-
{
|
|
34
|
-
method: "PUT",
|
|
35
|
-
body: value,
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
30
|
return {
|
|
41
31
|
getBySiteId,
|
|
42
32
|
getById,
|
|
43
|
-
|
|
44
|
-
updateBySiteId,
|
|
33
|
+
save,
|
|
45
34
|
};
|
|
46
35
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default function useStock() {
|
|
2
|
+
function getStockBySupply(
|
|
3
|
+
site: string,
|
|
4
|
+
supply: string,
|
|
5
|
+
page = 1,
|
|
6
|
+
search = "",
|
|
7
|
+
limit = 10
|
|
8
|
+
) {
|
|
9
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
10
|
+
`/api/hygiene-stocks/site/${site}/supply/${supply}`,
|
|
11
|
+
{ method: "GET", query: { page, search, limit } }
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function createStock(site: string, id: string, payload: TStockCreate) {
|
|
16
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
17
|
+
`/api/hygiene-stocks/site/${site}/supply/${id}`,
|
|
18
|
+
{
|
|
19
|
+
method: "POST",
|
|
20
|
+
body: {
|
|
21
|
+
qty: payload.qty,
|
|
22
|
+
remarks: payload.remarks,
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function requestItem(site: string, id: string, payload: TStockCreate) {
|
|
29
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
30
|
+
`/api/hygiene-request-items/site/${site}/supply/${id}`,
|
|
31
|
+
{
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: {
|
|
34
|
+
qty: payload.qty,
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
createStock,
|
|
42
|
+
getStockBySupply,
|
|
43
|
+
requestItem,
|
|
44
|
+
};
|
|
45
|
+
}
|