@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
|
@@ -1,14 +1,29 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server'
|
|
1
2
|
import { z } from 'zod'
|
|
2
3
|
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
3
|
-
import { makeCrudRoute } from '@open-mercato/shared/lib/crud/factory'
|
|
4
|
+
import { makeCrudRoute, type CrudCtx } from '@open-mercato/shared/lib/crud/factory'
|
|
5
|
+
import { staffTimeProjectCrudEvents } from '../../../lib/crud'
|
|
4
6
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
5
7
|
import { resolveCrudRecordId, parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
6
8
|
import { escapeLikePattern } from '@open-mercato/shared/lib/db/escapeLikePattern'
|
|
7
9
|
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
10
|
+
import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
11
|
+
import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
12
|
+
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
13
|
+
import { isIdsParamProvided, parseIdsParam } from '@open-mercato/shared/lib/crud/ids'
|
|
14
|
+
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
15
|
+
import type { ModuleConfigService } from '@open-mercato/core/modules/configs/lib/module-config-service'
|
|
8
16
|
import { StaffTimeProject, StaffTimeProjectMember, StaffTeamMember } from '../../../data/entities'
|
|
9
17
|
import { staffTimeProjectCreateSchema, staffTimeProjectUpdateSchema } from '../../../data/validators'
|
|
18
|
+
import { resolveFeatureAccess } from '../../../lib/time-tracking/featureAccess'
|
|
19
|
+
import { MANAGE_PROJECTS_FEATURE, resolveProjectAccess, type ProjectAccess } from '../../../lib/time-tracking/access'
|
|
20
|
+
import { readTimeTrackingSettings } from '../../../lib/time-tracking/settings'
|
|
21
|
+
import { buildSqlInClause } from '../../../lib/time-tracking/sqlInClause'
|
|
10
22
|
import { sanitizeSearchTerm, parseBooleanFlag } from '../../helpers'
|
|
11
23
|
import { createStaffCrudOpenApi, createPagedListResponseSchema, defaultOkResponseSchema } from '../../openapi'
|
|
24
|
+
import { E } from '#generated/entities.ids.generated'
|
|
25
|
+
|
|
26
|
+
const logger = createLogger('staff').child({ component: 'api/timesheets/time-projects' })
|
|
12
27
|
|
|
13
28
|
const F = {
|
|
14
29
|
id: 'id',
|
|
@@ -21,9 +36,16 @@ const F = {
|
|
|
21
36
|
color: 'color',
|
|
22
37
|
status: 'status',
|
|
23
38
|
customer_id: 'customer_id',
|
|
39
|
+
customer_snapshot: 'customer_snapshot',
|
|
24
40
|
owner_user_id: 'owner_user_id',
|
|
25
41
|
cost_center: 'cost_center',
|
|
26
42
|
start_date: 'start_date',
|
|
43
|
+
hourly_rate: 'hourly_rate',
|
|
44
|
+
currency_code: 'currency_code',
|
|
45
|
+
billable_by_default: 'billable_by_default',
|
|
46
|
+
budget_kind: 'budget_kind',
|
|
47
|
+
budget_value: 'budget_value',
|
|
48
|
+
budget_warn_at_percent: 'budget_warn_at_percent',
|
|
27
49
|
created_at: 'created_at',
|
|
28
50
|
updated_at: 'updated_at',
|
|
29
51
|
deleted_at: 'deleted_at',
|
|
@@ -56,6 +78,152 @@ const listSchema = z
|
|
|
56
78
|
})
|
|
57
79
|
.passthrough()
|
|
58
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Discriminator returned with the 404 a project-scoped read answers when the
|
|
83
|
+
* caller may not see the record. It is the whole body besides a generic error
|
|
84
|
+
* string: naming the project or the customer here would confirm the resource to
|
|
85
|
+
* someone who has no right to it (screen 17 note 1).
|
|
86
|
+
*
|
|
87
|
+
* Denied and genuinely-missing are deliberately indistinguishable for a caller
|
|
88
|
+
* without `staff.timesheets.projects.manage` — both answer this same 404 — so the
|
|
89
|
+
* endpoint cannot be used to enumerate which project ids exist. The discriminator
|
|
90
|
+
* only tells the client "you are not a member", which is what screen 17 needs to
|
|
91
|
+
* render the request-access affordance; a manager still gets a plain 200-empty
|
|
92
|
+
* for an id that really does not exist.
|
|
93
|
+
*/
|
|
94
|
+
export const NO_PROJECT_ACCESS_REASON = 'no_project_access'
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Non-UUID sentinel used as the "match nothing" id filter. Kept in the shape the
|
|
98
|
+
* `mine=true` branch has always used so both narrowing paths behave identically.
|
|
99
|
+
*/
|
|
100
|
+
const IMPOSSIBLE_PROJECT_ID = '00000000-0000-0000-0000-000000000000'
|
|
101
|
+
|
|
102
|
+
const DENIED_ACCESS: ProjectAccess = { canManageAll: false, projectIds: [], staffMemberId: null }
|
|
103
|
+
|
|
104
|
+
type RbacServiceLike = {
|
|
105
|
+
getGrantedFeatures?: (
|
|
106
|
+
userId: string,
|
|
107
|
+
options: { tenantId: string | null; organizationId: string | null },
|
|
108
|
+
) => Promise<string[]>
|
|
109
|
+
userHasAllFeatures?: (
|
|
110
|
+
userId: string,
|
|
111
|
+
required: string[],
|
|
112
|
+
options: { tenantId: string | null; organizationId: string | null },
|
|
113
|
+
) => Promise<boolean>
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
type ContainerLike = { resolve: (name: string) => unknown }
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Both entry points into a single request — the denial probe on `GET` and the
|
|
120
|
+
* list narrowing in `buildFilters` — must agree on what the caller may see, and
|
|
121
|
+
* neither should pay for the other's lookups. The resolved access is therefore
|
|
122
|
+
* memoised per `Request`; the factory hands `buildFilters` the same object the
|
|
123
|
+
* route received.
|
|
124
|
+
*/
|
|
125
|
+
const accessByRequest = new WeakMap<Request, Promise<ProjectAccess>>()
|
|
126
|
+
|
|
127
|
+
async function resolveGrantedFeatures(
|
|
128
|
+
container: ContainerLike,
|
|
129
|
+
userId: string,
|
|
130
|
+
scope: { tenantId: string; organizationId: string },
|
|
131
|
+
): Promise<string[]> {
|
|
132
|
+
try {
|
|
133
|
+
const rbac = container.resolve('rbacService') as RbacServiceLike | undefined
|
|
134
|
+
if (!rbac?.getGrantedFeatures) return []
|
|
135
|
+
return (await rbac.getGrantedFeatures(userId, scope)) ?? []
|
|
136
|
+
} catch {
|
|
137
|
+
// Fail closed: an unreadable grant set is no grant set, so the caller falls
|
|
138
|
+
// back to their project memberships instead of being treated as a manager.
|
|
139
|
+
return []
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function resolveUnrestricted(
|
|
144
|
+
container: ContainerLike,
|
|
145
|
+
userId: string,
|
|
146
|
+
scope: { tenantId: string; organizationId: string },
|
|
147
|
+
): Promise<boolean> {
|
|
148
|
+
try {
|
|
149
|
+
const rbac = container.resolve('rbacService') as RbacServiceLike | undefined
|
|
150
|
+
if (!rbac?.userHasAllFeatures) return false
|
|
151
|
+
return (await rbac.userHasAllFeatures(userId, [MANAGE_PROJECTS_FEATURE], scope)) === true
|
|
152
|
+
} catch {
|
|
153
|
+
// Fail closed, exactly as the grant lookup does.
|
|
154
|
+
return false
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async function resolveAssignmentGraceDays(
|
|
159
|
+
container: ContainerLike,
|
|
160
|
+
tenantId: string,
|
|
161
|
+
): Promise<number | null> {
|
|
162
|
+
try {
|
|
163
|
+
const configService = container.resolve('moduleConfigService') as ModuleConfigService
|
|
164
|
+
const settings = await readTimeTrackingSettings(configService, { tenantId })
|
|
165
|
+
return settings.access.assignmentGraceDays
|
|
166
|
+
} catch {
|
|
167
|
+
// Fail safe to the documented default rather than widening the window.
|
|
168
|
+
return null
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async function loadProjectAccess(
|
|
173
|
+
container: ContainerLike,
|
|
174
|
+
userId: string | null,
|
|
175
|
+
tenantId: string | null,
|
|
176
|
+
organizationId: string | null,
|
|
177
|
+
): Promise<ProjectAccess> {
|
|
178
|
+
if (!tenantId || !organizationId) return { ...DENIED_ACCESS }
|
|
179
|
+
const scope = { tenantId, organizationId }
|
|
180
|
+
try {
|
|
181
|
+
// One lookup, one authority, and a failure that says so. The two-call version
|
|
182
|
+
// this replaces rescued `canManageAll` but still fed a possibly-empty array
|
|
183
|
+
// into `userFeatures`, which the guards downstream read.
|
|
184
|
+
const access = await resolveFeatureAccess(container, userId, [MANAGE_PROJECTS_FEATURE], scope)
|
|
185
|
+
const em = container.resolve('em') as EntityManager
|
|
186
|
+
return await resolveProjectAccess({
|
|
187
|
+
em: em.fork(),
|
|
188
|
+
userId,
|
|
189
|
+
tenantId,
|
|
190
|
+
organizationId,
|
|
191
|
+
canManageAll: access.allowed,
|
|
192
|
+
userFeatures: access.grantedFeatures,
|
|
193
|
+
assignmentGraceDays: await resolveAssignmentGraceDays(container, tenantId),
|
|
194
|
+
})
|
|
195
|
+
} catch (err) {
|
|
196
|
+
logger.error('staff.timesheets.time-projects access resolution failed', { err })
|
|
197
|
+
return { ...DENIED_ACCESS }
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function resolveRequestProjectAccess(
|
|
202
|
+
request: Request | undefined,
|
|
203
|
+
load: () => Promise<ProjectAccess>,
|
|
204
|
+
): Promise<ProjectAccess> {
|
|
205
|
+
if (!request) return load()
|
|
206
|
+
const cached = accessByRequest.get(request)
|
|
207
|
+
if (cached) return cached
|
|
208
|
+
const pending = load()
|
|
209
|
+
accessByRequest.set(request, pending)
|
|
210
|
+
return pending
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function resolveCtxScope(ctx: CrudCtx): { tenantId: string | null; organizationId: string | null } {
|
|
214
|
+
return {
|
|
215
|
+
tenantId: ctx.auth?.tenantId ?? null,
|
|
216
|
+
organizationId: ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null,
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async function resolveListProjectAccess(ctx: CrudCtx): Promise<ProjectAccess> {
|
|
221
|
+
const { tenantId, organizationId } = resolveCtxScope(ctx)
|
|
222
|
+
return resolveRequestProjectAccess(ctx.request, () =>
|
|
223
|
+
loadProjectAccess(ctx.container, ctx.auth?.sub ?? null, tenantId, organizationId),
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
|
|
59
227
|
async function resolveCallerAssignedProjectIds(
|
|
60
228
|
em: EntityManager,
|
|
61
229
|
userId: string,
|
|
@@ -81,6 +249,98 @@ async function resolveCallerAssignedProjectIds(
|
|
|
81
249
|
return Array.from(new Set(memberships.map((m) => m.timeProjectId)))
|
|
82
250
|
}
|
|
83
251
|
|
|
252
|
+
type ProjectEntryCountRow = {
|
|
253
|
+
time_project_id: string
|
|
254
|
+
entry_count: string | number
|
|
255
|
+
locked_entry_count: string | number
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
type ProjectListItem = {
|
|
259
|
+
id?: unknown
|
|
260
|
+
entryCount?: number
|
|
261
|
+
lockedEntryCount?: number
|
|
262
|
+
currencyLocked?: boolean
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function toCount(value: string | number | null | undefined): number {
|
|
266
|
+
const parsed = typeof value === 'number' ? value : Number(value ?? 0)
|
|
267
|
+
return Number.isFinite(parsed) ? parsed : 0
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* D-3 read-side signal: currency is read-only once hours have been logged, so the
|
|
272
|
+
* project list/detail response carries the reason alongside the value.
|
|
273
|
+
* `currencyLocked` tells the form to render the field read-only behind the explicit
|
|
274
|
+
* change action, `entryCount` names why, and `lockedEntryCount` says whether even
|
|
275
|
+
* that action will be refused (entries frozen in a closed report).
|
|
276
|
+
*
|
|
277
|
+
* One grouped aggregate for the whole page — never a per-row count.
|
|
278
|
+
*/
|
|
279
|
+
export async function decorateProjectCurrencyLock(
|
|
280
|
+
items: ProjectListItem[],
|
|
281
|
+
em: EntityManager,
|
|
282
|
+
scope: { tenantId: string; organizationId: string },
|
|
283
|
+
): Promise<void> {
|
|
284
|
+
const ids = Array.from(
|
|
285
|
+
new Set(items.map((item) => item.id).filter((value): value is string => typeof value === 'string' && value.length > 0)),
|
|
286
|
+
)
|
|
287
|
+
if (ids.length === 0) return
|
|
288
|
+
|
|
289
|
+
const projectIn = buildSqlInClause('time_project_id', ids)
|
|
290
|
+
const rows = (await em.getConnection().execute(
|
|
291
|
+
`
|
|
292
|
+
SELECT time_project_id,
|
|
293
|
+
COUNT(*)::bigint AS entry_count,
|
|
294
|
+
COUNT(locked_report_id)::bigint AS locked_entry_count
|
|
295
|
+
FROM staff_time_entries
|
|
296
|
+
WHERE tenant_id = ?
|
|
297
|
+
AND organization_id = ?
|
|
298
|
+
AND deleted_at IS NULL
|
|
299
|
+
AND ${projectIn.sql}
|
|
300
|
+
GROUP BY time_project_id
|
|
301
|
+
`,
|
|
302
|
+
[scope.tenantId, scope.organizationId, ...projectIn.params],
|
|
303
|
+
)) as ProjectEntryCountRow[]
|
|
304
|
+
|
|
305
|
+
const counts = new Map(rows.map((row) => [row.time_project_id, row]))
|
|
306
|
+
for (const item of items) {
|
|
307
|
+
const row = typeof item.id === 'string' ? counts.get(item.id) : undefined
|
|
308
|
+
const entryCount = toCount(row?.entry_count)
|
|
309
|
+
item.entryCount = entryCount
|
|
310
|
+
item.lockedEntryCount = toCount(row?.locked_entry_count)
|
|
311
|
+
item.currencyLocked = entryCount > 0
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* The list projection doubles as the detail projection (the edit page re-reads this
|
|
317
|
+
* route with `?id=`), so every column the project form round-trips has to be here.
|
|
318
|
+
*/
|
|
319
|
+
export const timeProjectListFields = [
|
|
320
|
+
F.id,
|
|
321
|
+
F.organization_id,
|
|
322
|
+
F.tenant_id,
|
|
323
|
+
F.name,
|
|
324
|
+
F.code,
|
|
325
|
+
F.description,
|
|
326
|
+
F.project_type,
|
|
327
|
+
F.color,
|
|
328
|
+
F.status,
|
|
329
|
+
F.customer_id,
|
|
330
|
+
F.customer_snapshot,
|
|
331
|
+
F.owner_user_id,
|
|
332
|
+
F.cost_center,
|
|
333
|
+
F.start_date,
|
|
334
|
+
F.hourly_rate,
|
|
335
|
+
F.currency_code,
|
|
336
|
+
F.billable_by_default,
|
|
337
|
+
F.budget_kind,
|
|
338
|
+
F.budget_value,
|
|
339
|
+
F.budget_warn_at_percent,
|
|
340
|
+
F.created_at,
|
|
341
|
+
F.updated_at,
|
|
342
|
+
] as const
|
|
343
|
+
|
|
84
344
|
const crud = makeCrudRoute({
|
|
85
345
|
metadata: routeMetadata,
|
|
86
346
|
orm: {
|
|
@@ -90,28 +350,14 @@ const crud = makeCrudRoute({
|
|
|
90
350
|
tenantField: 'tenantId',
|
|
91
351
|
softDeleteField: 'deletedAt',
|
|
92
352
|
},
|
|
353
|
+
events: staffTimeProjectCrudEvents,
|
|
93
354
|
indexer: { entityType: 'staff:staff_time_project' },
|
|
94
355
|
enrichers: { entityId: 'staff:staff_time_project' },
|
|
95
356
|
list: {
|
|
96
357
|
schema: listSchema,
|
|
97
358
|
entityId: 'staff:staff_time_project',
|
|
98
|
-
fields: [
|
|
99
|
-
|
|
100
|
-
F.organization_id,
|
|
101
|
-
F.tenant_id,
|
|
102
|
-
F.name,
|
|
103
|
-
F.code,
|
|
104
|
-
F.description,
|
|
105
|
-
F.project_type,
|
|
106
|
-
F.color,
|
|
107
|
-
F.status,
|
|
108
|
-
F.customer_id,
|
|
109
|
-
F.owner_user_id,
|
|
110
|
-
F.cost_center,
|
|
111
|
-
F.start_date,
|
|
112
|
-
F.created_at,
|
|
113
|
-
F.updated_at,
|
|
114
|
-
],
|
|
359
|
+
fields: [...timeProjectListFields],
|
|
360
|
+
decorateCustomFields: { entityIds: [E.staff.staff_time_project] },
|
|
115
361
|
sortFieldMap: {
|
|
116
362
|
name: F.name,
|
|
117
363
|
code: F.code,
|
|
@@ -143,7 +389,21 @@ const crud = makeCrudRoute({
|
|
|
143
389
|
? narrowIds.filter((id) => assigned.includes(id))
|
|
144
390
|
: assigned
|
|
145
391
|
if (narrowIds.length === 0) {
|
|
146
|
-
filters[F.id] = { $in: [
|
|
392
|
+
filters[F.id] = { $in: [IMPOSSIBLE_PROJECT_ID] }
|
|
393
|
+
return filters
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// Every project-scoped read filters through the one resolver: a caller
|
|
397
|
+
// without `staff.timesheets.projects.manage` only ever sees the projects
|
|
398
|
+
// they are an active member of. A non-member gets no row at all — not a
|
|
399
|
+
// redacted one — so the customer and project name never leave the server.
|
|
400
|
+
const access = await resolveListProjectAccess(ctx)
|
|
401
|
+
if (!access.canManageAll) {
|
|
402
|
+
narrowIds = narrowIds
|
|
403
|
+
? narrowIds.filter((id) => access.projectIds.includes(id))
|
|
404
|
+
: [...access.projectIds]
|
|
405
|
+
if (narrowIds.length === 0) {
|
|
406
|
+
filters[F.id] = { $in: [IMPOSSIBLE_PROJECT_ID] }
|
|
147
407
|
return filters
|
|
148
408
|
}
|
|
149
409
|
}
|
|
@@ -166,6 +426,19 @@ const crud = makeCrudRoute({
|
|
|
166
426
|
return filters
|
|
167
427
|
},
|
|
168
428
|
},
|
|
429
|
+
hooks: {
|
|
430
|
+
afterList: async (res, ctx) => {
|
|
431
|
+
const items = Array.isArray((res as { items?: unknown })?.items)
|
|
432
|
+
? ((res as { items: ProjectListItem[] }).items)
|
|
433
|
+
: []
|
|
434
|
+
if (items.length === 0) return
|
|
435
|
+
const tenantId = ctx.auth?.tenantId ?? null
|
|
436
|
+
const organizationId = ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? null
|
|
437
|
+
if (!tenantId || !organizationId) return
|
|
438
|
+
const em = ctx.container.resolve('em') as EntityManager
|
|
439
|
+
await decorateProjectCurrencyLock(items, em.fork(), { tenantId, organizationId })
|
|
440
|
+
},
|
|
441
|
+
},
|
|
169
442
|
actions: {
|
|
170
443
|
create: {
|
|
171
444
|
commandId: 'staff.timesheets.time_projects.create',
|
|
@@ -199,12 +472,74 @@ const crud = makeCrudRoute({
|
|
|
199
472
|
},
|
|
200
473
|
})
|
|
201
474
|
|
|
202
|
-
|
|
475
|
+
async function buildAccessDenialResponse(): Promise<Response> {
|
|
476
|
+
const { translate } = await resolveTranslations()
|
|
477
|
+
return NextResponse.json(
|
|
478
|
+
{
|
|
479
|
+
// Same string a genuinely missing record gets: the body must not tell the
|
|
480
|
+
// caller which of the two it is beyond the membership discriminator.
|
|
481
|
+
error: translate('staff.timesheets.projects.errors.notFound', 'Project not found.'),
|
|
482
|
+
reason: NO_PROJECT_ACCESS_REASON,
|
|
483
|
+
},
|
|
484
|
+
{ status: 404 },
|
|
485
|
+
)
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* The list route doubles as the detail read (`?ids=<id>`, and defensively `?id=`),
|
|
490
|
+
* so a caller asking for one specific project needs an answer the UI can turn
|
|
491
|
+
* into screen 17 rather than an indistinguishable empty page. Returning 404 for
|
|
492
|
+
* denied *and* unknown ids alike keeps the endpoint useless for enumeration; the
|
|
493
|
+
* `reason` discriminator carries only "you are not a member of this project",
|
|
494
|
+
* never the project or customer it is refusing to describe.
|
|
495
|
+
*/
|
|
496
|
+
async function resolveProjectAccessDenial(req: Request): Promise<Response | null> {
|
|
497
|
+
const url = new URL(req.url)
|
|
498
|
+
const rawIds = url.searchParams.get('ids') ?? url.searchParams.get('id')
|
|
499
|
+
if (!isIdsParamProvided(rawIds)) return null
|
|
500
|
+
const requestedIds = parseIdsParam(rawIds)
|
|
501
|
+
// Malformed ids match nothing on their own; the factory answers an empty list.
|
|
502
|
+
if (requestedIds.length === 0) return null
|
|
503
|
+
|
|
504
|
+
try {
|
|
505
|
+
const container = await createRequestContainer()
|
|
506
|
+
const auth = await getAuthFromRequest(req)
|
|
507
|
+
// Unauthenticated and unscoped requests are the factory's to reject.
|
|
508
|
+
if (!auth) return null
|
|
509
|
+
const orgScope = await resolveOrganizationScopeForRequest({ container, auth, request: req })
|
|
510
|
+
const tenantId = orgScope?.tenantId ?? auth.tenantId ?? null
|
|
511
|
+
const organizationId = orgScope?.selectedId ?? auth.orgId ?? null
|
|
512
|
+
if (!tenantId || !organizationId) return null
|
|
513
|
+
|
|
514
|
+
const access = await resolveRequestProjectAccess(req, () =>
|
|
515
|
+
loadProjectAccess(
|
|
516
|
+
container,
|
|
517
|
+
typeof auth.sub === 'string' ? auth.sub : null,
|
|
518
|
+
tenantId,
|
|
519
|
+
organizationId,
|
|
520
|
+
),
|
|
521
|
+
)
|
|
522
|
+
if (access.canManageAll) return null
|
|
523
|
+
if (requestedIds.some((id) => access.projectIds.includes(id))) return null
|
|
524
|
+
return await buildAccessDenialResponse()
|
|
525
|
+
} catch (err) {
|
|
526
|
+
// Fail closed: an access decision that could not be made is a denial.
|
|
527
|
+
logger.error('staff.timesheets.time-projects denial probe failed', { err })
|
|
528
|
+
return await buildAccessDenialResponse()
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export async function GET(req: Request): Promise<Response> {
|
|
533
|
+
const denial = await resolveProjectAccessDenial(req)
|
|
534
|
+
if (denial) return denial
|
|
535
|
+
return crud.GET(req)
|
|
536
|
+
}
|
|
537
|
+
|
|
203
538
|
export const POST = crud.POST
|
|
204
539
|
export const PUT = crud.PUT
|
|
205
540
|
export const DELETE = crud.DELETE
|
|
206
541
|
|
|
207
|
-
const timeProjectListItemSchema = z.object({
|
|
542
|
+
export const timeProjectListItemSchema = z.object({
|
|
208
543
|
id: z.string().uuid().nullable().optional(),
|
|
209
544
|
organization_id: z.string().uuid().nullable().optional(),
|
|
210
545
|
tenant_id: z.string().uuid().nullable().optional(),
|
|
@@ -215,14 +550,31 @@ const timeProjectListItemSchema = z.object({
|
|
|
215
550
|
color: z.string().nullable().optional(),
|
|
216
551
|
status: z.string().nullable().optional(),
|
|
217
552
|
customer_id: z.string().uuid().nullable().optional(),
|
|
553
|
+
customer_snapshot: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
218
554
|
owner_user_id: z.string().uuid().nullable().optional(),
|
|
219
555
|
cost_center: z.string().nullable().optional(),
|
|
220
556
|
start_date: z.string().nullable().optional(),
|
|
557
|
+
// numeric(14,4) reaches the client as a decimal string; a number stays accepted
|
|
558
|
+
// for callers that read the column through a numeric-casting driver.
|
|
559
|
+
hourly_rate: z.union([z.string(), z.number()]).nullable().optional(),
|
|
560
|
+
currency_code: z.string().nullable().optional(),
|
|
561
|
+
billable_by_default: z.boolean().nullable().optional(),
|
|
562
|
+
budget_kind: z.string().nullable().optional(),
|
|
563
|
+
budget_value: z.union([z.string(), z.number()]).nullable().optional(),
|
|
564
|
+
budget_warn_at_percent: z.number().int().nullable().optional(),
|
|
221
565
|
created_at: z.string().nullable().optional(),
|
|
222
566
|
updated_at: z.string().nullable().optional(),
|
|
567
|
+
entryCount: z.number().int().optional(),
|
|
568
|
+
lockedEntryCount: z.number().int().optional(),
|
|
569
|
+
currencyLocked: z.boolean().optional(),
|
|
570
|
+
})
|
|
571
|
+
|
|
572
|
+
export const projectAccessDeniedResponseSchema = z.object({
|
|
573
|
+
error: z.string(),
|
|
574
|
+
reason: z.literal(NO_PROJECT_ACCESS_REASON),
|
|
223
575
|
})
|
|
224
576
|
|
|
225
|
-
|
|
577
|
+
const baseOpenApi = createStaffCrudOpenApi({
|
|
226
578
|
resourceName: 'TimeProject',
|
|
227
579
|
pluralName: 'Time Projects',
|
|
228
580
|
querySchema: listSchema,
|
|
@@ -242,3 +594,26 @@ export const openApi = createStaffCrudOpenApi({
|
|
|
242
594
|
description: 'Soft-deletes a time project by id.',
|
|
243
595
|
},
|
|
244
596
|
})
|
|
597
|
+
|
|
598
|
+
export const openApi = {
|
|
599
|
+
...baseOpenApi,
|
|
600
|
+
methods: {
|
|
601
|
+
...baseOpenApi.methods,
|
|
602
|
+
...(baseOpenApi.methods?.GET
|
|
603
|
+
? {
|
|
604
|
+
GET: {
|
|
605
|
+
...baseOpenApi.methods.GET,
|
|
606
|
+
description: `${baseOpenApi.methods.GET.description ?? ''} Rows are intersected with the caller's project access: without staff.timesheets.projects.manage only projects the caller is an active member of are returned. Asking for a single id the caller may not see answers 404 with reason=${NO_PROJECT_ACCESS_REASON} and never names the project or its customer; the same 404 covers ids that do not exist, so the endpoint cannot be used to enumerate projects.`.trim(),
|
|
607
|
+
responses: [
|
|
608
|
+
...(baseOpenApi.methods.GET.responses ?? []),
|
|
609
|
+
{
|
|
610
|
+
status: 404,
|
|
611
|
+
description: 'The caller is not a member of the requested project (or it does not exist)',
|
|
612
|
+
schema: projectAccessDeniedResponseSchema,
|
|
613
|
+
},
|
|
614
|
+
],
|
|
615
|
+
},
|
|
616
|
+
}
|
|
617
|
+
: {}),
|
|
618
|
+
},
|
|
619
|
+
} satisfies typeof baseOpenApi
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const metadata = {
|
|
2
|
+
requireAuth: true,
|
|
3
|
+
requireFeatures: ['staff.timesheets.tasks.view'],
|
|
4
|
+
pageTitle: 'Tasks',
|
|
5
|
+
pageTitleKey: 'staff.time_tracking.nav.tasks',
|
|
6
|
+
pageGroup: 'Time tracking',
|
|
7
|
+
pageGroupKey: 'staff.time_tracking.nav.group',
|
|
8
|
+
pageOrder: 30,
|
|
9
|
+
icon: 'layers',
|
|
10
|
+
breadcrumb: [
|
|
11
|
+
{ label: 'Time tracking', labelKey: 'staff.time_tracking.nav.group', href: '/backend/staff/time-tracking' },
|
|
12
|
+
{ label: 'Tasks', labelKey: 'staff.time_tracking.nav.tasks' },
|
|
13
|
+
],
|
|
14
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { useRouter, useSearchParams } from 'next/navigation'
|
|
5
|
+
import { useQuery } from '@tanstack/react-query'
|
|
6
|
+
import { Page, PageBody, PageHeader } from '@open-mercato/ui/backend/Page'
|
|
7
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
|
+
import { EmptyState } from '@open-mercato/ui/primitives/empty-state'
|
|
9
|
+
import {
|
|
10
|
+
Select,
|
|
11
|
+
SelectContent,
|
|
12
|
+
SelectItem,
|
|
13
|
+
SelectTrigger,
|
|
14
|
+
SelectValue,
|
|
15
|
+
} from '@open-mercato/ui/primitives/select'
|
|
16
|
+
import { ErrorMessage, LoadingMessage } from '@open-mercato/ui/backend/detail'
|
|
17
|
+
import { apiCall } from '@open-mercato/ui/backend/utils/apiCall'
|
|
18
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
19
|
+
import { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'
|
|
20
|
+
import { TaskBoardScreen } from '../../../../lib/time-tracking-ui/TaskBoardScreen'
|
|
21
|
+
import { readItems, readString } from '../../../../lib/time-tracking-ui/kanbanBoardData'
|
|
22
|
+
|
|
23
|
+
type BoardProject = {
|
|
24
|
+
id: string
|
|
25
|
+
name: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The module-level Tasks board (screen 6).
|
|
30
|
+
*
|
|
31
|
+
* Columns are per project (D-1), so the board always needs one. This route carries the
|
|
32
|
+
* project in `?projectId=` and falls back to the first project the caller can see; the
|
|
33
|
+
* per-project route renders the same screen with the id already resolved.
|
|
34
|
+
*/
|
|
35
|
+
export default function TimeTrackingBoardPage() {
|
|
36
|
+
const t = useT()
|
|
37
|
+
const router = useRouter()
|
|
38
|
+
const searchParams = useSearchParams()
|
|
39
|
+
const scopeVersion = useOrganizationScopeVersion()
|
|
40
|
+
const requestedProjectId = searchParams?.get('projectId') ?? null
|
|
41
|
+
|
|
42
|
+
const projectsQuery = useQuery<BoardProject[]>({
|
|
43
|
+
queryKey: ['staff', 'time-tracking', 'board', 'projects', `scope:${scopeVersion}`],
|
|
44
|
+
staleTime: 60_000,
|
|
45
|
+
queryFn: async () => {
|
|
46
|
+
const call = await apiCall<Record<string, unknown>>(
|
|
47
|
+
'/api/staff/timesheets/time-projects?page=1&pageSize=100&sortField=name&sortDir=asc',
|
|
48
|
+
)
|
|
49
|
+
// A failed call must not look like an empty project list: the empty state below
|
|
50
|
+
// tells the caller to ask a Team Leader for access, which is the wrong advice for
|
|
51
|
+
// a network error or a 500.
|
|
52
|
+
if (!call.ok) throw new Error(`[internal] staff.time_tracking board projects request failed (${call.status})`)
|
|
53
|
+
return readItems(call.result)
|
|
54
|
+
.map((row) => {
|
|
55
|
+
const id = readString(row, 'id')
|
|
56
|
+
if (!id) return null
|
|
57
|
+
return { id, name: readString(row, 'name') ?? id }
|
|
58
|
+
})
|
|
59
|
+
.filter((project): project is BoardProject => project !== null)
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const projects = projectsQuery.data ?? []
|
|
64
|
+
const activeProject =
|
|
65
|
+
projects.find((project) => project.id === requestedProjectId) ?? projects[0] ?? null
|
|
66
|
+
|
|
67
|
+
const handleProjectChange = React.useCallback(
|
|
68
|
+
(projectId: string) => {
|
|
69
|
+
const params = new URLSearchParams(searchParams?.toString() ?? '')
|
|
70
|
+
params.set('projectId', projectId)
|
|
71
|
+
params.delete('task')
|
|
72
|
+
router.replace(`?${params.toString()}`, { scroll: false })
|
|
73
|
+
},
|
|
74
|
+
[router, searchParams],
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
const projectPicker =
|
|
78
|
+
projects.length > 0 && activeProject ? (
|
|
79
|
+
<Select value={activeProject.id} onValueChange={handleProjectChange}>
|
|
80
|
+
<SelectTrigger
|
|
81
|
+
className="w-64"
|
|
82
|
+
aria-label={t('staff.time_tracking.board.projectPicker', 'Project')}
|
|
83
|
+
>
|
|
84
|
+
<SelectValue />
|
|
85
|
+
</SelectTrigger>
|
|
86
|
+
<SelectContent>
|
|
87
|
+
{projects.map((project) => (
|
|
88
|
+
<SelectItem key={project.id} value={project.id}>
|
|
89
|
+
{project.name}
|
|
90
|
+
</SelectItem>
|
|
91
|
+
))}
|
|
92
|
+
</SelectContent>
|
|
93
|
+
</Select>
|
|
94
|
+
) : null
|
|
95
|
+
|
|
96
|
+
if (projectsQuery.isLoading) {
|
|
97
|
+
return (
|
|
98
|
+
<Page>
|
|
99
|
+
<PageHeader title={t('staff.time_tracking.nav.tasks', 'Tasks')} />
|
|
100
|
+
<PageBody>
|
|
101
|
+
<LoadingMessage label={t('staff.time_tracking.board.loading', 'Loading the board…')} />
|
|
102
|
+
</PageBody>
|
|
103
|
+
</Page>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (projectsQuery.isError) {
|
|
108
|
+
return (
|
|
109
|
+
<Page>
|
|
110
|
+
<PageHeader title={t('staff.time_tracking.nav.tasks', 'Tasks')} />
|
|
111
|
+
<PageBody>
|
|
112
|
+
<ErrorMessage
|
|
113
|
+
label={t('staff.time_tracking.board.projectsLoadError', 'Could not load your projects.')}
|
|
114
|
+
action={
|
|
115
|
+
<Button type="button" variant="outline" size="sm" onClick={() => void projectsQuery.refetch()}>
|
|
116
|
+
{t('staff.time_tracking.board.reload', 'Try again')}
|
|
117
|
+
</Button>
|
|
118
|
+
}
|
|
119
|
+
/>
|
|
120
|
+
</PageBody>
|
|
121
|
+
</Page>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!activeProject) {
|
|
126
|
+
return (
|
|
127
|
+
<Page>
|
|
128
|
+
<PageHeader title={t('staff.time_tracking.nav.tasks', 'Tasks')} />
|
|
129
|
+
<PageBody>
|
|
130
|
+
<EmptyState
|
|
131
|
+
title={t('staff.time_tracking.board.noProject.title', 'No project to show')}
|
|
132
|
+
description={t(
|
|
133
|
+
'staff.time_tracking.board.noProject.description',
|
|
134
|
+
'The board needs a project. Ask a Team Leader for access to one.',
|
|
135
|
+
)}
|
|
136
|
+
/>
|
|
137
|
+
</PageBody>
|
|
138
|
+
</Page>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<Page>
|
|
144
|
+
<TaskBoardScreen
|
|
145
|
+
timeProjectId={activeProject.id}
|
|
146
|
+
projectName={activeProject.name}
|
|
147
|
+
headerActions={projectPicker}
|
|
148
|
+
/>
|
|
149
|
+
</Page>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const metadata = {
|
|
2
|
+
requireAuth: true,
|
|
3
|
+
requireFeatures: ['staff.timesheets.view'],
|
|
4
|
+
pageTitle: 'Time entries',
|
|
5
|
+
pageTitleKey: 'staff.time_tracking.nav.entries',
|
|
6
|
+
pageGroup: 'Time tracking',
|
|
7
|
+
pageGroupKey: 'staff.time_tracking.nav.group',
|
|
8
|
+
pageOrder: 40,
|
|
9
|
+
icon: 'list',
|
|
10
|
+
breadcrumb: [
|
|
11
|
+
{ label: 'Time tracking', labelKey: 'staff.time_tracking.nav.group', href: '/backend/staff/time-tracking' },
|
|
12
|
+
{ label: 'Time entries', labelKey: 'staff.time_tracking.nav.entries' },
|
|
13
|
+
],
|
|
14
|
+
}
|