@omniumretail/shared-resources 0.2.37 → 0.2.39

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.
@@ -1,10 +1,10 @@
1
1
  import { UseQueryOptions } from "@tanstack/react-query";
2
- import { ResponseList, AttendancesSummary } from "../../../../interfaces";
3
- interface EmployeeQueryOptions extends UseQueryOptions<ResponseList<"AttendancesSummary", AttendancesSummary>> {
2
+ import { AttendancesSummary } from "../../../../interfaces";
3
+ interface EmployeeQueryOptions extends UseQueryOptions<AttendancesSummary> {
4
4
  employeeId?: string;
5
5
  storeId?: string;
6
6
  beginWorkPeriod?: number;
7
7
  endWorkPeriod?: number;
8
8
  }
9
- export declare const useAttendancesSummary: ({ employeeId, storeId, beginWorkPeriod, endWorkPeriod, ...options }: EmployeeQueryOptions) => import("@tanstack/react-query").UseQueryResult<ResponseList<"AttendancesSummary", AttendancesSummary>, unknown>;
9
+ export declare const useAttendancesSummary: ({ employeeId, storeId, beginWorkPeriod, endWorkPeriod, ...options }: EmployeeQueryOptions) => import("@tanstack/react-query").UseQueryResult<AttendancesSummary, unknown>;
10
10
  export {};
@@ -0,0 +1,2 @@
1
+ import { AttendancesSummary } from '../../../../interfaces';
2
+ export declare const useUpdateAttendancesSummary: (id: string) => import("@tanstack/react-query").UseMutationResult<AttendancesSummary, unknown, AttendancesSummary, unknown>;
@@ -1,2 +1,3 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
1
2
  import { User } from "../../../interfaces";
2
- export declare const useSingleUserIdQueryHook: (userId: string) => import("@tanstack/react-query").UseQueryResult<User, unknown>;
3
+ export declare const useSingleUserIdQueryHook: (userId: string, options?: UseQueryOptions<User, Error>) => import("@tanstack/react-query").UseQueryResult<User, Error>;
@@ -268,6 +268,7 @@ export * from "./ATIM/BackOffice/mutate/postAttendanceRange.hook";
268
268
  export * from "./ATIM/BackOffice/get/useAbsenceTypes.hook";
269
269
  export * from "./ATIM/BackOffice/get/useAttendancesSummary.hook";
270
270
  export * from "./ATIM/BackOffice/get/useWorkMonths.hook";
271
+ export * from "./ATIM/BackOffice/mutate/useUpdateAttendancesSummary.hook";
271
272
  export * from "./Others/useJobTitlesQuery.hook";
272
273
  export * from "./Others/useContractStatesQuery.hook";
273
274
  export * from "./Others/useApplicationDataQuery.hook";
@@ -63,7 +63,8 @@ export interface AbsenceDetail {
63
63
  export interface AbsenceDetails {
64
64
  Justified: number;
65
65
  Unjustified: number;
66
- Others: AbsenceOthers[];
66
+ Others: AbsenceOthers;
67
+ Details: AbsenceDetail[];
67
68
  }
68
69
  export interface ExtraHours {
69
70
  Hours: string;
@@ -96,6 +97,7 @@ export interface AttendancesSummary {
96
97
  Hours: string;
97
98
  Notes: string | null;
98
99
  };
100
+ Stocktaking: string;
99
101
  ScheduleWorkHours: ScheduleWorkHours;
100
102
  WorkPeriod: WorkPeriod;
101
103
  WorkedHours: WorkedHours;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.37",
3
+ "version": "0.2.39",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -1,11 +1,9 @@
1
1
  import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
2
  import { getAuth0 } from "../../../../services/ApiService";
3
- import { ResponseList, AttendancesSummary } from "../../../../interfaces";
3
+ import { AttendancesSummary } from "../../../../interfaces";
4
4
 
5
5
  interface EmployeeQueryOptions
6
- extends UseQueryOptions<
7
- ResponseList<"AttendancesSummary", AttendancesSummary>
8
- > {
6
+ extends UseQueryOptions<AttendancesSummary>{
9
7
  employeeId?: string;
10
8
  storeId?: string;
11
9
  beginWorkPeriod?: number;
@@ -19,7 +17,7 @@ export const useAttendancesSummary = ({
19
17
  endWorkPeriod,
20
18
  ...options
21
19
  }: EmployeeQueryOptions) => {
22
- return useQuery<ResponseList<"AttendancesSummary", AttendancesSummary>>(
20
+ return useQuery<AttendancesSummary>(
23
21
  [
24
22
  "ATTENDANCES_SUMMARY",
25
23
  employeeId,
@@ -0,0 +1,17 @@
1
+ import { useMutation, useQueryClient, UseQueryOptions } from '@tanstack/react-query';
2
+ import { AttendancesSummary } from '../../../../interfaces';
3
+ import { putAuth0, postAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const useUpdateAttendancesSummary = ( id: string) => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<AttendancesSummary, unknown, AttendancesSummary>((data: AttendancesSummary) => {
8
+ return id ?
9
+ putAuth0(`/ATIM/AttendancesSummary/${id}`, undefined, data) :
10
+ postAuth0(`/ATIM/AttendancesSummary`, undefined, data);
11
+ }, {
12
+ onSuccess: (data: AttendancesSummary) => {
13
+ queryClient.setQueryData(
14
+ ['ATTENDANCES_SUMMARY_QUERY'], data);
15
+ },
16
+ });
17
+ }
@@ -1,13 +1,14 @@
1
- import { useQuery } from "@tanstack/react-query";
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
2
  import { User } from "../../../interfaces";
3
3
  import { getAuth0 } from "../../../services/ApiService";
4
4
 
5
- export const useSingleUserIdQueryHook = (userId: string) => {
5
+ export const useSingleUserIdQueryHook = (userId: string, options?: UseQueryOptions<User, Error>) => {
6
6
  return useQuery(
7
7
  ['SINGLE_USER_ID_QUERY', userId],
8
8
  () => getAuth0<User>(`/AACP/Users/${userId}`),
9
9
  {
10
10
  enabled: !!(userId),
11
+ ...options,
11
12
  },
12
13
  );
13
14
  }
@@ -316,6 +316,7 @@ export * from "./ATIM/BackOffice/mutate/postAttendanceRange.hook";
316
316
  export * from "./ATIM/BackOffice/get/useAbsenceTypes.hook";
317
317
  export * from "./ATIM/BackOffice/get/useAttendancesSummary.hook";
318
318
  export * from "./ATIM/BackOffice/get/useWorkMonths.hook";
319
+ export * from "./ATIM/BackOffice/mutate/useUpdateAttendancesSummary.hook";
319
320
 
320
321
  //Others
321
322
  export * from "./Others/useJobTitlesQuery.hook";
@@ -74,9 +74,11 @@ export interface AbsenceDetail {
74
74
  export interface AbsenceDetails {
75
75
  Justified: number;
76
76
  Unjustified: number;
77
- Others: AbsenceOthers[];
77
+ Others: AbsenceOthers;
78
+ Details: AbsenceDetail[];
78
79
  }
79
80
 
81
+
80
82
  export interface ExtraHours {
81
83
  Hours: string;
82
84
  AuthorizedBy: string | null;
@@ -112,6 +114,7 @@ export interface AttendancesSummary {
112
114
  Hours: string;
113
115
  Notes: string | null;
114
116
  };
117
+ Stocktaking: string;
115
118
  ScheduleWorkHours: ScheduleWorkHours;
116
119
  WorkPeriod: WorkPeriod;
117
120
  WorkedHours: WorkedHours;