@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,167 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { makeCrudRoute } from '@open-mercato/shared/lib/crud/factory'
|
|
3
|
+
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
4
|
+
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
5
|
+
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
6
|
+
import { StaffTimeProjectMember } from '../../../../../data/entities'
|
|
7
|
+
import { staffTimeProjectMemberAssignSchema } from '../../../../../data/validators'
|
|
8
|
+
import { createStaffCrudOpenApi, createPagedListResponseSchema, defaultOkResponseSchema } from '../../../../openapi'
|
|
9
|
+
|
|
10
|
+
function extractProjectIdFromUrl(request?: Request): string | null {
|
|
11
|
+
if (!request?.url) return null
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(request.url)
|
|
14
|
+
const match = url.pathname.match(/\/time-projects\/([^/]+)\/employees/)
|
|
15
|
+
return match?.[1] ?? null
|
|
16
|
+
} catch {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const F = {
|
|
22
|
+
id: 'id',
|
|
23
|
+
tenant_id: 'tenant_id',
|
|
24
|
+
organization_id: 'organization_id',
|
|
25
|
+
time_project_id: 'time_project_id',
|
|
26
|
+
staff_member_id: 'staff_member_id',
|
|
27
|
+
role: 'role',
|
|
28
|
+
status: 'status',
|
|
29
|
+
assigned_start_date: 'assigned_start_date',
|
|
30
|
+
assigned_end_date: 'assigned_end_date',
|
|
31
|
+
created_at: 'created_at',
|
|
32
|
+
updated_at: 'updated_at',
|
|
33
|
+
deleted_at: 'deleted_at',
|
|
34
|
+
} as const
|
|
35
|
+
|
|
36
|
+
const routeMetadata = {
|
|
37
|
+
GET: { requireAuth: true, requireFeatures: ['staff.timesheets.projects.view'] },
|
|
38
|
+
POST: { requireAuth: true, requireFeatures: ['staff.timesheets.projects.manage'] },
|
|
39
|
+
DELETE: { requireAuth: true, requireFeatures: ['staff.timesheets.projects.manage'] },
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const metadata = routeMetadata
|
|
43
|
+
|
|
44
|
+
const rawBodySchema = z.object({}).passthrough()
|
|
45
|
+
|
|
46
|
+
const listSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
page: z.coerce.number().min(1).default(1),
|
|
49
|
+
pageSize: z.coerce.number().min(1).max(100).default(50),
|
|
50
|
+
timeProjectId: z.string().uuid().optional(),
|
|
51
|
+
status: z.string().optional(),
|
|
52
|
+
sortField: z.string().optional(),
|
|
53
|
+
sortDir: z.enum(['asc', 'desc']).optional(),
|
|
54
|
+
})
|
|
55
|
+
.passthrough()
|
|
56
|
+
|
|
57
|
+
const crud = makeCrudRoute({
|
|
58
|
+
metadata: routeMetadata,
|
|
59
|
+
orm: {
|
|
60
|
+
entity: StaffTimeProjectMember,
|
|
61
|
+
idField: 'id',
|
|
62
|
+
orgField: 'organizationId',
|
|
63
|
+
tenantField: 'tenantId',
|
|
64
|
+
softDeleteField: 'deletedAt',
|
|
65
|
+
},
|
|
66
|
+
indexer: { entityType: 'staff:staff_time_project_member' },
|
|
67
|
+
list: {
|
|
68
|
+
schema: listSchema,
|
|
69
|
+
entityId: 'staff:staff_time_project_member',
|
|
70
|
+
fields: [
|
|
71
|
+
F.id,
|
|
72
|
+
F.organization_id,
|
|
73
|
+
F.tenant_id,
|
|
74
|
+
F.time_project_id,
|
|
75
|
+
F.staff_member_id,
|
|
76
|
+
F.role,
|
|
77
|
+
F.status,
|
|
78
|
+
F.assigned_start_date,
|
|
79
|
+
F.assigned_end_date,
|
|
80
|
+
F.created_at,
|
|
81
|
+
F.updated_at,
|
|
82
|
+
],
|
|
83
|
+
sortFieldMap: {
|
|
84
|
+
createdAt: F.created_at,
|
|
85
|
+
updatedAt: F.updated_at,
|
|
86
|
+
assignedStartDate: F.assigned_start_date,
|
|
87
|
+
},
|
|
88
|
+
buildFilters: async (query, ctx) => {
|
|
89
|
+
const filters: Record<string, unknown> = {}
|
|
90
|
+
const projectId = query.timeProjectId ?? extractProjectIdFromUrl(ctx?.request) ?? null
|
|
91
|
+
if (typeof projectId === 'string' && projectId.trim().length > 0) {
|
|
92
|
+
filters[F.time_project_id] = projectId.trim()
|
|
93
|
+
}
|
|
94
|
+
if (typeof query.status === 'string' && query.status.trim().length > 0) {
|
|
95
|
+
filters[F.status] = query.status.trim()
|
|
96
|
+
}
|
|
97
|
+
return filters
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
actions: {
|
|
101
|
+
create: {
|
|
102
|
+
commandId: 'staff.timesheets.time_project_members.assign',
|
|
103
|
+
schema: rawBodySchema,
|
|
104
|
+
mapInput: async ({ raw, ctx }) => {
|
|
105
|
+
const { translate } = await resolveTranslations()
|
|
106
|
+
const projectId = extractProjectIdFromUrl(ctx?.request) ?? null
|
|
107
|
+
const body = { ...raw, timeProjectId: raw?.timeProjectId ?? projectId }
|
|
108
|
+
return parseScopedCommandInput(staffTimeProjectMemberAssignSchema, body, ctx, translate)
|
|
109
|
+
},
|
|
110
|
+
response: ({ result }) => ({ id: result?.timeProjectMemberId ?? null }),
|
|
111
|
+
status: 201,
|
|
112
|
+
},
|
|
113
|
+
delete: {
|
|
114
|
+
commandId: 'staff.timesheets.time_project_members.unassign',
|
|
115
|
+
schema: rawBodySchema,
|
|
116
|
+
mapInput: async ({ parsed, ctx }) => {
|
|
117
|
+
const { translate } = await resolveTranslations()
|
|
118
|
+
const id =
|
|
119
|
+
parsed?.body?.id ??
|
|
120
|
+
parsed?.id ??
|
|
121
|
+
parsed?.query?.id ??
|
|
122
|
+
(ctx.request ? new URL(ctx.request.url).searchParams.get('id') : null)
|
|
123
|
+
if (!id) {
|
|
124
|
+
throw new CrudHttpError(400, {
|
|
125
|
+
error: translate('staff.timesheets.errors.memberRequired', 'Time project member id is required.'),
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
return { id }
|
|
129
|
+
},
|
|
130
|
+
response: () => ({ ok: true }),
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
export const GET = crud.GET
|
|
136
|
+
export const POST = crud.POST
|
|
137
|
+
export const DELETE = crud.DELETE
|
|
138
|
+
|
|
139
|
+
const projectMemberListItemSchema = z.object({
|
|
140
|
+
id: z.string().uuid().nullable().optional(),
|
|
141
|
+
organization_id: z.string().uuid().nullable().optional(),
|
|
142
|
+
tenant_id: z.string().uuid().nullable().optional(),
|
|
143
|
+
time_project_id: z.string().uuid().nullable().optional(),
|
|
144
|
+
staff_member_id: z.string().uuid().nullable().optional(),
|
|
145
|
+
role: z.string().nullable().optional(),
|
|
146
|
+
status: z.string().nullable().optional(),
|
|
147
|
+
assigned_start_date: z.string().nullable().optional(),
|
|
148
|
+
assigned_end_date: z.string().nullable().optional(),
|
|
149
|
+
created_at: z.string().nullable().optional(),
|
|
150
|
+
updated_at: z.string().nullable().optional(),
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
export const openApi = createStaffCrudOpenApi({
|
|
154
|
+
resourceName: 'TimeProjectMember',
|
|
155
|
+
pluralName: 'Time Project Members',
|
|
156
|
+
querySchema: listSchema,
|
|
157
|
+
listResponseSchema: createPagedListResponseSchema(projectMemberListItemSchema),
|
|
158
|
+
create: {
|
|
159
|
+
schema: staffTimeProjectMemberAssignSchema,
|
|
160
|
+
description: 'Assigns an employee to a time project.',
|
|
161
|
+
},
|
|
162
|
+
del: {
|
|
163
|
+
schema: z.object({ id: z.string().uuid() }),
|
|
164
|
+
responseSchema: defaultOkResponseSchema,
|
|
165
|
+
description: 'Unassigns an employee from a time project.',
|
|
166
|
+
},
|
|
167
|
+
})
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
3
|
+
import { makeCrudRoute } from '@open-mercato/shared/lib/crud/factory'
|
|
4
|
+
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
5
|
+
import { resolveCrudRecordId, parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
6
|
+
import { escapeLikePattern } from '@open-mercato/shared/lib/db/escapeLikePattern'
|
|
7
|
+
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
8
|
+
import { StaffTimeProject, StaffTimeProjectMember, StaffTeamMember } from '../../../data/entities'
|
|
9
|
+
import { staffTimeProjectCreateSchema, staffTimeProjectUpdateSchema } from '../../../data/validators'
|
|
10
|
+
import { sanitizeSearchTerm, parseBooleanFlag } from '../../helpers'
|
|
11
|
+
import { createStaffCrudOpenApi, createPagedListResponseSchema, defaultOkResponseSchema } from '../../openapi'
|
|
12
|
+
|
|
13
|
+
const F = {
|
|
14
|
+
id: 'id',
|
|
15
|
+
tenant_id: 'tenant_id',
|
|
16
|
+
organization_id: 'organization_id',
|
|
17
|
+
name: 'name',
|
|
18
|
+
code: 'code',
|
|
19
|
+
description: 'description',
|
|
20
|
+
project_type: 'project_type',
|
|
21
|
+
color: 'color',
|
|
22
|
+
status: 'status',
|
|
23
|
+
customer_id: 'customer_id',
|
|
24
|
+
owner_user_id: 'owner_user_id',
|
|
25
|
+
cost_center: 'cost_center',
|
|
26
|
+
start_date: 'start_date',
|
|
27
|
+
created_at: 'created_at',
|
|
28
|
+
updated_at: 'updated_at',
|
|
29
|
+
deleted_at: 'deleted_at',
|
|
30
|
+
} as const
|
|
31
|
+
|
|
32
|
+
const routeMetadata = {
|
|
33
|
+
GET: { requireAuth: true, requireFeatures: ['staff.timesheets.projects.view'] },
|
|
34
|
+
POST: { requireAuth: true, requireFeatures: ['staff.timesheets.projects.manage'] },
|
|
35
|
+
PUT: { requireAuth: true, requireFeatures: ['staff.timesheets.projects.manage'] },
|
|
36
|
+
DELETE: { requireAuth: true, requireFeatures: ['staff.timesheets.projects.manage'] },
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const metadata = routeMetadata
|
|
40
|
+
|
|
41
|
+
const rawBodySchema = z.object({}).passthrough()
|
|
42
|
+
|
|
43
|
+
const listSchema = z
|
|
44
|
+
.object({
|
|
45
|
+
page: z.coerce.number().min(1).default(1),
|
|
46
|
+
pageSize: z.coerce.number().min(1).max(100).default(50),
|
|
47
|
+
q: z.string().optional(),
|
|
48
|
+
ids: z.string().optional(),
|
|
49
|
+
projectType: z.string().optional(),
|
|
50
|
+
status: z.string().optional(),
|
|
51
|
+
customerId: z.string().uuid().optional(),
|
|
52
|
+
mine: z.string().optional(),
|
|
53
|
+
include: z.string().optional(),
|
|
54
|
+
sortField: z.string().optional(),
|
|
55
|
+
sortDir: z.enum(['asc', 'desc']).optional(),
|
|
56
|
+
})
|
|
57
|
+
.passthrough()
|
|
58
|
+
|
|
59
|
+
async function resolveCallerAssignedProjectIds(
|
|
60
|
+
em: EntityManager,
|
|
61
|
+
userId: string,
|
|
62
|
+
tenantId: string,
|
|
63
|
+
organizationId: string,
|
|
64
|
+
): Promise<string[]> {
|
|
65
|
+
const scopeCtx = { tenantId, organizationId }
|
|
66
|
+
const staffMember = await findOneWithDecryption(
|
|
67
|
+
em.fork(),
|
|
68
|
+
StaffTeamMember,
|
|
69
|
+
{ userId, tenantId, organizationId, deletedAt: null },
|
|
70
|
+
{},
|
|
71
|
+
scopeCtx,
|
|
72
|
+
)
|
|
73
|
+
if (!staffMember) return []
|
|
74
|
+
const memberships = await em.fork().find(StaffTimeProjectMember, {
|
|
75
|
+
staffMemberId: staffMember.id,
|
|
76
|
+
tenantId,
|
|
77
|
+
organizationId,
|
|
78
|
+
status: 'active',
|
|
79
|
+
deletedAt: null,
|
|
80
|
+
})
|
|
81
|
+
return Array.from(new Set(memberships.map((m) => m.timeProjectId)))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const crud = makeCrudRoute({
|
|
85
|
+
metadata: routeMetadata,
|
|
86
|
+
orm: {
|
|
87
|
+
entity: StaffTimeProject,
|
|
88
|
+
idField: 'id',
|
|
89
|
+
orgField: 'organizationId',
|
|
90
|
+
tenantField: 'tenantId',
|
|
91
|
+
softDeleteField: 'deletedAt',
|
|
92
|
+
},
|
|
93
|
+
indexer: { entityType: 'staff:staff_time_project' },
|
|
94
|
+
enrichers: { entityId: 'staff:staff_time_project' },
|
|
95
|
+
list: {
|
|
96
|
+
schema: listSchema,
|
|
97
|
+
entityId: 'staff:staff_time_project',
|
|
98
|
+
fields: [
|
|
99
|
+
F.id,
|
|
100
|
+
F.organization_id,
|
|
101
|
+
F.tenant_id,
|
|
102
|
+
F.name,
|
|
103
|
+
F.code,
|
|
104
|
+
F.description,
|
|
105
|
+
F.project_type,
|
|
106
|
+
F.color,
|
|
107
|
+
F.status,
|
|
108
|
+
F.customer_id,
|
|
109
|
+
F.owner_user_id,
|
|
110
|
+
F.cost_center,
|
|
111
|
+
F.start_date,
|
|
112
|
+
F.created_at,
|
|
113
|
+
F.updated_at,
|
|
114
|
+
],
|
|
115
|
+
sortFieldMap: {
|
|
116
|
+
name: F.name,
|
|
117
|
+
code: F.code,
|
|
118
|
+
status: F.status,
|
|
119
|
+
createdAt: F.created_at,
|
|
120
|
+
updatedAt: F.updated_at,
|
|
121
|
+
startDate: F.start_date,
|
|
122
|
+
},
|
|
123
|
+
buildFilters: async (query, ctx) => {
|
|
124
|
+
const filters: Record<string, unknown> = {}
|
|
125
|
+
let narrowIds: string[] | null = null
|
|
126
|
+
if (typeof query.ids === 'string' && query.ids.trim().length > 0) {
|
|
127
|
+
narrowIds = query.ids
|
|
128
|
+
.split(',')
|
|
129
|
+
.map((value) => value.trim())
|
|
130
|
+
.filter((value) => value.length > 0)
|
|
131
|
+
}
|
|
132
|
+
if (parseBooleanFlag(query.mine) && ctx.auth) {
|
|
133
|
+
const em = ctx.container.resolve('em') as EntityManager
|
|
134
|
+
const tenantId = ctx.auth.tenantId ?? ''
|
|
135
|
+
const organizationId = ctx.selectedOrganizationId ?? ctx.auth.orgId ?? ''
|
|
136
|
+
const assigned = await resolveCallerAssignedProjectIds(
|
|
137
|
+
em,
|
|
138
|
+
ctx.auth.sub,
|
|
139
|
+
tenantId,
|
|
140
|
+
organizationId,
|
|
141
|
+
)
|
|
142
|
+
narrowIds = narrowIds
|
|
143
|
+
? narrowIds.filter((id) => assigned.includes(id))
|
|
144
|
+
: assigned
|
|
145
|
+
if (narrowIds.length === 0) {
|
|
146
|
+
filters[F.id] = { $in: ['00000000-0000-0000-0000-000000000000'] }
|
|
147
|
+
return filters
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (narrowIds && narrowIds.length > 0) {
|
|
151
|
+
filters[F.id] = { $in: narrowIds }
|
|
152
|
+
}
|
|
153
|
+
const term = sanitizeSearchTerm(query.q)
|
|
154
|
+
if (term) {
|
|
155
|
+
filters[F.name] = { $ilike: `%${escapeLikePattern(term)}%` }
|
|
156
|
+
}
|
|
157
|
+
if (typeof query.projectType === 'string' && query.projectType.trim().length > 0) {
|
|
158
|
+
filters[F.project_type] = query.projectType.trim()
|
|
159
|
+
}
|
|
160
|
+
if (typeof query.status === 'string' && query.status.trim().length > 0) {
|
|
161
|
+
filters[F.status] = query.status.trim()
|
|
162
|
+
}
|
|
163
|
+
if (typeof query.customerId === 'string' && query.customerId.trim().length > 0) {
|
|
164
|
+
filters[F.customer_id] = query.customerId.trim()
|
|
165
|
+
}
|
|
166
|
+
return filters
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
actions: {
|
|
170
|
+
create: {
|
|
171
|
+
commandId: 'staff.timesheets.time_projects.create',
|
|
172
|
+
schema: rawBodySchema,
|
|
173
|
+
mapInput: async ({ raw, ctx }) => {
|
|
174
|
+
const { translate } = await resolveTranslations()
|
|
175
|
+
return parseScopedCommandInput(staffTimeProjectCreateSchema, raw ?? {}, ctx, translate)
|
|
176
|
+
},
|
|
177
|
+
response: ({ result }) => ({ id: result?.timeProjectId ?? null }),
|
|
178
|
+
status: 201,
|
|
179
|
+
},
|
|
180
|
+
update: {
|
|
181
|
+
commandId: 'staff.timesheets.time_projects.update',
|
|
182
|
+
schema: rawBodySchema,
|
|
183
|
+
mapInput: async ({ raw, ctx }) => {
|
|
184
|
+
const { translate } = await resolveTranslations()
|
|
185
|
+
return parseScopedCommandInput(staffTimeProjectUpdateSchema, raw ?? {}, ctx, translate)
|
|
186
|
+
},
|
|
187
|
+
response: () => ({ ok: true }),
|
|
188
|
+
},
|
|
189
|
+
delete: {
|
|
190
|
+
commandId: 'staff.timesheets.time_projects.delete',
|
|
191
|
+
schema: rawBodySchema,
|
|
192
|
+
mapInput: async ({ parsed, ctx }) => {
|
|
193
|
+
const { translate } = await resolveTranslations()
|
|
194
|
+
const id = resolveCrudRecordId(parsed, ctx, translate)
|
|
195
|
+
return { id }
|
|
196
|
+
},
|
|
197
|
+
response: () => ({ ok: true }),
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
export const GET = crud.GET
|
|
203
|
+
export const POST = crud.POST
|
|
204
|
+
export const PUT = crud.PUT
|
|
205
|
+
export const DELETE = crud.DELETE
|
|
206
|
+
|
|
207
|
+
const timeProjectListItemSchema = z.object({
|
|
208
|
+
id: z.string().uuid().nullable().optional(),
|
|
209
|
+
organization_id: z.string().uuid().nullable().optional(),
|
|
210
|
+
tenant_id: z.string().uuid().nullable().optional(),
|
|
211
|
+
name: z.string().nullable().optional(),
|
|
212
|
+
code: z.string().nullable().optional(),
|
|
213
|
+
description: z.string().nullable().optional(),
|
|
214
|
+
project_type: z.string().nullable().optional(),
|
|
215
|
+
color: z.string().nullable().optional(),
|
|
216
|
+
status: z.string().nullable().optional(),
|
|
217
|
+
customer_id: z.string().uuid().nullable().optional(),
|
|
218
|
+
owner_user_id: z.string().uuid().nullable().optional(),
|
|
219
|
+
cost_center: z.string().nullable().optional(),
|
|
220
|
+
start_date: z.string().nullable().optional(),
|
|
221
|
+
created_at: z.string().nullable().optional(),
|
|
222
|
+
updated_at: z.string().nullable().optional(),
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
export const openApi = createStaffCrudOpenApi({
|
|
226
|
+
resourceName: 'TimeProject',
|
|
227
|
+
pluralName: 'Time Projects',
|
|
228
|
+
querySchema: listSchema,
|
|
229
|
+
listResponseSchema: createPagedListResponseSchema(timeProjectListItemSchema),
|
|
230
|
+
create: {
|
|
231
|
+
schema: staffTimeProjectCreateSchema,
|
|
232
|
+
description: 'Creates a time project.',
|
|
233
|
+
},
|
|
234
|
+
update: {
|
|
235
|
+
schema: staffTimeProjectUpdateSchema,
|
|
236
|
+
responseSchema: defaultOkResponseSchema,
|
|
237
|
+
description: 'Updates a time project by id.',
|
|
238
|
+
},
|
|
239
|
+
del: {
|
|
240
|
+
schema: z.object({ id: z.string().uuid() }),
|
|
241
|
+
responseSchema: defaultOkResponseSchema,
|
|
242
|
+
description: 'Soft-deletes a time project by id.',
|
|
243
|
+
},
|
|
244
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
const clockIcon = React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 16, height: 16, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2 },
|
|
6
|
+
React.createElement('circle', { cx: 12, cy: 12, r: 10 }),
|
|
7
|
+
React.createElement('path', { d: 'M12 6v6l4 2' }),
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
export const metadata = {
|
|
11
|
+
requireAuth: true,
|
|
12
|
+
requireFeatures: ['staff.timesheets.view'],
|
|
13
|
+
pageTitle: 'My Timesheets',
|
|
14
|
+
pageTitleKey: 'staff.timesheets.nav.my_timesheets',
|
|
15
|
+
pageGroup: 'Employees',
|
|
16
|
+
pageGroupKey: 'staff.nav.group',
|
|
17
|
+
pageOrder: 85,
|
|
18
|
+
icon: clockIcon,
|
|
19
|
+
breadcrumb: [{ label: 'My Timesheets', labelKey: 'staff.timesheets.nav.my_timesheets' }],
|
|
20
|
+
}
|