@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,400 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deriveInterval,
|
|
3
|
+
formatClock,
|
|
4
|
+
parseClock,
|
|
5
|
+
type ComputedIntervalField,
|
|
6
|
+
type IntervalInput,
|
|
7
|
+
} from '../time-tracking/interval'
|
|
8
|
+
|
|
9
|
+
export type IntervalField = 'start' | 'end' | 'duration'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The 2-of-3 state of screen 8. It keeps the three fields as the user left them
|
|
13
|
+
* plus the answer `deriveInterval` gave for the third one, so the badge and the
|
|
14
|
+
* hint can be read straight off the state instead of being recomputed in the
|
|
15
|
+
* render path.
|
|
16
|
+
*/
|
|
17
|
+
export type TimeIntervalState = {
|
|
18
|
+
/** Raw clock text, so half-typed input (`15:1`) is never rewritten. */
|
|
19
|
+
startText: string
|
|
20
|
+
endText: string
|
|
21
|
+
durationMinutes: number | null
|
|
22
|
+
/** `DurationInput` said the text does not parse — Save is blocked on this. */
|
|
23
|
+
durationInvalid: boolean
|
|
24
|
+
computed: ComputedIntervalField
|
|
25
|
+
crossesMidnight: boolean
|
|
26
|
+
/**
|
|
27
|
+
* Bumped only when the *derived* duration changes. The dialog uses it as the
|
|
28
|
+
* `key` of `DurationInput`, so a machine-filled duration re-renders while the
|
|
29
|
+
* text the user is typing there is left alone.
|
|
30
|
+
*/
|
|
31
|
+
durationEpoch: number
|
|
32
|
+
lastEdited: IntervalField | null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type TimeIntervalEdit =
|
|
36
|
+
| { field: 'start'; value: string }
|
|
37
|
+
| { field: 'end'; value: string }
|
|
38
|
+
| { field: 'duration'; minutes: number | null; invalid: boolean }
|
|
39
|
+
/** "Snap start to 13:30" — moves the start and keeps the duration. */
|
|
40
|
+
| { field: 'snapStart'; value: string }
|
|
41
|
+
|
|
42
|
+
type RawInterval = {
|
|
43
|
+
startText: string
|
|
44
|
+
endText: string
|
|
45
|
+
durationMinutes: number | null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Which field yields when all three are filled. `start` is the anchor a person
|
|
50
|
+
* thinks in, so editing the end restates the duration (screen 8 note 1) rather
|
|
51
|
+
* than sliding the start backwards.
|
|
52
|
+
*/
|
|
53
|
+
const ANCHOR_PRIORITY: readonly IntervalField[] = ['start', 'end', 'duration']
|
|
54
|
+
|
|
55
|
+
function hasValue(raw: RawInterval, field: IntervalField): boolean {
|
|
56
|
+
if (field === 'duration') return raw.durationMinutes !== null
|
|
57
|
+
return parseClock(field === 'start' ? raw.startText : raw.endText) !== null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function chooseAnchors(raw: RawInterval, lastEdited: IntervalField | null): IntervalField[] {
|
|
61
|
+
const present = ANCHOR_PRIORITY.filter((field) => hasValue(raw, field))
|
|
62
|
+
if (present.length <= 2) return present
|
|
63
|
+
if (!lastEdited) return present.slice(0, 2)
|
|
64
|
+
const second = ANCHOR_PRIORITY.find((field) => field !== lastEdited && hasValue(raw, field))
|
|
65
|
+
return second ? [lastEdited, second] : [lastEdited]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function buildInput(raw: RawInterval, anchors: readonly IntervalField[]): IntervalInput {
|
|
69
|
+
const input: IntervalInput = {}
|
|
70
|
+
if (anchors.includes('start')) input.start = raw.startText
|
|
71
|
+
if (anchors.includes('end')) input.end = raw.endText
|
|
72
|
+
// With both clocks anchored the duration is still handed over: `deriveInterval`
|
|
73
|
+
// then answers `computed: null` for values that already agree, which is what
|
|
74
|
+
// keeps a freshly loaded entry from opening with a spurious badge.
|
|
75
|
+
if (anchors.includes('duration') || (anchors.includes('start') && anchors.includes('end'))) {
|
|
76
|
+
input.durationMinutes = raw.durationMinutes
|
|
77
|
+
}
|
|
78
|
+
return input
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function applyDerivation(
|
|
82
|
+
raw: RawInterval,
|
|
83
|
+
previous: TimeIntervalState,
|
|
84
|
+
lastEdited: IntervalField | null,
|
|
85
|
+
anchors: readonly IntervalField[],
|
|
86
|
+
): TimeIntervalState {
|
|
87
|
+
const derived = deriveInterval(buildInput(raw, anchors))
|
|
88
|
+
const durationMinutes = derived.computed === 'duration' ? derived.durationMinutes : raw.durationMinutes
|
|
89
|
+
const durationChanged = derived.computed === 'duration' && durationMinutes !== previous.durationMinutes
|
|
90
|
+
return {
|
|
91
|
+
startText: derived.computed === 'start' && derived.start ? derived.start : raw.startText,
|
|
92
|
+
endText: derived.computed === 'end' && derived.end ? derived.end : raw.endText,
|
|
93
|
+
durationMinutes,
|
|
94
|
+
durationInvalid: derived.computed === 'duration' ? false : previous.durationInvalid,
|
|
95
|
+
computed: derived.computed,
|
|
96
|
+
crossesMidnight: derived.crossesMidnight,
|
|
97
|
+
durationEpoch: durationChanged ? previous.durationEpoch + 1 : previous.durationEpoch,
|
|
98
|
+
lastEdited,
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const EMPTY_STATE: TimeIntervalState = {
|
|
103
|
+
startText: '',
|
|
104
|
+
endText: '',
|
|
105
|
+
durationMinutes: null,
|
|
106
|
+
durationInvalid: false,
|
|
107
|
+
computed: null,
|
|
108
|
+
crossesMidnight: false,
|
|
109
|
+
durationEpoch: 0,
|
|
110
|
+
lastEdited: null,
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function createIntervalState(seed: {
|
|
114
|
+
start?: string | null
|
|
115
|
+
end?: string | null
|
|
116
|
+
durationMinutes?: number | null
|
|
117
|
+
}): TimeIntervalState {
|
|
118
|
+
const raw: RawInterval = {
|
|
119
|
+
startText: seed.start ?? '',
|
|
120
|
+
endText: seed.end ?? '',
|
|
121
|
+
durationMinutes: seed.durationMinutes ?? null,
|
|
122
|
+
}
|
|
123
|
+
return applyDerivation(raw, EMPTY_STATE, null, chooseAnchors(raw, null))
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Re-seeds the three fields for a different entry — or for the next one after
|
|
128
|
+
* "save and add another" — and always advances `durationEpoch`, so the duration
|
|
129
|
+
* field remounts and drops whatever text was left in it.
|
|
130
|
+
*/
|
|
131
|
+
export function resetIntervalState(
|
|
132
|
+
previous: TimeIntervalState,
|
|
133
|
+
seed: { start?: string | null; end?: string | null; durationMinutes?: number | null },
|
|
134
|
+
): TimeIntervalState {
|
|
135
|
+
const next = createIntervalState(seed)
|
|
136
|
+
return { ...next, durationEpoch: previous.durationEpoch + 1 }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function reduceIntervalState(state: TimeIntervalState, edit: TimeIntervalEdit): TimeIntervalState {
|
|
140
|
+
if (edit.field === 'snapStart') {
|
|
141
|
+
const raw: RawInterval = { ...toRaw(state), startText: edit.value }
|
|
142
|
+
// The suggestion moves the start and keeps the length of the work, so the
|
|
143
|
+
// end is the field that follows — never the duration the user already typed.
|
|
144
|
+
const anchors: IntervalField[] = raw.durationMinutes !== null ? ['start', 'duration'] : ['start', 'end']
|
|
145
|
+
return applyDerivation(raw, state, 'start', anchors)
|
|
146
|
+
}
|
|
147
|
+
if (edit.field === 'duration') {
|
|
148
|
+
const raw: RawInterval = { ...toRaw(state), durationMinutes: edit.minutes }
|
|
149
|
+
const next = applyDerivation(raw, state, 'duration', chooseAnchors(raw, 'duration'))
|
|
150
|
+
return { ...next, durationInvalid: edit.invalid }
|
|
151
|
+
}
|
|
152
|
+
const raw: RawInterval =
|
|
153
|
+
edit.field === 'start'
|
|
154
|
+
? { ...toRaw(state), startText: edit.value }
|
|
155
|
+
: { ...toRaw(state), endText: edit.value }
|
|
156
|
+
return applyDerivation(raw, state, edit.field, chooseAnchors(raw, edit.field))
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function toRaw(state: TimeIntervalState): RawInterval {
|
|
160
|
+
return { startText: state.startText, endText: state.endText, durationMinutes: state.durationMinutes }
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/
|
|
164
|
+
|
|
165
|
+
export function shiftIsoDate(date: string, days: number): string {
|
|
166
|
+
const match = DATE_PATTERN.exec(date)
|
|
167
|
+
if (!match) return date
|
|
168
|
+
const shifted = new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]) + days))
|
|
169
|
+
const month = String(shifted.getUTCMonth() + 1).padStart(2, '0')
|
|
170
|
+
const day = String(shifted.getUTCDate()).padStart(2, '0')
|
|
171
|
+
return `${shifted.getUTCFullYear()}-${month}-${day}`
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function todayIsoDate(now: Date = new Date()): string {
|
|
175
|
+
const month = String(now.getMonth() + 1).padStart(2, '0')
|
|
176
|
+
const day = String(now.getDate()).padStart(2, '0')
|
|
177
|
+
return `${now.getFullYear()}-${month}-${day}`
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Wall clock plus calendar day into the instant the API stores. `plusDays` is 1
|
|
182
|
+
* for the end of an entry that crosses midnight (D-8): the work started on
|
|
183
|
+
* `date` and finished the following calendar day.
|
|
184
|
+
*/
|
|
185
|
+
export function combineDateAndClock(date: string, clock: string, plusDays = 0): string | null {
|
|
186
|
+
const match = DATE_PATTERN.exec(date)
|
|
187
|
+
const minutesOfDay = parseClock(clock)
|
|
188
|
+
if (!match || minutesOfDay === null) return null
|
|
189
|
+
const composed = new Date(
|
|
190
|
+
Number(match[1]),
|
|
191
|
+
Number(match[2]) - 1,
|
|
192
|
+
Number(match[3]) + plusDays,
|
|
193
|
+
Math.floor(minutesOfDay / 60),
|
|
194
|
+
minutesOfDay % 60,
|
|
195
|
+
0,
|
|
196
|
+
0,
|
|
197
|
+
)
|
|
198
|
+
if (Number.isNaN(composed.getTime())) return null
|
|
199
|
+
return composed.toISOString()
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Accepts the wall clock the form sends and the timestamp the timer persists. */
|
|
203
|
+
export function clockFromApiValue(value: unknown): string {
|
|
204
|
+
if (typeof value !== 'string' || value.trim().length === 0) return ''
|
|
205
|
+
const trimmed = value.trim()
|
|
206
|
+
const direct = parseClock(trimmed)
|
|
207
|
+
if (direct !== null) return formatClock(direct)
|
|
208
|
+
const parsed = new Date(trimmed)
|
|
209
|
+
if (Number.isNaN(parsed.getTime())) return ''
|
|
210
|
+
return formatClock(parsed.getHours() * 60 + parsed.getMinutes())
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function dateFromApiValue(value: unknown): string {
|
|
214
|
+
if (typeof value !== 'string' || value.trim().length === 0) return ''
|
|
215
|
+
const match = /^(\d{4}-\d{2}-\d{2})/.exec(value.trim())
|
|
216
|
+
if (match) return match[1]
|
|
217
|
+
const parsed = new Date(value)
|
|
218
|
+
if (Number.isNaN(parsed.getTime())) return ''
|
|
219
|
+
return todayIsoDate(parsed)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export type TimeEntryRecord = {
|
|
223
|
+
id: string
|
|
224
|
+
date: string
|
|
225
|
+
startText: string
|
|
226
|
+
endText: string
|
|
227
|
+
durationMinutes: number | null
|
|
228
|
+
description: string
|
|
229
|
+
taskId: string | null
|
|
230
|
+
timeProjectId: string | null
|
|
231
|
+
isBillable: boolean
|
|
232
|
+
rateOverrideAmount: number | null
|
|
233
|
+
currencyCode: string | null
|
|
234
|
+
tagIds: string[]
|
|
235
|
+
isLocked: boolean
|
|
236
|
+
lockedReportId: string | null
|
|
237
|
+
updatedAt: string | null
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export type ApiRow = Record<string, unknown>
|
|
241
|
+
|
|
242
|
+
export function readRowString(row: ApiRow, ...keys: string[]): string | null {
|
|
243
|
+
for (const key of keys) {
|
|
244
|
+
const value = row[key]
|
|
245
|
+
if (typeof value === 'string' && value.trim().length > 0) return value
|
|
246
|
+
}
|
|
247
|
+
return null
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function readRowNumber(row: ApiRow, ...keys: string[]): number | null {
|
|
251
|
+
for (const key of keys) {
|
|
252
|
+
const value = row[key]
|
|
253
|
+
if (typeof value === 'number' && Number.isFinite(value)) return value
|
|
254
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
255
|
+
const parsed = Number(value)
|
|
256
|
+
if (Number.isFinite(parsed)) return parsed
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return null
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export function readRowBoolean(row: ApiRow, fallback: boolean, ...keys: string[]): boolean {
|
|
263
|
+
for (const key of keys) {
|
|
264
|
+
const value = row[key]
|
|
265
|
+
if (typeof value === 'boolean') return value
|
|
266
|
+
}
|
|
267
|
+
return fallback
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function readRowItems(payload: unknown): ApiRow[] {
|
|
271
|
+
const items = (payload as { items?: unknown } | null)?.items
|
|
272
|
+
return Array.isArray(items) ? (items.filter((item) => !!item && typeof item === 'object') as ApiRow[]) : []
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export function toTimeEntryRecord(row: ApiRow): TimeEntryRecord | null {
|
|
276
|
+
const id = readRowString(row, 'id')
|
|
277
|
+
if (!id) return null
|
|
278
|
+
const tags = Array.isArray(row.tags) ? row.tags : []
|
|
279
|
+
return {
|
|
280
|
+
id,
|
|
281
|
+
date: dateFromApiValue(readRowString(row, 'date')),
|
|
282
|
+
startText: clockFromApiValue(readRowString(row, 'started_at', 'startedAt')),
|
|
283
|
+
endText: clockFromApiValue(readRowString(row, 'ended_at', 'endedAt')),
|
|
284
|
+
durationMinutes: readRowNumber(row, 'duration_minutes', 'durationMinutes'),
|
|
285
|
+
description: readRowString(row, 'description', 'notes') ?? '',
|
|
286
|
+
taskId: readRowString(row, 'task_id', 'taskId'),
|
|
287
|
+
timeProjectId: readRowString(row, 'time_project_id', 'timeProjectId'),
|
|
288
|
+
isBillable: readRowBoolean(row, true, 'is_billable', 'isBillable'),
|
|
289
|
+
rateOverrideAmount: readRowNumber(row, 'rate_override_amount', 'rateOverrideAmount'),
|
|
290
|
+
currencyCode: readRowString(row, 'currencyCode', 'rate_currency_code', 'rateCurrencyCode'),
|
|
291
|
+
tagIds: tags
|
|
292
|
+
.map((tag) => (tag && typeof tag === 'object' ? readRowString(tag as ApiRow, 'id') : null))
|
|
293
|
+
.filter((value): value is string => value !== null),
|
|
294
|
+
isLocked: readRowBoolean(row, false, 'isLocked', 'is_locked'),
|
|
295
|
+
lockedReportId: readRowString(row, 'lockedReportId', 'locked_report_id'),
|
|
296
|
+
updatedAt: readRowString(row, 'updated_at', 'updatedAt'),
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export type TaskOption = {
|
|
301
|
+
id: string
|
|
302
|
+
title: string
|
|
303
|
+
/** `<project code>-<n>` — frozen at creation, quoted in reports. */
|
|
304
|
+
reference: string | null
|
|
305
|
+
timeProjectId: string | null
|
|
306
|
+
/** Drives the picker's status dot. */
|
|
307
|
+
taskStatusId: string | null
|
|
308
|
+
/** Inclusive rollup from the tasks enricher; shown as context, never edited. */
|
|
309
|
+
loggedMinutes: number | null
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export type TagOption = {
|
|
313
|
+
id: string
|
|
314
|
+
label: string
|
|
315
|
+
/** A `PROJECT_COLOR_KEYS` key, resolved to a hex at render time. */
|
|
316
|
+
color: string | null
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export type ProjectOption = {
|
|
320
|
+
id: string
|
|
321
|
+
name: string
|
|
322
|
+
customerName: string | null
|
|
323
|
+
hourlyRate: number | null
|
|
324
|
+
currencyCode: string | null
|
|
325
|
+
billableByDefault: boolean | null
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export function toTaskOption(row: ApiRow): TaskOption | null {
|
|
329
|
+
const id = readRowString(row, 'id')
|
|
330
|
+
const title = readRowString(row, 'title')
|
|
331
|
+
if (!id || !title) return null
|
|
332
|
+
const logged = row.loggedMinutes ?? row.logged_minutes
|
|
333
|
+
return {
|
|
334
|
+
id,
|
|
335
|
+
title,
|
|
336
|
+
reference: readRowString(row, 'reference'),
|
|
337
|
+
timeProjectId: readRowString(row, 'time_project_id', 'timeProjectId'),
|
|
338
|
+
taskStatusId: readRowString(row, 'task_status_id', 'taskStatusId'),
|
|
339
|
+
loggedMinutes: typeof logged === 'number' ? logged : null,
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export function toProjectOption(row: ApiRow): ProjectOption | null {
|
|
344
|
+
const id = readRowString(row, 'id')
|
|
345
|
+
if (!id) return null
|
|
346
|
+
const snapshot = row.customer_snapshot ?? row.customerSnapshot
|
|
347
|
+
const customerName =
|
|
348
|
+
snapshot && typeof snapshot === 'object' ? readRowString(snapshot as ApiRow, 'name', 'displayName') : null
|
|
349
|
+
return {
|
|
350
|
+
id,
|
|
351
|
+
name: readRowString(row, 'name') ?? id,
|
|
352
|
+
customerName,
|
|
353
|
+
hourlyRate: readRowNumber(row, 'hourly_rate', 'hourlyRate'),
|
|
354
|
+
currencyCode: readRowString(row, 'currency_code', 'currencyCode'),
|
|
355
|
+
billableByDefault:
|
|
356
|
+
typeof row.billable_by_default === 'boolean'
|
|
357
|
+
? row.billable_by_default
|
|
358
|
+
: typeof row.billableByDefault === 'boolean'
|
|
359
|
+
? row.billableByDefault
|
|
360
|
+
: null,
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** `Migracja koszyka B2B — Nordvik — migracja B2B` (screen 8's task option). */
|
|
365
|
+
/**
|
|
366
|
+
* The reference leads, because it is what people actually say to each other about
|
|
367
|
+
* a task ("I put two hours on APOLLO-14") and what a client-facing report quotes.
|
|
368
|
+
* A list keyed on the title alone makes the picker unusable the moment two
|
|
369
|
+
* projects both have a "Consulting / workshops".
|
|
370
|
+
*/
|
|
371
|
+
export function describeTaskOption(task: TaskOption, project: ProjectOption | null | undefined): string {
|
|
372
|
+
const label = [task.title, project?.customerName ?? null, project?.name ?? null]
|
|
373
|
+
.filter((part): part is string => !!part && part.trim().length > 0)
|
|
374
|
+
.join(' — ')
|
|
375
|
+
return task.reference ? `${task.reference} · ${label}` : label
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export type OverlapEntry = {
|
|
379
|
+
id: string
|
|
380
|
+
startText: string
|
|
381
|
+
endText: string
|
|
382
|
+
durationMinutes: number
|
|
383
|
+
taskTitle: string | null
|
|
384
|
+
projectName: string | null
|
|
385
|
+
description: string | null
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export function toOverlapEntry(row: ApiRow): OverlapEntry | null {
|
|
389
|
+
const id = readRowString(row, 'id')
|
|
390
|
+
if (!id) return null
|
|
391
|
+
return {
|
|
392
|
+
id,
|
|
393
|
+
startText: clockFromApiValue(readRowString(row, 'started_at', 'startedAt')),
|
|
394
|
+
endText: clockFromApiValue(readRowString(row, 'ended_at', 'endedAt')),
|
|
395
|
+
durationMinutes: readRowNumber(row, 'duration_minutes', 'durationMinutes') ?? 0,
|
|
396
|
+
taskTitle: readRowString(row, 'task_title', 'taskTitle'),
|
|
397
|
+
projectName: readRowString(row, 'project_name', 'projectName'),
|
|
398
|
+
description: readRowString(row, 'notes', 'description'),
|
|
399
|
+
}
|
|
400
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reading half of screen 10 — everything the entries list needs that is not
|
|
3
|
+
* React. Kept out of the page so the rules the mockup's notes describe can be
|
|
4
|
+
* tested as arithmetic rather than through a rendered table.
|
|
5
|
+
*
|
|
6
|
+
* Three of those rules live here:
|
|
7
|
+
*
|
|
8
|
+
* 1. **Money is never summed across currencies.** `summarizeTimeEntries`
|
|
9
|
+
* returns one subtotal PER currency instead of a single number. A tenant
|
|
10
|
+
* billing one client in PLN and another in EUR would otherwise read a
|
|
11
|
+
* footer total that is arithmetically valid and financially meaningless.
|
|
12
|
+
* The renderer decides between "one currency → show it" and "several →
|
|
13
|
+
* show them apart", but it can never be handed a pre-added figure.
|
|
14
|
+
* 2. **A non-billable entry has no cost, not a zero cost.** The list route
|
|
15
|
+
* already answers `null` for it (screen 10 note 5); nothing here turns that
|
|
16
|
+
* into `0`, and the totals skip it rather than adding nothing to a currency
|
|
17
|
+
* that would then appear in the footer.
|
|
18
|
+
* 3. **The lock and the copy-day refusal are read off the response body, not
|
|
19
|
+
* off the status code.** `409` covers an optimistic-lock conflict, a locked
|
|
20
|
+
* entry and a non-empty copy-day target, and each one needs a different
|
|
21
|
+
* sentence in front of the user.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
clockFromApiValue,
|
|
26
|
+
dateFromApiValue,
|
|
27
|
+
readRowBoolean,
|
|
28
|
+
readRowNumber,
|
|
29
|
+
readRowString,
|
|
30
|
+
type ApiRow,
|
|
31
|
+
} from './timeEntryDialogState'
|
|
32
|
+
|
|
33
|
+
/** The shared refusal code every write path answers when an entry is frozen in a report. */
|
|
34
|
+
export const TIME_ENTRY_LOCKED_CODE = 'time_entry_locked'
|
|
35
|
+
|
|
36
|
+
/** The refusal a second "copy yesterday" click gets instead of a doubled day. */
|
|
37
|
+
export const COPY_DAY_TARGET_NOT_EMPTY_CODE = 'copy_day_target_not_empty'
|
|
38
|
+
|
|
39
|
+
export type TimeEntryListRow = {
|
|
40
|
+
id: string
|
|
41
|
+
date: string
|
|
42
|
+
taskId: string | null
|
|
43
|
+
taskTitle: string | null
|
|
44
|
+
timeProjectId: string | null
|
|
45
|
+
projectLabel: string | null
|
|
46
|
+
description: string | null
|
|
47
|
+
startText: string
|
|
48
|
+
endText: string
|
|
49
|
+
durationMinutes: number
|
|
50
|
+
roundedMinutes: number | null
|
|
51
|
+
isBillable: boolean
|
|
52
|
+
cost: number | null
|
|
53
|
+
currencyCode: string | null
|
|
54
|
+
rateOverrideAmount: number | null
|
|
55
|
+
isLocked: boolean
|
|
56
|
+
lockedReportId: string | null
|
|
57
|
+
updatedAt: string | null
|
|
58
|
+
tagIds: string[]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type TimeEntryDirectory = {
|
|
62
|
+
taskTitles: ReadonlyMap<string, string>
|
|
63
|
+
projectLabels: ReadonlyMap<string, string>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const EMPTY_TIME_ENTRY_DIRECTORY: TimeEntryDirectory = {
|
|
67
|
+
taskTitles: new Map<string, string>(),
|
|
68
|
+
projectLabels: new Map<string, string>(),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function readTagIds(row: ApiRow): string[] {
|
|
72
|
+
const tags = Array.isArray(row.tags) ? row.tags : []
|
|
73
|
+
return tags
|
|
74
|
+
.map((tag) => (tag && typeof tag === 'object' ? readRowString(tag as ApiRow, 'id') : null))
|
|
75
|
+
.filter((value): value is string => value !== null)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function toTimeEntryListRow(
|
|
79
|
+
row: ApiRow,
|
|
80
|
+
directory: TimeEntryDirectory = EMPTY_TIME_ENTRY_DIRECTORY,
|
|
81
|
+
): TimeEntryListRow | null {
|
|
82
|
+
const id = readRowString(row, 'id')
|
|
83
|
+
if (!id) return null
|
|
84
|
+
const taskId = readRowString(row, 'task_id', 'taskId')
|
|
85
|
+
const timeProjectId = readRowString(row, 'time_project_id', 'timeProjectId')
|
|
86
|
+
return {
|
|
87
|
+
id,
|
|
88
|
+
date: dateFromApiValue(readRowString(row, 'date')),
|
|
89
|
+
taskId,
|
|
90
|
+
taskTitle: taskId ? directory.taskTitles.get(taskId) ?? null : null,
|
|
91
|
+
timeProjectId,
|
|
92
|
+
projectLabel: timeProjectId ? directory.projectLabels.get(timeProjectId) ?? null : null,
|
|
93
|
+
description: readRowString(row, 'description', 'notes'),
|
|
94
|
+
startText: clockFromApiValue(readRowString(row, 'started_at', 'startedAt')),
|
|
95
|
+
endText: clockFromApiValue(readRowString(row, 'ended_at', 'endedAt')),
|
|
96
|
+
durationMinutes: readRowNumber(row, 'duration_minutes', 'durationMinutes') ?? 0,
|
|
97
|
+
roundedMinutes: readRowNumber(row, 'rounded_minutes', 'roundedMinutes'),
|
|
98
|
+
isBillable: readRowBoolean(row, true, 'is_billable', 'isBillable'),
|
|
99
|
+
cost: readRowNumber(row, 'cost'),
|
|
100
|
+
currencyCode: readRowString(row, 'currencyCode', 'rate_currency_code', 'rateCurrencyCode'),
|
|
101
|
+
rateOverrideAmount: readRowNumber(row, 'rate_override_amount', 'rateOverrideAmount'),
|
|
102
|
+
isLocked: readRowBoolean(row, false, 'isLocked', 'is_locked'),
|
|
103
|
+
lockedReportId: readRowString(row, 'lockedReportId', 'locked_report_id'),
|
|
104
|
+
updatedAt: readRowString(row, 'updated_at', 'updatedAt'),
|
|
105
|
+
tagIds: readTagIds(row),
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type MoneySubtotal = {
|
|
110
|
+
currencyCode: string | null
|
|
111
|
+
amount: number
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type TimeEntriesSummary = {
|
|
115
|
+
visibleCount: number
|
|
116
|
+
totalMinutes: number
|
|
117
|
+
/** One entry per currency present among the priced rows; never pre-added. */
|
|
118
|
+
money: MoneySubtotal[]
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The mockup's `Razem (5 z 23 wpisów) · 15:15 · 4 315,00 PLN`.
|
|
123
|
+
*
|
|
124
|
+
* The time total is the sum of the durations the table SHOWS, so the footer
|
|
125
|
+
* always reconciles against the column above it; cost is the server's `cost`,
|
|
126
|
+
* which is derived from rounded minutes and is therefore not a function of the
|
|
127
|
+
* displayed duration.
|
|
128
|
+
*/
|
|
129
|
+
export function summarizeTimeEntries(rows: readonly TimeEntryListRow[]): TimeEntriesSummary {
|
|
130
|
+
const byCurrency = new Map<string, MoneySubtotal>()
|
|
131
|
+
let totalMinutes = 0
|
|
132
|
+
for (const row of rows) {
|
|
133
|
+
totalMinutes += Number.isFinite(row.durationMinutes) ? row.durationMinutes : 0
|
|
134
|
+
if (row.cost === null || !Number.isFinite(row.cost)) continue
|
|
135
|
+
const key = row.currencyCode ?? ''
|
|
136
|
+
const current = byCurrency.get(key)
|
|
137
|
+
if (current) current.amount += row.cost
|
|
138
|
+
else byCurrency.set(key, { currencyCode: row.currencyCode ?? null, amount: row.cost })
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
visibleCount: rows.length,
|
|
142
|
+
totalMinutes,
|
|
143
|
+
money: Array.from(byCurrency.values()),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
type ErrorBag = Record<string, unknown>
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* `raiseCrudError` spreads the response body onto the thrown Error, but a
|
|
151
|
+
* caller that re-wraps it can leave the payload one level down. Both shapes are
|
|
152
|
+
* read so a lock refusal never degrades into "something went wrong".
|
|
153
|
+
*/
|
|
154
|
+
function errorPayloads(error: unknown): ErrorBag[] {
|
|
155
|
+
if (!error || typeof error !== 'object') return []
|
|
156
|
+
const bags: ErrorBag[] = [error as ErrorBag]
|
|
157
|
+
const nested = (error as { body?: unknown }).body
|
|
158
|
+
if (nested && typeof nested === 'object') bags.push(nested as ErrorBag)
|
|
159
|
+
return bags
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function readErrorCode(error: unknown): string | null {
|
|
163
|
+
for (const bag of errorPayloads(error)) {
|
|
164
|
+
if (typeof bag.code === 'string' && bag.code.length > 0) return bag.code
|
|
165
|
+
}
|
|
166
|
+
return null
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function readErrorStatus(error: unknown): number | null {
|
|
170
|
+
for (const bag of errorPayloads(error)) {
|
|
171
|
+
if (typeof bag.status === 'number' && Number.isFinite(bag.status)) return bag.status
|
|
172
|
+
}
|
|
173
|
+
return null
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* True for the `409 time_entry_locked` every write path answers for an entry a
|
|
178
|
+
* closed report has frozen. `entry_locked` is accepted as well so a route that
|
|
179
|
+
* spells the code without its resource prefix still reads as a lock rather than
|
|
180
|
+
* as a generic failure.
|
|
181
|
+
*/
|
|
182
|
+
export function isEntryLockedError(error: unknown): boolean {
|
|
183
|
+
const code = readErrorCode(error)
|
|
184
|
+
return code === TIME_ENTRY_LOCKED_CODE || code === 'entry_locked'
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export type CopyDayTargetConflict = {
|
|
188
|
+
toDate: string | null
|
|
189
|
+
existingEntryCount: number
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The `409 copy_day_target_not_empty` that names what is already on the target
|
|
194
|
+
* day. Returning the count is the whole point: the user has to be told what
|
|
195
|
+
* they would be adding to before they are offered `allowDuplicates`.
|
|
196
|
+
*/
|
|
197
|
+
export function readCopyDayTargetConflict(error: unknown): CopyDayTargetConflict | null {
|
|
198
|
+
if (readErrorCode(error) !== COPY_DAY_TARGET_NOT_EMPTY_CODE) return null
|
|
199
|
+
for (const bag of errorPayloads(error)) {
|
|
200
|
+
if (bag.code !== COPY_DAY_TARGET_NOT_EMPTY_CODE) continue
|
|
201
|
+
const count = bag.existingEntryCount
|
|
202
|
+
const ids = Array.isArray(bag.existingEntryIds) ? bag.existingEntryIds.length : 0
|
|
203
|
+
return {
|
|
204
|
+
toDate: typeof bag.toDate === 'string' ? bag.toDate : null,
|
|
205
|
+
existingEntryCount: typeof count === 'number' && Number.isFinite(count) ? count : ids,
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return { toDate: null, existingEntryCount: 0 }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export type IsoDateRange = {
|
|
212
|
+
from: string
|
|
213
|
+
to: string
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function toIsoDay(date: Date): string {
|
|
217
|
+
const year = date.getFullYear()
|
|
218
|
+
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
219
|
+
const day = String(date.getDate()).padStart(2, '0')
|
|
220
|
+
return `${year}-${month}-${day}`
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Monday-to-Sunday, matching the mockup's "Okres: ten tydzień" default. The
|
|
225
|
+
* week is computed in local time because a time entry is addressed by its
|
|
226
|
+
* calendar day, not by an instant.
|
|
227
|
+
*/
|
|
228
|
+
export function currentWeekRange(now: Date = new Date()): IsoDateRange {
|
|
229
|
+
const start = new Date(now.getFullYear(), now.getMonth(), now.getDate())
|
|
230
|
+
const weekday = (start.getDay() + 6) % 7
|
|
231
|
+
start.setDate(start.getDate() - weekday)
|
|
232
|
+
const end = new Date(start)
|
|
233
|
+
end.setDate(end.getDate() + 6)
|
|
234
|
+
return { from: toIsoDay(start), to: toIsoDay(end) }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* `pon 20 lip` — the weekday the mockup leads each row with. The locale is left
|
|
239
|
+
* to the runtime by default, exactly as `formatDate`/`formatCurrency` do, so a
|
|
240
|
+
* date on this page reads the same way as a date anywhere else in the backoffice.
|
|
241
|
+
*/
|
|
242
|
+
export function formatEntryDay(isoDate: string, locale?: string): string {
|
|
243
|
+
if (!isoDate) return ''
|
|
244
|
+
const parsed = new Date(`${isoDate}T00:00:00`)
|
|
245
|
+
if (Number.isNaN(parsed.getTime())) return isoDate
|
|
246
|
+
try {
|
|
247
|
+
return new Intl.DateTimeFormat(locale, { weekday: 'short', day: 'numeric', month: 'short' }).format(parsed)
|
|
248
|
+
} catch {
|
|
249
|
+
return isoDate
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** `09:00 – 11:30`, or an em-dash when the entry carries no clock times. */
|
|
254
|
+
export function formatEntryClockRange(row: Pick<TimeEntryListRow, 'startText' | 'endText'>): string | null {
|
|
255
|
+
if (!row.startText && !row.endText) return null
|
|
256
|
+
if (row.startText && row.endText) return `${row.startText} – ${row.endText}`
|
|
257
|
+
return row.startText || row.endText
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function collectDirectoryIds(rows: readonly TimeEntryListRow[]): {
|
|
261
|
+
taskIds: string[]
|
|
262
|
+
projectIds: string[]
|
|
263
|
+
} {
|
|
264
|
+
const taskIds = new Set<string>()
|
|
265
|
+
const projectIds = new Set<string>()
|
|
266
|
+
for (const row of rows) {
|
|
267
|
+
if (row.taskId) taskIds.add(row.taskId)
|
|
268
|
+
if (row.timeProjectId) projectIds.add(row.timeProjectId)
|
|
269
|
+
}
|
|
270
|
+
return { taskIds: Array.from(taskIds), projectIds: Array.from(projectIds) }
|
|
271
|
+
}
|