@hed-hog/operations 0.0.300 → 0.0.302

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 (73) hide show
  1. package/dist/operations.controller.d.ts +713 -31
  2. package/dist/operations.controller.d.ts.map +1 -1
  3. package/dist/operations.controller.js +157 -0
  4. package/dist/operations.controller.js.map +1 -1
  5. package/dist/operations.module.d.ts.map +1 -1
  6. package/dist/operations.module.js +5 -1
  7. package/dist/operations.module.js.map +1 -1
  8. package/dist/operations.proposal.subscriber.d.ts +11 -0
  9. package/dist/operations.proposal.subscriber.d.ts.map +1 -0
  10. package/dist/operations.proposal.subscriber.js +80 -0
  11. package/dist/operations.proposal.subscriber.js.map +1 -0
  12. package/dist/operations.proposal.subscriber.spec.d.ts +2 -0
  13. package/dist/operations.proposal.subscriber.spec.d.ts.map +1 -0
  14. package/dist/operations.proposal.subscriber.spec.js +88 -0
  15. package/dist/operations.proposal.subscriber.spec.js.map +1 -0
  16. package/dist/operations.service.d.ts +491 -46
  17. package/dist/operations.service.d.ts.map +1 -1
  18. package/dist/operations.service.js +2484 -121
  19. package/dist/operations.service.js.map +1 -1
  20. package/dist/operations.service.spec.d.ts +2 -0
  21. package/dist/operations.service.spec.d.ts.map +1 -0
  22. package/dist/operations.service.spec.js +159 -0
  23. package/dist/operations.service.spec.js.map +1 -0
  24. package/hedhog/data/menu.yaml +35 -22
  25. package/hedhog/data/role_route.yaml +39 -0
  26. package/hedhog/data/route.yaml +130 -0
  27. package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +8 -6
  28. package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +1163 -327
  29. package/hedhog/frontend/app/_components/collaborator-select-with-create.tsx.ejs +256 -0
  30. package/hedhog/frontend/app/_components/contract-content-editor.tsx.ejs +258 -0
  31. package/hedhog/frontend/app/_components/contract-creation-wizard.tsx.ejs +631 -0
  32. package/hedhog/frontend/app/_components/contract-details-screen.tsx.ejs +353 -27
  33. package/hedhog/frontend/app/_components/contract-form-screen.tsx.ejs +1926 -87
  34. package/hedhog/frontend/app/_components/contract-template-form-screen.tsx.ejs +526 -0
  35. package/hedhog/frontend/app/_components/contract-template-select-with-create.tsx.ejs +247 -0
  36. package/hedhog/frontend/app/_components/contract-wizard-sheet.tsx.ejs +3520 -0
  37. package/hedhog/frontend/app/_components/department-select-with-create.tsx.ejs +370 -0
  38. package/hedhog/frontend/app/_components/person-select-with-create.tsx.ejs +826 -0
  39. package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +1251 -364
  40. package/hedhog/frontend/app/_components/section-card.tsx.ejs +48 -13
  41. package/hedhog/frontend/app/_lib/api.ts.ejs +2 -5
  42. package/hedhog/frontend/app/_lib/types.ts.ejs +76 -33
  43. package/hedhog/frontend/app/_lib/utils/format.ts.ejs +85 -8
  44. package/hedhog/frontend/app/approvals/page.tsx.ejs +90 -54
  45. package/hedhog/frontend/app/collaborators/[id]/edit/page.tsx.ejs +2 -2
  46. package/hedhog/frontend/app/collaborators/[id]/page.tsx.ejs +2 -2
  47. package/hedhog/frontend/app/collaborators/page.tsx.ejs +597 -140
  48. package/hedhog/frontend/app/contracts/[id]/edit/page.tsx.ejs +2 -2
  49. package/hedhog/frontend/app/contracts/[id]/page.tsx.ejs +2 -2
  50. package/hedhog/frontend/app/contracts/page.tsx.ejs +941 -262
  51. package/hedhog/frontend/app/contracts/templates/page.tsx.ejs +384 -0
  52. package/hedhog/frontend/app/departments/page.tsx.ejs +442 -0
  53. package/hedhog/frontend/app/page.tsx.ejs +3 -317
  54. package/hedhog/frontend/app/projects/[id]/edit/page.tsx.ejs +2 -2
  55. package/hedhog/frontend/app/projects/new/page.tsx.ejs +2 -2
  56. package/hedhog/frontend/app/projects/page.tsx.ejs +264 -102
  57. package/hedhog/frontend/app/schedule-adjustments/page.tsx.ejs +50 -28
  58. package/hedhog/frontend/app/time-off/page.tsx.ejs +57 -31
  59. package/hedhog/frontend/app/timesheets/page.tsx.ejs +85 -42
  60. package/hedhog/frontend/messages/en.json +473 -12
  61. package/hedhog/frontend/messages/pt.json +528 -66
  62. package/hedhog/table/operations_collaborator.yaml +20 -0
  63. package/hedhog/table/operations_contract.yaml +22 -1
  64. package/hedhog/table/operations_contract_document.yaml +33 -16
  65. package/hedhog/table/operations_contract_template.yaml +58 -0
  66. package/hedhog/table/operations_department.yaml +24 -0
  67. package/package.json +7 -5
  68. package/src/operations.controller.ts +122 -0
  69. package/src/operations.module.ts +6 -2
  70. package/src/operations.proposal.subscriber.spec.ts +121 -0
  71. package/src/operations.proposal.subscriber.ts +86 -0
  72. package/src/operations.service.spec.ts +210 -0
  73. package/src/operations.service.ts +4026 -241
