@open-mercato/core 0.7.1-develop.7178.1.ab93fbaf4e → 0.7.1-develop.7180.1.9717fbbb43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/staff_time_entry/index.js +14 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +2 -2
- package/dist/generated/entities/staff_time_entry_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_entry_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +16 -0
- package/dist/generated/entities/staff_time_project/index.js.map +2 -2
- package/dist/generated/entities/staff_time_report/index.js +57 -0
- package/dist/generated/entities/staff_time_report/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_entry/index.js +27 -0
- package/dist/generated/entities/staff_time_report_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_event/index.js +21 -0
- package/dist/generated/entities/staff_time_report_event/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_project/index.js +15 -0
- package/dist/generated/entities/staff_time_report_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_tag/index.js +21 -0
- package/dist/generated/entities/staff_time_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task/index.js +37 -0
- package/dist/generated/entities/staff_time_task/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_comment/index.js +21 -0
- package/dist/generated/entities/staff_time_task_comment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_status/index.js +29 -0
- package/dist/generated/entities/staff_time_task_status/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_task_tag/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +11 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +149 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +7 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +2 -2
- package/dist/modules/auth/cli.js +16 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js +44 -0
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +1 -28
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +2 -0
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +39 -17
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/start-controls.js +42 -0
- package/dist/modules/data_sync/lib/start-controls.js.map +7 -0
- package/dist/modules/staff/acl.js +9 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/ai-agents.js +142 -0
- package/dist/modules/staff/ai-agents.js.map +7 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js +348 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js.map +7 -0
- package/dist/modules/staff/ai-tools/types.js +54 -0
- package/dist/modules/staff/ai-tools/types.js.map +7 -0
- package/dist/modules/staff/ai-tools.js +8 -0
- package/dist/modules/staff/ai-tools.js.map +7 -0
- package/dist/modules/staff/analytics.js +84 -1
- package/dist/modules/staff/analytics.js.map +2 -2
- package/dist/modules/staff/api/guards.js +37 -3
- package/dist/modules/staff/api/guards.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js +131 -0
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js.map +7 -0
- package/dist/modules/staff/api/portal/time-reports/route.js +179 -0
- package/dist/modules/staff/api/portal/time-reports/route.js.map +7 -0
- package/dist/modules/staff/api/team-members/self/route.js +1 -3
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +174 -0
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js +226 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +15 -8
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +13 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js +42 -0
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js +383 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +14 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +168 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +246 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +183 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +164 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +360 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/route.js +316 -0
- package/dist/modules/staff/api/timesheets/reports/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js +63 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +164 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js +168 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/route.js +199 -0
- package/dist/modules/staff/api/timesheets/settings/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/access.js +76 -0
- package/dist/modules/staff/api/timesheets/tags/access.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +235 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/route.js +160 -0
- package/dist/modules/staff/api/timesheets/tags/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +233 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js +188 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +399 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +210 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js +333 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +228 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +29 -10
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +31 -18
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +21 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +27 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +215 -32
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +378 -0
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +340 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +238 -26
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +23 -8
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +209 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +59 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +264 -22
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js +110 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js +981 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js +583 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js +15 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js +65 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js +229 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js +1014 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js +97 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js +1040 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js +19 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js +353 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js +457 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js +697 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js +174 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js +546 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js +710 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js +646 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +4 -793
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +2 -7
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +5 -136
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +5 -445
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +3 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +4 -76
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +4 -613
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +2 -17
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +2 -2
- package/dist/modules/staff/ce.js +40 -0
- package/dist/modules/staff/ce.js.map +2 -2
- package/dist/modules/staff/cli.js +166 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +5 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +569 -21
- package/dist/modules/staff/commands/timesheets-entries.js.map +3 -3
- package/dist/modules/staff/commands/timesheets-projects.js +450 -7
- package/dist/modules/staff/commands/timesheets-projects.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +1036 -0
- package/dist/modules/staff/commands/timesheets-reports.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tags.js +1015 -0
- package/dist/modules/staff/commands/timesheets-tags.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js +438 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js +723 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tasks.js +834 -0
- package/dist/modules/staff/commands/timesheets-tasks.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +426 -12
- package/dist/modules/staff/data/enrichers.js.map +2 -2
- package/dist/modules/staff/data/entities.js +552 -3
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/extensions.js +41 -0
- package/dist/modules/staff/data/extensions.js.map +7 -0
- package/dist/modules/staff/data/validators.js +254 -9
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/di.js +42 -1
- package/dist/modules/staff/di.js.map +2 -2
- package/dist/modules/staff/events.js +84 -6
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/events.payloads.js +158 -0
- package/dist/modules/staff/events.payloads.js.map +7 -0
- package/dist/modules/staff/extension-points.js +261 -0
- package/dist/modules/staff/extension-points.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js +138 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js +12 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js +133 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js +19 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js.map +7 -0
- package/dist/modules/staff/lib/crud.js +11 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/time-tracking/access.js +92 -0
- package/dist/modules/staff/lib/time-tracking/access.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/billability.js +39 -0
- package/dist/modules/staff/lib/time-tracking/billability.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js +68 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js +15 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/cost.js +82 -0
- package/dist/modules/staff/lib/time-tracking/cost.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/duration.js +55 -0
- package/dist/modules/staff/lib/time-tracking/duration.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js +41 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/interval.js +72 -0
- package/dist/modules/staff/lib/time-tracking/interval.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js +88 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js +10 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js +87 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js +27 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js +16 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js +135 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js +187 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js +80 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js +56 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js +63 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js +62 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js +21 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js +34 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js +66 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js +39 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js +214 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settings.js +87 -0
- package/dist/modules/staff/lib/time-tracking/settings.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js +9 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js +48 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js +283 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js +324 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js +121 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js +89 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js +855 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js +360 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js +259 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js +238 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js +130 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js +98 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js +27 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js +166 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js +295 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js +212 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js +729 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js +217 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js +158 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js +224 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js +93 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js +1196 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js +307 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js +284 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js +73 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js +1499 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js +95 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js +61 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js +45 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js +82 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js +5 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js +152 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js +92 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js +111 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js +243 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js +105 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js +132 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js +205 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js +53 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js +77 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js.map +7 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js +809 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js.map +7 -0
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js +2 -3
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js.map +2 -2
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js +152 -0
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js +36 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js +78 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js +44 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js +169 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js +22 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +51 -1
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js +70 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +63 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +170 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js +205 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js +68 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js +135 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js +48 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js +262 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js +34 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js +79 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js +11 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js +83 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js +42 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js +107 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js +289 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js +145 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js +116 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js +50 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js +27 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js +65 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js +17 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js +51 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +11 -4
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +369 -111
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +47 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +2 -2
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js +79 -0
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js +15 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js.map +7 -0
- package/dist/modules/staff/notifications.client.js +16 -0
- package/dist/modules/staff/notifications.client.js.map +7 -0
- package/dist/modules/staff/notifications.handlers.js +80 -0
- package/dist/modules/staff/notifications.handlers.js.map +7 -0
- package/dist/modules/staff/notifications.js +168 -0
- package/dist/modules/staff/notifications.js.map +2 -2
- package/dist/modules/staff/search.js +159 -1
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +20 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js +68 -0
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js +149 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js +78 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js +78 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js.map +7 -0
- package/dist/modules/staff/translations.js +4 -1
- package/dist/modules/staff/translations.js.map +2 -2
- package/dist/modules/staff/widgets/components.js +7 -0
- package/dist/modules/staff/widgets/components.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +5 -4
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +2 -2
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js +135 -0
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js.map +7 -0
- package/dist/modules/staff/widgets/notifications/index.js +5 -0
- package/dist/modules/staff/widgets/notifications/index.js.map +7 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js +43 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js.map +7 -0
- package/generated/entities/staff_time_entry/index.ts +7 -0
- package/generated/entities/staff_time_entry_tag/index.ts +6 -0
- package/generated/entities/staff_time_project/index.ts +8 -0
- package/generated/entities/staff_time_report/index.ts +27 -0
- package/generated/entities/staff_time_report_entry/index.ts +12 -0
- package/generated/entities/staff_time_report_event/index.ts +9 -0
- package/generated/entities/staff_time_report_project/index.ts +6 -0
- package/generated/entities/staff_time_tag/index.ts +9 -0
- package/generated/entities/staff_time_task/index.ts +17 -0
- package/generated/entities/staff_time_task_comment/index.ts +9 -0
- package/generated/entities/staff_time_task_status/index.ts +13 -0
- package/generated/entities/staff_time_task_tag/index.ts +6 -0
- package/generated/entities.ids.generated.ts +11 -1
- package/generated/entity-fields-registry.ts +149 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +31 -1
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/cli.ts +35 -1
- package/src/modules/auth/i18n/de.json +7 -0
- package/src/modules/auth/i18n/en.json +7 -0
- package/src/modules/auth/i18n/es.json +7 -0
- package/src/modules/auth/i18n/ko.json +7 -0
- package/src/modules/auth/i18n/pl.json +7 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/customer_accounts/lib/customerRoleAcls.ts +79 -0
- package/src/modules/customer_accounts/setup.ts +1 -45
- package/src/modules/data_sync/AGENTS.md +34 -0
- package/src/modules/data_sync/api/options.ts +2 -0
- package/src/modules/data_sync/backend/data-sync/page.tsx +82 -33
- package/src/modules/data_sync/i18n/de.json +1 -0
- package/src/modules/data_sync/i18n/en.json +1 -0
- package/src/modules/data_sync/i18n/es.json +1 -0
- package/src/modules/data_sync/i18n/ko.json +1 -0
- package/src/modules/data_sync/i18n/pl.json +1 -0
- package/src/modules/data_sync/lib/adapter.ts +45 -0
- package/src/modules/data_sync/lib/start-controls.ts +89 -0
- package/src/modules/staff/AGENTS.md +769 -1
- package/src/modules/staff/acl.ts +9 -0
- package/src/modules/staff/ai-agents.ts +189 -0
- package/src/modules/staff/ai-tools/time-tracking-pack.ts +494 -0
- package/src/modules/staff/ai-tools/types.ts +82 -0
- package/src/modules/staff/ai-tools.ts +13 -0
- package/src/modules/staff/analytics.ts +113 -0
- package/src/modules/staff/api/guards.ts +85 -3
- package/src/modules/staff/api/leave-requests/accept/route.ts +0 -2
- package/src/modules/staff/api/leave-requests/reject/route.ts +0 -2
- package/src/modules/staff/api/portal/time-reports/[id]/route.ts +182 -0
- package/src/modules/staff/api/portal/time-reports/route.ts +270 -0
- package/src/modules/staff/api/team-members/self/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/assign/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +0 -2
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +292 -0
- package/src/modules/staff/api/timesheets/access-requests/route.ts +299 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +15 -7
- package/src/modules/staff/api/timesheets/my-projects/route.ts +14 -1
- package/src/modules/staff/api/timesheets/my-work/myWorkAggregate.ts +90 -0
- package/src/modules/staff/api/timesheets/my-work/route.ts +475 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +15 -2
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +203 -0
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +315 -0
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +220 -0
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +208 -0
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +449 -0
- package/src/modules/staff/api/timesheets/reports/route.ts +386 -0
- package/src/modules/staff/api/timesheets/reports/shared.ts +121 -0
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +205 -0
- package/src/modules/staff/api/timesheets/settings/rounding-impact/route.ts +226 -0
- package/src/modules/staff/api/timesheets/settings/route.ts +242 -0
- package/src/modules/staff/api/timesheets/tags/access.ts +134 -0
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +290 -0
- package/src/modules/staff/api/timesheets/tags/route.ts +177 -0
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +294 -0
- package/src/modules/staff/api/timesheets/task-statuses/route.ts +232 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +532 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +271 -0
- package/src/modules/staff/api/timesheets/tasks/route.ts +443 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +306 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +32 -10
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +32 -17
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +27 -6
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +36 -6
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +331 -34
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +533 -0
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +457 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +378 -24
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +31 -9
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +246 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +62 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +397 -22
- package/src/modules/staff/backend/staff/time-tracking/board/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/board/page.tsx +151 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.tsx +1229 -0
- package/src/modules/staff/backend/staff/time-tracking/page.meta.ts +11 -0
- package/src/modules/staff/backend/staff/time-tracking/page.tsx +823 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.tsx +81 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.tsx +275 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.tsx +1420 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.tsx +109 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.meta.ts +15 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.tsx +1254 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.ts +466 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.tsx +632 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.tsx +867 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.tsx +246 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.tsx +701 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/GridView.tsx +953 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.tsx +800 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +6 -6
- package/src/modules/staff/backend/staff/timesheets/page.tsx +12 -1010
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +4 -158
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +4 -609
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +3 -89
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +2 -19
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +3 -778
- package/src/modules/staff/ce.ts +63 -0
- package/src/modules/staff/cli.ts +207 -1
- package/src/modules/staff/commands/index.ts +5 -0
- package/src/modules/staff/commands/timesheets-entries.ts +1006 -28
- package/src/modules/staff/commands/timesheets-projects.ts +593 -7
- package/src/modules/staff/commands/timesheets-reports.ts +1329 -0
- package/src/modules/staff/commands/timesheets-tags.ts +1315 -0
- package/src/modules/staff/commands/timesheets-task-comments.ts +583 -0
- package/src/modules/staff/commands/timesheets-task-statuses.ts +889 -0
- package/src/modules/staff/commands/timesheets-tasks.ts +1121 -0
- package/src/modules/staff/data/enrichers.ts +675 -10
- package/src/modules/staff/data/entities.ts +494 -2
- package/src/modules/staff/data/extensions.ts +68 -0
- package/src/modules/staff/data/validators.ts +348 -3
- package/src/modules/staff/di.ts +96 -0
- package/src/modules/staff/events.payloads.ts +268 -0
- package/src/modules/staff/events.ts +87 -5
- package/src/modules/staff/extension-points.ts +308 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.ts +10 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.tsx +225 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.ts +17 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.tsx +182 -0
- package/src/modules/staff/i18n/de.json +899 -0
- package/src/modules/staff/i18n/en.json +899 -0
- package/src/modules/staff/i18n/es.json +899 -0
- package/src/modules/staff/i18n/ko.json +899 -0
- package/src/modules/staff/i18n/pl.json +899 -0
- package/src/modules/staff/lib/crud.ts +14 -3
- package/src/modules/staff/lib/time-tracking/access.ts +155 -0
- package/src/modules/staff/lib/time-tracking/billability.ts +68 -0
- package/src/modules/staff/lib/time-tracking/capacity.ts +124 -0
- package/src/modules/staff/lib/time-tracking/componentContracts.ts +26 -0
- package/src/modules/staff/lib/time-tracking/cost.ts +144 -0
- package/src/modules/staff/lib/time-tracking/duration.ts +68 -0
- package/src/modules/staff/lib/time-tracking/featureAccess.ts +115 -0
- package/src/modules/staff/lib/time-tracking/interval.ts +90 -0
- package/src/modules/staff/lib/time-tracking/migrateProjectCodes.ts +161 -0
- package/src/modules/staff/lib/time-tracking/moneyVisibility.ts +37 -0
- package/src/modules/staff/lib/time-tracking/overlap.ts +159 -0
- package/src/modules/staff/lib/time-tracking/portalRecipients.ts +76 -0
- package/src/modules/staff/lib/time-tracking/portalReports.ts +31 -0
- package/src/modules/staff/lib/time-tracking/projectCode.ts +221 -0
- package/src/modules/staff/lib/time-tracking/reapplyRounding.ts +313 -0
- package/src/modules/staff/lib/time-tracking/recalculationRunner.ts +118 -0
- package/src/modules/staff/lib/time-tracking/recalculations.ts +135 -0
- package/src/modules/staff/lib/time-tracking/registries/invoke.ts +122 -0
- package/src/modules/staff/lib/time-tracking/registries/registry.ts +124 -0
- package/src/modules/staff/lib/time-tracking/registries/scope.ts +56 -0
- package/src/modules/staff/lib/time-tracking/rollup.ts +59 -0
- package/src/modules/staff/lib/time-tracking/rounding.ts +126 -0
- package/src/modules/staff/lib/time-tracking/roundingImpact.ts +75 -0
- package/src/modules/staff/lib/time-tracking/settingKeys.ts +274 -0
- package/src/modules/staff/lib/time-tracking/settings.ts +168 -0
- package/src/modules/staff/lib/time-tracking/sqlInClause.ts +22 -0
- package/src/modules/staff/lib/time-tracking/timeEntrySources.ts +85 -0
- package/src/modules/staff/lib/time-tracking-ui/BoardFilterChips.tsx +360 -0
- package/src/modules/staff/lib/time-tracking-ui/CustomerPicker.tsx +427 -0
- package/src/modules/staff/lib/time-tracking-ui/DurationInput.tsx +192 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryDetailsFields.tsx +224 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryFilterBar.tsx +144 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanBoard.tsx +1065 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanCard.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanColumn.tsx +316 -0
- package/src/modules/staff/lib/time-tracking-ui/NewTaskDialog.tsx +291 -0
- package/src/modules/staff/lib/time-tracking-ui/NoProjectAccess.tsx +162 -0
- package/src/modules/staff/lib/time-tracking-ui/PeriodSelector.tsx +149 -0
- package/src/modules/staff/lib/time-tracking-ui/PhasePlaceholder.tsx +31 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCodeField.tsx +230 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.tsx +432 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectFormSections.tsx +323 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.tsx +930 -0
- package/src/modules/staff/lib/time-tracking-ui/ReportSheet.tsx +357 -0
- package/src/modules/staff/lib/time-tracking-ui/TagPicker.tsx +195 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskBoardScreen.tsx +243 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskCommentThread.tsx +137 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskDrawer.tsx +1405 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskListView.tsx +260 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskPicker.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskQuickLog.tsx +296 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.tsx +97 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDialog.tsx +1929 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.tsx +126 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetCalendar.tsx +265 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.tsx +78 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.tsx +70 -0
- package/src/modules/staff/lib/time-tracking-ui/boardDirectory.ts +231 -0
- package/src/modules/staff/lib/time-tracking-ui/boardFilters.ts +128 -0
- package/src/modules/staff/lib/time-tracking-ui/boardSummary.ts +20 -0
- package/src/modules/staff/lib/time-tracking-ui/kanbanBoardData.ts +228 -0
- package/src/modules/staff/lib/time-tracking-ui/projectTeamAssignment.ts +143 -0
- package/src/modules/staff/lib/time-tracking-ui/taskDrawerData.ts +194 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryDialogState.ts +400 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryListData.ts +271 -0
- package/src/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.ts +168 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetData.ts +225 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetPeriod.ts +278 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetTargets.ts +93 -0
- package/src/modules/staff/lib/time-tracking-ui/useBoardFilters.ts +107 -0
- package/src/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.ts +245 -0
- package/src/modules/staff/lib/timeTrackingSeeds.ts +1037 -0
- package/src/modules/staff/lib/timesheets/timeEntryCacheInvalidation.ts +11 -10
- package/src/modules/staff/lib/timesheets/timeEntryDecoration.ts +256 -0
- package/src/modules/staff/lib/timesheets-projects/budgetBurn.ts +60 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThreshold.ts +135 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThresholdState.ts +137 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectFinancials.ts +142 -0
- package/src/modules/staff/lib/timesheets-projects/reportSelection.ts +82 -0
- package/src/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.tsx +237 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.tsx +33 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +56 -1
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.tsx +90 -0
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +125 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +251 -0
- package/src/modules/staff/lib/timesheets-reports/pdf.ts +263 -0
- package/src/modules/staff/lib/timesheets-reports/reportApprovalPolicies.ts +137 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigData.ts +247 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigState.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportExport.ts +373 -0
- package/src/modules/staff/lib/timesheets-reports/reportExportFormats.ts +71 -0
- package/src/modules/staff/lib/timesheets-reports/reportGroupings.ts +153 -0
- package/src/modules/staff/lib/timesheets-reports/reportLabels.ts +23 -0
- package/src/modules/staff/lib/timesheets-reports/reportReference.ts +146 -0
- package/src/modules/staff/lib/timesheets-reports/reportRows.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportSheetData.ts +196 -0
- package/src/modules/staff/lib/timesheets-reports/reportTotals.ts +544 -0
- package/src/modules/staff/lib/timesheets-reports/xlsx.ts +207 -0
- package/src/modules/staff/lib/timesheets-tasks/computeTaskRollups.ts +238 -0
- package/src/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.ts +90 -0
- package/src/modules/staff/lib/timesheets-tasks/seedProjectStatuses.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/statusPositions.ts +132 -0
- package/src/modules/staff/lib/timesheets-tasks/statusSlug.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHierarchy.ts +99 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHoursTotals.ts +42 -0
- package/src/modules/staff/lib/timesheets-tasks/taskReference.ts +108 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +18 -4
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +504 -149
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +50 -2
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +3244 -228
- package/src/modules/staff/migrations/Migration20260813073131_staff.ts +94 -0
- package/src/modules/staff/migrations/Migration20260824143357_staff.ts +17 -0
- package/src/modules/staff/notifications.client.ts +16 -0
- package/src/modules/staff/notifications.handlers.ts +88 -0
- package/src/modules/staff/notifications.ts +163 -0
- package/src/modules/staff/search.ts +191 -1
- package/src/modules/staff/setup.ts +22 -0
- package/src/modules/staff/subscribers/time-project-access-requested-notification.ts +95 -0
- package/src/modules/staff/subscribers/time-project-budget-threshold-notification.ts +226 -0
- package/src/modules/staff/subscribers/time-report-approved-notification.ts +116 -0
- package/src/modules/staff/subscribers/time-report-portal-broadcast.ts +120 -0
- package/src/modules/staff/translations.ts +17 -0
- package/src/modules/staff/widgets/components.ts +34 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +6 -5
- package/src/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.tsx +138 -0
- package/src/modules/staff/widgets/notifications/index.ts +1 -0
- package/src/modules/staff/workers/timesheets-reapply-rounding.ts +59 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +0 -123
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +0 -7
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +0 -138
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The kept editable grid (T5.4) — project × day cells, typed straight into, saved
|
|
5
|
+
* in one pass.
|
|
6
|
+
*
|
|
7
|
+
* This is the one surface of the old timesheet the redesign keeps, because it is
|
|
8
|
+
* the fastest way in the product to fill a week. The table's markup, column
|
|
9
|
+
* widths, weekend treatment, footer and totals are carried over unchanged; the
|
|
10
|
+
* functional upgrade is three things and no more:
|
|
11
|
+
*
|
|
12
|
+
* 1. **The shared duration parser.** Cells were a private `decimalToMinutes`
|
|
13
|
+
* that understood `1.5` and silently answered `0` for `1h 40m`. They are now
|
|
14
|
+
* `DurationInput`, so the grid understands exactly what the entry dialog, the
|
|
15
|
+
* inline cell edit and the quick-add rows understand. The look is preserved
|
|
16
|
+
* by `formatValue={formatTrimmedDecimalDuration}` — 120 minutes renders `2`,
|
|
17
|
+
* not `2.00` (watch item W3, closed by T4.5 with a test pinning the
|
|
18
|
+
* divergence from `formatDuration(…, 'decimal')`).
|
|
19
|
+
*
|
|
20
|
+
* A consequence worth stating: text that does not parse is **kept**, the cell
|
|
21
|
+
* is flagged, and Save is disabled until it is fixed. The old grid stripped
|
|
22
|
+
* every character it did not like as you typed.
|
|
23
|
+
*
|
|
24
|
+
* 2. **Rows can be a project or a project + task.** The row-mode toggle splits
|
|
25
|
+
* each project row into its task-less entries plus one row per task with time
|
|
26
|
+
* in the period, so grid entries carry `taskId` like every other entry.
|
|
27
|
+
*
|
|
28
|
+
* 3. **Locked cells are read-only**, badged, and never sent. The bulk endpoint
|
|
29
|
+
* refuses the whole batch with `409 time_entry_locked` naming the offending
|
|
30
|
+
* ids (T4.2); those ids are marked here so the refusal lands on the cells
|
|
31
|
+
* that caused it rather than as an opaque batch failure.
|
|
32
|
+
*
|
|
33
|
+
* **Table semantics and states.** The grid is a data table, so it carries an
|
|
34
|
+
* sr-only `<caption>`, `scope`d column headers and a `<th scope="row">` row
|
|
35
|
+
* label — without them a screen reader reads a row as eight unlabelled numbers.
|
|
36
|
+
* Weekends keep their background tint but no longer depend on it alone: the
|
|
37
|
+
* header also carries the day and the word in its `title` and an sr-only marker.
|
|
38
|
+
* `isLoading` draws skeleton rows in the real row geometry rather than a
|
|
39
|
+
* centered one-liner, and a period with no rows gets an in-table empty state
|
|
40
|
+
* instead of headers over an empty body.
|
|
41
|
+
*
|
|
42
|
+
* **Save path — two routes, and why.**
|
|
43
|
+
* The bulk endpoint now assigns `task_id` on both its create and update
|
|
44
|
+
* branches, so the silent-drop defect this file used to document is fixed and
|
|
45
|
+
* the note is retired. Task-row cells nonetheless keep writing through the
|
|
46
|
+
* single-entry CRUD route, for a different reason: that route carries a
|
|
47
|
+
* per-entry `If-Match`-style expected version, so a cell edited from another
|
|
48
|
+
* tab surfaces as a conflict on the cell that caused it. The batch has no
|
|
49
|
+
* per-row version contract — it is all-or-nothing and reconciles only the
|
|
50
|
+
* report lock (`409 time_entry_locked`) — so project rows sent through it are
|
|
51
|
+
* deliberately last-write-wins. optimistic-lock-exempt: the bulk batch has no
|
|
52
|
+
* per-row version field; per-cell locking is provided by the single-entry path
|
|
53
|
+
* above, and the batch's own gate is the closed-report lock.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
import * as React from 'react'
|
|
57
|
+
import { z } from 'zod'
|
|
58
|
+
import { registerComponent } from '@open-mercato/shared/modules/widgets/component-registry'
|
|
59
|
+
import { useRegisteredComponent } from '@open-mercato/ui/backend/injection/useRegisteredComponent'
|
|
60
|
+
import { extensionPoints } from '@open-mercato/core/modules/staff/extension-points'
|
|
61
|
+
import {
|
|
62
|
+
callbackProp,
|
|
63
|
+
opaqueProp,
|
|
64
|
+
} from '../../../../lib/time-tracking/componentContracts'
|
|
65
|
+
import { Lock, X } from 'lucide-react'
|
|
66
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
67
|
+
import { SegmentedControl, SegmentedControlItem } from '@open-mercato/ui/primitives/segmented-control'
|
|
68
|
+
import {
|
|
69
|
+
Select,
|
|
70
|
+
SelectContent,
|
|
71
|
+
SelectItem,
|
|
72
|
+
SelectTrigger,
|
|
73
|
+
SelectValue,
|
|
74
|
+
} from '@open-mercato/ui/primitives/select'
|
|
75
|
+
import { apiCallOrThrow, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'
|
|
76
|
+
import { createCrud, deleteCrud, updateCrud } from '@open-mercato/ui/backend/utils/crud'
|
|
77
|
+
import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'
|
|
78
|
+
import { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'
|
|
79
|
+
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
80
|
+
import { surfaceRecordConflict } from '@open-mercato/ui/backend/conflicts'
|
|
81
|
+
import { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'
|
|
82
|
+
import { cn } from '@open-mercato/shared/lib/utils'
|
|
83
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
84
|
+
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
85
|
+
import { AddRowDropdown } from '../../../../lib/timesheets-ui/AddRowDropdown'
|
|
86
|
+
import { ProjectColorDot } from '../../../../lib/timesheets-ui/ProjectColorDot'
|
|
87
|
+
import { DurationInput, formatTrimmedDecimalDuration } from '../../../../lib/time-tracking-ui/DurationInput'
|
|
88
|
+
import { readErrorCode, isEntryLockedError } from '../../../../lib/time-tracking-ui/timeEntryListData'
|
|
89
|
+
import type { TimesheetEntry } from '../../../../lib/time-tracking-ui/timesheetData'
|
|
90
|
+
import { isWeekendIso, parseIsoDay } from '../../../../lib/time-tracking-ui/timesheetPeriod'
|
|
91
|
+
import {
|
|
92
|
+
buildTargetKey,
|
|
93
|
+
targetLabel,
|
|
94
|
+
type TimesheetLogTarget,
|
|
95
|
+
type TimesheetProjectRef,
|
|
96
|
+
type TimesheetTaskRef,
|
|
97
|
+
} from '../../../../lib/time-tracking-ui/timesheetTargets'
|
|
98
|
+
|
|
99
|
+
const logger = createLogger('staff').child({ component: 'time-tracking/timesheet/grid' })
|
|
100
|
+
|
|
101
|
+
/** Placeholder rows drawn while the period loads — same geometry as a real row. */
|
|
102
|
+
const SKELETON_ROW_COUNT = 4
|
|
103
|
+
|
|
104
|
+
const ENTRIES_API_PATH = 'staff/timesheets/time-entries'
|
|
105
|
+
const BULK_ENDPOINT = '/api/staff/timesheets/time-entries/bulk'
|
|
106
|
+
const RESOURCE_KIND = 'staff.timesheets.time_entry'
|
|
107
|
+
|
|
108
|
+
export type GridRowMode = 'projects' | 'tasks'
|
|
109
|
+
|
|
110
|
+
export type GridViewProps = {
|
|
111
|
+
/** Every day column of the current period, in order. */
|
|
112
|
+
days: readonly string[]
|
|
113
|
+
projects: readonly TimesheetProjectRef[]
|
|
114
|
+
allAssignedProjects: readonly TimesheetProjectRef[]
|
|
115
|
+
tasks: readonly TimesheetTaskRef[]
|
|
116
|
+
entries: readonly TimesheetEntry[]
|
|
117
|
+
staffMemberId: string | null
|
|
118
|
+
canManage: boolean
|
|
119
|
+
canManageProjects: boolean
|
|
120
|
+
/** Someone else's timesheet is readable but not editable from the grid. */
|
|
121
|
+
readOnly: boolean
|
|
122
|
+
/** Draws skeleton rows instead of data while the period is being fetched. */
|
|
123
|
+
isLoading?: boolean
|
|
124
|
+
rowMode: GridRowMode
|
|
125
|
+
onRowModeChange: (mode: GridRowMode) => void
|
|
126
|
+
onAddProject: (project: TimesheetProjectRef) => void | Promise<void>
|
|
127
|
+
onRemoveProject: (project: TimesheetProjectRef) => void | Promise<void>
|
|
128
|
+
onCreateProject: () => void
|
|
129
|
+
onSaved: () => void | Promise<void>
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
type GridRow = TimesheetLogTarget & {
|
|
133
|
+
removable: boolean
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type GridCell = {
|
|
137
|
+
minutes: number
|
|
138
|
+
entryIds: string[]
|
|
139
|
+
lockedEntryIds: string[]
|
|
140
|
+
/** `updated_at` per entry id — the expected version a task-cell write sends. */
|
|
141
|
+
entryVersions: Record<string, string | null>
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
type DirtyCell = {
|
|
145
|
+
rowKey: string
|
|
146
|
+
date: string
|
|
147
|
+
minutes: number
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function cellKey(rowKey: string, date: string): string {
|
|
151
|
+
return `${rowKey}|${date}`
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The grid's column header: `Mon` over `13`. */
|
|
155
|
+
function dayHeaderParts(date: string, locale?: string): { weekday: string; dayOfMonth: string } {
|
|
156
|
+
const parsed = parseIsoDay(date)
|
|
157
|
+
if (!parsed) return { weekday: '', dayOfMonth: date }
|
|
158
|
+
let weekday = ''
|
|
159
|
+
try {
|
|
160
|
+
weekday = new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(parsed)
|
|
161
|
+
} catch {
|
|
162
|
+
weekday = ''
|
|
163
|
+
}
|
|
164
|
+
return { weekday, dayOfMonth: String(parsed.getDate()) }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function buildGridRows(
|
|
168
|
+
projects: readonly TimesheetProjectRef[],
|
|
169
|
+
tasks: readonly TimesheetTaskRef[],
|
|
170
|
+
entries: readonly TimesheetEntry[],
|
|
171
|
+
rowMode: GridRowMode,
|
|
172
|
+
extraTaskKeys: ReadonlySet<string>,
|
|
173
|
+
): GridRow[] {
|
|
174
|
+
if (rowMode === 'projects') {
|
|
175
|
+
return projects.map((project) => ({
|
|
176
|
+
key: buildTargetKey(project.id, null),
|
|
177
|
+
timeProjectId: project.id,
|
|
178
|
+
taskId: null,
|
|
179
|
+
projectName: project.name,
|
|
180
|
+
projectCode: project.code,
|
|
181
|
+
projectColor: project.color,
|
|
182
|
+
taskTitle: null,
|
|
183
|
+
removable: true,
|
|
184
|
+
}))
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const tasksById = new Map(tasks.map((task) => [task.id, task]))
|
|
188
|
+
const usedTaskIds = new Map<string, Set<string>>()
|
|
189
|
+
for (const entry of entries) {
|
|
190
|
+
if (!entry.taskId || !entry.timeProjectId) continue
|
|
191
|
+
const bucket = usedTaskIds.get(entry.timeProjectId) ?? new Set<string>()
|
|
192
|
+
bucket.add(entry.taskId)
|
|
193
|
+
usedTaskIds.set(entry.timeProjectId, bucket)
|
|
194
|
+
}
|
|
195
|
+
for (const key of extraTaskKeys) {
|
|
196
|
+
const separator = key.indexOf(':')
|
|
197
|
+
if (separator < 0) continue
|
|
198
|
+
const projectId = key.slice(0, separator)
|
|
199
|
+
const taskId = key.slice(separator + 1)
|
|
200
|
+
const bucket = usedTaskIds.get(projectId) ?? new Set<string>()
|
|
201
|
+
bucket.add(taskId)
|
|
202
|
+
usedTaskIds.set(projectId, bucket)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const rows: GridRow[] = []
|
|
206
|
+
for (const project of projects) {
|
|
207
|
+
rows.push({
|
|
208
|
+
key: buildTargetKey(project.id, null),
|
|
209
|
+
timeProjectId: project.id,
|
|
210
|
+
taskId: null,
|
|
211
|
+
projectName: project.name,
|
|
212
|
+
projectCode: project.code,
|
|
213
|
+
projectColor: project.color,
|
|
214
|
+
taskTitle: null,
|
|
215
|
+
removable: true,
|
|
216
|
+
})
|
|
217
|
+
const taskIds = Array.from(usedTaskIds.get(project.id) ?? [])
|
|
218
|
+
const named = taskIds
|
|
219
|
+
.map((taskId) => ({ taskId, title: tasksById.get(taskId)?.title ?? null }))
|
|
220
|
+
.sort((left, right) => (left.title ?? '').localeCompare(right.title ?? ''))
|
|
221
|
+
for (const task of named) {
|
|
222
|
+
rows.push({
|
|
223
|
+
key: buildTargetKey(project.id, task.taskId),
|
|
224
|
+
timeProjectId: project.id,
|
|
225
|
+
taskId: task.taskId,
|
|
226
|
+
projectName: project.name,
|
|
227
|
+
projectCode: project.code,
|
|
228
|
+
projectColor: project.color,
|
|
229
|
+
taskTitle: task.title,
|
|
230
|
+
removable: false,
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return rows
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function buildGridCells(
|
|
238
|
+
entries: readonly TimesheetEntry[],
|
|
239
|
+
rowMode: GridRowMode,
|
|
240
|
+
): Map<string, GridCell> {
|
|
241
|
+
const cells = new Map<string, GridCell>()
|
|
242
|
+
for (const entry of entries) {
|
|
243
|
+
if (!entry.timeProjectId) continue
|
|
244
|
+
const rowKey =
|
|
245
|
+
rowMode === 'projects'
|
|
246
|
+
? buildTargetKey(entry.timeProjectId, null)
|
|
247
|
+
: buildTargetKey(entry.timeProjectId, entry.taskId)
|
|
248
|
+
const key = cellKey(rowKey, entry.date)
|
|
249
|
+
const current = cells.get(key) ?? { minutes: 0, entryIds: [], lockedEntryIds: [], entryVersions: {} }
|
|
250
|
+
current.minutes += Number.isFinite(entry.durationMinutes) ? entry.durationMinutes : 0
|
|
251
|
+
current.entryIds.push(entry.id)
|
|
252
|
+
current.entryVersions[entry.id] = entry.updatedAt
|
|
253
|
+
if (entry.isLocked) current.lockedEntryIds.push(entry.id)
|
|
254
|
+
cells.set(key, current)
|
|
255
|
+
}
|
|
256
|
+
return cells
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function DefaultGridView({
|
|
260
|
+
days,
|
|
261
|
+
projects,
|
|
262
|
+
allAssignedProjects,
|
|
263
|
+
tasks,
|
|
264
|
+
entries,
|
|
265
|
+
staffMemberId,
|
|
266
|
+
canManage,
|
|
267
|
+
canManageProjects,
|
|
268
|
+
readOnly,
|
|
269
|
+
isLoading = false,
|
|
270
|
+
rowMode,
|
|
271
|
+
onRowModeChange,
|
|
272
|
+
onAddProject,
|
|
273
|
+
onRemoveProject,
|
|
274
|
+
onCreateProject,
|
|
275
|
+
onSaved,
|
|
276
|
+
}: GridViewProps) {
|
|
277
|
+
const t = useT()
|
|
278
|
+
const { confirm, ConfirmDialogElement } = useConfirmDialog()
|
|
279
|
+
const [dirty, setDirty] = React.useState<Record<string, DirtyCell>>({})
|
|
280
|
+
const [invalidCells, setInvalidCells] = React.useState<Record<string, true>>({})
|
|
281
|
+
const [extraLockedEntryIds, setExtraLockedEntryIds] = React.useState<Record<string, true>>({})
|
|
282
|
+
const [extraTaskKeys, setExtraTaskKeys] = React.useState<Set<string>>(() => new Set())
|
|
283
|
+
const [isSaving, setIsSaving] = React.useState(false)
|
|
284
|
+
|
|
285
|
+
const mutationContextId = staffMemberId ? `staff-timesheets:${staffMemberId}` : 'staff-timesheets:pending'
|
|
286
|
+
const { runMutation, retryLastMutation } = useGuardedMutation<{
|
|
287
|
+
formId: string
|
|
288
|
+
resourceKind: string
|
|
289
|
+
resourceId?: string
|
|
290
|
+
staffMemberId: string | null
|
|
291
|
+
retryLastMutation: () => Promise<boolean>
|
|
292
|
+
}>({
|
|
293
|
+
contextId: mutationContextId,
|
|
294
|
+
blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
const mutationContext = React.useCallback(
|
|
298
|
+
(resourceId?: string) => ({
|
|
299
|
+
formId: mutationContextId,
|
|
300
|
+
resourceKind: RESOURCE_KIND,
|
|
301
|
+
resourceId,
|
|
302
|
+
staffMemberId,
|
|
303
|
+
retryLastMutation,
|
|
304
|
+
}),
|
|
305
|
+
[mutationContextId, retryLastMutation, staffMemberId],
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
const rows = React.useMemo(
|
|
309
|
+
() => buildGridRows(projects, tasks, entries, rowMode, extraTaskKeys),
|
|
310
|
+
[entries, extraTaskKeys, projects, rowMode, tasks],
|
|
311
|
+
)
|
|
312
|
+
const cells = React.useMemo(() => buildGridCells(entries, rowMode), [entries, rowMode])
|
|
313
|
+
const rowsByKey = React.useMemo(() => new Map(rows.map((row) => [row.key, row])), [rows])
|
|
314
|
+
|
|
315
|
+
// A fresh period, a different person or a row-mode switch invalidates every
|
|
316
|
+
// pending edit: the cells they belong to are no longer on screen.
|
|
317
|
+
const resetToken = `${rowMode}|${days[0] ?? ''}|${days[days.length - 1] ?? ''}|${staffMemberId ?? ''}`
|
|
318
|
+
const resetTokenRef = React.useRef(resetToken)
|
|
319
|
+
React.useEffect(() => {
|
|
320
|
+
if (resetTokenRef.current === resetToken) return
|
|
321
|
+
resetTokenRef.current = resetToken
|
|
322
|
+
setDirty({})
|
|
323
|
+
setInvalidCells({})
|
|
324
|
+
}, [resetToken])
|
|
325
|
+
|
|
326
|
+
const isCellLocked = React.useCallback(
|
|
327
|
+
(key: string) => {
|
|
328
|
+
const cell = cells.get(key)
|
|
329
|
+
if (!cell) return false
|
|
330
|
+
if (cell.lockedEntryIds.length > 0) return true
|
|
331
|
+
return cell.entryIds.some((id) => extraLockedEntryIds[id])
|
|
332
|
+
},
|
|
333
|
+
[cells, extraLockedEntryIds],
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
const cellMinutes = React.useCallback(
|
|
337
|
+
(key: string) => {
|
|
338
|
+
const pending = dirty[key]
|
|
339
|
+
if (pending) return pending.minutes
|
|
340
|
+
return cells.get(key)?.minutes ?? 0
|
|
341
|
+
},
|
|
342
|
+
[cells, dirty],
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
const handleCellChange = React.useCallback(
|
|
346
|
+
(row: GridRow, date: string, minutes: number | null, invalid: boolean) => {
|
|
347
|
+
const key = cellKey(row.key, date)
|
|
348
|
+
setInvalidCells((current) => {
|
|
349
|
+
if (invalid === Boolean(current[key])) return current
|
|
350
|
+
const next = { ...current }
|
|
351
|
+
if (invalid) next[key] = true
|
|
352
|
+
else delete next[key]
|
|
353
|
+
return next
|
|
354
|
+
})
|
|
355
|
+
// Unparseable text is never turned into a number — the previous value stands
|
|
356
|
+
// and Save stays blocked until the text is fixed or cleared.
|
|
357
|
+
if (invalid) return
|
|
358
|
+
const nextMinutes = minutes ?? 0
|
|
359
|
+
const stored = cells.get(key)
|
|
360
|
+
const storedMinutes = stored?.minutes ?? 0
|
|
361
|
+
const hadEntries = (stored?.entryIds.length ?? 0) > 0
|
|
362
|
+
setDirty((current) => {
|
|
363
|
+
const next = { ...current }
|
|
364
|
+
if (nextMinutes === storedMinutes && !hadEntries) {
|
|
365
|
+
delete next[key]
|
|
366
|
+
return next
|
|
367
|
+
}
|
|
368
|
+
next[key] = { rowKey: row.key, date, minutes: nextMinutes }
|
|
369
|
+
return next
|
|
370
|
+
})
|
|
371
|
+
},
|
|
372
|
+
[cells],
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
const rowTotal = React.useCallback(
|
|
376
|
+
(rowKey: string) => days.reduce((sum, date) => sum + cellMinutes(cellKey(rowKey, date)), 0),
|
|
377
|
+
[cellMinutes, days],
|
|
378
|
+
)
|
|
379
|
+
const dayTotal = React.useCallback(
|
|
380
|
+
(date: string) => rows.reduce((sum, row) => sum + cellMinutes(cellKey(row.key, date)), 0),
|
|
381
|
+
[cellMinutes, rows],
|
|
382
|
+
)
|
|
383
|
+
const grandTotal = React.useMemo(
|
|
384
|
+
() => rows.reduce((sum, row) => sum + rowTotal(row.key), 0),
|
|
385
|
+
[rowTotal, rows],
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
const dirtyCount = Object.keys(dirty).length
|
|
389
|
+
const invalidCount = Object.keys(invalidCells).length
|
|
390
|
+
const hasChanges = dirtyCount > 0
|
|
391
|
+
const dense = days.length > 10
|
|
392
|
+
|
|
393
|
+
const markLockedFromError = React.useCallback((error: unknown) => {
|
|
394
|
+
const body = (error as { body?: { lockedEntryIds?: unknown } } | null)?.body
|
|
395
|
+
const direct = (error as { lockedEntryIds?: unknown } | null)?.lockedEntryIds
|
|
396
|
+
const ids = Array.isArray(body?.lockedEntryIds)
|
|
397
|
+
? body?.lockedEntryIds
|
|
398
|
+
: Array.isArray(direct)
|
|
399
|
+
? direct
|
|
400
|
+
: []
|
|
401
|
+
const marked = ids.filter((id): id is string => typeof id === 'string')
|
|
402
|
+
if (marked.length === 0) return false
|
|
403
|
+
setExtraLockedEntryIds((current) => {
|
|
404
|
+
const next = { ...current }
|
|
405
|
+
for (const id of marked) next[id] = true
|
|
406
|
+
return next
|
|
407
|
+
})
|
|
408
|
+
return true
|
|
409
|
+
}, [])
|
|
410
|
+
|
|
411
|
+
const reportSaveFailure = React.useCallback(
|
|
412
|
+
(error: unknown) => {
|
|
413
|
+
if (surfaceRecordConflict(error, t)) return
|
|
414
|
+
if (isEntryLockedError(error)) {
|
|
415
|
+
markLockedFromError(error)
|
|
416
|
+
flash(
|
|
417
|
+
t(
|
|
418
|
+
'staff.time_tracking.timesheet.grid.errors.locked',
|
|
419
|
+
'Some of these cells belong to a closed report and cannot be changed. They are now marked as locked.',
|
|
420
|
+
),
|
|
421
|
+
'error',
|
|
422
|
+
)
|
|
423
|
+
return
|
|
424
|
+
}
|
|
425
|
+
logger.error('staff.time_tracking.timesheet.grid save failed', { err: error, code: readErrorCode(error) })
|
|
426
|
+
flash(t('staff.timesheets.my.errors.save', 'Failed to save timesheets.'), 'error')
|
|
427
|
+
},
|
|
428
|
+
[markLockedFromError, t],
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Task-row cells, one write each through the single-entry route — see the file
|
|
433
|
+
* header for why they cannot ride the batch yet. A locked cell never reaches
|
|
434
|
+
* here (its input is read-only), so a 409 from this path means the entry was
|
|
435
|
+
* frozen after the page loaded, which is exactly when the user needs to be
|
|
436
|
+
* told which cell it was.
|
|
437
|
+
*/
|
|
438
|
+
const saveTaskCells = React.useCallback(
|
|
439
|
+
async (changes: Array<{ row: GridRow; cell: DirtyCell }>) => {
|
|
440
|
+
for (const { row, cell } of changes) {
|
|
441
|
+
const key = cellKey(row.key, cell.date)
|
|
442
|
+
const storedCell = cells.get(key)
|
|
443
|
+
const existingId = storedCell?.entryIds[0] ?? null
|
|
444
|
+
const existingVersion = existingId ? storedCell?.entryVersions[existingId] ?? null : null
|
|
445
|
+
const errorMessage = t('staff.timesheets.my.errors.save', 'Failed to save timesheets.')
|
|
446
|
+
if (existingId && cell.minutes <= 0) {
|
|
447
|
+
await runMutation({
|
|
448
|
+
operation: () =>
|
|
449
|
+
withScopedApiRequestHeaders(buildOptimisticLockHeader(existingVersion), () =>
|
|
450
|
+
deleteCrud(ENTRIES_API_PATH, existingId, { errorMessage }),
|
|
451
|
+
),
|
|
452
|
+
context: mutationContext(existingId),
|
|
453
|
+
mutationPayload: { id: existingId },
|
|
454
|
+
})
|
|
455
|
+
continue
|
|
456
|
+
}
|
|
457
|
+
if (cell.minutes <= 0) continue
|
|
458
|
+
if (existingId) {
|
|
459
|
+
const payload = { id: existingId, durationMinutes: cell.minutes }
|
|
460
|
+
await runMutation({
|
|
461
|
+
operation: () =>
|
|
462
|
+
withScopedApiRequestHeaders(buildOptimisticLockHeader(existingVersion), () =>
|
|
463
|
+
updateCrud(ENTRIES_API_PATH, payload, { errorMessage }),
|
|
464
|
+
),
|
|
465
|
+
context: mutationContext(existingId),
|
|
466
|
+
mutationPayload: payload,
|
|
467
|
+
})
|
|
468
|
+
continue
|
|
469
|
+
}
|
|
470
|
+
const payload = {
|
|
471
|
+
staffMemberId,
|
|
472
|
+
date: cell.date,
|
|
473
|
+
timeProjectId: row.timeProjectId,
|
|
474
|
+
taskId: row.taskId,
|
|
475
|
+
durationMinutes: cell.minutes,
|
|
476
|
+
source: 'manual',
|
|
477
|
+
}
|
|
478
|
+
await runMutation({
|
|
479
|
+
operation: () => createCrud(ENTRIES_API_PATH, payload, { errorMessage }),
|
|
480
|
+
context: mutationContext(),
|
|
481
|
+
mutationPayload: payload,
|
|
482
|
+
})
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
[cells, mutationContext, runMutation, staffMemberId, t],
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
const handleSave = React.useCallback(async () => {
|
|
489
|
+
if (!hasChanges || invalidCount > 0) return
|
|
490
|
+
const confirmed = await confirm({
|
|
491
|
+
title: t('staff.timesheets.my.confirm_save.title', 'Save changes?'),
|
|
492
|
+
text: t('staff.timesheets.my.confirm_save.body', 'Your timesheet entries will be saved.'),
|
|
493
|
+
})
|
|
494
|
+
if (!confirmed) return
|
|
495
|
+
|
|
496
|
+
const bulkEntries: Array<{ id?: string; date: string; timeProjectId: string; durationMinutes: number }> = []
|
|
497
|
+
const taskChanges: Array<{ row: GridRow; cell: DirtyCell }> = []
|
|
498
|
+
for (const cell of Object.values(dirty)) {
|
|
499
|
+
const row = rowsByKey.get(cell.rowKey)
|
|
500
|
+
if (!row) continue
|
|
501
|
+
if (row.taskId) {
|
|
502
|
+
taskChanges.push({ row, cell })
|
|
503
|
+
continue
|
|
504
|
+
}
|
|
505
|
+
const key = cellKey(row.key, cell.date)
|
|
506
|
+
bulkEntries.push({
|
|
507
|
+
id: cells.get(key)?.entryIds[0],
|
|
508
|
+
date: cell.date,
|
|
509
|
+
timeProjectId: row.timeProjectId,
|
|
510
|
+
durationMinutes: cell.minutes,
|
|
511
|
+
})
|
|
512
|
+
}
|
|
513
|
+
if (bulkEntries.length === 0 && taskChanges.length === 0) return
|
|
514
|
+
|
|
515
|
+
setIsSaving(true)
|
|
516
|
+
try {
|
|
517
|
+
if (bulkEntries.length > 0) {
|
|
518
|
+
const payload = { entries: bulkEntries }
|
|
519
|
+
await runMutation({
|
|
520
|
+
operation: () =>
|
|
521
|
+
apiCallOrThrow(BULK_ENDPOINT, {
|
|
522
|
+
method: 'POST',
|
|
523
|
+
headers: { 'Content-Type': 'application/json' },
|
|
524
|
+
body: JSON.stringify(payload),
|
|
525
|
+
}),
|
|
526
|
+
context: mutationContext(staffMemberId ?? undefined),
|
|
527
|
+
mutationPayload: payload as unknown as Record<string, unknown>,
|
|
528
|
+
})
|
|
529
|
+
}
|
|
530
|
+
if (taskChanges.length > 0) await saveTaskCells(taskChanges)
|
|
531
|
+
setDirty({})
|
|
532
|
+
flash(t('staff.timesheets.my.saved', 'Timesheet saved.'), 'success')
|
|
533
|
+
await onSaved()
|
|
534
|
+
} catch (error) {
|
|
535
|
+
reportSaveFailure(error)
|
|
536
|
+
} finally {
|
|
537
|
+
setIsSaving(false)
|
|
538
|
+
}
|
|
539
|
+
}, [
|
|
540
|
+
cells,
|
|
541
|
+
confirm,
|
|
542
|
+
dirty,
|
|
543
|
+
hasChanges,
|
|
544
|
+
invalidCount,
|
|
545
|
+
mutationContext,
|
|
546
|
+
onSaved,
|
|
547
|
+
reportSaveFailure,
|
|
548
|
+
rowsByKey,
|
|
549
|
+
runMutation,
|
|
550
|
+
saveTaskCells,
|
|
551
|
+
staffMemberId,
|
|
552
|
+
t,
|
|
553
|
+
])
|
|
554
|
+
|
|
555
|
+
const taskRowOptions = React.useMemo(() => {
|
|
556
|
+
const visibleProjectIds = new Set(projects.map((project) => project.id))
|
|
557
|
+
const existing = new Set(rows.map((row) => row.key))
|
|
558
|
+
return tasks
|
|
559
|
+
.filter((task) => visibleProjectIds.has(task.timeProjectId))
|
|
560
|
+
.map((task) => {
|
|
561
|
+
const project = projects.find((candidate) => candidate.id === task.timeProjectId)!
|
|
562
|
+
return {
|
|
563
|
+
key: buildTargetKey(task.timeProjectId, task.id),
|
|
564
|
+
label: targetLabel({
|
|
565
|
+
key: buildTargetKey(task.timeProjectId, task.id),
|
|
566
|
+
timeProjectId: task.timeProjectId,
|
|
567
|
+
taskId: task.id,
|
|
568
|
+
projectName: project.name,
|
|
569
|
+
projectCode: project.code,
|
|
570
|
+
projectColor: project.color,
|
|
571
|
+
taskTitle: task.title,
|
|
572
|
+
}),
|
|
573
|
+
}
|
|
574
|
+
})
|
|
575
|
+
.filter((option) => !existing.has(option.key))
|
|
576
|
+
}, [projects, rows, tasks])
|
|
577
|
+
|
|
578
|
+
const editable = canManage && !readOnly
|
|
579
|
+
const loadingLabel = t('staff.time_tracking.timesheet.grid.loading', 'Loading the timesheet grid\u2026')
|
|
580
|
+
|
|
581
|
+
return (
|
|
582
|
+
<div className="flex flex-col gap-3">
|
|
583
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
584
|
+
<SegmentedControl
|
|
585
|
+
value={rowMode}
|
|
586
|
+
onValueChange={(value) => {
|
|
587
|
+
if (value !== rowMode) onRowModeChange(value as GridRowMode)
|
|
588
|
+
}}
|
|
589
|
+
size="sm"
|
|
590
|
+
aria-label={t('staff.time_tracking.timesheet.grid.rowMode.label', 'Grid rows')}
|
|
591
|
+
>
|
|
592
|
+
<SegmentedControlItem value="projects">
|
|
593
|
+
{t('staff.time_tracking.timesheet.grid.rowMode.projects', 'Projects')}
|
|
594
|
+
</SegmentedControlItem>
|
|
595
|
+
<SegmentedControlItem value="tasks">
|
|
596
|
+
{t('staff.time_tracking.timesheet.grid.rowMode.tasks', 'Projects + tasks')}
|
|
597
|
+
</SegmentedControlItem>
|
|
598
|
+
</SegmentedControl>
|
|
599
|
+
|
|
600
|
+
<div className="flex items-center gap-3">
|
|
601
|
+
{invalidCount > 0 ? (
|
|
602
|
+
<span className="text-xs font-medium text-status-error-text">
|
|
603
|
+
{t('staff.time_tracking.timesheet.grid.invalid', 'Fix the highlighted cell before saving.')}
|
|
604
|
+
</span>
|
|
605
|
+
) : hasChanges ? (
|
|
606
|
+
<span className="text-xs font-medium text-status-warning-text">
|
|
607
|
+
{t('staff.timesheets.my.unsaved', 'Unsaved changes')}
|
|
608
|
+
</span>
|
|
609
|
+
) : null}
|
|
610
|
+
{editable ? (
|
|
611
|
+
<Button
|
|
612
|
+
size="sm"
|
|
613
|
+
type="button"
|
|
614
|
+
onClick={() => void handleSave()}
|
|
615
|
+
disabled={!hasChanges || invalidCount > 0 || isSaving}
|
|
616
|
+
>
|
|
617
|
+
{isSaving
|
|
618
|
+
? t('staff.timesheets.my.saving', 'Saving...')
|
|
619
|
+
: t('staff.timesheets.my.save_changes', 'Save Changes')}
|
|
620
|
+
</Button>
|
|
621
|
+
) : null}
|
|
622
|
+
</div>
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
{rowMode === 'tasks' && editable && taskRowOptions.length > 0 ? (
|
|
626
|
+
<div className="flex items-center gap-2">
|
|
627
|
+
<Select
|
|
628
|
+
value=""
|
|
629
|
+
onValueChange={(value) => setExtraTaskKeys((current) => new Set(current).add(value))}
|
|
630
|
+
>
|
|
631
|
+
<SelectTrigger
|
|
632
|
+
className="w-72"
|
|
633
|
+
aria-label={t('staff.time_tracking.timesheet.grid.addTaskRow', 'Add a task row')}
|
|
634
|
+
>
|
|
635
|
+
<SelectValue placeholder={t('staff.time_tracking.timesheet.grid.addTaskRow', 'Add a task row')} />
|
|
636
|
+
</SelectTrigger>
|
|
637
|
+
<SelectContent>
|
|
638
|
+
{taskRowOptions.map((option) => (
|
|
639
|
+
<SelectItem key={option.key} value={option.key}>
|
|
640
|
+
{option.label}
|
|
641
|
+
</SelectItem>
|
|
642
|
+
))}
|
|
643
|
+
</SelectContent>
|
|
644
|
+
</Select>
|
|
645
|
+
</div>
|
|
646
|
+
) : null}
|
|
647
|
+
|
|
648
|
+
<div className="overflow-x-auto rounded-lg border">
|
|
649
|
+
<table className="w-full text-sm table-fixed" aria-busy={isLoading || undefined}>
|
|
650
|
+
<caption className="sr-only">
|
|
651
|
+
{t(
|
|
652
|
+
'staff.time_tracking.timesheet.grid.caption',
|
|
653
|
+
'Timesheet grid: one row per project or task, one column per day of the period.',
|
|
654
|
+
)}
|
|
655
|
+
</caption>
|
|
656
|
+
<colgroup>
|
|
657
|
+
<col className={dense ? 'w-[140px] min-w-[140px]' : 'w-[35%]'} />
|
|
658
|
+
{days.map((date) => (
|
|
659
|
+
<col key={date} className={dense ? 'w-[36px] min-w-[36px]' : ''} />
|
|
660
|
+
))}
|
|
661
|
+
<col className={dense ? 'w-[56px] min-w-[56px]' : 'w-[72px]'} />
|
|
662
|
+
</colgroup>
|
|
663
|
+
<thead>
|
|
664
|
+
<tr className="border-b bg-muted/50">
|
|
665
|
+
<th scope="col" className="sticky left-0 z-10 bg-muted px-3 py-2 text-left font-medium">
|
|
666
|
+
{t('staff.timesheets.my.project', 'Project')}
|
|
667
|
+
</th>
|
|
668
|
+
{days.map((date) => {
|
|
669
|
+
const { weekday, dayOfMonth } = dayHeaderParts(date)
|
|
670
|
+
const weekend = isWeekendIso(date)
|
|
671
|
+
// Weekends were signalled by a background tint alone, which a
|
|
672
|
+
// screen reader and a monochrome display both miss. The tint stays;
|
|
673
|
+
// the meaning now also travels as a title and an sr-only word.
|
|
674
|
+
const weekendLabel = t('staff.time_tracking.timesheet.grid.weekend', 'Weekend day')
|
|
675
|
+
return (
|
|
676
|
+
<th
|
|
677
|
+
scope="col"
|
|
678
|
+
key={date}
|
|
679
|
+
title={weekend ? `${date} · ${weekendLabel}` : date}
|
|
680
|
+
className={cn(
|
|
681
|
+
'py-2 text-center font-medium px-1',
|
|
682
|
+
weekend ? 'bg-muted/80 text-muted-foreground' : null,
|
|
683
|
+
)}
|
|
684
|
+
>
|
|
685
|
+
<div className="text-xs uppercase text-muted-foreground">{weekday}</div>
|
|
686
|
+
<div className="text-xs">{dayOfMonth}</div>
|
|
687
|
+
{weekend ? <span className="sr-only">{weekendLabel}</span> : null}
|
|
688
|
+
</th>
|
|
689
|
+
)
|
|
690
|
+
})}
|
|
691
|
+
<th scope="col" className="px-3 py-2 text-right font-medium">
|
|
692
|
+
{t('staff.timesheets.my.total', 'Total')}
|
|
693
|
+
</th>
|
|
694
|
+
</tr>
|
|
695
|
+
</thead>
|
|
696
|
+
<tbody>
|
|
697
|
+
{isLoading
|
|
698
|
+
? Array.from({ length: SKELETON_ROW_COUNT }).map((_, index) => (
|
|
699
|
+
<tr key={`grid-skeleton-${index}`} data-testid="grid-skeleton-row" className="border-b">
|
|
700
|
+
<th scope="row" className="sticky left-0 z-10 bg-background px-3 py-1.5 text-left font-medium">
|
|
701
|
+
{index === 0 ? <span className="sr-only">{loadingLabel}</span> : null}
|
|
702
|
+
<span aria-hidden="true" className="block h-4 w-32 animate-pulse rounded bg-muted" />
|
|
703
|
+
</th>
|
|
704
|
+
{days.map((date) => (
|
|
705
|
+
<td key={date} className="px-0.5 py-0.5">
|
|
706
|
+
<span
|
|
707
|
+
aria-hidden="true"
|
|
708
|
+
className={cn('mx-auto block h-6 animate-pulse rounded bg-muted', dense ? 'w-10' : 'w-16')}
|
|
709
|
+
/>
|
|
710
|
+
</td>
|
|
711
|
+
))}
|
|
712
|
+
<td className="px-3 py-1.5">
|
|
713
|
+
<span aria-hidden="true" className="ml-auto block h-4 w-8 animate-pulse rounded bg-muted" />
|
|
714
|
+
</td>
|
|
715
|
+
</tr>
|
|
716
|
+
))
|
|
717
|
+
: null}
|
|
718
|
+
{!isLoading && rows.length === 0 ? (
|
|
719
|
+
<tr data-testid="grid-empty-row" className="border-b">
|
|
720
|
+
<td colSpan={days.length + 2} className="px-3 py-10 text-center">
|
|
721
|
+
<p className="text-sm font-medium text-foreground">
|
|
722
|
+
{t('staff.time_tracking.timesheet.grid.empty.title', 'This grid has no rows yet')}
|
|
723
|
+
</p>
|
|
724
|
+
<p className="mt-1 text-sm text-muted-foreground">
|
|
725
|
+
{t(
|
|
726
|
+
'staff.time_tracking.timesheet.grid.noRows',
|
|
727
|
+
'Add a project row to start filling the grid.',
|
|
728
|
+
)}
|
|
729
|
+
</p>
|
|
730
|
+
</td>
|
|
731
|
+
</tr>
|
|
732
|
+
) : null}
|
|
733
|
+
{isLoading ? null : rows.map((row) => (
|
|
734
|
+
<tr key={row.key} className="group border-b hover:bg-muted/30">
|
|
735
|
+
<th
|
|
736
|
+
scope="row"
|
|
737
|
+
className={cn(
|
|
738
|
+
'sticky left-0 z-10 bg-background px-3 py-1.5 text-left font-medium text-foreground',
|
|
739
|
+
row.taskId ? 'pl-6' : null,
|
|
740
|
+
)}
|
|
741
|
+
>
|
|
742
|
+
<div className="flex items-center justify-between gap-2">
|
|
743
|
+
<div className="min-w-0 flex-1">
|
|
744
|
+
<div className="flex items-center gap-1.5 truncate" title={targetLabel(row)}>
|
|
745
|
+
{row.taskId ? null : (
|
|
746
|
+
<ProjectColorDot colorKey={row.projectColor} projectName={row.projectName} size="sm" />
|
|
747
|
+
)}
|
|
748
|
+
<span className="truncate">{row.taskId ? row.taskTitle ?? targetLabel(row) : row.projectName}</span>
|
|
749
|
+
</div>
|
|
750
|
+
{row.taskId ? (
|
|
751
|
+
<div className="text-xs text-muted-foreground truncate">{row.projectName}</div>
|
|
752
|
+
) : row.projectCode ? (
|
|
753
|
+
<div className="text-xs text-muted-foreground">{row.projectCode}</div>
|
|
754
|
+
) : null}
|
|
755
|
+
</div>
|
|
756
|
+
{row.removable && editable ? (
|
|
757
|
+
<button
|
|
758
|
+
type="button"
|
|
759
|
+
onClick={() => {
|
|
760
|
+
const project = projects.find((candidate) => candidate.id === row.timeProjectId)
|
|
761
|
+
if (!project) return
|
|
762
|
+
// Drop the row's pending errors with the row. An invalid
|
|
763
|
+
// cell left behind keeps Save blocked over a row that is
|
|
764
|
+
// no longer on screen, so the reader cannot reach the
|
|
765
|
+
// thing they are being told to fix.
|
|
766
|
+
setInvalidCells((current) => {
|
|
767
|
+
const prefix = cellKey(row.key, '')
|
|
768
|
+
const next = Object.fromEntries(
|
|
769
|
+
Object.entries(current).filter(([key]) => !key.startsWith(prefix)),
|
|
770
|
+
) as Record<string, true>
|
|
771
|
+
return Object.keys(next).length === Object.keys(current).length ? current : next
|
|
772
|
+
})
|
|
773
|
+
setDirty((current) => {
|
|
774
|
+
const prefix = cellKey(row.key, '')
|
|
775
|
+
const next = Object.fromEntries(
|
|
776
|
+
Object.entries(current).filter(([key]) => !key.startsWith(prefix)),
|
|
777
|
+
) as typeof current
|
|
778
|
+
return Object.keys(next).length === Object.keys(current).length ? current : next
|
|
779
|
+
})
|
|
780
|
+
void onRemoveProject(project)
|
|
781
|
+
}}
|
|
782
|
+
aria-label={t('staff.timesheets.my.removeRow', 'Remove from grid')}
|
|
783
|
+
title={t('staff.timesheets.my.removeRow', 'Remove from grid')}
|
|
784
|
+
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"
|
|
785
|
+
>
|
|
786
|
+
<X className="size-3.5" />
|
|
787
|
+
</button>
|
|
788
|
+
) : null}
|
|
789
|
+
</div>
|
|
790
|
+
</th>
|
|
791
|
+
{days.map((date) => {
|
|
792
|
+
const key = cellKey(row.key, date)
|
|
793
|
+
const weekend = isWeekendIso(date)
|
|
794
|
+
const minutes = cellMinutes(key)
|
|
795
|
+
const locked = isCellLocked(key)
|
|
796
|
+
const isDirty = dirty[key] !== undefined
|
|
797
|
+
const isInvalid = Boolean(invalidCells[key])
|
|
798
|
+
return (
|
|
799
|
+
<td
|
|
800
|
+
key={date}
|
|
801
|
+
className={cn(
|
|
802
|
+
'px-0.5 py-0.5',
|
|
803
|
+
weekend ? 'bg-muted/40' : null,
|
|
804
|
+
// The old grid tinted the input itself amber; the border and
|
|
805
|
+
// background of a `DurationInput` belong to the primitive, so
|
|
806
|
+
// the pending-edit cue moved to the cell — same signal, DS
|
|
807
|
+
// status tokens instead of raw `amber-*` (Boy Scout rule).
|
|
808
|
+
isInvalid
|
|
809
|
+
? 'bg-status-error-bg'
|
|
810
|
+
: isDirty
|
|
811
|
+
? 'bg-status-warning-bg'
|
|
812
|
+
: null,
|
|
813
|
+
)}
|
|
814
|
+
>
|
|
815
|
+
{weekend && minutes === 0 ? (
|
|
816
|
+
<div className="rounded px-1 py-1 text-center text-xs text-muted-foreground/50">-</div>
|
|
817
|
+
) : locked || !editable ? (
|
|
818
|
+
<div
|
|
819
|
+
className="flex items-center justify-center gap-1 rounded px-1 py-1 text-center text-xs tabular-nums text-muted-foreground"
|
|
820
|
+
title={
|
|
821
|
+
locked
|
|
822
|
+
? t(
|
|
823
|
+
'staff.time_tracking.timesheet.grid.lockedCell',
|
|
824
|
+
'Locked by a closed report',
|
|
825
|
+
)
|
|
826
|
+
: undefined
|
|
827
|
+
}
|
|
828
|
+
>
|
|
829
|
+
{locked ? <Lock className="size-3 shrink-0" aria-hidden="true" /> : null}
|
|
830
|
+
<span>{formatTrimmedDecimalDuration(minutes) || '-'}</span>
|
|
831
|
+
</div>
|
|
832
|
+
) : (
|
|
833
|
+
<DurationInput
|
|
834
|
+
variant="compact"
|
|
835
|
+
inputSize="sm"
|
|
836
|
+
value={minutes > 0 ? minutes : null}
|
|
837
|
+
formatValue={formatTrimmedDecimalDuration}
|
|
838
|
+
onChange={(nextMinutes, state) =>
|
|
839
|
+
handleCellChange(row, date, nextMinutes, state.status === 'invalid')
|
|
840
|
+
}
|
|
841
|
+
placeholder={t('staff.timesheets.my.durationPlaceholder', '0')}
|
|
842
|
+
ariaLabel={`${targetLabel(row)} · ${date}`}
|
|
843
|
+
className={cn('mx-auto', dense ? 'w-10' : 'w-16')}
|
|
844
|
+
inputClassName={cn(
|
|
845
|
+
'text-center px-1 tabular-nums',
|
|
846
|
+
dense ? 'text-xs' : null,
|
|
847
|
+
minutes > 0 ? 'font-semibold' : 'text-muted-foreground',
|
|
848
|
+
)}
|
|
849
|
+
/>
|
|
850
|
+
)}
|
|
851
|
+
</td>
|
|
852
|
+
)
|
|
853
|
+
})}
|
|
854
|
+
<td className="px-3 py-1.5 text-right font-semibold text-xs tabular-nums">
|
|
855
|
+
{formatTrimmedDecimalDuration(rowTotal(row.key)) || '0'}
|
|
856
|
+
</td>
|
|
857
|
+
</tr>
|
|
858
|
+
))}
|
|
859
|
+
{editable && !isLoading ? (
|
|
860
|
+
<tr className="border-b">
|
|
861
|
+
<td colSpan={days.length + 2} className="sticky left-0 bg-background px-1 py-0.5">
|
|
862
|
+
<AddRowDropdown
|
|
863
|
+
assignedProjects={allAssignedProjects.map((project) => ({
|
|
864
|
+
id: project.id,
|
|
865
|
+
name: project.name,
|
|
866
|
+
code: project.code,
|
|
867
|
+
color: project.color,
|
|
868
|
+
}))}
|
|
869
|
+
visibleProjectIds={new Set(projects.map((project) => project.id))}
|
|
870
|
+
canCreateProject={canManageProjects}
|
|
871
|
+
onAddProject={(project) => {
|
|
872
|
+
void onAddProject({
|
|
873
|
+
id: project.id,
|
|
874
|
+
name: project.name,
|
|
875
|
+
code: project.code ?? null,
|
|
876
|
+
color: project.color ?? null,
|
|
877
|
+
})
|
|
878
|
+
}}
|
|
879
|
+
onCreateProject={onCreateProject}
|
|
880
|
+
/>
|
|
881
|
+
</td>
|
|
882
|
+
</tr>
|
|
883
|
+
) : null}
|
|
884
|
+
</tbody>
|
|
885
|
+
<tfoot>
|
|
886
|
+
<tr className="border-t bg-muted/50 font-semibold">
|
|
887
|
+
<th scope="row" className="sticky left-0 z-10 bg-muted px-3 py-2 text-left">
|
|
888
|
+
{t('staff.timesheets.my.daily_total', 'Daily Total')}
|
|
889
|
+
</th>
|
|
890
|
+
{days.map((date) => {
|
|
891
|
+
const weekend = isWeekendIso(date)
|
|
892
|
+
const minutes = dayTotal(date)
|
|
893
|
+
return (
|
|
894
|
+
<td
|
|
895
|
+
key={date}
|
|
896
|
+
className={cn(
|
|
897
|
+
'py-2 text-center text-xs tabular-nums',
|
|
898
|
+
weekend ? 'text-muted-foreground/50' : null,
|
|
899
|
+
)}
|
|
900
|
+
>
|
|
901
|
+
{weekend && minutes === 0 ? '-' : formatTrimmedDecimalDuration(minutes) || '-'}
|
|
902
|
+
</td>
|
|
903
|
+
)
|
|
904
|
+
})}
|
|
905
|
+
<td className="px-3 py-2 text-right tabular-nums font-semibold">
|
|
906
|
+
{formatTrimmedDecimalDuration(grandTotal) || '0'}
|
|
907
|
+
</td>
|
|
908
|
+
</tr>
|
|
909
|
+
</tfoot>
|
|
910
|
+
</table>
|
|
911
|
+
</div>
|
|
912
|
+
|
|
913
|
+
{ConfirmDialogElement}
|
|
914
|
+
</div>
|
|
915
|
+
)
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
const gridViewPropsSchema: z.ZodType<GridViewProps> = z.object({
|
|
919
|
+
days: z.array(z.string()),
|
|
920
|
+
projects: z.array(opaqueProp<TimesheetProjectRef>()),
|
|
921
|
+
allAssignedProjects: z.array(opaqueProp<TimesheetProjectRef>()),
|
|
922
|
+
tasks: z.array(opaqueProp<TimesheetTaskRef>()),
|
|
923
|
+
entries: z.array(opaqueProp<TimesheetEntry>()),
|
|
924
|
+
staffMemberId: z.string().nullable(),
|
|
925
|
+
canManage: z.boolean(),
|
|
926
|
+
canManageProjects: z.boolean(),
|
|
927
|
+
readOnly: z.boolean(),
|
|
928
|
+
isLoading: z.boolean().optional(),
|
|
929
|
+
rowMode: z.union([z.literal('projects'), z.literal('tasks')]),
|
|
930
|
+
onRowModeChange: callbackProp<(mode: GridRowMode) => void>(),
|
|
931
|
+
onAddProject: callbackProp<(project: TimesheetProjectRef) => void | Promise<void>>(),
|
|
932
|
+
onRemoveProject: callbackProp<(project: TimesheetProjectRef) => void | Promise<void>>(),
|
|
933
|
+
onCreateProject: callbackProp<() => void>(),
|
|
934
|
+
onSaved: callbackProp<() => void | Promise<void>>(),
|
|
935
|
+
})
|
|
936
|
+
|
|
937
|
+
registerComponent<GridViewProps>({
|
|
938
|
+
id: extensionPoints.hosts.timesheetGridComponent.componentId,
|
|
939
|
+
component: DefaultGridView,
|
|
940
|
+
metadata: {
|
|
941
|
+
module: 'staff',
|
|
942
|
+
description: 'Timesheet grid view — projects/tasks by day, editable cells.',
|
|
943
|
+
propsSchema: gridViewPropsSchema,
|
|
944
|
+
},
|
|
945
|
+
})
|
|
946
|
+
|
|
947
|
+
export function GridView(props: GridViewProps) {
|
|
948
|
+
const Resolved = useRegisteredComponent<GridViewProps>(
|
|
949
|
+
extensionPoints.hosts.timesheetGridComponent.componentId,
|
|
950
|
+
DefaultGridView,
|
|
951
|
+
)
|
|
952
|
+
return <Resolved {...props} />
|
|
953
|
+
}
|