@omniumretail/shared-resources 0.1.61 → 0.1.63
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/enums/attendence-type.enum.d.ts +4 -0
- package/dist/types/enums/employees-order.enum.d.ts +6 -0
- package/dist/types/helpers/codeMutation.d.ts +4 -0
- package/dist/types/helpers/date-unix.helper.d.ts +5 -0
- package/dist/types/helpers/formatted-date.helper.d.ts +1 -0
- package/dist/types/helpers/getChildrenByType.helper.d.ts +2 -0
- package/dist/types/hooks/ATIM/PicaPonto/get/getEmployeesWithTimekeeping.hook.d.ts +14 -0
- package/dist/types/hooks/ATIM/PicaPonto/mutate/postAttendance.hook.d.ts +8 -0
- package/dist/types/hooks/ATIM/PicaPonto/mutate/postTogglePinCode.d.ts +10 -0
- package/dist/types/hooks/ATIM/PicaPonto/mutate/postVerifyUserQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Answer/get/getAstaAnswerQuery.hook.d.ts +11 -0
- package/dist/types/hooks/Asta/Answer/mutate/useAstaAnswersMutateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Answer/others/finishAstaAnswersQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Answer/others/putAnswerImageQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Inspection/get/getInspectionQuery.hook.d.ts +11 -0
- package/dist/types/hooks/Asta/Inspection/mutate/useInspectionMutateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Inspection/others/deleteInspectionQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Inspection/others/finishInspectionQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Template/get/getTemplateByIdQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Template/get/getTemplateHeadersQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Template/get/getTemplateQuery.hook.d.ts +11 -0
- package/dist/types/hooks/Asta/Template/mutate/useEvaluationCycleMutateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Template/others/deleteTemplateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/Template/others/finishTemplateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/index.d.ts +17 -1
- package/dist/types/interfaces/Answer.d.ts +1 -0
- package/dist/types/interfaces/AstaQuestions.d.ts +9 -0
- package/dist/types/interfaces/Employee.d.ts +10 -0
- package/dist/types/interfaces/Inspection.d.ts +20 -0
- package/dist/types/interfaces/Responses.d.ts +23 -0
- package/dist/types/interfaces/Template.d.ts +25 -0
- package/dist/types/interfaces/TimeKeeping.d.ts +12 -0
- package/dist/types/interfaces/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/hooks/ATIM/PicaPonto/mutate/postAttendance.hook.ts +15 -18
- package/src/hooks/ATIM/PicaPonto/mutate/postTogglePinCode.ts +4 -4
- package/src/hooks/Asta/Template/get/getTemplateHeadersQuery.hook.ts +2 -2
- package/src/interfaces/Responses.ts +16 -1
- package/src/interfaces/index.ts +3 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MenuProps } from 'antd';
|
|
3
|
+
export type MenuItem = Required<MenuProps>['items'][number];
|
|
4
|
+
export declare function getItem(label: React.ReactNode, key: React.Key, icon?: React.ReactNode, children?: MenuItem[], type?: 'group'): MenuItem;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
export declare const getDateFromUnix: <T = string | dayjs.Dayjs>(unixDate: number, formatStr?: string) => T;
|
|
3
|
+
export declare const getDateToUnix: (date: Date) => number | null;
|
|
4
|
+
export declare const getUnixFromDateString: (dateString: string) => number | null;
|
|
5
|
+
export declare const getDateStringToUnix: (dateUnix: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getFormattedDate: (seconds: number, defaultValue?: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { EmployeeTimeKeeping } from "../../../../interfaces/Responses";
|
|
3
|
+
import { ResponseList } from '../../../../interfaces';
|
|
4
|
+
interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"EmployeesWorkLogs", EmployeeTimeKeeping>> {
|
|
5
|
+
storeId?: string;
|
|
6
|
+
date?: number;
|
|
7
|
+
search?: string;
|
|
8
|
+
page?: number;
|
|
9
|
+
records?: number;
|
|
10
|
+
sortBy?: string;
|
|
11
|
+
sortDirection?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const getEmployeesWithTimekeeping: ({ storeId, date, search, page, records, sortBy, sortDirection }: EmployeesWithTimekeepingProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"EmployeesWorkLogs", EmployeeTimeKeeping>, unknown>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { Attendance } from "../../../../interfaces";
|
|
3
|
+
export interface PostAttendance extends UseQueryOptions<Attendance> {
|
|
4
|
+
storeId: string;
|
|
5
|
+
employeeId: string;
|
|
6
|
+
isWorking: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const usePostAttendance: ({ storeId, employeeId, isWorking }: PostAttendance) => import("@tanstack/react-query").UseMutationResult<Attendance, unknown, Attendance, unknown>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { TogglePinCode } from "../../../../interfaces/Responses";
|
|
3
|
+
interface TogglePinCodeMutateProps extends UseQueryOptions<TogglePinCode> {
|
|
4
|
+
pinCode: string;
|
|
5
|
+
storeId: string;
|
|
6
|
+
employeeId: string;
|
|
7
|
+
isWorking: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const postTogglePinCode: ({ pinCode, storeId, employeeId, isWorking }: TogglePinCodeMutateProps) => import("@tanstack/react-query").UseMutationResult<TogglePinCode, unknown, TogglePinCode, unknown>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { Answer, ResponseList } from "../../../../interfaces";
|
|
3
|
+
export interface AstaAnswersQueryProps extends UseQueryOptions<ResponseList<"Answers", Answer>> {
|
|
4
|
+
tags?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
records?: number;
|
|
7
|
+
sortBy?: string;
|
|
8
|
+
sortDirection?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getAstaAnswersQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: AstaAnswersQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Answers", Answer>, unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { Inspection, ResponseList } from "../../../../interfaces";
|
|
3
|
+
export interface InspectionQueryProps extends UseQueryOptions<ResponseList<"Inspection", Inspection>> {
|
|
4
|
+
tags?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
records?: number;
|
|
7
|
+
sortBy?: string;
|
|
8
|
+
sortDirection?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getInspectionQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: InspectionQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Inspection", Inspection>, unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { Template, ResponseList } from "../../../../interfaces";
|
|
3
|
+
export interface TemplateQueryProps extends UseQueryOptions<ResponseList<"Templates", Template>> {
|
|
4
|
+
tags?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
records?: number;
|
|
7
|
+
sortBy?: string;
|
|
8
|
+
sortDirection?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getTemplateQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: TemplateQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Templates", Template>, unknown>;
|
|
@@ -56,6 +56,23 @@ export * from './Astt/mutate/putTransferDocumentsStateMutateQuery.hook';
|
|
|
56
56
|
export * from './Astt/get/getReportsBuilderQuery.hook';
|
|
57
57
|
export * from './Astt/get/getRfidQuery.hook';
|
|
58
58
|
export * from './Astt/get/getProductsListingQuery.hook';
|
|
59
|
+
export * from './ATIM/PicaPonto/get/getEmployeesWithTimekeeping.hook';
|
|
60
|
+
export * from './ATIM/PicaPonto/mutate/postVerifyUserQuery.hook';
|
|
61
|
+
export * from './ATIM/PicaPonto/mutate/postAttendance.hook';
|
|
62
|
+
export * from './Asta/Template/get/getTemplateByIdQuery.hook';
|
|
63
|
+
export * from './Asta/Template/get/getTemplateHeadersQuery.hook';
|
|
64
|
+
export * from './Asta/Template/get/getTemplateQuery.hook';
|
|
65
|
+
export * from './Asta/Template/mutate/useEvaluationCycleMutateQuery.hook';
|
|
66
|
+
export * from './Asta/Template/others/deleteTemplateQuery.hook';
|
|
67
|
+
export * from './Asta/Template/others/finishTemplateQuery.hook';
|
|
68
|
+
export * from './Asta/Inspection/get/getInspectionQuery.hook';
|
|
69
|
+
export * from './Asta/Inspection/mutate/useInspectionMutateQuery.hook';
|
|
70
|
+
export * from './Asta/Inspection/others/deleteInspectionQuery.hook';
|
|
71
|
+
export * from './Asta/Inspection/others/finishInspectionQuery.hook';
|
|
72
|
+
export * from './Asta/Answer/get/getAstaAnswerQuery.hook';
|
|
73
|
+
export * from './Asta/Answer/mutate/useAstaAnswersMutateQuery.hook';
|
|
74
|
+
export * from './Asta/Answer/others/finishAstaAnswersQuery.hook';
|
|
75
|
+
export * from './Asta/Answer/others/putAnswerImageQuery.hook';
|
|
59
76
|
export * from './Others/useJobTitlesQuery.hook';
|
|
60
77
|
export * from './Others/useContractStatesQuery.hook';
|
|
61
78
|
export * from './Others/useApplicationDataQuery.hook';
|
|
@@ -64,7 +81,6 @@ export * from './Others/useCustomersQuery.hook';
|
|
|
64
81
|
export * from './Others/useCountriesQuery.hook';
|
|
65
82
|
export * from './Others/useCreateNotification.hook';
|
|
66
83
|
export * from './Others/postCheckoutsMutateQuery.hook';
|
|
67
|
-
export * from './Others/postVerifyUserQuery.hook';
|
|
68
84
|
export * from './Others/postVerifyImageQuery.hook';
|
|
69
85
|
export * from './Others/getWeeklyWorkloadQuery.hook';
|
|
70
86
|
export * from './Others/getNotificationTitleQuery.hook';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AstaCategories, HeadersInterface } from "./Template";
|
|
2
|
+
export interface Inspection {
|
|
3
|
+
Id: string;
|
|
4
|
+
TemplateId: string;
|
|
5
|
+
UserId: string;
|
|
6
|
+
UserName: string;
|
|
7
|
+
LocationName: string;
|
|
8
|
+
LocationId: string;
|
|
9
|
+
Name: string;
|
|
10
|
+
Type: string;
|
|
11
|
+
Headers: HeadersInterface[];
|
|
12
|
+
StoreId: string;
|
|
13
|
+
Store: any;
|
|
14
|
+
Total: number;
|
|
15
|
+
Date: number;
|
|
16
|
+
UpdateDate: number;
|
|
17
|
+
EmployeeId: string;
|
|
18
|
+
EmployeeName: string;
|
|
19
|
+
CategoriesDTO: AstaCategories[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Employee } from './Employee';
|
|
2
|
+
import { WorkLog } from './TimeKeeping';
|
|
3
|
+
export interface EmployeeTimeKeeping {
|
|
4
|
+
Count?: number;
|
|
5
|
+
EmployeesWorklog?: Employee[];
|
|
6
|
+
error?: string[];
|
|
7
|
+
success: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TogglePinCode {
|
|
10
|
+
workLog?: WorkLog;
|
|
11
|
+
error?: string[];
|
|
12
|
+
success: boolean;
|
|
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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AstaQuestions } from "./AstaQuestions";
|
|
2
|
+
export interface Template {
|
|
3
|
+
Id: string;
|
|
4
|
+
Name: string;
|
|
5
|
+
Type: string;
|
|
6
|
+
Headers: HeadersInterface[];
|
|
7
|
+
StoreId: string;
|
|
8
|
+
Store: any;
|
|
9
|
+
Total: number;
|
|
10
|
+
Date: number;
|
|
11
|
+
UpdateDate: number;
|
|
12
|
+
EmployeeId: string;
|
|
13
|
+
EmployeeName: string;
|
|
14
|
+
CategoriesDTO: AstaCategories[];
|
|
15
|
+
}
|
|
16
|
+
export interface AstaCategories {
|
|
17
|
+
Name: string;
|
|
18
|
+
Questions: AstaQuestions[];
|
|
19
|
+
SubCategoriesDTO: AstaCategories[];
|
|
20
|
+
}
|
|
21
|
+
export interface HeadersInterface {
|
|
22
|
+
Id: string;
|
|
23
|
+
Name: string;
|
|
24
|
+
Value: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum WorkingStatus {
|
|
2
|
+
WORKING = "working",
|
|
3
|
+
NOT_WORKING = "not_working",
|
|
4
|
+
IN_BREAK = "in_break",
|
|
5
|
+
NOT_STARTED = "not_started"
|
|
6
|
+
}
|
|
7
|
+
export interface WorkLog {
|
|
8
|
+
LastEntry: number;
|
|
9
|
+
LastExit: number;
|
|
10
|
+
TimeWorked: number;
|
|
11
|
+
Breaks: number;
|
|
12
|
+
}
|
|
@@ -39,3 +39,9 @@ export * from './TransferAllProducts';
|
|
|
39
39
|
export * from './TransferDocumentState';
|
|
40
40
|
export * from './ReportBuilder';
|
|
41
41
|
export * from './Rfid';
|
|
42
|
+
export * from './Template';
|
|
43
|
+
export * from './AstaQuestions';
|
|
44
|
+
export * from './Inspection';
|
|
45
|
+
export * from './Responses';
|
|
46
|
+
export * from './TimeKeeping';
|
|
47
|
+
export * from './Employee';
|
package/package.json
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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,
|
|
16
|
-
const queryClient =
|
|
17
|
-
return useMutation<
|
|
18
|
-
return postAuth0(
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
export const usePostAttendance = ({ storeId, employeeId, isWorking}: PostAttendance) => {
|
|
14
|
+
const queryClient = useQueryClient();
|
|
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();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
2
|
+
import { HeadersInterface } from "../../../../interfaces";
|
|
3
3
|
import { getAuth0 } from "../../../../services/ApiService";
|
|
4
4
|
|
|
5
5
|
export const getTemplateHeadersQueryHook = () => {
|
|
6
6
|
return useQuery(
|
|
7
7
|
['TEMPLATE_HEADERS_QUERY'],
|
|
8
|
-
() => getAuth0<
|
|
8
|
+
() => getAuth0<HeadersInterface[]>(`/ASTA/Template/GetHeaders`),
|
|
9
9
|
);
|
|
10
10
|
}
|
|
@@ -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
|
|