@hed-hog/operations 0.0.305 → 0.0.309
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/controllers/operations-approvals.controller.d.ts +114 -1
- package/dist/controllers/operations-approvals.controller.d.ts.map +1 -1
- package/dist/controllers/operations-approvals.controller.js +16 -3
- package/dist/controllers/operations-approvals.controller.js.map +1 -1
- package/dist/controllers/operations-collaborators.controller.d.ts +16 -1
- package/dist/controllers/operations-collaborators.controller.d.ts.map +1 -1
- package/dist/controllers/operations-collaborators.controller.js +16 -3
- package/dist/controllers/operations-collaborators.controller.js.map +1 -1
- package/dist/controllers/operations-contracts.controller.d.ts +14 -453
- package/dist/controllers/operations-contracts.controller.d.ts.map +1 -1
- package/dist/controllers/operations-contracts.controller.js +11 -112
- package/dist/controllers/operations-contracts.controller.js.map +1 -1
- package/dist/controllers/operations-org-structure.controller.d.ts +65 -2
- package/dist/controllers/operations-org-structure.controller.d.ts.map +1 -1
- package/dist/controllers/operations-org-structure.controller.js +18 -5
- package/dist/controllers/operations-org-structure.controller.js.map +1 -1
- package/dist/controllers/operations-projects.controller.d.ts +28 -4
- package/dist/controllers/operations-projects.controller.d.ts.map +1 -1
- package/dist/controllers/operations-projects.controller.js +17 -5
- package/dist/controllers/operations-projects.controller.js.map +1 -1
- package/dist/controllers/operations-timesheets.controller.d.ts +52 -4
- package/dist/controllers/operations-timesheets.controller.d.ts.map +1 -1
- package/dist/controllers/operations-timesheets.controller.js +28 -11
- package/dist/controllers/operations-timesheets.controller.js.map +1 -1
- package/dist/dto/list-approvals.dto.d.ts +6 -0
- package/dist/dto/list-approvals.dto.d.ts.map +1 -0
- package/dist/dto/list-approvals.dto.js +28 -0
- package/dist/dto/list-approvals.dto.js.map +1 -0
- package/dist/dto/list-collaborator-types.dto.d.ts +3 -1
- package/dist/dto/list-collaborator-types.dto.d.ts.map +1 -1
- package/dist/dto/list-collaborator-types.dto.js +7 -1
- package/dist/dto/list-collaborator-types.dto.js.map +1 -1
- package/dist/dto/list-collaborators.dto.d.ts +1 -0
- package/dist/dto/list-collaborators.dto.d.ts.map +1 -1
- package/dist/dto/list-collaborators.dto.js +5 -0
- package/dist/dto/list-collaborators.dto.js.map +1 -1
- package/dist/dto/list-contracts.dto.d.ts +8 -0
- package/dist/dto/list-contracts.dto.d.ts.map +1 -0
- package/dist/dto/list-contracts.dto.js +38 -0
- package/dist/dto/list-contracts.dto.js.map +1 -0
- package/dist/dto/list-departments.dto.d.ts +5 -0
- package/dist/dto/list-departments.dto.d.ts.map +1 -0
- package/dist/dto/list-departments.dto.js +23 -0
- package/dist/dto/list-departments.dto.js.map +1 -0
- package/dist/dto/list-projects.dto.d.ts +5 -0
- package/dist/dto/list-projects.dto.d.ts.map +1 -0
- package/dist/dto/list-projects.dto.js +23 -0
- package/dist/dto/list-projects.dto.js.map +1 -0
- package/dist/dto/list-schedule-adjustments.dto.d.ts +5 -0
- package/dist/dto/list-schedule-adjustments.dto.d.ts.map +1 -0
- package/dist/dto/list-schedule-adjustments.dto.js +23 -0
- package/dist/dto/list-schedule-adjustments.dto.js.map +1 -0
- package/dist/dto/list-time-off-requests.dto.d.ts +5 -0
- package/dist/dto/list-time-off-requests.dto.d.ts.map +1 -0
- package/dist/dto/list-time-off-requests.dto.js +23 -0
- package/dist/dto/list-time-off-requests.dto.js.map +1 -0
- package/dist/dto/list-timesheets.dto.d.ts +5 -0
- package/dist/dto/list-timesheets.dto.d.ts.map +1 -0
- package/dist/dto/list-timesheets.dto.js +23 -0
- package/dist/dto/list-timesheets.dto.js.map +1 -0
- package/dist/dto/reorder-collaborator-types.dto.d.ts +4 -0
- package/dist/dto/reorder-collaborator-types.dto.d.ts.map +1 -0
- package/dist/dto/reorder-collaborator-types.dto.js +25 -0
- package/dist/dto/reorder-collaborator-types.dto.js.map +1 -0
- package/dist/dto/update-collaborator-type.dto.d.ts +3 -1
- package/dist/dto/update-collaborator-type.dto.d.ts.map +1 -1
- package/dist/dto/update-collaborator-type.dto.js +2 -1
- package/dist/dto/update-collaborator-type.dto.js.map +1 -1
- package/dist/operations.service.d.ts +362 -271
- package/dist/operations.service.d.ts.map +1 -1
- package/dist/operations.service.js +1195 -1098
- package/dist/operations.service.js.map +1 -1
- package/dist/operations.service.spec.js +73 -22
- package/dist/operations.service.spec.js.map +1 -1
- package/hedhog/data/menu.yaml +19 -55
- package/hedhog/data/operations_collaborator_type.yaml +76 -76
- package/hedhog/data/route.yaml +52 -70
- package/hedhog/frontend/app/_components/async-options-combobox.tsx.ejs +5 -3
- package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +8 -1
- package/hedhog/frontend/app/_components/collaborator-select-with-create.tsx.ejs +15 -10
- package/hedhog/frontend/app/_components/contract-details-screen.tsx.ejs +108 -213
- package/hedhog/frontend/app/_components/contract-form-screen.tsx.ejs +251 -2039
- package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +167 -60
- package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +70 -301
- package/hedhog/frontend/app/_components/system-user-select-with-create.tsx.ejs +102 -51
- package/hedhog/frontend/app/_components/timesheet-task-create-sheet.tsx.ejs +1 -0
- package/hedhog/frontend/app/_lib/types.ts.ejs +19 -24
- package/hedhog/frontend/app/_lib/utils/format.ts.ejs +14 -9
- package/hedhog/frontend/app/approvals/page.tsx.ejs +843 -151
- package/hedhog/frontend/app/collaborator-types/page.tsx.ejs +457 -154
- package/hedhog/frontend/app/collaborators/page.tsx.ejs +118 -49
- package/hedhog/frontend/app/contracts/[id]/page.tsx.ejs +2 -2
- package/hedhog/frontend/app/contracts/page.tsx.ejs +215 -617
- package/hedhog/frontend/app/departments/page.tsx.ejs +257 -113
- package/hedhog/frontend/app/projects/page.tsx.ejs +90 -51
- package/hedhog/frontend/app/schedule-adjustments/page.tsx.ejs +546 -118
- package/hedhog/frontend/app/time-off/page.tsx.ejs +400 -123
- package/hedhog/frontend/app/timesheets/page.tsx.ejs +647 -342
- package/hedhog/frontend/messages/en.json +148 -14
- package/hedhog/frontend/messages/pt.json +199 -56
- package/hedhog/table/operations_collaborator.yaml +18 -18
- package/hedhog/table/operations_collaborator_equity_participation.yaml +43 -43
- package/hedhog/table/operations_collaborator_type.yaml +33 -33
- package/hedhog/table/operations_contract.yaml +0 -9
- package/hedhog/table/operations_contract_document.yaml +33 -33
- package/package.json +4 -4
- package/src/controllers/operations-approvals.controller.ts +9 -3
- package/src/controllers/operations-collaborators.controller.ts +15 -2
- package/src/controllers/operations-contracts.controller.ts +8 -92
- package/src/controllers/operations-org-structure.controller.ts +17 -4
- package/src/controllers/operations-projects.controller.ts +10 -4
- package/src/controllers/operations-timesheets.controller.ts +30 -8
- package/src/dto/create-collaborator-type.dto.ts +43 -43
- package/src/dto/create-collaborator.dto.ts +223 -223
- package/src/dto/list-approvals.dto.ts +12 -0
- package/src/dto/list-collaborator-types.dto.ts +20 -15
- package/src/dto/list-collaborators.dto.ts +34 -30
- package/src/dto/list-contracts.dto.ts +20 -0
- package/src/dto/list-departments.dto.ts +8 -0
- package/src/dto/list-projects.dto.ts +8 -0
- package/src/dto/list-schedule-adjustments.dto.ts +8 -0
- package/src/dto/list-time-off-requests.dto.ts +8 -0
- package/src/dto/list-timesheets.dto.ts +8 -0
- package/src/dto/reorder-collaborator-types.dto.ts +10 -0
- package/src/dto/update-collaborator-type.dto.ts +4 -3
- package/src/dto/update-collaborator.dto.ts +3 -3
- package/src/operations.service.spec.ts +96 -30
- package/src/operations.service.ts +1738 -1777
- package/hedhog/frontend/app/_components/contract-creation-wizard.tsx.ejs +0 -631
- package/hedhog/frontend/app/_components/contract-template-form-screen.tsx.ejs +0 -526
- package/hedhog/frontend/app/_components/contract-template-select-with-create.tsx.ejs +0 -247
- package/hedhog/frontend/app/_components/contract-wizard-sheet.tsx.ejs +0 -3520
- package/hedhog/frontend/app/contracts/templates/page.tsx.ejs +0 -380
- package/hedhog/frontend/app/team/page.tsx.ejs +0 -352
- package/hedhog/table/operations_contract_financial_term.yaml +0 -40
- package/hedhog/table/operations_contract_revision.yaml +0 -38
- package/hedhog/table/operations_contract_signature.yaml +0 -38
- package/hedhog/table/operations_contract_template.yaml +0 -58
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
EmptyState,
|
|
5
|
+
Page,
|
|
6
|
+
PaginationFooter,
|
|
7
|
+
SearchBar,
|
|
8
|
+
} from '@/components/entity-list';
|
|
4
9
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
|
5
10
|
import { Button } from '@/components/ui/button';
|
|
6
11
|
import { Card, CardContent } from '@/components/ui/card';
|
|
@@ -44,7 +49,9 @@ import { fetchOperations, mutateOperations } from '../_lib/api';
|
|
|
44
49
|
import { useOperationsAccess } from '../_lib/hooks/use-operations-access';
|
|
45
50
|
import type {
|
|
46
51
|
OperationsCollaborator,
|
|
52
|
+
OperationsCollaboratorStats,
|
|
47
53
|
OperationsCollaboratorType,
|
|
54
|
+
PaginatedResponse,
|
|
48
55
|
} from '../_lib/types';
|
|
49
56
|
import {
|
|
50
57
|
formatCurrency,
|
|
@@ -91,6 +98,8 @@ export default function OperationsCollaboratorsPage() {
|
|
|
91
98
|
const [search, setSearch] = useState('');
|
|
92
99
|
const [statusFilter, setStatusFilter] = useState('all');
|
|
93
100
|
const [typeFilter, setTypeFilter] = useState('all');
|
|
101
|
+
const [page, setPage] = useState(1);
|
|
102
|
+
const [pageSize, setPageSize] = useState(12);
|
|
94
103
|
const [viewMode, setViewMode] = useState<CollaboratorViewMode>(() => {
|
|
95
104
|
if (typeof window === 'undefined') {
|
|
96
105
|
return 'table';
|
|
@@ -154,16 +163,43 @@ export default function OperationsCollaboratorsPage() {
|
|
|
154
163
|
}
|
|
155
164
|
};
|
|
156
165
|
|
|
157
|
-
const { data:
|
|
158
|
-
OperationsCollaborator
|
|
166
|
+
const { data: collaboratorsResponse, refetch } = useQuery<
|
|
167
|
+
PaginatedResponse<OperationsCollaborator>
|
|
159
168
|
>({
|
|
160
|
-
queryKey: [
|
|
169
|
+
queryKey: [
|
|
170
|
+
'operations-collaborators-list',
|
|
171
|
+
currentLocaleCode,
|
|
172
|
+
search,
|
|
173
|
+
statusFilter,
|
|
174
|
+
typeFilter,
|
|
175
|
+
page,
|
|
176
|
+
pageSize,
|
|
177
|
+
],
|
|
161
178
|
enabled: access.isCollaborator,
|
|
162
|
-
queryFn: () =>
|
|
163
|
-
|
|
179
|
+
queryFn: () => {
|
|
180
|
+
const params = new URLSearchParams({
|
|
181
|
+
page: String(page),
|
|
182
|
+
pageSize: String(pageSize),
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
if (search.trim()) {
|
|
186
|
+
params.set('search', search.trim());
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (statusFilter !== 'all') {
|
|
190
|
+
params.set('status', statusFilter);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (typeFilter !== 'all') {
|
|
194
|
+
params.set('collaboratorType', typeFilter);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return fetchOperations<PaginatedResponse<OperationsCollaborator>>(
|
|
164
198
|
request,
|
|
165
|
-
|
|
166
|
-
)
|
|
199
|
+
`/operations/collaborators?${params.toString()}`
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
placeholderData: (previous) => previous,
|
|
167
203
|
});
|
|
168
204
|
|
|
169
205
|
const { data: collaboratorTypes = [] } = useQuery<
|
|
@@ -178,6 +214,41 @@ export default function OperationsCollaboratorsPage() {
|
|
|
178
214
|
),
|
|
179
215
|
});
|
|
180
216
|
|
|
217
|
+
const { data: collaboratorStats } = useQuery<OperationsCollaboratorStats>({
|
|
218
|
+
queryKey: [
|
|
219
|
+
'operations-collaborators-stats',
|
|
220
|
+
currentLocaleCode,
|
|
221
|
+
search,
|
|
222
|
+
statusFilter,
|
|
223
|
+
typeFilter,
|
|
224
|
+
],
|
|
225
|
+
enabled: access.isCollaborator,
|
|
226
|
+
queryFn: () => {
|
|
227
|
+
const params = new URLSearchParams();
|
|
228
|
+
|
|
229
|
+
if (search.trim()) {
|
|
230
|
+
params.set('search', search.trim());
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (statusFilter !== 'all') {
|
|
234
|
+
params.set('status', statusFilter);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (typeFilter !== 'all') {
|
|
238
|
+
params.set('collaboratorType', typeFilter);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const query = params.toString();
|
|
242
|
+
|
|
243
|
+
return fetchOperations<OperationsCollaboratorStats>(
|
|
244
|
+
request,
|
|
245
|
+
query
|
|
246
|
+
? `/operations/collaborators/stats?${query}`
|
|
247
|
+
: '/operations/collaborators/stats'
|
|
248
|
+
);
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
|
|
181
252
|
const getCollaboratorTypeLabel = (
|
|
182
253
|
slug?: string | null,
|
|
183
254
|
fallbackName?: string | null
|
|
@@ -190,35 +261,8 @@ export default function OperationsCollaboratorsPage() {
|
|
|
190
261
|
return matchedType?.name ?? formatEnumLabel(slug);
|
|
191
262
|
};
|
|
192
263
|
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
collaborators.filter((item) => {
|
|
196
|
-
const matchesSearch = !search.trim()
|
|
197
|
-
? true
|
|
198
|
-
: [
|
|
199
|
-
item.displayName,
|
|
200
|
-
item.code,
|
|
201
|
-
item.department,
|
|
202
|
-
item.title,
|
|
203
|
-
item.supervisorName,
|
|
204
|
-
]
|
|
205
|
-
.filter(Boolean)
|
|
206
|
-
.some((value) =>
|
|
207
|
-
String(value)
|
|
208
|
-
.toLowerCase()
|
|
209
|
-
.includes(search.trim().toLowerCase())
|
|
210
|
-
);
|
|
211
|
-
const matchesStatus =
|
|
212
|
-
statusFilter === 'all' ? true : item.status === statusFilter;
|
|
213
|
-
const matchesType =
|
|
214
|
-
typeFilter === 'all'
|
|
215
|
-
? true
|
|
216
|
-
: item.collaboratorTypeSlug === typeFilter ||
|
|
217
|
-
item.collaboratorType === typeFilter;
|
|
218
|
-
return matchesSearch && matchesStatus && matchesType;
|
|
219
|
-
}),
|
|
220
|
-
[collaborators, search, statusFilter, typeFilter]
|
|
221
|
-
);
|
|
264
|
+
const collaborators = collaboratorsResponse?.data ?? [];
|
|
265
|
+
const filteredRows = collaborators;
|
|
222
266
|
|
|
223
267
|
const statsCards = useMemo(
|
|
224
268
|
() => [
|
|
@@ -226,33 +270,32 @@ export default function OperationsCollaboratorsPage() {
|
|
|
226
270
|
key: 'total',
|
|
227
271
|
title: t('cards.total'),
|
|
228
272
|
description: t('cards.totalDescription'),
|
|
229
|
-
value:
|
|
273
|
+
value: collaboratorStats?.total ?? 0,
|
|
230
274
|
icon: Users,
|
|
231
275
|
},
|
|
232
276
|
{
|
|
233
277
|
key: 'active',
|
|
234
278
|
title: t('cards.active'),
|
|
235
279
|
description: t('cards.activeDescription'),
|
|
236
|
-
value:
|
|
280
|
+
value: collaboratorStats?.active ?? 0,
|
|
237
281
|
icon: UserCheck,
|
|
238
282
|
},
|
|
239
283
|
{
|
|
240
284
|
key: 'onLeave',
|
|
241
285
|
title: t('cards.onLeave'),
|
|
242
286
|
description: t('cards.onLeaveDescription'),
|
|
243
|
-
value:
|
|
244
|
-
.length,
|
|
287
|
+
value: collaboratorStats?.onLeave ?? 0,
|
|
245
288
|
icon: CalendarDays,
|
|
246
289
|
},
|
|
247
290
|
{
|
|
248
291
|
key: 'withContracts',
|
|
249
292
|
title: t('cards.withContracts'),
|
|
250
293
|
description: t('cards.withContractsDescription'),
|
|
251
|
-
value:
|
|
294
|
+
value: collaboratorStats?.withContracts ?? 0,
|
|
252
295
|
icon: FileText,
|
|
253
296
|
},
|
|
254
297
|
],
|
|
255
|
-
[
|
|
298
|
+
[collaboratorStats, t]
|
|
256
299
|
);
|
|
257
300
|
|
|
258
301
|
const handleViewModeChange = (value: string) => {
|
|
@@ -308,15 +351,22 @@ export default function OperationsCollaboratorsPage() {
|
|
|
308
351
|
<div className="flex-1">
|
|
309
352
|
<SearchBar
|
|
310
353
|
searchQuery={search}
|
|
311
|
-
onSearchChange={
|
|
312
|
-
|
|
354
|
+
onSearchChange={(value) => {
|
|
355
|
+
setSearch(value);
|
|
356
|
+
setPage(1);
|
|
357
|
+
}}
|
|
358
|
+
showSearchButton={false}
|
|
359
|
+
debounceMs={500}
|
|
313
360
|
placeholder={t('searchPlaceholder')}
|
|
314
361
|
controls={[
|
|
315
362
|
{
|
|
316
363
|
id: 'type',
|
|
317
364
|
type: 'select',
|
|
318
365
|
value: typeFilter,
|
|
319
|
-
onChange:
|
|
366
|
+
onChange: (value) => {
|
|
367
|
+
setTypeFilter(value);
|
|
368
|
+
setPage(1);
|
|
369
|
+
},
|
|
320
370
|
placeholder: commonT('labels.collaboratorType'),
|
|
321
371
|
options: [
|
|
322
372
|
{ value: 'all', label: commonT('filters.allTypes') },
|
|
@@ -330,7 +380,10 @@ export default function OperationsCollaboratorsPage() {
|
|
|
330
380
|
id: 'status',
|
|
331
381
|
type: 'select',
|
|
332
382
|
value: statusFilter,
|
|
333
|
-
onChange:
|
|
383
|
+
onChange: (value) => {
|
|
384
|
+
setStatusFilter(value);
|
|
385
|
+
setPage(1);
|
|
386
|
+
},
|
|
334
387
|
placeholder: commonT('labels.status'),
|
|
335
388
|
options: [
|
|
336
389
|
{ value: 'all', label: commonT('filters.allStatuses') },
|
|
@@ -448,7 +501,9 @@ export default function OperationsCollaboratorsPage() {
|
|
|
448
501
|
</span>{' '}
|
|
449
502
|
{collaborator.compensationAmount != null
|
|
450
503
|
? formatCurrency(
|
|
451
|
-
Number(collaborator.compensationAmount)
|
|
504
|
+
Number(collaborator.compensationAmount),
|
|
505
|
+
getSettingValue,
|
|
506
|
+
currentLocaleCode
|
|
452
507
|
)
|
|
453
508
|
: commonT('labels.notAvailable')}
|
|
454
509
|
</div>
|
|
@@ -649,7 +704,9 @@ export default function OperationsCollaboratorsPage() {
|
|
|
649
704
|
<TableCell className="hidden 2xl:table-cell">
|
|
650
705
|
{collaborator.compensationAmount != null
|
|
651
706
|
? formatCurrency(
|
|
652
|
-
Number(collaborator.compensationAmount)
|
|
707
|
+
Number(collaborator.compensationAmount),
|
|
708
|
+
getSettingValue,
|
|
709
|
+
currentLocaleCode
|
|
653
710
|
)
|
|
654
711
|
: commonT('labels.notAvailable')}
|
|
655
712
|
</TableCell>
|
|
@@ -726,6 +783,18 @@ export default function OperationsCollaboratorsPage() {
|
|
|
726
783
|
/>
|
|
727
784
|
)}
|
|
728
785
|
|
|
786
|
+
<PaginationFooter
|
|
787
|
+
currentPage={collaboratorsResponse?.page ?? page}
|
|
788
|
+
pageSize={collaboratorsResponse?.pageSize ?? pageSize}
|
|
789
|
+
totalItems={collaboratorsResponse?.total ?? 0}
|
|
790
|
+
onPageChange={setPage}
|
|
791
|
+
onPageSizeChange={(value) => {
|
|
792
|
+
setPageSize(value);
|
|
793
|
+
setPage(1);
|
|
794
|
+
}}
|
|
795
|
+
pageSizeOptions={[12, 24, 48]}
|
|
796
|
+
/>
|
|
797
|
+
|
|
729
798
|
<Sheet
|
|
730
799
|
open={isCreateSheetOpen || editingCollaboratorId !== null}
|
|
731
800
|
onOpenChange={(open) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContractDetailsScreen } from '../../_components/contract-details-screen';
|
|
2
2
|
|
|
3
3
|
export default async function OperationsContractDetailsPage({
|
|
4
4
|
params,
|
|
@@ -7,5 +7,5 @@ export default async function OperationsContractDetailsPage({
|
|
|
7
7
|
}) {
|
|
8
8
|
const { id } = await params;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
return <ContractDetailsScreen contractId={Number(id)} />;
|
|
11
11
|
}
|