@@ -1,319 +1,5 @@
1
- 'use client';
1
+ import { redirect } from 'next/navigation';
2
2
 
3
- import { EmptyState, Page } from '@/components/entity-list';
4
- import { Button } from '@/components/ui/button';
5
- import { KpiCardsGrid } from '@/components/ui/kpi-cards-grid';
6
- import { Skeleton } from '@/components/ui/skeleton';
7
- import {
8
- Table,
9
- TableBody,
10
- TableCell,
11
- TableHead,
12
- TableHeader,
13
- TableRow,
14
- } from '@/components/ui/table';
15
- import { useApp, useQuery } from '@hed-hog/next-app-provider';
16
- import {
17
- CheckCircle2,
18
- ClipboardList,
19
- FolderKanban,
20
- Hourglass,
21
- PlaneTakeoff,
22
- RefreshCcw,
23
- Users,
24
- } from 'lucide-react';
25
- import Link from 'next/link';
26
- import { useTranslations } from 'next-intl';
27
- import { OperationsHeader } from './_components/operations-header';
28
- import { SectionCard } from './_components/section-card';
29
- import { StatusBadge } from './_components/status-badge';
30
- import { fetchOperations } from './_lib/api';
31
- import { useOperationsAccess } from './_lib/hooks/use-operations-access';
32
- import type { OperationsDashboard, OperationsTeamOverview } from './_lib/types';
33
- import {
34
- formatDate,
35
- formatDateRange,
36
- formatEnumLabel,
37
- formatHours,
38
- getStatusBadgeClass,
39
- } from './_lib/utils/format';
40
-
41
- export default function OperationsDashboardPage() {
42
- const t = useTranslations('operations.DashboardPage');
43
- const commonT = useTranslations('operations.Common');
44
- const { request, currentLocaleCode } = useApp();
45
- const access = useOperationsAccess();
46
-
47
- const {
48
- data: dashboard,
49
- isLoading,
50
- refetch,
51
- } = useQuery<OperationsDashboard>({
52
- queryKey: ['operations-dashboard', currentLocaleCode],
53
- queryFn: () => fetchOperations<OperationsDashboard>(request, '/operations/dashboard'),
54
- });
55
-
56
- const { data: team } = useQuery<OperationsTeamOverview>({
57
- queryKey: ['operations-team-overview', currentLocaleCode],
58
- enabled: access.isSupervisor,
59
- queryFn: () => fetchOperations<OperationsTeamOverview>(request, '/operations/team'),
60
- });
61
-
62
- const cards = dashboard
63
- ? [
64
- {
65
- key: 'projects',
66
- title: t('cards.projects'),
67
- value: dashboard.cards.projectsTotal,
68
- description: t('cards.projectsDescription', {
69
- active: dashboard.cards.activeProjects,
70
- }),
71
- icon: FolderKanban,
72
- },
73
- {
74
- key: 'timesheets',
75
- title: t('cards.timesheets'),
76
- value: dashboard.cards.visibleTimesheets,
77
- description: t('cards.timesheetsDescription', {
78
- pending: dashboard.cards.pendingTimesheets,
79
- }),
80
- icon: ClipboardList,
81
- },
82
- {
83
- key: 'timeOff',
84
- title: t('cards.timeOff'),
85
- value: dashboard.cards.timeOffRequests,
86
- description: t('cards.timeOffDescription'),
87
- icon: PlaneTakeoff,
88
- },
89
- {
90
- key: 'approvals',
91
- title: t('cards.approvals'),
92
- value: dashboard.cards.pendingApprovals,
93
- description: t('cards.approvalsDescription'),
94
- icon: Hourglass,
95
- },
96
- ]
97
- : [];
98
-
99
- return (
100
- <Page>
101
- <OperationsHeader
102
- title={t('title')}
103
- description={t('description')}
104
- current={t('breadcrumb')}
105
- actions={
106
- <div className="flex gap-2">
107
- <Button variant="outline" size="sm" onClick={() => void refetch()}>
108
- <RefreshCcw className="size-4" />
109
- {commonT('actions.refresh')}
110
- </Button>
111
- <Button asChild size="sm">
112
- <Link href="/operations/timesheets">{t('actions.openTimesheets')}</Link>
113
- </Button>
114
- </div>
115
- }
116
- />
117
-
118
- {isLoading || access.isLoading ? (
119
- <div className="space-y-4">
120
- <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
121
- {Array.from({ length: 4 }).map((_, index) => (
122
- <Skeleton key={index} className="h-32 w-full" />
123
- ))}
124
- </div>
125
- <div className="grid gap-4 xl:grid-cols-3">
126
- <Skeleton className="h-64 w-full xl:col-span-2" />
127
- <Skeleton className="h-64 w-full" />
128
- </div>
129
- </div>
130
- ) : dashboard ? (
131
- <>
132
- <KpiCardsGrid items={cards} />
133
-
134
- <div className="grid gap-4 xl:grid-cols-3">
135
- <SectionCard
136
- title={t('scope.title')}
137
- description={t('scope.description')}
138
- className="xl:col-span-1"
139
- >
140
- <dl className="space-y-3 text-sm">
141
- <div className="flex items-center justify-between gap-4">
142
- <dt className="text-muted-foreground">{t('scope.roleScope')}</dt>
143
- <dd className="font-medium">
144
- {formatEnumLabel(dashboard.actor.roleScope)}
145
- </dd>
146
- </div>
147
- <div className="flex items-center justify-between gap-4">
148
- <dt className="text-muted-foreground">{t('scope.collaborator')}</dt>
149
- <dd className="font-medium">
150
- {dashboard.actor.collaboratorName ?? commonT('labels.notAvailable')}
151
- </dd>
152
- </div>
153
- <div className="flex items-center justify-between gap-4">
154
- <dt className="text-muted-foreground">{t('scope.teamSize')}</dt>
155
- <dd className="font-medium">{dashboard.actor.teamSize}</dd>
156
- </div>
157
- </dl>
158
- </SectionCard>
159
-
160
- <SectionCard
161
- title={t('recentTimesheets.title')}
162
- description={t('recentTimesheets.description')}
163
- className="xl:col-span-2"
164
- >
165
- {dashboard.recentTimesheets.length === 0 ? (
166
- <EmptyState
167
- icon={<ClipboardList className="size-12" />}
168
- title={commonT('states.emptyTitle')}
169
- description={t('recentTimesheets.empty')}
170
- actionLabel={t('actions.openTimesheets')}
171
- onAction={() => {
172
- window.location.href = '/operations/timesheets';
173
- }}
174
- />
175
- ) : (
176
- <div className="overflow-x-auto rounded-md border">
177
- <Table>
178
- <TableHeader>
179
- <TableRow>
180
- <TableHead>{commonT('labels.collaborator')}</TableHead>
181
- <TableHead>{commonT('labels.week')}</TableHead>
182
- <TableHead>{commonT('labels.totalHours')}</TableHead>
183
- <TableHead>{commonT('labels.status')}</TableHead>
184
- </TableRow>
185
- </TableHeader>
186
- <TableBody>
187
- {dashboard.recentTimesheets.map((item) => (
188
- <TableRow key={item.id}>
189
- <TableCell className="font-medium">
190
- {item.collaboratorName}
191
- </TableCell>
192
- <TableCell>
193
- {formatDateRange(item.weekStartDate, item.weekEndDate)}
194
- </TableCell>
195
- <TableCell>{formatHours(item.totalHours)}</TableCell>
196
- <TableCell>
197
- <StatusBadge
198
- label={formatEnumLabel(item.status)}
199
- className={getStatusBadgeClass(item.status)}
200
- />
201
- </TableCell>
202
- </TableRow>
203
- ))}
204
- </TableBody>
205
- </Table>
206
- </div>
207
- )}
208
- </SectionCard>
209
- </div>
210
-
211
- <div className="grid gap-4 xl:grid-cols-2">
212
- <SectionCard
213
- title={t('nextSteps.title')}
214
- description={t('nextSteps.description')}
215
- >
216
- <div className="space-y-3 text-sm">
217
- <div className="flex items-start gap-3">
218
- <CheckCircle2 className="mt-0.5 size-4 text-emerald-600" />
219
- <p>{t('nextSteps.submitTimesheet')}</p>
220
- </div>
221
- <div className="flex items-start gap-3">
222
- <CheckCircle2 className="mt-0.5 size-4 text-emerald-600" />
223
- <p>{t('nextSteps.requestTimeOff')}</p>
224
- </div>
225
- <div className="flex items-start gap-3">
226
- <CheckCircle2 className="mt-0.5 size-4 text-emerald-600" />
227
- <p>{t('nextSteps.adjustSchedule')}</p>
228
- </div>
229
- </div>
230
- </SectionCard>
231
-
232
- <SectionCard
233
- title={t('team.title')}
234
- description={t('team.description')}
235
- >
236
- {access.isSupervisor && team ? (
237
- <>
238
- <div className="mb-4 grid gap-3 md:grid-cols-3">
239
- <div className="rounded-lg border p-4">
240
- <div className="text-xs uppercase tracking-[0.2em] text-muted-foreground">
241
- {t('team.members')}
242
- </div>
243
- <div className="mt-2 text-2xl font-semibold">
244
- {team.teamMembers.length}
245
- </div>
246
- </div>
247
- <div className="rounded-lg border p-4">
248
- <div className="text-xs uppercase tracking-[0.2em] text-muted-foreground">
249
- {t('team.projects')}
250
- </div>
251
- <div className="mt-2 text-2xl font-semibold">
252
- {team.projectCount}
253
- </div>
254
- </div>
255
- <div className="rounded-lg border p-4">
256
- <div className="text-xs uppercase tracking-[0.2em] text-muted-foreground">
257
- {t('team.pendingApprovals')}
258
- </div>
259
- <div className="mt-2 text-2xl font-semibold">
260
- {team.pendingApprovals}
261
- </div>
262
- </div>
263
- </div>
264
-
265
- {team.teamMembers.length > 0 ? (
266
- <div className="space-y-3">
267
- {team.teamMembers.slice(0, 4).map((member) => (
268
- <div
269
- key={member.id}
270
- className="flex items-center justify-between rounded-lg border px-4 py-3 text-sm"
271
- >
272
- <div>
273
- <div className="font-medium">{member.displayName}</div>
274
- <div className="text-muted-foreground">
275
- {[member.department, member.title]
276
- .filter(Boolean)
277
- .join(' • ') || commonT('labels.notAvailable')}
278
- </div>
279
- </div>
280
- <div className="text-right">
281
- <div className="font-medium">
282
- {member.activeAssignments ?? 0}{' '}
283
- {t('team.assignments')}
284
- </div>
285
- <div className="text-muted-foreground">
286
- {member.pendingApprovals ?? 0}{' '}
287
- {t('team.awaitingReview')}
288
- </div>
289
- </div>
290
- </div>
291
- ))}
292
- </div>
293
- ) : (
294
- <p className="text-sm text-muted-foreground">
295
- {t('team.empty')}
296
- </p>
297
- )}
298
- </>
299
- ) : (
300
- <div className="flex items-start gap-3 rounded-lg border border-dashed p-4 text-sm text-muted-foreground">
301
- <Users className="mt-0.5 size-4" />
302
- <p>{t('team.collaboratorMessage')}</p>
303
- </div>
304
- )}
305
- </SectionCard>
306
- </div>
307
- </>
308
- ) : (
309
- <EmptyState
310
- icon={<FolderKanban className="size-12" />}
311
- title={commonT('states.emptyTitle')}
312
- description={commonT('states.emptyDescription')}
313
- actionLabel={commonT('actions.refresh')}
314
- onAction={() => void refetch()}
315
- />
316
- )}
317
- </Page>
318
- );
3
+ export default function OperationsPage() {
4
+ redirect('/operations/projects');
319
5
  }
@@ -1,4 +1,4 @@
1
- import { ProjectFormScreen } from '../../../_components/project-form-screen';
1
+ import { redirect } from 'next/navigation';
2
2
 
3
3
  export default async function OperationsProjectEditPage({
4
4
  params,
@@ -7,5 +7,5 @@ export default async function OperationsProjectEditPage({
7
7
  }) {
8
8
  const { id } = await params;
9
9
 
10
- return <ProjectFormScreen projectId={Number(id)} />;
10
+ redirect(`/operations/projects?edit=${id}`);
11
11
  }
@@ -1,5 +1,5 @@
1
- import { ProjectFormScreen } from '../../_components/project-form-screen';
1
+ import { redirect } from 'next/navigation';
2
2
 
3
3
  export default function OperationsProjectCreatePage() {
4
- return <ProjectFormScreen />;
4
+ redirect('/operations/projects?create=1');
5
5
  }