@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
|
@@ -69,14 +69,14 @@ import {
|
|
|
69
69
|
import { useTranslations } from 'next-intl';
|
|
70
70
|
import Link from 'next/link';
|
|
71
71
|
import { useRouter } from 'next/navigation';
|
|
72
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
72
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
73
73
|
import {
|
|
74
74
|
CartesianGrid,
|
|
75
75
|
Legend,
|
|
76
76
|
Line,
|
|
77
77
|
LineChart,
|
|
78
|
-
ResponsiveContainer,
|
|
79
78
|
Tooltip as RechartsTooltip,
|
|
79
|
+
ResponsiveContainer,
|
|
80
80
|
XAxis,
|
|
81
81
|
YAxis,
|
|
82
82
|
} from 'recharts';
|
|
@@ -117,10 +117,6 @@ import { DepartmentPicker } from './department-picker';
|
|
|
117
117
|
import { OperationsHeader } from './operations-header';
|
|
118
118
|
import { ProjectAssignmentsTab } from './project-assignments-tab';
|
|
119
119
|
import { StatusBadge } from './status-badge';
|
|
120
|
-
import {
|
|
121
|
-
SystemUserPicker,
|
|
122
|
-
type SystemUserPickerOption as SystemUserOption,
|
|
123
|
-
} from './system-user-picker';
|
|
124
120
|
|
|
125
121
|
const weekdays = [
|
|
126
122
|
'monday',
|
|
@@ -251,7 +247,6 @@ const EQUITY_ENABLED_TYPE_SLUGS = new Set([
|
|
|
251
247
|
const HOURLY_RATE_SLUGS = new Set(['pj', 'freelancer']);
|
|
252
248
|
|
|
253
249
|
type CollaboratorFormState = {
|
|
254
|
-
userId: string;
|
|
255
250
|
personId: string;
|
|
256
251
|
displayName: string;
|
|
257
252
|
collaboratorTypeId: string;
|
|
@@ -299,7 +294,6 @@ function defaultSchedule(): CollaboratorFormState['weeklySchedule'] {
|
|
|
299
294
|
|
|
300
295
|
function buildEmptyForm(): CollaboratorFormState {
|
|
301
296
|
return {
|
|
302
|
-
userId: '',
|
|
303
297
|
personId: '',
|
|
304
298
|
displayName: '',
|
|
305
299
|
collaboratorTypeId: '',
|
|
@@ -358,7 +352,6 @@ function toFormState(
|
|
|
358
352
|
collaborator: OperationsCollaboratorDetails
|
|
359
353
|
): CollaboratorFormState {
|
|
360
354
|
return {
|
|
361
|
-
userId: collaborator.userId ? String(collaborator.userId) : '',
|
|
362
355
|
personId: collaborator.personId ? String(collaborator.personId) : '',
|
|
363
356
|
displayName: collaborator.displayName ?? '',
|
|
364
357
|
collaboratorTypeId: collaborator.collaboratorTypeId
|
|
@@ -637,38 +630,6 @@ export function CollaboratorFormScreen({
|
|
|
637
630
|
),
|
|
638
631
|
});
|
|
639
632
|
|
|
640
|
-
const { data: systemUsers = [], refetch: refetchSystemUsers } = useQuery<
|
|
641
|
-
SystemUserOption[]
|
|
642
|
-
>({
|
|
643
|
-
queryKey: ['operations-collaborator-form-system-users', currentLocaleCode],
|
|
644
|
-
enabled: access.isDirector,
|
|
645
|
-
staleTime: 0,
|
|
646
|
-
refetchOnMount: 'always',
|
|
647
|
-
queryFn: async () => {
|
|
648
|
-
const response = await request<{
|
|
649
|
-
paginate: {
|
|
650
|
-
data: Array<{
|
|
651
|
-
id: number;
|
|
652
|
-
name: string | null;
|
|
653
|
-
photo_id?: number | null;
|
|
654
|
-
}>;
|
|
655
|
-
};
|
|
656
|
-
}>({
|
|
657
|
-
url: '/user?pageSize=100',
|
|
658
|
-
method: 'GET',
|
|
659
|
-
});
|
|
660
|
-
|
|
661
|
-
const raw = response.data?.paginate?.data ?? [];
|
|
662
|
-
const options: SystemUserOption[] = raw.map((u) => ({
|
|
663
|
-
id: u.id,
|
|
664
|
-
name: u.name || `#${u.id}`,
|
|
665
|
-
photoId: u.photo_id ?? null,
|
|
666
|
-
}));
|
|
667
|
-
|
|
668
|
-
return options.sort((left, right) => left.name.localeCompare(right.name));
|
|
669
|
-
},
|
|
670
|
-
});
|
|
671
|
-
|
|
672
633
|
const {
|
|
673
634
|
data: collaboratorTypes = [],
|
|
674
635
|
refetch: refetchCollaboratorTypes,
|
|
@@ -726,6 +687,7 @@ export function CollaboratorFormScreen({
|
|
|
726
687
|
|
|
727
688
|
const [personSheetOpen, setPersonSheetOpen] = useState(false);
|
|
728
689
|
const [personToEdit, setPersonToEdit] = useState<Person | null>(null);
|
|
690
|
+
const personSheetModeRef = useRef<'edit' | 'create'>('edit');
|
|
729
691
|
|
|
730
692
|
const { data: contactTypes = [] } = useQuery<ContactTypeOption[]>({
|
|
731
693
|
queryKey: ['contact-person-contact-types', currentLocaleCode],
|
|
@@ -781,13 +743,22 @@ export function CollaboratorFormScreen({
|
|
|
781
743
|
placeholderData: (previous) => previous ?? [],
|
|
782
744
|
});
|
|
783
745
|
|
|
784
|
-
const handleOpenPersonSheet = async () => {
|
|
785
|
-
|
|
746
|
+
const handleOpenPersonSheet = async (personId?: number | null) => {
|
|
747
|
+
const targetPersonId =
|
|
748
|
+
personId && personId > 0
|
|
749
|
+
? personId
|
|
750
|
+
: (parseNumberInput(form.personId) ?? collaborator?.personId ?? null);
|
|
751
|
+
|
|
752
|
+
if (!targetPersonId) {
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
|
|
786
756
|
try {
|
|
787
757
|
const response = await request<Person>({
|
|
788
|
-
url: `/person/${
|
|
758
|
+
url: `/person/${targetPersonId}`,
|
|
789
759
|
method: 'GET',
|
|
790
760
|
});
|
|
761
|
+
personSheetModeRef.current = 'edit';
|
|
791
762
|
setPersonToEdit(response.data);
|
|
792
763
|
setPersonSheetOpen(true);
|
|
793
764
|
} catch {
|
|
@@ -795,6 +766,12 @@ export function CollaboratorFormScreen({
|
|
|
795
766
|
}
|
|
796
767
|
};
|
|
797
768
|
|
|
769
|
+
const handleOpenPersonCreateSheet = () => {
|
|
770
|
+
personSheetModeRef.current = 'create';
|
|
771
|
+
setPersonToEdit(null);
|
|
772
|
+
setPersonSheetOpen(true);
|
|
773
|
+
};
|
|
774
|
+
|
|
798
775
|
useEffect(() => {
|
|
799
776
|
if (collaborator) {
|
|
800
777
|
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
@@ -1016,37 +993,6 @@ export function CollaboratorFormScreen({
|
|
|
1016
993
|
}
|
|
1017
994
|
};
|
|
1018
995
|
|
|
1019
|
-
const createSystemUser = async (
|
|
1020
|
-
name: string,
|
|
1021
|
-
email: string,
|
|
1022
|
-
password: string
|
|
1023
|
-
): Promise<SystemUserOption | null> => {
|
|
1024
|
-
try {
|
|
1025
|
-
const response = await request<{
|
|
1026
|
-
user: { id: number; name: string | null; photo_id?: number | null };
|
|
1027
|
-
challenge: unknown;
|
|
1028
|
-
}>({
|
|
1029
|
-
url: '/user',
|
|
1030
|
-
method: 'POST',
|
|
1031
|
-
data: { name, email, password },
|
|
1032
|
-
});
|
|
1033
|
-
await refetchSystemUsers();
|
|
1034
|
-
showToastHandler?.('success', t('messages.createUserSuccess'));
|
|
1035
|
-
const user = response.data.user;
|
|
1036
|
-
return {
|
|
1037
|
-
id: user.id,
|
|
1038
|
-
name: user.name || `#${user.id}`,
|
|
1039
|
-
photoId: user.photo_id ?? null,
|
|
1040
|
-
};
|
|
1041
|
-
} catch (error) {
|
|
1042
|
-
showToastHandler?.(
|
|
1043
|
-
'error',
|
|
1044
|
-
getOperationsErrorMessage(error, t('messages.createUserError'))
|
|
1045
|
-
);
|
|
1046
|
-
return null;
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
996
|
const updateScheduleDay = (
|
|
1051
997
|
weekday: string,
|
|
1052
998
|
patch: Partial<CollaboratorFormState['weeklySchedule'][number]>
|
|
@@ -1081,7 +1027,6 @@ export function CollaboratorFormScreen({
|
|
|
1081
1027
|
};
|
|
1082
1028
|
|
|
1083
1029
|
const onSubmit = async () => {
|
|
1084
|
-
const userId = parseNumberInput(form.userId);
|
|
1085
1030
|
const personId = parseNumberInput(form.personId);
|
|
1086
1031
|
const compensationAmount = isHourlyType
|
|
1087
1032
|
? null
|
|
@@ -1103,7 +1048,6 @@ export function CollaboratorFormScreen({
|
|
|
1103
1048
|
}
|
|
1104
1049
|
|
|
1105
1050
|
const payload = {
|
|
1106
|
-
userId: userId ?? undefined,
|
|
1107
1051
|
personId: personId ?? undefined,
|
|
1108
1052
|
displayName: trimToNull(form.displayName),
|
|
1109
1053
|
collaboratorTypeId,
|
|
@@ -1380,6 +1324,10 @@ export function CollaboratorFormScreen({
|
|
|
1380
1324
|
value={form.personId ? Number(form.personId) : null}
|
|
1381
1325
|
initialSelectedLabel={collaborator?.personName ?? form.displayName}
|
|
1382
1326
|
selectPlaceholder={t('placeholders.person')}
|
|
1327
|
+
showEditButton
|
|
1328
|
+
editAriaLabel={t('actions.editPersonCrm')}
|
|
1329
|
+
onEditSelection={(personId) => void handleOpenPersonSheet(personId)}
|
|
1330
|
+
onCreateNew={() => handleOpenPersonCreateSheet()}
|
|
1383
1331
|
onChange={(personId, personName) =>
|
|
1384
1332
|
setForm((current) => ({
|
|
1385
1333
|
...current,
|
|
@@ -1389,25 +1337,6 @@ export function CollaboratorFormScreen({
|
|
|
1389
1337
|
}
|
|
1390
1338
|
/>
|
|
1391
1339
|
</div>
|
|
1392
|
-
<div className="space-y-2 md:col-span-2 xl:col-span-2">
|
|
1393
|
-
<SystemUserPicker
|
|
1394
|
-
label={t('fields.userIdOptional')}
|
|
1395
|
-
value={form.userId}
|
|
1396
|
-
options={systemUsers}
|
|
1397
|
-
placeholder={t('placeholders.userIdOptional')}
|
|
1398
|
-
emptyLabel={commonT('labels.notAssigned')}
|
|
1399
|
-
onChange={(value) =>
|
|
1400
|
-
setForm((current) => ({
|
|
1401
|
-
...current,
|
|
1402
|
-
userId: value,
|
|
1403
|
-
}))
|
|
1404
|
-
}
|
|
1405
|
-
onCreate={createSystemUser}
|
|
1406
|
-
/>
|
|
1407
|
-
<p className="text-xs text-muted-foreground">
|
|
1408
|
-
{t('fields.userIdDescription')}
|
|
1409
|
-
</p>
|
|
1410
|
-
</div>
|
|
1411
1340
|
|
|
1412
1341
|
{!isCreateMode ? (
|
|
1413
1342
|
<div className="space-y-2">
|
|
@@ -2128,7 +2057,7 @@ export function CollaboratorFormScreen({
|
|
|
2128
2057
|
</div>
|
|
2129
2058
|
);
|
|
2130
2059
|
|
|
2131
|
-
const salaryChartData =
|
|
2060
|
+
const salaryChartData = (() => {
|
|
2132
2061
|
if (!compensationHistory.length) return [];
|
|
2133
2062
|
|
|
2134
2063
|
const sorted = [...compensationHistory].sort(
|
|
@@ -2178,7 +2107,7 @@ export function CollaboratorFormScreen({
|
|
|
2178
2107
|
},
|
|
2179
2108
|
...projectionPoints,
|
|
2180
2109
|
];
|
|
2181
|
-
}
|
|
2110
|
+
})();
|
|
2182
2111
|
|
|
2183
2112
|
const costsSection = (
|
|
2184
2113
|
<Accordion
|
|
@@ -2488,7 +2417,18 @@ export function CollaboratorFormScreen({
|
|
|
2488
2417
|
setPersonSheetOpen(nextOpen);
|
|
2489
2418
|
if (!nextOpen) setPersonToEdit(null);
|
|
2490
2419
|
}}
|
|
2491
|
-
onSuccess={() =>
|
|
2420
|
+
onSuccess={(person) => {
|
|
2421
|
+
if (personSheetModeRef.current === 'create' && person) {
|
|
2422
|
+
setForm((current) => ({
|
|
2423
|
+
...current,
|
|
2424
|
+
personId: String(person.id),
|
|
2425
|
+
displayName: person.name,
|
|
2426
|
+
}));
|
|
2427
|
+
} else {
|
|
2428
|
+
void refetchCollaborator();
|
|
2429
|
+
}
|
|
2430
|
+
personSheetModeRef.current = 'edit';
|
|
2431
|
+
}}
|
|
2492
2432
|
/>
|
|
2493
2433
|
</div>
|
|
2494
2434
|
);
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
|
4
|
+
import { EntityPicker } from '@/components/ui/entity-picker';
|
|
5
|
+
import { useApp } from '@hed-hog/next-app-provider';
|
|
6
|
+
import { useTranslations } from 'next-intl';
|
|
7
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
8
|
+
|
|
9
|
+
export type CollaboratorPickerOption = {
|
|
10
|
+
id: number;
|
|
11
|
+
displayName: string;
|
|
12
|
+
userPhotoId?: number | null;
|
|
13
|
+
personAvatarId?: number | null;
|
|
14
|
+
code?: string | null;
|
|
15
|
+
department?: string | null;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type CollaboratorPickerProps = {
|
|
19
|
+
label?: string;
|
|
20
|
+
value: string;
|
|
21
|
+
placeholder: string;
|
|
22
|
+
onChange: (value: string) => void;
|
|
23
|
+
setFormData: Dispatch<SetStateAction<any>>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type CollaboratorListPayload = {
|
|
27
|
+
data: CollaboratorPickerOption[];
|
|
28
|
+
total: number;
|
|
29
|
+
page: number;
|
|
30
|
+
pageSize: number;
|
|
31
|
+
lastPage: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const PAGE_SIZE = 20;
|
|
35
|
+
|
|
36
|
+
function getCollaboratorPhotoUrl(option: CollaboratorPickerOption) {
|
|
37
|
+
// Priority: userPhotoId > personAvatarId
|
|
38
|
+
if (typeof option.userPhotoId === 'number' && option.userPhotoId > 0) {
|
|
39
|
+
return `${process.env.NEXT_PUBLIC_API_BASE_URL}/file/open/${option.userPhotoId}`;
|
|
40
|
+
}
|
|
41
|
+
if (typeof option.personAvatarId === 'number' && option.personAvatarId > 0) {
|
|
42
|
+
return `${process.env.NEXT_PUBLIC_API_BASE_URL}/person/avatar/${option.personAvatarId}`;
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getInitials(value?: string | null) {
|
|
48
|
+
const parts = String(value ?? '')
|
|
49
|
+
.trim()
|
|
50
|
+
.split(/\s+/)
|
|
51
|
+
.filter(Boolean)
|
|
52
|
+
.slice(0, 2);
|
|
53
|
+
|
|
54
|
+
if (!parts.length) {
|
|
55
|
+
return '??';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return parts.map((part) => part[0]?.toUpperCase() ?? '').join('');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function CollaboratorPicker({
|
|
62
|
+
label,
|
|
63
|
+
value,
|
|
64
|
+
placeholder,
|
|
65
|
+
onChange,
|
|
66
|
+
setFormData,
|
|
67
|
+
}: CollaboratorPickerProps) {
|
|
68
|
+
const { request } = useApp();
|
|
69
|
+
const commonT = useTranslations('operations.Common');
|
|
70
|
+
const taskT = useTranslations('operations.ProjectDetailsPage');
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<EntityPicker<CollaboratorPickerOption>
|
|
74
|
+
label={label}
|
|
75
|
+
value={value || ''}
|
|
76
|
+
onChange={(nextValue) => {
|
|
77
|
+
const normalizedValue = nextValue ? String(nextValue) : '';
|
|
78
|
+
onChange(normalizedValue);
|
|
79
|
+
setFormData((prev: any) => ({
|
|
80
|
+
...prev,
|
|
81
|
+
assigneeCollaboratorId: normalizedValue,
|
|
82
|
+
}));
|
|
83
|
+
}}
|
|
84
|
+
placeholder={commonT('labels.notAssigned')}
|
|
85
|
+
emptySelectionLabel={commonT('labels.notAssigned')}
|
|
86
|
+
searchPlaceholder={placeholder}
|
|
87
|
+
emptyStateDescription={commonT('states.emptyDescription')}
|
|
88
|
+
noResultsLabel={commonT('states.emptyDescription')}
|
|
89
|
+
loadingLabel={commonT('states.loading')}
|
|
90
|
+
clearable
|
|
91
|
+
allowEmptySelection
|
|
92
|
+
valueType="string"
|
|
93
|
+
showCreateButton={false}
|
|
94
|
+
getOptionValue={(collab) => String(collab.id)}
|
|
95
|
+
getOptionLabel={(collab) => collab.displayName}
|
|
96
|
+
getOptionDescription={(collab) =>
|
|
97
|
+
[collab.code, collab.department].filter(Boolean).join(' • ') || undefined
|
|
98
|
+
}
|
|
99
|
+
renderOption={({ option }) => (
|
|
100
|
+
<div className="flex min-w-0 items-center gap-2.5">
|
|
101
|
+
<Avatar className="h-7 w-7 shrink-0 rounded-full">
|
|
102
|
+
<AvatarImage src={getCollaboratorPhotoUrl(option)} />
|
|
103
|
+
<AvatarFallback className="rounded-full bg-muted text-[10px] font-semibold text-muted-foreground">
|
|
104
|
+
{getInitials(option.displayName)}
|
|
105
|
+
</AvatarFallback>
|
|
106
|
+
</Avatar>
|
|
107
|
+
<div className="min-w-0 flex-1">
|
|
108
|
+
<div className="truncate text-sm font-medium">{option.displayName}</div>
|
|
109
|
+
{option.code || option.department ? (
|
|
110
|
+
<div className="truncate text-xs text-muted-foreground">
|
|
111
|
+
{[option.code, option.department].filter(Boolean).join(' • ')}
|
|
112
|
+
</div>
|
|
113
|
+
) : null}
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
)}
|
|
117
|
+
renderSelectedValue={({ option, label: fallbackLabel }) => {
|
|
118
|
+
if (!option) {
|
|
119
|
+
return fallbackLabel;
|
|
120
|
+
}
|
|
121
|
+
return (
|
|
122
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
123
|
+
<Avatar className="h-5 w-5 shrink-0 rounded-full">
|
|
124
|
+
<AvatarImage src={getCollaboratorPhotoUrl(option)} />
|
|
125
|
+
<AvatarFallback className="rounded-full bg-muted text-[9px] font-semibold text-muted-foreground">
|
|
126
|
+
{getInitials(option.displayName)}
|
|
127
|
+
</AvatarFallback>
|
|
128
|
+
</Avatar>
|
|
129
|
+
<span className="truncate">{option.displayName}</span>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}}
|
|
133
|
+
loadOptions={async ({ page, pageSize, search }) => {
|
|
134
|
+
const params = new URLSearchParams();
|
|
135
|
+
params.set('page', String(page));
|
|
136
|
+
params.set('pageSize', String(pageSize || PAGE_SIZE));
|
|
137
|
+
params.set('sortField', 'displayName');
|
|
138
|
+
params.set('sortOrder', 'asc');
|
|
139
|
+
|
|
140
|
+
if (search.trim()) {
|
|
141
|
+
params.set('search', search.trim());
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const response = await request<CollaboratorListPayload>({
|
|
145
|
+
url: `/operations/collaborators?${params.toString()}`,
|
|
146
|
+
method: 'GET',
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const payload = response?.data;
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
items: (payload?.data ?? []) as CollaboratorPickerOption[],
|
|
153
|
+
hasMore: (payload?.page ?? 1) < (payload?.lastPage ?? 1),
|
|
154
|
+
};
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
}
|