@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.
Files changed (370) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/dist/generated/entities/staff_time_entry/index.js +37 -0
  3. package/dist/generated/entities/staff_time_entry/index.js.map +7 -0
  4. package/dist/generated/entities/staff_time_entry_segment/index.js +23 -0
  5. package/dist/generated/entities/staff_time_entry_segment/index.js.map +7 -0
  6. package/dist/generated/entities/staff_time_project/index.js +35 -0
  7. package/dist/generated/entities/staff_time_project/index.js.map +7 -0
  8. package/dist/generated/entities/staff_time_project_member/index.js +29 -0
  9. package/dist/generated/entities/staff_time_project_member/index.js.map +7 -0
  10. package/dist/generated/entities.ids.generated.js +5 -1
  11. package/dist/generated/entities.ids.generated.js.map +2 -2
  12. package/dist/generated/entity-fields-registry.js +64 -0
  13. package/dist/generated/entity-fields-registry.js.map +2 -2
  14. package/dist/helpers/integration/timesheetFixtures.js +50 -0
  15. package/dist/helpers/integration/timesheetFixtures.js.map +7 -0
  16. package/dist/modules/attachments/api/library/[id]/route.js +20 -16
  17. package/dist/modules/attachments/api/library/[id]/route.js.map +2 -2
  18. package/dist/modules/attachments/api/route.js +18 -14
  19. package/dist/modules/attachments/api/route.js.map +2 -2
  20. package/dist/modules/auth/api/roles/acl/route.js +10 -4
  21. package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
  22. package/dist/modules/auth/api/sidebar/preferences/route.js +27 -20
  23. package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
  24. package/dist/modules/auth/api/users/acl/route.js +16 -11
  25. package/dist/modules/auth/api/users/acl/route.js.map +2 -2
  26. package/dist/modules/auth/commands/users.js +87 -71
  27. package/dist/modules/auth/commands/users.js.map +2 -2
  28. package/dist/modules/auth/services/sidebarPreferencesService.js +39 -30
  29. package/dist/modules/auth/services/sidebarPreferencesService.js.map +2 -2
  30. package/dist/modules/catalog/commands/categories.js +61 -12
  31. package/dist/modules/catalog/commands/categories.js.map +2 -2
  32. package/dist/modules/catalog/commands/products.js +79 -54
  33. package/dist/modules/catalog/commands/products.js.map +2 -2
  34. package/dist/modules/catalog/commands/variants.js +29 -16
  35. package/dist/modules/catalog/commands/variants.js.map +2 -2
  36. package/dist/modules/currencies/commands/currencies.js +15 -8
  37. package/dist/modules/currencies/commands/currencies.js.map +2 -2
  38. package/dist/modules/customer_accounts/api/admin/users.js +27 -26
  39. package/dist/modules/customer_accounts/api/admin/users.js.map +2 -2
  40. package/dist/modules/customer_accounts/api/password/reset-confirm.js +5 -5
  41. package/dist/modules/customer_accounts/api/password/reset-confirm.js.map +2 -2
  42. package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js +11 -10
  43. package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js.map +2 -2
  44. package/dist/modules/customers/commands/addresses.js +35 -21
  45. package/dist/modules/customers/commands/addresses.js.map +2 -2
  46. package/dist/modules/customers/commands/companies.js +163 -162
  47. package/dist/modules/customers/commands/companies.js.map +2 -2
  48. package/dist/modules/customers/commands/deals.js +3 -4
  49. package/dist/modules/customers/commands/deals.js.map +2 -2
  50. package/dist/modules/customers/commands/interactions.js +19 -22
  51. package/dist/modules/customers/commands/interactions.js.map +2 -2
  52. package/dist/modules/customers/commands/people.js +18 -15
  53. package/dist/modules/customers/commands/people.js.map +2 -2
  54. package/dist/modules/customers/commands/personCompanyLinks.js +105 -94
  55. package/dist/modules/customers/commands/personCompanyLinks.js.map +2 -2
  56. package/dist/modules/customers/commands/pipeline-stages.js +30 -23
  57. package/dist/modules/customers/commands/pipeline-stages.js.map +2 -2
  58. package/dist/modules/customers/commands/pipelines.js +27 -20
  59. package/dist/modules/customers/commands/pipelines.js.map +2 -2
  60. package/dist/modules/customers/commands/tags.js +13 -5
  61. package/dist/modules/customers/commands/tags.js.map +2 -2
  62. package/dist/modules/dashboards/api/users/widgets/route.js +0 -1
  63. package/dist/modules/dashboards/api/users/widgets/route.js.map +2 -2
  64. package/dist/modules/dashboards/api/widgets/data/route.js +29 -1
  65. package/dist/modules/dashboards/api/widgets/data/route.js.map +2 -2
  66. package/dist/modules/data_sync/lib/sync-engine.js +4 -4
  67. package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
  68. package/dist/modules/data_sync/lib/sync-run-service.js +51 -27
  69. package/dist/modules/data_sync/lib/sync-run-service.js.map +2 -2
  70. package/dist/modules/directory/commands/organizations.js +192 -158
  71. package/dist/modules/directory/commands/organizations.js.map +3 -3
  72. package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js +22 -16
  73. package/dist/modules/inbox_ops/api/emails/[id]/reprocess/route.js.map +2 -2
  74. package/dist/modules/messages/commands/messages.js +77 -75
  75. package/dist/modules/messages/commands/messages.js.map +2 -2
  76. package/dist/modules/messages/commands/shared.js +132 -132
  77. package/dist/modules/messages/commands/shared.js.map +2 -2
  78. package/dist/modules/perspectives/api/[tableId]/route.js +37 -26
  79. package/dist/modules/perspectives/api/[tableId]/route.js.map +2 -2
  80. package/dist/modules/resources/commands/resources.js +125 -117
  81. package/dist/modules/resources/commands/resources.js.map +2 -2
  82. package/dist/modules/resources/commands/tags.js +7 -3
  83. package/dist/modules/resources/commands/tags.js.map +2 -2
  84. package/dist/modules/sales/api/quotes/send/route.js +12 -11
  85. package/dist/modules/sales/api/quotes/send/route.js.map +2 -2
  86. package/dist/modules/sales/commands/documents.js +629 -478
  87. package/dist/modules/sales/commands/documents.js.map +2 -2
  88. package/dist/modules/sales/commands/payments.js +146 -146
  89. package/dist/modules/sales/commands/payments.js.map +2 -2
  90. package/dist/modules/sales/commands/returns.js +68 -60
  91. package/dist/modules/sales/commands/returns.js.map +2 -2
  92. package/dist/modules/staff/acl.js +10 -1
  93. package/dist/modules/staff/acl.js.map +2 -2
  94. package/dist/modules/staff/analytics.js +33 -0
  95. package/dist/modules/staff/analytics.js.map +7 -0
  96. package/dist/modules/staff/api/guards.js +31 -0
  97. package/dist/modules/staff/api/guards.js.map +7 -0
  98. package/dist/modules/staff/api/interceptors.js +96 -0
  99. package/dist/modules/staff/api/interceptors.js.map +7 -0
  100. package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +170 -0
  101. package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +7 -0
  102. package/dist/modules/staff/api/timesheets/my-projects/route.js +103 -0
  103. package/dist/modules/staff/api/timesheets/my-projects/route.js.map +7 -0
  104. package/dist/modules/staff/api/timesheets/projects/kpis/route.js +147 -0
  105. package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +7 -0
  106. package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +171 -0
  107. package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +7 -0
  108. package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +180 -0
  109. package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +7 -0
  110. package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +155 -0
  111. package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +7 -0
  112. package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +173 -0
  113. package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +7 -0
  114. package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +260 -0
  115. package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +7 -0
  116. package/dist/modules/staff/api/timesheets/time-entries/route.js +188 -0
  117. package/dist/modules/staff/api/timesheets/time-entries/route.js.map +7 -0
  118. package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +159 -0
  119. package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +7 -0
  120. package/dist/modules/staff/api/timesheets/time-projects/route.js +230 -0
  121. package/dist/modules/staff/api/timesheets/time-projects/route.js.map +7 -0
  122. package/dist/modules/staff/backend/staff/timesheets/page.js +710 -0
  123. package/dist/modules/staff/backend/staff/timesheets/page.js.map +7 -0
  124. package/dist/modules/staff/backend/staff/timesheets/page.meta.js +22 -0
  125. package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +7 -0
  126. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +125 -0
  127. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +7 -0
  128. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +16 -0
  129. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +7 -0
  130. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +418 -0
  131. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +7 -0
  132. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +16 -0
  133. package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +7 -0
  134. package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +79 -0
  135. package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +7 -0
  136. package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +16 -0
  137. package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +7 -0
  138. package/dist/modules/staff/backend/staff/timesheets/projects/page.js +602 -0
  139. package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +7 -0
  140. package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +25 -0
  141. package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +7 -0
  142. package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +123 -0
  143. package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +7 -0
  144. package/dist/modules/staff/cli.js +38 -1
  145. package/dist/modules/staff/cli.js.map +2 -2
  146. package/dist/modules/staff/commands/index.js +2 -0
  147. package/dist/modules/staff/commands/index.js.map +2 -2
  148. package/dist/modules/staff/commands/leave-requests.js +30 -28
  149. package/dist/modules/staff/commands/leave-requests.js.map +3 -3
  150. package/dist/modules/staff/commands/team-members.js +21 -20
  151. package/dist/modules/staff/commands/team-members.js.map +2 -2
  152. package/dist/modules/staff/commands/timesheets-entries.js +409 -0
  153. package/dist/modules/staff/commands/timesheets-entries.js.map +7 -0
  154. package/dist/modules/staff/commands/timesheets-projects.js +618 -0
  155. package/dist/modules/staff/commands/timesheets-projects.js.map +7 -0
  156. package/dist/modules/staff/data/enrichers.js +104 -0
  157. package/dist/modules/staff/data/enrichers.js.map +7 -0
  158. package/dist/modules/staff/data/entities.js +226 -1
  159. package/dist/modules/staff/data/entities.js.map +2 -2
  160. package/dist/modules/staff/data/validators.js +113 -1
  161. package/dist/modules/staff/data/validators.js.map +2 -2
  162. package/dist/modules/staff/events.js +13 -1
  163. package/dist/modules/staff/events.js.map +2 -2
  164. package/dist/modules/staff/lib/crud.js +7 -1
  165. package/dist/modules/staff/lib/crud.js.map +2 -2
  166. package/dist/modules/staff/lib/staffMemberResolver.js +15 -0
  167. package/dist/modules/staff/lib/staffMemberResolver.js.map +7 -0
  168. package/dist/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.js +60 -0
  169. package/dist/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.js.map +7 -0
  170. package/dist/modules/staff/lib/timesheets-projects/computeProjectsKpis.js +260 -0
  171. package/dist/modules/staff/lib/timesheets-projects/computeProjectsKpis.js.map +7 -0
  172. package/dist/modules/staff/lib/timesheets-projects/dateBuckets.js +41 -0
  173. package/dist/modules/staff/lib/timesheets-projects/dateBuckets.js.map +7 -0
  174. package/dist/modules/staff/lib/timesheets-projects/initials.js +10 -0
  175. package/dist/modules/staff/lib/timesheets-projects/initials.js.map +7 -0
  176. package/dist/modules/staff/lib/timesheets-projects/kpiMath.js +12 -0
  177. package/dist/modules/staff/lib/timesheets-projects/kpiMath.js.map +7 -0
  178. package/dist/modules/staff/lib/timesheets-projects/listProjectMembersPreview.js +55 -0
  179. package/dist/modules/staff/lib/timesheets-projects/listProjectMembersPreview.js.map +7 -0
  180. package/dist/modules/staff/lib/timesheets-projects-ui/HoursSparkline.js +66 -0
  181. package/dist/modules/staff/lib/timesheets-projects-ui/HoursSparkline.js.map +7 -0
  182. package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +81 -0
  183. package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +7 -0
  184. package/dist/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.js +58 -0
  185. package/dist/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.js.map +7 -0
  186. package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.js +152 -0
  187. package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.js.map +7 -0
  188. package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js +37 -0
  189. package/dist/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.js.map +7 -0
  190. package/dist/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.js +57 -0
  191. package/dist/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.js.map +7 -0
  192. package/dist/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.js +50 -0
  193. package/dist/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.js.map +7 -0
  194. package/dist/modules/staff/lib/timesheets-ui/AddRowDropdown.js +163 -0
  195. package/dist/modules/staff/lib/timesheets-ui/AddRowDropdown.js.map +7 -0
  196. package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js +209 -0
  197. package/dist/modules/staff/lib/timesheets-ui/CalendarPicker.js.map +7 -0
  198. package/dist/modules/staff/lib/timesheets-ui/ColorPicker.js +52 -0
  199. package/dist/modules/staff/lib/timesheets-ui/ColorPicker.js.map +7 -0
  200. package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +77 -0
  201. package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +7 -0
  202. package/dist/modules/staff/lib/timesheets-ui/ListView.js +173 -0
  203. package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +7 -0
  204. package/dist/modules/staff/lib/timesheets-ui/ProjectColorDot.js +32 -0
  205. package/dist/modules/staff/lib/timesheets-ui/ProjectColorDot.js.map +7 -0
  206. package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +270 -0
  207. package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +7 -0
  208. package/dist/modules/staff/lib/timesheets-ui/ViewSwitcher.js +57 -0
  209. package/dist/modules/staff/lib/timesheets-ui/ViewSwitcher.js.map +7 -0
  210. package/dist/modules/staff/lib/timesheets-ui/colors.js +43 -0
  211. package/dist/modules/staff/lib/timesheets-ui/colors.js.map +7 -0
  212. package/dist/modules/staff/migrations/Migration20260326135612.js +24 -0
  213. package/dist/modules/staff/migrations/Migration20260326135612.js.map +7 -0
  214. package/dist/modules/staff/migrations/Migration20260413102715.js +23 -0
  215. package/dist/modules/staff/migrations/Migration20260413102715.js.map +7 -0
  216. package/dist/modules/staff/migrations/Migration20260413111602.js +13 -0
  217. package/dist/modules/staff/migrations/Migration20260413111602.js.map +7 -0
  218. package/dist/modules/staff/migrations/Migration20260511112759.js +19 -0
  219. package/dist/modules/staff/migrations/Migration20260511112759.js.map +7 -0
  220. package/dist/modules/staff/search.js +35 -0
  221. package/dist/modules/staff/search.js.map +2 -2
  222. package/dist/modules/staff/setup.js +15 -1
  223. package/dist/modules/staff/setup.js.map +2 -2
  224. package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.js +16 -0
  225. package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.js.map +7 -0
  226. package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js +126 -0
  227. package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.js.map +7 -0
  228. package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.js +26 -0
  229. package/dist/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.js.map +7 -0
  230. package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/config.js +15 -0
  231. package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/config.js.map +7 -0
  232. package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js +238 -0
  233. package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.js.map +7 -0
  234. package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.js +26 -0
  235. package/dist/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.js.map +7 -0
  236. package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +145 -0
  237. package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +7 -0
  238. package/dist/modules/staff/widgets/injection-table.js +12 -0
  239. package/dist/modules/staff/widgets/injection-table.js.map +7 -0
  240. package/dist/modules/sync_excel/api/import/route.js +19 -17
  241. package/dist/modules/sync_excel/api/import/route.js.map +2 -2
  242. package/dist/modules/translations/commands/translations.js +22 -19
  243. package/dist/modules/translations/commands/translations.js.map +2 -2
  244. package/generated/entities/staff_time_entry/index.ts +17 -0
  245. package/generated/entities/staff_time_entry_segment/index.ts +10 -0
  246. package/generated/entities/staff_time_project/index.ts +16 -0
  247. package/generated/entities/staff_time_project_member/index.ts +13 -0
  248. package/generated/entities.ids.generated.ts +5 -1
  249. package/generated/entity-fields-registry.ts +64 -0
  250. package/package.json +7 -7
  251. package/src/helpers/integration/timesheetFixtures.ts +61 -0
  252. package/src/modules/attachments/api/library/[id]/route.ts +24 -17
  253. package/src/modules/attachments/api/route.ts +20 -14
  254. package/src/modules/auth/api/roles/acl/route.ts +11 -5
  255. package/src/modules/auth/api/sidebar/preferences/route.ts +33 -24
  256. package/src/modules/auth/api/users/acl/route.ts +17 -12
  257. package/src/modules/auth/commands/users.ts +96 -80
  258. package/src/modules/auth/services/sidebarPreferencesService.ts +40 -32
  259. package/src/modules/catalog/commands/categories.ts +61 -12
  260. package/src/modules/catalog/commands/products.ts +93 -60
  261. package/src/modules/catalog/commands/variants.ts +29 -16
  262. package/src/modules/currencies/commands/currencies.ts +27 -14
  263. package/src/modules/customer_accounts/api/admin/users.ts +31 -26
  264. package/src/modules/customer_accounts/api/password/reset-confirm.ts +5 -6
  265. package/src/modules/customer_accounts/api/portal/users/[id]/roles.ts +14 -13
  266. package/src/modules/customers/commands/addresses.ts +35 -23
  267. package/src/modules/customers/commands/companies.ts +166 -165
  268. package/src/modules/customers/commands/deals.ts +2 -4
  269. package/src/modules/customers/commands/interactions.ts +20 -26
  270. package/src/modules/customers/commands/people.ts +18 -15
  271. package/src/modules/customers/commands/personCompanyLinks.ts +109 -100
  272. package/src/modules/customers/commands/pipeline-stages.ts +31 -27
  273. package/src/modules/customers/commands/pipelines.ts +29 -23
  274. package/src/modules/customers/commands/tags.ts +13 -5
  275. package/src/modules/dashboards/api/users/widgets/route.ts +0 -1
  276. package/src/modules/dashboards/api/widgets/data/route.ts +36 -1
  277. package/src/modules/data_sync/lib/sync-engine.ts +4 -5
  278. package/src/modules/data_sync/lib/sync-run-service.ts +57 -28
  279. package/src/modules/directory/commands/organizations.ts +203 -166
  280. package/src/modules/inbox_ops/api/emails/[id]/reprocess/route.ts +26 -18
  281. package/src/modules/messages/commands/messages.ts +82 -80
  282. package/src/modules/messages/commands/shared.ts +138 -133
  283. package/src/modules/perspectives/api/[tableId]/route.ts +38 -27
  284. package/src/modules/resources/commands/resources.ts +127 -117
  285. package/src/modules/resources/commands/tags.ts +7 -3
  286. package/src/modules/sales/api/quotes/send/route.ts +17 -12
  287. package/src/modules/sales/commands/documents.ts +673 -481
  288. package/src/modules/sales/commands/payments.ts +158 -152
  289. package/src/modules/sales/commands/returns.ts +74 -63
  290. package/src/modules/staff/acl.ts +11 -0
  291. package/src/modules/staff/analytics.ts +30 -0
  292. package/src/modules/staff/api/guards.ts +59 -0
  293. package/src/modules/staff/api/interceptors.ts +122 -0
  294. package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +191 -0
  295. package/src/modules/staff/api/timesheets/my-projects/route.ts +115 -0
  296. package/src/modules/staff/api/timesheets/projects/kpis/route.ts +159 -0
  297. package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +187 -0
  298. package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +191 -0
  299. package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +168 -0
  300. package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +191 -0
  301. package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +292 -0
  302. package/src/modules/staff/api/timesheets/time-entries/route.ts +193 -0
  303. package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +167 -0
  304. package/src/modules/staff/api/timesheets/time-projects/route.ts +244 -0
  305. package/src/modules/staff/backend/staff/timesheets/page.meta.ts +20 -0
  306. package/src/modules/staff/backend/staff/timesheets/page.tsx +899 -0
  307. package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +12 -0
  308. package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +141 -0
  309. package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +12 -0
  310. package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +579 -0
  311. package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +12 -0
  312. package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +90 -0
  313. package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +23 -0
  314. package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +765 -0
  315. package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +138 -0
  316. package/src/modules/staff/cli.ts +40 -1
  317. package/src/modules/staff/commands/index.ts +2 -0
  318. package/src/modules/staff/commands/leave-requests.ts +37 -29
  319. package/src/modules/staff/commands/team-members.ts +25 -20
  320. package/src/modules/staff/commands/timesheets-entries.ts +504 -0
  321. package/src/modules/staff/commands/timesheets-projects.ts +699 -0
  322. package/src/modules/staff/data/enrichers.ts +134 -0
  323. package/src/modules/staff/data/entities.ts +198 -0
  324. package/src/modules/staff/data/validators.ts +129 -0
  325. package/src/modules/staff/events.ts +13 -0
  326. package/src/modules/staff/i18n/de.json +209 -1
  327. package/src/modules/staff/i18n/en.json +209 -1
  328. package/src/modules/staff/i18n/es.json +209 -1
  329. package/src/modules/staff/i18n/pl.json +209 -1
  330. package/src/modules/staff/lib/crud.ts +8 -0
  331. package/src/modules/staff/lib/staffMemberResolver.ts +22 -0
  332. package/src/modules/staff/lib/timesheets-projects/computeProjectHoursTrend.ts +89 -0
  333. package/src/modules/staff/lib/timesheets-projects/computeProjectsKpis.ts +311 -0
  334. package/src/modules/staff/lib/timesheets-projects/dateBuckets.ts +37 -0
  335. package/src/modules/staff/lib/timesheets-projects/initials.ts +6 -0
  336. package/src/modules/staff/lib/timesheets-projects/kpiMath.ts +8 -0
  337. package/src/modules/staff/lib/timesheets-projects/listProjectMembersPreview.ts +83 -0
  338. package/src/modules/staff/lib/timesheets-projects-ui/HoursSparkline.tsx +75 -0
  339. package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +110 -0
  340. package/src/modules/staff/lib/timesheets-projects-ui/ProjectMembersAvatarStack.tsx +73 -0
  341. package/src/modules/staff/lib/timesheets-projects-ui/ProjectsKpiStrip.tsx +185 -0
  342. package/src/modules/staff/lib/timesheets-projects-ui/SavedViewTabs.tsx +53 -0
  343. package/src/modules/staff/lib/timesheets-projects-ui/ViewModeToggle.tsx +63 -0
  344. package/src/modules/staff/lib/timesheets-projects-ui/useProjectsViewMode.ts +63 -0
  345. package/src/modules/staff/lib/timesheets-ui/AddRowDropdown.tsx +188 -0
  346. package/src/modules/staff/lib/timesheets-ui/CalendarPicker.tsx +229 -0
  347. package/src/modules/staff/lib/timesheets-ui/ColorPicker.tsx +65 -0
  348. package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +99 -0
  349. package/src/modules/staff/lib/timesheets-ui/ListView.tsx +230 -0
  350. package/src/modules/staff/lib/timesheets-ui/ProjectColorDot.tsx +40 -0
  351. package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +327 -0
  352. package/src/modules/staff/lib/timesheets-ui/ViewSwitcher.tsx +60 -0
  353. package/src/modules/staff/lib/timesheets-ui/colors.ts +58 -0
  354. package/src/modules/staff/migrations/.snapshot-open-mercato.json +1148 -0
  355. package/src/modules/staff/migrations/Migration20260326135612.ts +26 -0
  356. package/src/modules/staff/migrations/Migration20260413102715.ts +25 -0
  357. package/src/modules/staff/migrations/Migration20260413111602.ts +13 -0
  358. package/src/modules/staff/migrations/Migration20260511112759.ts +21 -0
  359. package/src/modules/staff/search.ts +35 -0
  360. package/src/modules/staff/setup.ts +15 -0
  361. package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/config.ts +17 -0
  362. package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.client.tsx +158 -0
  363. package/src/modules/staff/widgets/dashboard/timesheets-hours-by-project/widget.ts +25 -0
  364. package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/config.ts +15 -0
  365. package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.client.tsx +297 -0
  366. package/src/modules/staff/widgets/dashboard/timesheets-time-reporting/widget.ts +25 -0
  367. package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +161 -0
  368. package/src/modules/staff/widgets/injection-table.ts +10 -0
  369. package/src/modules/sync_excel/api/import/route.ts +23 -18
  370. package/src/modules/translations/commands/translations.ts +49 -41
