@hed-hog/operations 0.0.332 → 0.0.338
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-collaborators.controller.d.ts +0 -54
- package/dist/controllers/operations-collaborators.controller.d.ts.map +1 -1
- package/dist/controllers/operations-collaborators.controller.js +0 -100
- package/dist/controllers/operations-collaborators.controller.js.map +1 -1
- package/dist/controllers/operations-contracts.controller.d.ts +12 -12
- package/dist/operations.service.d.ts +0 -76
- package/dist/operations.service.d.ts.map +1 -1
- package/dist/operations.service.js +7 -230
- package/dist/operations.service.js.map +1 -1
- package/dist/operations.service.spec.js +6 -0
- package/dist/operations.service.spec.js.map +1 -1
- package/hedhog/data/menu.yaml +8 -27
- package/hedhog/data/route.yaml +0 -72
- package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +476 -0
- package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +3 -39
- package/hedhog/frontend/app/_components/collaborator-select-with-create.tsx.ejs +261 -0
- package/hedhog/frontend/app/_components/collaborator-tasks-tab.tsx.ejs +358 -358
- package/hedhog/frontend/app/_components/collaborator-timesheets-tab.tsx.ejs +6 -6
- package/hedhog/frontend/app/_components/contract-content-editor.tsx.ejs +258 -0
- package/hedhog/frontend/app/_components/my-project-summary-screen.tsx.ejs +5 -4
- package/hedhog/frontend/app/_components/person-select-with-create.tsx.ejs +1 -0
- package/hedhog/frontend/app/_components/project-assignments-tab.tsx.ejs +10 -218
- package/hedhog/frontend/app/_components/project-cost-report-screen.tsx.ejs +23 -23
- package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +24 -708
- package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +38 -158
- package/hedhog/frontend/app/_components/task-detail-sheet.tsx.ejs +1 -5
- package/hedhog/frontend/app/_components/task-form-sheet.tsx.ejs +629 -629
- package/hedhog/frontend/app/_lib/api.ts.ejs +0 -151
- package/hedhog/frontend/app/_lib/types.ts.ejs +0 -1
- package/hedhog/frontend/app/_lib/utils/task-ui.ts.ejs +0 -18
- package/hedhog/frontend/app/my-projects/page.tsx.ejs +2 -16
- package/hedhog/frontend/app/my-tasks/page.tsx.ejs +86 -24
- package/hedhog/frontend/app/projects/page.tsx.ejs +6 -42
- package/hedhog/frontend/messages/en.json +2 -96
- package/hedhog/frontend/messages/operations/operations/en.json +2100 -0
- package/hedhog/frontend/messages/operations/operations/pt.json +2111 -0
- package/hedhog/frontend/messages/pt.json +2 -96
- package/hedhog/frontend/widgets/capacity-distribution.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/effort-by-project.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/headcount-by-area.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/index.ts.ejs +25 -25
- package/hedhog/frontend/widgets/managed-projects-status.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-hours-period-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-open-requests-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-pending-requests-list.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-project-allocations-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-quick-actions.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-relevant-deadlines.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-timesheet-status-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/my-weekly-journey.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/portfolio-costs-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/portfolio-effort-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/portfolio-projects-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/portfolio-risk-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/project-status-overview.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/shared-operations-widget.tsx.ejs +169 -169
- package/hedhog/frontend/widgets/strategic-deadlines.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/team-approval-queue.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/team-capacity-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/team-headcount-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/team-hours-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/team-pending-approvals-kpi.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/team-utilization-overview.tsx.ejs +16 -16
- package/hedhog/frontend/widgets/team-workload-alerts.tsx.ejs +16 -16
- package/hedhog/table/operations_collaborator.yaml +8 -8
- package/hedhog/table/operations_task.yaml +76 -76
- package/hedhog/table/operations_task_activity.yaml +51 -51
- package/package.json +6 -6
- package/src/controllers/operations-collaborators.controller.ts +8 -117
- package/src/controllers/operations-tasks.controller.ts +156 -156
- package/src/dashboard/widgets/MyQuickActions.tsx +22 -22
- package/src/dto/create-collaborator.dto.ts +4 -4
- package/src/operations.service.spec.ts +1006 -988
- package/src/operations.service.ts +7 -323
- package/dist/dto/create-collaborator-invoice.dto.d.ts +0 -11
- package/dist/dto/create-collaborator-invoice.dto.d.ts.map +0 -1
- package/dist/dto/create-collaborator-invoice.dto.js +0 -55
- package/dist/dto/create-collaborator-invoice.dto.js.map +0 -1
- package/dist/dto/create-collaborator-payment.dto.d.ts +0 -10
- package/dist/dto/create-collaborator-payment.dto.d.ts.map +0 -1
- package/dist/dto/create-collaborator-payment.dto.js +0 -50
- package/dist/dto/create-collaborator-payment.dto.js.map +0 -1
- package/dist/dto/list-collaborator-invoice.dto.d.ts +0 -4
- package/dist/dto/list-collaborator-invoice.dto.d.ts.map +0 -1
- package/dist/dto/list-collaborator-invoice.dto.js +0 -8
- package/dist/dto/list-collaborator-invoice.dto.js.map +0 -1
- package/dist/dto/list-collaborator-payment.dto.d.ts +0 -4
- package/dist/dto/list-collaborator-payment.dto.d.ts.map +0 -1
- package/dist/dto/list-collaborator-payment.dto.js +0 -8
- package/dist/dto/list-collaborator-payment.dto.js.map +0 -1
- package/dist/dto/update-collaborator-invoice.dto.d.ts +0 -6
- package/dist/dto/update-collaborator-invoice.dto.d.ts.map +0 -1
- package/dist/dto/update-collaborator-invoice.dto.js +0 -9
- package/dist/dto/update-collaborator-invoice.dto.js.map +0 -1
- package/dist/dto/update-collaborator-payment.dto.d.ts +0 -6
- package/dist/dto/update-collaborator-payment.dto.d.ts.map +0 -1
- package/dist/dto/update-collaborator-payment.dto.js +0 -9
- package/dist/dto/update-collaborator-payment.dto.js.map +0 -1
- package/hedhog/frontend/app/_components/collaborator-invoices-tab.tsx.ejs +0 -443
- package/hedhog/frontend/app/_components/collaborator-payment-history-tab.tsx.ejs +0 -429
- package/hedhog/frontend/app/tasks-gantt/page.tsx.ejs +0 -953
- package/hedhog/table/operations_collaborator_invoice.yaml +0 -35
- package/hedhog/table/operations_collaborator_payment.yaml +0 -32
- package/src/dto/create-collaborator-invoice.dto.ts +0 -39
- package/src/dto/create-collaborator-payment.dto.ts +0 -35
- package/src/dto/list-collaborator-invoice.dto.ts +0 -3
- package/src/dto/list-collaborator-payment.dto.ts +0 -3
- package/src/dto/update-collaborator-invoice.dto.ts +0 -6
- package/src/dto/update-collaborator-payment.dto.ts +0 -6
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='portfolio-effort-kpi' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='portfolio-effort-kpi' />;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='portfolio-projects-kpi' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='portfolio-projects-kpi' />;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='portfolio-risk-kpi' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='portfolio-risk-kpi' />;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='project-status-overview' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='project-status-overview' />;
|
|
17
17
|
}
|
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
|
|
4
|
-
import { Card, CardContent } from '@/components/ui/card';
|
|
5
|
-
import { useWidgetData } from '@/hooks/use-widget-data';
|
|
6
|
-
|
|
7
|
-
interface WidgetLayoutLike {
|
|
8
|
-
name?: string;
|
|
9
|
-
slug?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface OperationsWidgetProps {
|
|
13
|
-
widget?: WidgetLayoutLike;
|
|
14
|
-
onRemove?: () => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface OperationsDashboardData {
|
|
18
|
-
actor: {
|
|
19
|
-
roleScope: 'self' | 'team' | 'full';
|
|
20
|
-
collaboratorId: number | null;
|
|
21
|
-
collaboratorName: string | null;
|
|
22
|
-
teamSize: number;
|
|
23
|
-
};
|
|
24
|
-
cards: {
|
|
25
|
-
projectsTotal: number;
|
|
26
|
-
activeProjects: number;
|
|
27
|
-
visibleTimesheets: number;
|
|
28
|
-
pendingTimesheets: number;
|
|
29
|
-
timeOffRequests: number;
|
|
30
|
-
scheduleAdjustmentRequests: number;
|
|
31
|
-
pendingApprovals: number;
|
|
32
|
-
};
|
|
33
|
-
recentTimesheets: Array<{
|
|
34
|
-
id: number;
|
|
35
|
-
collaboratorName: string;
|
|
36
|
-
weekStartDate: string;
|
|
37
|
-
weekEndDate: string;
|
|
38
|
-
totalHours: number | null;
|
|
39
|
-
status: string;
|
|
40
|
-
}>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface SharedOperationsWidgetProps extends OperationsWidgetProps {
|
|
44
|
-
slug: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const buildSummary = (slug: string, data: OperationsDashboardData | undefined) => {
|
|
48
|
-
const cards = data?.cards;
|
|
49
|
-
const actor = data?.actor;
|
|
50
|
-
|
|
51
|
-
const fallback = {
|
|
52
|
-
value: 0,
|
|
53
|
-
caption: 'Sem dados disponiveis',
|
|
54
|
-
detail: 'Aguardando sincronizacao com o dashboard.',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
if (!cards || !actor) {
|
|
58
|
-
return fallback;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const map: Record<string, { value: number; caption: string; detail: string }> = {
|
|
62
|
-
'my-hours-period-kpi': {
|
|
63
|
-
value: cards.visibleTimesheets,
|
|
64
|
-
caption: 'Lacamentos visiveis',
|
|
65
|
-
detail: `Timesheets pendentes: ${cards.pendingTimesheets}`,
|
|
66
|
-
},
|
|
67
|
-
'my-timesheet-status-kpi': {
|
|
68
|
-
value: cards.pendingTimesheets,
|
|
69
|
-
caption: 'Timesheets pendentes',
|
|
70
|
-
detail: `Timesheets visiveis: ${cards.visibleTimesheets}`,
|
|
71
|
-
},
|
|
72
|
-
'my-project-allocations-kpi': {
|
|
73
|
-
value: cards.activeProjects,
|
|
74
|
-
caption: 'Projetos ativos',
|
|
75
|
-
detail: `Projetos visiveis: ${cards.projectsTotal}`,
|
|
76
|
-
},
|
|
77
|
-
'my-open-requests-kpi': {
|
|
78
|
-
value: cards.timeOffRequests + cards.scheduleAdjustmentRequests,
|
|
79
|
-
caption: 'Solicitacoes abertas',
|
|
80
|
-
detail: `Folgas: ${cards.timeOffRequests} · Ajustes: ${cards.scheduleAdjustmentRequests}`,
|
|
81
|
-
},
|
|
82
|
-
'team-headcount-kpi': {
|
|
83
|
-
value: actor.teamSize,
|
|
84
|
-
caption: 'Tamanho da equipe',
|
|
85
|
-
detail: `Escopo atual: ${actor.roleScope}`,
|
|
86
|
-
},
|
|
87
|
-
'team-pending-approvals-kpi': {
|
|
88
|
-
value: cards.pendingApprovals,
|
|
89
|
-
caption: 'Aprovacoes pendentes',
|
|
90
|
-
detail: `Timesheets pendentes: ${cards.pendingTimesheets}`,
|
|
91
|
-
},
|
|
92
|
-
'team-hours-kpi': {
|
|
93
|
-
value: cards.visibleTimesheets,
|
|
94
|
-
caption: 'Horas em timesheets',
|
|
95
|
-
detail: `Escopo atual: ${actor.roleScope}`,
|
|
96
|
-
},
|
|
97
|
-
'team-capacity-kpi': {
|
|
98
|
-
value: actor.teamSize,
|
|
99
|
-
caption: 'Capacidade monitorada',
|
|
100
|
-
detail: `Solicitacoes em aberto: ${cards.timeOffRequests + cards.scheduleAdjustmentRequests}`,
|
|
101
|
-
},
|
|
102
|
-
'portfolio-projects-kpi': {
|
|
103
|
-
value: cards.projectsTotal,
|
|
104
|
-
caption: 'Projetos do portfolio',
|
|
105
|
-
detail: `Projetos ativos: ${cards.activeProjects}`,
|
|
106
|
-
},
|
|
107
|
-
'portfolio-costs-kpi': {
|
|
108
|
-
value: cards.pendingApprovals,
|
|
109
|
-
caption: 'Itens aguardando aprovacao',
|
|
110
|
-
detail: 'Use este KPI para identificar impacto operacional imediato.',
|
|
111
|
-
},
|
|
112
|
-
'portfolio-effort-kpi': {
|
|
113
|
-
value: cards.visibleTimesheets,
|
|
114
|
-
caption: 'Esforco registrado',
|
|
115
|
-
detail: `Timesheets pendentes: ${cards.pendingTimesheets}`,
|
|
116
|
-
},
|
|
117
|
-
'portfolio-risk-kpi': {
|
|
118
|
-
value: cards.pendingApprovals,
|
|
119
|
-
caption: 'Risco operacional',
|
|
120
|
-
detail: 'Pendencias de aprovacao podem indicar gargalos.',
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
if (map[slug]) {
|
|
125
|
-
return map[slug];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
value: data.recentTimesheets.length,
|
|
130
|
-
caption: 'Atualizacoes recentes',
|
|
131
|
-
detail: `Escopo ${actor.roleScope} · ${data.recentTimesheets.length} registros recentes`,
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export default function SharedOperationsWidget({
|
|
136
|
-
widget,
|
|
137
|
-
onRemove,
|
|
138
|
-
slug,
|
|
139
|
-
}: SharedOperationsWidgetProps) {
|
|
140
|
-
const { data, isLoading, isAccessDenied, isError } =
|
|
141
|
-
useWidgetData<OperationsDashboardData>({
|
|
142
|
-
endpoint: '/operations/dashboard',
|
|
143
|
-
queryKey: 'operations-dashboard-shared',
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
const summary = buildSummary(slug, data);
|
|
147
|
-
const title = widget?.name || slug;
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<WidgetWrapper
|
|
151
|
-
isLoading={isLoading}
|
|
152
|
-
isAccessDenied={isAccessDenied}
|
|
153
|
-
isError={isError}
|
|
154
|
-
widgetName={title}
|
|
155
|
-
onRemove={onRemove}
|
|
156
|
-
>
|
|
157
|
-
<Card className="h-full border-border/60 bg-linear-to-br from-background to-slate-50/40 shadow-sm">
|
|
158
|
-
<CardContent className="flex h-full flex-col justify-between gap-3 p-4">
|
|
159
|
-
<div>
|
|
160
|
-
<p className="text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground">
|
|
161
|
-
{summary.caption}
|
|
162
|
-
</p>
|
|
163
|
-
<p className="mt-2 text-3xl font-bold text-foreground">{summary.value}</p>
|
|
164
|
-
</div>
|
|
165
|
-
<p className="text-xs text-muted-foreground">{summary.detail}</p>
|
|
166
|
-
</CardContent>
|
|
167
|
-
</Card>
|
|
168
|
-
</WidgetWrapper>
|
|
169
|
-
);
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
|
|
4
|
+
import { Card, CardContent } from '@/components/ui/card';
|
|
5
|
+
import { useWidgetData } from '@/hooks/use-widget-data';
|
|
6
|
+
|
|
7
|
+
interface WidgetLayoutLike {
|
|
8
|
+
name?: string;
|
|
9
|
+
slug?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface OperationsWidgetProps {
|
|
13
|
+
widget?: WidgetLayoutLike;
|
|
14
|
+
onRemove?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface OperationsDashboardData {
|
|
18
|
+
actor: {
|
|
19
|
+
roleScope: 'self' | 'team' | 'full';
|
|
20
|
+
collaboratorId: number | null;
|
|
21
|
+
collaboratorName: string | null;
|
|
22
|
+
teamSize: number;
|
|
23
|
+
};
|
|
24
|
+
cards: {
|
|
25
|
+
projectsTotal: number;
|
|
26
|
+
activeProjects: number;
|
|
27
|
+
visibleTimesheets: number;
|
|
28
|
+
pendingTimesheets: number;
|
|
29
|
+
timeOffRequests: number;
|
|
30
|
+
scheduleAdjustmentRequests: number;
|
|
31
|
+
pendingApprovals: number;
|
|
32
|
+
};
|
|
33
|
+
recentTimesheets: Array<{
|
|
34
|
+
id: number;
|
|
35
|
+
collaboratorName: string;
|
|
36
|
+
weekStartDate: string;
|
|
37
|
+
weekEndDate: string;
|
|
38
|
+
totalHours: number | null;
|
|
39
|
+
status: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface SharedOperationsWidgetProps extends OperationsWidgetProps {
|
|
44
|
+
slug: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const buildSummary = (slug: string, data: OperationsDashboardData | undefined) => {
|
|
48
|
+
const cards = data?.cards;
|
|
49
|
+
const actor = data?.actor;
|
|
50
|
+
|
|
51
|
+
const fallback = {
|
|
52
|
+
value: 0,
|
|
53
|
+
caption: 'Sem dados disponiveis',
|
|
54
|
+
detail: 'Aguardando sincronizacao com o dashboard.',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
if (!cards || !actor) {
|
|
58
|
+
return fallback;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const map: Record<string, { value: number; caption: string; detail: string }> = {
|
|
62
|
+
'my-hours-period-kpi': {
|
|
63
|
+
value: cards.visibleTimesheets,
|
|
64
|
+
caption: 'Lacamentos visiveis',
|
|
65
|
+
detail: `Timesheets pendentes: ${cards.pendingTimesheets}`,
|
|
66
|
+
},
|
|
67
|
+
'my-timesheet-status-kpi': {
|
|
68
|
+
value: cards.pendingTimesheets,
|
|
69
|
+
caption: 'Timesheets pendentes',
|
|
70
|
+
detail: `Timesheets visiveis: ${cards.visibleTimesheets}`,
|
|
71
|
+
},
|
|
72
|
+
'my-project-allocations-kpi': {
|
|
73
|
+
value: cards.activeProjects,
|
|
74
|
+
caption: 'Projetos ativos',
|
|
75
|
+
detail: `Projetos visiveis: ${cards.projectsTotal}`,
|
|
76
|
+
},
|
|
77
|
+
'my-open-requests-kpi': {
|
|
78
|
+
value: cards.timeOffRequests + cards.scheduleAdjustmentRequests,
|
|
79
|
+
caption: 'Solicitacoes abertas',
|
|
80
|
+
detail: `Folgas: ${cards.timeOffRequests} · Ajustes: ${cards.scheduleAdjustmentRequests}`,
|
|
81
|
+
},
|
|
82
|
+
'team-headcount-kpi': {
|
|
83
|
+
value: actor.teamSize,
|
|
84
|
+
caption: 'Tamanho da equipe',
|
|
85
|
+
detail: `Escopo atual: ${actor.roleScope}`,
|
|
86
|
+
},
|
|
87
|
+
'team-pending-approvals-kpi': {
|
|
88
|
+
value: cards.pendingApprovals,
|
|
89
|
+
caption: 'Aprovacoes pendentes',
|
|
90
|
+
detail: `Timesheets pendentes: ${cards.pendingTimesheets}`,
|
|
91
|
+
},
|
|
92
|
+
'team-hours-kpi': {
|
|
93
|
+
value: cards.visibleTimesheets,
|
|
94
|
+
caption: 'Horas em timesheets',
|
|
95
|
+
detail: `Escopo atual: ${actor.roleScope}`,
|
|
96
|
+
},
|
|
97
|
+
'team-capacity-kpi': {
|
|
98
|
+
value: actor.teamSize,
|
|
99
|
+
caption: 'Capacidade monitorada',
|
|
100
|
+
detail: `Solicitacoes em aberto: ${cards.timeOffRequests + cards.scheduleAdjustmentRequests}`,
|
|
101
|
+
},
|
|
102
|
+
'portfolio-projects-kpi': {
|
|
103
|
+
value: cards.projectsTotal,
|
|
104
|
+
caption: 'Projetos do portfolio',
|
|
105
|
+
detail: `Projetos ativos: ${cards.activeProjects}`,
|
|
106
|
+
},
|
|
107
|
+
'portfolio-costs-kpi': {
|
|
108
|
+
value: cards.pendingApprovals,
|
|
109
|
+
caption: 'Itens aguardando aprovacao',
|
|
110
|
+
detail: 'Use este KPI para identificar impacto operacional imediato.',
|
|
111
|
+
},
|
|
112
|
+
'portfolio-effort-kpi': {
|
|
113
|
+
value: cards.visibleTimesheets,
|
|
114
|
+
caption: 'Esforco registrado',
|
|
115
|
+
detail: `Timesheets pendentes: ${cards.pendingTimesheets}`,
|
|
116
|
+
},
|
|
117
|
+
'portfolio-risk-kpi': {
|
|
118
|
+
value: cards.pendingApprovals,
|
|
119
|
+
caption: 'Risco operacional',
|
|
120
|
+
detail: 'Pendencias de aprovacao podem indicar gargalos.',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (map[slug]) {
|
|
125
|
+
return map[slug];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
value: data.recentTimesheets.length,
|
|
130
|
+
caption: 'Atualizacoes recentes',
|
|
131
|
+
detail: `Escopo ${actor.roleScope} · ${data.recentTimesheets.length} registros recentes`,
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default function SharedOperationsWidget({
|
|
136
|
+
widget,
|
|
137
|
+
onRemove,
|
|
138
|
+
slug,
|
|
139
|
+
}: SharedOperationsWidgetProps) {
|
|
140
|
+
const { data, isLoading, isAccessDenied, isError } =
|
|
141
|
+
useWidgetData<OperationsDashboardData>({
|
|
142
|
+
endpoint: '/operations/dashboard',
|
|
143
|
+
queryKey: 'operations-dashboard-shared',
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const summary = buildSummary(slug, data);
|
|
147
|
+
const title = widget?.name || slug;
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<WidgetWrapper
|
|
151
|
+
isLoading={isLoading}
|
|
152
|
+
isAccessDenied={isAccessDenied}
|
|
153
|
+
isError={isError}
|
|
154
|
+
widgetName={title}
|
|
155
|
+
onRemove={onRemove}
|
|
156
|
+
>
|
|
157
|
+
<Card className="h-full border-border/60 bg-linear-to-br from-background to-slate-50/40 shadow-sm">
|
|
158
|
+
<CardContent className="flex h-full flex-col justify-between gap-3 p-4">
|
|
159
|
+
<div>
|
|
160
|
+
<p className="text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground">
|
|
161
|
+
{summary.caption}
|
|
162
|
+
</p>
|
|
163
|
+
<p className="mt-2 text-3xl font-bold text-foreground">{summary.value}</p>
|
|
164
|
+
</div>
|
|
165
|
+
<p className="text-xs text-muted-foreground">{summary.detail}</p>
|
|
166
|
+
</CardContent>
|
|
167
|
+
</Card>
|
|
168
|
+
</WidgetWrapper>
|
|
169
|
+
);
|
|
170
170
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='strategic-deadlines' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='strategic-deadlines' />;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='team-approval-queue' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='team-approval-queue' />;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='team-capacity-kpi' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='team-capacity-kpi' />;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='team-headcount-kpi' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='team-headcount-kpi' />;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
-
|
|
5
|
-
interface WidgetLayoutLike {
|
|
6
|
-
name?: string;
|
|
7
|
-
slug?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface OperationsWidgetProps {
|
|
11
|
-
widget?: WidgetLayoutLike;
|
|
12
|
-
onRemove?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
-
return <SharedOperationsWidget {...props} slug='team-hours-kpi' />;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import SharedOperationsWidget from './operations.shared-operations-widget';
|
|
4
|
+
|
|
5
|
+
interface WidgetLayoutLike {
|
|
6
|
+
name?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface OperationsWidgetProps {
|
|
11
|
+
widget?: WidgetLayoutLike;
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function OperationsWidget(props: OperationsWidgetProps) {
|
|
16
|
+
return <SharedOperationsWidget {...props} slug='team-hours-kpi' />;
|
|
17
17
|
}
|