@hed-hog/operations 0.0.297 → 0.0.299

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.
Files changed (32) hide show
  1. package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +310 -310
  2. package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +631 -631
  3. package/hedhog/frontend/app/_components/contract-details-screen.tsx.ejs +132 -132
  4. package/hedhog/frontend/app/_components/contract-form-screen.tsx.ejs +558 -558
  5. package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +291 -291
  6. package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +689 -689
  7. package/hedhog/frontend/app/_lib/api.ts.ejs +32 -32
  8. package/hedhog/frontend/app/_lib/hooks/use-operations-access.ts.ejs +44 -44
  9. package/hedhog/frontend/app/_lib/types.ts.ejs +360 -360
  10. package/hedhog/frontend/app/_lib/utils/format.ts.ejs +129 -129
  11. package/hedhog/frontend/app/_lib/utils/forms.ts.ejs +14 -14
  12. package/hedhog/frontend/app/approvals/page.tsx.ejs +386 -386
  13. package/hedhog/frontend/app/collaborators/[id]/edit/page.tsx.ejs +11 -11
  14. package/hedhog/frontend/app/collaborators/[id]/page.tsx.ejs +11 -11
  15. package/hedhog/frontend/app/collaborators/new/page.tsx.ejs +5 -5
  16. package/hedhog/frontend/app/collaborators/page.tsx.ejs +261 -261
  17. package/hedhog/frontend/app/contracts/[id]/edit/page.tsx.ejs +11 -11
  18. package/hedhog/frontend/app/contracts/[id]/page.tsx.ejs +11 -11
  19. package/hedhog/frontend/app/contracts/new/page.tsx.ejs +17 -17
  20. package/hedhog/frontend/app/contracts/page.tsx.ejs +262 -262
  21. package/hedhog/frontend/app/page.tsx.ejs +319 -319
  22. package/hedhog/frontend/app/projects/[id]/edit/page.tsx.ejs +11 -11
  23. package/hedhog/frontend/app/projects/[id]/page.tsx.ejs +11 -11
  24. package/hedhog/frontend/app/projects/new/page.tsx.ejs +5 -5
  25. package/hedhog/frontend/app/projects/page.tsx.ejs +236 -236
  26. package/hedhog/frontend/app/schedule-adjustments/page.tsx.ejs +418 -418
  27. package/hedhog/frontend/app/team/page.tsx.ejs +339 -339
  28. package/hedhog/frontend/app/time-off/page.tsx.ejs +328 -328
  29. package/hedhog/frontend/app/timesheets/page.tsx.ejs +636 -636
  30. package/hedhog/frontend/messages/en.json +648 -648
  31. package/hedhog/frontend/messages/pt.json +647 -647
  32. package/package.json +4 -4
@@ -1,32 +1,32 @@
1
- type RequestFn = (input: {
2
- url: string;
3
- method: string;
4
- data?: unknown;
5
- }) => Promise<{ data: any }>;
6
-
7
- export async function fetchOperations<T>(
8
- request: RequestFn,
9
- url: string
10
- ) {
11
- const response = await request({
12
- url,
13
- method: 'GET',
14
- });
15
-
16
- return response.data as T;
17
- }
18
-
19
- export async function mutateOperations<T>(
20
- request: RequestFn,
21
- url: string,
22
- method: 'POST' | 'PATCH',
23
- data?: unknown
24
- ) {
25
- const response = await request({
26
- url,
27
- method,
28
- data,
29
- });
30
-
31
- return response.data as T;
32
- }
1
+ type RequestFn = (input: {
2
+ url: string;
3
+ method: string;
4
+ data?: unknown;
5
+ }) => Promise<{ data: any }>;
6
+
7
+ export async function fetchOperations<T>(
8
+ request: RequestFn,
9
+ url: string
10
+ ) {
11
+ const response = await request({
12
+ url,
13
+ method: 'GET',
14
+ });
15
+
16
+ return response.data as T;
17
+ }
18
+
19
+ export async function mutateOperations<T>(
20
+ request: RequestFn,
21
+ url: string,
22
+ method: 'POST' | 'PATCH',
23
+ data?: unknown
24
+ ) {
25
+ const response = await request({
26
+ url,
27
+ method,
28
+ data,
29
+ });
30
+
31
+ return response.data as T;
32
+ }
@@ -1,44 +1,44 @@
1
- 'use client';
2
-
3
- import { useApp, useQuery } from '@hed-hog/next-app-provider';
4
-
5
- type Role = {
6
- slug?: string;
7
- };
8
-
9
- export function useOperationsAccess() {
10
- const { request, accessToken } = useApp();
11
-
12
- const { data, isLoading } = useQuery<{ roles: Role[] }>({
13
- queryKey: ['operations-roles', accessToken],
14
- enabled: !!accessToken,
15
- queryFn: async () => {
16
- const response = await request<{ roles: Role[] }>({
17
- url: '/auth/roles',
18
- });
19
-
20
- return response.data;
21
- },
22
- });
23
-
24
- const roleSlugs = (data?.roles ?? [])
25
- .map((role) => role.slug || '')
26
- .filter(Boolean);
27
-
28
- return {
29
- isLoading,
30
- roleSlugs,
31
- isDirector:
32
- roleSlugs.includes('admin') ||
33
- roleSlugs.includes('admin-operations-director'),
34
- isSupervisor:
35
- roleSlugs.includes('admin') ||
36
- roleSlugs.includes('admin-operations-director') ||
37
- roleSlugs.includes('admin-operations-supervisor'),
38
- isCollaborator:
39
- roleSlugs.includes('admin') ||
40
- roleSlugs.includes('admin-operations-director') ||
41
- roleSlugs.includes('admin-operations-supervisor') ||
42
- roleSlugs.includes('admin-operations-collaborator'),
43
- };
44
- }
1
+ 'use client';
2
+
3
+ import { useApp, useQuery } from '@hed-hog/next-app-provider';
4
+
5
+ type Role = {
6
+ slug?: string;
7
+ };
8
+
9
+ export function useOperationsAccess() {
10
+ const { request, accessToken } = useApp();
11
+
12
+ const { data, isLoading } = useQuery<{ roles: Role[] }>({
13
+ queryKey: ['operations-roles', accessToken],
14
+ enabled: !!accessToken,
15
+ queryFn: async () => {
16
+ const response = await request<{ roles: Role[] }>({
17
+ url: '/auth/roles',
18
+ });
19
+
20
+ return response.data;
21
+ },
22
+ });
23
+
24
+ const roleSlugs = (data?.roles ?? [])
25
+ .map((role) => role.slug || '')
26
+ .filter(Boolean);
27
+
28
+ return {
29
+ isLoading,
30
+ roleSlugs,
31
+ isDirector:
32
+ roleSlugs.includes('admin') ||
33
+ roleSlugs.includes('admin-operations-director'),
34
+ isSupervisor:
35
+ roleSlugs.includes('admin') ||
36
+ roleSlugs.includes('admin-operations-director') ||
37
+ roleSlugs.includes('admin-operations-supervisor'),
38
+ isCollaborator:
39
+ roleSlugs.includes('admin') ||
40
+ roleSlugs.includes('admin-operations-director') ||
41
+ roleSlugs.includes('admin-operations-supervisor') ||
42
+ roleSlugs.includes('admin-operations-collaborator'),
43
+ };
44
+ }