@omniumretail/shared-resources 0.2.25 → 0.2.27

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.
@@ -0,0 +1,11 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import { ResponseList, UserBackoffice } from '../../../../interfaces';
3
+ interface EmployeeQueryOptions extends UseQueryOptions<ResponseList<'Users', UserBackoffice>> {
4
+ query?: string;
5
+ page?: number;
6
+ records?: number;
7
+ sortBy?: string;
8
+ sortDirection?: string;
9
+ }
10
+ export declare const useEmployeeQueryHook: ({ query, page, records, sortBy, sortDirection, ...options }: EmployeeQueryOptions) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Users", UserBackoffice>, unknown>;
11
+ export {};
@@ -0,0 +1,14 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import { ResponseList, EmployeesWorklog } from '../../../../interfaces';
3
+ interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"EmployeesWorkLog", EmployeesWorklog>> {
4
+ storeId?: string;
5
+ startDate?: number;
6
+ endDate?: number;
7
+ search?: string;
8
+ page?: number;
9
+ records?: number;
10
+ sortBy?: string;
11
+ sortDirection?: string;
12
+ }
13
+ export declare const useEmployeeWorklogDetails: ({ storeId, startDate, endDate, search, page, records, sortBy, sortDirection, ...options }: EmployeesWithTimekeepingProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"EmployeesWorklog", EmployeesWorklog>, unknown>;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Actions } from '../../../../interfaces';
2
+ export declare const selectActionStatusQueryHook: () => import("@tanstack/react-query").UseMutationResult<Actions, unknown, Actions, unknown>;
@@ -0,0 +1,2 @@
1
+ import { AnswerType } from '../../../../interfaces';
2
+ export declare const selectAnswerNameQueryHook: () => import("@tanstack/react-query").UseMutationResult<AnswerType, unknown, AnswerType, unknown>;
@@ -96,6 +96,7 @@ export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
96
96
  export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
97
97
  export * from './Asta/AnswerType/others/deleteAnswerTypeQuery.hook';
98
98
  export * from './Asta/AnswerType/others/finishAnswerTypeQuery.hook';
99
+ export * from './Asta/AnswerType/others/selectAnswerNameQuery.hook';
99
100
  export * from './Asta/Actions/get/getActionByIdQuery.hook';
100
101
  export * from './Asta/Actions/get/getActionStagesQuery.hook';
101
102
  export * from './Asta/Actions/get/getActionPriorityQuery.hook';
@@ -106,6 +107,7 @@ export * from './Asta/Actions/others/extractActionQuery.hook';
106
107
  export * from './Asta/Actions/others/archiveActionQuery.hook';
107
108
  export * from './Asta/Actions/others/finishActionQuery.hook';
108
109
  export * from './Asta/Actions/others/startActionQuery.hook';
110
+ export * from './Asta/Actions/others/selectActionStatusQuery.hook';
109
111
  export * from './Aprc/get/getPriceChangePinQuery.hook';
110
112
  export * from './Aprc/others/postPriceChangePinQuery.hook';
111
113
  export * from './Aprc/others/sendEmailWithPinQuery.hook';
@@ -120,7 +122,8 @@ export * from './OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook';
120
122
  export * from './OSUA/mutate/postCreateIntegrationRequest.hook';
121
123
  export * from './ACB/get/getClientBalance.hook';
122
124
  export * from './ACB/mutate/postClientBalance.hook';
123
- export * from './ATIM/BackOffice/get/useEmployeeTimekeepingDetails.hook';
125
+ export * from './ATIM/BackOffice/get/useEmployeeWorklogDetails.hook';
126
+ export * from './ATIM/BackOffice/get/useEmployeeQueryHook.hook';
124
127
  export * from './ATIM/BackOffice/get/useStoresQueryHook.hook';
125
128
  export * from './ATIM/BackOffice/mutate/postAttendanceRange.hook';
126
129
  export * from './Others/useJobTitlesQuery.hook';
