@open-mercato/core 0.7.1-develop.7178.1.ab93fbaf4e → 0.7.1-develop.7180.1.9717fbbb43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/staff_time_entry/index.js +14 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +2 -2
- package/dist/generated/entities/staff_time_entry_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_entry_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +16 -0
- package/dist/generated/entities/staff_time_project/index.js.map +2 -2
- package/dist/generated/entities/staff_time_report/index.js +57 -0
- package/dist/generated/entities/staff_time_report/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_entry/index.js +27 -0
- package/dist/generated/entities/staff_time_report_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_event/index.js +21 -0
- package/dist/generated/entities/staff_time_report_event/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_project/index.js +15 -0
- package/dist/generated/entities/staff_time_report_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_tag/index.js +21 -0
- package/dist/generated/entities/staff_time_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task/index.js +37 -0
- package/dist/generated/entities/staff_time_task/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_comment/index.js +21 -0
- package/dist/generated/entities/staff_time_task_comment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_status/index.js +29 -0
- package/dist/generated/entities/staff_time_task_status/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_task_tag/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +11 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +149 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +7 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +2 -2
- package/dist/modules/auth/cli.js +16 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js +44 -0
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +1 -28
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +2 -0
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +39 -17
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/start-controls.js +42 -0
- package/dist/modules/data_sync/lib/start-controls.js.map +7 -0
- package/dist/modules/staff/acl.js +9 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/ai-agents.js +142 -0
- package/dist/modules/staff/ai-agents.js.map +7 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js +348 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js.map +7 -0
- package/dist/modules/staff/ai-tools/types.js +54 -0
- package/dist/modules/staff/ai-tools/types.js.map +7 -0
- package/dist/modules/staff/ai-tools.js +8 -0
- package/dist/modules/staff/ai-tools.js.map +7 -0
- package/dist/modules/staff/analytics.js +84 -1
- package/dist/modules/staff/analytics.js.map +2 -2
- package/dist/modules/staff/api/guards.js +37 -3
- package/dist/modules/staff/api/guards.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js +131 -0
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js.map +7 -0
- package/dist/modules/staff/api/portal/time-reports/route.js +179 -0
- package/dist/modules/staff/api/portal/time-reports/route.js.map +7 -0
- package/dist/modules/staff/api/team-members/self/route.js +1 -3
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +174 -0
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js +226 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +15 -8
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +13 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js +42 -0
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js +383 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +14 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +168 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +246 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +183 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +164 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +360 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/route.js +316 -0
- package/dist/modules/staff/api/timesheets/reports/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js +63 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +164 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js +168 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/route.js +199 -0
- package/dist/modules/staff/api/timesheets/settings/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/access.js +76 -0
- package/dist/modules/staff/api/timesheets/tags/access.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +235 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/route.js +160 -0
- package/dist/modules/staff/api/timesheets/tags/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +233 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js +188 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +399 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +210 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js +333 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +228 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +29 -10
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +31 -18
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +21 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +27 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +215 -32
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +378 -0
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +340 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +238 -26
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +23 -8
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +209 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +59 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +264 -22
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js +110 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js +981 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js +583 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js +15 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js +65 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js +229 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js +1014 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js +97 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js +1040 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js +19 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js +353 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js +457 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js +697 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js +174 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js +546 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js +710 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js +646 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +4 -793
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +2 -7
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +5 -136
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +5 -445
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +3 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +4 -76
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +4 -613
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +2 -17
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +2 -2
- package/dist/modules/staff/ce.js +40 -0
- package/dist/modules/staff/ce.js.map +2 -2
- package/dist/modules/staff/cli.js +166 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +5 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +569 -21
- package/dist/modules/staff/commands/timesheets-entries.js.map +3 -3
- package/dist/modules/staff/commands/timesheets-projects.js +450 -7
- package/dist/modules/staff/commands/timesheets-projects.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +1036 -0
- package/dist/modules/staff/commands/timesheets-reports.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tags.js +1015 -0
- package/dist/modules/staff/commands/timesheets-tags.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js +438 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js +723 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tasks.js +834 -0
- package/dist/modules/staff/commands/timesheets-tasks.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +426 -12
- package/dist/modules/staff/data/enrichers.js.map +2 -2
- package/dist/modules/staff/data/entities.js +552 -3
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/extensions.js +41 -0
- package/dist/modules/staff/data/extensions.js.map +7 -0
- package/dist/modules/staff/data/validators.js +254 -9
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/di.js +42 -1
- package/dist/modules/staff/di.js.map +2 -2
- package/dist/modules/staff/events.js +84 -6
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/events.payloads.js +158 -0
- package/dist/modules/staff/events.payloads.js.map +7 -0
- package/dist/modules/staff/extension-points.js +261 -0
- package/dist/modules/staff/extension-points.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js +138 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js +12 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js +133 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js +19 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js.map +7 -0
- package/dist/modules/staff/lib/crud.js +11 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/time-tracking/access.js +92 -0
- package/dist/modules/staff/lib/time-tracking/access.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/billability.js +39 -0
- package/dist/modules/staff/lib/time-tracking/billability.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js +68 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js +15 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/cost.js +82 -0
- package/dist/modules/staff/lib/time-tracking/cost.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/duration.js +55 -0
- package/dist/modules/staff/lib/time-tracking/duration.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js +41 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/interval.js +72 -0
- package/dist/modules/staff/lib/time-tracking/interval.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js +88 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js +10 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js +87 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js +27 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js +16 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js +135 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js +187 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js +80 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js +56 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js +63 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js +62 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js +21 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js +34 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js +66 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js +39 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js +214 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settings.js +87 -0
- package/dist/modules/staff/lib/time-tracking/settings.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js +9 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js +48 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js +283 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js +324 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js +121 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js +89 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js +855 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js +360 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js +259 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js +238 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js +130 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js +98 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js +27 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js +166 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js +295 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js +212 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js +729 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js +217 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js +158 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js +224 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js +93 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js +1196 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js +307 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js +284 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js +73 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js +1499 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js +95 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js +61 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js +45 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js +82 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js +5 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js +152 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js +92 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js +111 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js +243 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js +105 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js +132 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js +205 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js +53 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js +77 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js.map +7 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js +809 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js.map +7 -0
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js +2 -3
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js.map +2 -2
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js +152 -0
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js +36 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js +78 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js +44 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js +169 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js +22 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +51 -1
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js +70 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +63 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +170 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js +205 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js +68 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js +135 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js +48 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js +262 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js +34 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js +79 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js +11 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js +83 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js +42 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js +107 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js +289 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js +145 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js +116 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js +50 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js +27 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js +65 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js +17 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js +51 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +11 -4
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +369 -111
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +47 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +2 -2
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js +79 -0
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js +15 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js.map +7 -0
- package/dist/modules/staff/notifications.client.js +16 -0
- package/dist/modules/staff/notifications.client.js.map +7 -0
- package/dist/modules/staff/notifications.handlers.js +80 -0
- package/dist/modules/staff/notifications.handlers.js.map +7 -0
- package/dist/modules/staff/notifications.js +168 -0
- package/dist/modules/staff/notifications.js.map +2 -2
- package/dist/modules/staff/search.js +159 -1
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +20 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js +68 -0
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js +149 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js +78 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js +78 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js.map +7 -0
- package/dist/modules/staff/translations.js +4 -1
- package/dist/modules/staff/translations.js.map +2 -2
- package/dist/modules/staff/widgets/components.js +7 -0
- package/dist/modules/staff/widgets/components.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +5 -4
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +2 -2
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js +135 -0
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js.map +7 -0
- package/dist/modules/staff/widgets/notifications/index.js +5 -0
- package/dist/modules/staff/widgets/notifications/index.js.map +7 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js +43 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js.map +7 -0
- package/generated/entities/staff_time_entry/index.ts +7 -0
- package/generated/entities/staff_time_entry_tag/index.ts +6 -0
- package/generated/entities/staff_time_project/index.ts +8 -0
- package/generated/entities/staff_time_report/index.ts +27 -0
- package/generated/entities/staff_time_report_entry/index.ts +12 -0
- package/generated/entities/staff_time_report_event/index.ts +9 -0
- package/generated/entities/staff_time_report_project/index.ts +6 -0
- package/generated/entities/staff_time_tag/index.ts +9 -0
- package/generated/entities/staff_time_task/index.ts +17 -0
- package/generated/entities/staff_time_task_comment/index.ts +9 -0
- package/generated/entities/staff_time_task_status/index.ts +13 -0
- package/generated/entities/staff_time_task_tag/index.ts +6 -0
- package/generated/entities.ids.generated.ts +11 -1
- package/generated/entity-fields-registry.ts +149 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +31 -1
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/cli.ts +35 -1
- package/src/modules/auth/i18n/de.json +7 -0
- package/src/modules/auth/i18n/en.json +7 -0
- package/src/modules/auth/i18n/es.json +7 -0
- package/src/modules/auth/i18n/ko.json +7 -0
- package/src/modules/auth/i18n/pl.json +7 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/customer_accounts/lib/customerRoleAcls.ts +79 -0
- package/src/modules/customer_accounts/setup.ts +1 -45
- package/src/modules/data_sync/AGENTS.md +34 -0
- package/src/modules/data_sync/api/options.ts +2 -0
- package/src/modules/data_sync/backend/data-sync/page.tsx +82 -33
- package/src/modules/data_sync/i18n/de.json +1 -0
- package/src/modules/data_sync/i18n/en.json +1 -0
- package/src/modules/data_sync/i18n/es.json +1 -0
- package/src/modules/data_sync/i18n/ko.json +1 -0
- package/src/modules/data_sync/i18n/pl.json +1 -0
- package/src/modules/data_sync/lib/adapter.ts +45 -0
- package/src/modules/data_sync/lib/start-controls.ts +89 -0
- package/src/modules/staff/AGENTS.md +769 -1
- package/src/modules/staff/acl.ts +9 -0
- package/src/modules/staff/ai-agents.ts +189 -0
- package/src/modules/staff/ai-tools/time-tracking-pack.ts +494 -0
- package/src/modules/staff/ai-tools/types.ts +82 -0
- package/src/modules/staff/ai-tools.ts +13 -0
- package/src/modules/staff/analytics.ts +113 -0
- package/src/modules/staff/api/guards.ts +85 -3
- package/src/modules/staff/api/leave-requests/accept/route.ts +0 -2
- package/src/modules/staff/api/leave-requests/reject/route.ts +0 -2
- package/src/modules/staff/api/portal/time-reports/[id]/route.ts +182 -0
- package/src/modules/staff/api/portal/time-reports/route.ts +270 -0
- package/src/modules/staff/api/team-members/self/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/assign/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +0 -2
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +292 -0
- package/src/modules/staff/api/timesheets/access-requests/route.ts +299 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +15 -7
- package/src/modules/staff/api/timesheets/my-projects/route.ts +14 -1
- package/src/modules/staff/api/timesheets/my-work/myWorkAggregate.ts +90 -0
- package/src/modules/staff/api/timesheets/my-work/route.ts +475 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +15 -2
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +203 -0
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +315 -0
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +220 -0
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +208 -0
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +449 -0
- package/src/modules/staff/api/timesheets/reports/route.ts +386 -0
- package/src/modules/staff/api/timesheets/reports/shared.ts +121 -0
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +205 -0
- package/src/modules/staff/api/timesheets/settings/rounding-impact/route.ts +226 -0
- package/src/modules/staff/api/timesheets/settings/route.ts +242 -0
- package/src/modules/staff/api/timesheets/tags/access.ts +134 -0
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +290 -0
- package/src/modules/staff/api/timesheets/tags/route.ts +177 -0
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +294 -0
- package/src/modules/staff/api/timesheets/task-statuses/route.ts +232 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +532 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +271 -0
- package/src/modules/staff/api/timesheets/tasks/route.ts +443 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +306 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +32 -10
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +32 -17
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +27 -6
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +36 -6
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +331 -34
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +533 -0
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +457 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +378 -24
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +31 -9
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +246 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +62 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +397 -22
- package/src/modules/staff/backend/staff/time-tracking/board/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/board/page.tsx +151 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.tsx +1229 -0
- package/src/modules/staff/backend/staff/time-tracking/page.meta.ts +11 -0
- package/src/modules/staff/backend/staff/time-tracking/page.tsx +823 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.tsx +81 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.tsx +275 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.tsx +1420 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.tsx +109 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.meta.ts +15 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.tsx +1254 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.ts +466 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.tsx +632 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.tsx +867 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.tsx +246 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.tsx +701 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/GridView.tsx +953 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.tsx +800 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +6 -6
- package/src/modules/staff/backend/staff/timesheets/page.tsx +12 -1010
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +4 -158
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +4 -609
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +3 -89
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +2 -19
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +3 -778
- package/src/modules/staff/ce.ts +63 -0
- package/src/modules/staff/cli.ts +207 -1
- package/src/modules/staff/commands/index.ts +5 -0
- package/src/modules/staff/commands/timesheets-entries.ts +1006 -28
- package/src/modules/staff/commands/timesheets-projects.ts +593 -7
- package/src/modules/staff/commands/timesheets-reports.ts +1329 -0
- package/src/modules/staff/commands/timesheets-tags.ts +1315 -0
- package/src/modules/staff/commands/timesheets-task-comments.ts +583 -0
- package/src/modules/staff/commands/timesheets-task-statuses.ts +889 -0
- package/src/modules/staff/commands/timesheets-tasks.ts +1121 -0
- package/src/modules/staff/data/enrichers.ts +675 -10
- package/src/modules/staff/data/entities.ts +494 -2
- package/src/modules/staff/data/extensions.ts +68 -0
- package/src/modules/staff/data/validators.ts +348 -3
- package/src/modules/staff/di.ts +96 -0
- package/src/modules/staff/events.payloads.ts +268 -0
- package/src/modules/staff/events.ts +87 -5
- package/src/modules/staff/extension-points.ts +308 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.ts +10 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.tsx +225 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.ts +17 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.tsx +182 -0
- package/src/modules/staff/i18n/de.json +899 -0
- package/src/modules/staff/i18n/en.json +899 -0
- package/src/modules/staff/i18n/es.json +899 -0
- package/src/modules/staff/i18n/ko.json +899 -0
- package/src/modules/staff/i18n/pl.json +899 -0
- package/src/modules/staff/lib/crud.ts +14 -3
- package/src/modules/staff/lib/time-tracking/access.ts +155 -0
- package/src/modules/staff/lib/time-tracking/billability.ts +68 -0
- package/src/modules/staff/lib/time-tracking/capacity.ts +124 -0
- package/src/modules/staff/lib/time-tracking/componentContracts.ts +26 -0
- package/src/modules/staff/lib/time-tracking/cost.ts +144 -0
- package/src/modules/staff/lib/time-tracking/duration.ts +68 -0
- package/src/modules/staff/lib/time-tracking/featureAccess.ts +115 -0
- package/src/modules/staff/lib/time-tracking/interval.ts +90 -0
- package/src/modules/staff/lib/time-tracking/migrateProjectCodes.ts +161 -0
- package/src/modules/staff/lib/time-tracking/moneyVisibility.ts +37 -0
- package/src/modules/staff/lib/time-tracking/overlap.ts +159 -0
- package/src/modules/staff/lib/time-tracking/portalRecipients.ts +76 -0
- package/src/modules/staff/lib/time-tracking/portalReports.ts +31 -0
- package/src/modules/staff/lib/time-tracking/projectCode.ts +221 -0
- package/src/modules/staff/lib/time-tracking/reapplyRounding.ts +313 -0
- package/src/modules/staff/lib/time-tracking/recalculationRunner.ts +118 -0
- package/src/modules/staff/lib/time-tracking/recalculations.ts +135 -0
- package/src/modules/staff/lib/time-tracking/registries/invoke.ts +122 -0
- package/src/modules/staff/lib/time-tracking/registries/registry.ts +124 -0
- package/src/modules/staff/lib/time-tracking/registries/scope.ts +56 -0
- package/src/modules/staff/lib/time-tracking/rollup.ts +59 -0
- package/src/modules/staff/lib/time-tracking/rounding.ts +126 -0
- package/src/modules/staff/lib/time-tracking/roundingImpact.ts +75 -0
- package/src/modules/staff/lib/time-tracking/settingKeys.ts +274 -0
- package/src/modules/staff/lib/time-tracking/settings.ts +168 -0
- package/src/modules/staff/lib/time-tracking/sqlInClause.ts +22 -0
- package/src/modules/staff/lib/time-tracking/timeEntrySources.ts +85 -0
- package/src/modules/staff/lib/time-tracking-ui/BoardFilterChips.tsx +360 -0
- package/src/modules/staff/lib/time-tracking-ui/CustomerPicker.tsx +427 -0
- package/src/modules/staff/lib/time-tracking-ui/DurationInput.tsx +192 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryDetailsFields.tsx +224 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryFilterBar.tsx +144 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanBoard.tsx +1065 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanCard.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanColumn.tsx +316 -0
- package/src/modules/staff/lib/time-tracking-ui/NewTaskDialog.tsx +291 -0
- package/src/modules/staff/lib/time-tracking-ui/NoProjectAccess.tsx +162 -0
- package/src/modules/staff/lib/time-tracking-ui/PeriodSelector.tsx +149 -0
- package/src/modules/staff/lib/time-tracking-ui/PhasePlaceholder.tsx +31 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCodeField.tsx +230 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.tsx +432 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectFormSections.tsx +323 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.tsx +930 -0
- package/src/modules/staff/lib/time-tracking-ui/ReportSheet.tsx +357 -0
- package/src/modules/staff/lib/time-tracking-ui/TagPicker.tsx +195 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskBoardScreen.tsx +243 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskCommentThread.tsx +137 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskDrawer.tsx +1405 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskListView.tsx +260 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskPicker.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskQuickLog.tsx +296 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.tsx +97 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDialog.tsx +1929 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.tsx +126 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetCalendar.tsx +265 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.tsx +78 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.tsx +70 -0
- package/src/modules/staff/lib/time-tracking-ui/boardDirectory.ts +231 -0
- package/src/modules/staff/lib/time-tracking-ui/boardFilters.ts +128 -0
- package/src/modules/staff/lib/time-tracking-ui/boardSummary.ts +20 -0
- package/src/modules/staff/lib/time-tracking-ui/kanbanBoardData.ts +228 -0
- package/src/modules/staff/lib/time-tracking-ui/projectTeamAssignment.ts +143 -0
- package/src/modules/staff/lib/time-tracking-ui/taskDrawerData.ts +194 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryDialogState.ts +400 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryListData.ts +271 -0
- package/src/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.ts +168 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetData.ts +225 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetPeriod.ts +278 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetTargets.ts +93 -0
- package/src/modules/staff/lib/time-tracking-ui/useBoardFilters.ts +107 -0
- package/src/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.ts +245 -0
- package/src/modules/staff/lib/timeTrackingSeeds.ts +1037 -0
- package/src/modules/staff/lib/timesheets/timeEntryCacheInvalidation.ts +11 -10
- package/src/modules/staff/lib/timesheets/timeEntryDecoration.ts +256 -0
- package/src/modules/staff/lib/timesheets-projects/budgetBurn.ts +60 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThreshold.ts +135 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThresholdState.ts +137 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectFinancials.ts +142 -0
- package/src/modules/staff/lib/timesheets-projects/reportSelection.ts +82 -0
- package/src/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.tsx +237 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.tsx +33 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +56 -1
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.tsx +90 -0
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +125 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +251 -0
- package/src/modules/staff/lib/timesheets-reports/pdf.ts +263 -0
- package/src/modules/staff/lib/timesheets-reports/reportApprovalPolicies.ts +137 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigData.ts +247 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigState.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportExport.ts +373 -0
- package/src/modules/staff/lib/timesheets-reports/reportExportFormats.ts +71 -0
- package/src/modules/staff/lib/timesheets-reports/reportGroupings.ts +153 -0
- package/src/modules/staff/lib/timesheets-reports/reportLabels.ts +23 -0
- package/src/modules/staff/lib/timesheets-reports/reportReference.ts +146 -0
- package/src/modules/staff/lib/timesheets-reports/reportRows.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportSheetData.ts +196 -0
- package/src/modules/staff/lib/timesheets-reports/reportTotals.ts +544 -0
- package/src/modules/staff/lib/timesheets-reports/xlsx.ts +207 -0
- package/src/modules/staff/lib/timesheets-tasks/computeTaskRollups.ts +238 -0
- package/src/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.ts +90 -0
- package/src/modules/staff/lib/timesheets-tasks/seedProjectStatuses.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/statusPositions.ts +132 -0
- package/src/modules/staff/lib/timesheets-tasks/statusSlug.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHierarchy.ts +99 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHoursTotals.ts +42 -0
- package/src/modules/staff/lib/timesheets-tasks/taskReference.ts +108 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +18 -4
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +504 -149
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +50 -2
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +3244 -228
- package/src/modules/staff/migrations/Migration20260813073131_staff.ts +94 -0
- package/src/modules/staff/migrations/Migration20260824143357_staff.ts +17 -0
- package/src/modules/staff/notifications.client.ts +16 -0
- package/src/modules/staff/notifications.handlers.ts +88 -0
- package/src/modules/staff/notifications.ts +163 -0
- package/src/modules/staff/search.ts +191 -1
- package/src/modules/staff/setup.ts +22 -0
- package/src/modules/staff/subscribers/time-project-access-requested-notification.ts +95 -0
- package/src/modules/staff/subscribers/time-project-budget-threshold-notification.ts +226 -0
- package/src/modules/staff/subscribers/time-report-approved-notification.ts +116 -0
- package/src/modules/staff/subscribers/time-report-portal-broadcast.ts +120 -0
- package/src/modules/staff/translations.ts +17 -0
- package/src/modules/staff/widgets/components.ts +34 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +6 -5
- package/src/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.tsx +138 -0
- package/src/modules/staff/widgets/notifications/index.ts +1 -0
- package/src/modules/staff/workers/timesheets-reapply-rounding.ts +59 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +0 -123
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +0 -7
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +0 -138
|
@@ -0,0 +1,867 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Screen 13 — report configuration.
|
|
5
|
+
*
|
|
6
|
+
* The four notes on the mockup are the four decisions this screen exists to
|
|
7
|
+
* make:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Every number recomputes on the server as the period moves** (note 1).
|
|
10
|
+
* The pick-list would be guesswork otherwise. The page never adds up money
|
|
11
|
+
* itself: `POST .../reports/preview` owns D-7 and the screen renders what it
|
|
12
|
+
* answers, so a figure beside a project and the grand total can never come
|
|
13
|
+
* from two different rules.
|
|
14
|
+
* 2. **A project with no entries in the period stays listed** (note 2),
|
|
15
|
+
* unticked and muted. Hiding it leaves the user asking where the UX workshop
|
|
16
|
+
* project went.
|
|
17
|
+
* 3. **Presets fill an editable range** (note 3 → D-4). Week/Month/Year seed
|
|
18
|
+
* From and To; moving either date drops the preset to `custom`, because a
|
|
19
|
+
* highlighted "Month" over a 1 June – 19 July range would be a lie.
|
|
20
|
+
* 4. **An hour already frozen in another report is excluded by default**
|
|
21
|
+
* (note 4 → D-5). This deviates from the mockup, which drew silent
|
|
22
|
+
* inclusion. The panel names the count, the minutes and the reports
|
|
23
|
+
* responsible, and the opt-in ships unticked — re-billing the same hour must
|
|
24
|
+
* be a deliberate act.
|
|
25
|
+
*
|
|
26
|
+
* The currency rule (R2) is enforced twice and surfaced once: the server refuses
|
|
27
|
+
* a mixed selection with `422 report_currency_conflict`, and the screen renders
|
|
28
|
+
* the offending projects it names rather than a generic failure.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import * as React from 'react'
|
|
32
|
+
import { useRouter, useSearchParams } from 'next/navigation'
|
|
33
|
+
import { AlertTriangle, FileText, Info } from 'lucide-react'
|
|
34
|
+
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
35
|
+
import { Alert, AlertDescription, AlertTitle } from '@open-mercato/ui/primitives/alert'
|
|
36
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
37
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@open-mercato/ui/primitives/card'
|
|
38
|
+
import { Checkbox } from '@open-mercato/ui/primitives/checkbox'
|
|
39
|
+
import { Input } from '@open-mercato/ui/primitives/input'
|
|
40
|
+
import { Label } from '@open-mercato/ui/primitives/label'
|
|
41
|
+
import { Separator } from '@open-mercato/ui/primitives/separator'
|
|
42
|
+
import { SegmentedControl, SegmentedControlItem } from '@open-mercato/ui/primitives/segmented-control'
|
|
43
|
+
import {
|
|
44
|
+
Select,
|
|
45
|
+
SelectContent,
|
|
46
|
+
SelectItem,
|
|
47
|
+
SelectTrigger,
|
|
48
|
+
SelectValue,
|
|
49
|
+
} from '@open-mercato/ui/primitives/select'
|
|
50
|
+
import { Switch } from '@open-mercato/ui/primitives/switch'
|
|
51
|
+
import { Spinner } from '@open-mercato/ui/primitives/spinner'
|
|
52
|
+
import { FormHeader } from '@open-mercato/ui/backend/forms'
|
|
53
|
+
import { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'
|
|
54
|
+
import { extensionPoints } from '@open-mercato/core/modules/staff/extension-points'
|
|
55
|
+
import { extensionSpotChildId } from '@open-mercato/shared/modules/widgets/extension-points'
|
|
56
|
+
import { ErrorMessage } from '@open-mercato/ui/backend/detail'
|
|
57
|
+
import { apiCall, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
|
|
58
|
+
import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'
|
|
59
|
+
import { useBackendChrome } from '@open-mercato/ui/backend/BackendChromeProvider'
|
|
60
|
+
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
61
|
+
import { formatCurrency } from '@open-mercato/ui/utils/format'
|
|
62
|
+
import { hasFeature } from '@open-mercato/shared/security/features'
|
|
63
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
64
|
+
import { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'
|
|
65
|
+
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
66
|
+
import { CustomerPicker, type CustomerSelection } from '../../../../../lib/time-tracking-ui/CustomerPicker'
|
|
67
|
+
import {
|
|
68
|
+
applyBound,
|
|
69
|
+
applyPreset,
|
|
70
|
+
defaultReportTitle,
|
|
71
|
+
initialReportPeriod,
|
|
72
|
+
isValidReportPeriod,
|
|
73
|
+
REPORT_PERIOD_PRESETS,
|
|
74
|
+
spansMultipleMonths,
|
|
75
|
+
type ReportPeriodState,
|
|
76
|
+
} from '../../../../../lib/timesheets-reports/reportConfigState'
|
|
77
|
+
import {
|
|
78
|
+
parseReportPreview,
|
|
79
|
+
readCurrencyConflict,
|
|
80
|
+
toCandidateProject,
|
|
81
|
+
type CurrencyConflict,
|
|
82
|
+
type ReportCandidateProject,
|
|
83
|
+
type ReportPreview,
|
|
84
|
+
} from '../../../../../lib/timesheets-reports/reportConfigData'
|
|
85
|
+
import { formatReportMinutes } from '../../../../../lib/timesheets-reports/reportTotals'
|
|
86
|
+
|
|
87
|
+
const logger = createLogger('staff').child({ component: 'time-tracking/reports/create' })
|
|
88
|
+
|
|
89
|
+
const REPORTS_HREF = '/backend/staff/time-tracking/reports'
|
|
90
|
+
const PROJECTS_API = '/api/staff/timesheets/time-projects'
|
|
91
|
+
const PREVIEW_API = '/api/staff/timesheets/reports/preview'
|
|
92
|
+
const REPORTS_API_PATH = 'staff/timesheets/reports'
|
|
93
|
+
const RATES_FEATURE = 'staff.timesheets.rates.view'
|
|
94
|
+
const MUTATION_CONTEXT_ID = 'staff.time_tracking.reportCreate'
|
|
95
|
+
const REPORT_ENTITY_ID = 'staff:staff_time_report'
|
|
96
|
+
const RESOURCE_KIND = 'staff.timesheets.time_report'
|
|
97
|
+
const CANDIDATE_PAGE_SIZE = 100
|
|
98
|
+
|
|
99
|
+
type Grouping = 'project_task' | 'project_person' | 'project_day'
|
|
100
|
+
type NonbillableMode = 'separate' | 'exclude'
|
|
101
|
+
|
|
102
|
+
type MutationContext = {
|
|
103
|
+
formId: string
|
|
104
|
+
resourceKind: string
|
|
105
|
+
resourceId: string
|
|
106
|
+
retryLastMutation: () => Promise<boolean>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function readPreselectedProjectIds(params: URLSearchParams): string[] {
|
|
110
|
+
const raw = params.get('projectIds')
|
|
111
|
+
return raw ? raw.split(',').map((id) => id.trim()).filter(Boolean) : []
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function readRows(payload: unknown): Array<Record<string, unknown>> {
|
|
115
|
+
if (!payload || typeof payload !== 'object') return []
|
|
116
|
+
const items = (payload as { items?: unknown }).items
|
|
117
|
+
return Array.isArray(items) ? (items.filter((row) => row && typeof row === 'object') as Array<Record<string, unknown>>) : []
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default function TimeTrackingReportCreatePage() {
|
|
121
|
+
const t = useT()
|
|
122
|
+
const router = useRouter()
|
|
123
|
+
const searchParams = useSearchParams()
|
|
124
|
+
const scopeVersion = useOrganizationScopeVersion()
|
|
125
|
+
const { payload } = useBackendChrome()
|
|
126
|
+
const canSeeMoney = hasFeature(payload?.grantedFeatures, RATES_FEATURE)
|
|
127
|
+
|
|
128
|
+
const [customer, setCustomer] = React.useState<CustomerSelection | null>(null)
|
|
129
|
+
const [customerId, setCustomerId] = React.useState<string | null>(() => searchParams.get('customerId'))
|
|
130
|
+
const [period, setPeriod] = React.useState<ReportPeriodState>(() => initialReportPeriod())
|
|
131
|
+
const [candidates, setCandidates] = React.useState<ReportCandidateProject[]>([])
|
|
132
|
+
const [candidatesLoading, setCandidatesLoading] = React.useState(false)
|
|
133
|
+
const preselectedIds = React.useMemo(() => readPreselectedProjectIds(searchParams), [searchParams])
|
|
134
|
+
const [selectedIds, setSelectedIds] = React.useState<string[]>(preselectedIds)
|
|
135
|
+
// Note 2 forbids a pre-ticked project with no entries in the period, and the
|
|
136
|
+
// entry counts only arrive with the candidate preview. So the default tick is
|
|
137
|
+
// owed rather than applied: this flag says the screen still has to decide it
|
|
138
|
+
// once the counts are in. An explicit `?projectIds=` preselection settles the
|
|
139
|
+
// question up front and never becomes pending.
|
|
140
|
+
const [defaultSelectionPending, setDefaultSelectionPending] = React.useState(preselectedIds.length === 0)
|
|
141
|
+
const [grouping, setGrouping] = React.useState<Grouping>('project_task')
|
|
142
|
+
const [nonbillableMode, setNonbillableMode] = React.useState<NonbillableMode>('separate')
|
|
143
|
+
const [showRates, setShowRates] = React.useState(true)
|
|
144
|
+
const [includeAlreadyReported, setIncludeAlreadyReported] = React.useState(false)
|
|
145
|
+
const [title, setTitle] = React.useState('')
|
|
146
|
+
const [titleTouched, setTitleTouched] = React.useState(false)
|
|
147
|
+
|
|
148
|
+
const [candidatePreview, setCandidatePreview] = React.useState<ReportPreview | null>(null)
|
|
149
|
+
const [preview, setPreview] = React.useState<ReportPreview | null>(null)
|
|
150
|
+
const [previewLoading, setPreviewLoading] = React.useState(false)
|
|
151
|
+
const [previewError, setPreviewError] = React.useState<string | null>(null)
|
|
152
|
+
const [conflict, setConflict] = React.useState<CurrencyConflict | null>(null)
|
|
153
|
+
const [submitting, setSubmitting] = React.useState(false)
|
|
154
|
+
|
|
155
|
+
const labels = React.useMemo(
|
|
156
|
+
() => ({
|
|
157
|
+
customer: t('staff.time_tracking.reports.create.customer', 'Customer'),
|
|
158
|
+
customerHint: t(
|
|
159
|
+
'staff.time_tracking.reports.create.customerHint',
|
|
160
|
+
'Report currency: {currency} — it comes from this customer projects.',
|
|
161
|
+
),
|
|
162
|
+
unknownCustomer: t('staff.time_tracking.reports.create.unknownCustomer', 'Customer'),
|
|
163
|
+
previewError: t('staff.time_tracking.reports.errors.previewFailed', 'Could not compute the report totals.'),
|
|
164
|
+
createError: t('staff.time_tracking.reports.errors.createFailed', 'Could not create the report.'),
|
|
165
|
+
}),
|
|
166
|
+
[t],
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
const { runMutation, retryLastMutation } = useGuardedMutation<MutationContext>({
|
|
170
|
+
contextId: MUTATION_CONTEXT_ID,
|
|
171
|
+
blockedMessage: labels.createError,
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
const selectedIdsRef = React.useRef<string[]>(selectedIds)
|
|
175
|
+
React.useEffect(() => {
|
|
176
|
+
selectedIdsRef.current = selectedIds
|
|
177
|
+
}, [selectedIds])
|
|
178
|
+
|
|
179
|
+
React.useEffect(() => {
|
|
180
|
+
if (!customer) return
|
|
181
|
+
setCustomerId(customer.id)
|
|
182
|
+
}, [customer])
|
|
183
|
+
|
|
184
|
+
React.useEffect(() => {
|
|
185
|
+
if (titleTouched) return
|
|
186
|
+
setTitle(defaultReportTitle(customer?.name ?? null, period, labels.unknownCustomer))
|
|
187
|
+
}, [customer?.name, labels.unknownCustomer, period, titleTouched])
|
|
188
|
+
|
|
189
|
+
// The customer's whole project list, not just what is ticked: note 2 keeps an
|
|
190
|
+
// empty project visible so nobody wonders where it went.
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
if (!customerId) {
|
|
193
|
+
setCandidates([])
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
let cancelled = false
|
|
197
|
+
setCandidatesLoading(true)
|
|
198
|
+
const params = new URLSearchParams({
|
|
199
|
+
page: '1',
|
|
200
|
+
pageSize: String(CANDIDATE_PAGE_SIZE),
|
|
201
|
+
customerId,
|
|
202
|
+
})
|
|
203
|
+
void readApiResultOrThrow<Record<string, unknown>>(`${PROJECTS_API}?${params.toString()}`, undefined, {
|
|
204
|
+
allowNullResult: true,
|
|
205
|
+
errorMessage: labels.previewError,
|
|
206
|
+
})
|
|
207
|
+
.then((result) => {
|
|
208
|
+
if (cancelled) return
|
|
209
|
+
const rows = readRows(result)
|
|
210
|
+
.map(toCandidateProject)
|
|
211
|
+
.filter((project): project is ReportCandidateProject => project !== null)
|
|
212
|
+
setCandidates(rows)
|
|
213
|
+
const allowed = new Set(rows.map((project) => project.id))
|
|
214
|
+
const kept = selectedIdsRef.current.filter((id) => allowed.has(id))
|
|
215
|
+
setSelectedIds(kept)
|
|
216
|
+
setDefaultSelectionPending(kept.length === 0)
|
|
217
|
+
})
|
|
218
|
+
.catch((err) => {
|
|
219
|
+
if (cancelled) return
|
|
220
|
+
logger.error('staff.time_tracking.reports candidate projects failed', { err })
|
|
221
|
+
setCandidates([])
|
|
222
|
+
})
|
|
223
|
+
.finally(() => {
|
|
224
|
+
if (!cancelled) setCandidatesLoading(false)
|
|
225
|
+
})
|
|
226
|
+
return () => {
|
|
227
|
+
cancelled = true
|
|
228
|
+
}
|
|
229
|
+
}, [customerId, labels.previewError, scopeVersion])
|
|
230
|
+
|
|
231
|
+
const runPreview = React.useCallback(
|
|
232
|
+
async (projectIds: string[], signal: AbortSignal): Promise<ReportPreview | null> => {
|
|
233
|
+
if (projectIds.length === 0 || !isValidReportPeriod(period)) return null
|
|
234
|
+
const call = await apiCall<Record<string, unknown>>(
|
|
235
|
+
PREVIEW_API,
|
|
236
|
+
{
|
|
237
|
+
method: 'POST',
|
|
238
|
+
headers: { 'content-type': 'application/json' },
|
|
239
|
+
body: JSON.stringify({
|
|
240
|
+
customerId,
|
|
241
|
+
periodKind: period.kind,
|
|
242
|
+
periodFrom: period.from,
|
|
243
|
+
periodTo: period.to,
|
|
244
|
+
grouping,
|
|
245
|
+
nonbillableMode,
|
|
246
|
+
includeAlreadyReported,
|
|
247
|
+
showRates,
|
|
248
|
+
timeProjectIds: projectIds,
|
|
249
|
+
}),
|
|
250
|
+
signal,
|
|
251
|
+
},
|
|
252
|
+
)
|
|
253
|
+
if (!call.ok) {
|
|
254
|
+
const currencyConflict = readCurrencyConflict(call.result)
|
|
255
|
+
if (currencyConflict) {
|
|
256
|
+
setConflict(currencyConflict)
|
|
257
|
+
return null
|
|
258
|
+
}
|
|
259
|
+
const message =
|
|
260
|
+
(call.result && typeof call.result === 'object' && typeof (call.result as { error?: unknown }).error === 'string'
|
|
261
|
+
? ((call.result as { error: string }).error)
|
|
262
|
+
: null) ?? labels.previewError
|
|
263
|
+
throw new Error(message)
|
|
264
|
+
}
|
|
265
|
+
setConflict(null)
|
|
266
|
+
return parseReportPreview(call.result)
|
|
267
|
+
},
|
|
268
|
+
[customerId, grouping, includeAlreadyReported, labels.previewError, nonbillableMode, period, showRates],
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
// Per-project figures depend only on (project, period), never on the ticks, so
|
|
272
|
+
// they are fetched once for the whole candidate set and stay put while the
|
|
273
|
+
// user changes the selection.
|
|
274
|
+
React.useEffect(() => {
|
|
275
|
+
if (candidates.length === 0) {
|
|
276
|
+
setCandidatePreview(null)
|
|
277
|
+
return
|
|
278
|
+
}
|
|
279
|
+
const controller = new AbortController()
|
|
280
|
+
void runPreview(candidates.map((project) => project.id), controller.signal)
|
|
281
|
+
.then((result) => {
|
|
282
|
+
if (!controller.signal.aborted) setCandidatePreview(result)
|
|
283
|
+
})
|
|
284
|
+
.catch((err) => {
|
|
285
|
+
if (controller.signal.aborted) return
|
|
286
|
+
logger.error('staff.time_tracking.reports candidate preview failed', { err })
|
|
287
|
+
})
|
|
288
|
+
return () => controller.abort()
|
|
289
|
+
}, [candidates, runPreview])
|
|
290
|
+
|
|
291
|
+
React.useEffect(() => {
|
|
292
|
+
if (selectedIds.length === 0) {
|
|
293
|
+
setPreview(null)
|
|
294
|
+
setPreviewError(null)
|
|
295
|
+
return
|
|
296
|
+
}
|
|
297
|
+
const controller = new AbortController()
|
|
298
|
+
setPreviewLoading(true)
|
|
299
|
+
setPreviewError(null)
|
|
300
|
+
void runPreview(selectedIds, controller.signal)
|
|
301
|
+
.then((result) => {
|
|
302
|
+
if (!controller.signal.aborted) setPreview(result)
|
|
303
|
+
})
|
|
304
|
+
.catch((err) => {
|
|
305
|
+
if (controller.signal.aborted) return
|
|
306
|
+
setPreview(null)
|
|
307
|
+
setPreviewError(err instanceof Error ? err.message : labels.previewError)
|
|
308
|
+
})
|
|
309
|
+
.finally(() => {
|
|
310
|
+
if (!controller.signal.aborted) setPreviewLoading(false)
|
|
311
|
+
})
|
|
312
|
+
return () => controller.abort()
|
|
313
|
+
}, [labels.previewError, runPreview, selectedIds])
|
|
314
|
+
|
|
315
|
+
const projectFigures = React.useMemo(() => {
|
|
316
|
+
const map = new Map<string, { entryCount: number; minutes: number; amount: number | null }>()
|
|
317
|
+
for (const row of candidatePreview?.projects ?? []) {
|
|
318
|
+
map.set(row.id, {
|
|
319
|
+
entryCount: row.entryCount,
|
|
320
|
+
minutes: row.billableMinutes + row.nonbillableMinutes,
|
|
321
|
+
amount: row.amount,
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
return map
|
|
325
|
+
}, [candidatePreview])
|
|
326
|
+
|
|
327
|
+
// The counts decide the default: every project with time in the period is
|
|
328
|
+
// ticked, the empty ones stay listed and untouched. Whatever the user ticked
|
|
329
|
+
// while the counts were in flight is merged in rather than overwritten — the
|
|
330
|
+
// screen settles the default once and then leaves the selection alone.
|
|
331
|
+
React.useEffect(() => {
|
|
332
|
+
if (!defaultSelectionPending || !candidatePreview || candidates.length === 0) return
|
|
333
|
+
const withEntries = candidates
|
|
334
|
+
.filter((project) => (projectFigures.get(project.id)?.entryCount ?? 0) > 0)
|
|
335
|
+
.map((project) => project.id)
|
|
336
|
+
setSelectedIds((current) => Array.from(new Set([...current, ...withEntries])))
|
|
337
|
+
setDefaultSelectionPending(false)
|
|
338
|
+
}, [candidatePreview, candidates, defaultSelectionPending, projectFigures])
|
|
339
|
+
|
|
340
|
+
const currencyCode = preview?.currencyCode ?? candidatePreview?.currencyCode ?? null
|
|
341
|
+
|
|
342
|
+
const money = React.useCallback(
|
|
343
|
+
(amount: number | null | undefined) => {
|
|
344
|
+
if (amount === null || amount === undefined) return '—'
|
|
345
|
+
return formatCurrency(amount, currencyCode ?? undefined) ?? '—'
|
|
346
|
+
},
|
|
347
|
+
[currencyCode],
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
const toggleProject = React.useCallback((projectId: string, checked: boolean) => {
|
|
351
|
+
setSelectedIds((current) =>
|
|
352
|
+
checked ? Array.from(new Set([...current, projectId])) : current.filter((id) => id !== projectId),
|
|
353
|
+
)
|
|
354
|
+
}, [])
|
|
355
|
+
|
|
356
|
+
const reportFormValues = React.useMemo(
|
|
357
|
+
() => ({
|
|
358
|
+
customerId,
|
|
359
|
+
timeProjectIds: selectedIds,
|
|
360
|
+
periodFrom: period.from,
|
|
361
|
+
periodTo: period.to,
|
|
362
|
+
grouping,
|
|
363
|
+
nonbillableMode,
|
|
364
|
+
showRates,
|
|
365
|
+
includeAlreadyReported,
|
|
366
|
+
title,
|
|
367
|
+
}),
|
|
368
|
+
[customerId, grouping, includeAlreadyReported, nonbillableMode, period.from, period.to, selectedIds, showRates, title],
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
const reportFormInjectionContext = React.useMemo(
|
|
372
|
+
() => ({
|
|
373
|
+
formId: MUTATION_CONTEXT_ID,
|
|
374
|
+
entityId: REPORT_ENTITY_ID,
|
|
375
|
+
recordId: null,
|
|
376
|
+
resourceKind: 'staff.timesheets.time_report',
|
|
377
|
+
resourceId: 'new',
|
|
378
|
+
operation: 'create' as const,
|
|
379
|
+
retryLastMutation,
|
|
380
|
+
}),
|
|
381
|
+
[retryLastMutation],
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
const canSubmit =
|
|
385
|
+
Boolean(customerId) &&
|
|
386
|
+
selectedIds.length > 0 &&
|
|
387
|
+
isValidReportPeriod(period) &&
|
|
388
|
+
title.trim().length > 0 &&
|
|
389
|
+
!conflict &&
|
|
390
|
+
!submitting
|
|
391
|
+
|
|
392
|
+
const handleSubmit = React.useCallback(async () => {
|
|
393
|
+
if (!customerId || selectedIds.length === 0) return
|
|
394
|
+
setSubmitting(true)
|
|
395
|
+
try {
|
|
396
|
+
const call = await runMutation({
|
|
397
|
+
operation: () =>
|
|
398
|
+
apiCall<{ id?: string | null }>(
|
|
399
|
+
`/api/${REPORTS_API_PATH}`,
|
|
400
|
+
{
|
|
401
|
+
method: 'POST',
|
|
402
|
+
headers: { 'content-type': 'application/json' },
|
|
403
|
+
body: JSON.stringify({
|
|
404
|
+
customerId,
|
|
405
|
+
title: title.trim(),
|
|
406
|
+
periodKind: period.kind,
|
|
407
|
+
periodFrom: period.from,
|
|
408
|
+
periodTo: period.to,
|
|
409
|
+
grouping,
|
|
410
|
+
nonbillableMode,
|
|
411
|
+
includeAlreadyReported,
|
|
412
|
+
showRates,
|
|
413
|
+
timeProjectIds: selectedIds,
|
|
414
|
+
}),
|
|
415
|
+
},
|
|
416
|
+
),
|
|
417
|
+
context: {
|
|
418
|
+
formId: MUTATION_CONTEXT_ID,
|
|
419
|
+
resourceKind: RESOURCE_KIND,
|
|
420
|
+
resourceId: 'new',
|
|
421
|
+
retryLastMutation,
|
|
422
|
+
},
|
|
423
|
+
mutationPayload: { customerId, timeProjectIds: selectedIds },
|
|
424
|
+
})
|
|
425
|
+
if (!call.ok) {
|
|
426
|
+
const currencyConflict = readCurrencyConflict(call.result)
|
|
427
|
+
if (currencyConflict) {
|
|
428
|
+
setConflict(currencyConflict)
|
|
429
|
+
return
|
|
430
|
+
}
|
|
431
|
+
const message =
|
|
432
|
+
call.result && typeof call.result === 'object' && typeof (call.result as { error?: unknown }).error === 'string'
|
|
433
|
+
? (call.result as { error: string }).error
|
|
434
|
+
: labels.createError
|
|
435
|
+
flash(message, 'error')
|
|
436
|
+
return
|
|
437
|
+
}
|
|
438
|
+
const reportId = call.result?.id ?? null
|
|
439
|
+
flash(t('staff.time_tracking.reports.create.created', 'Report generated.'), 'success')
|
|
440
|
+
router.push(reportId ? `${REPORTS_HREF}/${reportId}` : REPORTS_HREF)
|
|
441
|
+
} catch (err) {
|
|
442
|
+
logger.error('staff.time_tracking.reports create failed', { err })
|
|
443
|
+
flash(err instanceof Error ? err.message : labels.createError, 'error')
|
|
444
|
+
} finally {
|
|
445
|
+
setSubmitting(false)
|
|
446
|
+
}
|
|
447
|
+
}, [
|
|
448
|
+
customerId,
|
|
449
|
+
grouping,
|
|
450
|
+
includeAlreadyReported,
|
|
451
|
+
labels.createError,
|
|
452
|
+
nonbillableMode,
|
|
453
|
+
period,
|
|
454
|
+
retryLastMutation,
|
|
455
|
+
router,
|
|
456
|
+
runMutation,
|
|
457
|
+
selectedIds,
|
|
458
|
+
showRates,
|
|
459
|
+
t,
|
|
460
|
+
title,
|
|
461
|
+
])
|
|
462
|
+
|
|
463
|
+
return (
|
|
464
|
+
<Page>
|
|
465
|
+
<PageBody>
|
|
466
|
+
<FormHeader
|
|
467
|
+
mode="detail"
|
|
468
|
+
title={t('staff.time_tracking.reports.create.title', 'New report')}
|
|
469
|
+
subtitle={t('staff.time_tracking.reports.create.subtitle', 'A report always covers one customer.')}
|
|
470
|
+
backHref={REPORTS_HREF}
|
|
471
|
+
/>
|
|
472
|
+
|
|
473
|
+
<div className="grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]">
|
|
474
|
+
<div className="flex flex-col gap-6">
|
|
475
|
+
<InjectionSpot
|
|
476
|
+
spotId={extensionSpotChildId(extensionPoints.hosts.reportForm.spotId, 'before-fields')}
|
|
477
|
+
context={reportFormInjectionContext}
|
|
478
|
+
data={reportFormValues}
|
|
479
|
+
/>
|
|
480
|
+
|
|
481
|
+
<section className="flex flex-col gap-2">
|
|
482
|
+
<Label htmlFor="report-customer">{labels.customer}</Label>
|
|
483
|
+
<CustomerPicker
|
|
484
|
+
value={customerId}
|
|
485
|
+
snapshot={customer}
|
|
486
|
+
onChange={(selection) => {
|
|
487
|
+
setCustomer(selection)
|
|
488
|
+
setCustomerId(selection?.id ?? null)
|
|
489
|
+
setSelectedIds([])
|
|
490
|
+
setDefaultSelectionPending(true)
|
|
491
|
+
setConflict(null)
|
|
492
|
+
}}
|
|
493
|
+
/>
|
|
494
|
+
{currencyCode ? (
|
|
495
|
+
<p className="text-xs text-muted-foreground">
|
|
496
|
+
{labels.customerHint.replace('{currency}', currencyCode)}
|
|
497
|
+
</p>
|
|
498
|
+
) : null}
|
|
499
|
+
</section>
|
|
500
|
+
|
|
501
|
+
<section className="flex flex-col gap-2">
|
|
502
|
+
<Label htmlFor="report-title">
|
|
503
|
+
{t('staff.time_tracking.reports.create.reportTitle', 'Report title')}
|
|
504
|
+
</Label>
|
|
505
|
+
<Input
|
|
506
|
+
id="report-title"
|
|
507
|
+
value={title}
|
|
508
|
+
onChange={(event) => {
|
|
509
|
+
setTitleTouched(true)
|
|
510
|
+
setTitle(event.target.value)
|
|
511
|
+
}}
|
|
512
|
+
/>
|
|
513
|
+
</section>
|
|
514
|
+
|
|
515
|
+
<section className="flex flex-col gap-3">
|
|
516
|
+
<Label>{t('staff.time_tracking.reports.create.period', 'Period')}</Label>
|
|
517
|
+
<SegmentedControl
|
|
518
|
+
value={period.kind === 'custom' ? '' : period.kind}
|
|
519
|
+
onValueChange={(value) => {
|
|
520
|
+
if (value === 'week' || value === 'month' || value === 'year') {
|
|
521
|
+
setPeriod((current) => applyPreset(current, value))
|
|
522
|
+
}
|
|
523
|
+
}}
|
|
524
|
+
>
|
|
525
|
+
{REPORT_PERIOD_PRESETS.map((preset) => (
|
|
526
|
+
<SegmentedControlItem key={preset} value={preset}>
|
|
527
|
+
{t(`staff.time_tracking.reports.create.preset.${preset}`, preset)}
|
|
528
|
+
</SegmentedControlItem>
|
|
529
|
+
))}
|
|
530
|
+
</SegmentedControl>
|
|
531
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
532
|
+
<div className="flex flex-col gap-1.5">
|
|
533
|
+
<Label htmlFor="report-from">{t('staff.time_tracking.reports.create.from', 'From')}</Label>
|
|
534
|
+
<Input
|
|
535
|
+
id="report-from"
|
|
536
|
+
type="date"
|
|
537
|
+
value={period.from}
|
|
538
|
+
onChange={(event) => setPeriod((current) => applyBound(current, 'from', event.target.value))}
|
|
539
|
+
/>
|
|
540
|
+
</div>
|
|
541
|
+
<div className="flex flex-col gap-1.5">
|
|
542
|
+
<Label htmlFor="report-to">{t('staff.time_tracking.reports.create.to', 'To')}</Label>
|
|
543
|
+
<Input
|
|
544
|
+
id="report-to"
|
|
545
|
+
type="date"
|
|
546
|
+
value={period.to}
|
|
547
|
+
onChange={(event) => setPeriod((current) => applyBound(current, 'to', event.target.value))}
|
|
548
|
+
/>
|
|
549
|
+
</div>
|
|
550
|
+
</div>
|
|
551
|
+
{!isValidReportPeriod(period) ? (
|
|
552
|
+
<p className="text-xs text-status-error-text">
|
|
553
|
+
{t('staff.time_tracking.reports.create.invalidPeriod', 'The end date must not precede the start date.')}
|
|
554
|
+
</p>
|
|
555
|
+
) : spansMultipleMonths(period) ? (
|
|
556
|
+
<p className="text-xs text-muted-foreground">
|
|
557
|
+
{t(
|
|
558
|
+
'staff.time_tracking.reports.create.spansMonths',
|
|
559
|
+
'This range covers more than one month — adjust the dates if you only want one of them.',
|
|
560
|
+
)}
|
|
561
|
+
</p>
|
|
562
|
+
) : null}
|
|
563
|
+
</section>
|
|
564
|
+
|
|
565
|
+
<section className="flex flex-col gap-2">
|
|
566
|
+
<div>
|
|
567
|
+
<Label>{t('staff.time_tracking.reports.create.projects', 'Customer projects')}</Label>
|
|
568
|
+
<p className="text-xs text-muted-foreground">
|
|
569
|
+
{t('staff.time_tracking.reports.create.projectsHint', 'Tick the projects this report should cover.')}
|
|
570
|
+
</p>
|
|
571
|
+
</div>
|
|
572
|
+
{candidatesLoading ? (
|
|
573
|
+
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
574
|
+
<Spinner className="size-4" />
|
|
575
|
+
{t('staff.time_tracking.reports.create.loadingProjects', 'Loading projects…')}
|
|
576
|
+
</div>
|
|
577
|
+
) : candidates.length === 0 ? (
|
|
578
|
+
<p className="rounded-md border border-border p-4 text-sm text-muted-foreground">
|
|
579
|
+
{customerId
|
|
580
|
+
? t('staff.time_tracking.reports.create.noProjects', 'This customer has no time projects yet.')
|
|
581
|
+
: t('staff.time_tracking.reports.create.pickCustomer', 'Pick a customer to see their projects.')}
|
|
582
|
+
</p>
|
|
583
|
+
) : (
|
|
584
|
+
<ul className="divide-y divide-border rounded-md border border-border">
|
|
585
|
+
{candidates.map((project) => {
|
|
586
|
+
const figures = projectFigures.get(project.id)
|
|
587
|
+
const empty = (figures?.entryCount ?? 0) === 0
|
|
588
|
+
const checked = selectedIds.includes(project.id)
|
|
589
|
+
const isOffender = conflict?.offenders.some((offender) => offender.id === project.id) ?? false
|
|
590
|
+
return (
|
|
591
|
+
<li
|
|
592
|
+
key={project.id}
|
|
593
|
+
className={`flex items-center gap-3 p-3 ${empty && !checked ? 'opacity-60' : ''}`}
|
|
594
|
+
>
|
|
595
|
+
<Checkbox
|
|
596
|
+
checked={checked}
|
|
597
|
+
onCheckedChange={(value) => toggleProject(project.id, value === true)}
|
|
598
|
+
aria-label={project.name}
|
|
599
|
+
/>
|
|
600
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
601
|
+
<span className="truncate text-sm font-medium">{project.name}</span>
|
|
602
|
+
<span className="text-xs text-muted-foreground">
|
|
603
|
+
{[
|
|
604
|
+
canSeeMoney && project.hourlyRate !== null
|
|
605
|
+
? `${money(project.hourlyRate)}/h`
|
|
606
|
+
: null,
|
|
607
|
+
t('staff.time_tracking.reports.create.entriesInPeriod', '{count} entries in period').replace(
|
|
608
|
+
'{count}',
|
|
609
|
+
String(figures?.entryCount ?? 0),
|
|
610
|
+
),
|
|
611
|
+
isOffender && project.currencyCode ? project.currencyCode : null,
|
|
612
|
+
]
|
|
613
|
+
.filter(Boolean)
|
|
614
|
+
.join(' · ')}
|
|
615
|
+
</span>
|
|
616
|
+
</div>
|
|
617
|
+
<span className="font-mono text-sm tabular-nums">
|
|
618
|
+
{formatReportMinutes(figures?.minutes ?? 0)}
|
|
619
|
+
</span>
|
|
620
|
+
<span className="w-28 text-right font-mono text-sm tabular-nums text-muted-foreground">
|
|
621
|
+
{canSeeMoney ? money(figures?.amount ?? null) : '—'}
|
|
622
|
+
</span>
|
|
623
|
+
</li>
|
|
624
|
+
)
|
|
625
|
+
})}
|
|
626
|
+
</ul>
|
|
627
|
+
)}
|
|
628
|
+
</section>
|
|
629
|
+
|
|
630
|
+
<section className="flex flex-col gap-3">
|
|
631
|
+
<Label>{t('staff.time_tracking.reports.create.presentation', 'Presentation')}</Label>
|
|
632
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
633
|
+
<div className="flex flex-col gap-1.5">
|
|
634
|
+
<Label htmlFor="report-grouping">
|
|
635
|
+
{t('staff.time_tracking.reports.create.grouping', 'Grouping')}
|
|
636
|
+
</Label>
|
|
637
|
+
<Select value={grouping} onValueChange={(value) => setGrouping(value as Grouping)}>
|
|
638
|
+
<SelectTrigger id="report-grouping">
|
|
639
|
+
<SelectValue />
|
|
640
|
+
</SelectTrigger>
|
|
641
|
+
<SelectContent>
|
|
642
|
+
<SelectItem value="project_task">
|
|
643
|
+
{t('staff.time_tracking.reports.grouping.project_task', 'Project → task')}
|
|
644
|
+
</SelectItem>
|
|
645
|
+
<SelectItem value="project_person">
|
|
646
|
+
{t('staff.time_tracking.reports.grouping.project_person', 'Project → person')}
|
|
647
|
+
</SelectItem>
|
|
648
|
+
<SelectItem value="project_day">
|
|
649
|
+
{t('staff.time_tracking.reports.grouping.project_day', 'Project → day')}
|
|
650
|
+
</SelectItem>
|
|
651
|
+
</SelectContent>
|
|
652
|
+
</Select>
|
|
653
|
+
</div>
|
|
654
|
+
<div className="flex flex-col gap-1.5">
|
|
655
|
+
<Label htmlFor="report-nonbillable">
|
|
656
|
+
{t('staff.time_tracking.reports.create.nonbillable', 'Non-billable time')}
|
|
657
|
+
</Label>
|
|
658
|
+
<Select
|
|
659
|
+
value={nonbillableMode}
|
|
660
|
+
onValueChange={(value) => setNonbillableMode(value as NonbillableMode)}
|
|
661
|
+
>
|
|
662
|
+
<SelectTrigger id="report-nonbillable">
|
|
663
|
+
<SelectValue />
|
|
664
|
+
</SelectTrigger>
|
|
665
|
+
<SelectContent>
|
|
666
|
+
<SelectItem value="separate">
|
|
667
|
+
{t('staff.time_tracking.reports.nonbillable.separate', 'Show separately, at no cost')}
|
|
668
|
+
</SelectItem>
|
|
669
|
+
<SelectItem value="exclude">
|
|
670
|
+
{t('staff.time_tracking.reports.nonbillable.exclude', 'Leave it out entirely')}
|
|
671
|
+
</SelectItem>
|
|
672
|
+
</SelectContent>
|
|
673
|
+
</Select>
|
|
674
|
+
</div>
|
|
675
|
+
</div>
|
|
676
|
+
<div className="flex items-start gap-3">
|
|
677
|
+
<Switch
|
|
678
|
+
checked={showRates}
|
|
679
|
+
onCheckedChange={(value) => setShowRates(value === true)}
|
|
680
|
+
aria-label={t('staff.time_tracking.reports.create.showRates', 'Show hourly rates')}
|
|
681
|
+
disabled={!canSeeMoney}
|
|
682
|
+
/>
|
|
683
|
+
<div className="flex flex-col">
|
|
684
|
+
<span className="text-sm font-medium">
|
|
685
|
+
{t('staff.time_tracking.reports.create.showRates', 'Show hourly rates')}
|
|
686
|
+
</span>
|
|
687
|
+
<span className="text-xs text-muted-foreground">
|
|
688
|
+
{t(
|
|
689
|
+
'staff.time_tracking.reports.create.showRatesHint',
|
|
690
|
+
'Turn off if the client should see amounts only.',
|
|
691
|
+
)}
|
|
692
|
+
</span>
|
|
693
|
+
</div>
|
|
694
|
+
</div>
|
|
695
|
+
</section>
|
|
696
|
+
|
|
697
|
+
<InjectionSpot
|
|
698
|
+
spotId={extensionSpotChildId(extensionPoints.hosts.reportForm.spotId, 'fields')}
|
|
699
|
+
context={reportFormInjectionContext}
|
|
700
|
+
data={reportFormValues}
|
|
701
|
+
/>
|
|
702
|
+
</div>
|
|
703
|
+
|
|
704
|
+
<aside className="flex flex-col gap-4">
|
|
705
|
+
<Card>
|
|
706
|
+
<CardHeader>
|
|
707
|
+
<CardTitle>{t('staff.time_tracking.reports.create.summary', 'Range summary')}</CardTitle>
|
|
708
|
+
</CardHeader>
|
|
709
|
+
<CardContent className="flex flex-col gap-3">
|
|
710
|
+
<SummaryRow
|
|
711
|
+
label={t('staff.time_tracking.reports.create.summaryProjects', 'Projects')}
|
|
712
|
+
value={`${selectedIds.length} / ${candidates.length}`}
|
|
713
|
+
/>
|
|
714
|
+
<SummaryRow
|
|
715
|
+
label={t('staff.time_tracking.reports.create.summaryEntries', 'Entries')}
|
|
716
|
+
value={String(preview?.totals.entryCount ?? 0)}
|
|
717
|
+
mono
|
|
718
|
+
/>
|
|
719
|
+
<SummaryRow
|
|
720
|
+
label={t('staff.time_tracking.reports.create.summaryBillable', 'Billable time')}
|
|
721
|
+
value={formatReportMinutes(preview?.totals.billableMinutes ?? 0)}
|
|
722
|
+
mono
|
|
723
|
+
/>
|
|
724
|
+
<SummaryRow
|
|
725
|
+
label={t('staff.time_tracking.reports.create.summaryNonbillable', 'Non-billable')}
|
|
726
|
+
value={formatReportMinutes(preview?.totals.nonbillableMinutes ?? 0)}
|
|
727
|
+
mono
|
|
728
|
+
/>
|
|
729
|
+
<Separator />
|
|
730
|
+
<div className="flex items-center justify-between">
|
|
731
|
+
<span className="text-sm font-medium">
|
|
732
|
+
{t('staff.time_tracking.reports.create.summaryTotal', 'To invoice')}
|
|
733
|
+
</span>
|
|
734
|
+
<span className="font-mono text-sm font-semibold tabular-nums">
|
|
735
|
+
{previewLoading ? <Spinner className="size-4" /> : money(preview?.totals.totalAmount ?? null)}
|
|
736
|
+
</span>
|
|
737
|
+
</div>
|
|
738
|
+
</CardContent>
|
|
739
|
+
</Card>
|
|
740
|
+
|
|
741
|
+
{conflict ? (
|
|
742
|
+
<Alert status="error">
|
|
743
|
+
<AlertTitle>
|
|
744
|
+
{t('staff.time_tracking.reports.errors.currencyConflictTitle', 'Mixed currencies in this selection')}
|
|
745
|
+
</AlertTitle>
|
|
746
|
+
<AlertDescription>
|
|
747
|
+
<p>
|
|
748
|
+
{t(
|
|
749
|
+
'staff.time_tracking.reports.errors.currencyConflict',
|
|
750
|
+
'A report always covers one currency. Selected projects use {currencies}.',
|
|
751
|
+
).replace('{currencies}', conflict.currencies.join(', '))}
|
|
752
|
+
</p>
|
|
753
|
+
<ul className="mt-2 list-disc pl-4">
|
|
754
|
+
{conflict.offenders.map((offender) => (
|
|
755
|
+
<li key={offender.id}>
|
|
756
|
+
{offender.name} — {offender.currencyCode ?? '—'}
|
|
757
|
+
</li>
|
|
758
|
+
))}
|
|
759
|
+
</ul>
|
|
760
|
+
</AlertDescription>
|
|
761
|
+
</Alert>
|
|
762
|
+
) : null}
|
|
763
|
+
|
|
764
|
+
{previewError ? <ErrorMessage label={previewError} /> : null}
|
|
765
|
+
|
|
766
|
+
{(preview?.alreadyReportedCount ?? 0) > 0 || includeAlreadyReported ? (
|
|
767
|
+
<Alert status="warning" icon={<AlertTriangle aria-hidden="true" />}>
|
|
768
|
+
<AlertTitle>
|
|
769
|
+
{t(
|
|
770
|
+
'staff.time_tracking.reports.alreadyReported.title',
|
|
771
|
+
'{count} entries are already in another report',
|
|
772
|
+
).replace('{count}', String(preview?.alreadyReportedCount ?? 0))}
|
|
773
|
+
</AlertTitle>
|
|
774
|
+
<AlertDescription>
|
|
775
|
+
<p>
|
|
776
|
+
{t(
|
|
777
|
+
'staff.time_tracking.reports.alreadyReported.body',
|
|
778
|
+
'They are excluded from this report so the same hour is not billed twice. Including them adds {hours} at the values frozen when those reports were closed.',
|
|
779
|
+
).replace('{hours}', formatReportMinutes(preview?.alreadyReportedMinutes ?? 0))}
|
|
780
|
+
</p>
|
|
781
|
+
{(preview?.alreadyReportedIn.length ?? 0) > 0 ? (
|
|
782
|
+
<ul className="mt-2 list-disc pl-4">
|
|
783
|
+
{preview?.alreadyReportedIn.map((source) => (
|
|
784
|
+
<li key={source.reportId}>
|
|
785
|
+
<a className="underline" href={`${REPORTS_HREF}/${source.reportId}`}>
|
|
786
|
+
{source.reference ?? source.title ?? source.reportId}
|
|
787
|
+
</a>{' '}
|
|
788
|
+
— {source.entryCount} · {formatReportMinutes(source.minutes)}
|
|
789
|
+
</li>
|
|
790
|
+
))}
|
|
791
|
+
</ul>
|
|
792
|
+
) : null}
|
|
793
|
+
<label className="mt-3 flex items-start gap-2">
|
|
794
|
+
<Checkbox
|
|
795
|
+
checked={includeAlreadyReported}
|
|
796
|
+
onCheckedChange={(value) => setIncludeAlreadyReported(value === true)}
|
|
797
|
+
/>
|
|
798
|
+
<span className="text-sm">
|
|
799
|
+
{t(
|
|
800
|
+
'staff.time_tracking.reports.alreadyReported.optIn',
|
|
801
|
+
'Include them anyway, at their frozen values',
|
|
802
|
+
)}
|
|
803
|
+
</span>
|
|
804
|
+
</label>
|
|
805
|
+
</AlertDescription>
|
|
806
|
+
</Alert>
|
|
807
|
+
) : null}
|
|
808
|
+
|
|
809
|
+
<Alert status="information" icon={<Info aria-hidden="true" />}>
|
|
810
|
+
<AlertDescription>
|
|
811
|
+
{t(
|
|
812
|
+
'staff.time_tracking.reports.create.roundingNotice',
|
|
813
|
+
'Rounding: {rule} (global). Every amount above is rounded at the entry and then summed, so the printed lines add up to the total.',
|
|
814
|
+
).replace(
|
|
815
|
+
'{rule}',
|
|
816
|
+
preview?.rounding.unitMinutes || candidatePreview?.rounding.unitMinutes
|
|
817
|
+
? t('staff.time_tracking.reports.create.roundingRule', '{minutes} min, {direction}')
|
|
818
|
+
.replace(
|
|
819
|
+
'{minutes}',
|
|
820
|
+
String(preview?.rounding.unitMinutes ?? candidatePreview?.rounding.unitMinutes ?? 0),
|
|
821
|
+
)
|
|
822
|
+
.replace(
|
|
823
|
+
'{direction}',
|
|
824
|
+
(preview?.rounding.direction ?? candidatePreview?.rounding.direction) === 'nearest'
|
|
825
|
+
? t('staff.time_tracking.reports.create.roundingNearest', 'to the nearest')
|
|
826
|
+
: t('staff.time_tracking.reports.create.roundingUp', 'always up'),
|
|
827
|
+
)
|
|
828
|
+
: t('staff.time_tracking.reports.create.roundingOff', 'off'),
|
|
829
|
+
)}
|
|
830
|
+
</AlertDescription>
|
|
831
|
+
</Alert>
|
|
832
|
+
</aside>
|
|
833
|
+
</div>
|
|
834
|
+
|
|
835
|
+
<InjectionSpot
|
|
836
|
+
spotId={extensionSpotChildId(extensionPoints.hosts.reportForm.spotId, 'after-fields')}
|
|
837
|
+
context={reportFormInjectionContext}
|
|
838
|
+
data={reportFormValues}
|
|
839
|
+
/>
|
|
840
|
+
|
|
841
|
+
<div className="mt-6 flex items-center justify-end gap-2">
|
|
842
|
+
<InjectionSpot
|
|
843
|
+
spotId={extensionSpotChildId(extensionPoints.hosts.reportForm.spotId, 'footer')}
|
|
844
|
+
context={reportFormInjectionContext}
|
|
845
|
+
data={reportFormValues}
|
|
846
|
+
/>
|
|
847
|
+
<Button variant="ghost" onClick={() => router.push(REPORTS_HREF)}>
|
|
848
|
+
{t('staff.time_tracking.reports.create.cancel', 'Cancel')}
|
|
849
|
+
</Button>
|
|
850
|
+
<Button onClick={() => void handleSubmit()} disabled={!canSubmit}>
|
|
851
|
+
<FileText aria-hidden="true" />
|
|
852
|
+
{t('staff.time_tracking.reports.create.submit', 'Generate preview')}
|
|
853
|
+
</Button>
|
|
854
|
+
</div>
|
|
855
|
+
</PageBody>
|
|
856
|
+
</Page>
|
|
857
|
+
)
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function SummaryRow({ label, value, mono }: { label: string; value: string; mono?: boolean }) {
|
|
861
|
+
return (
|
|
862
|
+
<div className="flex items-center justify-between">
|
|
863
|
+
<span className="text-sm text-muted-foreground">{label}</span>
|
|
864
|
+
<span className={mono ? 'font-mono text-sm tabular-nums' : 'text-sm font-medium'}>{value}</span>
|
|
865
|
+
</div>
|
|
866
|
+
)
|
|
867
|
+
}
|