@hed-hog/operations 0.0.304 → 0.0.306

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 (81) hide show
  1. package/dist/controllers/operations-projects.controller.d.ts +15 -0
  2. package/dist/controllers/operations-projects.controller.d.ts.map +1 -1
  3. package/dist/controllers/operations-tasks.controller.d.ts +41 -10
  4. package/dist/controllers/operations-tasks.controller.d.ts.map +1 -1
  5. package/dist/controllers/operations-tasks.controller.js +11 -0
  6. package/dist/controllers/operations-tasks.controller.js.map +1 -1
  7. package/dist/controllers/operations-timesheets.controller.d.ts +21 -0
  8. package/dist/controllers/operations-timesheets.controller.d.ts.map +1 -1
  9. package/dist/controllers/operations-timesheets.controller.js +12 -0
  10. package/dist/controllers/operations-timesheets.controller.js.map +1 -1
  11. package/dist/dto/create-task.dto.d.ts +7 -1
  12. package/dist/dto/create-task.dto.d.ts.map +1 -1
  13. package/dist/dto/create-task.dto.js +38 -5
  14. package/dist/dto/create-task.dto.js.map +1 -1
  15. package/dist/dto/list-tasks.dto.d.ts +1 -1
  16. package/dist/dto/list-tasks.dto.d.ts.map +1 -1
  17. package/dist/dto/list-tasks.dto.js +2 -2
  18. package/dist/dto/list-tasks.dto.js.map +1 -1
  19. package/dist/dto/update-collaborator-type.dto.d.ts +3 -1
  20. package/dist/dto/update-collaborator-type.dto.d.ts.map +1 -1
  21. package/dist/dto/update-collaborator-type.dto.js +2 -1
  22. package/dist/dto/update-collaborator-type.dto.js.map +1 -1
  23. package/dist/dto/update-task.dto.d.ts +7 -1
  24. package/dist/dto/update-task.dto.d.ts.map +1 -1
  25. package/dist/dto/update-task.dto.js +38 -5
  26. package/dist/dto/update-task.dto.js.map +1 -1
  27. package/dist/operations.service.d.ts +90 -12
  28. package/dist/operations.service.d.ts.map +1 -1
  29. package/dist/operations.service.js +560 -148
  30. package/dist/operations.service.js.map +1 -1
  31. package/dist/operations.service.spec.js +73 -0
  32. package/dist/operations.service.spec.js.map +1 -1
  33. package/hedhog/data/menu.yaml +26 -26
  34. package/hedhog/data/operations_collaborator_type.yaml +76 -76
  35. package/hedhog/data/route.yaml +26 -0
  36. package/hedhog/frontend/app/_components/async-options-combobox.tsx.ejs +5 -3
  37. package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +44 -44
  38. package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +168 -213
  39. package/hedhog/frontend/app/_components/collaborator-select-with-create.tsx.ejs +256 -256
  40. package/hedhog/frontend/app/_components/contract-form-screen.tsx.ejs +7 -7
  41. package/hedhog/frontend/app/_components/contract-template-form-screen.tsx.ejs +306 -306
  42. package/hedhog/frontend/app/_components/contract-template-select-with-create.tsx.ejs +247 -247
  43. package/hedhog/frontend/app/_components/contract-wizard-sheet.tsx.ejs +3520 -3520
  44. package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +1504 -52
  45. package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +528 -403
  46. package/hedhog/frontend/app/_components/section-card.tsx.ejs +25 -18
  47. package/hedhog/frontend/app/_components/system-user-select-with-create.tsx.ejs +609 -0
  48. package/hedhog/frontend/app/_components/timesheet-task-create-sheet.tsx.ejs +1 -0
  49. package/hedhog/frontend/app/_lib/types.ts.ejs +5 -0
  50. package/hedhog/frontend/app/_lib/utils/format.ts.ejs +7 -7
  51. package/hedhog/frontend/app/_lib/utils/forms.ts.ejs +48 -1
  52. package/hedhog/frontend/app/approvals/page.tsx.ejs +2 -2
  53. package/hedhog/frontend/app/collaborator-types/page.tsx.ejs +513 -502
  54. package/hedhog/frontend/app/collaborators/page.tsx.ejs +10 -7
  55. package/hedhog/frontend/app/contracts/page.tsx.ejs +938 -938
  56. package/hedhog/frontend/app/projects/[id]/edit/page.tsx.ejs +1 -1
  57. package/hedhog/frontend/app/projects/page.tsx.ejs +360 -133
  58. package/hedhog/frontend/app/schedule-adjustments/page.tsx.ejs +235 -72
  59. package/hedhog/frontend/app/timesheets/page.tsx.ejs +344 -134
  60. package/hedhog/frontend/messages/en.json +32 -4
  61. package/hedhog/frontend/messages/pt.json +34 -6
  62. package/hedhog/table/operations_collaborator.yaml +18 -18
  63. package/hedhog/table/operations_collaborator_equity_participation.yaml +43 -43
  64. package/hedhog/table/operations_collaborator_type.yaml +33 -33
  65. package/hedhog/table/operations_contract_document.yaml +33 -33
  66. package/hedhog/table/operations_project.yaml +9 -0
  67. package/hedhog/table/operations_task.yaml +43 -4
  68. package/package.json +6 -6
  69. package/src/controllers/operations-tasks.controller.ts +11 -0
  70. package/src/controllers/operations-timesheets.controller.ts +13 -0
  71. package/src/dto/create-collaborator-type.dto.ts +43 -43
  72. package/src/dto/create-collaborator.dto.ts +223 -223
  73. package/src/dto/create-task.dto.ts +47 -7
  74. package/src/dto/list-collaborator-types.dto.ts +15 -15
  75. package/src/dto/list-collaborators.dto.ts +30 -30
  76. package/src/dto/list-tasks.dto.ts +3 -3
  77. package/src/dto/update-collaborator-type.dto.ts +4 -3
  78. package/src/dto/update-collaborator.dto.ts +3 -3
  79. package/src/dto/update-task.dto.ts +47 -7
  80. package/src/operations.service.spec.ts +96 -0
  81. package/src/operations.service.ts +813 -135
