@hed-hog/operations 0.0.330 → 0.0.331
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/README.md +5 -5
- package/dist/controllers/operations-collaborators.controller.d.ts +7 -216
- package/dist/controllers/operations-collaborators.controller.d.ts.map +1 -1
- package/dist/controllers/operations-contracts.controller.d.ts +6 -6
- package/dist/controllers/operations-projects.controller.d.ts +25 -0
- package/dist/controllers/operations-projects.controller.d.ts.map +1 -1
- package/dist/controllers/operations-projects.controller.js +48 -0
- package/dist/controllers/operations-projects.controller.js.map +1 -1
- package/dist/controllers/operations-reports.controller.d.ts +1 -1
- package/dist/controllers/operations-tasks.controller.d.ts +34 -9
- package/dist/controllers/operations-tasks.controller.d.ts.map +1 -1
- package/dist/controllers/operations-tasks.controller.js +43 -32
- package/dist/controllers/operations-tasks.controller.js.map +1 -1
- package/dist/controllers/operations-timesheets.controller.d.ts +9 -9
- package/dist/dashboard/components/DashboardLayout.d.ts +30 -0
- package/dist/dashboard/components/DashboardLayout.d.ts.map +1 -0
- package/dist/dashboard/components/DashboardLayout.js +87 -0
- package/dist/dashboard/components/DashboardLayout.js.map +1 -0
- package/dist/dashboard/components/widget-registry.d.ts +23 -0
- package/dist/dashboard/components/widget-registry.d.ts.map +1 -0
- package/dist/dashboard/components/widget-registry.js +245 -0
- package/dist/dashboard/components/widget-registry.js.map +1 -0
- package/dist/dashboard/hooks/useDashboardData.d.ts +20 -0
- package/dist/dashboard/hooks/useDashboardData.d.ts.map +1 -0
- package/dist/dashboard/hooks/useDashboardData.js +24 -0
- package/dist/dashboard/hooks/useDashboardData.js.map +1 -0
- package/dist/dashboard/types/widgets.types.d.ts +233 -0
- package/dist/dashboard/types/widgets.types.d.ts.map +1 -0
- package/dist/dashboard/types/widgets.types.js +6 -0
- package/dist/dashboard/types/widgets.types.js.map +1 -0
- package/dist/dashboard/widgets/CapacityDistribution.d.ts +23 -0
- package/dist/dashboard/widgets/CapacityDistribution.d.ts.map +1 -0
- package/dist/dashboard/widgets/CapacityDistribution.js +11 -0
- package/dist/dashboard/widgets/CapacityDistribution.js.map +1 -0
- package/dist/dashboard/widgets/EffortByProject.d.ts +22 -0
- package/dist/dashboard/widgets/EffortByProject.d.ts.map +1 -0
- package/dist/dashboard/widgets/EffortByProject.js +11 -0
- package/dist/dashboard/widgets/EffortByProject.js.map +1 -0
- package/dist/dashboard/widgets/HeadcountByArea.d.ts +24 -0
- package/dist/dashboard/widgets/HeadcountByArea.d.ts.map +1 -0
- package/dist/dashboard/widgets/HeadcountByArea.js +11 -0
- package/dist/dashboard/widgets/HeadcountByArea.js.map +1 -0
- package/dist/dashboard/widgets/ManagedProjectsStatus.d.ts +18 -0
- package/dist/dashboard/widgets/ManagedProjectsStatus.d.ts.map +1 -0
- package/dist/dashboard/widgets/ManagedProjectsStatus.js +12 -0
- package/dist/dashboard/widgets/ManagedProjectsStatus.js.map +1 -0
- package/dist/dashboard/widgets/MyHoursPeriodKpi.d.ts +22 -0
- package/dist/dashboard/widgets/MyHoursPeriodKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyHoursPeriodKpi.js +12 -0
- package/dist/dashboard/widgets/MyHoursPeriodKpi.js.map +1 -0
- package/dist/dashboard/widgets/MyOpenRequestsKpi.d.ts +19 -0
- package/dist/dashboard/widgets/MyOpenRequestsKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyOpenRequestsKpi.js +17 -0
- package/dist/dashboard/widgets/MyOpenRequestsKpi.js.map +1 -0
- package/dist/dashboard/widgets/MyPendingRequestsList.d.ts +23 -0
- package/dist/dashboard/widgets/MyPendingRequestsList.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyPendingRequestsList.js +14 -0
- package/dist/dashboard/widgets/MyPendingRequestsList.js.map +1 -0
- package/dist/dashboard/widgets/MyProjectAllocationsKpi.d.ts +22 -0
- package/dist/dashboard/widgets/MyProjectAllocationsKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyProjectAllocationsKpi.js +11 -0
- package/dist/dashboard/widgets/MyProjectAllocationsKpi.js.map +1 -0
- package/dist/dashboard/widgets/MyQuickActions.d.ts +23 -0
- package/dist/dashboard/widgets/MyQuickActions.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyQuickActions.js +18 -0
- package/dist/dashboard/widgets/MyQuickActions.js.map +1 -0
- package/dist/dashboard/widgets/MyRelevantDeadlines.d.ts +23 -0
- package/dist/dashboard/widgets/MyRelevantDeadlines.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyRelevantDeadlines.js +22 -0
- package/dist/dashboard/widgets/MyRelevantDeadlines.js.map +1 -0
- package/dist/dashboard/widgets/MyTimesheetStatusKpi.d.ts +17 -0
- package/dist/dashboard/widgets/MyTimesheetStatusKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyTimesheetStatusKpi.js +11 -0
- package/dist/dashboard/widgets/MyTimesheetStatusKpi.js.map +1 -0
- package/dist/dashboard/widgets/MyWeeklyJourney.d.ts +21 -0
- package/dist/dashboard/widgets/MyWeeklyJourney.d.ts.map +1 -0
- package/dist/dashboard/widgets/MyWeeklyJourney.js +19 -0
- package/dist/dashboard/widgets/MyWeeklyJourney.js.map +1 -0
- package/dist/dashboard/widgets/PortfolioCostsKpi.d.ts +19 -0
- package/dist/dashboard/widgets/PortfolioCostsKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/PortfolioCostsKpi.js +12 -0
- package/dist/dashboard/widgets/PortfolioCostsKpi.js.map +1 -0
- package/dist/dashboard/widgets/PortfolioEffortKpi.d.ts +18 -0
- package/dist/dashboard/widgets/PortfolioEffortKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/PortfolioEffortKpi.js +8 -0
- package/dist/dashboard/widgets/PortfolioEffortKpi.js.map +1 -0
- package/dist/dashboard/widgets/PortfolioProjectsKpi.d.ts +22 -0
- package/dist/dashboard/widgets/PortfolioProjectsKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/PortfolioProjectsKpi.js +56 -0
- package/dist/dashboard/widgets/PortfolioProjectsKpi.js.map +1 -0
- package/dist/dashboard/widgets/PortfolioRiskKpi.d.ts +19 -0
- package/dist/dashboard/widgets/PortfolioRiskKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/PortfolioRiskKpi.js +11 -0
- package/dist/dashboard/widgets/PortfolioRiskKpi.js.map +1 -0
- package/dist/dashboard/widgets/ProjectStatusOverview.d.ts +19 -0
- package/dist/dashboard/widgets/ProjectStatusOverview.d.ts.map +1 -0
- package/dist/dashboard/widgets/ProjectStatusOverview.js +18 -0
- package/dist/dashboard/widgets/ProjectStatusOverview.js.map +1 -0
- package/dist/dashboard/widgets/StrategicDeadlines.d.ts +24 -0
- package/dist/dashboard/widgets/StrategicDeadlines.d.ts.map +1 -0
- package/dist/dashboard/widgets/StrategicDeadlines.js +22 -0
- package/dist/dashboard/widgets/StrategicDeadlines.js.map +1 -0
- package/dist/dashboard/widgets/TeamApprovalQueue.d.ts +24 -0
- package/dist/dashboard/widgets/TeamApprovalQueue.d.ts.map +1 -0
- package/dist/dashboard/widgets/TeamApprovalQueue.js +12 -0
- package/dist/dashboard/widgets/TeamApprovalQueue.js.map +1 -0
- package/dist/dashboard/widgets/TeamCapacityKpi.d.ts +18 -0
- package/dist/dashboard/widgets/TeamCapacityKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/TeamCapacityKpi.js +19 -0
- package/dist/dashboard/widgets/TeamCapacityKpi.js.map +1 -0
- package/dist/dashboard/widgets/TeamHeadcountKpi.d.ts +22 -0
- package/dist/dashboard/widgets/TeamHeadcountKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/TeamHeadcountKpi.js +56 -0
- package/dist/dashboard/widgets/TeamHeadcountKpi.js.map +1 -0
- package/dist/dashboard/widgets/TeamHoursKpi.d.ts +19 -0
- package/dist/dashboard/widgets/TeamHoursKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/TeamHoursKpi.js +13 -0
- package/dist/dashboard/widgets/TeamHoursKpi.js.map +1 -0
- package/dist/dashboard/widgets/TeamPendingApprovalsKpi.d.ts +20 -0
- package/dist/dashboard/widgets/TeamPendingApprovalsKpi.d.ts.map +1 -0
- package/dist/dashboard/widgets/TeamPendingApprovalsKpi.js +11 -0
- package/dist/dashboard/widgets/TeamPendingApprovalsKpi.js.map +1 -0
- package/dist/dashboard/widgets/TeamUtilizationOverview.d.ts +18 -0
- package/dist/dashboard/widgets/TeamUtilizationOverview.d.ts.map +1 -0
- package/dist/dashboard/widgets/TeamUtilizationOverview.js +17 -0
- package/dist/dashboard/widgets/TeamUtilizationOverview.js.map +1 -0
- package/dist/dashboard/widgets/TeamWorkloadAlerts.d.ts +24 -0
- package/dist/dashboard/widgets/TeamWorkloadAlerts.d.ts.map +1 -0
- package/dist/dashboard/widgets/TeamWorkloadAlerts.js +19 -0
- package/dist/dashboard/widgets/TeamWorkloadAlerts.js.map +1 -0
- package/dist/dashboard/widgets/index.d.ts +24 -0
- package/dist/dashboard/widgets/index.d.ts.map +1 -0
- package/dist/dashboard/widgets/index.js +54 -0
- package/dist/dashboard/widgets/index.js.map +1 -0
- package/dist/dto/create-collaborator.dto.d.ts +0 -1
- package/dist/dto/create-collaborator.dto.d.ts.map +1 -1
- package/dist/dto/create-collaborator.dto.js +0 -6
- package/dist/dto/create-collaborator.dto.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/operations.controller.d.ts +42 -0
- package/dist/operations.controller.d.ts.map +1 -1
- package/dist/operations.service.d.ts +182 -268
- package/dist/operations.service.d.ts.map +1 -1
- package/dist/operations.service.js +2147 -1337
- package/dist/operations.service.js.map +1 -1
- package/dist/operations.service.spec.js +345 -174
- package/dist/operations.service.spec.js.map +1 -1
- package/hedhog/data/dashboard_component.yaml +66 -0
- package/hedhog/data/dashboard_item.yaml +25 -25
- package/hedhog/data/route.yaml +61 -0
- package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +39 -99
- package/hedhog/frontend/app/_components/collaborator-picker.tsx.ejs +158 -0
- package/hedhog/frontend/app/_components/my-project-summary-screen.tsx.ejs +314 -116
- package/hedhog/frontend/app/_components/project-assignments-tab.tsx.ejs +434 -449
- package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +289 -412
- package/hedhog/frontend/app/_components/project-file-attachments.tsx.ejs +371 -0
- package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +426 -374
- package/hedhog/frontend/app/_components/task-detail-sheet.tsx.ejs +803 -581
- package/hedhog/frontend/app/_components/task-file-attachments.tsx.ejs +4 -1
- package/hedhog/frontend/app/_components/task-form-fields.tsx.ejs +406 -0
- package/hedhog/frontend/app/_components/task-form-sheet.tsx.ejs +629 -784
- package/hedhog/frontend/app/_components/task-info-display.tsx.ejs +137 -0
- package/hedhog/frontend/app/_components/timesheet-entry-create-sheet.tsx.ejs +306 -0
- package/hedhog/frontend/app/_lib/api.ts.ejs +480 -476
- package/hedhog/frontend/app/_lib/types.ts.ejs +66 -5
- package/hedhog/frontend/app/_lib/utils/format.ts.ejs +0 -2
- package/hedhog/frontend/app/_lib/utils/task-ui.ts.ejs +43 -0
- package/hedhog/frontend/app/approvals/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/collaborator-types/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/collaborators/page.tsx.ejs +59 -8
- package/hedhog/frontend/app/contracts/page.tsx.ejs +29 -8
- package/hedhog/frontend/app/dashboard/widgets/CapacityDistribution.tsx.ejs +84 -0
- package/hedhog/frontend/app/dashboard/widgets/EffortByProject.tsx.ejs +85 -0
- package/hedhog/frontend/app/dashboard/widgets/HeadcountByArea.tsx.ejs +101 -0
- package/hedhog/frontend/app/dashboard/widgets/ManagedProjectsStatus.tsx.ejs +113 -0
- package/hedhog/frontend/app/dashboard/widgets/MyHoursPeriodKpi.tsx.ejs +87 -0
- package/hedhog/frontend/app/dashboard/widgets/MyOpenRequestsKpi.tsx.ejs +97 -0
- package/hedhog/frontend/app/dashboard/widgets/MyPendingRequestsList.tsx.ejs +99 -0
- package/hedhog/frontend/app/dashboard/widgets/MyProjectAllocationsKpi.tsx.ejs +78 -0
- package/hedhog/frontend/app/dashboard/widgets/MyQuickActions.tsx.ejs +130 -0
- package/hedhog/frontend/app/dashboard/widgets/MyRelevantDeadlines.tsx.ejs +144 -0
- package/hedhog/frontend/app/dashboard/widgets/MyTimesheetStatusKpi.tsx.ejs +78 -0
- package/hedhog/frontend/app/dashboard/widgets/MyWeeklyJourney.tsx.ejs +99 -0
- package/hedhog/frontend/app/dashboard/widgets/PortfolioCostsKpi.tsx.ejs +112 -0
- package/hedhog/frontend/app/dashboard/widgets/PortfolioEffortKpi.tsx.ejs +93 -0
- package/hedhog/frontend/app/dashboard/widgets/PortfolioProjectsKpi.tsx.ejs +96 -0
- package/hedhog/frontend/app/dashboard/widgets/PortfolioRiskKpi.tsx.ejs +115 -0
- package/hedhog/frontend/app/dashboard/widgets/ProjectStatusOverview.tsx.ejs +120 -0
- package/hedhog/frontend/app/dashboard/widgets/StrategicDeadlines.tsx.ejs +146 -0
- package/hedhog/frontend/app/dashboard/widgets/TeamApprovalQueue.tsx.ejs +108 -0
- package/hedhog/frontend/app/dashboard/widgets/TeamCapacityKpi.tsx.ejs +97 -0
- package/hedhog/frontend/app/dashboard/widgets/TeamHeadcountKpi.tsx.ejs +100 -0
- package/hedhog/frontend/app/dashboard/widgets/TeamHoursKpi.tsx.ejs +104 -0
- package/hedhog/frontend/app/dashboard/widgets/TeamPendingApprovalsKpi.tsx.ejs +110 -0
- package/hedhog/frontend/app/dashboard/widgets/TeamUtilizationOverview.tsx.ejs +115 -0
- package/hedhog/frontend/app/dashboard/widgets/TeamWorkloadAlerts.tsx.ejs +117 -0
- package/hedhog/frontend/app/dashboard/widgets/index.ts.ejs +26 -0
- package/hedhog/frontend/app/departments/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/my-projects/page.tsx.ejs +14 -10
- package/hedhog/frontend/app/my-tasks/page.tsx.ejs +328 -105
- package/hedhog/frontend/app/project-cost-categories/page.tsx.ejs +58 -52
- package/hedhog/frontend/app/project-cost-types/page.tsx.ejs +58 -51
- package/hedhog/frontend/app/projects/page.tsx.ejs +376 -30
- package/hedhog/frontend/app/schedule-adjustments/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/time-off/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/timesheets/page.tsx.ejs +10 -4
- package/hedhog/frontend/messages/en.json +238 -46
- package/hedhog/frontend/messages/operations/en.json +61 -52
- package/hedhog/frontend/messages/operations/pt.json +59 -43
- package/hedhog/frontend/messages/pt.json +238 -46
- package/hedhog/frontend/widgets/capacity-distribution.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/effort-by-project.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/headcount-by-area.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/index.ts.ejs +25 -0
- package/hedhog/frontend/widgets/managed-projects-status.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-hours-period-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-open-requests-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-pending-requests-list.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-project-allocations-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-quick-actions.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-relevant-deadlines.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-timesheet-status-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/my-weekly-journey.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/portfolio-costs-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/portfolio-effort-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/portfolio-projects-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/portfolio-risk-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/project-status-overview.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/shared-operations-widget.tsx.ejs +170 -0
- package/hedhog/frontend/widgets/strategic-deadlines.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/team-approval-queue.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/team-capacity-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/team-headcount-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/team-hours-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/team-pending-approvals-kpi.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/team-utilization-overview.tsx.ejs +17 -0
- package/hedhog/frontend/widgets/team-workload-alerts.tsx.ejs +17 -0
- package/hedhog/table/operations_collaborator.yaml +8 -13
- package/hedhog/table/operations_project.yaml +1 -1
- package/hedhog/table/operations_project_file.yaml +23 -0
- package/hedhog/table/operations_task.yaml +76 -69
- package/hedhog/table/operations_task_activity.yaml +51 -0
- package/package.json +6 -5
- package/src/controllers/operations-projects.controller.ts +41 -8
- package/src/controllers/operations-tasks.controller.ts +156 -166
- package/src/dashboard/README.md +214 -0
- package/src/dashboard/components/DashboardLayout.tsx +131 -0
- package/src/dashboard/components/widget-registry.ts +255 -0
- package/src/dashboard/hooks/useDashboardData.ts +29 -0
- package/src/dashboard/types/widgets.types.ts +237 -0
- package/src/dashboard/widgets/CapacityDistribution.tsx +56 -0
- package/src/dashboard/widgets/EffortByProject.tsx +51 -0
- package/src/dashboard/widgets/HeadcountByArea.tsx +57 -0
- package/src/dashboard/widgets/ManagedProjectsStatus.tsx +53 -0
- package/src/dashboard/widgets/MyHoursPeriodKpi.tsx +87 -0
- package/src/dashboard/widgets/MyOpenRequestsKpi.tsx +51 -0
- package/src/dashboard/widgets/MyPendingRequestsList.tsx +63 -0
- package/src/dashboard/widgets/MyProjectAllocationsKpi.tsx +57 -0
- package/src/dashboard/widgets/MyQuickActions.tsx +62 -0
- package/src/dashboard/widgets/MyRelevantDeadlines.tsx +84 -0
- package/src/dashboard/widgets/MyTimesheetStatusKpi.tsx +65 -0
- package/src/dashboard/widgets/MyWeeklyJourney.tsx +57 -0
- package/src/dashboard/widgets/PortfolioCostsKpi.tsx +48 -0
- package/src/dashboard/widgets/PortfolioEffortKpi.tsx +41 -0
- package/src/dashboard/widgets/PortfolioRiskKpi.tsx +50 -0
- package/src/dashboard/widgets/ProjectStatusOverview.tsx +52 -0
- package/src/dashboard/widgets/StrategicDeadlines.tsx +93 -0
- package/src/dashboard/widgets/TeamApprovalQueue.tsx +70 -0
- package/src/dashboard/widgets/TeamCapacityKpi.tsx +50 -0
- package/src/dashboard/widgets/TeamHoursKpi.tsx +51 -0
- package/src/dashboard/widgets/TeamPendingApprovalsKpi.tsx +53 -0
- package/src/dashboard/widgets/TeamUtilizationOverview.tsx +62 -0
- package/src/dashboard/widgets/TeamWorkloadAlerts.tsx +81 -0
- package/src/dashboard/widgets/index.ts +26 -0
- package/src/dto/create-collaborator.dto.ts +4 -11
- package/src/index.ts +3 -0
- package/src/operations.service.spec.ts +988 -764
- package/src/operations.service.ts +4277 -2535
|
@@ -1,784 +1,629 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from '
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
type TaskColumnId = 'todo' | 'doing' | 'review' | 'done';
|
|
39
|
-
|
|
40
|
-
const KANBAN_COLUMNS: Array<{ id: TaskColumnId; label: string }> = [
|
|
41
|
-
{ id: 'todo', label: 'Backlog' },
|
|
42
|
-
{ id: 'doing', label: 'Em execução' },
|
|
43
|
-
{ id: 'review', label: 'Revisão' },
|
|
44
|
-
{ id: 'done', label: 'Concluído' },
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
type TaskFormState = {
|
|
48
|
-
projectId: string;
|
|
49
|
-
name: string;
|
|
50
|
-
description: string;
|
|
51
|
-
priority: 'low' | 'medium' | 'high';
|
|
52
|
-
status: TaskColumnId;
|
|
53
|
-
dueDate: string;
|
|
54
|
-
estimateHours: string;
|
|
55
|
-
tags: string;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
</
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
{
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
...prev,
|
|
631
|
-
priority: v as TaskFormState['priority'],
|
|
632
|
-
}))
|
|
633
|
-
}
|
|
634
|
-
>
|
|
635
|
-
<SelectTrigger className="w-full">
|
|
636
|
-
<SelectValue />
|
|
637
|
-
</SelectTrigger>
|
|
638
|
-
<SelectContent>
|
|
639
|
-
<SelectItem value="low">
|
|
640
|
-
{getTaskPriorityLabel('low')}
|
|
641
|
-
</SelectItem>
|
|
642
|
-
<SelectItem value="medium">
|
|
643
|
-
{getTaskPriorityLabel('medium')}
|
|
644
|
-
</SelectItem>
|
|
645
|
-
<SelectItem value="high">
|
|
646
|
-
{getTaskPriorityLabel('high')}
|
|
647
|
-
</SelectItem>
|
|
648
|
-
</SelectContent>
|
|
649
|
-
</Select>
|
|
650
|
-
</div>
|
|
651
|
-
|
|
652
|
-
<div className="space-y-1.5">
|
|
653
|
-
<Label>{taskT('taskForm.columnLabel')}</Label>
|
|
654
|
-
<Select
|
|
655
|
-
value={formData.status}
|
|
656
|
-
onValueChange={(v) =>
|
|
657
|
-
setFormData((prev) => ({
|
|
658
|
-
...prev,
|
|
659
|
-
status: v as TaskColumnId,
|
|
660
|
-
}))
|
|
661
|
-
}
|
|
662
|
-
>
|
|
663
|
-
<SelectTrigger className="w-full">
|
|
664
|
-
<SelectValue />
|
|
665
|
-
</SelectTrigger>
|
|
666
|
-
<SelectContent>
|
|
667
|
-
{KANBAN_COLUMNS.map((col) => (
|
|
668
|
-
<SelectItem key={col.id} value={col.id}>
|
|
669
|
-
{col.label}
|
|
670
|
-
</SelectItem>
|
|
671
|
-
))}
|
|
672
|
-
</SelectContent>
|
|
673
|
-
</Select>
|
|
674
|
-
</div>
|
|
675
|
-
</div>
|
|
676
|
-
|
|
677
|
-
<div className="grid grid-cols-2 gap-3">
|
|
678
|
-
<div className="space-y-1.5">
|
|
679
|
-
<Label htmlFor="task-form-due-date">
|
|
680
|
-
{taskT('taskForm.deadlineLabel')}
|
|
681
|
-
</Label>
|
|
682
|
-
<Input
|
|
683
|
-
id="task-form-due-date"
|
|
684
|
-
type="date"
|
|
685
|
-
value={formData.dueDate}
|
|
686
|
-
onChange={(e) =>
|
|
687
|
-
setFormData((prev) => ({
|
|
688
|
-
...prev,
|
|
689
|
-
dueDate: e.target.value,
|
|
690
|
-
}))
|
|
691
|
-
}
|
|
692
|
-
/>
|
|
693
|
-
</div>
|
|
694
|
-
|
|
695
|
-
<div className="space-y-1.5">
|
|
696
|
-
<Label htmlFor="task-form-estimate">
|
|
697
|
-
{taskT('taskForm.estimateLabel')}
|
|
698
|
-
</Label>
|
|
699
|
-
<Input
|
|
700
|
-
id="task-form-estimate"
|
|
701
|
-
type="number"
|
|
702
|
-
min="0"
|
|
703
|
-
step="0.5"
|
|
704
|
-
placeholder="0"
|
|
705
|
-
value={formData.estimateHours}
|
|
706
|
-
onChange={(e) =>
|
|
707
|
-
setFormData((prev) => ({
|
|
708
|
-
...prev,
|
|
709
|
-
estimateHours: e.target.value,
|
|
710
|
-
}))
|
|
711
|
-
}
|
|
712
|
-
/>
|
|
713
|
-
</div>
|
|
714
|
-
</div>
|
|
715
|
-
|
|
716
|
-
<div className="space-y-1.5">
|
|
717
|
-
<Label htmlFor="task-form-tags">
|
|
718
|
-
{taskT('taskForm.tagsLabel')}
|
|
719
|
-
</Label>
|
|
720
|
-
<Input
|
|
721
|
-
id="task-form-tags"
|
|
722
|
-
placeholder={taskT('taskForm.tagsPlaceholder')}
|
|
723
|
-
value={formData.tags}
|
|
724
|
-
onChange={(e) =>
|
|
725
|
-
setFormData((prev) => ({ ...prev, tags: e.target.value }))
|
|
726
|
-
}
|
|
727
|
-
/>
|
|
728
|
-
</div>
|
|
729
|
-
</div>
|
|
730
|
-
|
|
731
|
-
<div className="mt-4 flex flex-wrap items-center justify-between gap-2 border-t px-4 pb-4 pt-4">
|
|
732
|
-
<div className="flex gap-2" />
|
|
733
|
-
<div className="flex gap-2">
|
|
734
|
-
<Button variant="outline" onClick={close} disabled={loading}>
|
|
735
|
-
{commonT('actions.cancel')}
|
|
736
|
-
</Button>
|
|
737
|
-
<Button
|
|
738
|
-
onClick={() => void handleSubmit()}
|
|
739
|
-
disabled={loading || isSubmitDisabled()}
|
|
740
|
-
>
|
|
741
|
-
{loading ? (
|
|
742
|
-
<Loader2 className="mr-2 size-4 animate-spin" />
|
|
743
|
-
) : null}
|
|
744
|
-
{commonT('actions.create')}
|
|
745
|
-
</Button>
|
|
746
|
-
</div>
|
|
747
|
-
</div>
|
|
748
|
-
</>
|
|
749
|
-
)}
|
|
750
|
-
</SheetContent>
|
|
751
|
-
</Sheet>
|
|
752
|
-
|
|
753
|
-
<Sheet open={projectFormOpen} onOpenChange={setProjectFormOpen}>
|
|
754
|
-
<SheetContent className="w-full overflow-x-hidden overflow-y-auto sm:max-w-[min(92vw,64rem)]">
|
|
755
|
-
<SheetHeader>
|
|
756
|
-
<SheetTitle>{projectsT('sheet.createTitle')}</SheetTitle>
|
|
757
|
-
<SheetDescription>
|
|
758
|
-
{projectsT('sheet.description')}
|
|
759
|
-
</SheetDescription>
|
|
760
|
-
</SheetHeader>
|
|
761
|
-
<ProjectFormScreen
|
|
762
|
-
onCancel={() => setProjectFormOpen(false)}
|
|
763
|
-
onSaved={(project: OperationsProjectDetails) => {
|
|
764
|
-
const newOption: OperationsProjectOption = {
|
|
765
|
-
id: project.id,
|
|
766
|
-
label: project.name,
|
|
767
|
-
name: project.name,
|
|
768
|
-
code: project.code,
|
|
769
|
-
clientName: project.clientName,
|
|
770
|
-
status: project.status,
|
|
771
|
-
};
|
|
772
|
-
setLocalProjectOptions((prev) => [newOption, ...prev]);
|
|
773
|
-
setFormData((prev) => ({
|
|
774
|
-
...prev,
|
|
775
|
-
projectId: String(project.id),
|
|
776
|
-
}));
|
|
777
|
-
setProjectFormOpen(false);
|
|
778
|
-
}}
|
|
779
|
-
/>
|
|
780
|
-
</SheetContent>
|
|
781
|
-
</Sheet>
|
|
782
|
-
</>
|
|
783
|
-
);
|
|
784
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import {
|
|
5
|
+
Sheet,
|
|
6
|
+
SheetContent,
|
|
7
|
+
SheetDescription,
|
|
8
|
+
SheetHeader,
|
|
9
|
+
SheetTitle,
|
|
10
|
+
} from '@/components/ui/sheet';
|
|
11
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
12
|
+
import { useApp, useQuery } from '@hed-hog/next-app-provider';
|
|
13
|
+
import { Archive, History, Loader2, MessageSquare, Timer } from 'lucide-react';
|
|
14
|
+
import { useTranslations } from 'next-intl';
|
|
15
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
16
|
+
import { fetchOperations, mutateOperations } from '../_lib/api';
|
|
17
|
+
import { useMentionItems } from '../_lib/hooks/use-mention-items';
|
|
18
|
+
import type {
|
|
19
|
+
OperationsProjectDetails,
|
|
20
|
+
OperationsProjectOption,
|
|
21
|
+
OperationsTaskOption,
|
|
22
|
+
PaginatedResponse,
|
|
23
|
+
} from '../_lib/types';
|
|
24
|
+
import { getElapsedDoingMinutes } from '../_lib/utils/task-ui';
|
|
25
|
+
import { ProjectFormScreen } from './project-form-screen';
|
|
26
|
+
import {
|
|
27
|
+
TaskActivitiesSection,
|
|
28
|
+
TaskCommentsSection,
|
|
29
|
+
} from './task-detail-sheet';
|
|
30
|
+
import { TimesheetEntryCreateSheet } from './timesheet-entry-create-sheet';
|
|
31
|
+
import { TaskFormFields } from './task-form-fields';
|
|
32
|
+
|
|
33
|
+
const ASIDE_WIDTH_LS_KEY = 'task-form-sheet:aside-width';
|
|
34
|
+
const DEFAULT_ASIDE_WIDTH = 288;
|
|
35
|
+
const MIN_ASIDE_WIDTH = 180;
|
|
36
|
+
const MAX_ASIDE_WIDTH = 560;
|
|
37
|
+
|
|
38
|
+
type TaskColumnId = 'todo' | 'doing' | 'review' | 'done';
|
|
39
|
+
|
|
40
|
+
const KANBAN_COLUMNS: Array<{ id: TaskColumnId; label: string }> = [
|
|
41
|
+
{ id: 'todo', label: 'Backlog' },
|
|
42
|
+
{ id: 'doing', label: 'Em execução' },
|
|
43
|
+
{ id: 'review', label: 'Revisão' },
|
|
44
|
+
{ id: 'done', label: 'Concluído' },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
type TaskFormState = {
|
|
48
|
+
projectId: string;
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
priority: 'low' | 'medium' | 'high';
|
|
52
|
+
status: TaskColumnId;
|
|
53
|
+
dueDate: string;
|
|
54
|
+
estimateHours: string;
|
|
55
|
+
tags: string;
|
|
56
|
+
assigneeCollaboratorId: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const EMPTY_TASK_FORM: TaskFormState = {
|
|
60
|
+
projectId: '',
|
|
61
|
+
name: '',
|
|
62
|
+
description: '',
|
|
63
|
+
priority: 'medium',
|
|
64
|
+
status: 'todo',
|
|
65
|
+
dueDate: '',
|
|
66
|
+
estimateHours: '',
|
|
67
|
+
tags: '',
|
|
68
|
+
assigneeCollaboratorId: '',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
function normalizeDateValue(value?: string | null) {
|
|
72
|
+
if (!value) return '';
|
|
73
|
+
const match = String(value)
|
|
74
|
+
.trim()
|
|
75
|
+
.match(/^\d{4}-\d{2}-\d{2}/);
|
|
76
|
+
return match?.[0] ?? '';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type TaskFormSheetProps = {
|
|
80
|
+
open: boolean;
|
|
81
|
+
onOpenChange: (open: boolean) => void;
|
|
82
|
+
request: Parameters<typeof mutateOperations>[0];
|
|
83
|
+
/** When provided, the form enters edit mode. */
|
|
84
|
+
editingTask?: OperationsTaskOption | null;
|
|
85
|
+
/** Pre-assigns this collaborator on new task creation. */
|
|
86
|
+
defaultAssigneeCollaboratorId?: number | null;
|
|
87
|
+
/** When true the project field is required for creation. Default: false. */
|
|
88
|
+
projectRequired?: boolean;
|
|
89
|
+
/** When false the project selector is hidden (e.g. when the project is already known from context). Default: true. */
|
|
90
|
+
showProject?: boolean;
|
|
91
|
+
/** Default active tab when opening in edit mode. Default: 'comments'. */
|
|
92
|
+
defaultTab?: 'comments' | 'activities';
|
|
93
|
+
/** When false the assignee field is hidden entirely. Default: true. */
|
|
94
|
+
showAssignee?: boolean;
|
|
95
|
+
/** When provided, renders a static Select for assignee instead of the CollaboratorPicker API widget. */
|
|
96
|
+
assigneeOptions?: Array<{ id: string; label: string }>;
|
|
97
|
+
/** When provided, called instead of the internal PATCH archive. The sheet still closes and calls onSaved after. */
|
|
98
|
+
onArchive?: (taskId: number) => Promise<void> | void;
|
|
99
|
+
/** When provided, called on "Log hours" click instead of opening the internal timesheet sheet. */
|
|
100
|
+
onLogHours?: () => void;
|
|
101
|
+
/** Pre-populate projectId on create (useful when showProject=false but project is known from context). */
|
|
102
|
+
defaultProjectId?: number;
|
|
103
|
+
/** Pre-populate status on create. Default: 'todo'. */
|
|
104
|
+
defaultStatus?: string;
|
|
105
|
+
/** Called when a file or comment is added/removed, so parent can refresh card counts. */
|
|
106
|
+
onCountChanged?: () => void;
|
|
107
|
+
onSaved: () => void;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export function TaskFormSheet({
|
|
111
|
+
open,
|
|
112
|
+
onOpenChange,
|
|
113
|
+
request,
|
|
114
|
+
editingTask,
|
|
115
|
+
defaultAssigneeCollaboratorId,
|
|
116
|
+
projectRequired = false,
|
|
117
|
+
showProject = true,
|
|
118
|
+
defaultTab = 'comments',
|
|
119
|
+
showAssignee = true,
|
|
120
|
+
assigneeOptions,
|
|
121
|
+
onArchive,
|
|
122
|
+
onLogHours,
|
|
123
|
+
defaultProjectId,
|
|
124
|
+
defaultStatus,
|
|
125
|
+
onCountChanged,
|
|
126
|
+
onSaved,
|
|
127
|
+
}: TaskFormSheetProps) {
|
|
128
|
+
const { currentLocaleCode, request: appRequest } = useApp();
|
|
129
|
+
const commonT = useTranslations('operations.Common');
|
|
130
|
+
const taskT = useTranslations('operations.ProjectDetailsPage');
|
|
131
|
+
const projectsT = useTranslations('operations.ProjectsPage');
|
|
132
|
+
|
|
133
|
+
const mentionItems = useMentionItems(appRequest);
|
|
134
|
+
|
|
135
|
+
const [formData, setFormData] = useState<TaskFormState>(EMPTY_TASK_FORM);
|
|
136
|
+
const [loading, setLoading] = useState(false);
|
|
137
|
+
const [archivingId, setArchivingId] = useState<number | null>(null);
|
|
138
|
+
const [projectFormOpen, setProjectFormOpen] = useState(false);
|
|
139
|
+
const [activeTab, setActiveTab] = useState<'comments' | 'activities'>(
|
|
140
|
+
defaultTab
|
|
141
|
+
);
|
|
142
|
+
const [doingTick, setDoingTick] = useState(0);
|
|
143
|
+
const [isTimesheetOpen, setIsTimesheetOpen] = useState(false);
|
|
144
|
+
const [asideWidth, setAsideWidth] = useState(DEFAULT_ASIDE_WIDTH);
|
|
145
|
+
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
const stored = localStorage.getItem(ASIDE_WIDTH_LS_KEY);
|
|
148
|
+
if (stored) {
|
|
149
|
+
const v = Number(stored);
|
|
150
|
+
if (!isNaN(v) && v >= MIN_ASIDE_WIDTH && v <= MAX_ASIDE_WIDTH)
|
|
151
|
+
setAsideWidth(v);
|
|
152
|
+
}
|
|
153
|
+
}, []);
|
|
154
|
+
|
|
155
|
+
const handleResizeMouseDown = useCallback(
|
|
156
|
+
(e: React.MouseEvent) => {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
const startX = e.clientX;
|
|
159
|
+
let width = asideWidth;
|
|
160
|
+
|
|
161
|
+
document.body.style.cursor = 'col-resize';
|
|
162
|
+
document.body.style.userSelect = 'none';
|
|
163
|
+
|
|
164
|
+
const onMouseMove = (ev: MouseEvent) => {
|
|
165
|
+
width = Math.min(
|
|
166
|
+
MAX_ASIDE_WIDTH,
|
|
167
|
+
Math.max(MIN_ASIDE_WIDTH, asideWidth + (startX - ev.clientX))
|
|
168
|
+
);
|
|
169
|
+
setAsideWidth(width);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const onMouseUp = () => {
|
|
173
|
+
document.body.style.cursor = '';
|
|
174
|
+
document.body.style.userSelect = '';
|
|
175
|
+
localStorage.setItem(ASIDE_WIDTH_LS_KEY, String(width));
|
|
176
|
+
document.removeEventListener('mousemove', onMouseMove);
|
|
177
|
+
document.removeEventListener('mouseup', onMouseUp);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
document.addEventListener('mousemove', onMouseMove);
|
|
181
|
+
document.addEventListener('mouseup', onMouseUp);
|
|
182
|
+
},
|
|
183
|
+
[asideWidth]
|
|
184
|
+
);
|
|
185
|
+
const [localProjectOptions, setLocalProjectOptions] = useState<
|
|
186
|
+
OperationsProjectOption[]
|
|
187
|
+
>([]);
|
|
188
|
+
|
|
189
|
+
const { data: projectOptionsResponse } = useQuery<
|
|
190
|
+
PaginatedResponse<OperationsProjectOption>
|
|
191
|
+
>({
|
|
192
|
+
queryKey: ['task-form-project-options', currentLocaleCode],
|
|
193
|
+
queryFn: () =>
|
|
194
|
+
fetchOperations<PaginatedResponse<OperationsProjectOption>>(
|
|
195
|
+
request,
|
|
196
|
+
'/operations/projects/options?pageSize=200&sortField=name&sortOrder=asc'
|
|
197
|
+
),
|
|
198
|
+
enabled: open,
|
|
199
|
+
placeholderData: (previous) => previous,
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const remoteProjectOptions = projectOptionsResponse?.data ?? [];
|
|
203
|
+
const projectOptions = [
|
|
204
|
+
...localProjectOptions,
|
|
205
|
+
...remoteProjectOptions.filter(
|
|
206
|
+
(r) => !localProjectOptions.some((l) => l.id === r.id)
|
|
207
|
+
),
|
|
208
|
+
];
|
|
209
|
+
const projectOptionsWithFallback =
|
|
210
|
+
editingTask?.projectId &&
|
|
211
|
+
!projectOptions.some((p) => String(p.id) === String(editingTask.projectId))
|
|
212
|
+
? [
|
|
213
|
+
{
|
|
214
|
+
id: editingTask.projectId,
|
|
215
|
+
label:
|
|
216
|
+
[editingTask.projectCode, editingTask.projectName]
|
|
217
|
+
.filter(Boolean)
|
|
218
|
+
.join(' • ') || String(editingTask.projectId),
|
|
219
|
+
name: editingTask.projectName ?? String(editingTask.projectId),
|
|
220
|
+
code: editingTask.projectCode,
|
|
221
|
+
status: editingTask.status,
|
|
222
|
+
},
|
|
223
|
+
...projectOptions,
|
|
224
|
+
]
|
|
225
|
+
: projectOptions;
|
|
226
|
+
|
|
227
|
+
// Sync form state when editingTask or open changes.
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
if (!open) return;
|
|
230
|
+
setActiveTab(defaultTab);
|
|
231
|
+
if (editingTask) {
|
|
232
|
+
setFormData({
|
|
233
|
+
projectId: String(editingTask.projectId ?? ''),
|
|
234
|
+
name: editingTask.name,
|
|
235
|
+
description: editingTask.description ?? '',
|
|
236
|
+
priority:
|
|
237
|
+
(editingTask.priority as TaskFormState['priority']) ?? 'medium',
|
|
238
|
+
status: KANBAN_COLUMNS.some((c) => c.id === editingTask.status)
|
|
239
|
+
? (editingTask.status as TaskColumnId)
|
|
240
|
+
: 'todo',
|
|
241
|
+
dueDate: normalizeDateValue(editingTask.dueDate),
|
|
242
|
+
estimateHours:
|
|
243
|
+
editingTask.estimateHours != null
|
|
244
|
+
? String(editingTask.estimateHours)
|
|
245
|
+
: '',
|
|
246
|
+
tags: editingTask.tags ?? '',
|
|
247
|
+
assigneeCollaboratorId:
|
|
248
|
+
editingTask.assigneeCollaboratorId != null
|
|
249
|
+
? String(editingTask.assigneeCollaboratorId)
|
|
250
|
+
: '',
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
setFormData({
|
|
254
|
+
...EMPTY_TASK_FORM,
|
|
255
|
+
status: (defaultStatus as TaskFormState['status']) ?? 'todo',
|
|
256
|
+
projectId: defaultProjectId ? String(defaultProjectId) : '',
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}, [open, editingTask, defaultTab, defaultStatus, defaultProjectId]);
|
|
260
|
+
|
|
261
|
+
useEffect(() => {
|
|
262
|
+
if (!open || editingTask?.status !== 'doing' || !editingTask.doingStartedAt)
|
|
263
|
+
return;
|
|
264
|
+
const timer = setInterval(() => setDoingTick((value) => value + 1), 30000);
|
|
265
|
+
return () => clearInterval(timer);
|
|
266
|
+
}, [editingTask?.doingStartedAt, editingTask?.status, open]);
|
|
267
|
+
|
|
268
|
+
const close = () => {
|
|
269
|
+
onOpenChange(false);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const isSubmitDisabled = () => {
|
|
273
|
+
if (!formData.name.trim()) return true;
|
|
274
|
+
if (!editingTask && projectRequired && !formData.projectId) return true;
|
|
275
|
+
return false;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const handleSubmit = async () => {
|
|
279
|
+
if (isSubmitDisabled()) return;
|
|
280
|
+
setLoading(true);
|
|
281
|
+
try {
|
|
282
|
+
const selectedProject = projectOptions.find(
|
|
283
|
+
(p) => String(p.id) === formData.projectId
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
const payload: Record<string, unknown> = {
|
|
287
|
+
name: formData.name.trim(),
|
|
288
|
+
description: formData.description.trim() || null,
|
|
289
|
+
priority: formData.priority,
|
|
290
|
+
status: formData.status,
|
|
291
|
+
dueDate: formData.dueDate || null,
|
|
292
|
+
estimateHours: formData.estimateHours
|
|
293
|
+
? Number(formData.estimateHours)
|
|
294
|
+
: null,
|
|
295
|
+
tags: formData.tags.trim() || null,
|
|
296
|
+
assigneeCollaboratorId: formData.assigneeCollaboratorId
|
|
297
|
+
? Number(formData.assigneeCollaboratorId)
|
|
298
|
+
: null,
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
if (editingTask) {
|
|
302
|
+
await mutateOperations(
|
|
303
|
+
request,
|
|
304
|
+
`/operations/tasks/${editingTask.id}`,
|
|
305
|
+
'PATCH',
|
|
306
|
+
payload
|
|
307
|
+
);
|
|
308
|
+
} else {
|
|
309
|
+
if (selectedProject) {
|
|
310
|
+
payload.projectId = selectedProject.id;
|
|
311
|
+
if (selectedProject.projectAssignmentId != null) {
|
|
312
|
+
payload.projectAssignmentId = selectedProject.projectAssignmentId;
|
|
313
|
+
}
|
|
314
|
+
} else if (formData.projectId) {
|
|
315
|
+
payload.projectId = Number(formData.projectId);
|
|
316
|
+
}
|
|
317
|
+
// Form selection takes priority over the default prop
|
|
318
|
+
if (
|
|
319
|
+
!payload.assigneeCollaboratorId &&
|
|
320
|
+
defaultAssigneeCollaboratorId != null
|
|
321
|
+
) {
|
|
322
|
+
payload.assigneeCollaboratorId = defaultAssigneeCollaboratorId;
|
|
323
|
+
}
|
|
324
|
+
await mutateOperations(request, '/operations/tasks', 'POST', payload);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
onSaved();
|
|
328
|
+
close();
|
|
329
|
+
} finally {
|
|
330
|
+
setLoading(false);
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const handleTagsChange = useCallback(
|
|
335
|
+
async (tags: string) => {
|
|
336
|
+
if (!editingTask) return;
|
|
337
|
+
try {
|
|
338
|
+
await mutateOperations(request, `/operations/tasks/${editingTask.id}`, 'PATCH', {
|
|
339
|
+
tags: tags || null,
|
|
340
|
+
});
|
|
341
|
+
} catch {
|
|
342
|
+
// auto-save failure is silent; the value stays in form state
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
[editingTask, request]
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
const handleArchive = async () => {
|
|
349
|
+
if (!editingTask) return;
|
|
350
|
+
setArchivingId(editingTask.id);
|
|
351
|
+
try {
|
|
352
|
+
if (onArchive) {
|
|
353
|
+
await onArchive(editingTask.id);
|
|
354
|
+
} else {
|
|
355
|
+
await mutateOperations(
|
|
356
|
+
request,
|
|
357
|
+
`/operations/tasks/${editingTask.id}`,
|
|
358
|
+
'PATCH',
|
|
359
|
+
{ archived: true }
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
onSaved();
|
|
363
|
+
close();
|
|
364
|
+
} finally {
|
|
365
|
+
setArchivingId(null);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
const timesheetProject =
|
|
370
|
+
editingTask?.projectId
|
|
371
|
+
? {
|
|
372
|
+
id: editingTask.projectId,
|
|
373
|
+
label:
|
|
374
|
+
[editingTask.projectName, editingTask.projectCode]
|
|
375
|
+
.filter(Boolean)
|
|
376
|
+
.join(' • ') || String(editingTask.projectId),
|
|
377
|
+
projectAssignmentId: editingTask.projectAssignmentId,
|
|
378
|
+
}
|
|
379
|
+
: null;
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<>
|
|
383
|
+
<Sheet
|
|
384
|
+
open={open}
|
|
385
|
+
onOpenChange={(value) => {
|
|
386
|
+
if (!loading) onOpenChange(value);
|
|
387
|
+
}}
|
|
388
|
+
>
|
|
389
|
+
<SheetContent className="flex w-full flex-col gap-0 overflow-hidden sm:max-w-5xl">
|
|
390
|
+
<SheetHeader className="shrink-0 border-b px-5 pb-3 pt-4">
|
|
391
|
+
<SheetTitle>
|
|
392
|
+
{editingTask
|
|
393
|
+
? taskT('taskForm.titleEdit')
|
|
394
|
+
: taskT('taskForm.titleNew')}
|
|
395
|
+
</SheetTitle>
|
|
396
|
+
<SheetDescription className="sr-only">
|
|
397
|
+
{editingTask
|
|
398
|
+
? taskT('taskForm.titleEdit')
|
|
399
|
+
: taskT('taskForm.titleNew')}
|
|
400
|
+
</SheetDescription>
|
|
401
|
+
</SheetHeader>
|
|
402
|
+
|
|
403
|
+
{editingTask ? (
|
|
404
|
+
<>
|
|
405
|
+
<div className="flex flex-1 min-h-0 overflow-hidden">
|
|
406
|
+
{/* ── Coluna esquerda ── */}
|
|
407
|
+
<div className="flex flex-1 flex-col min-h-0 overflow-hidden">
|
|
408
|
+
<div className="shrink-0 space-y-4 overflow-y-auto border-b px-5 py-4">
|
|
409
|
+
<TaskFormFields
|
|
410
|
+
formData={formData}
|
|
411
|
+
setFormData={setFormData}
|
|
412
|
+
statusOptions={KANBAN_COLUMNS}
|
|
413
|
+
mentionItems={mentionItems}
|
|
414
|
+
projectOptions={projectOptionsWithFallback}
|
|
415
|
+
showProject={showProject}
|
|
416
|
+
projectRequired={projectRequired}
|
|
417
|
+
onOpenCreateProject={() => setProjectFormOpen(true)}
|
|
418
|
+
section="main"
|
|
419
|
+
/>
|
|
420
|
+
</div>
|
|
421
|
+
|
|
422
|
+
<Tabs
|
|
423
|
+
value={activeTab}
|
|
424
|
+
onValueChange={(v) =>
|
|
425
|
+
setActiveTab(v as 'comments' | 'activities')
|
|
426
|
+
}
|
|
427
|
+
className="flex flex-1 min-h-0 flex-col"
|
|
428
|
+
>
|
|
429
|
+
<div className="shrink-0 border-b px-5 py-2">
|
|
430
|
+
<TabsList className="grid grid-cols-2">
|
|
431
|
+
<TabsTrigger value="comments">
|
|
432
|
+
<MessageSquare className="mr-1.5 size-3.5" />
|
|
433
|
+
{taskT('taskForm.tabComments')}
|
|
434
|
+
</TabsTrigger>
|
|
435
|
+
<TabsTrigger value="activities">
|
|
436
|
+
<History className="mr-1.5 size-3.5" />
|
|
437
|
+
{taskT('taskForm.tabActivities')}
|
|
438
|
+
</TabsTrigger>
|
|
439
|
+
</TabsList>
|
|
440
|
+
</div>
|
|
441
|
+
<TabsContent
|
|
442
|
+
value="comments"
|
|
443
|
+
className="mt-0 flex-1 overflow-y-auto px-5 py-4 data-[state=inactive]:hidden"
|
|
444
|
+
>
|
|
445
|
+
<TaskCommentsSection taskId={editingTask.id} onChanged={onCountChanged} />
|
|
446
|
+
</TabsContent>
|
|
447
|
+
<TabsContent
|
|
448
|
+
value="activities"
|
|
449
|
+
className="mt-0 flex-1 overflow-y-auto px-5 py-4 data-[state=inactive]:hidden"
|
|
450
|
+
>
|
|
451
|
+
<TaskActivitiesSection
|
|
452
|
+
taskId={editingTask.id}
|
|
453
|
+
task={editingTask}
|
|
454
|
+
statusLabel={(status) =>
|
|
455
|
+
KANBAN_COLUMNS.find((column) => column.id === status)
|
|
456
|
+
?.label ?? status
|
|
457
|
+
}
|
|
458
|
+
/>
|
|
459
|
+
</TabsContent>
|
|
460
|
+
</Tabs>
|
|
461
|
+
</div>
|
|
462
|
+
|
|
463
|
+
{/* ── Resize handle ── */}
|
|
464
|
+
<div
|
|
465
|
+
className="group relative w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/40"
|
|
466
|
+
onMouseDown={handleResizeMouseDown}
|
|
467
|
+
>
|
|
468
|
+
<div className="absolute inset-y-0 -left-1.5 -right-1.5" />
|
|
469
|
+
<div className="absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col gap-0.75 opacity-0 transition-opacity group-hover:opacity-100">
|
|
470
|
+
<div className="size-0.75 rounded-full bg-primary/60" />
|
|
471
|
+
<div className="size-0.75 rounded-full bg-primary/60" />
|
|
472
|
+
<div className="size-0.75 rounded-full bg-primary/60" />
|
|
473
|
+
<div className="size-0.75 rounded-full bg-primary/60" />
|
|
474
|
+
<div className="size-0.75 rounded-full bg-primary/60" />
|
|
475
|
+
</div>
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
{/* ── Aside direito ── */}
|
|
479
|
+
<aside
|
|
480
|
+
className="flex shrink-0 flex-col gap-4 overflow-y-auto px-4 py-4"
|
|
481
|
+
style={{ width: asideWidth }}
|
|
482
|
+
>
|
|
483
|
+
<TaskFormFields
|
|
484
|
+
formData={formData}
|
|
485
|
+
setFormData={setFormData}
|
|
486
|
+
statusOptions={KANBAN_COLUMNS}
|
|
487
|
+
mentionItems={mentionItems}
|
|
488
|
+
projectOptions={projectOptionsWithFallback}
|
|
489
|
+
showDoingTime
|
|
490
|
+
doingMinutes={getElapsedDoingMinutes(editingTask, doingTick)}
|
|
491
|
+
showAttachments
|
|
492
|
+
attachmentTaskId={editingTask.id}
|
|
493
|
+
section="aside"
|
|
494
|
+
showAssignee={showAssignee}
|
|
495
|
+
assigneeOptions={assigneeOptions}
|
|
496
|
+
onTagsChange={(tags) => void handleTagsChange(tags)}
|
|
497
|
+
onFileChanged={onCountChanged}
|
|
498
|
+
/>
|
|
499
|
+
</aside>
|
|
500
|
+
</div>
|
|
501
|
+
|
|
502
|
+
<div className="flex flex-wrap items-center justify-between gap-2 border-t px-5 py-3">
|
|
503
|
+
<div className="flex gap-2">
|
|
504
|
+
<Button
|
|
505
|
+
type="button"
|
|
506
|
+
variant="outline"
|
|
507
|
+
disabled={loading || archivingId === editingTask.id}
|
|
508
|
+
onClick={() => void handleArchive()}
|
|
509
|
+
>
|
|
510
|
+
{archivingId === editingTask.id ? (
|
|
511
|
+
<Loader2 className="mr-2 size-4 animate-spin" />
|
|
512
|
+
) : (
|
|
513
|
+
<Archive className="mr-2 size-4" />
|
|
514
|
+
)}
|
|
515
|
+
{commonT('actions.archive')}
|
|
516
|
+
</Button>
|
|
517
|
+
{timesheetProject ? (
|
|
518
|
+
<Button
|
|
519
|
+
type="button"
|
|
520
|
+
variant="outline"
|
|
521
|
+
disabled={loading}
|
|
522
|
+
onClick={() =>
|
|
523
|
+
onLogHours ? onLogHours() : setIsTimesheetOpen(true)
|
|
524
|
+
}
|
|
525
|
+
>
|
|
526
|
+
<Timer className="mr-2 size-4" />
|
|
527
|
+
{commonT('actions.logHours')}
|
|
528
|
+
</Button>
|
|
529
|
+
) : null}
|
|
530
|
+
</div>
|
|
531
|
+
<div className="flex gap-2">
|
|
532
|
+
<Button variant="outline" onClick={close} disabled={loading}>
|
|
533
|
+
{commonT('actions.cancel')}
|
|
534
|
+
</Button>
|
|
535
|
+
<Button
|
|
536
|
+
onClick={() => void handleSubmit()}
|
|
537
|
+
disabled={loading || isSubmitDisabled()}
|
|
538
|
+
>
|
|
539
|
+
{loading ? (
|
|
540
|
+
<Loader2 className="mr-2 size-4 animate-spin" />
|
|
541
|
+
) : null}
|
|
542
|
+
{commonT('actions.save')}
|
|
543
|
+
</Button>
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
</>
|
|
547
|
+
) : (
|
|
548
|
+
<>
|
|
549
|
+
<div className="flex-1 space-y-4 overflow-y-auto px-4 py-2">
|
|
550
|
+
<TaskFormFields
|
|
551
|
+
formData={formData}
|
|
552
|
+
setFormData={setFormData}
|
|
553
|
+
statusOptions={KANBAN_COLUMNS}
|
|
554
|
+
mentionItems={mentionItems}
|
|
555
|
+
projectOptions={projectOptions}
|
|
556
|
+
showProject={showProject}
|
|
557
|
+
projectRequired={projectRequired}
|
|
558
|
+
allowUnassignedProject={!projectRequired}
|
|
559
|
+
onOpenCreateProject={() => setProjectFormOpen(true)}
|
|
560
|
+
showAssignee={showAssignee}
|
|
561
|
+
assigneeOptions={assigneeOptions}
|
|
562
|
+
/>
|
|
563
|
+
</div>
|
|
564
|
+
|
|
565
|
+
<div className="mt-4 flex flex-wrap items-center justify-between gap-2 border-t px-4 pb-4 pt-4">
|
|
566
|
+
<div className="flex gap-2" />
|
|
567
|
+
<div className="flex gap-2">
|
|
568
|
+
<Button variant="outline" onClick={close} disabled={loading}>
|
|
569
|
+
{commonT('actions.cancel')}
|
|
570
|
+
</Button>
|
|
571
|
+
<Button
|
|
572
|
+
onClick={() => void handleSubmit()}
|
|
573
|
+
disabled={loading || isSubmitDisabled()}
|
|
574
|
+
>
|
|
575
|
+
{loading ? (
|
|
576
|
+
<Loader2 className="mr-2 size-4 animate-spin" />
|
|
577
|
+
) : null}
|
|
578
|
+
{commonT('actions.create')}
|
|
579
|
+
</Button>
|
|
580
|
+
</div>
|
|
581
|
+
</div>
|
|
582
|
+
</>
|
|
583
|
+
)}
|
|
584
|
+
</SheetContent>
|
|
585
|
+
</Sheet>
|
|
586
|
+
|
|
587
|
+
<Sheet open={projectFormOpen} onOpenChange={setProjectFormOpen}>
|
|
588
|
+
<SheetContent className="w-full overflow-x-hidden overflow-y-auto sm:max-w-[min(92vw,64rem)]">
|
|
589
|
+
<SheetHeader>
|
|
590
|
+
<SheetTitle>{projectsT('sheet.createTitle')}</SheetTitle>
|
|
591
|
+
<SheetDescription>
|
|
592
|
+
{projectsT('sheet.description')}
|
|
593
|
+
</SheetDescription>
|
|
594
|
+
</SheetHeader>
|
|
595
|
+
<ProjectFormScreen
|
|
596
|
+
onCancel={() => setProjectFormOpen(false)}
|
|
597
|
+
onSaved={(project: OperationsProjectDetails) => {
|
|
598
|
+
const newOption: OperationsProjectOption = {
|
|
599
|
+
id: project.id,
|
|
600
|
+
label: project.name,
|
|
601
|
+
name: project.name,
|
|
602
|
+
code: project.code,
|
|
603
|
+
clientName: project.clientName,
|
|
604
|
+
status: project.status,
|
|
605
|
+
};
|
|
606
|
+
setLocalProjectOptions((prev) => [newOption, ...prev]);
|
|
607
|
+
setFormData((prev) => ({
|
|
608
|
+
...prev,
|
|
609
|
+
projectId: String(project.id),
|
|
610
|
+
}));
|
|
611
|
+
setProjectFormOpen(false);
|
|
612
|
+
}}
|
|
613
|
+
/>
|
|
614
|
+
</SheetContent>
|
|
615
|
+
</Sheet>
|
|
616
|
+
|
|
617
|
+
{!onLogHours ? (
|
|
618
|
+
<TimesheetEntryCreateSheet
|
|
619
|
+
open={isTimesheetOpen}
|
|
620
|
+
onOpenChange={setIsTimesheetOpen}
|
|
621
|
+
project={timesheetProject}
|
|
622
|
+
task={
|
|
623
|
+
editingTask ? { id: editingTask.id, label: editingTask.name } : null
|
|
624
|
+
}
|
|
625
|
+
/>
|
|
626
|
+
) : null}
|
|
627
|
+
</>
|
|
628
|
+
);
|
|
629
|
+
}
|