@open-mercato/core 0.7.1-develop.7178.1.ab93fbaf4e → 0.7.1-develop.7180.1.9717fbbb43
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/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/staff_time_entry/index.js +14 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +2 -2
- package/dist/generated/entities/staff_time_entry_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_entry_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +16 -0
- package/dist/generated/entities/staff_time_project/index.js.map +2 -2
- package/dist/generated/entities/staff_time_report/index.js +57 -0
- package/dist/generated/entities/staff_time_report/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_entry/index.js +27 -0
- package/dist/generated/entities/staff_time_report_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_event/index.js +21 -0
- package/dist/generated/entities/staff_time_report_event/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_project/index.js +15 -0
- package/dist/generated/entities/staff_time_report_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_tag/index.js +21 -0
- package/dist/generated/entities/staff_time_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task/index.js +37 -0
- package/dist/generated/entities/staff_time_task/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_comment/index.js +21 -0
- package/dist/generated/entities/staff_time_task_comment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_status/index.js +29 -0
- package/dist/generated/entities/staff_time_task_status/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_task_tag/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +11 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +149 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +7 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +2 -2
- package/dist/modules/auth/cli.js +16 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js +44 -0
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +1 -28
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +2 -0
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +39 -17
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/start-controls.js +42 -0
- package/dist/modules/data_sync/lib/start-controls.js.map +7 -0
- package/dist/modules/staff/acl.js +9 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/ai-agents.js +142 -0
- package/dist/modules/staff/ai-agents.js.map +7 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js +348 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js.map +7 -0
- package/dist/modules/staff/ai-tools/types.js +54 -0
- package/dist/modules/staff/ai-tools/types.js.map +7 -0
- package/dist/modules/staff/ai-tools.js +8 -0
- package/dist/modules/staff/ai-tools.js.map +7 -0
- package/dist/modules/staff/analytics.js +84 -1
- package/dist/modules/staff/analytics.js.map +2 -2
- package/dist/modules/staff/api/guards.js +37 -3
- package/dist/modules/staff/api/guards.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js +131 -0
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js.map +7 -0
- package/dist/modules/staff/api/portal/time-reports/route.js +179 -0
- package/dist/modules/staff/api/portal/time-reports/route.js.map +7 -0
- package/dist/modules/staff/api/team-members/self/route.js +1 -3
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +174 -0
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js +226 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +15 -8
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +13 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js +42 -0
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js +383 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +14 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +168 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +246 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +183 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +164 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +360 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/route.js +316 -0
- package/dist/modules/staff/api/timesheets/reports/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js +63 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +164 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js +168 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/route.js +199 -0
- package/dist/modules/staff/api/timesheets/settings/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/access.js +76 -0
- package/dist/modules/staff/api/timesheets/tags/access.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +235 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/route.js +160 -0
- package/dist/modules/staff/api/timesheets/tags/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +233 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js +188 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +399 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +210 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js +333 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +228 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +29 -10
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +31 -18
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +21 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +27 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +215 -32
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +378 -0
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +340 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +238 -26
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +23 -8
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +209 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +59 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +264 -22
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js +110 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js +981 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js +583 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js +15 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js +65 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js +229 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js +1014 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js +97 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js +1040 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js +19 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js +353 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js +457 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js +697 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js +174 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js +546 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js +710 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js +646 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +4 -793
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +2 -7
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +5 -136
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +5 -445
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +3 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +4 -76
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +4 -613
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +2 -17
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +2 -2
- package/dist/modules/staff/ce.js +40 -0
- package/dist/modules/staff/ce.js.map +2 -2
- package/dist/modules/staff/cli.js +166 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +5 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +569 -21
- package/dist/modules/staff/commands/timesheets-entries.js.map +3 -3
- package/dist/modules/staff/commands/timesheets-projects.js +450 -7
- package/dist/modules/staff/commands/timesheets-projects.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +1036 -0
- package/dist/modules/staff/commands/timesheets-reports.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tags.js +1015 -0
- package/dist/modules/staff/commands/timesheets-tags.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js +438 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js +723 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tasks.js +834 -0
- package/dist/modules/staff/commands/timesheets-tasks.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +426 -12
- package/dist/modules/staff/data/enrichers.js.map +2 -2
- package/dist/modules/staff/data/entities.js +552 -3
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/extensions.js +41 -0
- package/dist/modules/staff/data/extensions.js.map +7 -0
- package/dist/modules/staff/data/validators.js +254 -9
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/di.js +42 -1
- package/dist/modules/staff/di.js.map +2 -2
- package/dist/modules/staff/events.js +84 -6
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/events.payloads.js +158 -0
- package/dist/modules/staff/events.payloads.js.map +7 -0
- package/dist/modules/staff/extension-points.js +261 -0
- package/dist/modules/staff/extension-points.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js +138 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js +12 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js +133 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js +19 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js.map +7 -0
- package/dist/modules/staff/lib/crud.js +11 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/time-tracking/access.js +92 -0
- package/dist/modules/staff/lib/time-tracking/access.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/billability.js +39 -0
- package/dist/modules/staff/lib/time-tracking/billability.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js +68 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js +15 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/cost.js +82 -0
- package/dist/modules/staff/lib/time-tracking/cost.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/duration.js +55 -0
- package/dist/modules/staff/lib/time-tracking/duration.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js +41 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/interval.js +72 -0
- package/dist/modules/staff/lib/time-tracking/interval.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js +88 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js +10 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js +87 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js +27 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js +16 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js +135 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js +187 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js +80 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js +56 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js +63 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js +62 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js +21 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js +34 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js +66 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js +39 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js +214 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settings.js +87 -0
- package/dist/modules/staff/lib/time-tracking/settings.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js +9 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js +48 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js +283 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js +324 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js +121 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js +89 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js +855 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js +360 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js +259 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js +238 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js +130 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js +98 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js +27 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js +166 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js +295 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js +212 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js +729 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js +217 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js +158 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js +224 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js +93 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js +1196 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js +307 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js +284 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js +73 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js +1499 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js +95 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js +61 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js +45 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js +82 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js +5 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js +152 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js +92 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js +111 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js +243 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js +105 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js +132 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js +205 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js +53 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js +77 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js.map +7 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js +809 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js.map +7 -0
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js +2 -3
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js.map +2 -2
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js +152 -0
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js +36 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js +78 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js +44 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js +169 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js +22 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +51 -1
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js +70 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +63 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +170 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js +205 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js +68 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js +135 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js +48 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js +262 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js +34 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js +79 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js +11 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js +83 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js +42 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js +107 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js +289 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js +145 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js +116 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js +50 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js +27 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js +65 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js +17 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js +51 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +11 -4
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +369 -111
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +47 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +2 -2
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js +79 -0
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js +15 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js.map +7 -0
- package/dist/modules/staff/notifications.client.js +16 -0
- package/dist/modules/staff/notifications.client.js.map +7 -0
- package/dist/modules/staff/notifications.handlers.js +80 -0
- package/dist/modules/staff/notifications.handlers.js.map +7 -0
- package/dist/modules/staff/notifications.js +168 -0
- package/dist/modules/staff/notifications.js.map +2 -2
- package/dist/modules/staff/search.js +159 -1
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +20 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js +68 -0
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js +149 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js +78 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js +78 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js.map +7 -0
- package/dist/modules/staff/translations.js +4 -1
- package/dist/modules/staff/translations.js.map +2 -2
- package/dist/modules/staff/widgets/components.js +7 -0
- package/dist/modules/staff/widgets/components.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +5 -4
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +2 -2
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js +135 -0
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js.map +7 -0
- package/dist/modules/staff/widgets/notifications/index.js +5 -0
- package/dist/modules/staff/widgets/notifications/index.js.map +7 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js +43 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js.map +7 -0
- package/generated/entities/staff_time_entry/index.ts +7 -0
- package/generated/entities/staff_time_entry_tag/index.ts +6 -0
- package/generated/entities/staff_time_project/index.ts +8 -0
- package/generated/entities/staff_time_report/index.ts +27 -0
- package/generated/entities/staff_time_report_entry/index.ts +12 -0
- package/generated/entities/staff_time_report_event/index.ts +9 -0
- package/generated/entities/staff_time_report_project/index.ts +6 -0
- package/generated/entities/staff_time_tag/index.ts +9 -0
- package/generated/entities/staff_time_task/index.ts +17 -0
- package/generated/entities/staff_time_task_comment/index.ts +9 -0
- package/generated/entities/staff_time_task_status/index.ts +13 -0
- package/generated/entities/staff_time_task_tag/index.ts +6 -0
- package/generated/entities.ids.generated.ts +11 -1
- package/generated/entity-fields-registry.ts +149 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +31 -1
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/cli.ts +35 -1
- package/src/modules/auth/i18n/de.json +7 -0
- package/src/modules/auth/i18n/en.json +7 -0
- package/src/modules/auth/i18n/es.json +7 -0
- package/src/modules/auth/i18n/ko.json +7 -0
- package/src/modules/auth/i18n/pl.json +7 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/customer_accounts/lib/customerRoleAcls.ts +79 -0
- package/src/modules/customer_accounts/setup.ts +1 -45
- package/src/modules/data_sync/AGENTS.md +34 -0
- package/src/modules/data_sync/api/options.ts +2 -0
- package/src/modules/data_sync/backend/data-sync/page.tsx +82 -33
- package/src/modules/data_sync/i18n/de.json +1 -0
- package/src/modules/data_sync/i18n/en.json +1 -0
- package/src/modules/data_sync/i18n/es.json +1 -0
- package/src/modules/data_sync/i18n/ko.json +1 -0
- package/src/modules/data_sync/i18n/pl.json +1 -0
- package/src/modules/data_sync/lib/adapter.ts +45 -0
- package/src/modules/data_sync/lib/start-controls.ts +89 -0
- package/src/modules/staff/AGENTS.md +769 -1
- package/src/modules/staff/acl.ts +9 -0
- package/src/modules/staff/ai-agents.ts +189 -0
- package/src/modules/staff/ai-tools/time-tracking-pack.ts +494 -0
- package/src/modules/staff/ai-tools/types.ts +82 -0
- package/src/modules/staff/ai-tools.ts +13 -0
- package/src/modules/staff/analytics.ts +113 -0
- package/src/modules/staff/api/guards.ts +85 -3
- package/src/modules/staff/api/leave-requests/accept/route.ts +0 -2
- package/src/modules/staff/api/leave-requests/reject/route.ts +0 -2
- package/src/modules/staff/api/portal/time-reports/[id]/route.ts +182 -0
- package/src/modules/staff/api/portal/time-reports/route.ts +270 -0
- package/src/modules/staff/api/team-members/self/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/assign/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +0 -2
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +292 -0
- package/src/modules/staff/api/timesheets/access-requests/route.ts +299 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +15 -7
- package/src/modules/staff/api/timesheets/my-projects/route.ts +14 -1
- package/src/modules/staff/api/timesheets/my-work/myWorkAggregate.ts +90 -0
- package/src/modules/staff/api/timesheets/my-work/route.ts +475 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +15 -2
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +203 -0
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +315 -0
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +220 -0
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +208 -0
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +449 -0
- package/src/modules/staff/api/timesheets/reports/route.ts +386 -0
- package/src/modules/staff/api/timesheets/reports/shared.ts +121 -0
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +205 -0
- package/src/modules/staff/api/timesheets/settings/rounding-impact/route.ts +226 -0
- package/src/modules/staff/api/timesheets/settings/route.ts +242 -0
- package/src/modules/staff/api/timesheets/tags/access.ts +134 -0
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +290 -0
- package/src/modules/staff/api/timesheets/tags/route.ts +177 -0
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +294 -0
- package/src/modules/staff/api/timesheets/task-statuses/route.ts +232 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +532 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +271 -0
- package/src/modules/staff/api/timesheets/tasks/route.ts +443 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +306 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +32 -10
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +32 -17
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +27 -6
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +36 -6
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +331 -34
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +533 -0
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +457 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +378 -24
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +31 -9
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +246 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +62 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +397 -22
- package/src/modules/staff/backend/staff/time-tracking/board/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/board/page.tsx +151 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.tsx +1229 -0
- package/src/modules/staff/backend/staff/time-tracking/page.meta.ts +11 -0
- package/src/modules/staff/backend/staff/time-tracking/page.tsx +823 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.tsx +81 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.tsx +275 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.tsx +1420 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.tsx +109 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.meta.ts +15 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.tsx +1254 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.ts +466 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.tsx +632 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.tsx +867 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.tsx +246 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.tsx +701 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/GridView.tsx +953 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.tsx +800 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +6 -6
- package/src/modules/staff/backend/staff/timesheets/page.tsx +12 -1010
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +4 -158
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +4 -609
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +3 -89
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +2 -19
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +3 -778
- package/src/modules/staff/ce.ts +63 -0
- package/src/modules/staff/cli.ts +207 -1
- package/src/modules/staff/commands/index.ts +5 -0
- package/src/modules/staff/commands/timesheets-entries.ts +1006 -28
- package/src/modules/staff/commands/timesheets-projects.ts +593 -7
- package/src/modules/staff/commands/timesheets-reports.ts +1329 -0
- package/src/modules/staff/commands/timesheets-tags.ts +1315 -0
- package/src/modules/staff/commands/timesheets-task-comments.ts +583 -0
- package/src/modules/staff/commands/timesheets-task-statuses.ts +889 -0
- package/src/modules/staff/commands/timesheets-tasks.ts +1121 -0
- package/src/modules/staff/data/enrichers.ts +675 -10
- package/src/modules/staff/data/entities.ts +494 -2
- package/src/modules/staff/data/extensions.ts +68 -0
- package/src/modules/staff/data/validators.ts +348 -3
- package/src/modules/staff/di.ts +96 -0
- package/src/modules/staff/events.payloads.ts +268 -0
- package/src/modules/staff/events.ts +87 -5
- package/src/modules/staff/extension-points.ts +308 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.ts +10 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.tsx +225 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.ts +17 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.tsx +182 -0
- package/src/modules/staff/i18n/de.json +899 -0
- package/src/modules/staff/i18n/en.json +899 -0
- package/src/modules/staff/i18n/es.json +899 -0
- package/src/modules/staff/i18n/ko.json +899 -0
- package/src/modules/staff/i18n/pl.json +899 -0
- package/src/modules/staff/lib/crud.ts +14 -3
- package/src/modules/staff/lib/time-tracking/access.ts +155 -0
- package/src/modules/staff/lib/time-tracking/billability.ts +68 -0
- package/src/modules/staff/lib/time-tracking/capacity.ts +124 -0
- package/src/modules/staff/lib/time-tracking/componentContracts.ts +26 -0
- package/src/modules/staff/lib/time-tracking/cost.ts +144 -0
- package/src/modules/staff/lib/time-tracking/duration.ts +68 -0
- package/src/modules/staff/lib/time-tracking/featureAccess.ts +115 -0
- package/src/modules/staff/lib/time-tracking/interval.ts +90 -0
- package/src/modules/staff/lib/time-tracking/migrateProjectCodes.ts +161 -0
- package/src/modules/staff/lib/time-tracking/moneyVisibility.ts +37 -0
- package/src/modules/staff/lib/time-tracking/overlap.ts +159 -0
- package/src/modules/staff/lib/time-tracking/portalRecipients.ts +76 -0
- package/src/modules/staff/lib/time-tracking/portalReports.ts +31 -0
- package/src/modules/staff/lib/time-tracking/projectCode.ts +221 -0
- package/src/modules/staff/lib/time-tracking/reapplyRounding.ts +313 -0
- package/src/modules/staff/lib/time-tracking/recalculationRunner.ts +118 -0
- package/src/modules/staff/lib/time-tracking/recalculations.ts +135 -0
- package/src/modules/staff/lib/time-tracking/registries/invoke.ts +122 -0
- package/src/modules/staff/lib/time-tracking/registries/registry.ts +124 -0
- package/src/modules/staff/lib/time-tracking/registries/scope.ts +56 -0
- package/src/modules/staff/lib/time-tracking/rollup.ts +59 -0
- package/src/modules/staff/lib/time-tracking/rounding.ts +126 -0
- package/src/modules/staff/lib/time-tracking/roundingImpact.ts +75 -0
- package/src/modules/staff/lib/time-tracking/settingKeys.ts +274 -0
- package/src/modules/staff/lib/time-tracking/settings.ts +168 -0
- package/src/modules/staff/lib/time-tracking/sqlInClause.ts +22 -0
- package/src/modules/staff/lib/time-tracking/timeEntrySources.ts +85 -0
- package/src/modules/staff/lib/time-tracking-ui/BoardFilterChips.tsx +360 -0
- package/src/modules/staff/lib/time-tracking-ui/CustomerPicker.tsx +427 -0
- package/src/modules/staff/lib/time-tracking-ui/DurationInput.tsx +192 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryDetailsFields.tsx +224 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryFilterBar.tsx +144 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanBoard.tsx +1065 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanCard.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanColumn.tsx +316 -0
- package/src/modules/staff/lib/time-tracking-ui/NewTaskDialog.tsx +291 -0
- package/src/modules/staff/lib/time-tracking-ui/NoProjectAccess.tsx +162 -0
- package/src/modules/staff/lib/time-tracking-ui/PeriodSelector.tsx +149 -0
- package/src/modules/staff/lib/time-tracking-ui/PhasePlaceholder.tsx +31 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCodeField.tsx +230 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.tsx +432 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectFormSections.tsx +323 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.tsx +930 -0
- package/src/modules/staff/lib/time-tracking-ui/ReportSheet.tsx +357 -0
- package/src/modules/staff/lib/time-tracking-ui/TagPicker.tsx +195 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskBoardScreen.tsx +243 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskCommentThread.tsx +137 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskDrawer.tsx +1405 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskListView.tsx +260 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskPicker.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskQuickLog.tsx +296 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.tsx +97 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDialog.tsx +1929 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.tsx +126 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetCalendar.tsx +265 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.tsx +78 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.tsx +70 -0
- package/src/modules/staff/lib/time-tracking-ui/boardDirectory.ts +231 -0
- package/src/modules/staff/lib/time-tracking-ui/boardFilters.ts +128 -0
- package/src/modules/staff/lib/time-tracking-ui/boardSummary.ts +20 -0
- package/src/modules/staff/lib/time-tracking-ui/kanbanBoardData.ts +228 -0
- package/src/modules/staff/lib/time-tracking-ui/projectTeamAssignment.ts +143 -0
- package/src/modules/staff/lib/time-tracking-ui/taskDrawerData.ts +194 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryDialogState.ts +400 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryListData.ts +271 -0
- package/src/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.ts +168 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetData.ts +225 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetPeriod.ts +278 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetTargets.ts +93 -0
- package/src/modules/staff/lib/time-tracking-ui/useBoardFilters.ts +107 -0
- package/src/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.ts +245 -0
- package/src/modules/staff/lib/timeTrackingSeeds.ts +1037 -0
- package/src/modules/staff/lib/timesheets/timeEntryCacheInvalidation.ts +11 -10
- package/src/modules/staff/lib/timesheets/timeEntryDecoration.ts +256 -0
- package/src/modules/staff/lib/timesheets-projects/budgetBurn.ts +60 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThreshold.ts +135 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThresholdState.ts +137 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectFinancials.ts +142 -0
- package/src/modules/staff/lib/timesheets-projects/reportSelection.ts +82 -0
- package/src/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.tsx +237 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.tsx +33 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +56 -1
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.tsx +90 -0
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +125 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +251 -0
- package/src/modules/staff/lib/timesheets-reports/pdf.ts +263 -0
- package/src/modules/staff/lib/timesheets-reports/reportApprovalPolicies.ts +137 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigData.ts +247 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigState.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportExport.ts +373 -0
- package/src/modules/staff/lib/timesheets-reports/reportExportFormats.ts +71 -0
- package/src/modules/staff/lib/timesheets-reports/reportGroupings.ts +153 -0
- package/src/modules/staff/lib/timesheets-reports/reportLabels.ts +23 -0
- package/src/modules/staff/lib/timesheets-reports/reportReference.ts +146 -0
- package/src/modules/staff/lib/timesheets-reports/reportRows.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportSheetData.ts +196 -0
- package/src/modules/staff/lib/timesheets-reports/reportTotals.ts +544 -0
- package/src/modules/staff/lib/timesheets-reports/xlsx.ts +207 -0
- package/src/modules/staff/lib/timesheets-tasks/computeTaskRollups.ts +238 -0
- package/src/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.ts +90 -0
- package/src/modules/staff/lib/timesheets-tasks/seedProjectStatuses.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/statusPositions.ts +132 -0
- package/src/modules/staff/lib/timesheets-tasks/statusSlug.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHierarchy.ts +99 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHoursTotals.ts +42 -0
- package/src/modules/staff/lib/timesheets-tasks/taskReference.ts +108 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +18 -4
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +504 -149
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +50 -2
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +3244 -228
- package/src/modules/staff/migrations/Migration20260813073131_staff.ts +94 -0
- package/src/modules/staff/migrations/Migration20260824143357_staff.ts +17 -0
- package/src/modules/staff/notifications.client.ts +16 -0
- package/src/modules/staff/notifications.handlers.ts +88 -0
- package/src/modules/staff/notifications.ts +163 -0
- package/src/modules/staff/search.ts +191 -1
- package/src/modules/staff/setup.ts +22 -0
- package/src/modules/staff/subscribers/time-project-access-requested-notification.ts +95 -0
- package/src/modules/staff/subscribers/time-project-budget-threshold-notification.ts +226 -0
- package/src/modules/staff/subscribers/time-report-approved-notification.ts +116 -0
- package/src/modules/staff/subscribers/time-report-portal-broadcast.ts +120 -0
- package/src/modules/staff/translations.ts +17 -0
- package/src/modules/staff/widgets/components.ts +34 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +6 -5
- package/src/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.tsx +138 -0
- package/src/modules/staff/widgets/notifications/index.ts +1 -0
- package/src/modules/staff/workers/timesheets-reapply-rounding.ts +59 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +0 -123
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +0 -7
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +0 -138
|
@@ -0,0 +1,1040 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { extensionPoints } from "@open-mercato/core/modules/staff/extension-points";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
7
|
+
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
8
|
+
import { DataTable, withDataTableNamespaces } from "@open-mercato/ui/backend/DataTable";
|
|
9
|
+
import { FilterBar } from "@open-mercato/ui/backend/FilterBar";
|
|
10
|
+
import { RowActions } from "@open-mercato/ui/backend/RowActions";
|
|
11
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
12
|
+
import { Checkbox } from "@open-mercato/ui/primitives/checkbox";
|
|
13
|
+
import { StatusBadge } from "@open-mercato/ui/primitives/status-badge";
|
|
14
|
+
import { readApiResultOrThrow, withScopedApiRequestHeaders } from "@open-mercato/ui/backend/utils/apiCall";
|
|
15
|
+
import { buildOptimisticLockHeader } from "@open-mercato/ui/backend/utils/optimisticLock";
|
|
16
|
+
import { surfaceRecordConflict } from "@open-mercato/ui/backend/conflicts";
|
|
17
|
+
import { createCrud, deleteCrud } from "@open-mercato/ui/backend/utils/crud";
|
|
18
|
+
import { groupBulkDeleteFailures, runBulkDelete } from "@open-mercato/ui/backend/utils/bulkDelete";
|
|
19
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
20
|
+
import { useBackendChrome } from "@open-mercato/ui/backend/BackendChromeProvider";
|
|
21
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
22
|
+
import { useConfirmDialog } from "@open-mercato/ui/backend/confirm-dialog";
|
|
23
|
+
import { formatCurrency, formatDate } from "@open-mercato/ui/utils/format";
|
|
24
|
+
import { hasAllFeatures } from "@open-mercato/shared/security/features";
|
|
25
|
+
import { useOrganizationScopeVersion } from "@open-mercato/shared/lib/frontend/useOrganizationScope";
|
|
26
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
27
|
+
import { formatDateTime } from "@open-mercato/shared/lib/time";
|
|
28
|
+
import { ProjectColorDot } from "../../../../lib/timesheets-ui/ProjectColorDot.js";
|
|
29
|
+
import { resolveProjectColorHex } from "../../../../lib/timesheets-ui/colors.js";
|
|
30
|
+
import { formatDuration } from "../../../../lib/time-tracking/duration.js";
|
|
31
|
+
import {
|
|
32
|
+
ProjectsKpiStrip
|
|
33
|
+
} from "../../../../lib/timesheets-projects-ui/ProjectsKpiStrip.js";
|
|
34
|
+
import { SavedViewTabs } from "../../../../lib/timesheets-projects-ui/SavedViewTabs.js";
|
|
35
|
+
import { HoursSparkline } from "../../../../lib/timesheets-projects-ui/HoursSparkline.js";
|
|
36
|
+
import {
|
|
37
|
+
ProjectMembersAvatarStack
|
|
38
|
+
} from "../../../../lib/timesheets-projects-ui/ProjectMembersAvatarStack.js";
|
|
39
|
+
import { ViewModeToggle } from "../../../../lib/timesheets-projects-ui/ViewModeToggle.js";
|
|
40
|
+
import {
|
|
41
|
+
useProjectsViewMode
|
|
42
|
+
} from "../../../../lib/timesheets-projects-ui/useProjectsViewMode.js";
|
|
43
|
+
import {
|
|
44
|
+
ProjectCard
|
|
45
|
+
} from "../../../../lib/timesheets-projects-ui/ProjectCard.js";
|
|
46
|
+
import { ProjectBudgetCell } from "../../../../lib/timesheets-projects-ui/ProjectBudgetCell.js";
|
|
47
|
+
import { ProjectsBulkActionsBar } from "../../../../lib/timesheets-projects-ui/ProjectsBulkActionsBar.js";
|
|
48
|
+
import {
|
|
49
|
+
AssignMembersDialog
|
|
50
|
+
} from "../../../../lib/timesheets-projects-ui/AssignMembersDialog.js";
|
|
51
|
+
import { computeBudgetBurn } from "../../../../lib/timesheets-projects/budgetBurn.js";
|
|
52
|
+
import { resolveReportSelection } from "../../../../lib/timesheets-projects/reportSelection.js";
|
|
53
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
54
|
+
const logger = createLogger("staff");
|
|
55
|
+
const PAGE_SIZE = 50;
|
|
56
|
+
const INCLUDE_FIELDS = "hoursWeek,hoursTrend,members,myRole";
|
|
57
|
+
const MANAGE_FEATURE = "staff.timesheets.projects.manage";
|
|
58
|
+
const RATES_FEATURE = "staff.timesheets.rates.view";
|
|
59
|
+
const REPORTS_FEATURES = ["staff.timesheets.reports.view", "staff.timesheets.reports.manage"];
|
|
60
|
+
const REPORTS_HREF = "/backend/staff/time-tracking/reports";
|
|
61
|
+
const STATUS_VARIANTS = {
|
|
62
|
+
active: "success",
|
|
63
|
+
on_hold: "warning",
|
|
64
|
+
completed: "neutral"
|
|
65
|
+
};
|
|
66
|
+
function readString(item, camel, snake) {
|
|
67
|
+
const camelValue = item[camel];
|
|
68
|
+
if (typeof camelValue === "string") return camelValue;
|
|
69
|
+
const snakeValue = item[snake];
|
|
70
|
+
return typeof snakeValue === "string" ? snakeValue : null;
|
|
71
|
+
}
|
|
72
|
+
function readNumber(value) {
|
|
73
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
74
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
75
|
+
const parsed = Number(value);
|
|
76
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
function readBudgetKind(value) {
|
|
81
|
+
return value === "hours" || value === "amount" ? value : "none";
|
|
82
|
+
}
|
|
83
|
+
function formatRelativeTime(iso, fallback, t) {
|
|
84
|
+
if (!iso) return fallback;
|
|
85
|
+
const parsed = new Date(iso);
|
|
86
|
+
if (Number.isNaN(parsed.getTime())) return fallback;
|
|
87
|
+
const diffMs = Date.now() - parsed.getTime();
|
|
88
|
+
const minutes = Math.round(diffMs / 6e4);
|
|
89
|
+
if (minutes < 1) return t("staff.timesheets.projects.portfolio.relativeTime.justNow", "just now");
|
|
90
|
+
if (minutes < 60) return t("staff.timesheets.projects.portfolio.relativeTime.minutesAgo", "{minutes}m ago", { minutes });
|
|
91
|
+
const hours = Math.round(minutes / 60);
|
|
92
|
+
if (hours < 24) return t("staff.timesheets.projects.portfolio.relativeTime.hoursAgo", "{hours}h ago", { hours });
|
|
93
|
+
const days = Math.round(hours / 24);
|
|
94
|
+
if (days < 14) return t("staff.timesheets.projects.portfolio.relativeTime.daysAgo", "{days}d ago", { days });
|
|
95
|
+
return formatDateTime(iso) ?? fallback;
|
|
96
|
+
}
|
|
97
|
+
function mapApiProject(item) {
|
|
98
|
+
const id = typeof item.id === "string" ? item.id : "";
|
|
99
|
+
const name = typeof item.name === "string" ? item.name : id;
|
|
100
|
+
const code = typeof item.code === "string" && item.code.trim().length ? item.code.trim() : null;
|
|
101
|
+
const customerId = readString(item, "customerId", "customer_id");
|
|
102
|
+
const status = typeof item.status === "string" ? item.status : "active";
|
|
103
|
+
const projectType = readString(item, "projectType", "project_type");
|
|
104
|
+
const color = typeof item.color === "string" ? item.color : null;
|
|
105
|
+
const startDate = readString(item, "startDate", "start_date");
|
|
106
|
+
const updatedAt = readString(item, "updatedAt", "updated_at");
|
|
107
|
+
const currencyCode = readString(item, "currencyCode", "currency_code");
|
|
108
|
+
const enrichment = item._staff ?? {};
|
|
109
|
+
const hoursWeek = typeof enrichment.hoursWeek === "number" ? enrichment.hoursWeek : 0;
|
|
110
|
+
const hoursTrend = Array.isArray(enrichment.hoursTrend) ? enrichment.hoursTrend.filter((v) => typeof v === "number") : [];
|
|
111
|
+
const members = Array.isArray(enrichment.members) ? enrichment.members.filter((m) => !!m && typeof m === "object" && typeof m.id === "string").map((m) => ({
|
|
112
|
+
id: m.id,
|
|
113
|
+
name: m.name ?? "",
|
|
114
|
+
initials: m.initials ?? "",
|
|
115
|
+
avatarUrl: m.avatarUrl ?? null
|
|
116
|
+
})) : [];
|
|
117
|
+
const memberCount = typeof enrichment.memberCount === "number" ? enrichment.memberCount : members.length;
|
|
118
|
+
const myRole = typeof enrichment.myRole === "string" ? enrichment.myRole : null;
|
|
119
|
+
const customerName = typeof enrichment.customerName === "string" && enrichment.customerName.length > 0 ? enrichment.customerName : readString(item, "customerName", "customer_name");
|
|
120
|
+
return withDataTableNamespaces(
|
|
121
|
+
{
|
|
122
|
+
id,
|
|
123
|
+
name,
|
|
124
|
+
code,
|
|
125
|
+
customerId,
|
|
126
|
+
customerName,
|
|
127
|
+
status,
|
|
128
|
+
projectType,
|
|
129
|
+
color,
|
|
130
|
+
startDate,
|
|
131
|
+
updatedAt,
|
|
132
|
+
currencyCode,
|
|
133
|
+
hoursWeek,
|
|
134
|
+
hoursTrend,
|
|
135
|
+
myRole,
|
|
136
|
+
members,
|
|
137
|
+
memberCount,
|
|
138
|
+
totalMinutes: typeof enrichment.totalMinutes === "number" ? enrichment.totalMinutes : 0,
|
|
139
|
+
hourlyRate: readNumber(enrichment.hourlyRate),
|
|
140
|
+
cost: readNumber(enrichment.cost),
|
|
141
|
+
budgetKind: readBudgetKind(enrichment.budget?.kind),
|
|
142
|
+
budgetValue: readNumber(enrichment.budget?.value),
|
|
143
|
+
budgetWarnAtPercent: readNumber(enrichment.budget?.warnAtPercent)
|
|
144
|
+
},
|
|
145
|
+
item
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function TimesheetProjectsPage() {
|
|
149
|
+
const t = useT();
|
|
150
|
+
const router = useRouter();
|
|
151
|
+
const searchParams = useSearchParams();
|
|
152
|
+
const scopeVersion = useOrganizationScopeVersion();
|
|
153
|
+
const { confirm, ConfirmDialogElement } = useConfirmDialog();
|
|
154
|
+
const { payload: chromePayload } = useBackendChrome();
|
|
155
|
+
const [rows, setRows] = React.useState([]);
|
|
156
|
+
const [page, setPage] = React.useState(1);
|
|
157
|
+
const [total, setTotal] = React.useState(0);
|
|
158
|
+
const [totalIsCapped, setTotalIsCapped] = React.useState(false);
|
|
159
|
+
const [totalPages, setTotalPages] = React.useState(1);
|
|
160
|
+
const [sorting, setSorting] = React.useState([{ id: "updatedAt", desc: true }]);
|
|
161
|
+
const [search, setSearch] = React.useState("");
|
|
162
|
+
const [filterValues, setFilterValues] = React.useState({});
|
|
163
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
164
|
+
const [isRefreshing, setIsRefreshing] = React.useState(false);
|
|
165
|
+
const hasLoadedOnceRef = React.useRef(false);
|
|
166
|
+
const [reloadToken, setReloadToken] = React.useState(0);
|
|
167
|
+
const [kpis, setKpis] = React.useState(null);
|
|
168
|
+
const [isLoadingKpis, setIsLoadingKpis] = React.useState(true);
|
|
169
|
+
const [selectedIds, setSelectedIds] = React.useState([]);
|
|
170
|
+
const [assignDialogOpen, setAssignDialogOpen] = React.useState(false);
|
|
171
|
+
const [isAssigning, setIsAssigning] = React.useState(false);
|
|
172
|
+
const activeTab = searchParams.get("tab") ?? "all";
|
|
173
|
+
const urlViewMode = searchParams.get("view");
|
|
174
|
+
const [viewMode, setViewMode] = useProjectsViewMode({
|
|
175
|
+
userKey: null,
|
|
176
|
+
urlOverride: urlViewMode
|
|
177
|
+
});
|
|
178
|
+
const grantedFeatures = React.useMemo(
|
|
179
|
+
() => chromePayload?.grantedFeatures ?? [],
|
|
180
|
+
[chromePayload?.grantedFeatures]
|
|
181
|
+
);
|
|
182
|
+
const canManageProjects = hasAllFeatures(grantedFeatures, [MANAGE_FEATURE]);
|
|
183
|
+
const canViewRates = hasAllFeatures(grantedFeatures, [RATES_FEATURE]);
|
|
184
|
+
const canCreateReports = hasAllFeatures(grantedFeatures, REPORTS_FEATURES);
|
|
185
|
+
const canSelectRows = canManageProjects || canCreateReports;
|
|
186
|
+
const labels = React.useMemo(
|
|
187
|
+
() => ({
|
|
188
|
+
title: t("staff.timesheets.projects.page.title", "Projects"),
|
|
189
|
+
table: {
|
|
190
|
+
name: t("staff.timesheets.projects.table.name", "Project"),
|
|
191
|
+
status: t("staff.timesheets.projects.table.status", "Status"),
|
|
192
|
+
type: t("staff.timesheets.projects.table.type", "Type"),
|
|
193
|
+
updatedAt: t("staff.timesheets.projects.table.updatedAt", "Updated"),
|
|
194
|
+
empty: t("staff.timesheets.projects.table.empty", "No projects yet."),
|
|
195
|
+
search: t("staff.timesheets.projects.table.search", "Search projects..."),
|
|
196
|
+
team: t("staff.timesheets.projects.portfolio.team", "Team"),
|
|
197
|
+
myRole: t("staff.timesheets.projects.portfolio.myRole", "My role"),
|
|
198
|
+
hoursWeek: t("staff.timesheets.projects.portfolio.hoursWeek", "Hours / week"),
|
|
199
|
+
myHoursWeek: t("staff.timesheets.projects.portfolio.myHoursWeek", "My hours / week"),
|
|
200
|
+
customer: t("staff.time_tracking.projects.columns.customer", "Customer"),
|
|
201
|
+
rate: t("staff.time_tracking.projects.columns.rate", "Rate"),
|
|
202
|
+
hours: t("staff.time_tracking.projects.columns.hours", "Hours"),
|
|
203
|
+
cost: t("staff.time_tracking.projects.columns.cost", "Cost"),
|
|
204
|
+
budget: t("staff.time_tracking.projects.columns.budget", "Budget"),
|
|
205
|
+
selectRow: t("staff.time_tracking.projects.selection.selectRow", "Select project"),
|
|
206
|
+
selectAll: t("staff.time_tracking.projects.selection.selectAll", "Select all projects on this page")
|
|
207
|
+
},
|
|
208
|
+
actions: {
|
|
209
|
+
add: t("staff.timesheets.projects.actions.add", "Add Project"),
|
|
210
|
+
addFirst: t("staff.timesheets.projects.actions.addFirst", "+ Add first project"),
|
|
211
|
+
viewDetails: t("staff.timesheets.projects.actions.viewDetails", "View Details"),
|
|
212
|
+
delete: t("staff.timesheets.projects.actions.delete", "Delete"),
|
|
213
|
+
deleteConfirm: t("staff.timesheets.projects.actions.deleteConfirm", 'Delete project "{{name}}"?'),
|
|
214
|
+
refresh: t("staff.timesheets.projects.actions.refresh", "Refresh"),
|
|
215
|
+
assignCustomer: t("staff.time_tracking.projects.actions.assignCustomer", "Assign a customer")
|
|
216
|
+
},
|
|
217
|
+
messages: {
|
|
218
|
+
deleted: t("staff.timesheets.projects.messages.deleted", "Project deleted.")
|
|
219
|
+
},
|
|
220
|
+
errors: {
|
|
221
|
+
load: t("staff.timesheets.projects.errors.load", "Failed to load projects."),
|
|
222
|
+
delete: t("staff.timesheets.projects.errors.delete", "Failed to delete project.")
|
|
223
|
+
},
|
|
224
|
+
statuses: {
|
|
225
|
+
all: t("staff.timesheets.projects.statuses.all", "All"),
|
|
226
|
+
active: t("staff.timesheets.projects.statuses.active", "Active"),
|
|
227
|
+
on_hold: t("staff.timesheets.projects.statuses.onHold", "On Hold"),
|
|
228
|
+
completed: t("staff.timesheets.projects.statuses.completed", "Completed")
|
|
229
|
+
},
|
|
230
|
+
tabs: {
|
|
231
|
+
all: t("staff.timesheets.projects.portfolio.tabs.all", "All"),
|
|
232
|
+
active: t("staff.timesheets.projects.portfolio.tabs.active", "Active"),
|
|
233
|
+
onHold: t("staff.timesheets.projects.portfolio.tabs.onHold", "On Hold"),
|
|
234
|
+
completed: t("staff.timesheets.projects.portfolio.tabs.completed", "Completed"),
|
|
235
|
+
mine: t("staff.timesheets.projects.portfolio.tabs.mine", "Mine")
|
|
236
|
+
},
|
|
237
|
+
viewMode: {
|
|
238
|
+
table: t("staff.timesheets.projects.portfolio.viewMode.table", "Table"),
|
|
239
|
+
cards: t("staff.timesheets.projects.portfolio.viewMode.cards", "Cards")
|
|
240
|
+
},
|
|
241
|
+
kpi: {
|
|
242
|
+
totalProjects: t("staff.timesheets.projects.portfolio.kpi.totalProjects", "Total Projects"),
|
|
243
|
+
hoursWeek: t("staff.timesheets.projects.portfolio.kpi.hoursWeek", "Hours this week"),
|
|
244
|
+
hoursWeekSub: t("staff.timesheets.projects.portfolio.kpi.hoursWeekSub", "vs previous week"),
|
|
245
|
+
assignedToMe: t("staff.timesheets.projects.portfolio.kpi.assignedToMe", "Assigned to me"),
|
|
246
|
+
hoursMonth: t("staff.timesheets.projects.portfolio.kpi.hoursMonth", "Hours this month"),
|
|
247
|
+
hoursMonthSub: t("staff.timesheets.projects.portfolio.kpi.hoursMonthSub", "vs previous month"),
|
|
248
|
+
teamActive: t("staff.timesheets.projects.portfolio.kpi.teamActive", "Active team"),
|
|
249
|
+
teamActiveSub: t("staff.timesheets.projects.portfolio.kpi.teamActiveSub", "Members with entries this month"),
|
|
250
|
+
myProjects: t("staff.timesheets.projects.portfolio.kpi.myProjects", "My projects"),
|
|
251
|
+
myHoursWeek: t("staff.timesheets.projects.portfolio.kpi.myHoursWeek", "My hours this week"),
|
|
252
|
+
myHoursMonth: t("staff.timesheets.projects.portfolio.kpi.myHoursMonth", "My hours this month"),
|
|
253
|
+
deltaFlat: t("staff.timesheets.projects.portfolio.kpi.deltaFlat", "no change"),
|
|
254
|
+
noPrevious: t("staff.timesheets.projects.portfolio.kpi.noPrevious", "no previous data")
|
|
255
|
+
},
|
|
256
|
+
card: {
|
|
257
|
+
hoursPanelPm: t("staff.timesheets.projects.portfolio.card.hoursPanelPm", "Team hours \xB7 last 7w"),
|
|
258
|
+
hoursPanelCollab: t("staff.timesheets.projects.portfolio.card.hoursPanelCollab", "My hours \xB7 last 7w"),
|
|
259
|
+
sparklineAria: t("staff.timesheets.projects.portfolio.sparkline.ariaLabel", "Hours per week, last 7 weeks"),
|
|
260
|
+
role: t("staff.timesheets.projects.portfolio.card.role", "Role")
|
|
261
|
+
},
|
|
262
|
+
emptyState: {
|
|
263
|
+
noProjects: t("staff.timesheets.projects.portfolio.emptyState.noProjects", "No projects yet."),
|
|
264
|
+
noAssignments: t(
|
|
265
|
+
"staff.timesheets.projects.portfolio.emptyState.noAssignments",
|
|
266
|
+
"You aren't assigned to any projects yet. Ask a PM to add you."
|
|
267
|
+
),
|
|
268
|
+
noMatches: t("staff.timesheets.projects.portfolio.emptyState.noMatches", "No projects match these filters.")
|
|
269
|
+
},
|
|
270
|
+
budget: {
|
|
271
|
+
none: t("staff.time_tracking.projects.budget.none", "no budget"),
|
|
272
|
+
aria: t("staff.time_tracking.projects.budget.ariaLabel", "Budget usage")
|
|
273
|
+
},
|
|
274
|
+
bulk: {
|
|
275
|
+
report: t("staff.time_tracking.projects.bulk.report", "Report from selected"),
|
|
276
|
+
assignMembers: t("staff.time_tracking.projects.bulk.assignMembers", "Assign members"),
|
|
277
|
+
clear: t("staff.time_tracking.projects.bulk.clear", "Clear")
|
|
278
|
+
},
|
|
279
|
+
assign: {
|
|
280
|
+
title: t("staff.time_tracking.projects.assignMembers.title", "Assign members"),
|
|
281
|
+
searchPlaceholder: t("staff.timesheets.projects.employees.searchEmployee", "Search team members..."),
|
|
282
|
+
empty: t("staff.timesheets.projects.employees.noResults", "No team members found"),
|
|
283
|
+
loadError: t(
|
|
284
|
+
"staff.time_tracking.projects.assignMembers.loadError",
|
|
285
|
+
"Could not load team members. Check your connection and try again."
|
|
286
|
+
),
|
|
287
|
+
loading: t("staff.timesheets.projects.employees.loading", "Loading employees..."),
|
|
288
|
+
role: t("staff.timesheets.projects.employees.roleOnProject", "Role on Project"),
|
|
289
|
+
rolePlaceholder: t("staff.timesheets.projects.employees.rolePlaceholder", "e.g. Developer, Designer..."),
|
|
290
|
+
startDate: t("staff.timesheets.projects.employees.assignmentStartDate", "Assignment Start Date"),
|
|
291
|
+
cancel: t("staff.timesheets.projects.form.actions.cancel", "Cancel"),
|
|
292
|
+
confirm: t("staff.time_tracking.projects.assignMembers.confirm", "Assign"),
|
|
293
|
+
error: t("staff.time_tracking.projects.assignMembers.error", "Failed to assign members."),
|
|
294
|
+
progressName: t("staff.time_tracking.projects.assignMembers.progressName", "Assign members to projects")
|
|
295
|
+
}
|
|
296
|
+
}),
|
|
297
|
+
[t]
|
|
298
|
+
);
|
|
299
|
+
const kpiLabels = React.useMemo(
|
|
300
|
+
() => ({
|
|
301
|
+
totalProjects: labels.kpi.totalProjects,
|
|
302
|
+
totalProjectsSub: ({ active, onHold }) => `${active} ${labels.statuses.active.toLowerCase()} \xB7 ${onHold} ${labels.statuses.on_hold.toLowerCase()}`,
|
|
303
|
+
hoursWeek: labels.kpi.hoursWeek,
|
|
304
|
+
hoursWeekSub: labels.kpi.hoursWeekSub,
|
|
305
|
+
assignedToMe: labels.kpi.assignedToMe,
|
|
306
|
+
assignedToMeSub: (active) => `${active} ${labels.statuses.active.toLowerCase()}`,
|
|
307
|
+
hoursMonth: labels.kpi.hoursMonth,
|
|
308
|
+
hoursMonthSub: labels.kpi.hoursMonthSub,
|
|
309
|
+
teamActive: labels.kpi.teamActive,
|
|
310
|
+
teamActiveSub: labels.kpi.teamActiveSub,
|
|
311
|
+
myProjects: labels.kpi.myProjects,
|
|
312
|
+
myProjectsSub: (active) => `${active} ${labels.statuses.active.toLowerCase()}`,
|
|
313
|
+
myHoursWeek: labels.kpi.myHoursWeek,
|
|
314
|
+
myHoursMonth: labels.kpi.myHoursMonth,
|
|
315
|
+
deltaUp: (pct) => `up ${pct}%`,
|
|
316
|
+
deltaDown: (pct) => `down ${pct}%`,
|
|
317
|
+
deltaFlat: labels.kpi.deltaFlat,
|
|
318
|
+
noPrevious: labels.kpi.noPrevious
|
|
319
|
+
}),
|
|
320
|
+
[labels]
|
|
321
|
+
);
|
|
322
|
+
const isPmRole = kpis?.role === "pm";
|
|
323
|
+
const filters = React.useMemo(
|
|
324
|
+
() => [
|
|
325
|
+
{
|
|
326
|
+
id: "status",
|
|
327
|
+
label: labels.table.status,
|
|
328
|
+
type: "select",
|
|
329
|
+
options: [
|
|
330
|
+
{ value: "active", label: labels.statuses.active },
|
|
331
|
+
{ value: "on_hold", label: labels.statuses.on_hold },
|
|
332
|
+
{ value: "completed", label: labels.statuses.completed }
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
[labels.table.status, labels.statuses]
|
|
337
|
+
);
|
|
338
|
+
const tabs = React.useMemo(() => {
|
|
339
|
+
const base = [
|
|
340
|
+
{ id: "all", label: labels.tabs.all },
|
|
341
|
+
{ id: "active", label: labels.tabs.active }
|
|
342
|
+
];
|
|
343
|
+
if (isPmRole) {
|
|
344
|
+
base.push({ id: "on_hold", label: labels.tabs.onHold });
|
|
345
|
+
}
|
|
346
|
+
base.push({ id: "completed", label: labels.tabs.completed });
|
|
347
|
+
if (isPmRole) {
|
|
348
|
+
base.push({ id: "mine", label: labels.tabs.mine });
|
|
349
|
+
}
|
|
350
|
+
return base;
|
|
351
|
+
}, [labels.tabs, isPmRole]);
|
|
352
|
+
const statusFromTab = (tabId) => {
|
|
353
|
+
if (tabId === "active" || tabId === "on_hold" || tabId === "completed") return tabId;
|
|
354
|
+
return null;
|
|
355
|
+
};
|
|
356
|
+
const mineFromTab = (tabId) => tabId === "mine" || !isPmRole;
|
|
357
|
+
const loadKpis = React.useCallback(async () => {
|
|
358
|
+
setIsLoadingKpis(true);
|
|
359
|
+
try {
|
|
360
|
+
const payload = await readApiResultOrThrow(
|
|
361
|
+
"/api/staff/timesheets/projects/kpis",
|
|
362
|
+
void 0,
|
|
363
|
+
{
|
|
364
|
+
errorMessage: labels.errors.load,
|
|
365
|
+
fallback: null
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
setKpis(payload);
|
|
369
|
+
} catch {
|
|
370
|
+
setKpis(null);
|
|
371
|
+
} finally {
|
|
372
|
+
setIsLoadingKpis(false);
|
|
373
|
+
}
|
|
374
|
+
}, [labels.errors.load]);
|
|
375
|
+
const loadProjects = React.useCallback(async () => {
|
|
376
|
+
if (hasLoadedOnceRef.current) {
|
|
377
|
+
setIsRefreshing(true);
|
|
378
|
+
} else {
|
|
379
|
+
setIsLoading(true);
|
|
380
|
+
}
|
|
381
|
+
try {
|
|
382
|
+
const params = new URLSearchParams({
|
|
383
|
+
page: String(page),
|
|
384
|
+
pageSize: String(PAGE_SIZE),
|
|
385
|
+
include: INCLUDE_FIELDS
|
|
386
|
+
});
|
|
387
|
+
const sort = sorting[0];
|
|
388
|
+
if (sort?.id) {
|
|
389
|
+
params.set("sortField", sort.id);
|
|
390
|
+
params.set("sortDir", sort.desc ? "desc" : "asc");
|
|
391
|
+
}
|
|
392
|
+
if (search.trim()) params.set("q", search.trim());
|
|
393
|
+
const tabStatus = statusFromTab(activeTab);
|
|
394
|
+
if (tabStatus) params.set("status", tabStatus);
|
|
395
|
+
else if (typeof filterValues.status === "string" && filterValues.status.length > 0) {
|
|
396
|
+
params.set("status", filterValues.status);
|
|
397
|
+
}
|
|
398
|
+
if (mineFromTab(activeTab)) params.set("mine", "1");
|
|
399
|
+
const payload = await readApiResultOrThrow(
|
|
400
|
+
`/api/staff/timesheets/time-projects?${params.toString()}`,
|
|
401
|
+
void 0,
|
|
402
|
+
{ errorMessage: labels.errors.load, fallback: { items: [], total: 0, totalPages: 1 } }
|
|
403
|
+
);
|
|
404
|
+
const items = Array.isArray(payload.items) ? payload.items : [];
|
|
405
|
+
setRows(items.map(mapApiProject));
|
|
406
|
+
setTotal(typeof payload.total === "number" ? payload.total : items.length);
|
|
407
|
+
setTotalIsCapped(payload.totalIsCapped === true);
|
|
408
|
+
setTotalPages(
|
|
409
|
+
typeof payload.totalPages === "number" ? payload.totalPages : Math.max(1, Math.ceil(items.length / PAGE_SIZE))
|
|
410
|
+
);
|
|
411
|
+
} catch (error) {
|
|
412
|
+
logger.error("staff.timesheets.projects.list", { err: error });
|
|
413
|
+
flash(labels.errors.load, "error");
|
|
414
|
+
} finally {
|
|
415
|
+
setIsLoading(false);
|
|
416
|
+
setIsRefreshing(false);
|
|
417
|
+
hasLoadedOnceRef.current = true;
|
|
418
|
+
}
|
|
419
|
+
}, [labels.errors.load, page, search, sorting, filterValues.status, activeTab, isPmRole]);
|
|
420
|
+
React.useEffect(() => {
|
|
421
|
+
void loadKpis();
|
|
422
|
+
}, [loadKpis, scopeVersion, reloadToken]);
|
|
423
|
+
React.useEffect(() => {
|
|
424
|
+
void loadProjects();
|
|
425
|
+
}, [loadProjects, scopeVersion, reloadToken]);
|
|
426
|
+
React.useEffect(() => {
|
|
427
|
+
setSelectedIds([]);
|
|
428
|
+
}, [page, activeTab, search, filterValues.status, scopeVersion]);
|
|
429
|
+
const selectedRows = React.useMemo(
|
|
430
|
+
() => rows.filter((row) => selectedIds.includes(row.id)),
|
|
431
|
+
[rows, selectedIds]
|
|
432
|
+
);
|
|
433
|
+
const reportSelection = React.useMemo(
|
|
434
|
+
() => resolveReportSelection(
|
|
435
|
+
selectedRows.map((row) => ({
|
|
436
|
+
id: row.id,
|
|
437
|
+
name: row.name,
|
|
438
|
+
customerId: row.customerId,
|
|
439
|
+
customerName: row.customerName,
|
|
440
|
+
currencyCode: row.currencyCode
|
|
441
|
+
}))
|
|
442
|
+
),
|
|
443
|
+
[selectedRows]
|
|
444
|
+
);
|
|
445
|
+
const reportBlockedReason = React.useMemo(() => {
|
|
446
|
+
if (reportSelection.ok) return null;
|
|
447
|
+
const offenders = reportSelection.offenders.join(", ");
|
|
448
|
+
if (reportSelection.reason === "multiple_customers") {
|
|
449
|
+
return t(
|
|
450
|
+
"staff.time_tracking.projects.bulk.reportBlocked.multipleCustomers",
|
|
451
|
+
"A report always covers one customer. Selected: {customers}.",
|
|
452
|
+
{ customers: offenders }
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
if (reportSelection.reason === "multiple_currencies") {
|
|
456
|
+
return t(
|
|
457
|
+
"staff.time_tracking.projects.bulk.reportBlocked.multipleCurrencies",
|
|
458
|
+
"A report always covers one currency. Selected: {currencies}.",
|
|
459
|
+
{ currencies: offenders }
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
if (reportSelection.reason === "missing_customer") {
|
|
463
|
+
return t(
|
|
464
|
+
"staff.time_tracking.projects.bulk.reportBlocked.missingCustomer",
|
|
465
|
+
"These projects have no customer yet: {projects}.",
|
|
466
|
+
{ projects: offenders }
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
return null;
|
|
470
|
+
}, [reportSelection, t]);
|
|
471
|
+
const handleTabSelect = React.useCallback(
|
|
472
|
+
(id) => {
|
|
473
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
474
|
+
if (id === "all") params.delete("tab");
|
|
475
|
+
else params.set("tab", id);
|
|
476
|
+
router.replace(`?${params.toString()}`);
|
|
477
|
+
setPage(1);
|
|
478
|
+
},
|
|
479
|
+
[router, searchParams]
|
|
480
|
+
);
|
|
481
|
+
const handleViewModeChange = React.useCallback(
|
|
482
|
+
(next) => {
|
|
483
|
+
setViewMode(next);
|
|
484
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
485
|
+
if (next === "table") params.delete("view");
|
|
486
|
+
else params.set("view", next);
|
|
487
|
+
router.replace(`?${params.toString()}`);
|
|
488
|
+
},
|
|
489
|
+
[router, searchParams, setViewMode]
|
|
490
|
+
);
|
|
491
|
+
const handleSearchChange = React.useCallback((value) => {
|
|
492
|
+
setSearch(value);
|
|
493
|
+
setPage(1);
|
|
494
|
+
}, []);
|
|
495
|
+
const handleFiltersApply = React.useCallback((values) => {
|
|
496
|
+
setFilterValues(values);
|
|
497
|
+
setPage(1);
|
|
498
|
+
}, []);
|
|
499
|
+
const handleFiltersClear = React.useCallback(() => {
|
|
500
|
+
setFilterValues({});
|
|
501
|
+
setPage(1);
|
|
502
|
+
}, []);
|
|
503
|
+
const handleRefresh = React.useCallback(() => {
|
|
504
|
+
setReloadToken((token) => token + 1);
|
|
505
|
+
}, []);
|
|
506
|
+
const projectsMutationContextId = "staff-time-projects-list:assign-members";
|
|
507
|
+
const { runMutation: runProjectsMutation, retryLastMutation: retryProjectsMutation } = useGuardedMutation({
|
|
508
|
+
contextId: projectsMutationContextId,
|
|
509
|
+
blockedMessage: t("ui.forms.flash.saveBlocked", "Save blocked by validation")
|
|
510
|
+
});
|
|
511
|
+
const handleDelete = React.useCallback(
|
|
512
|
+
async (entry) => {
|
|
513
|
+
const message = labels.actions.deleteConfirm.replace("{{name}}", entry.name);
|
|
514
|
+
const confirmed = await confirm({
|
|
515
|
+
title: labels.actions.delete,
|
|
516
|
+
text: message,
|
|
517
|
+
variant: "destructive"
|
|
518
|
+
});
|
|
519
|
+
if (!confirmed) return;
|
|
520
|
+
try {
|
|
521
|
+
await runProjectsMutation({
|
|
522
|
+
operation: () => withScopedApiRequestHeaders(
|
|
523
|
+
buildOptimisticLockHeader(entry.updatedAt),
|
|
524
|
+
() => deleteCrud("staff/timesheets/time-projects", entry.id, { errorMessage: labels.errors.delete })
|
|
525
|
+
),
|
|
526
|
+
context: {
|
|
527
|
+
formId: projectsMutationContextId,
|
|
528
|
+
resourceKind: "staff.time_project",
|
|
529
|
+
resourceId: entry.id,
|
|
530
|
+
retryLastMutation: retryProjectsMutation
|
|
531
|
+
},
|
|
532
|
+
mutationPayload: { id: entry.id }
|
|
533
|
+
});
|
|
534
|
+
flash(labels.messages.deleted, "success");
|
|
535
|
+
handleRefresh();
|
|
536
|
+
} catch (error) {
|
|
537
|
+
if (surfaceRecordConflict(error, t)) {
|
|
538
|
+
handleRefresh();
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
logger.error("staff.timesheets.projects.delete", { err: error });
|
|
542
|
+
flash(labels.errors.delete, "error");
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
[confirm, handleRefresh, projectsMutationContextId, retryProjectsMutation, runProjectsMutation, t, labels.actions.deleteConfirm, labels.actions.delete, labels.errors.delete, labels.messages.deleted]
|
|
546
|
+
);
|
|
547
|
+
const handleAssignMembers = React.useCallback(
|
|
548
|
+
async (input) => {
|
|
549
|
+
const targets = selectedRows;
|
|
550
|
+
if (targets.length === 0 || input.staffMemberIds.length === 0) return;
|
|
551
|
+
setIsAssigning(true);
|
|
552
|
+
try {
|
|
553
|
+
const { succeeded, failures } = await runProjectsMutation({
|
|
554
|
+
operation: () => runBulkDelete(
|
|
555
|
+
targets,
|
|
556
|
+
async (row) => {
|
|
557
|
+
for (const staffMemberId of input.staffMemberIds) {
|
|
558
|
+
await createCrud(
|
|
559
|
+
`staff/timesheets/time-projects/${row.id}/employees`,
|
|
560
|
+
{
|
|
561
|
+
timeProjectId: row.id,
|
|
562
|
+
staffMemberId,
|
|
563
|
+
role: input.role,
|
|
564
|
+
assignedStartDate: input.assignedStartDate
|
|
565
|
+
},
|
|
566
|
+
{ errorMessage: labels.assign.error }
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
fallbackErrorMessage: labels.assign.error,
|
|
572
|
+
logTag: "staff.timesheets.projects.assignMembers",
|
|
573
|
+
progress: {
|
|
574
|
+
jobType: "staff.timesheets.projects.bulk_assign_members",
|
|
575
|
+
name: labels.assign.progressName
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
context: {
|
|
580
|
+
formId: projectsMutationContextId,
|
|
581
|
+
resourceKind: "staff.time_project_member",
|
|
582
|
+
retryLastMutation: retryProjectsMutation
|
|
583
|
+
},
|
|
584
|
+
mutationPayload: {
|
|
585
|
+
projectIds: targets.map((row) => row.id),
|
|
586
|
+
staffMemberIds: input.staffMemberIds
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
if (succeeded.length > 0) {
|
|
590
|
+
flash(
|
|
591
|
+
t("staff.time_tracking.projects.assignMembers.success", "Members assigned to {count} projects.", {
|
|
592
|
+
count: succeeded.length
|
|
593
|
+
}),
|
|
594
|
+
"success"
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
for (const group of groupBulkDeleteFailures(failures)) {
|
|
598
|
+
flash(group.sampleMessage, "error");
|
|
599
|
+
}
|
|
600
|
+
setAssignDialogOpen(false);
|
|
601
|
+
setSelectedIds([]);
|
|
602
|
+
handleRefresh();
|
|
603
|
+
} catch (error) {
|
|
604
|
+
logger.error("staff.timesheets.projects.assignMembers", { err: error });
|
|
605
|
+
flash(labels.assign.error, "error");
|
|
606
|
+
} finally {
|
|
607
|
+
setIsAssigning(false);
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
[
|
|
611
|
+
projectsMutationContextId,
|
|
612
|
+
handleRefresh,
|
|
613
|
+
labels.assign.error,
|
|
614
|
+
labels.assign.progressName,
|
|
615
|
+
retryProjectsMutation,
|
|
616
|
+
runProjectsMutation,
|
|
617
|
+
selectedRows,
|
|
618
|
+
t
|
|
619
|
+
]
|
|
620
|
+
);
|
|
621
|
+
const handleReportFromSelected = React.useCallback(() => {
|
|
622
|
+
if (!reportSelection.ok) return;
|
|
623
|
+
const params = new URLSearchParams({
|
|
624
|
+
customerId: reportSelection.customerId,
|
|
625
|
+
projectIds: reportSelection.projectIds.join(",")
|
|
626
|
+
});
|
|
627
|
+
router.push(`${REPORTS_HREF}?${params.toString()}`);
|
|
628
|
+
}, [reportSelection, router]);
|
|
629
|
+
const toggleRowSelection = React.useCallback((id, checked) => {
|
|
630
|
+
setSelectedIds((prev) => checked ? Array.from(/* @__PURE__ */ new Set([...prev, id])) : prev.filter((value) => value !== id));
|
|
631
|
+
}, []);
|
|
632
|
+
const toggleAllSelection = React.useCallback(
|
|
633
|
+
(checked) => {
|
|
634
|
+
setSelectedIds(checked ? rows.map((row) => row.id) : []);
|
|
635
|
+
},
|
|
636
|
+
[rows]
|
|
637
|
+
);
|
|
638
|
+
const allSelected = rows.length > 0 && selectedIds.length === rows.length;
|
|
639
|
+
const someSelected = selectedIds.length > 0 && !allSelected;
|
|
640
|
+
const columns = React.useMemo(() => {
|
|
641
|
+
const rightHeader = (label) => () => /* @__PURE__ */ jsx("span", { className: "block text-right", children: label });
|
|
642
|
+
const defs = [];
|
|
643
|
+
if (canSelectRows) {
|
|
644
|
+
defs.push({
|
|
645
|
+
id: "select",
|
|
646
|
+
accessorKey: "id",
|
|
647
|
+
header: () => /* @__PURE__ */ jsx(
|
|
648
|
+
Checkbox,
|
|
649
|
+
{
|
|
650
|
+
checked: allSelected ? true : someSelected ? "indeterminate" : false,
|
|
651
|
+
onCheckedChange: (checked) => toggleAllSelection(Boolean(checked)),
|
|
652
|
+
"aria-label": labels.table.selectAll
|
|
653
|
+
}
|
|
654
|
+
),
|
|
655
|
+
enableSorting: false,
|
|
656
|
+
meta: { priority: 1 },
|
|
657
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(
|
|
658
|
+
Checkbox,
|
|
659
|
+
{
|
|
660
|
+
checked: selectedIds.includes(row.original.id),
|
|
661
|
+
onCheckedChange: (checked) => toggleRowSelection(row.original.id, Boolean(checked)),
|
|
662
|
+
onClick: (event) => event.stopPropagation(),
|
|
663
|
+
"aria-label": labels.table.selectRow
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
defs.push({
|
|
669
|
+
accessorKey: "name",
|
|
670
|
+
header: labels.table.name,
|
|
671
|
+
meta: { priority: 1 },
|
|
672
|
+
cell: ({ row }) => {
|
|
673
|
+
const startDate = row.original.startDate ? formatDate(row.original.startDate) : null;
|
|
674
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
675
|
+
/* @__PURE__ */ jsx(ProjectColorDot, { colorKey: row.original.color, projectName: row.original.name, size: "sm" }),
|
|
676
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
677
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: row.original.name }),
|
|
678
|
+
/* @__PURE__ */ jsxs("span", { className: "truncate font-mono text-xs text-muted-foreground", children: [
|
|
679
|
+
row.original.code ?? "\u2014",
|
|
680
|
+
startDate ? ` \xB7 ${startDate}` : ""
|
|
681
|
+
] })
|
|
682
|
+
] })
|
|
683
|
+
] });
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
defs.push({
|
|
687
|
+
accessorKey: "customerName",
|
|
688
|
+
id: "customerName",
|
|
689
|
+
header: labels.table.customer,
|
|
690
|
+
enableSorting: false,
|
|
691
|
+
meta: { priority: 2 },
|
|
692
|
+
cell: ({ row }) => {
|
|
693
|
+
if (row.original.customerName) {
|
|
694
|
+
return /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: row.original.customerName });
|
|
695
|
+
}
|
|
696
|
+
if (canManageProjects && !row.original.customerId) {
|
|
697
|
+
return /* @__PURE__ */ jsx(
|
|
698
|
+
Link,
|
|
699
|
+
{
|
|
700
|
+
href: `/backend/staff/time-tracking/projects/${row.original.id}/edit`,
|
|
701
|
+
className: "text-sm text-primary underline-offset-2 hover:underline",
|
|
702
|
+
onClick: (event) => event.stopPropagation(),
|
|
703
|
+
children: labels.actions.assignCustomer
|
|
704
|
+
}
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
return /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground/70", children: "\u2014" });
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
defs.push({
|
|
711
|
+
accessorKey: "status",
|
|
712
|
+
header: labels.table.status,
|
|
713
|
+
meta: { priority: 3 },
|
|
714
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(StatusBadge, { variant: STATUS_VARIANTS[row.original.status] ?? "neutral", dot: true, children: labels.statuses[row.original.status] ?? row.original.status })
|
|
715
|
+
});
|
|
716
|
+
defs.push(
|
|
717
|
+
isPmRole ? {
|
|
718
|
+
accessorKey: "members",
|
|
719
|
+
id: "members",
|
|
720
|
+
header: labels.table.team,
|
|
721
|
+
enableSorting: false,
|
|
722
|
+
meta: { priority: 4 },
|
|
723
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(
|
|
724
|
+
ProjectMembersAvatarStack,
|
|
725
|
+
{
|
|
726
|
+
members: row.original.members,
|
|
727
|
+
total: row.original.memberCount,
|
|
728
|
+
peopleCountLabel: `${row.original.memberCount}`
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
} : {
|
|
732
|
+
accessorKey: "myRole",
|
|
733
|
+
header: labels.table.myRole,
|
|
734
|
+
enableSorting: false,
|
|
735
|
+
meta: { priority: 4 },
|
|
736
|
+
cell: ({ row }) => row.original.myRole ? /* @__PURE__ */ jsx("span", { className: "text-sm text-foreground", children: row.original.myRole }) : /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground/70", children: "\u2014" })
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
if (canViewRates) {
|
|
740
|
+
defs.push({
|
|
741
|
+
accessorKey: "hourlyRate",
|
|
742
|
+
id: "hourlyRate",
|
|
743
|
+
header: rightHeader(labels.table.rate),
|
|
744
|
+
enableSorting: false,
|
|
745
|
+
meta: { priority: 5 },
|
|
746
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "block text-right font-mono text-sm tabular-nums text-foreground", children: formatCurrency(row.original.hourlyRate, row.original.currencyCode) ?? "\u2014" })
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
defs.push({
|
|
750
|
+
accessorKey: "totalMinutes",
|
|
751
|
+
id: "totalMinutes",
|
|
752
|
+
header: rightHeader(labels.table.hours),
|
|
753
|
+
enableSorting: false,
|
|
754
|
+
meta: { priority: 5 },
|
|
755
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "block text-right font-mono text-sm font-semibold tabular-nums text-foreground", children: row.original.totalMinutes > 0 ? formatDuration(row.original.totalMinutes, "clock") : "\u2014" })
|
|
756
|
+
});
|
|
757
|
+
if (canViewRates) {
|
|
758
|
+
defs.push({
|
|
759
|
+
accessorKey: "cost",
|
|
760
|
+
id: "cost",
|
|
761
|
+
header: rightHeader(labels.table.cost),
|
|
762
|
+
enableSorting: false,
|
|
763
|
+
meta: { priority: 5 },
|
|
764
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "block text-right font-mono text-sm tabular-nums text-foreground", children: formatCurrency(row.original.cost, row.original.currencyCode) ?? "\u2014" })
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
defs.push({
|
|
768
|
+
accessorKey: "budgetValue",
|
|
769
|
+
id: "budget",
|
|
770
|
+
header: labels.table.budget,
|
|
771
|
+
enableSorting: false,
|
|
772
|
+
meta: { priority: 5 },
|
|
773
|
+
cell: ({ row }) => {
|
|
774
|
+
if (row.original.budgetKind === "amount" && !canViewRates) {
|
|
775
|
+
return /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "\u2014" });
|
|
776
|
+
}
|
|
777
|
+
const burn = computeBudgetBurn({
|
|
778
|
+
kind: row.original.budgetKind,
|
|
779
|
+
budgetValue: row.original.budgetValue,
|
|
780
|
+
warnAtPercent: row.original.budgetWarnAtPercent,
|
|
781
|
+
totalMinutes: row.original.totalMinutes,
|
|
782
|
+
cost: row.original.cost
|
|
783
|
+
});
|
|
784
|
+
const budgetLabel = burn ? burn.kind === "hours" ? t("staff.time_tracking.projects.budget.hoursValue", "{value} h", {
|
|
785
|
+
value: Math.round(burn.budgetValue * 10) / 10
|
|
786
|
+
}) : formatCurrency(burn.budgetValue, row.original.currencyCode) ?? `${burn.budgetValue}` : null;
|
|
787
|
+
return /* @__PURE__ */ jsx(
|
|
788
|
+
ProjectBudgetCell,
|
|
789
|
+
{
|
|
790
|
+
burn,
|
|
791
|
+
usageLabel: burn ? t("staff.time_tracking.projects.budget.usage", "{percent}% of {value}", {
|
|
792
|
+
percent: burn.percent,
|
|
793
|
+
value: budgetLabel ?? ""
|
|
794
|
+
}) : null,
|
|
795
|
+
noBudgetLabel: labels.budget.none,
|
|
796
|
+
ariaLabel: labels.budget.aria
|
|
797
|
+
}
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
defs.push({
|
|
802
|
+
accessorKey: "hoursWeek",
|
|
803
|
+
header: isPmRole ? labels.table.hoursWeek : labels.table.myHoursWeek,
|
|
804
|
+
enableSorting: false,
|
|
805
|
+
meta: { priority: 6 },
|
|
806
|
+
cell: ({ row }) => {
|
|
807
|
+
const stripe = resolveProjectColorHex(row.original.color, row.original.name);
|
|
808
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
809
|
+
/* @__PURE__ */ jsx(
|
|
810
|
+
HoursSparkline,
|
|
811
|
+
{
|
|
812
|
+
values: row.original.hoursTrend,
|
|
813
|
+
color: stripe,
|
|
814
|
+
ariaLabel: labels.card.sparklineAria
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium tabular-nums text-foreground", children: row.original.hoursWeek > 0 ? `${row.original.hoursWeek}h` : "\u2014" })
|
|
818
|
+
] });
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
defs.push({
|
|
822
|
+
accessorKey: "projectType",
|
|
823
|
+
header: labels.table.type,
|
|
824
|
+
meta: { priority: 7 },
|
|
825
|
+
cell: ({ row }) => row.original.projectType ? /* @__PURE__ */ jsx("span", { className: "text-sm text-foreground", children: row.original.projectType }) : /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground/70", children: "\u2014" })
|
|
826
|
+
});
|
|
827
|
+
defs.push({
|
|
828
|
+
accessorKey: "updatedAt",
|
|
829
|
+
header: labels.table.updatedAt,
|
|
830
|
+
meta: { priority: 8 },
|
|
831
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: formatRelativeTime(row.original.updatedAt, "\u2014", t) })
|
|
832
|
+
});
|
|
833
|
+
return defs;
|
|
834
|
+
}, [
|
|
835
|
+
allSelected,
|
|
836
|
+
canManageProjects,
|
|
837
|
+
canSelectRows,
|
|
838
|
+
canViewRates,
|
|
839
|
+
isPmRole,
|
|
840
|
+
labels,
|
|
841
|
+
selectedIds,
|
|
842
|
+
someSelected,
|
|
843
|
+
t,
|
|
844
|
+
toggleAllSelection,
|
|
845
|
+
toggleRowSelection
|
|
846
|
+
]);
|
|
847
|
+
const cardLabels = React.useMemo(
|
|
848
|
+
() => ({
|
|
849
|
+
hoursPanelPm: labels.card.hoursPanelPm,
|
|
850
|
+
hoursPanelCollab: labels.card.hoursPanelCollab,
|
|
851
|
+
sparklineAria: labels.card.sparklineAria,
|
|
852
|
+
peopleCount: (count) => `${count}`,
|
|
853
|
+
role: labels.card.role,
|
|
854
|
+
noCustomer: "\u2014",
|
|
855
|
+
statuses: labels.statuses
|
|
856
|
+
}),
|
|
857
|
+
[labels.card, labels.statuses]
|
|
858
|
+
);
|
|
859
|
+
const emptyStateCopy = React.useMemo(() => {
|
|
860
|
+
const hasFiltersApplied = activeTab !== "all" || search.trim().length > 0 || Object.values(filterValues).some(Boolean);
|
|
861
|
+
if (hasFiltersApplied) return labels.emptyState.noMatches;
|
|
862
|
+
if (!canManageProjects) return labels.emptyState.noAssignments;
|
|
863
|
+
return labels.emptyState.noProjects;
|
|
864
|
+
}, [activeTab, search, filterValues, canManageProjects, labels.emptyState]);
|
|
865
|
+
const cardsData = rows.map((row) => ({
|
|
866
|
+
id: row.id,
|
|
867
|
+
name: row.name,
|
|
868
|
+
code: row.code,
|
|
869
|
+
customerName: row.customerName,
|
|
870
|
+
color: row.color,
|
|
871
|
+
status: row.status,
|
|
872
|
+
hoursWeek: row.hoursWeek,
|
|
873
|
+
hoursTrend: row.hoursTrend,
|
|
874
|
+
members: row.members,
|
|
875
|
+
memberCount: row.memberCount,
|
|
876
|
+
myRole: row.myRole,
|
|
877
|
+
updatedAt: row.updatedAt
|
|
878
|
+
}));
|
|
879
|
+
const tableToolbar = /* @__PURE__ */ jsx(
|
|
880
|
+
FilterBar,
|
|
881
|
+
{
|
|
882
|
+
searchValue: search,
|
|
883
|
+
onSearchChange: handleSearchChange,
|
|
884
|
+
searchPlaceholder: labels.table.search,
|
|
885
|
+
filters,
|
|
886
|
+
values: filterValues,
|
|
887
|
+
onApply: handleFiltersApply,
|
|
888
|
+
onClear: handleFiltersClear,
|
|
889
|
+
trailingItems: canSelectRows ? /* @__PURE__ */ jsx(
|
|
890
|
+
ProjectsBulkActionsBar,
|
|
891
|
+
{
|
|
892
|
+
selectedCount: selectedIds.length,
|
|
893
|
+
labels: {
|
|
894
|
+
selectedCount: t("staff.time_tracking.projects.bulk.selectedCount", "{count} selected", {
|
|
895
|
+
count: selectedIds.length
|
|
896
|
+
}),
|
|
897
|
+
report: labels.bulk.report,
|
|
898
|
+
assignMembers: labels.bulk.assignMembers,
|
|
899
|
+
clear: labels.bulk.clear
|
|
900
|
+
},
|
|
901
|
+
canReport: canCreateReports,
|
|
902
|
+
canAssignMembers: canManageProjects,
|
|
903
|
+
reportBlockedReason,
|
|
904
|
+
isBusy: isAssigning,
|
|
905
|
+
onReport: handleReportFromSelected,
|
|
906
|
+
onAssignMembers: () => setAssignDialogOpen(true),
|
|
907
|
+
onClear: () => setSelectedIds([])
|
|
908
|
+
}
|
|
909
|
+
) : null
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
return /* @__PURE__ */ jsxs(Page, { children: [
|
|
913
|
+
/* @__PURE__ */ jsxs(PageBody, { children: [
|
|
914
|
+
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx(ProjectsKpiStrip, { kpis, labels: kpiLabels, isLoading: isLoadingKpis }) }),
|
|
915
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex flex-wrap items-center justify-between gap-3", children: [
|
|
916
|
+
/* @__PURE__ */ jsx(
|
|
917
|
+
SavedViewTabs,
|
|
918
|
+
{
|
|
919
|
+
tabs,
|
|
920
|
+
activeId: activeTab,
|
|
921
|
+
onSelect: handleTabSelect,
|
|
922
|
+
ariaLabel: t("staff.timesheets.projects.portfolio.savedViews.ariaLabel", "Saved views")
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ jsx(
|
|
926
|
+
ViewModeToggle,
|
|
927
|
+
{
|
|
928
|
+
mode: viewMode,
|
|
929
|
+
onChange: handleViewModeChange,
|
|
930
|
+
tableLabel: labels.viewMode.table,
|
|
931
|
+
cardsLabel: labels.viewMode.cards,
|
|
932
|
+
ariaLabel: t("staff.timesheets.projects.portfolio.viewMode.ariaLabel", "View mode")
|
|
933
|
+
}
|
|
934
|
+
)
|
|
935
|
+
] }),
|
|
936
|
+
viewMode === "cards" ? /* @__PURE__ */ jsx("div", { children: isLoading ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3", children: Array.from({ length: 6 }).map((_, idx) => /* @__PURE__ */ jsx("div", { className: "h-48 animate-pulse rounded-lg border border-border bg-muted/40" }, idx)) }) : rows.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-border bg-card p-10 text-center", children: [
|
|
937
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: emptyStateCopy }),
|
|
938
|
+
canManageProjects ? /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", children: /* @__PURE__ */ jsx(Link, { href: "/backend/staff/time-tracking/projects/create", children: labels.actions.addFirst }) }) }) : null
|
|
939
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3", children: cardsData.map((card) => /* @__PURE__ */ jsx(
|
|
940
|
+
ProjectCard,
|
|
941
|
+
{
|
|
942
|
+
data: card,
|
|
943
|
+
labels: cardLabels,
|
|
944
|
+
showTeam: isPmRole,
|
|
945
|
+
href: `/backend/staff/time-tracking/projects/${card.id}`
|
|
946
|
+
},
|
|
947
|
+
card.id
|
|
948
|
+
)) }) }) : /* @__PURE__ */ jsx(
|
|
949
|
+
DataTable,
|
|
950
|
+
{
|
|
951
|
+
extensionTableId: extensionPoints.hosts.timeProjectsTable.tableId,
|
|
952
|
+
title: labels.title,
|
|
953
|
+
titleHeadingLevel: 1,
|
|
954
|
+
data: rows,
|
|
955
|
+
columns,
|
|
956
|
+
isLoading,
|
|
957
|
+
toolbar: tableToolbar,
|
|
958
|
+
emptyState: /* @__PURE__ */ jsxs("div", { className: "py-12 text-center", children: [
|
|
959
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: emptyStateCopy }),
|
|
960
|
+
canManageProjects ? /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", children: /* @__PURE__ */ jsx(Link, { href: "/backend/staff/time-tracking/projects/create", children: labels.actions.addFirst }) }) : null
|
|
961
|
+
] }),
|
|
962
|
+
actions: canManageProjects ? /* @__PURE__ */ jsx(Button, { asChild: true, size: "sm", children: /* @__PURE__ */ jsx(Link, { href: "/backend/staff/time-tracking/projects/create", children: labels.actions.add }) }) : void 0,
|
|
963
|
+
refreshButton: {
|
|
964
|
+
label: labels.actions.refresh,
|
|
965
|
+
onRefresh: handleRefresh,
|
|
966
|
+
isRefreshing: isLoading || isRefreshing
|
|
967
|
+
},
|
|
968
|
+
sortable: true,
|
|
969
|
+
sorting,
|
|
970
|
+
onSortingChange: setSorting,
|
|
971
|
+
pagination: {
|
|
972
|
+
page,
|
|
973
|
+
pageSize: PAGE_SIZE,
|
|
974
|
+
total,
|
|
975
|
+
totalIsCapped,
|
|
976
|
+
totalPages,
|
|
977
|
+
onPageChange: setPage
|
|
978
|
+
},
|
|
979
|
+
stickyActionsColumn: true,
|
|
980
|
+
rowActions: (row) => /* @__PURE__ */ jsx(
|
|
981
|
+
RowActions,
|
|
982
|
+
{
|
|
983
|
+
items: [
|
|
984
|
+
{
|
|
985
|
+
id: "view",
|
|
986
|
+
label: labels.actions.viewDetails,
|
|
987
|
+
href: `/backend/staff/time-tracking/projects/${row.id}`
|
|
988
|
+
},
|
|
989
|
+
...canManageProjects ? [
|
|
990
|
+
{
|
|
991
|
+
id: "delete",
|
|
992
|
+
label: labels.actions.delete,
|
|
993
|
+
destructive: true,
|
|
994
|
+
onSelect: () => {
|
|
995
|
+
void handleDelete(row);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
] : []
|
|
999
|
+
]
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
onRowClick: (row) => router.push(`/backend/staff/time-tracking/projects/${row.id}`)
|
|
1003
|
+
}
|
|
1004
|
+
)
|
|
1005
|
+
] }),
|
|
1006
|
+
canManageProjects ? /* @__PURE__ */ jsx(
|
|
1007
|
+
AssignMembersDialog,
|
|
1008
|
+
{
|
|
1009
|
+
open: assignDialogOpen,
|
|
1010
|
+
onOpenChange: setAssignDialogOpen,
|
|
1011
|
+
isSaving: isAssigning,
|
|
1012
|
+
labels: {
|
|
1013
|
+
title: labels.assign.title,
|
|
1014
|
+
description: t(
|
|
1015
|
+
"staff.time_tracking.projects.assignMembers.description",
|
|
1016
|
+
"Selected projects: {count}.",
|
|
1017
|
+
{ count: selectedIds.length }
|
|
1018
|
+
),
|
|
1019
|
+
searchPlaceholder: labels.assign.searchPlaceholder,
|
|
1020
|
+
empty: labels.assign.empty,
|
|
1021
|
+
loadError: labels.assign.loadError,
|
|
1022
|
+
loading: labels.assign.loading,
|
|
1023
|
+
role: labels.assign.role,
|
|
1024
|
+
rolePlaceholder: labels.assign.rolePlaceholder,
|
|
1025
|
+
startDate: labels.assign.startDate,
|
|
1026
|
+
cancel: labels.assign.cancel,
|
|
1027
|
+
confirm: labels.assign.confirm
|
|
1028
|
+
},
|
|
1029
|
+
onConfirm: (input) => {
|
|
1030
|
+
void handleAssignMembers(input);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
) : null,
|
|
1034
|
+
ConfirmDialogElement
|
|
1035
|
+
] });
|
|
1036
|
+
}
|
|
1037
|
+
export {
|
|
1038
|
+
TimesheetProjectsPage as default
|
|
1039
|
+
};
|
|
1040
|
+
//# sourceMappingURL=page.js.map
|