@@ -4,6 +4,7 @@ export interface Actions {
4
4
  Description: string;
5
5
  UserName: string;
6
6
  State: string;
7
+ Stage: string;
7
8
  Priority: string;
8
9
  EndDate: number;
9
10
  InspectionAnswer: any;
@@ -10,6 +10,7 @@ export interface AnswerType {
10
10
  State: string;
11
11
  Grade: number;
12
12
  Options: AnswerTypeOptions[];
13
+ UseName: boolean;
13
14
  }
14
15
  export interface AnswerTypeOptions {
15
16
  Value: string;
@@ -32,4 +32,5 @@ export interface Location {
32
32
  export interface UserBackoffice {
33
33
  UserId: string;
34
34
  FullName: string;
35
+ DisplayName: string;
35
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -0,0 +1,30 @@
1
+ import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
+ import { getAuth0 } from '../../../../services/ApiService';
3
+ import { Store, ResponseList, UserBackoffice } from '../../../../interfaces';
4
+
5
+ interface EmployeeQueryOptions extends UseQueryOptions<ResponseList<'Users', UserBackoffice >> {
6
+ query?: string;
7
+ page?: number;
8
+ records?: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ }
12
+
13
+ export const useEmployeeQueryHook = ({ query, page, records, sortBy, sortDirection, ...options }: EmployeeQueryOptions) => {
14
+ return useQuery<ResponseList<'Users', UserBackoffice >>(
15
+ ['EMPLOYEES_QUERY', query, page, records, sortBy, sortDirection],
16
+ () =>
17
+ getAuth0('/AACP/Users', {
18
+ pPage: page,
19
+ pRecords: records,
20
+ pSortBy: sortBy,
21
+ pSortDirection: sortDirection,
22
+ pQuery: query ,
23
+ }),
24
+ {
25
+
26
+ ...options
27
+ }
28
+ );
29
+ };
30
+
@@ -1,6 +1,6 @@
1
1
  import { useQuery , UseQueryOptions} from '@tanstack/react-query';
2
2
  import { getDateToUnix } from "../../../../helpers/date-unix.helper";
3
- import { getAuth0 } from "../../../../services/ApiService";
3
+ import { get, getAuth0} from "../../../../services/ApiService";
4
4
  import { ResponseList, EmployeesWorklog } from '../../../../interfaces';
5
5
 
6
6
 
@@ -13,26 +13,29 @@ interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"Em
13
13
  records?: number;
14
14
  sortBy?: string;
15
15
  sortDirection?: string;
16
- employeeId?: string;
16
+
17
+
17
18
 
18
19
  }
19
20
 
20
- export const useEmployeeTimekeepingDetails = ({storeId, startDate, endDate, search, employeeId, page, records, sortBy, sortDirection, ...options}: EmployeesWithTimekeepingProps) => {
21
- return useQuery(
21
+ export const useEmployeeWorklogDetails = ({storeId, startDate, endDate, search, page, records, sortBy, sortDirection, ...options}: EmployeesWithTimekeepingProps) => {
22
+ return useQuery<ResponseList<"EmployeesWorklog", EmployeesWorklog>>(
22
23
  ['EMPLOYEES_WITH_TIMEKEEPING', storeId, startDate, endDate, search, page, records, sortBy, sortDirection],
23
24
  () => getAuth0<ResponseList<"EmployeesWorklog", EmployeesWorklog>>('/ATIM/EmployeesWorklogDetails', {
24
25
  pStoreId: storeId,
25
- pStartDate: startDate || getDateToUnix(new Date()),
26
- pEndDate: endDate || getDateToUnix(new Date()),
27
- pEmployeeId: employeeId,
28
26
  pPage: page || 1,
29
27
  pRecords: records,
28
+ pStartDate: startDate || getDateToUnix(new Date()),
29
+ pEndDate: endDate || getDateToUnix(new Date()),
30
30
  pSortBy: sortBy,
31
31
  pSortDirection: sortDirection,
32
- pSearch: search
32
+ pDisplayName: search,
33
+
33
34
  }),
34
35
  {
35
- keepPreviousData: true,
36
+ suspense: false,
37
+ enabled: (!!storeId && !!startDate && !!endDate),
38
+
36
39
  }
37
40
  );
38
41
  }
@@ -0,0 +1,18 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { Actions } from '../../../../interfaces';
3
+ import { putAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const selectActionStatusQueryHook = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<Actions, unknown, Actions>((data: Actions) => {
8
+ return putAuth0(`/ASTA/Actions/SelectStatus?`, {
9
+ pActionId: data.Id,
10
+ pStatus: data.Stage
11
+ }, data);
12
+ }, {
13
+ onSuccess: (data: Actions) => {
14
+ queryClient.setQueryData(
15
+ ['ACTION_STATUS_ID_QUERY'], data);
16
+ },
17
+ });
18
+ }
@@ -0,0 +1,18 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { AnswerType } from '../../../../interfaces';
3
+ import { putAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const selectAnswerNameQueryHook = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<AnswerType, unknown, AnswerType>((data: AnswerType) => {
8
+ return putAuth0(`/ASTA/AnswerType/SelectName?`, {
9
+ pAnswerTypeId: data.Id,
10
+ pUseName: data.UseName
11
+ }, data);
12
+ }, {
13
+ onSuccess: (data: AnswerType) => {
14
+ queryClient.setQueryData(
15
+ ['ANSWER_NAME_ID_QUERY'], data);
16
+ },
17
+ });
18
+ }
@@ -126,6 +126,7 @@ export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
126
126
  export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
127
127
  export * from './Asta/AnswerType/others/deleteAnswerTypeQuery.hook';
128
128
  export * from './Asta/AnswerType/others/finishAnswerTypeQuery.hook';
129
+ export * from './Asta/AnswerType/others/selectAnswerNameQuery.hook';
129
130
 
130
131
  export * from './Asta/Actions/get/getActionByIdQuery.hook';
131
132
  export * from './Asta/Actions/get/getActionStagesQuery.hook';
@@ -137,6 +138,7 @@ export * from './Asta/Actions/others/extractActionQuery.hook';
137
138
  export * from './Asta/Actions/others/archiveActionQuery.hook';
138
139
  export * from './Asta/Actions/others/finishActionQuery.hook';
139
140
  export * from './Asta/Actions/others/startActionQuery.hook';
141
+ export * from './Asta/Actions/others/selectActionStatusQuery.hook';
140
142
 
141
143
  //APRC
142
144
  export * from './Aprc/get/getPriceChangePinQuery.hook';
@@ -161,7 +163,8 @@ export * from './ACB/get/getClientBalance.hook';
161
163
  export * from './ACB/mutate/postClientBalance.hook';
162
164
 
163
165
  //BackofficeAtim
164
- export * from './ATIM/BackOffice/get/useEmployeeTimekeepingDetails.hook';
166
+ export * from './ATIM/BackOffice/get/useEmployeeWorklogDetails.hook';
167
+ export * from './ATIM/BackOffice/get/useEmployeeQueryHook.hook';
165
168
  export * from './ATIM/BackOffice/get/useStoresQueryHook.hook';
166
169
  export * from './ATIM/BackOffice/mutate/postAttendanceRange.hook';
167
170
 
@@ -5,6 +5,7 @@ export interface Actions {
5
5
  Description: string;
6
6
  UserName: string;
7
7
  State: string;
8
+ Stage: string;
8
9
  Priority: string;
9
10
  EndDate: number;
10
11
  InspectionAnswer: any;
@@ -11,6 +11,7 @@ export interface AnswerType {
11
11
  State: string;
12
12
  Grade: number;
13
13
  Options: AnswerTypeOptions[];
14
+ UseName: boolean;
14
15
  }
15
16
 
16
17
  export interface AnswerTypeOptions {
@@ -1,7 +1,3 @@
1
- import { Store } from './Store';
2
-
3
-
4
-
5
1
  export interface WorkLogDetail {
6
2
  Id: string;
7
3
  Type: number;
@@ -29,6 +25,7 @@ export interface EmployeesWorklog {
29
25
  TimeWorked: number;
30
26
  Breaks: Breaks;
31
27
  WorkDayLogs: WorkDayLog[];
28
+
32
29
  }
33
30
 
34
31
 
@@ -43,6 +40,6 @@ export interface Location {
43
40
  export interface UserBackoffice {
44
41
  UserId: string;
45
42
  FullName: string;
43
+ DisplayName: string;
46
44
 
47
-
48
45
  }