@omniumretail/shared-resources 0.1.62 → 0.1.64
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/dist/bundle.js +1 -1
- package/dist/types/hooks/ATIM/PicaPonto/mutate/postAttendance.hook.d.ts +3 -5
- package/dist/types/hooks/ATIM/PicaPonto/mutate/postTogglePinCode.d.ts +4 -4
- package/dist/types/hooks/Asta/Template/others/archiveTemplateQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/Template/others/deleteTemplateQuery.hook.d.ts +5 -1
- package/dist/types/hooks/Asta/Template/others/duplicateTemplateQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/Template/others/finishTemplateQuery.hook.d.ts +5 -1
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/interfaces/Responses.d.ts +10 -0
- package/dist/types/interfaces/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/hooks/ATIM/PicaPonto/mutate/postAttendance.hook.ts +14 -17
- package/src/hooks/ATIM/PicaPonto/mutate/postTogglePinCode.ts +4 -4
- package/src/hooks/Asta/Template/others/archiveTemplateQuery.hook.ts +21 -0
- package/src/hooks/Asta/Template/others/deleteTemplateQuery.hook.ts +9 -3
- package/src/hooks/Asta/Template/others/duplicateTemplateQuery.hook.ts +21 -0
- package/src/hooks/Asta/Template/others/finishTemplateQuery.hook.ts +9 -3
- package/src/hooks/index.ts +2 -0
- package/src/interfaces/Responses.ts +16 -1
- package/src/interfaces/index.ts +3 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface PostAttendance extends UseQueryOptions<TogglePinCode> {
|
|
2
|
+
import { Attendance } from "../../../../interfaces";
|
|
3
|
+
export interface PostAttendance extends UseQueryOptions<Attendance> {
|
|
5
4
|
storeId: string;
|
|
6
5
|
employeeId: string;
|
|
7
6
|
isWorking: boolean;
|
|
8
|
-
type: AttendanceType;
|
|
9
7
|
}
|
|
10
|
-
export declare const usePostAttendance: ({ storeId, employeeId,
|
|
8
|
+
export declare const usePostAttendance: ({ storeId, employeeId, isWorking }: PostAttendance) => import("@tanstack/react-query").UseMutationResult<Attendance, unknown, Attendance, unknown>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
2
|
import { TogglePinCode } from "../../../../interfaces/Responses";
|
|
3
3
|
interface TogglePinCodeMutateProps extends UseQueryOptions<TogglePinCode> {
|
|
4
|
-
pinCode
|
|
5
|
-
storeId
|
|
6
|
-
employeeId
|
|
7
|
-
isWorking
|
|
4
|
+
pinCode: string;
|
|
5
|
+
storeId: string;
|
|
6
|
+
employeeId: string;
|
|
7
|
+
isWorking: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare const postTogglePinCode: ({ pinCode, storeId, employeeId, isWorking }: TogglePinCodeMutateProps) => import("@tanstack/react-query").UseMutationResult<TogglePinCode, unknown, TogglePinCode, unknown>;
|
|
10
10
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Template } from '../../../../interfaces';
|
|
3
|
+
export interface ArchiveTemplateProps extends UseQueryOptions<Template> {
|
|
4
|
+
templatesIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const archiveTemplateQueryHook: ({ templatesIds }: ArchiveTemplateProps) => import("@tanstack/react-query").UseMutationResult<Template, unknown, Template, unknown>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
1
2
|
import { Template } from '../../../../interfaces';
|
|
2
|
-
export
|
|
3
|
+
export interface DeleteTemplateProps extends UseQueryOptions<Template> {
|
|
4
|
+
templatesIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const deleteTemplateMutateHook: ({ templatesIds }: DeleteTemplateProps) => import("@tanstack/react-query").UseMutationResult<Template, unknown, Template, unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Template } from '../../../../interfaces';
|
|
3
|
+
export interface DuplicateTemplateProps extends UseQueryOptions<Template> {
|
|
4
|
+
templatesIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const duplicateTemplateQueryHook: ({ templatesIds }: DuplicateTemplateProps) => import("@tanstack/react-query").UseMutationResult<Template, unknown, Template, unknown>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
1
2
|
import { Template } from '../../../../interfaces';
|
|
2
|
-
export
|
|
3
|
+
export interface FinishTemplateProps extends UseQueryOptions<Template> {
|
|
4
|
+
templatesIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const finishTemplateQueryHook: ({ templatesIds }: FinishTemplateProps) => import("@tanstack/react-query").UseMutationResult<Template, unknown, Template, unknown>;
|
|
@@ -65,6 +65,8 @@ export * from './Asta/Template/get/getTemplateQuery.hook';
|
|
|
65
65
|
export * from './Asta/Template/mutate/useEvaluationCycleMutateQuery.hook';
|
|
66
66
|
export * from './Asta/Template/others/deleteTemplateQuery.hook';
|
|
67
67
|
export * from './Asta/Template/others/finishTemplateQuery.hook';
|
|
68
|
+
export * from './Asta/Template/others/archiveTemplateQuery.hook';
|
|
69
|
+
export * from './Asta/Template/others/duplicateTemplateQuery.hook';
|
|
68
70
|
export * from './Asta/Inspection/get/getInspectionQuery.hook';
|
|
69
71
|
export * from './Asta/Inspection/mutate/useInspectionMutateQuery.hook';
|
|
70
72
|
export * from './Asta/Inspection/others/deleteInspectionQuery.hook';
|
|
@@ -11,3 +11,13 @@ export interface TogglePinCode {
|
|
|
11
11
|
error?: string[];
|
|
12
12
|
success: boolean;
|
|
13
13
|
}
|
|
14
|
+
export interface Attendance {
|
|
15
|
+
Id: string;
|
|
16
|
+
StoreId: string;
|
|
17
|
+
EmployeeId: string;
|
|
18
|
+
Date: string;
|
|
19
|
+
Type: number;
|
|
20
|
+
Status: string;
|
|
21
|
+
CreateDate: string;
|
|
22
|
+
UpdateDate: string;
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import { UseQueryOptions, useMutation
|
|
2
|
-
import { TogglePinCode } from "../../../../interfaces
|
|
1
|
+
import { useQueryClient, UseQueryOptions, useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { Attendance, TogglePinCode } from "../../../../interfaces";
|
|
3
3
|
import { AttendanceType} from "../../../../enums/attendence-type.enum";
|
|
4
4
|
import { getDateToUnix } from "../../../../helpers/date-unix.helper";
|
|
5
5
|
import { postAuth0} from "../../../../services/ApiService";
|
|
6
6
|
|
|
7
|
-
export interface PostAttendance extends UseQueryOptions<
|
|
7
|
+
export interface PostAttendance extends UseQueryOptions<Attendance>{
|
|
8
8
|
storeId: string;
|
|
9
9
|
employeeId: string;
|
|
10
10
|
isWorking: boolean;
|
|
11
|
-
type: AttendanceType;
|
|
12
|
-
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
export const usePostAttendance = ({ storeId, employeeId,
|
|
13
|
+
export const usePostAttendance = ({ storeId, employeeId, isWorking}: PostAttendance) => {
|
|
16
14
|
const queryClient = useQueryClient();
|
|
17
|
-
return useMutation<
|
|
18
|
-
return postAuth0(
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
return useMutation<Attendance, unknown, Attendance>((data: Attendance) => {
|
|
16
|
+
return postAuth0('/Attendances', {
|
|
17
|
+
StoreId: storeId,
|
|
18
|
+
EmployeeId: employeeId,
|
|
21
19
|
Date: getDateToUnix(new Date()),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
Type: isWorking ? AttendanceType.ENTER : AttendanceType.EXIT
|
|
21
|
+
|
|
22
|
+
}, data);
|
|
25
23
|
}, {
|
|
26
|
-
onSuccess: (data:
|
|
24
|
+
onSuccess: (data: Attendance) => {
|
|
27
25
|
queryClient.setQueryData(
|
|
28
|
-
['
|
|
29
|
-
}
|
|
30
|
-
|
|
26
|
+
['POST_ATTENDANCE'], data);
|
|
27
|
+
},
|
|
31
28
|
});
|
|
32
29
|
}
|
|
@@ -3,10 +3,10 @@ import { TogglePinCode } from "../../../../interfaces/Responses";
|
|
|
3
3
|
import { postAuth0 } from "../../../../services/ApiService";
|
|
4
4
|
|
|
5
5
|
interface TogglePinCodeMutateProps extends UseQueryOptions<TogglePinCode>{
|
|
6
|
-
pinCode
|
|
7
|
-
storeId
|
|
8
|
-
employeeId
|
|
9
|
-
isWorking
|
|
6
|
+
pinCode: string;
|
|
7
|
+
storeId: string;
|
|
8
|
+
employeeId: string;
|
|
9
|
+
isWorking: boolean;
|
|
10
10
|
}
|
|
11
11
|
export const postTogglePinCode = ({pinCode, storeId, employeeId, isWorking }: TogglePinCodeMutateProps) => {
|
|
12
12
|
const queryClient = useQueryClient();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Template } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface ArchiveTemplateProps extends UseQueryOptions<Template> {
|
|
6
|
+
templatesIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const archiveTemplateQueryHook = ({ templatesIds }: ArchiveTemplateProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<Template, unknown, Template>((data: Template) => {
|
|
12
|
+
return putAuth0(`/ASTA/Template/FileTemplateList`, {
|
|
13
|
+
templatesIds
|
|
14
|
+
}, data)
|
|
15
|
+
}, {
|
|
16
|
+
onSuccess: (data: Template) => {
|
|
17
|
+
queryClient.setQueryData(
|
|
18
|
+
['TEMPLATE_ID_QUERY'], data);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
2
|
import { Template } from '../../../../interfaces';
|
|
3
3
|
import { toDeleteAuth0 } from '../../../../services/ApiService';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface DeleteTemplateProps extends UseQueryOptions<Template> {
|
|
6
|
+
templatesIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const deleteTemplateMutateHook = ({ templatesIds }: DeleteTemplateProps) => {
|
|
6
10
|
const queryClient = useQueryClient();
|
|
7
11
|
return useMutation<Template, unknown, Template>((data: Template) => {
|
|
8
|
-
return toDeleteAuth0(`/ASTA/Template/
|
|
12
|
+
return toDeleteAuth0(`/ASTA/Template/DeleteTemplateList`, {
|
|
13
|
+
templatesIds
|
|
14
|
+
}, data)
|
|
9
15
|
}, {
|
|
10
16
|
onSuccess: () => {
|
|
11
17
|
queryClient.invalidateQueries(
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Template } from '../../../../interfaces';
|
|
3
|
+
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
|
+
|
|
5
|
+
export interface DuplicateTemplateProps extends UseQueryOptions<Template> {
|
|
6
|
+
templatesIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const duplicateTemplateQueryHook = ({ templatesIds }: DuplicateTemplateProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<Template, unknown, Template>((data: Template) => {
|
|
12
|
+
return putAuth0(`/ASTA/Template/DuplicateTemplateList`, {
|
|
13
|
+
templatesIds
|
|
14
|
+
}, data)
|
|
15
|
+
}, {
|
|
16
|
+
onSuccess: (data: Template) => {
|
|
17
|
+
queryClient.setQueryData(
|
|
18
|
+
['TEMPLATE_ID_QUERY'], data);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
2
|
import { Template } from '../../../../interfaces';
|
|
3
3
|
import { putAuth0 } from '../../../../services/ApiService';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface FinishTemplateProps extends UseQueryOptions<Template> {
|
|
6
|
+
templatesIds: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const finishTemplateQueryHook = ({ templatesIds }: FinishTemplateProps) => {
|
|
6
10
|
const queryClient = useQueryClient();
|
|
7
11
|
return useMutation<Template, unknown, Template>((data: Template) => {
|
|
8
|
-
return putAuth0(`/ASTA/Template/
|
|
12
|
+
return putAuth0(`/ASTA/Template/FinishedTemplateList`, {
|
|
13
|
+
templatesIds
|
|
14
|
+
}, data)
|
|
9
15
|
}, {
|
|
10
16
|
onSuccess: (data: Template) => {
|
|
11
17
|
queryClient.setQueryData(
|
package/src/hooks/index.ts
CHANGED
|
@@ -88,6 +88,8 @@ export * from './Asta/Template/get/getTemplateQuery.hook';
|
|
|
88
88
|
export * from './Asta/Template/mutate/useEvaluationCycleMutateQuery.hook';
|
|
89
89
|
export * from './Asta/Template/others/deleteTemplateQuery.hook';
|
|
90
90
|
export * from './Asta/Template/others/finishTemplateQuery.hook';
|
|
91
|
+
export * from './Asta/Template/others/archiveTemplateQuery.hook';
|
|
92
|
+
export * from './Asta/Template/others/duplicateTemplateQuery.hook';
|
|
91
93
|
|
|
92
94
|
export * from './Asta/Inspection/get/getInspectionQuery.hook';
|
|
93
95
|
export * from './Asta/Inspection/mutate/useInspectionMutateQuery.hook';
|
|
@@ -2,6 +2,7 @@ import { Employee} from './Employee';
|
|
|
2
2
|
import { WorkLog } from './TimeKeeping';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
//Response Interfaces
|
|
6
7
|
|
|
7
8
|
export interface EmployeeTimeKeeping {
|
|
@@ -12,12 +13,26 @@ export interface EmployeeTimeKeeping {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface TogglePinCode {
|
|
15
|
-
|
|
16
16
|
workLog?: WorkLog;
|
|
17
17
|
error?: string[];
|
|
18
18
|
success: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export interface Attendance {
|
|
22
|
+
Id: string;
|
|
23
|
+
StoreId: string;
|
|
24
|
+
EmployeeId: string;
|
|
25
|
+
Date: string;
|
|
26
|
+
Type: number;
|
|
27
|
+
Status: string;
|
|
28
|
+
CreateDate: string;
|
|
29
|
+
UpdateDate: string;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
21
36
|
|
|
22
37
|
|
|
23
38
|
|