@open-mercato/core 0.6.4-develop.4210.1.d412061cfe → 0.6.4-develop.4236.1.9fa6806b34
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 +37 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_entry_segment/index.js +23 -0
- package/dist/generated/entities/staff_time_entry_segment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +35 -0
- package/dist/generated/entities/staff_time_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project_member/index.js +29 -0
- package/dist/generated/entities/staff_time_project_member/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +5 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +64 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +50 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +7 -0
- package/dist/modules/attachments/api/library/[id]/route.js +20 -16
- package/dist/modules/attachments/api/library/[id]/route.js.map +2 -2
- package/dist/modules/attachments/api/route.js +18 -14
- package/dist/modules/attachments/api/route.js.map +2 -2
- package/dist/modules/auth/api/roles/acl/route.js +10 -4
- package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
- package/dist/modules/auth/api/sidebar/preferences/route.js +27 -20
- package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
- package/dist/modules/auth/api/users/acl/route.js +16 -11
- package/dist/modules/auth/api/users/acl/route.js.map +2 -2
- package/dist/modules/auth/commands/users.js +87 -71
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/services/sidebarPreferencesService.js +39 -30
- package/dist/modules/auth/services/sidebarPreferencesService.js.map +2 -2
- package/dist/modules/catalog/commands/categories.js +61 -12
- package/dist/modules/catalog/commands/categories.js.map +2 -2
- package/dist/modules/catalog/commands/products.js +79 -54
- package/dist/modules/catalog/commands/products.js.map +2 -2
- package/dist/modules/catalog/commands/variants.js +29 -16
- package/dist/modules/catalog/commands/variants.js.map +2 -2
- package/dist/modules/currencies/commands/currencies.js +15 -8
- package/dist/modules/currencies/commands/currencies.js.map +2 -2
- package/dist/modules/customer_accounts/api/admin/users.js +27 -26
- package/dist/modules/customer_accounts/api/admin/users.js.map +2 -2
- package/dist/modules/customer_accounts/api/password/reset-confirm.js +5 -5
- package/dist/modules/customer_accounts/api/password/reset-confirm.js.map +2 -2
- package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js +11 -10
- package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js.map +2 -2
- package/dist/modules/customers/commands/addresses.js +35 -21
- package/dist/modules/customers/commands/addresses.js.map +2 -2
- package/dist/modules/customers/commands/companies.js +163 -162
- package/dist/modules/customers/commands/companies.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +3 -4
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js +19 -22
- package/dist/modules/customers/commands/interactions.js.map +2 -2
- package/dist/modules/customers/commands/people.js +18 -15
- package/dist/modules/customers/commands/people.js.map +2 -2
- package/dist/modules/customers/commands/personCompanyLinks.js +105 -94
- package/dist/modules/customers/commands/personCompanyLinks.js.map +2 -2
- package/dist/modules/customers/commands/pipeline-stages.js +30 -23
- package/dist/modules/customers/commands/pipeline-stages.js.map +2 -2
- package/dist/modules/customers/commands/pipelines.js +27 -20
- package/dist/modules/customers/commands/pipelines.js.map +2 -2
- package/dist/modules/customers/commands/tags.js +13 -5
- package/dist/modules/customers/commands/tags.js.map +2 -2
- package/dist/modules/dashboards/api/users/widgets/route.js +0 -1
- package/dist/modules/dashboards/api/users/widgets/route.js.map +2 -2
- package/dist/modules/dashboards/api/widgets/data/route.js +29 -1
- package/dist/modules/dashboards/api/widgets/data/route.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js +4 -4
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-run-service.js +51 -27
- package/dist/modules/data_sync/lib/sync-run-service.js.map +2 -2
- package/dist/modules/directory/commands/organizations.js +192 -158
- package/dist/modules/directory/commands/organizations.js.map +3 -3
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js +22 -16
- package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js.map +2 -2
- package/dist/modules/messages/commands/messages.js +77 -75
- package/dist/modules/messages/commands/messages.js.map +2 -2
- package/dist/modules/messages/commands/shared.js +132 -132
- package/dist/modules/messages/commands/shared.js.map +2 -2
- package/dist/modules/perspectives/api/[tableId]/route.js +37 -26
- package/dist/modules/perspectives/api/[tableId]/route.js.map +2 -2
- package/dist/modules/resources/commands/resources.js +125 -117
- package/dist/modules/resources/commands/resources.js.map +2 -2
- package/dist/modules/resources/commands/tags.js +7 -3
- package/dist/modules/resources/commands/tags.js.map +2 -2
- package/dist/modules/sales/api/quotes/send/route.js +12 -11
- package/dist/modules/sales/api/quotes/send/route.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +629 -478
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/payments.js +146 -146
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/commands/returns.js +68 -60
- package/dist/modules/sales/commands/returns.js.map +2 -2
- package/dist/modules/staff/acl.js +10 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/analytics.js +33 -0
- package/dist/modules/staff/analytics.js.map +7 -0
- package/dist/modules/staff/api/guards.js +31 -0
- package/dist/modules/staff/api/guards.js.map +7 -0
- package/dist/modules/staff/api/interceptors.js +96 -0
- package/dist/modules/staff/api/interceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +170 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/route.js +103 -0
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +147 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +171 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +180 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +155 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +173 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +260 -0
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +188 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +159 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/route.js +230 -0
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +710 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +22 -0
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +125 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +418 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +79 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +602 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +25 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +123 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/cli.js +38 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +2 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/leave-requests.js +30 -28
- package/dist/modules/staff/commands/leave-requests.js.map +3 -3
- package/dist/modules/staff/commands/team-members.js +21 -20
- package/dist/modules/staff/commands/team-members.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +409 -0
- package/dist/modules/staff/commands/timesheets-entries.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-projects.js +618 -0
- package/dist/modules/staff/commands/timesheets-projects.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +104 -0
- package/dist/modules/staff/data/enrichers.js.map +7 -0
- package/dist/modules/staff/data/entities.js +226 -1
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/validators.js +113 -1
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/events.js +13 -1
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/lib/crud.js +7 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/staffMemberResolver.js +15 -0
- package/dist/modules/staff/lib/staffMemberResolver.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.js +60 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectsKpis.js +260 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectsKpis.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/dateBuckets.js +41 -0
- package/dist/modules/staff/lib/timesheets-projects/dateBuckets.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/initials.js +10 -0
- package/dist/modules/staff/lib/timesheets-projects/initials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/kpiMath.js +12 -0
- package/dist/modules/staff/lib/timesheets-projects/kpiMath.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/listProjectMembersPreview.js +55 -0
- package/dist/modules/staff/lib/timesheets-projects/listProjectMembersPreview.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/HoursSparkline.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/HoursSparkline.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.js +58 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.js +152 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js +37 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.js +57 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.js +50 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/AddRowDropdown.js +163 -0
- package/dist/modules/staff/lib/timesheets-ui/AddRowDropdown.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js +209 -0
- package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ColorPicker.js +52 -0
- package/dist/modules/staff/lib/timesheets-ui/ColorPicker.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +77 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +173 -0
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ProjectColorDot.js +32 -0
- package/dist/modules/staff/lib/timesheets-ui/ProjectColorDot.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +270 -0
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ViewSwitcher.js +57 -0
- package/dist/modules/staff/lib/timesheets-ui/ViewSwitcher.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/colors.js +43 -0
- package/dist/modules/staff/lib/timesheets-ui/colors.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260326135612.js +24 -0
- package/dist/modules/staff/migrations/Migration20260326135612.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260413102715.js +23 -0
- package/dist/modules/staff/migrations/Migration20260413102715.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260413111602.js +13 -0
- package/dist/modules/staff/migrations/Migration20260413111602.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260511112759.js +19 -0
- package/dist/modules/staff/migrations/Migration20260511112759.js.map +7 -0
- package/dist/modules/staff/search.js +35 -0
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +15 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.js +16 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js +126 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.js +26 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/config.js +15 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/config.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js +238 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js.map +7 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.js +26 -0
- package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +145 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +7 -0
- package/dist/modules/staff/widgets/injection-table.js +12 -0
- package/dist/modules/staff/widgets/injection-table.js.map +7 -0
- package/dist/modules/sync_excel/api/import/route.js +19 -17
- package/dist/modules/sync_excel/api/import/route.js.map +2 -2
- package/dist/modules/translations/commands/translations.js +22 -19
- package/dist/modules/translations/commands/translations.js.map +2 -2
- package/generated/entities/staff_time_entry/index.ts +17 -0
- package/generated/entities/staff_time_entry_segment/index.ts +10 -0
- package/generated/entities/staff_time_project/index.ts +16 -0
- package/generated/entities/staff_time_project_member/index.ts +13 -0
- package/generated/entities.ids.generated.ts +5 -1
- package/generated/entity-fields-registry.ts +64 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +61 -0
- package/src/modules/attachments/api/library/[id]/route.ts +24 -17
- package/src/modules/attachments/api/route.ts +20 -14
- package/src/modules/auth/api/roles/acl/route.ts +11 -5
- package/src/modules/auth/api/sidebar/preferences/route.ts +33 -24
- package/src/modules/auth/api/users/acl/route.ts +17 -12
- package/src/modules/auth/commands/users.ts +96 -80
- package/src/modules/auth/services/sidebarPreferencesService.ts +40 -32
- package/src/modules/catalog/commands/categories.ts +61 -12
- package/src/modules/catalog/commands/products.ts +93 -60
- package/src/modules/catalog/commands/variants.ts +29 -16
- package/src/modules/currencies/commands/currencies.ts +27 -14
- package/src/modules/customer_accounts/api/admin/users.ts +31 -26
- package/src/modules/customer_accounts/api/password/reset-confirm.ts +5 -6
- package/src/modules/customer_accounts/api/portal/users/[id]/roles.ts +14 -13
- package/src/modules/customers/commands/addresses.ts +35 -23
- package/src/modules/customers/commands/companies.ts +166 -165
- package/src/modules/customers/commands/deals.ts +2 -4
- package/src/modules/customers/commands/interactions.ts +20 -26
- package/src/modules/customers/commands/people.ts +18 -15
- package/src/modules/customers/commands/personCompanyLinks.ts +109 -100
- package/src/modules/customers/commands/pipeline-stages.ts +31 -27
- package/src/modules/customers/commands/pipelines.ts +29 -23
- package/src/modules/customers/commands/tags.ts +13 -5
- package/src/modules/dashboards/api/users/widgets/route.ts +0 -1
- package/src/modules/dashboards/api/widgets/data/route.ts +36 -1
- package/src/modules/data_sync/lib/sync-engine.ts +4 -5
- package/src/modules/data_sync/lib/sync-run-service.ts +57 -28
- package/src/modules/directory/commands/organizations.ts +203 -166
- package/src/modules/inbox_ops/api/emails/[id]/reprocess/route.ts +26 -18
- package/src/modules/messages/commands/messages.ts +82 -80
- package/src/modules/messages/commands/shared.ts +138 -133
- package/src/modules/perspectives/api/[tableId]/route.ts +38 -27
- package/src/modules/resources/commands/resources.ts +127 -117
- package/src/modules/resources/commands/tags.ts +7 -3
- package/src/modules/sales/api/quotes/send/route.ts +17 -12
- package/src/modules/sales/commands/documents.ts +673 -481
- package/src/modules/sales/commands/payments.ts +158 -152
- package/src/modules/sales/commands/returns.ts +74 -63
- package/src/modules/staff/acl.ts +11 -0
- package/src/modules/staff/analytics.ts +30 -0
- package/src/modules/staff/api/guards.ts +59 -0
- package/src/modules/staff/api/interceptors.ts +122 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +191 -0
- package/src/modules/staff/api/timesheets/my-projects/route.ts +115 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +159 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +187 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +191 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +168 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +191 -0
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +292 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +193 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +167 -0
- package/src/modules/staff/api/timesheets/time-projects/route.ts +244 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +20 -0
- package/src/modules/staff/backend/staff/timesheets/page.tsx +899 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +141 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +579 -0
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +90 -0
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +23 -0
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +765 -0
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +138 -0
- package/src/modules/staff/cli.ts +40 -1
- package/src/modules/staff/commands/index.ts +2 -0
- package/src/modules/staff/commands/leave-requests.ts +37 -29
- package/src/modules/staff/commands/team-members.ts +25 -20
- package/src/modules/staff/commands/timesheets-entries.ts +504 -0
- package/src/modules/staff/commands/timesheets-projects.ts +699 -0
- package/src/modules/staff/data/enrichers.ts +134 -0
- package/src/modules/staff/data/entities.ts +198 -0
- package/src/modules/staff/data/validators.ts +129 -0
- package/src/modules/staff/events.ts +13 -0
- package/src/modules/staff/i18n/de.json +209 -1
- package/src/modules/staff/i18n/en.json +209 -1
- package/src/modules/staff/i18n/es.json +209 -1
- package/src/modules/staff/i18n/pl.json +209 -1
- package/src/modules/staff/lib/crud.ts +8 -0
- package/src/modules/staff/lib/staffMemberResolver.ts +22 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.ts +89 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectsKpis.ts +311 -0
- package/src/modules/staff/lib/timesheets-projects/dateBuckets.ts +37 -0
- package/src/modules/staff/lib/timesheets-projects/initials.ts +6 -0
- package/src/modules/staff/lib/timesheets-projects/kpiMath.ts +8 -0
- package/src/modules/staff/lib/timesheets-projects/listProjectMembersPreview.ts +83 -0
- package/src/modules/staff/lib/timesheets-projects-ui/HoursSparkline.tsx +75 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +110 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.tsx +73 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.tsx +185 -0
- package/src/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.tsx +53 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.tsx +63 -0
- package/src/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.ts +63 -0
- package/src/modules/staff/lib/timesheets-ui/AddRowDropdown.tsx +188 -0
- package/src/modules/staff/lib/timesheets-ui/CalendarPicker.tsx +229 -0
- package/src/modules/staff/lib/timesheets-ui/ColorPicker.tsx +65 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +99 -0
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +230 -0
- package/src/modules/staff/lib/timesheets-ui/ProjectColorDot.tsx +40 -0
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +327 -0
- package/src/modules/staff/lib/timesheets-ui/ViewSwitcher.tsx +60 -0
- package/src/modules/staff/lib/timesheets-ui/colors.ts +58 -0
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +1148 -0
- package/src/modules/staff/migrations/Migration20260326135612.ts +26 -0
- package/src/modules/staff/migrations/Migration20260413102715.ts +25 -0
- package/src/modules/staff/migrations/Migration20260413111602.ts +13 -0
- package/src/modules/staff/migrations/Migration20260511112759.ts +21 -0
- package/src/modules/staff/search.ts +35 -0
- package/src/modules/staff/setup.ts +15 -0
- package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.ts +17 -0
- package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.tsx +158 -0
- package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.ts +25 -0
- package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/config.ts +15 -0
- package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.tsx +297 -0
- package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.ts +25 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +161 -0
- package/src/modules/staff/widgets/injection-table.ts +10 -0
- package/src/modules/sync_excel/api/import/route.ts +23 -18
- package/src/modules/translations/commands/translations.ts +49 -41
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
2
|
+
import type { AwilixContainer } from 'awilix'
|
|
3
|
+
import type { ResponseEnricher, EnricherContext } from '@open-mercato/shared/lib/crud/response-enricher'
|
|
4
|
+
import type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'
|
|
5
|
+
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
6
|
+
import { StaffTeamMember } from './entities'
|
|
7
|
+
import { computeProjectHoursTrend } from '../lib/timesheets-projects/computeProjectHoursTrend'
|
|
8
|
+
import {
|
|
9
|
+
listProjectMembersPreview,
|
|
10
|
+
type MemberPreview,
|
|
11
|
+
} from '../lib/timesheets-projects/listProjectMembersPreview'
|
|
12
|
+
|
|
13
|
+
const MANAGE_FEATURE = 'staff.timesheets.projects.manage'
|
|
14
|
+
|
|
15
|
+
type EntityRecord = Record<string, unknown> & { id: string }
|
|
16
|
+
|
|
17
|
+
type StaffEnrichment = {
|
|
18
|
+
_staff: {
|
|
19
|
+
hoursWeek: number
|
|
20
|
+
hoursTrend: number[]
|
|
21
|
+
myRole: string | null
|
|
22
|
+
members?: MemberPreview[]
|
|
23
|
+
memberCount?: number
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const FALLBACK: StaffEnrichment = {
|
|
28
|
+
_staff: {
|
|
29
|
+
hoursWeek: 0,
|
|
30
|
+
hoursTrend: [0, 0, 0, 0, 0, 0, 0],
|
|
31
|
+
myRole: null,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type InternalContext = EnricherContext & {
|
|
36
|
+
em: EntityManager
|
|
37
|
+
container: AwilixContainer
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function callerHasManage(ctx: InternalContext): Promise<boolean> {
|
|
41
|
+
if (ctx.userFeatures?.includes(MANAGE_FEATURE)) return true
|
|
42
|
+
try {
|
|
43
|
+
const rbac = ctx.container.resolve('rbacService') as RbacService
|
|
44
|
+
return await rbac.userHasAllFeatures(ctx.userId, [MANAGE_FEATURE], {
|
|
45
|
+
tenantId: ctx.tenantId,
|
|
46
|
+
organizationId: ctx.organizationId,
|
|
47
|
+
})
|
|
48
|
+
} catch {
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function resolveCallerStaffMemberId(ctx: InternalContext): Promise<string | null> {
|
|
54
|
+
const member = await findOneWithDecryption(
|
|
55
|
+
ctx.em.fork(),
|
|
56
|
+
StaffTeamMember,
|
|
57
|
+
{
|
|
58
|
+
userId: ctx.userId,
|
|
59
|
+
tenantId: ctx.tenantId,
|
|
60
|
+
organizationId: ctx.organizationId,
|
|
61
|
+
deletedAt: null,
|
|
62
|
+
},
|
|
63
|
+
{},
|
|
64
|
+
{ tenantId: ctx.tenantId, organizationId: ctx.organizationId },
|
|
65
|
+
)
|
|
66
|
+
return member?.id ?? null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const portfolioEnricher: ResponseEnricher<EntityRecord, StaffEnrichment> = {
|
|
70
|
+
id: 'staff.timesheets-projects-portfolio',
|
|
71
|
+
targetEntity: 'staff:staff_time_project',
|
|
72
|
+
// ACL is enforced by the route (`requireFeatures: ['staff.timesheets.projects.view']`).
|
|
73
|
+
// Per-field gating (e.g. `members` for manage-only) happens inline below via rbacService.
|
|
74
|
+
priority: 10,
|
|
75
|
+
timeout: 3000,
|
|
76
|
+
critical: false,
|
|
77
|
+
fallback: FALLBACK,
|
|
78
|
+
|
|
79
|
+
async enrichOne(record, context) {
|
|
80
|
+
const enriched = await this.enrichMany!([record], context)
|
|
81
|
+
return enriched[0]
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
async enrichMany(records, context) {
|
|
85
|
+
if (records.length === 0) return records as (EntityRecord & StaffEnrichment)[]
|
|
86
|
+
|
|
87
|
+
const ctx = context as InternalContext
|
|
88
|
+
const projectIds = records.map((r) => r.id)
|
|
89
|
+
|
|
90
|
+
const [callerStaffMemberId, hasManage] = await Promise.all([
|
|
91
|
+
resolveCallerStaffMemberId(ctx),
|
|
92
|
+
callerHasManage(ctx),
|
|
93
|
+
])
|
|
94
|
+
|
|
95
|
+
const [trendMap, membersMap] = await Promise.all([
|
|
96
|
+
computeProjectHoursTrend({
|
|
97
|
+
em: ctx.em,
|
|
98
|
+
tenantId: ctx.tenantId,
|
|
99
|
+
organizationId: ctx.organizationId,
|
|
100
|
+
projectIds,
|
|
101
|
+
staffMemberId: hasManage ? null : callerStaffMemberId,
|
|
102
|
+
}),
|
|
103
|
+
listProjectMembersPreview({
|
|
104
|
+
em: ctx.em,
|
|
105
|
+
tenantId: ctx.tenantId,
|
|
106
|
+
organizationId: ctx.organizationId,
|
|
107
|
+
projectIds,
|
|
108
|
+
callerStaffMemberId,
|
|
109
|
+
}),
|
|
110
|
+
])
|
|
111
|
+
|
|
112
|
+
return records.map((record) => {
|
|
113
|
+
const trend = trendMap.get(record.id) ?? {
|
|
114
|
+
hoursWeek: 0,
|
|
115
|
+
hoursTrend: [0, 0, 0, 0, 0, 0, 0],
|
|
116
|
+
}
|
|
117
|
+
const members = membersMap.get(record.id)
|
|
118
|
+
const enrichment: StaffEnrichment['_staff'] = {
|
|
119
|
+
hoursWeek: trend.hoursWeek,
|
|
120
|
+
hoursTrend: trend.hoursTrend,
|
|
121
|
+
myRole: members?.myRole ?? null,
|
|
122
|
+
}
|
|
123
|
+
if (hasManage && members) {
|
|
124
|
+
enrichment.members = members.preview
|
|
125
|
+
enrichment.memberCount = members.total
|
|
126
|
+
}
|
|
127
|
+
return { ...record, _staff: enrichment }
|
|
128
|
+
})
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const enrichers: ResponseEnricher[] = [portfolioEnricher]
|
|
133
|
+
|
|
134
|
+
export default enrichers
|
|
@@ -362,3 +362,201 @@ export class StaffTeamMemberAddress {
|
|
|
362
362
|
@ManyToOne(() => StaffTeamMember, { fieldName: 'member_id' })
|
|
363
363
|
member!: StaffTeamMember
|
|
364
364
|
}
|
|
365
|
+
|
|
366
|
+
// --- Timesheets entities (Phase 1) ---
|
|
367
|
+
|
|
368
|
+
export type StaffTimeEntrySource = 'manual' | 'timer' | 'kiosk' | 'mobile'
|
|
369
|
+
export type StaffTimeProjectStatus = 'active' | 'on_hold' | 'completed'
|
|
370
|
+
export type StaffTimeProjectMemberStatus = 'active' | 'inactive'
|
|
371
|
+
export type StaffTimeEntrySegmentType = 'work' | 'break'
|
|
372
|
+
|
|
373
|
+
@Entity({ tableName: 'staff_time_entries' })
|
|
374
|
+
@Index({ name: 'staff_time_entries_tenant_org_idx', properties: ['tenantId', 'organizationId'] })
|
|
375
|
+
@Index({ name: 'staff_time_entries_member_date_idx', properties: ['organizationId', 'staffMemberId', 'date'] })
|
|
376
|
+
@Index({ name: 'staff_time_entries_project_date_idx', properties: ['organizationId', 'timeProjectId', 'date'] })
|
|
377
|
+
export class StaffTimeEntry {
|
|
378
|
+
@PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })
|
|
379
|
+
id!: string
|
|
380
|
+
|
|
381
|
+
@Property({ name: 'tenant_id', type: 'uuid' })
|
|
382
|
+
tenantId!: string
|
|
383
|
+
|
|
384
|
+
@Property({ name: 'organization_id', type: 'uuid' })
|
|
385
|
+
organizationId!: string
|
|
386
|
+
|
|
387
|
+
@Property({ name: 'staff_member_id', type: 'uuid' })
|
|
388
|
+
staffMemberId!: string
|
|
389
|
+
|
|
390
|
+
@Property({ name: 'date', type: 'date' })
|
|
391
|
+
date!: Date
|
|
392
|
+
|
|
393
|
+
@Property({ name: 'duration_minutes', type: 'integer', default: 0 })
|
|
394
|
+
durationMinutes: number = 0
|
|
395
|
+
|
|
396
|
+
@Property({ name: 'started_at', type: Date, nullable: true })
|
|
397
|
+
startedAt?: Date | null
|
|
398
|
+
|
|
399
|
+
@Property({ name: 'ended_at', type: Date, nullable: true })
|
|
400
|
+
endedAt?: Date | null
|
|
401
|
+
|
|
402
|
+
@Property({ type: 'text', nullable: true })
|
|
403
|
+
notes?: string | null
|
|
404
|
+
|
|
405
|
+
@Property({ name: 'time_project_id', type: 'uuid', nullable: true })
|
|
406
|
+
timeProjectId?: string | null
|
|
407
|
+
|
|
408
|
+
@Property({ name: 'customer_id', type: 'uuid', nullable: true })
|
|
409
|
+
customerId?: string | null
|
|
410
|
+
|
|
411
|
+
@Property({ name: 'deal_id', type: 'uuid', nullable: true })
|
|
412
|
+
dealId?: string | null
|
|
413
|
+
|
|
414
|
+
@Property({ name: 'order_id', type: 'uuid', nullable: true })
|
|
415
|
+
orderId?: string | null
|
|
416
|
+
|
|
417
|
+
@Enum({ items: ['manual', 'timer', 'kiosk', 'mobile'], type: 'text', name: 'source', default: 'manual' })
|
|
418
|
+
source: StaffTimeEntrySource = 'manual'
|
|
419
|
+
|
|
420
|
+
@Property({ name: 'created_at', type: Date, onCreate: () => new Date() })
|
|
421
|
+
createdAt: Date = new Date()
|
|
422
|
+
|
|
423
|
+
@Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })
|
|
424
|
+
updatedAt: Date = new Date()
|
|
425
|
+
|
|
426
|
+
@Property({ name: 'deleted_at', type: Date, nullable: true })
|
|
427
|
+
deletedAt?: Date | null
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
@Entity({ tableName: 'staff_time_entry_segments' })
|
|
431
|
+
@Index({ name: 'staff_time_entry_segments_tenant_org_idx', properties: ['tenantId', 'organizationId'] })
|
|
432
|
+
@Index({ name: 'staff_time_entry_segments_entry_idx', properties: ['timeEntryId'] })
|
|
433
|
+
export class StaffTimeEntrySegment {
|
|
434
|
+
@PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })
|
|
435
|
+
id!: string
|
|
436
|
+
|
|
437
|
+
@Property({ name: 'tenant_id', type: 'uuid' })
|
|
438
|
+
tenantId!: string
|
|
439
|
+
|
|
440
|
+
@Property({ name: 'organization_id', type: 'uuid' })
|
|
441
|
+
organizationId!: string
|
|
442
|
+
|
|
443
|
+
@Property({ name: 'time_entry_id', type: 'uuid' })
|
|
444
|
+
timeEntryId!: string
|
|
445
|
+
|
|
446
|
+
@Property({ name: 'started_at', type: Date })
|
|
447
|
+
startedAt!: Date
|
|
448
|
+
|
|
449
|
+
@Property({ name: 'ended_at', type: Date, nullable: true })
|
|
450
|
+
endedAt?: Date | null
|
|
451
|
+
|
|
452
|
+
@Enum({ items: ['work', 'break'], type: 'text', name: 'segment_type', default: 'work' })
|
|
453
|
+
segmentType: StaffTimeEntrySegmentType = 'work'
|
|
454
|
+
|
|
455
|
+
@Property({ name: 'created_at', type: Date, onCreate: () => new Date() })
|
|
456
|
+
createdAt: Date = new Date()
|
|
457
|
+
|
|
458
|
+
@Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })
|
|
459
|
+
updatedAt: Date = new Date()
|
|
460
|
+
|
|
461
|
+
@Property({ name: 'deleted_at', type: Date, nullable: true })
|
|
462
|
+
deletedAt?: Date | null
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
@Entity({ tableName: 'staff_time_projects' })
|
|
466
|
+
@Index({ name: 'staff_time_projects_tenant_org_idx', properties: ['tenantId', 'organizationId'] })
|
|
467
|
+
@Index({ name: 'staff_time_projects_code_unique_idx', properties: ['organizationId', 'tenantId', 'code'], options: { unique: true, where: 'deleted_at IS NULL' } })
|
|
468
|
+
export class StaffTimeProject {
|
|
469
|
+
@PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })
|
|
470
|
+
id!: string
|
|
471
|
+
|
|
472
|
+
@Property({ name: 'tenant_id', type: 'uuid' })
|
|
473
|
+
tenantId!: string
|
|
474
|
+
|
|
475
|
+
@Property({ name: 'organization_id', type: 'uuid' })
|
|
476
|
+
organizationId!: string
|
|
477
|
+
|
|
478
|
+
@Property({ type: 'text' })
|
|
479
|
+
name!: string
|
|
480
|
+
|
|
481
|
+
@Property({ name: 'customer_id', type: 'uuid', nullable: true })
|
|
482
|
+
customerId?: string | null
|
|
483
|
+
|
|
484
|
+
@Property({ type: 'text' })
|
|
485
|
+
code!: string
|
|
486
|
+
|
|
487
|
+
@Property({ type: 'text', nullable: true })
|
|
488
|
+
description?: string | null
|
|
489
|
+
|
|
490
|
+
@Property({ name: 'project_type', type: 'text', nullable: true })
|
|
491
|
+
projectType?: string | null
|
|
492
|
+
|
|
493
|
+
@Property({ type: 'varchar', length: 20, nullable: true })
|
|
494
|
+
color?: string | null
|
|
495
|
+
|
|
496
|
+
@Enum({ items: ['active', 'on_hold', 'completed'], type: 'text', name: 'status', default: 'active' })
|
|
497
|
+
status: StaffTimeProjectStatus = 'active'
|
|
498
|
+
|
|
499
|
+
@Property({ name: 'owner_user_id', type: 'uuid', nullable: true })
|
|
500
|
+
ownerUserId?: string | null
|
|
501
|
+
|
|
502
|
+
@Property({ name: 'cost_center', type: 'text', nullable: true })
|
|
503
|
+
costCenter?: string | null
|
|
504
|
+
|
|
505
|
+
@Property({ name: 'start_date', type: 'date', nullable: true })
|
|
506
|
+
startDate?: Date | null
|
|
507
|
+
|
|
508
|
+
@Property({ name: 'created_at', type: Date, onCreate: () => new Date() })
|
|
509
|
+
createdAt: Date = new Date()
|
|
510
|
+
|
|
511
|
+
@Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })
|
|
512
|
+
updatedAt: Date = new Date()
|
|
513
|
+
|
|
514
|
+
@Property({ name: 'deleted_at', type: Date, nullable: true })
|
|
515
|
+
deletedAt?: Date | null
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
@Entity({ tableName: 'staff_time_project_members' })
|
|
519
|
+
@Index({ name: 'staff_time_project_members_tenant_org_idx', properties: ['tenantId', 'organizationId'] })
|
|
520
|
+
@Index({ name: 'staff_time_project_members_project_idx', properties: ['organizationId', 'timeProjectId'] })
|
|
521
|
+
@Index({ name: 'staff_time_project_members_member_idx', properties: ['organizationId', 'staffMemberId'] })
|
|
522
|
+
@Index({ name: 'staff_time_project_members_unique_idx', properties: ['organizationId', 'tenantId', 'timeProjectId', 'staffMemberId'], options: { unique: true, where: 'deleted_at IS NULL' } })
|
|
523
|
+
export class StaffTimeProjectMember {
|
|
524
|
+
@PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })
|
|
525
|
+
id!: string
|
|
526
|
+
|
|
527
|
+
@Property({ name: 'tenant_id', type: 'uuid' })
|
|
528
|
+
tenantId!: string
|
|
529
|
+
|
|
530
|
+
@Property({ name: 'organization_id', type: 'uuid' })
|
|
531
|
+
organizationId!: string
|
|
532
|
+
|
|
533
|
+
@Property({ name: 'time_project_id', type: 'uuid' })
|
|
534
|
+
timeProjectId!: string
|
|
535
|
+
|
|
536
|
+
@Property({ name: 'staff_member_id', type: 'uuid' })
|
|
537
|
+
staffMemberId!: string
|
|
538
|
+
|
|
539
|
+
@Property({ type: 'text', nullable: true })
|
|
540
|
+
role?: string | null
|
|
541
|
+
|
|
542
|
+
@Enum({ items: ['active', 'inactive'], type: 'text', name: 'status', default: 'active' })
|
|
543
|
+
status: StaffTimeProjectMemberStatus = 'active'
|
|
544
|
+
|
|
545
|
+
@Property({ name: 'show_in_grid', type: 'boolean', default: false })
|
|
546
|
+
showInGrid: boolean = false
|
|
547
|
+
|
|
548
|
+
@Property({ name: 'assigned_start_date', type: 'date' })
|
|
549
|
+
assignedStartDate!: Date
|
|
550
|
+
|
|
551
|
+
@Property({ name: 'assigned_end_date', type: 'date', nullable: true })
|
|
552
|
+
assignedEndDate?: Date | null
|
|
553
|
+
|
|
554
|
+
@Property({ name: 'created_at', type: Date, onCreate: () => new Date() })
|
|
555
|
+
createdAt: Date = new Date()
|
|
556
|
+
|
|
557
|
+
@Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })
|
|
558
|
+
updatedAt: Date = new Date()
|
|
559
|
+
|
|
560
|
+
@Property({ name: 'deleted_at', type: Date, nullable: true })
|
|
561
|
+
deletedAt?: Date | null
|
|
562
|
+
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
|
+
import { PROJECT_COLOR_KEYS } from '../lib/timesheets-ui/colors'
|
|
3
|
+
|
|
4
|
+
const projectColorSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.refine(
|
|
7
|
+
(value) => (PROJECT_COLOR_KEYS as readonly string[]).includes(value),
|
|
8
|
+
{ message: 'Invalid project color key.' },
|
|
9
|
+
)
|
|
2
10
|
|
|
3
11
|
const tagsSchema = z.array(z.string().min(1)).optional().default([])
|
|
4
12
|
|
|
@@ -242,3 +250,124 @@ export type StaffLeaveRequestCreateInput = z.infer<typeof staffLeaveRequestCreat
|
|
|
242
250
|
export type StaffLeaveRequestUpdateInput = z.infer<typeof staffLeaveRequestUpdateSchema>
|
|
243
251
|
export type StaffLeaveRequestDecisionInput = z.infer<typeof staffLeaveRequestDecisionSchema>
|
|
244
252
|
export type StaffTeamMemberSelfCreateInput = z.infer<typeof staffTeamMemberSelfCreateSchema>
|
|
253
|
+
|
|
254
|
+
// --- Timesheets validators (Phase 1) ---
|
|
255
|
+
|
|
256
|
+
const timeEntrySourceSchema = z.enum(['manual', 'timer', 'kiosk', 'mobile'])
|
|
257
|
+
const timeProjectStatusSchema = z.enum(['active', 'on_hold', 'completed'])
|
|
258
|
+
const timeProjectMemberStatusSchema = z.enum(['active', 'inactive'])
|
|
259
|
+
const timeEntrySegmentTypeSchema = z.enum(['work', 'break'])
|
|
260
|
+
const projectCodeSchema = z.string().min(1).max(50).regex(/^[a-zA-Z0-9-]+$/)
|
|
261
|
+
|
|
262
|
+
export const staffTimeEntryCreateSchema = z.object({
|
|
263
|
+
...scopedCreateFields,
|
|
264
|
+
staffMemberId: z.string().uuid(),
|
|
265
|
+
date: z.coerce.date(),
|
|
266
|
+
durationMinutes: z.number().int().min(0).max(1440),
|
|
267
|
+
startedAt: z.coerce.date().optional().nullable(),
|
|
268
|
+
endedAt: z.coerce.date().optional().nullable(),
|
|
269
|
+
timeProjectId: z.string().uuid().optional().nullable(),
|
|
270
|
+
customerId: z.string().uuid().optional().nullable(),
|
|
271
|
+
dealId: z.string().uuid().optional().nullable(),
|
|
272
|
+
orderId: z.string().uuid().optional().nullable(),
|
|
273
|
+
notes: z.string().max(2000).optional().nullable(),
|
|
274
|
+
source: timeEntrySourceSchema.optional().default('manual'),
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
export const staffTimeEntryUpdateSchema = z.object({
|
|
278
|
+
...scopedUpdateFields,
|
|
279
|
+
date: z.coerce.date().optional(),
|
|
280
|
+
durationMinutes: z.number().int().min(0).max(1440).optional(),
|
|
281
|
+
timeProjectId: z.string().uuid().optional().nullable(),
|
|
282
|
+
customerId: z.string().uuid().optional().nullable(),
|
|
283
|
+
dealId: z.string().uuid().optional().nullable(),
|
|
284
|
+
orderId: z.string().uuid().optional().nullable(),
|
|
285
|
+
notes: z.string().max(2000).optional().nullable(),
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
export const staffTimeEntryBulkItemSchema = z.object({
|
|
289
|
+
id: z.string().uuid().optional().nullable(),
|
|
290
|
+
date: z.coerce.date(),
|
|
291
|
+
timeProjectId: z.string().uuid(),
|
|
292
|
+
durationMinutes: z.number().int().min(0).max(1440),
|
|
293
|
+
notes: z.string().max(2000).optional().nullable(),
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
export const staffTimeEntryBulkSaveSchema = z.object({
|
|
297
|
+
entries: z.array(staffTimeEntryBulkItemSchema).min(1).max(200),
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
export const staffTimeEntrySegmentCreateSchema = z.object({
|
|
301
|
+
...scopedCreateFields,
|
|
302
|
+
timeEntryId: z.string().uuid(),
|
|
303
|
+
startedAt: z.coerce.date(),
|
|
304
|
+
endedAt: z.coerce.date().optional().nullable(),
|
|
305
|
+
segmentType: timeEntrySegmentTypeSchema.optional().default('work'),
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
export const staffTimeEntrySegmentUpdateSchema = z.object({
|
|
309
|
+
...scopedUpdateFields,
|
|
310
|
+
startedAt: z.coerce.date().optional(),
|
|
311
|
+
endedAt: z.coerce.date().optional().nullable(),
|
|
312
|
+
segmentType: timeEntrySegmentTypeSchema.optional(),
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
export const staffTimeProjectCreateSchema = z.object({
|
|
316
|
+
...scopedCreateFields,
|
|
317
|
+
name: z.string().min(1).max(255),
|
|
318
|
+
customerId: z.string().uuid().optional().nullable(),
|
|
319
|
+
code: projectCodeSchema,
|
|
320
|
+
description: z.string().max(2000).optional().nullable(),
|
|
321
|
+
projectType: z.string().max(100).optional().nullable(),
|
|
322
|
+
color: projectColorSchema.optional().nullable(),
|
|
323
|
+
status: timeProjectStatusSchema.optional().default('active'),
|
|
324
|
+
ownerUserId: z.string().uuid().optional().nullable(),
|
|
325
|
+
costCenter: z.string().max(100).optional().nullable(),
|
|
326
|
+
startDate: z.coerce.date().optional().nullable(),
|
|
327
|
+
})
|
|
328
|
+
|
|
329
|
+
export const staffTimeProjectUpdateSchema = z.object({
|
|
330
|
+
...scopedUpdateFields,
|
|
331
|
+
name: z.string().min(1).max(255).optional(),
|
|
332
|
+
customerId: z.string().uuid().optional().nullable(),
|
|
333
|
+
code: projectCodeSchema.optional(),
|
|
334
|
+
description: z.string().max(2000).optional().nullable(),
|
|
335
|
+
projectType: z.string().max(100).optional().nullable(),
|
|
336
|
+
color: projectColorSchema.optional().nullable(),
|
|
337
|
+
status: timeProjectStatusSchema.optional(),
|
|
338
|
+
ownerUserId: z.string().uuid().optional().nullable(),
|
|
339
|
+
costCenter: z.string().max(100).optional().nullable(),
|
|
340
|
+
startDate: z.coerce.date().optional().nullable(),
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
export const staffTimeProjectMemberAssignSchema = z.object({
|
|
344
|
+
...scopedCreateFields,
|
|
345
|
+
timeProjectId: z.string().uuid(),
|
|
346
|
+
staffMemberId: z.string().uuid(),
|
|
347
|
+
role: z.string().max(100).optional().nullable(),
|
|
348
|
+
status: timeProjectMemberStatusSchema.optional().default('active'),
|
|
349
|
+
assignedStartDate: z.coerce.date(),
|
|
350
|
+
assignedEndDate: z.coerce.date().optional().nullable(),
|
|
351
|
+
})
|
|
352
|
+
|
|
353
|
+
export const staffTimeProjectMemberUpdateSchema = z.object({
|
|
354
|
+
...scopedUpdateFields,
|
|
355
|
+
role: z.string().max(100).optional().nullable(),
|
|
356
|
+
status: timeProjectMemberStatusSchema.optional(),
|
|
357
|
+
assignedEndDate: z.coerce.date().optional().nullable(),
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
export const staffMyProjectVisibilityUpdateSchema = z.object({
|
|
361
|
+
showInGrid: z.boolean(),
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
export type StaffTimeEntryCreateInput = z.infer<typeof staffTimeEntryCreateSchema>
|
|
365
|
+
export type StaffTimeEntryUpdateInput = z.infer<typeof staffTimeEntryUpdateSchema>
|
|
366
|
+
export type StaffTimeEntryBulkSaveInput = z.infer<typeof staffTimeEntryBulkSaveSchema>
|
|
367
|
+
export type StaffTimeEntrySegmentCreateInput = z.infer<typeof staffTimeEntrySegmentCreateSchema>
|
|
368
|
+
export type StaffTimeEntrySegmentUpdateInput = z.infer<typeof staffTimeEntrySegmentUpdateSchema>
|
|
369
|
+
export type StaffTimeProjectCreateInput = z.infer<typeof staffTimeProjectCreateSchema>
|
|
370
|
+
export type StaffTimeProjectUpdateInput = z.infer<typeof staffTimeProjectUpdateSchema>
|
|
371
|
+
export type StaffTimeProjectMemberAssignInput = z.infer<typeof staffTimeProjectMemberAssignSchema>
|
|
372
|
+
export type StaffTimeProjectMemberUpdateInput = z.infer<typeof staffTimeProjectMemberUpdateSchema>
|
|
373
|
+
export type StaffMyProjectVisibilityUpdateInput = z.infer<typeof staffMyProjectVisibilityUpdateSchema>
|
|
@@ -25,6 +25,19 @@ const events = [
|
|
|
25
25
|
{ id: 'staff.job_history.created', label: 'Job History Created', entity: 'job_history', category: 'crud' },
|
|
26
26
|
{ id: 'staff.job_history.updated', label: 'Job History Updated', entity: 'job_history', category: 'crud' },
|
|
27
27
|
{ id: 'staff.job_history.deleted', label: 'Job History Deleted', entity: 'job_history', category: 'crud' },
|
|
28
|
+
|
|
29
|
+
// Timesheets (Phase 1)
|
|
30
|
+
{ id: 'staff.timesheets.time_entry.created', label: 'Time Entry Created', entity: 'time_entry', category: 'crud' },
|
|
31
|
+
{ id: 'staff.timesheets.time_entry.updated', label: 'Time Entry Updated', entity: 'time_entry', category: 'crud' },
|
|
32
|
+
{ id: 'staff.timesheets.time_entry.deleted', label: 'Time Entry Deleted', entity: 'time_entry', category: 'crud' },
|
|
33
|
+
{ id: 'staff.timesheets.time_entry.timer_started', label: 'Timer Started', entity: 'time_entry', category: 'lifecycle' },
|
|
34
|
+
{ id: 'staff.timesheets.time_entry.timer_stopped', label: 'Timer Stopped', entity: 'time_entry', category: 'lifecycle' },
|
|
35
|
+
{ id: 'staff.timesheets.time_project.created', label: 'Time Project Created', entity: 'time_project', category: 'crud' },
|
|
36
|
+
{ id: 'staff.timesheets.time_project.updated', label: 'Time Project Updated', entity: 'time_project', category: 'crud' },
|
|
37
|
+
{ id: 'staff.timesheets.time_project.deleted', label: 'Time Project Deleted', entity: 'time_project', category: 'crud' },
|
|
38
|
+
{ id: 'staff.timesheets.time_project_member.created', label: 'Time Project Member Assigned', entity: 'time_project_member', category: 'crud' },
|
|
39
|
+
{ id: 'staff.timesheets.time_project_member.updated', label: 'Time Project Member Updated', entity: 'time_project_member', category: 'crud' },
|
|
40
|
+
{ id: 'staff.timesheets.time_project_member.deleted', label: 'Time Project Member Unassigned', entity: 'time_project_member', category: 'crud' },
|
|
28
41
|
] as const
|
|
29
42
|
|
|
30
43
|
export const eventsConfig = createModuleEvents({
|