@open-mercato/core 0.7.1-develop.7178.1.ab93fbaf4e → 0.7.1-develop.7180.1.9717fbbb43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/staff_time_entry/index.js +14 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +2 -2
- package/dist/generated/entities/staff_time_entry_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_entry_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +16 -0
- package/dist/generated/entities/staff_time_project/index.js.map +2 -2
- package/dist/generated/entities/staff_time_report/index.js +57 -0
- package/dist/generated/entities/staff_time_report/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_entry/index.js +27 -0
- package/dist/generated/entities/staff_time_report_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_event/index.js +21 -0
- package/dist/generated/entities/staff_time_report_event/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_project/index.js +15 -0
- package/dist/generated/entities/staff_time_report_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_tag/index.js +21 -0
- package/dist/generated/entities/staff_time_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task/index.js +37 -0
- package/dist/generated/entities/staff_time_task/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_comment/index.js +21 -0
- package/dist/generated/entities/staff_time_task_comment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_status/index.js +29 -0
- package/dist/generated/entities/staff_time_task_status/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_task_tag/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +11 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +149 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +7 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +2 -2
- package/dist/modules/auth/cli.js +16 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js +44 -0
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +1 -28
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +2 -0
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +39 -17
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/start-controls.js +42 -0
- package/dist/modules/data_sync/lib/start-controls.js.map +7 -0
- package/dist/modules/staff/acl.js +9 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/ai-agents.js +142 -0
- package/dist/modules/staff/ai-agents.js.map +7 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js +348 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js.map +7 -0
- package/dist/modules/staff/ai-tools/types.js +54 -0
- package/dist/modules/staff/ai-tools/types.js.map +7 -0
- package/dist/modules/staff/ai-tools.js +8 -0
- package/dist/modules/staff/ai-tools.js.map +7 -0
- package/dist/modules/staff/analytics.js +84 -1
- package/dist/modules/staff/analytics.js.map +2 -2
- package/dist/modules/staff/api/guards.js +37 -3
- package/dist/modules/staff/api/guards.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js +131 -0
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js.map +7 -0
- package/dist/modules/staff/api/portal/time-reports/route.js +179 -0
- package/dist/modules/staff/api/portal/time-reports/route.js.map +7 -0
- package/dist/modules/staff/api/team-members/self/route.js +1 -3
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +174 -0
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js +226 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +15 -8
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +13 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js +42 -0
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js +383 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +14 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +168 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +246 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +183 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +164 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +360 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/route.js +316 -0
- package/dist/modules/staff/api/timesheets/reports/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js +63 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +164 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js +168 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/route.js +199 -0
- package/dist/modules/staff/api/timesheets/settings/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/access.js +76 -0
- package/dist/modules/staff/api/timesheets/tags/access.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +235 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/route.js +160 -0
- package/dist/modules/staff/api/timesheets/tags/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +233 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js +188 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +399 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +210 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js +333 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +228 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +29 -10
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +31 -18
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +21 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +27 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +215 -32
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +378 -0
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +340 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +238 -26
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +23 -8
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +209 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +59 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +264 -22
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js +110 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js +981 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js +583 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js +15 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js +65 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js +229 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js +1014 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js +97 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js +1040 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js +19 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js +353 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js +457 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js +697 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js +174 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js +546 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js +710 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js +646 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +4 -793
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +2 -7
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +5 -136
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +5 -445
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +3 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +4 -76
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +4 -613
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +2 -17
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +2 -2
- package/dist/modules/staff/ce.js +40 -0
- package/dist/modules/staff/ce.js.map +2 -2
- package/dist/modules/staff/cli.js +166 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +5 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +569 -21
- package/dist/modules/staff/commands/timesheets-entries.js.map +3 -3
- package/dist/modules/staff/commands/timesheets-projects.js +450 -7
- package/dist/modules/staff/commands/timesheets-projects.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +1036 -0
- package/dist/modules/staff/commands/timesheets-reports.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tags.js +1015 -0
- package/dist/modules/staff/commands/timesheets-tags.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js +438 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js +723 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tasks.js +834 -0
- package/dist/modules/staff/commands/timesheets-tasks.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +426 -12
- package/dist/modules/staff/data/enrichers.js.map +2 -2
- package/dist/modules/staff/data/entities.js +552 -3
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/extensions.js +41 -0
- package/dist/modules/staff/data/extensions.js.map +7 -0
- package/dist/modules/staff/data/validators.js +254 -9
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/di.js +42 -1
- package/dist/modules/staff/di.js.map +2 -2
- package/dist/modules/staff/events.js +84 -6
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/events.payloads.js +158 -0
- package/dist/modules/staff/events.payloads.js.map +7 -0
- package/dist/modules/staff/extension-points.js +261 -0
- package/dist/modules/staff/extension-points.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js +138 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js +12 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js +133 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js +19 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js.map +7 -0
- package/dist/modules/staff/lib/crud.js +11 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/time-tracking/access.js +92 -0
- package/dist/modules/staff/lib/time-tracking/access.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/billability.js +39 -0
- package/dist/modules/staff/lib/time-tracking/billability.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js +68 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js +15 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/cost.js +82 -0
- package/dist/modules/staff/lib/time-tracking/cost.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/duration.js +55 -0
- package/dist/modules/staff/lib/time-tracking/duration.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js +41 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/interval.js +72 -0
- package/dist/modules/staff/lib/time-tracking/interval.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js +88 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js +10 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js +87 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js +27 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js +16 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js +135 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js +187 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js +80 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js +56 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js +63 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js +62 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js +21 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js +34 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js +66 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js +39 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js +214 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settings.js +87 -0
- package/dist/modules/staff/lib/time-tracking/settings.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js +9 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js +48 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js +283 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js +324 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js +121 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js +89 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js +855 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js +360 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js +259 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js +238 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js +130 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js +98 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js +27 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js +166 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js +295 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js +212 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js +729 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js +217 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js +158 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js +224 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js +93 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js +1196 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js +307 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js +284 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js +73 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js +1499 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js +95 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js +61 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js +45 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js +82 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js +5 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js +152 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js +92 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js +111 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js +243 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js +105 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js +132 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js +205 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js +53 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js +77 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js.map +7 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js +809 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js.map +7 -0
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js +2 -3
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js.map +2 -2
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js +152 -0
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js +36 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js +78 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js +44 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js +169 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js +22 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +51 -1
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js +70 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +63 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +170 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js +205 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js +68 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js +135 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js +48 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js +262 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js +34 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js +79 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js +11 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js +83 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js +42 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js +107 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js +289 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js +145 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js +116 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js +50 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js +27 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js +65 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js +17 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js +51 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +11 -4
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +369 -111
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +47 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +2 -2
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js +79 -0
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js +15 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js.map +7 -0
- package/dist/modules/staff/notifications.client.js +16 -0
- package/dist/modules/staff/notifications.client.js.map +7 -0
- package/dist/modules/staff/notifications.handlers.js +80 -0
- package/dist/modules/staff/notifications.handlers.js.map +7 -0
- package/dist/modules/staff/notifications.js +168 -0
- package/dist/modules/staff/notifications.js.map +2 -2
- package/dist/modules/staff/search.js +159 -1
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +20 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js +68 -0
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js +149 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js +78 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js +78 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js.map +7 -0
- package/dist/modules/staff/translations.js +4 -1
- package/dist/modules/staff/translations.js.map +2 -2
- package/dist/modules/staff/widgets/components.js +7 -0
- package/dist/modules/staff/widgets/components.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +5 -4
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +2 -2
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js +135 -0
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js.map +7 -0
- package/dist/modules/staff/widgets/notifications/index.js +5 -0
- package/dist/modules/staff/widgets/notifications/index.js.map +7 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js +43 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js.map +7 -0
- package/generated/entities/staff_time_entry/index.ts +7 -0
- package/generated/entities/staff_time_entry_tag/index.ts +6 -0
- package/generated/entities/staff_time_project/index.ts +8 -0
- package/generated/entities/staff_time_report/index.ts +27 -0
- package/generated/entities/staff_time_report_entry/index.ts +12 -0
- package/generated/entities/staff_time_report_event/index.ts +9 -0
- package/generated/entities/staff_time_report_project/index.ts +6 -0
- package/generated/entities/staff_time_tag/index.ts +9 -0
- package/generated/entities/staff_time_task/index.ts +17 -0
- package/generated/entities/staff_time_task_comment/index.ts +9 -0
- package/generated/entities/staff_time_task_status/index.ts +13 -0
- package/generated/entities/staff_time_task_tag/index.ts +6 -0
- package/generated/entities.ids.generated.ts +11 -1
- package/generated/entity-fields-registry.ts +149 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +31 -1
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/cli.ts +35 -1
- package/src/modules/auth/i18n/de.json +7 -0
- package/src/modules/auth/i18n/en.json +7 -0
- package/src/modules/auth/i18n/es.json +7 -0
- package/src/modules/auth/i18n/ko.json +7 -0
- package/src/modules/auth/i18n/pl.json +7 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/customer_accounts/lib/customerRoleAcls.ts +79 -0
- package/src/modules/customer_accounts/setup.ts +1 -45
- package/src/modules/data_sync/AGENTS.md +34 -0
- package/src/modules/data_sync/api/options.ts +2 -0
- package/src/modules/data_sync/backend/data-sync/page.tsx +82 -33
- package/src/modules/data_sync/i18n/de.json +1 -0
- package/src/modules/data_sync/i18n/en.json +1 -0
- package/src/modules/data_sync/i18n/es.json +1 -0
- package/src/modules/data_sync/i18n/ko.json +1 -0
- package/src/modules/data_sync/i18n/pl.json +1 -0
- package/src/modules/data_sync/lib/adapter.ts +45 -0
- package/src/modules/data_sync/lib/start-controls.ts +89 -0
- package/src/modules/staff/AGENTS.md +769 -1
- package/src/modules/staff/acl.ts +9 -0
- package/src/modules/staff/ai-agents.ts +189 -0
- package/src/modules/staff/ai-tools/time-tracking-pack.ts +494 -0
- package/src/modules/staff/ai-tools/types.ts +82 -0
- package/src/modules/staff/ai-tools.ts +13 -0
- package/src/modules/staff/analytics.ts +113 -0
- package/src/modules/staff/api/guards.ts +85 -3
- package/src/modules/staff/api/leave-requests/accept/route.ts +0 -2
- package/src/modules/staff/api/leave-requests/reject/route.ts +0 -2
- package/src/modules/staff/api/portal/time-reports/[id]/route.ts +182 -0
- package/src/modules/staff/api/portal/time-reports/route.ts +270 -0
- package/src/modules/staff/api/team-members/self/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/assign/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +0 -2
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +292 -0
- package/src/modules/staff/api/timesheets/access-requests/route.ts +299 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +15 -7
- package/src/modules/staff/api/timesheets/my-projects/route.ts +14 -1
- package/src/modules/staff/api/timesheets/my-work/myWorkAggregate.ts +90 -0
- package/src/modules/staff/api/timesheets/my-work/route.ts +475 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +15 -2
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +203 -0
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +315 -0
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +220 -0
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +208 -0
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +449 -0
- package/src/modules/staff/api/timesheets/reports/route.ts +386 -0
- package/src/modules/staff/api/timesheets/reports/shared.ts +121 -0
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +205 -0
- package/src/modules/staff/api/timesheets/settings/rounding-impact/route.ts +226 -0
- package/src/modules/staff/api/timesheets/settings/route.ts +242 -0
- package/src/modules/staff/api/timesheets/tags/access.ts +134 -0
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +290 -0
- package/src/modules/staff/api/timesheets/tags/route.ts +177 -0
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +294 -0
- package/src/modules/staff/api/timesheets/task-statuses/route.ts +232 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +532 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +271 -0
- package/src/modules/staff/api/timesheets/tasks/route.ts +443 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +306 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +32 -10
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +32 -17
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +27 -6
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +36 -6
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +331 -34
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +533 -0
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +457 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +378 -24
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +31 -9
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +246 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +62 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +397 -22
- package/src/modules/staff/backend/staff/time-tracking/board/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/board/page.tsx +151 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.tsx +1229 -0
- package/src/modules/staff/backend/staff/time-tracking/page.meta.ts +11 -0
- package/src/modules/staff/backend/staff/time-tracking/page.tsx +823 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.tsx +81 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.tsx +275 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.tsx +1420 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.tsx +109 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.meta.ts +15 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.tsx +1254 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.ts +466 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.tsx +632 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.tsx +867 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.tsx +246 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.tsx +701 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/GridView.tsx +953 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.tsx +800 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +6 -6
- package/src/modules/staff/backend/staff/timesheets/page.tsx +12 -1010
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +4 -158
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +4 -609
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +3 -89
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +2 -19
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +3 -778
- package/src/modules/staff/ce.ts +63 -0
- package/src/modules/staff/cli.ts +207 -1
- package/src/modules/staff/commands/index.ts +5 -0
- package/src/modules/staff/commands/timesheets-entries.ts +1006 -28
- package/src/modules/staff/commands/timesheets-projects.ts +593 -7
- package/src/modules/staff/commands/timesheets-reports.ts +1329 -0
- package/src/modules/staff/commands/timesheets-tags.ts +1315 -0
- package/src/modules/staff/commands/timesheets-task-comments.ts +583 -0
- package/src/modules/staff/commands/timesheets-task-statuses.ts +889 -0
- package/src/modules/staff/commands/timesheets-tasks.ts +1121 -0
- package/src/modules/staff/data/enrichers.ts +675 -10
- package/src/modules/staff/data/entities.ts +494 -2
- package/src/modules/staff/data/extensions.ts +68 -0
- package/src/modules/staff/data/validators.ts +348 -3
- package/src/modules/staff/di.ts +96 -0
- package/src/modules/staff/events.payloads.ts +268 -0
- package/src/modules/staff/events.ts +87 -5
- package/src/modules/staff/extension-points.ts +308 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.ts +10 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.tsx +225 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.ts +17 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.tsx +182 -0
- package/src/modules/staff/i18n/de.json +899 -0
- package/src/modules/staff/i18n/en.json +899 -0
- package/src/modules/staff/i18n/es.json +899 -0
- package/src/modules/staff/i18n/ko.json +899 -0
- package/src/modules/staff/i18n/pl.json +899 -0
- package/src/modules/staff/lib/crud.ts +14 -3
- package/src/modules/staff/lib/time-tracking/access.ts +155 -0
- package/src/modules/staff/lib/time-tracking/billability.ts +68 -0
- package/src/modules/staff/lib/time-tracking/capacity.ts +124 -0
- package/src/modules/staff/lib/time-tracking/componentContracts.ts +26 -0
- package/src/modules/staff/lib/time-tracking/cost.ts +144 -0
- package/src/modules/staff/lib/time-tracking/duration.ts +68 -0
- package/src/modules/staff/lib/time-tracking/featureAccess.ts +115 -0
- package/src/modules/staff/lib/time-tracking/interval.ts +90 -0
- package/src/modules/staff/lib/time-tracking/migrateProjectCodes.ts +161 -0
- package/src/modules/staff/lib/time-tracking/moneyVisibility.ts +37 -0
- package/src/modules/staff/lib/time-tracking/overlap.ts +159 -0
- package/src/modules/staff/lib/time-tracking/portalRecipients.ts +76 -0
- package/src/modules/staff/lib/time-tracking/portalReports.ts +31 -0
- package/src/modules/staff/lib/time-tracking/projectCode.ts +221 -0
- package/src/modules/staff/lib/time-tracking/reapplyRounding.ts +313 -0
- package/src/modules/staff/lib/time-tracking/recalculationRunner.ts +118 -0
- package/src/modules/staff/lib/time-tracking/recalculations.ts +135 -0
- package/src/modules/staff/lib/time-tracking/registries/invoke.ts +122 -0
- package/src/modules/staff/lib/time-tracking/registries/registry.ts +124 -0
- package/src/modules/staff/lib/time-tracking/registries/scope.ts +56 -0
- package/src/modules/staff/lib/time-tracking/rollup.ts +59 -0
- package/src/modules/staff/lib/time-tracking/rounding.ts +126 -0
- package/src/modules/staff/lib/time-tracking/roundingImpact.ts +75 -0
- package/src/modules/staff/lib/time-tracking/settingKeys.ts +274 -0
- package/src/modules/staff/lib/time-tracking/settings.ts +168 -0
- package/src/modules/staff/lib/time-tracking/sqlInClause.ts +22 -0
- package/src/modules/staff/lib/time-tracking/timeEntrySources.ts +85 -0
- package/src/modules/staff/lib/time-tracking-ui/BoardFilterChips.tsx +360 -0
- package/src/modules/staff/lib/time-tracking-ui/CustomerPicker.tsx +427 -0
- package/src/modules/staff/lib/time-tracking-ui/DurationInput.tsx +192 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryDetailsFields.tsx +224 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryFilterBar.tsx +144 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanBoard.tsx +1065 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanCard.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanColumn.tsx +316 -0
- package/src/modules/staff/lib/time-tracking-ui/NewTaskDialog.tsx +291 -0
- package/src/modules/staff/lib/time-tracking-ui/NoProjectAccess.tsx +162 -0
- package/src/modules/staff/lib/time-tracking-ui/PeriodSelector.tsx +149 -0
- package/src/modules/staff/lib/time-tracking-ui/PhasePlaceholder.tsx +31 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCodeField.tsx +230 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.tsx +432 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectFormSections.tsx +323 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.tsx +930 -0
- package/src/modules/staff/lib/time-tracking-ui/ReportSheet.tsx +357 -0
- package/src/modules/staff/lib/time-tracking-ui/TagPicker.tsx +195 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskBoardScreen.tsx +243 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskCommentThread.tsx +137 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskDrawer.tsx +1405 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskListView.tsx +260 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskPicker.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskQuickLog.tsx +296 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.tsx +97 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDialog.tsx +1929 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.tsx +126 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetCalendar.tsx +265 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.tsx +78 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.tsx +70 -0
- package/src/modules/staff/lib/time-tracking-ui/boardDirectory.ts +231 -0
- package/src/modules/staff/lib/time-tracking-ui/boardFilters.ts +128 -0
- package/src/modules/staff/lib/time-tracking-ui/boardSummary.ts +20 -0
- package/src/modules/staff/lib/time-tracking-ui/kanbanBoardData.ts +228 -0
- package/src/modules/staff/lib/time-tracking-ui/projectTeamAssignment.ts +143 -0
- package/src/modules/staff/lib/time-tracking-ui/taskDrawerData.ts +194 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryDialogState.ts +400 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryListData.ts +271 -0
- package/src/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.ts +168 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetData.ts +225 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetPeriod.ts +278 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetTargets.ts +93 -0
- package/src/modules/staff/lib/time-tracking-ui/useBoardFilters.ts +107 -0
- package/src/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.ts +245 -0
- package/src/modules/staff/lib/timeTrackingSeeds.ts +1037 -0
- package/src/modules/staff/lib/timesheets/timeEntryCacheInvalidation.ts +11 -10
- package/src/modules/staff/lib/timesheets/timeEntryDecoration.ts +256 -0
- package/src/modules/staff/lib/timesheets-projects/budgetBurn.ts +60 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThreshold.ts +135 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThresholdState.ts +137 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectFinancials.ts +142 -0
- package/src/modules/staff/lib/timesheets-projects/reportSelection.ts +82 -0
- package/src/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.tsx +237 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.tsx +33 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +56 -1
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.tsx +90 -0
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +125 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +251 -0
- package/src/modules/staff/lib/timesheets-reports/pdf.ts +263 -0
- package/src/modules/staff/lib/timesheets-reports/reportApprovalPolicies.ts +137 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigData.ts +247 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigState.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportExport.ts +373 -0
- package/src/modules/staff/lib/timesheets-reports/reportExportFormats.ts +71 -0
- package/src/modules/staff/lib/timesheets-reports/reportGroupings.ts +153 -0
- package/src/modules/staff/lib/timesheets-reports/reportLabels.ts +23 -0
- package/src/modules/staff/lib/timesheets-reports/reportReference.ts +146 -0
- package/src/modules/staff/lib/timesheets-reports/reportRows.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportSheetData.ts +196 -0
- package/src/modules/staff/lib/timesheets-reports/reportTotals.ts +544 -0
- package/src/modules/staff/lib/timesheets-reports/xlsx.ts +207 -0
- package/src/modules/staff/lib/timesheets-tasks/computeTaskRollups.ts +238 -0
- package/src/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.ts +90 -0
- package/src/modules/staff/lib/timesheets-tasks/seedProjectStatuses.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/statusPositions.ts +132 -0
- package/src/modules/staff/lib/timesheets-tasks/statusSlug.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHierarchy.ts +99 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHoursTotals.ts +42 -0
- package/src/modules/staff/lib/timesheets-tasks/taskReference.ts +108 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +18 -4
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +504 -149
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +50 -2
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +3244 -228
- package/src/modules/staff/migrations/Migration20260813073131_staff.ts +94 -0
- package/src/modules/staff/migrations/Migration20260824143357_staff.ts +17 -0
- package/src/modules/staff/notifications.client.ts +16 -0
- package/src/modules/staff/notifications.handlers.ts +88 -0
- package/src/modules/staff/notifications.ts +163 -0
- package/src/modules/staff/search.ts +191 -1
- package/src/modules/staff/setup.ts +22 -0
- package/src/modules/staff/subscribers/time-project-access-requested-notification.ts +95 -0
- package/src/modules/staff/subscribers/time-project-budget-threshold-notification.ts +226 -0
- package/src/modules/staff/subscribers/time-report-approved-notification.ts +116 -0
- package/src/modules/staff/subscribers/time-report-portal-broadcast.ts +120 -0
- package/src/modules/staff/translations.ts +17 -0
- package/src/modules/staff/widgets/components.ts +34 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +6 -5
- package/src/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.tsx +138 -0
- package/src/modules/staff/widgets/notifications/index.ts +1 -0
- package/src/modules/staff/workers/timesheets-reapply-rounding.ts +59 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +0 -123
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +0 -7
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +0 -138
|
@@ -1,1011 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
14
|
-
import { ChevronLeft, ChevronRight, X } from 'lucide-react'
|
|
15
|
-
import Link from 'next/link'
|
|
16
|
-
import { ViewSwitcher } from '../../../lib/timesheets-ui/ViewSwitcher'
|
|
17
|
-
import { CalendarPicker } from '../../../lib/timesheets-ui/CalendarPicker'
|
|
18
|
-
import { ListView } from '../../../lib/timesheets-ui/ListView'
|
|
19
|
-
import { TimerBar } from '../../../lib/timesheets-ui/TimerBar'
|
|
20
|
-
import { AddRowDropdown } from '../../../lib/timesheets-ui/AddRowDropdown'
|
|
21
|
-
import { CreateProjectDialog } from '../../../lib/timesheets-ui/CreateProjectDialog'
|
|
22
|
-
import { ProjectColorDot } from '../../../lib/timesheets-ui/ProjectColorDot'
|
|
23
|
-
import {
|
|
24
|
-
formatMinutesAsDecimal,
|
|
25
|
-
parseDurationInput,
|
|
26
|
-
type DurationParseError,
|
|
27
|
-
} from '../../../lib/timesheetsDuration'
|
|
28
|
-
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
29
|
-
|
|
30
|
-
const logger = createLogger('staff')
|
|
31
|
-
|
|
32
|
-
// --- Types ---
|
|
33
|
-
|
|
34
|
-
type ProjectRow = { id: string; name: string; code: string | null; color?: string | null }
|
|
35
|
-
type CellEntry = { id?: string; minutes: number }
|
|
36
|
-
type EntryMap = Record<string, Record<string, CellEntry[]>>
|
|
37
|
-
type DirtyMap = Record<string, Record<string, CellEntry>>
|
|
38
|
-
type RawTextMap = Record<string, Record<string, string>>
|
|
39
|
-
type CellErrorMap = Record<string, Record<string, DurationParseError>>
|
|
40
|
-
type ViewMode = 'weekly' | 'monthly'
|
|
41
|
-
type ViewType = 'timesheet' | 'list'
|
|
42
|
-
|
|
43
|
-
type RawTimeEntry = Record<string, unknown>
|
|
44
|
-
|
|
45
|
-
// --- Date Helpers ---
|
|
46
|
-
|
|
47
|
-
function getMonday(date: Date): Date {
|
|
48
|
-
const d = new Date(date)
|
|
49
|
-
const day = d.getDay()
|
|
50
|
-
const diff = day === 0 ? -6 : 1 - day
|
|
51
|
-
d.setDate(d.getDate() + diff)
|
|
52
|
-
d.setHours(0, 0, 0, 0)
|
|
53
|
-
return d
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getSunday(monday: Date): Date {
|
|
57
|
-
const d = new Date(monday)
|
|
58
|
-
d.setDate(d.getDate() + 6)
|
|
59
|
-
return d
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function getWeekNumber(date: Date): number {
|
|
63
|
-
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
|
64
|
-
d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7))
|
|
65
|
-
const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1))
|
|
66
|
-
return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function formatDateKey(date: Date): string {
|
|
70
|
-
const y = date.getFullYear()
|
|
71
|
-
const m = String(date.getMonth() + 1).padStart(2, '0')
|
|
72
|
-
const d = String(date.getDate()).padStart(2, '0')
|
|
73
|
-
return `${y}-${m}-${d}`
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function formatDateKeyFromParts(year: number, month: number, day: number): string {
|
|
77
|
-
const m = String(month + 1).padStart(2, '0')
|
|
78
|
-
const d = String(day).padStart(2, '0')
|
|
79
|
-
return `${year}-${m}-${d}`
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function getDaysInMonth(year: number, month: number): number {
|
|
83
|
-
return new Date(year, month + 1, 0).getDate()
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function isWeekendDay(date: Date): boolean {
|
|
87
|
-
const d = date.getDay()
|
|
88
|
-
return d === 0 || d === 6
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function getLocalizedDayName(date: Date): string {
|
|
92
|
-
return date.toLocaleDateString(undefined, { weekday: 'short' })
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function getLocalizedCellDate(date: Date): string {
|
|
96
|
-
return date.toLocaleDateString(undefined, { weekday: 'long', month: 'long', day: 'numeric' })
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// --- Derived date ranges ---
|
|
100
|
-
|
|
101
|
-
function getWeekDays(weekStart: Date): Date[] {
|
|
102
|
-
return Array.from({ length: 7 }, (_, i) => {
|
|
103
|
-
const d = new Date(weekStart)
|
|
104
|
-
d.setDate(d.getDate() + i)
|
|
105
|
-
return d
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function getMonthDays(year: number, month: number): Date[] {
|
|
110
|
-
const count = getDaysInMonth(year, month)
|
|
111
|
-
return Array.from({ length: count }, (_, i) => new Date(year, month, i + 1))
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// --- Week label ---
|
|
115
|
-
|
|
116
|
-
function formatWeekLabel(weekStart: Date): string {
|
|
117
|
-
const weekEnd = getSunday(weekStart)
|
|
118
|
-
const weekNum = getWeekNumber(weekStart)
|
|
119
|
-
const startDay = weekStart.getDate()
|
|
120
|
-
const endDay = weekEnd.getDate()
|
|
121
|
-
const startMonth = weekStart.toLocaleString(undefined, { month: 'short' })
|
|
122
|
-
const endMonth = weekEnd.toLocaleString(undefined, { month: 'short' })
|
|
123
|
-
const year = weekStart.getFullYear()
|
|
124
|
-
|
|
125
|
-
const dateRange = weekStart.getMonth() === weekEnd.getMonth()
|
|
126
|
-
? `${startDay} - ${endDay} ${startMonth} ${year}`
|
|
127
|
-
: `${startDay} ${startMonth} - ${endDay} ${endMonth} ${year}`
|
|
128
|
-
|
|
129
|
-
return `${dateRange} \u00b7 W${weekNum}`
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function formatMonthLabel(year: number, month: number): string {
|
|
133
|
-
const date = new Date(year, month, 1)
|
|
134
|
-
return date.toLocaleString(undefined, { month: 'long', year: 'numeric' })
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// --- Component ---
|
|
138
|
-
|
|
139
|
-
export default function MyTimesheetsPage() {
|
|
140
|
-
const t = useT()
|
|
141
|
-
const scopeVersion = useOrganizationScopeVersion()
|
|
142
|
-
const { confirm, ConfirmDialogElement } = useConfirmDialog()
|
|
143
|
-
|
|
144
|
-
const now = new Date()
|
|
145
|
-
const [viewMode, setViewMode] = React.useState<ViewMode>('weekly')
|
|
146
|
-
const [viewType, setViewType] = React.useState<ViewType>('timesheet')
|
|
147
|
-
const [weekStart, setWeekStart] = React.useState<Date>(() => getMonday(now))
|
|
148
|
-
const [monthYear, setMonthYear] = React.useState(now.getFullYear())
|
|
149
|
-
const [monthIndex, setMonthIndex] = React.useState(now.getMonth())
|
|
150
|
-
|
|
151
|
-
const [projects, setProjects] = React.useState<ProjectRow[]>([])
|
|
152
|
-
const [entries, setEntries] = React.useState<EntryMap>({})
|
|
153
|
-
const [rawEntries, setRawEntries] = React.useState<RawTimeEntry[]>([])
|
|
154
|
-
const [dirty, setDirty] = React.useState<DirtyMap>({})
|
|
155
|
-
const [rawText, setRawText] = React.useState<RawTextMap>({})
|
|
156
|
-
const [cellErrors, setCellErrors] = React.useState<CellErrorMap>({})
|
|
157
|
-
const [staffMemberId, setStaffMemberId] = React.useState<string | null>(null)
|
|
158
|
-
const [staffMemberMissing, setStaffMemberMissing] = React.useState(false)
|
|
159
|
-
const [isInitialLoad, setIsInitialLoad] = React.useState(true)
|
|
160
|
-
const [isRefreshing, setIsRefreshing] = React.useState(false)
|
|
161
|
-
const [isSaving, setIsSaving] = React.useState(false)
|
|
162
|
-
const [canManageProjects, setCanManageProjects] = React.useState(false)
|
|
163
|
-
const [createDialogOpen, setCreateDialogOpen] = React.useState(false)
|
|
164
|
-
const [allAssignedProjects, setAllAssignedProjects] = React.useState<ProjectRow[]>([])
|
|
165
|
-
|
|
166
|
-
const mutationContextId = React.useMemo(
|
|
167
|
-
() => (staffMemberId ? `staff-timesheets:${staffMemberId}` : 'staff-timesheets:pending'),
|
|
168
|
-
[staffMemberId],
|
|
169
|
-
)
|
|
170
|
-
const { runMutation, retryLastMutation } = useGuardedMutation<{
|
|
171
|
-
formId: string
|
|
172
|
-
resourceKind: string
|
|
173
|
-
resourceId?: string
|
|
174
|
-
staffMemberId: string | null
|
|
175
|
-
retryLastMutation: () => Promise<boolean>
|
|
176
|
-
}>({
|
|
177
|
-
contextId: mutationContextId,
|
|
178
|
-
blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
const gridInstanceId = React.useId()
|
|
182
|
-
const durationHintId = `${gridInstanceId}-duration-hint`
|
|
183
|
-
const buildDurationErrorId = React.useCallback(
|
|
184
|
-
(projectId: string, dateKey: string): string => `${gridInstanceId}-duration-error-${projectId}-${dateKey}`,
|
|
185
|
-
[gridInstanceId],
|
|
186
|
-
)
|
|
187
|
-
const durationFormatHint = t(
|
|
188
|
-
'staff.timesheets.my.duration.hint',
|
|
189
|
-
'Enter hours (8 or 1.5), h:mm (1:30) or minutes (90m). Max 24h per day.',
|
|
190
|
-
)
|
|
191
|
-
const describeDurationCell = React.useCallback((projectName: string, date: Date): string => (
|
|
192
|
-
t('staff.timesheets.my.duration.cellLabel', 'Duration for {project} on {date}')
|
|
193
|
-
.replace('{project}', projectName)
|
|
194
|
-
.replace('{date}', getLocalizedCellDate(date))
|
|
195
|
-
), [t])
|
|
196
|
-
const describeDurationError = React.useCallback((reason: DurationParseError): string => (
|
|
197
|
-
reason === 'out_of_range'
|
|
198
|
-
? t('staff.timesheets.my.duration.errors.out_of_range', 'Maximum 24h per day. Use 1:30 or 90m for shorter entries.')
|
|
199
|
-
: t('staff.timesheets.my.duration.errors.invalid', 'Unrecognised duration. Use 8, 1.5, 1:30, 90m or 1h 30m.')
|
|
200
|
-
), [t])
|
|
201
|
-
|
|
202
|
-
// --- Feature check ---
|
|
203
|
-
React.useEffect(() => {
|
|
204
|
-
let cancelled = false
|
|
205
|
-
void (async () => {
|
|
206
|
-
try {
|
|
207
|
-
const res = await apiCall<{ ok: boolean; granted: string[] }>('/api/auth/feature-check', {
|
|
208
|
-
method: 'POST',
|
|
209
|
-
headers: { 'content-type': 'application/json' },
|
|
210
|
-
body: JSON.stringify({ features: ['staff.timesheets.projects.manage'] }),
|
|
211
|
-
})
|
|
212
|
-
if (!cancelled) {
|
|
213
|
-
setCanManageProjects(new Set(res.result?.granted ?? []).has('staff.timesheets.projects.manage'))
|
|
214
|
-
}
|
|
215
|
-
} catch {
|
|
216
|
-
// default: no manage access
|
|
217
|
-
}
|
|
218
|
-
})()
|
|
219
|
-
return () => { cancelled = true }
|
|
220
|
-
}, [])
|
|
221
|
-
|
|
222
|
-
// --- Computed days for current view ---
|
|
223
|
-
const visibleDays = React.useMemo(() => {
|
|
224
|
-
if (viewMode === 'weekly') return getWeekDays(weekStart)
|
|
225
|
-
return getMonthDays(monthYear, monthIndex)
|
|
226
|
-
}, [viewMode, weekStart, monthYear, monthIndex])
|
|
227
|
-
|
|
228
|
-
const dateRange = React.useMemo(() => {
|
|
229
|
-
if (viewMode === 'weekly') {
|
|
230
|
-
return { from: formatDateKey(weekStart), to: formatDateKey(getSunday(weekStart)) }
|
|
231
|
-
}
|
|
232
|
-
const daysInMonth = getDaysInMonth(monthYear, monthIndex)
|
|
233
|
-
return {
|
|
234
|
-
from: formatDateKeyFromParts(monthYear, monthIndex, 1),
|
|
235
|
-
to: formatDateKeyFromParts(monthYear, monthIndex, daysInMonth),
|
|
236
|
-
}
|
|
237
|
-
}, [viewMode, weekStart, monthYear, monthIndex])
|
|
238
|
-
|
|
239
|
-
// --- Navigation ---
|
|
240
|
-
const goToPrev = React.useCallback(() => {
|
|
241
|
-
if (viewMode === 'weekly') {
|
|
242
|
-
setWeekStart((prev) => {
|
|
243
|
-
const d = new Date(prev)
|
|
244
|
-
d.setDate(d.getDate() - 7)
|
|
245
|
-
return d
|
|
246
|
-
})
|
|
247
|
-
} else {
|
|
248
|
-
setMonthIndex((prev) => {
|
|
249
|
-
if (prev === 0) { setMonthYear((y) => y - 1); return 11 }
|
|
250
|
-
return prev - 1
|
|
251
|
-
})
|
|
252
|
-
}
|
|
253
|
-
}, [viewMode])
|
|
254
|
-
|
|
255
|
-
const goToNext = React.useCallback(() => {
|
|
256
|
-
if (viewMode === 'weekly') {
|
|
257
|
-
setWeekStart((prev) => {
|
|
258
|
-
const d = new Date(prev)
|
|
259
|
-
d.setDate(d.getDate() + 7)
|
|
260
|
-
return d
|
|
261
|
-
})
|
|
262
|
-
} else {
|
|
263
|
-
setMonthIndex((prev) => {
|
|
264
|
-
if (prev === 11) { setMonthYear((y) => y + 1); return 0 }
|
|
265
|
-
return prev + 1
|
|
266
|
-
})
|
|
267
|
-
}
|
|
268
|
-
}, [viewMode])
|
|
269
|
-
|
|
270
|
-
const navigationLabel = React.useMemo(() => {
|
|
271
|
-
if (viewMode === 'weekly') return formatWeekLabel(weekStart)
|
|
272
|
-
return formatMonthLabel(monthYear, monthIndex)
|
|
273
|
-
}, [viewMode, weekStart, monthYear, monthIndex])
|
|
274
|
-
|
|
275
|
-
// --- Data loading ---
|
|
276
|
-
const isInitialLoadRef = React.useRef(true)
|
|
277
|
-
|
|
278
|
-
const loadData = React.useCallback(async () => {
|
|
279
|
-
if (!isInitialLoadRef.current) setIsRefreshing(true)
|
|
280
|
-
try {
|
|
281
|
-
const selfRes = await readApiResultOrThrow<{ member?: { id: string; displayName: string } | null }>(
|
|
282
|
-
'/api/staff/team-members/self',
|
|
283
|
-
undefined,
|
|
284
|
-
{ errorMessage: t('staff.timesheets.my.errors.load', 'Failed to load timesheets.'), fallback: { member: null } },
|
|
285
|
-
)
|
|
286
|
-
const memberId = selfRes.member?.id ?? null
|
|
287
|
-
setStaffMemberId(memberId)
|
|
288
|
-
if (!memberId) {
|
|
289
|
-
setStaffMemberMissing(true)
|
|
290
|
-
setProjects([])
|
|
291
|
-
setEntries({})
|
|
292
|
-
setRawEntries([])
|
|
293
|
-
setIsInitialLoad(false)
|
|
294
|
-
setIsRefreshing(false)
|
|
295
|
-
return
|
|
296
|
-
}
|
|
297
|
-
setStaffMemberMissing(false)
|
|
298
|
-
|
|
299
|
-
const assignmentsRes = await readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(
|
|
300
|
-
'/api/staff/timesheets/my-projects?pageSize=100',
|
|
301
|
-
undefined,
|
|
302
|
-
{ errorMessage: t('staff.timesheets.my.errors.load', 'Failed to load timesheets.'), fallback: { items: [] } },
|
|
303
|
-
)
|
|
304
|
-
const assignmentItems = Array.isArray(assignmentsRes.items) ? assignmentsRes.items : []
|
|
305
|
-
const assignedProjectIds = assignmentItems
|
|
306
|
-
.map((item) => String(item.time_project_id ?? item.timeProjectId ?? ''))
|
|
307
|
-
.filter((id) => id.length > 0)
|
|
308
|
-
const visibleProjectIdSet = new Set(
|
|
309
|
-
assignmentItems
|
|
310
|
-
.filter((item) => item.show_in_grid === true || item.showInGrid === true)
|
|
311
|
-
.map((item) => String(item.time_project_id ?? item.timeProjectId ?? ''))
|
|
312
|
-
.filter((id) => id.length > 0),
|
|
313
|
-
)
|
|
314
|
-
|
|
315
|
-
const entriesParams = new URLSearchParams({ pageSize: '100', staffMemberId: memberId })
|
|
316
|
-
if (dateRange.from) entriesParams.set('from', dateRange.from)
|
|
317
|
-
if (dateRange.to) entriesParams.set('to', dateRange.to)
|
|
318
|
-
|
|
319
|
-
const [projectsRes, entriesRes] = await Promise.all([
|
|
320
|
-
assignedProjectIds.length > 0
|
|
321
|
-
? readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(
|
|
322
|
-
`/api/staff/timesheets/time-projects?ids=${assignedProjectIds.join(',')}&pageSize=100`,
|
|
323
|
-
undefined,
|
|
324
|
-
{ errorMessage: t('staff.timesheets.my.errors.load', 'Failed to load timesheets.'), fallback: { items: [] } },
|
|
325
|
-
)
|
|
326
|
-
: Promise.resolve({ items: [] as Array<Record<string, unknown>> }),
|
|
327
|
-
readApiResultOrThrow<{ items?: Array<Record<string, unknown>> }>(
|
|
328
|
-
`/api/staff/timesheets/time-entries?${entriesParams.toString()}`,
|
|
329
|
-
undefined,
|
|
330
|
-
{ errorMessage: t('staff.timesheets.my.errors.load', 'Failed to load timesheets.'), fallback: { items: [] } },
|
|
331
|
-
),
|
|
332
|
-
])
|
|
333
|
-
|
|
334
|
-
const projectItems = Array.isArray(projectsRes.items) ? projectsRes.items : []
|
|
335
|
-
const mappedProjects = projectItems.map((item) => ({
|
|
336
|
-
id: String(item.id ?? ''),
|
|
337
|
-
name: String(item.name ?? ''),
|
|
338
|
-
code: typeof item.code === 'string' ? item.code : null,
|
|
339
|
-
color: typeof item.color === 'string' ? item.color : null,
|
|
340
|
-
}))
|
|
341
|
-
setAllAssignedProjects(mappedProjects)
|
|
342
|
-
const visibleProjects = mappedProjects.filter((p) => visibleProjectIdSet.has(p.id))
|
|
343
|
-
setProjects(visibleProjects)
|
|
344
|
-
|
|
345
|
-
const entryItems = Array.isArray(entriesRes.items) ? entriesRes.items : []
|
|
346
|
-
setRawEntries(entryItems)
|
|
347
|
-
const map: EntryMap = {}
|
|
348
|
-
for (const item of entryItems) {
|
|
349
|
-
const projectId = String(item.time_project_id ?? item.timeProjectId ?? '')
|
|
350
|
-
const rawDate = String(item.date ?? '')
|
|
351
|
-
const dateKey = rawDate.slice(0, 10)
|
|
352
|
-
const minutes = typeof item.duration_minutes === 'number'
|
|
353
|
-
? item.duration_minutes
|
|
354
|
-
: typeof item.durationMinutes === 'number'
|
|
355
|
-
? item.durationMinutes
|
|
356
|
-
: 0
|
|
357
|
-
const entryId = String(item.id ?? '')
|
|
358
|
-
if (!map[projectId]) map[projectId] = {}
|
|
359
|
-
if (!map[projectId][dateKey]) map[projectId][dateKey] = []
|
|
360
|
-
map[projectId][dateKey].push({ id: entryId || undefined, minutes })
|
|
361
|
-
}
|
|
362
|
-
setEntries(map)
|
|
363
|
-
setDirty({})
|
|
364
|
-
setRawText({})
|
|
365
|
-
setCellErrors({})
|
|
366
|
-
} catch (error) {
|
|
367
|
-
logger.error('staff.timesheets.my.load', { err: error })
|
|
368
|
-
flash(t('staff.timesheets.my.errors.load', 'Failed to load timesheets.'), 'error')
|
|
369
|
-
} finally {
|
|
370
|
-
isInitialLoadRef.current = false
|
|
371
|
-
setIsInitialLoad(false)
|
|
372
|
-
setIsRefreshing(false)
|
|
373
|
-
}
|
|
374
|
-
}, [dateRange.from, dateRange.to, t])
|
|
375
|
-
|
|
376
|
-
React.useEffect(() => {
|
|
377
|
-
void loadData()
|
|
378
|
-
}, [loadData, scopeVersion])
|
|
379
|
-
|
|
380
|
-
// --- Cell handlers ---
|
|
381
|
-
const clearCellError = React.useCallback((projectId: string, dateKey: string) => {
|
|
382
|
-
setCellErrors((prev) => {
|
|
383
|
-
const projectErrors = prev[projectId]
|
|
384
|
-
if (!projectErrors || projectErrors[dateKey] === undefined) return prev
|
|
385
|
-
const nextProjectErrors = { ...projectErrors }
|
|
386
|
-
delete nextProjectErrors[dateKey]
|
|
387
|
-
const next = { ...prev }
|
|
388
|
-
if (Object.keys(nextProjectErrors).length > 0) next[projectId] = nextProjectErrors
|
|
389
|
-
else delete next[projectId]
|
|
390
|
-
return next
|
|
391
|
-
})
|
|
392
|
-
}, [])
|
|
393
|
-
|
|
394
|
-
const handleCellChange = React.useCallback((projectId: string, dateKey: string, value: string) => {
|
|
395
|
-
clearCellError(projectId, dateKey)
|
|
396
|
-
setRawText((prev) => {
|
|
397
|
-
const projectTexts = { ...(prev[projectId] ?? {}) }
|
|
398
|
-
projectTexts[dateKey] = value
|
|
399
|
-
return { ...prev, [projectId]: projectTexts }
|
|
400
|
-
})
|
|
401
|
-
}, [clearCellError])
|
|
402
|
-
|
|
403
|
-
const dropDirtyCell = React.useCallback((projectId: string, dateKey: string) => {
|
|
404
|
-
setDirty((prev) => {
|
|
405
|
-
const projectEntries = prev[projectId]
|
|
406
|
-
if (!projectEntries || projectEntries[dateKey] === undefined) return prev
|
|
407
|
-
const nextProjectEntries = { ...projectEntries }
|
|
408
|
-
delete nextProjectEntries[dateKey]
|
|
409
|
-
const next = { ...prev }
|
|
410
|
-
if (Object.keys(nextProjectEntries).length > 0) next[projectId] = nextProjectEntries
|
|
411
|
-
else delete next[projectId]
|
|
412
|
-
return next
|
|
413
|
-
})
|
|
414
|
-
}, [])
|
|
415
|
-
|
|
416
|
-
const handleCellBlur = React.useCallback((projectId: string, dateKey: string, currentValue: string) => {
|
|
417
|
-
const editedText = rawText[projectId]?.[dateKey]
|
|
418
|
-
const text = editedText ?? currentValue
|
|
419
|
-
if (text === undefined) return
|
|
420
|
-
const parsed = parseDurationInput(text)
|
|
421
|
-
if (!parsed.ok) {
|
|
422
|
-
dropDirtyCell(projectId, dateKey)
|
|
423
|
-
setCellErrors((prev) => {
|
|
424
|
-
const projectErrors = { ...(prev[projectId] ?? {}) }
|
|
425
|
-
projectErrors[dateKey] = parsed.reason
|
|
426
|
-
return { ...prev, [projectId]: projectErrors }
|
|
427
|
-
})
|
|
428
|
-
return
|
|
429
|
-
}
|
|
430
|
-
clearCellError(projectId, dateKey)
|
|
431
|
-
const minutes = parsed.minutes
|
|
432
|
-
const cellEntries = entries[projectId]?.[dateKey] ?? []
|
|
433
|
-
const existingMinutes = cellEntries.reduce((sum, e) => sum + e.minutes, 0)
|
|
434
|
-
|
|
435
|
-
if (minutes !== existingMinutes || (editedText !== undefined && cellEntries.length > 0)) {
|
|
436
|
-
setDirty((prev) => {
|
|
437
|
-
const projectEntries: Record<string, CellEntry> = { ...(prev[projectId] ?? {}) }
|
|
438
|
-
const firstId = cellEntries[0]?.id
|
|
439
|
-
projectEntries[dateKey] = { id: firstId, minutes }
|
|
440
|
-
return { ...prev, [projectId]: projectEntries }
|
|
441
|
-
})
|
|
442
|
-
}
|
|
443
|
-
setRawText((prev) => {
|
|
444
|
-
const projectTexts = { ...(prev[projectId] ?? {}) }
|
|
445
|
-
delete projectTexts[dateKey]
|
|
446
|
-
const hasKeys = Object.keys(projectTexts).length > 0
|
|
447
|
-
if (!hasKeys) {
|
|
448
|
-
const next = { ...prev }
|
|
449
|
-
delete next[projectId]
|
|
450
|
-
return next
|
|
451
|
-
}
|
|
452
|
-
return { ...prev, [projectId]: projectTexts }
|
|
453
|
-
})
|
|
454
|
-
}, [rawText, entries, clearCellError, dropDirtyCell])
|
|
455
|
-
|
|
456
|
-
const getCellValue = React.useCallback((projectId: string, dateKey: string): number => {
|
|
457
|
-
const dirtyCell = dirty[projectId]?.[dateKey] as CellEntry | undefined
|
|
458
|
-
if (dirtyCell !== undefined) return dirtyCell.minutes
|
|
459
|
-
const cellEntries = entries[projectId]?.[dateKey] ?? []
|
|
460
|
-
return cellEntries.reduce((sum, e) => sum + e.minutes, 0)
|
|
461
|
-
}, [dirty, entries])
|
|
462
|
-
|
|
463
|
-
// --- Save ---
|
|
464
|
-
const hasChanges = Object.keys(dirty).length > 0 || Object.keys(rawText).length > 0
|
|
465
|
-
const invalidCellCount = React.useMemo(
|
|
466
|
-
() => Object.values(cellErrors).reduce((sum, projectErrors) => sum + Object.keys(projectErrors).length, 0),
|
|
467
|
-
[cellErrors],
|
|
468
|
-
)
|
|
469
|
-
const pendingSummary = React.useMemo(() => {
|
|
470
|
-
let cells = 0
|
|
471
|
-
let minutes = 0
|
|
472
|
-
for (const dateMap of Object.values(dirty)) {
|
|
473
|
-
for (const cell of Object.values(dateMap)) {
|
|
474
|
-
cells += 1
|
|
475
|
-
minutes += cell.minutes
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return { cells, minutes }
|
|
479
|
-
}, [dirty])
|
|
480
|
-
|
|
481
|
-
const handleSave = React.useCallback(async () => {
|
|
482
|
-
if (!hasChanges || invalidCellCount > 0) return
|
|
483
|
-
const summary = t('staff.timesheets.my.confirm_save.summary', '{count} cell(s), {total}h in total.')
|
|
484
|
-
.replace('{count}', String(pendingSummary.cells))
|
|
485
|
-
.replace('{total}', formatMinutesAsDecimal(pendingSummary.minutes) || '0')
|
|
486
|
-
const confirmed = await confirm({
|
|
487
|
-
title: t('staff.timesheets.my.confirm_save.title', 'Save changes?'),
|
|
488
|
-
text: `${t('staff.timesheets.my.confirm_save.body', 'Your timesheet entries will be saved.')} ${summary}`,
|
|
489
|
-
})
|
|
490
|
-
if (!confirmed) return
|
|
491
|
-
|
|
492
|
-
setIsSaving(true)
|
|
493
|
-
try {
|
|
494
|
-
const bulkEntries: Array<{ id?: string; date: string; timeProjectId: string; durationMinutes: number }> = []
|
|
495
|
-
for (const [projectId, dateMap] of Object.entries(dirty)) {
|
|
496
|
-
for (const [dateKey, cellValue] of Object.entries(dateMap)) {
|
|
497
|
-
const cell = cellValue as CellEntry
|
|
498
|
-
const cellEntries = entries[projectId]?.[dateKey] ?? []
|
|
499
|
-
const firstId = cell.id ?? cellEntries[0]?.id
|
|
500
|
-
bulkEntries.push({ id: firstId, date: dateKey, timeProjectId: projectId, durationMinutes: cell.minutes })
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
if (bulkEntries.length === 0) return
|
|
504
|
-
|
|
505
|
-
const payload = { entries: bulkEntries }
|
|
506
|
-
await runMutation({
|
|
507
|
-
operation: () =>
|
|
508
|
-
apiCallOrThrow('/api/staff/timesheets/time-entries/bulk', {
|
|
509
|
-
method: 'POST',
|
|
510
|
-
headers: { 'Content-Type': 'application/json' },
|
|
511
|
-
body: JSON.stringify(payload),
|
|
512
|
-
}),
|
|
513
|
-
context: {
|
|
514
|
-
formId: mutationContextId,
|
|
515
|
-
resourceKind: 'staff.timesheets.time_entry',
|
|
516
|
-
resourceId: staffMemberId ?? undefined,
|
|
517
|
-
staffMemberId,
|
|
518
|
-
retryLastMutation,
|
|
519
|
-
},
|
|
520
|
-
mutationPayload: payload as unknown as Record<string, unknown>,
|
|
521
|
-
})
|
|
522
|
-
|
|
523
|
-
flash(t('staff.timesheets.my.saved', 'Timesheet saved.'), 'success')
|
|
524
|
-
await loadData()
|
|
525
|
-
} catch (error) {
|
|
526
|
-
logger.error('staff.timesheets.my.save', { err: error })
|
|
527
|
-
flash(t('staff.timesheets.my.errors.save', 'Failed to save timesheets.'), 'error')
|
|
528
|
-
} finally {
|
|
529
|
-
setIsSaving(false)
|
|
530
|
-
}
|
|
531
|
-
}, [dirty, entries, hasChanges, invalidCellCount, pendingSummary, confirm, t, loadData, runMutation, mutationContextId, staffMemberId, retryLastMutation])
|
|
532
|
-
|
|
533
|
-
// --- Totals ---
|
|
534
|
-
const getRowTotal = React.useCallback((projectId: string): number => {
|
|
535
|
-
let total = 0
|
|
536
|
-
for (const day of visibleDays) {
|
|
537
|
-
total += getCellValue(projectId, formatDateKey(day))
|
|
538
|
-
}
|
|
539
|
-
return total
|
|
540
|
-
}, [visibleDays, getCellValue])
|
|
541
|
-
|
|
542
|
-
const getDayTotal = React.useCallback((date: Date): number => {
|
|
543
|
-
const dateKey = formatDateKey(date)
|
|
544
|
-
let total = 0
|
|
545
|
-
for (const project of projects) {
|
|
546
|
-
total += getCellValue(project.id, dateKey)
|
|
547
|
-
}
|
|
548
|
-
return total
|
|
549
|
-
}, [projects, getCellValue])
|
|
550
|
-
|
|
551
|
-
const grandTotal = React.useMemo(() => {
|
|
552
|
-
let total = 0
|
|
553
|
-
for (const project of projects) {
|
|
554
|
-
total += getRowTotal(project.id)
|
|
555
|
-
}
|
|
556
|
-
return total
|
|
557
|
-
}, [projects, getRowTotal])
|
|
558
|
-
|
|
559
|
-
const workingDays = React.useMemo(() => {
|
|
560
|
-
let count = 0
|
|
561
|
-
for (const day of visibleDays) {
|
|
562
|
-
if (!isWeekendDay(day)) {
|
|
563
|
-
const dateKey = formatDateKey(day)
|
|
564
|
-
for (const project of projects) {
|
|
565
|
-
if (getCellValue(project.id, dateKey) > 0) { count++; break }
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
return count
|
|
570
|
-
}, [visibleDays, projects, getCellValue])
|
|
571
|
-
|
|
572
|
-
const dailyAverage = React.useMemo(() => {
|
|
573
|
-
if (workingDays === 0) return 0
|
|
574
|
-
return grandTotal / workingDays
|
|
575
|
-
}, [grandTotal, workingDays])
|
|
576
|
-
|
|
577
|
-
// --- List view entries ---
|
|
578
|
-
const listViewEntries = React.useMemo(() => {
|
|
579
|
-
return rawEntries.map((item) => ({
|
|
580
|
-
id: String(item.id ?? ''),
|
|
581
|
-
date: String(item.date ?? '').slice(0, 10),
|
|
582
|
-
durationMinutes: typeof item.duration_minutes === 'number' ? item.duration_minutes
|
|
583
|
-
: typeof item.durationMinutes === 'number' ? item.durationMinutes : 0,
|
|
584
|
-
projectId: String(item.time_project_id ?? item.timeProjectId ?? ''),
|
|
585
|
-
projectName: projects.find((p) => p.id === String(item.time_project_id ?? item.timeProjectId ?? ''))?.name ?? '',
|
|
586
|
-
projectCode: projects.find((p) => p.id === String(item.time_project_id ?? item.timeProjectId ?? ''))?.code ?? null,
|
|
587
|
-
projectColor: projects.find((p) => p.id === String(item.time_project_id ?? item.timeProjectId ?? ''))?.color ?? null,
|
|
588
|
-
notes: typeof item.notes === 'string' ? item.notes : null,
|
|
589
|
-
source: typeof item.source === 'string' ? item.source : 'manual',
|
|
590
|
-
startedAt: typeof item.started_at === 'string' ? item.started_at : typeof item.startedAt === 'string' ? item.startedAt : null,
|
|
591
|
-
endedAt: typeof item.ended_at === 'string' ? item.ended_at : typeof item.endedAt === 'string' ? item.endedAt : null,
|
|
592
|
-
}))
|
|
593
|
-
}, [rawEntries, projects])
|
|
594
|
-
|
|
595
|
-
// --- Handle view mode change ---
|
|
596
|
-
const handleViewModeChange = React.useCallback((mode: ViewMode) => {
|
|
597
|
-
setViewMode(mode)
|
|
598
|
-
if (mode === 'monthly') {
|
|
599
|
-
// Use Thursday of the week to determine month (handles cross-month weeks)
|
|
600
|
-
const thursday = new Date(weekStart)
|
|
601
|
-
thursday.setDate(thursday.getDate() + 3)
|
|
602
|
-
setMonthYear(thursday.getFullYear())
|
|
603
|
-
setMonthIndex(thursday.getMonth())
|
|
604
|
-
} else {
|
|
605
|
-
// Find the Monday of the week containing the 15th (mid-month, always stable)
|
|
606
|
-
const midMonth = new Date(monthYear, monthIndex, 15)
|
|
607
|
-
setWeekStart(getMonday(midMonth))
|
|
608
|
-
}
|
|
609
|
-
}, [weekStart, monthYear, monthIndex])
|
|
610
|
-
|
|
611
|
-
// --- Add row handler ---
|
|
612
|
-
const visibleProjectIds = React.useMemo(() => new Set(projects.map((p) => p.id)), [projects])
|
|
613
|
-
|
|
614
|
-
// optimistic-lock-exempt: the my-projects PATCH calls below only toggle the
|
|
615
|
-
// caller's own `showInGrid` preference on the staff.timesheets.time_project_member
|
|
616
|
-
// junction (a per-user membership flag). There is no shared, multi-user-editable
|
|
617
|
-
// state to lose, so version-locking the toggle would surface false 409s without
|
|
618
|
-
// protecting any data.
|
|
619
|
-
const handleAddProject = React.useCallback(async (project: ProjectRow) => {
|
|
620
|
-
try {
|
|
621
|
-
const payload = { showInGrid: true }
|
|
622
|
-
await runMutation({
|
|
623
|
-
operation: () =>
|
|
624
|
-
apiCallOrThrow(`/api/staff/timesheets/my-projects/${project.id}`, {
|
|
625
|
-
method: 'PATCH',
|
|
626
|
-
headers: { 'Content-Type': 'application/json' },
|
|
627
|
-
body: JSON.stringify(payload),
|
|
628
|
-
}),
|
|
629
|
-
context: {
|
|
630
|
-
formId: mutationContextId,
|
|
631
|
-
resourceKind: 'staff.timesheets.time_project_member',
|
|
632
|
-
resourceId: project.id,
|
|
633
|
-
staffMemberId,
|
|
634
|
-
retryLastMutation,
|
|
635
|
-
},
|
|
636
|
-
mutationPayload: payload,
|
|
637
|
-
})
|
|
638
|
-
setProjects((prev) => {
|
|
639
|
-
if (prev.some((p) => p.id === project.id)) return prev
|
|
640
|
-
return [...prev, project]
|
|
641
|
-
})
|
|
642
|
-
} catch (error) {
|
|
643
|
-
logger.error('staff.timesheets.my.addRow', { err: error })
|
|
644
|
-
flash(t('staff.timesheets.my.addRow.error', 'Could not add the project. Please try again.'), 'error')
|
|
645
|
-
}
|
|
646
|
-
}, [t, runMutation, mutationContextId, staffMemberId, retryLastMutation])
|
|
647
|
-
|
|
648
|
-
const handleRemoveProject = React.useCallback(async (project: ProjectRow) => {
|
|
649
|
-
const confirmed = await confirm({
|
|
650
|
-
title: t('staff.timesheets.my.removeRow', 'Remove from grid'),
|
|
651
|
-
text: t(
|
|
652
|
-
'staff.timesheets.my.removeRow.confirm',
|
|
653
|
-
'Remove {projectName} from your timesheet grid? You can re-add it anytime via "+ Add row".',
|
|
654
|
-
).replace('{projectName}', project.name),
|
|
655
|
-
})
|
|
656
|
-
if (!confirmed) return
|
|
657
|
-
|
|
658
|
-
try {
|
|
659
|
-
const payload = { showInGrid: false }
|
|
660
|
-
await runMutation({
|
|
661
|
-
operation: () =>
|
|
662
|
-
apiCallOrThrow(`/api/staff/timesheets/my-projects/${project.id}`, {
|
|
663
|
-
method: 'PATCH',
|
|
664
|
-
headers: { 'Content-Type': 'application/json' },
|
|
665
|
-
body: JSON.stringify(payload),
|
|
666
|
-
}),
|
|
667
|
-
context: {
|
|
668
|
-
formId: mutationContextId,
|
|
669
|
-
resourceKind: 'staff.timesheets.time_project_member',
|
|
670
|
-
resourceId: project.id,
|
|
671
|
-
staffMemberId,
|
|
672
|
-
retryLastMutation,
|
|
673
|
-
},
|
|
674
|
-
mutationPayload: payload,
|
|
675
|
-
})
|
|
676
|
-
setProjects((prev) => prev.filter((p) => p.id !== project.id))
|
|
677
|
-
setDirty((prev) => {
|
|
678
|
-
if (!prev[project.id]) return prev
|
|
679
|
-
const next = { ...prev }
|
|
680
|
-
delete next[project.id]
|
|
681
|
-
return next
|
|
682
|
-
})
|
|
683
|
-
setRawText((prev) => {
|
|
684
|
-
if (!prev[project.id]) return prev
|
|
685
|
-
const next = { ...prev }
|
|
686
|
-
delete next[project.id]
|
|
687
|
-
return next
|
|
688
|
-
})
|
|
689
|
-
setCellErrors((prev) => {
|
|
690
|
-
if (!prev[project.id]) return prev
|
|
691
|
-
const next = { ...prev }
|
|
692
|
-
delete next[project.id]
|
|
693
|
-
return next
|
|
694
|
-
})
|
|
695
|
-
} catch (error) {
|
|
696
|
-
logger.error('staff.timesheets.my.removeRow', { err: error })
|
|
697
|
-
flash(t('staff.timesheets.my.removeRow.error', 'Could not remove the project. Please try again.'), 'error')
|
|
698
|
-
}
|
|
699
|
-
}, [confirm, t, runMutation, mutationContextId, staffMemberId, retryLastMutation])
|
|
700
|
-
|
|
701
|
-
const handleProjectCreated = React.useCallback(async (project: { id: string; name: string; code: string | null }) => {
|
|
702
|
-
setAllAssignedProjects((prev) => [...prev, project])
|
|
703
|
-
// New projects start hidden; immediately opt them into the grid for the creator.
|
|
704
|
-
try {
|
|
705
|
-
const payload = { showInGrid: true }
|
|
706
|
-
await runMutation({
|
|
707
|
-
operation: () =>
|
|
708
|
-
apiCallOrThrow(`/api/staff/timesheets/my-projects/${project.id}`, {
|
|
709
|
-
method: 'PATCH',
|
|
710
|
-
headers: { 'Content-Type': 'application/json' },
|
|
711
|
-
body: JSON.stringify(payload),
|
|
712
|
-
}),
|
|
713
|
-
context: {
|
|
714
|
-
formId: mutationContextId,
|
|
715
|
-
resourceKind: 'staff.timesheets.time_project_member',
|
|
716
|
-
resourceId: project.id,
|
|
717
|
-
staffMemberId,
|
|
718
|
-
retryLastMutation,
|
|
719
|
-
},
|
|
720
|
-
mutationPayload: payload,
|
|
721
|
-
})
|
|
722
|
-
} catch (error) {
|
|
723
|
-
logger.error('staff.timesheets.my.createProject.visibility', { err: error })
|
|
724
|
-
}
|
|
725
|
-
setProjects((prev) => [...prev, project])
|
|
726
|
-
setCreateDialogOpen(false)
|
|
727
|
-
}, [runMutation, mutationContextId, staffMemberId, retryLastMutation])
|
|
728
|
-
|
|
729
|
-
// --- Loading ---
|
|
730
|
-
if (isInitialLoad) {
|
|
731
|
-
return <Page><PageBody><LoadingMessage label={t('staff.timesheets.my.loading', 'Loading timesheets...')} /></PageBody></Page>
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
// --- No profile ---
|
|
735
|
-
if (staffMemberMissing) {
|
|
736
|
-
return (
|
|
737
|
-
<Page>
|
|
738
|
-
<PageBody>
|
|
739
|
-
<div className="py-12 text-center">
|
|
740
|
-
<p className="text-lg font-semibold mb-2">
|
|
741
|
-
{t('staff.timesheets.my.noProfile.title', 'Set up your profile to start tracking time')}
|
|
742
|
-
</p>
|
|
743
|
-
<p className="text-sm text-muted-foreground mb-6">
|
|
744
|
-
{t('staff.timesheets.my.noProfile', 'You need a Team Member profile to track time.')}
|
|
745
|
-
</p>
|
|
746
|
-
<Button asChild>
|
|
747
|
-
<Link href="/backend/staff/profile/create">
|
|
748
|
-
{t('staff.timesheets.my.createProfile', 'Create My Profile')}
|
|
749
|
-
</Link>
|
|
750
|
-
</Button>
|
|
751
|
-
</div>
|
|
752
|
-
</PageBody>
|
|
753
|
-
</Page>
|
|
754
|
-
)
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
return (
|
|
758
|
-
<Page>
|
|
759
|
-
<PageBody>
|
|
760
|
-
{/* Timer bar */}
|
|
761
|
-
<TimerBar
|
|
762
|
-
projects={allAssignedProjects}
|
|
763
|
-
staffMemberId={staffMemberId}
|
|
764
|
-
onTimerStopped={loadData}
|
|
765
|
-
/>
|
|
766
|
-
|
|
767
|
-
{/* Summary cards */}
|
|
768
|
-
<div className="mb-4 grid grid-cols-1 gap-4 sm:grid-cols-4">
|
|
769
|
-
<div className="rounded-lg border bg-card p-4">
|
|
770
|
-
<p className="text-sm text-muted-foreground">
|
|
771
|
-
{viewMode === 'weekly'
|
|
772
|
-
? t('staff.timesheets.my.weekTotal', 'Week Total')
|
|
773
|
-
: t('staff.timesheets.my.total_hours', 'Total Hours')}
|
|
774
|
-
</p>
|
|
775
|
-
<p className="text-2xl font-semibold">{formatMinutesAsDecimal(grandTotal) || '0'}</p>
|
|
776
|
-
</div>
|
|
777
|
-
<div className="rounded-lg border bg-card p-4">
|
|
778
|
-
<p className="text-sm text-muted-foreground">{t('staff.timesheets.my.working_days', 'Working Days')}</p>
|
|
779
|
-
<p className="text-2xl font-semibold">{workingDays}</p>
|
|
780
|
-
</div>
|
|
781
|
-
<div className="rounded-lg border bg-card p-4">
|
|
782
|
-
<p className="text-sm text-muted-foreground">{t('staff.timesheets.my.daily_average', 'Daily Average')}</p>
|
|
783
|
-
<p className="text-2xl font-semibold">{formatMinutesAsDecimal(Math.round(dailyAverage)) || '0'}</p>
|
|
784
|
-
</div>
|
|
785
|
-
<div className="rounded-lg border bg-card p-4">
|
|
786
|
-
<p className="text-sm text-muted-foreground">{t('staff.timesheets.my.status', 'Status')}</p>
|
|
787
|
-
<p className="text-2xl font-semibold">
|
|
788
|
-
<span className="inline-flex items-center rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-medium text-green-800">
|
|
789
|
-
{t('staff.timesheets.my.status_open', 'Open')}
|
|
790
|
-
</span>
|
|
791
|
-
</p>
|
|
792
|
-
</div>
|
|
793
|
-
</div>
|
|
794
|
-
|
|
795
|
-
{/* Navigation + controls */}
|
|
796
|
-
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
|
797
|
-
<div className="flex items-center gap-2">
|
|
798
|
-
<Button variant="outline" size="icon" type="button" onClick={goToPrev}>
|
|
799
|
-
<ChevronLeft className="size-4" />
|
|
800
|
-
</Button>
|
|
801
|
-
<span className="text-sm font-semibold min-w-[220px] text-center">{navigationLabel}</span>
|
|
802
|
-
<Button variant="outline" size="icon" type="button" onClick={goToNext}>
|
|
803
|
-
<ChevronRight className="size-4" />
|
|
804
|
-
</Button>
|
|
805
|
-
{viewMode === 'weekly' && (
|
|
806
|
-
<CalendarPicker selectedWeekStart={weekStart} onWeekSelect={setWeekStart} />
|
|
807
|
-
)}
|
|
808
|
-
</div>
|
|
809
|
-
|
|
810
|
-
<div className="flex items-center gap-3">
|
|
811
|
-
<ViewSwitcher
|
|
812
|
-
viewMode={viewMode}
|
|
813
|
-
onViewModeChange={handleViewModeChange}
|
|
814
|
-
viewType={viewType}
|
|
815
|
-
onViewTypeChange={setViewType}
|
|
816
|
-
/>
|
|
817
|
-
<div className="flex items-center gap-2">
|
|
818
|
-
{invalidCellCount > 0 ? (
|
|
819
|
-
<span className="text-xs text-status-error-text font-medium">
|
|
820
|
-
{t('staff.timesheets.my.duration.blocked', 'Fix the highlighted durations to save')}
|
|
821
|
-
</span>
|
|
822
|
-
) : hasChanges && (
|
|
823
|
-
<span className="text-xs text-status-warning-text font-medium">
|
|
824
|
-
{t('staff.timesheets.my.unsaved', 'Unsaved changes')}
|
|
825
|
-
</span>
|
|
826
|
-
)}
|
|
827
|
-
<Button size="sm" type="button" onClick={handleSave} disabled={!hasChanges || isSaving || invalidCellCount > 0}>
|
|
828
|
-
{isSaving ? t('staff.timesheets.my.saving', 'Saving...') : t('staff.timesheets.my.save_changes', 'Save Changes')}
|
|
829
|
-
</Button>
|
|
830
|
-
</div>
|
|
831
|
-
</div>
|
|
832
|
-
</div>
|
|
833
|
-
|
|
834
|
-
{/* Content: Grid or List */}
|
|
835
|
-
<div className={isRefreshing ? 'opacity-50 pointer-events-none transition-opacity' : 'transition-opacity'}>
|
|
836
|
-
{allAssignedProjects.length === 0 ? (
|
|
837
|
-
<div className="py-12 text-center">
|
|
838
|
-
<p className="text-lg font-semibold mb-2">
|
|
839
|
-
{t('staff.timesheets.my.noProjects.title', 'No projects assigned yet')}
|
|
840
|
-
</p>
|
|
841
|
-
<p className="text-sm text-muted-foreground mb-6">
|
|
842
|
-
{canManageProjects
|
|
843
|
-
? t('staff.timesheets.my.noProjects.admin', 'Create a project and assign yourself to start tracking time.')
|
|
844
|
-
: t('staff.timesheets.my.noProjects.employee', 'Ask your manager to assign you to a project.')}
|
|
845
|
-
</p>
|
|
846
|
-
<div className="flex items-center justify-center gap-3">
|
|
847
|
-
{canManageProjects && (
|
|
848
|
-
<Button asChild>
|
|
849
|
-
<Link href="/backend/staff/timesheets/projects/create">
|
|
850
|
-
{t('staff.timesheets.my.noProjects.createProject', 'Create Project')}
|
|
851
|
-
</Link>
|
|
852
|
-
</Button>
|
|
853
|
-
)}
|
|
854
|
-
<Button variant="outline" asChild>
|
|
855
|
-
<Link href="/backend/staff/timesheets/projects">
|
|
856
|
-
{t('staff.timesheets.my.noProjects.viewProjects', 'View Projects')}
|
|
857
|
-
</Link>
|
|
858
|
-
</Button>
|
|
859
|
-
</div>
|
|
860
|
-
</div>
|
|
861
|
-
) : viewType === 'list' ? (
|
|
862
|
-
<ListView entries={listViewEntries} onEntryUpdated={loadData} />
|
|
863
|
-
) : (
|
|
864
|
-
<div className="overflow-x-auto rounded-lg border">
|
|
865
|
-
<table className="w-full text-sm table-fixed">
|
|
866
|
-
<colgroup>
|
|
867
|
-
<col className={viewMode === 'weekly' ? 'w-[35%]' : 'w-[140px] min-w-[140px]'} />
|
|
868
|
-
{visibleDays.map((date) => (
|
|
869
|
-
<col key={formatDateKey(date)} className={viewMode === 'weekly' ? '' : 'w-[36px] min-w-[36px]'} />
|
|
870
|
-
))}
|
|
871
|
-
<col className={viewMode === 'weekly' ? 'w-[72px]' : 'w-[56px] min-w-[56px]'} />
|
|
872
|
-
</colgroup>
|
|
873
|
-
<thead>
|
|
874
|
-
<tr className="border-b bg-muted/50">
|
|
875
|
-
<th className="sticky left-0 z-10 bg-muted px-3 py-2 text-left font-medium">
|
|
876
|
-
{t('staff.timesheets.my.project', 'Project')}
|
|
877
|
-
</th>
|
|
878
|
-
{visibleDays.map((date) => {
|
|
879
|
-
const dayName = getLocalizedDayName(date)
|
|
880
|
-
const weekend = isWeekendDay(date)
|
|
881
|
-
return (
|
|
882
|
-
<th
|
|
883
|
-
key={formatDateKey(date)}
|
|
884
|
-
className={`py-2 text-center font-medium px-1 ${weekend ? 'bg-muted/80 text-muted-foreground' : ''}`}
|
|
885
|
-
>
|
|
886
|
-
<div className="text-[10px] uppercase text-muted-foreground">{dayName}</div>
|
|
887
|
-
<div className="text-xs">{date.getDate()}</div>
|
|
888
|
-
</th>
|
|
889
|
-
)
|
|
890
|
-
})}
|
|
891
|
-
<th className="px-3 py-2 text-right font-medium">
|
|
892
|
-
{t('staff.timesheets.my.total', 'Total')}
|
|
893
|
-
</th>
|
|
894
|
-
</tr>
|
|
895
|
-
</thead>
|
|
896
|
-
<tbody>
|
|
897
|
-
{projects.map((project) => (
|
|
898
|
-
<tr key={project.id} className="group border-b hover:bg-muted/30">
|
|
899
|
-
<td className="sticky left-0 z-10 bg-background px-3 py-1.5 font-medium text-foreground">
|
|
900
|
-
<div className="flex items-center justify-between gap-2">
|
|
901
|
-
<div className="min-w-0 flex-1">
|
|
902
|
-
<div className="flex items-center gap-1.5 truncate" title={project.name}>
|
|
903
|
-
<ProjectColorDot colorKey={project.color} projectName={project.name} size="sm" />
|
|
904
|
-
<span className="truncate">{project.name}</span>
|
|
905
|
-
</div>
|
|
906
|
-
{project.code && (
|
|
907
|
-
<div className="text-[10px] text-muted-foreground">{project.code}</div>
|
|
908
|
-
)}
|
|
909
|
-
</div>
|
|
910
|
-
<button
|
|
911
|
-
type="button"
|
|
912
|
-
onClick={() => { void handleRemoveProject(project) }}
|
|
913
|
-
aria-label={t('staff.timesheets.my.removeRow', 'Remove from grid')}
|
|
914
|
-
title={t('staff.timesheets.my.removeRow', 'Remove from grid')}
|
|
915
|
-
className="opacity-0 group-hover:opacity-100 focus:opacity-100 inline-flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground transition-opacity"
|
|
916
|
-
>
|
|
917
|
-
<X className="h-3.5 w-3.5" />
|
|
918
|
-
</button>
|
|
919
|
-
</div>
|
|
920
|
-
</td>
|
|
921
|
-
{visibleDays.map((date) => {
|
|
922
|
-
const dateKey = formatDateKey(date)
|
|
923
|
-
const weekend = isWeekendDay(date)
|
|
924
|
-
const cellMinutes = getCellValue(project.id, dateKey)
|
|
925
|
-
const isDirty = dirty[project.id]?.[dateKey] !== undefined
|
|
926
|
-
const cellError = cellErrors[project.id]?.[dateKey]
|
|
927
|
-
const cellErrorMessage = cellError ? describeDurationError(cellError) : undefined
|
|
928
|
-
const cellErrorId = cellErrorMessage ? buildDurationErrorId(project.id, dateKey) : undefined
|
|
929
|
-
return (
|
|
930
|
-
<td key={dateKey} className={`px-0.5 py-0.5 ${weekend ? 'bg-muted/40' : ''}`}>
|
|
931
|
-
{weekend ? (
|
|
932
|
-
<div className="rounded px-1 py-1 text-center text-xs text-muted-foreground/50">-</div>
|
|
933
|
-
) : (
|
|
934
|
-
<InlineInput
|
|
935
|
-
type="text"
|
|
936
|
-
inputMode="text"
|
|
937
|
-
showBorderOnHover={false}
|
|
938
|
-
className={`mx-auto flex h-6 border transition-colors
|
|
939
|
-
${viewMode === 'weekly' ? 'w-12 px-1' : 'w-8 px-0'}
|
|
940
|
-
${cellError
|
|
941
|
-
? 'bg-status-error-bg'
|
|
942
|
-
: isDirty
|
|
943
|
-
? 'border-status-warning-border bg-status-warning-bg'
|
|
944
|
-
: 'border-muted-foreground/20 bg-transparent hover:border-muted-foreground/40'}`}
|
|
945
|
-
inputClassName={`text-center text-xs tabular-nums
|
|
946
|
-
${cellError ? 'text-status-error-text' : cellMinutes > 0 ? 'font-semibold' : 'text-muted-foreground'}`}
|
|
947
|
-
value={rawText[project.id]?.[dateKey] ?? formatMinutesAsDecimal(cellMinutes)}
|
|
948
|
-
onChange={(e) => handleCellChange(project.id, dateKey, e.target.value)}
|
|
949
|
-
onBlur={(event) => handleCellBlur(project.id, dateKey, event.currentTarget.value)}
|
|
950
|
-
placeholder={t('staff.timesheets.my.durationPlaceholder', '0')}
|
|
951
|
-
aria-invalid={cellError !== undefined}
|
|
952
|
-
aria-label={describeDurationCell(project.name, date)}
|
|
953
|
-
aria-describedby={[durationHintId, cellErrorId].filter(Boolean).join(' ')}
|
|
954
|
-
title={cellErrorMessage ?? durationFormatHint}
|
|
955
|
-
/>
|
|
956
|
-
)}
|
|
957
|
-
{cellErrorMessage ? (
|
|
958
|
-
<span id={cellErrorId} role="alert" className="sr-only">{cellErrorMessage}</span>
|
|
959
|
-
) : null}
|
|
960
|
-
</td>
|
|
961
|
-
)
|
|
962
|
-
})}
|
|
963
|
-
<td className="px-3 py-1.5 text-right font-semibold text-xs tabular-nums">
|
|
964
|
-
{formatMinutesAsDecimal(getRowTotal(project.id)) || '0'}
|
|
965
|
-
</td>
|
|
966
|
-
</tr>
|
|
967
|
-
))}
|
|
968
|
-
<tr className="border-b">
|
|
969
|
-
<td colSpan={visibleDays.length + 2} className="sticky left-0 bg-background px-1 py-0.5">
|
|
970
|
-
<AddRowDropdown
|
|
971
|
-
assignedProjects={allAssignedProjects}
|
|
972
|
-
visibleProjectIds={visibleProjectIds}
|
|
973
|
-
canCreateProject={canManageProjects}
|
|
974
|
-
onAddProject={handleAddProject}
|
|
975
|
-
onCreateProject={() => setCreateDialogOpen(true)}
|
|
976
|
-
/>
|
|
977
|
-
</td>
|
|
978
|
-
</tr>
|
|
979
|
-
</tbody>
|
|
980
|
-
<tfoot>
|
|
981
|
-
<tr className="border-t bg-muted/50 font-semibold">
|
|
982
|
-
<td className="sticky left-0 z-10 bg-muted px-3 py-2">
|
|
983
|
-
{t('staff.timesheets.my.daily_total', 'Daily Total')}
|
|
984
|
-
</td>
|
|
985
|
-
{visibleDays.map((date) => {
|
|
986
|
-
const weekend = isWeekendDay(date)
|
|
987
|
-
const dayMinutes = getDayTotal(date)
|
|
988
|
-
return (
|
|
989
|
-
<td key={formatDateKey(date)} className={`py-2 text-center text-xs tabular-nums ${weekend ? 'text-muted-foreground/50' : ''}`}>
|
|
990
|
-
{weekend ? '-' : (formatMinutesAsDecimal(dayMinutes) || '-')}
|
|
991
|
-
</td>
|
|
992
|
-
)
|
|
993
|
-
})}
|
|
994
|
-
<td className="px-3 py-2 text-right tabular-nums font-semibold">{formatMinutesAsDecimal(grandTotal) || '0'}</td>
|
|
995
|
-
</tr>
|
|
996
|
-
</tfoot>
|
|
997
|
-
</table>
|
|
998
|
-
<p id={durationHintId} className="px-3 py-2 text-xs text-muted-foreground">{durationFormatHint}</p>
|
|
999
|
-
</div>
|
|
1000
|
-
)}
|
|
1001
|
-
</div>
|
|
1002
|
-
</PageBody>
|
|
1003
|
-
{ConfirmDialogElement}
|
|
1004
|
-
<CreateProjectDialog
|
|
1005
|
-
open={createDialogOpen}
|
|
1006
|
-
onOpenChange={setCreateDialogOpen}
|
|
1007
|
-
onProjectCreated={handleProjectCreated}
|
|
1008
|
-
/>
|
|
1009
|
-
</Page>
|
|
1010
|
-
)
|
|
1
|
+
import { permanentRedirect } from 'next/navigation'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Legacy route. The timesheets pages moved to the `Time tracking` nav group at
|
|
5
|
+
* `/backend/staff/time-tracking/*`; the editable project x day grid now lives at
|
|
6
|
+
* `/backend/staff/time-tracking/timesheet`.
|
|
7
|
+
*
|
|
8
|
+
* `permanentRedirect` answers 308, so bookmarks, deep links and API-doc examples
|
|
9
|
+
* keep working. Retained for at least one minor release per `UPGRADE_NOTES.md`.
|
|
10
|
+
*/
|
|
11
|
+
export default function TimesheetsLegacyRedirectPage() {
|
|
12
|
+
permanentRedirect('/backend/staff/time-tracking/timesheet')
|
|
1011
13
|
}
|