@@ -20,7 +20,7 @@ function resolveLocale(currentLocaleCode: string) {
20
20
  export function formatDate(
21
21
  value?: string | null,
22
22
  getSettingValue?: ((key: string) => unknown) | null,
23
- currentLocaleCode = 'en-US'
23
+ currentLocaleCode = 'pt-BR'
24
24
  ) {
25
25
  if (!value) {
26
26
  return '-';
@@ -47,8 +47,8 @@ export function formatDate(
47
47
  }
48
48
 
49
49
  return parsedDate.toLocaleDateString(resolveLocale(currentLocaleCode), {
50
- month: 'short',
51
- day: 'numeric',
50
+ day: '2-digit',
51
+ month: '2-digit',
52
52
  year: 'numeric',
53
53
  });
54
54
  }
@@ -56,7 +56,7 @@ export function formatDate(
56
56
  export function formatDateTime(
57
57
  value?: string | null,
58
58
  getSettingValue?: ((key: string) => unknown) | null,
59
- currentLocaleCode = 'en-US'
59
+ currentLocaleCode = 'pt-BR'
60
60
  ) {
61
61
  if (!value) {
62
62
  return '-';
@@ -81,8 +81,8 @@ export function formatDateTime(
81
81
  }
82
82
 
83
83
  return parsedDate.toLocaleString(resolveLocale(currentLocaleCode), {
84
- month: 'short',
85
- day: 'numeric',
84
+ day: '2-digit',
85
+ month: '2-digit',
86
86
  year: 'numeric',
87
87
  hour: '2-digit',
88
88
  minute: '2-digit',
@@ -169,7 +169,7 @@ export function formatDateRange(
169
169
  startDate?: string | null,
170
170
  endDate?: string | null,
171
171
  getSettingValue?: ((key: string) => unknown) | null,
172
- currentLocaleCode = 'en-US'
172
+ currentLocaleCode = 'pt-BR'
173
173
  ) {
174
174
  if (!startDate && !endDate) {
175
175
  return '-';
@@ -4,10 +4,57 @@ export function parseNumberInput(value: string) {
4
4
  return null;
5
5
  }
6
6
 
7
- const parsed = Number(trimmed);
7
+ const normalized = /[.,]/.test(trimmed)
8
+ ? trimmed.replace(/\./g, '').replace(',', '.')
9
+ : trimmed;
10
+
11
+ const parsed = Number(normalized);
8
12
  return Number.isFinite(parsed) ? parsed : null;
9
13
  }
10
14
 
15
+ export function normalizePercentInput(value: string) {
16
+ const trimmed = value.trim();
17
+
18
+ if (!trimmed) {
19
+ return '';
20
+ }
21
+
22
+ const withNormalizedSeparator = trimmed.replace(/,/g, '.');
23
+ const digitsAndSeparatorsOnly = withNormalizedSeparator.replace(
24
+ /[^0-9.]/g,
25
+ ''
26
+ );
27
+
28
+ if (!digitsAndSeparatorsOnly) {
29
+ return '';
30
+ }
31
+
32
+ const separatorIndex = digitsAndSeparatorsOnly.indexOf('.');
33
+ const normalized =
34
+ separatorIndex === -1
35
+ ? digitsAndSeparatorsOnly
36
+ : `${digitsAndSeparatorsOnly.slice(0, separatorIndex + 1)}${digitsAndSeparatorsOnly
37
+ .slice(separatorIndex + 1)
38
+ .replace(/\./g, '')}`;
39
+
40
+ const prefixedValue = normalized.startsWith('.') ? `0${normalized}` : normalized;
41
+ const parsed = Number(prefixedValue);
42
+
43
+ if (!Number.isFinite(parsed)) {
44
+ return '';
45
+ }
46
+
47
+ if (parsed <= 0) {
48
+ return prefixedValue === '0.' ? prefixedValue : '0';
49
+ }
50
+
51
+ if (parsed >= 100) {
52
+ return '100';
53
+ }
54
+
55
+ return prefixedValue;
56
+ }
57
+
11
58
  export function trimToNull(value?: string | null) {
12
59
  const trimmed = value?.trim() ?? '';
13
60
  return trimmed ? trimmed : null;
@@ -22,8 +22,8 @@ import {
22
22
  import { Textarea } from '@/components/ui/textarea';
23
23
  import { useApp, useQuery } from '@hed-hog/next-app-provider';
24
24
  import { Check, ClipboardCheck, X } from 'lucide-react';
25
- import { useMemo, useState } from 'react';
26
25
  import { useTranslations } from 'next-intl';
26
+ import { useMemo, useState } from 'react';
27
27
  import { OperationsHeader } from '../_components/operations-header';
28
28
  import { StatusBadge } from '../_components/status-badge';
29
29
  import { fetchOperations } from '../_lib/api';
@@ -381,7 +381,7 @@ export default function OperationsApprovalsPage() {
381
381
  }
382
382
  }}
383
383
  >
384
- <DialogContent>
384
+ <DialogContent className="max-w-150">
385
385
  <DialogHeader>
386
386
  <DialogTitle>
387
387
  {pendingDecision?.action === 'approve'