@@ -11,6 +11,7 @@ import {
11
11
  diffCustomFieldChanges
12
12
  } from "@open-mercato/shared/lib/commands/customFieldSnapshots";
13
13
  import { extractUndoPayload } from "@open-mercato/shared/lib/commands/undo";
14
+ import { withAtomicFlush } from "@open-mercato/shared/lib/commands/flush";
14
15
  import {
15
16
  parseWithCustomFields,
16
17
  setCustomFieldsIfAny,
@@ -225,32 +226,38 @@ const createOrganizationCommand = {
225
226
  const baseSlug = parsed.slug ? parsed.slug : slugify(parsed.name);
226
227
  const slug = baseSlug ? await resolveUniqueSlug(em, tenantId, baseSlug) : null;
227
228
  const de = ctx.container.resolve("dataEngine");
228
- const organization = await de.createOrmEntity({
229
- entity: Organization,
230
- data: {
231
- tenant: tenantRef,
232
- name: parsed.name,
233
- slug,
234
- isActive: parsed.isActive ?? true,
235
- parentId
229
+ let organization;
230
+ await withAtomicFlush(em, [
231
+ async () => {
232
+ organization = await de.createOrmEntity({
233
+ entity: Organization,
234
+ data: {
235
+ tenant: tenantRef,
236
+ name: parsed.name,
237
+ slug,
238
+ isActive: parsed.isActive ?? true,
239
+ parentId
240
+ }
241
+ });
242
+ setInternalTenantId(organization, tenantId);
243
+ const recordId2 = String(organization.id);
244
+ if (childIds.length) {
245
+ await assignChildren(em, tenantId, recordId2, childIds);
246
+ }
247
+ const childParentsAfter = await loadChildParentSnapshots(em, tenantId, childIds);
248
+ setUndoMeta(organization, { childParentsBefore, childParentsAfter });
249
+ await setCustomFieldsIfAny({
250
+ dataEngine: de,
251
+ entityId: E.directory.organization,
252
+ recordId: recordId2,
253
+ tenantId,
254
+ organizationId: recordId2,
255
+ values: custom
256
+ });
257
+ await rebuildHierarchyForTenant(em, tenantId);
236
258
  }
237
- });
238
- setInternalTenantId(organization, tenantId);
259
+ ], { transaction: true });
239
260
  const recordId = String(organization.id);
240
- if (childIds.length) {
241
- await assignChildren(em, tenantId, recordId, childIds);
242
- }
243
- const childParentsAfter = await loadChildParentSnapshots(em, tenantId, childIds);
244
- setUndoMeta(organization, { childParentsBefore, childParentsAfter });
245
- await setCustomFieldsIfAny({
246
- dataEngine: de,
247
- entityId: E.directory.organization,
248
- recordId,
249
- tenantId,
250
- organizationId: recordId,
251
- values: custom
252
- });
253
- await rebuildHierarchyForTenant(em, tenantId);
254
261
  const identifiers = { id: recordId, organizationId: recordId, tenantId };
255
262
  await emitCrudSideEffects({
256
263
  dataEngine: de,
@@ -308,27 +315,31 @@ const createOrganizationCommand = {
308
315
  if (!tenantId) return;
309
316
  const em = ctx.container.resolve("em");
310
317
  const de = ctx.container.resolve("dataEngine");
311
- await restoreChildParents(em, tenantId, childrenBefore);
312
- if (after.custom && Object.keys(after.custom).length) {
313
- const reset = buildCustomFieldResetMap(void 0, after.custom);
314
- if (Object.keys(reset).length) {
315
- const resetValues = reset;
316
- await de.setCustomFields({
317
- entityId: E.directory.organization,
318
- recordId: after.id,
319
- tenantId,
320
- organizationId: after.id,
321
- values: resetValues,
322
- notify: false
318
+ await withAtomicFlush(em, [
319
+ async () => {
320
+ await restoreChildParents(em, tenantId, childrenBefore);
321
+ if (after.custom && Object.keys(after.custom).length) {
322
+ const reset = buildCustomFieldResetMap(void 0, after.custom);
323
+ if (Object.keys(reset).length) {
324
+ const resetValues = reset;
325
+ await de.setCustomFields({
326
+ entityId: E.directory.organization,
327
+ recordId: after.id,
328
+ tenantId,
329
+ organizationId: after.id,
330
+ values: resetValues,
331
+ notify: false
332
+ });
333
+ }
334
+ }
335
+ await de.deleteOrmEntity({
336
+ entity: Organization,
337
+ where: { id: after.id, deletedAt: null },
338
+ soft: false
323
339
  });
340
+ await rebuildHierarchyForTenant(em, tenantId);
324
341
  }
325
- }
326
- await de.deleteOrmEntity({
327
- entity: Organization,
328
- where: { id: after.id, deletedAt: null },
329
- soft: false
330
- });
331
- await rebuildHierarchyForTenant(em, tenantId);
342
+ ], { transaction: true });
332
343
  }
333
344
  };
334
345
  const updateOrganizationCommand = {
@@ -395,43 +406,50 @@ const updateOrganizationCommand = {
395
406
  resolvedSlug = parsed.slug ? await resolveUniqueSlug(em, tenantId, parsed.slug, parsed.id) : parsed.slug;
396
407
  }
397
408
  const de = ctx.container.resolve("dataEngine");
398
- const organization = await de.updateOrmEntity({
399
- entity: Organization,
400
- where: { id: parsed.id, deletedAt: null },
401
- apply: (entity) => {
402
- if (parsed.name !== void 0) entity.name = parsed.name;
403
- if (resolvedSlug !== void 0) entity.slug = resolvedSlug;
404
- if (parsed.isActive !== void 0) entity.isActive = parsed.isActive;
405
- entity.parentId = parentId;
409
+ let resolvedOrganization;
410
+ await withAtomicFlush(em, [
411
+ async () => {
412
+ const organization = await de.updateOrmEntity({
413
+ entity: Organization,
414
+ where: { id: parsed.id, deletedAt: null },
415
+ apply: (entity) => {
416
+ if (parsed.name !== void 0) entity.name = parsed.name;
417
+ if (resolvedSlug !== void 0) entity.slug = resolvedSlug;
418
+ if (parsed.isActive !== void 0) entity.isActive = parsed.isActive;
419
+ entity.parentId = parentId;
420
+ }
421
+ });
422
+ if (!organization) throw new CrudHttpError(404, { error: "Not found" });
423
+ setInternalTenantId(organization, tenantId);
424
+ const recordId2 = String(organization.id);
425
+ const desiredChildIds = new Set(normalizedChildIds.filter((id) => id !== recordId2));
426
+ await clearRemovedChildren(em, tenantId, recordId2, desiredChildIds);
427
+ await assignChildren(em, tenantId, recordId2, desiredChildIds);
428
+ const childParentsAfter = await loadChildParentSnapshots(em, tenantId, combinedChildIds);
429
+ setUndoMeta(organization, { childParentsBefore, childParentsAfter });
430
+ await setCustomFieldsIfAny({
431
+ dataEngine: de,
432
+ entityId: E.directory.organization,
433
+ recordId: recordId2,
434
+ tenantId,
435
+ organizationId: recordId2,
436
+ values: custom
437
+ });
438
+ await rebuildHierarchyForTenant(em, tenantId);
439
+ resolvedOrganization = organization;
406
440
  }
407
- });
408
- if (!organization) throw new CrudHttpError(404, { error: "Not found" });
409
- setInternalTenantId(organization, tenantId);
410
- const recordId = String(organization.id);
411
- const desiredChildIds = new Set(normalizedChildIds.filter((id) => id !== recordId));
412
- await clearRemovedChildren(em, tenantId, recordId, desiredChildIds);
413
- await assignChildren(em, tenantId, recordId, desiredChildIds);
414
- const childParentsAfter = await loadChildParentSnapshots(em, tenantId, combinedChildIds);
415
- setUndoMeta(organization, { childParentsBefore, childParentsAfter });
416
- await setCustomFieldsIfAny({
417
- dataEngine: de,
418
- entityId: E.directory.organization,
419
- recordId,
420
- tenantId,
421
- organizationId: recordId,
422
- values: custom
423
- });
424
- await rebuildHierarchyForTenant(em, tenantId);
441
+ ], { transaction: true });
442
+ const recordId = String(resolvedOrganization.id);
425
443
  const identifiers = { id: recordId, organizationId: recordId, tenantId };
426
444
  await emitCrudSideEffects({
427
445
  dataEngine: de,
428
446
  action: "updated",
429
- entity: organization,
447
+ entity: resolvedOrganization,
430
448
  identifiers,
431
449
  events: organizationCrudEvents,
432
450
  indexer: organizationCrudIndexer
433
451
  });
434
- return organization;
452
+ return resolvedOrganization;
435
453
  },
436
454
  captureAfter: async (_input, result, ctx) => {
437
455
  const em = ctx.container.resolve("em").fork();
@@ -486,34 +504,39 @@ const updateOrganizationCommand = {
486
504
  if (!tenantId) return;
487
505
  const em = ctx.container.resolve("em");
488
506
  const de = ctx.container.resolve("dataEngine");
489
- const updated = await de.updateOrmEntity({
490
- entity: Organization,
491
- where: { id: before.id },
492
- apply: (entity) => {
493
- entity.name = before.name;
494
- if (before.slug !== void 0) entity.slug = before.slug;
495
- entity.isActive = before.isActive;
496
- entity.parentId = before.parentId;
507
+ let updated = null;
508
+ await withAtomicFlush(em, [
509
+ async () => {
510
+ updated = await de.updateOrmEntity({
511
+ entity: Organization,
512
+ where: { id: before.id },
513
+ apply: (entity) => {
514
+ entity.name = before.name;
515
+ if (before.slug !== void 0) entity.slug = before.slug;
516
+ entity.isActive = before.isActive;
517
+ entity.parentId = before.parentId;
518
+ }
519
+ });
520
+ if (updated && tenantId) {
521
+ setInternalTenantId(updated, tenantId);
522
+ }
523
+ const reset = buildCustomFieldResetMap(before.custom, after?.custom);
524
+ if (Object.keys(reset).length) {
525
+ const resetValues = reset;
526
+ await de.setCustomFields({
527
+ entityId: E.directory.organization,
528
+ recordId: before.id,
529
+ tenantId,
530
+ organizationId: before.id,
531
+ values: resetValues,
532
+ notify: false
533
+ });
534
+ }
535
+ const childSnapshots = before.childParents;
536
+ await restoreChildParents(em, tenantId, childSnapshots);
537
+ await rebuildHierarchyForTenant(em, tenantId);
497
538
  }
498
- });
499
- if (updated && tenantId) {
500
- setInternalTenantId(updated, tenantId);
501
- }
502
- const reset = buildCustomFieldResetMap(before.custom, after?.custom);
503
- if (Object.keys(reset).length) {
504
- const resetValues = reset;
505
- await de.setCustomFields({
506
- entityId: E.directory.organization,
507
- recordId: before.id,
508
- tenantId,
509
- organizationId: before.id,
510
- values: resetValues,
511
- notify: false
512
- });
513
- }
514
- const childSnapshots = before.childParents;
515
- await restoreChildParents(em, tenantId, childSnapshots);
516
- await rebuildHierarchyForTenant(em, tenantId);
539
+ ], { transaction: true });
517
540
  await emitCrudUndoSideEffects({
518
541
  dataEngine: de,
519
542
  action: "updated",
@@ -559,37 +582,43 @@ const deleteOrganizationCommand = {
559
582
  Array.isArray(existing.childIds) ? existing.childIds : []
560
583
  );
561
584
  const de = ctx.container.resolve("dataEngine");
562
- const deleted = await de.deleteOrmEntity({
563
- entity: Organization,
564
- where: { id, deletedAt: null },
565
- soft: true,
566
- softDeleteField: "deletedAt"
567
- });
568
- if (!deleted) throw new CrudHttpError(404, { error: "Not found" });
569
- setInternalTenantId(deleted, tenantId);
570
- deleted.isActive = false;
571
- deleted.parentId = null;
572
- const childrenFilter = { tenant: tenantId, parentId: id, deletedAt: null };
573
- const children = await em.find(Organization, childrenFilter);
574
- const toPersist = [];
575
- for (const child of children) {
576
- child.parentId = parentId;
577
- toPersist.push(child);
578
- }
579
- toPersist.push(deleted);
580
- if (toPersist.length) await em.persist(toPersist).flush();
581
- setUndoMeta(deleted, { childParentsBefore: childSnapshotsBefore });
582
- await rebuildHierarchyForTenant(em, tenantId);
585
+ let resolvedDeleted;
586
+ await withAtomicFlush(em, [
587
+ async () => {
588
+ const deleted = await de.deleteOrmEntity({
589
+ entity: Organization,
590
+ where: { id, deletedAt: null },
591
+ soft: true,
592
+ softDeleteField: "deletedAt"
593
+ });
594
+ if (!deleted) throw new CrudHttpError(404, { error: "Not found" });
595
+ setInternalTenantId(deleted, tenantId);
596
+ deleted.isActive = false;
597
+ deleted.parentId = null;
598
+ const childrenFilter = { tenant: tenantId, parentId: id, deletedAt: null };
599
+ const children = await em.find(Organization, childrenFilter);
600
+ const toPersist = [];
601
+ for (const child of children) {
602
+ child.parentId = parentId;
603
+ toPersist.push(child);
604
+ }
605
+ toPersist.push(deleted);
606
+ if (toPersist.length) await em.persist(toPersist).flush();
607
+ setUndoMeta(deleted, { childParentsBefore: childSnapshotsBefore });
608
+ await rebuildHierarchyForTenant(em, tenantId);
609
+ resolvedDeleted = deleted;
610
+ }
611
+ ], { transaction: true });
583
612
  const identifiers = { id, organizationId: id, tenantId };
584
613
  await emitCrudSideEffects({
585
614
  dataEngine: de,
586
615
  action: "deleted",
587
- entity: deleted,
616
+ entity: resolvedDeleted,
588
617
  identifiers,
589
618
  events: organizationCrudEvents,
590
619
  indexer: organizationCrudIndexer
591
620
  });
592
- return deleted;
621
+ return resolvedDeleted;
593
622
  },
594
623
  buildLog: async ({ snapshots, input, ctx }) => {
595
624
  const { translate } = await resolveTranslations();
@@ -620,45 +649,50 @@ const deleteOrganizationCommand = {
620
649
  if (!tenantId) return;
621
650
  const em = ctx.container.resolve("em");
622
651
  const de = ctx.container.resolve("dataEngine");
623
- let organization = await em.findOne(Organization, { id: before.id });
624
- if (organization) {
625
- organization.deletedAt = null;
626
- organization.isActive = before.isActive;
627
- organization.name = before.name;
628
- if (before.slug !== void 0) organization.slug = before.slug;
629
- organization.parentId = before.parentId;
630
- await em.flush();
631
- if (tenantId) setInternalTenantId(organization, tenantId);
632
- } else {
633
- organization = await de.createOrmEntity({
634
- entity: Organization,
635
- data: {
636
- id: before.id,
637
- name: before.name,
638
- slug: before.slug ?? null,
639
- tenant: tenantId ? em.getReference(Tenant, tenantId) : void 0,
640
- isActive: before.isActive,
641
- parentId: before.parentId
652
+ let organization = null;
653
+ await withAtomicFlush(em, [
654
+ async () => {
655
+ organization = await em.findOne(Organization, { id: before.id });
656
+ if (organization) {
657
+ organization.deletedAt = null;
658
+ organization.isActive = before.isActive;
659
+ organization.name = before.name;
660
+ if (before.slug !== void 0) organization.slug = before.slug;
661
+ organization.parentId = before.parentId;
662
+ await em.flush();
663
+ if (tenantId) setInternalTenantId(organization, tenantId);
664
+ } else {
665
+ organization = await de.createOrmEntity({
666
+ entity: Organization,
667
+ data: {
668
+ id: before.id,
669
+ name: before.name,
670
+ slug: before.slug ?? null,
671
+ tenant: tenantId ? em.getReference(Tenant, tenantId) : void 0,
672
+ isActive: before.isActive,
673
+ parentId: before.parentId
674
+ }
675
+ });
676
+ if (tenantId) setInternalTenantId(organization, tenantId);
642
677
  }
643
- });
644
- if (tenantId) setInternalTenantId(organization, tenantId);
645
- }
646
- if (tenantId) {
647
- const customValues = buildCustomFieldResetMap(before.custom, void 0);
648
- if (Object.keys(customValues).length) {
649
- const resetValues = customValues;
650
- await de.setCustomFields({
651
- entityId: E.directory.organization,
652
- recordId: before.id,
653
- tenantId,
654
- organizationId: before.id,
655
- values: resetValues,
656
- notify: false
657
- });
678
+ if (tenantId) {
679
+ const customValues = buildCustomFieldResetMap(before.custom, void 0);
680
+ if (Object.keys(customValues).length) {
681
+ const resetValues = customValues;
682
+ await de.setCustomFields({
683
+ entityId: E.directory.organization,
684
+ recordId: before.id,
685
+ tenantId,
686
+ organizationId: before.id,
687
+ values: resetValues,
688
+ notify: false
689
+ });
690
+ }
691
+ }
692
+ await restoreChildParents(em, tenantId, before.childParents);
693
+ await rebuildHierarchyForTenant(em, tenantId);
658
694
  }
659
- }
660
- await restoreChildParents(em, tenantId, before.childParents);
661
- await rebuildHierarchyForTenant(em, tenantId);
695
+ ], { transaction: true });
662
696
  await emitCrudUndoSideEffects({
663
697
  dataEngine: de,
664
698
  action: "updated",