@hed-hog/operations 0.0.3 → 0.0.286
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/README.md +122 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/operations-data.controller.d.ts +139 -0
- package/dist/operations-data.controller.d.ts.map +1 -0
- package/dist/operations-data.controller.js +113 -0
- package/dist/operations-data.controller.js.map +1 -0
- package/dist/operations-growth.controller.d.ts +48 -0
- package/dist/operations-growth.controller.d.ts.map +1 -0
- package/dist/operations-growth.controller.js +90 -0
- package/dist/operations-growth.controller.js.map +1 -0
- package/dist/operations.module.d.ts.map +1 -1
- package/dist/operations.module.js +10 -4
- package/dist/operations.module.js.map +1 -1
- package/dist/operations.service.d.ts +178 -0
- package/dist/operations.service.d.ts.map +1 -0
- package/dist/operations.service.js +134 -0
- package/dist/operations.service.js.map +1 -0
- package/hedhog/data/menu.yaml +251 -132
- package/hedhog/data/operations_career_level.yaml +102 -0
- package/hedhog/data/operations_career_track.yaml +8 -0
- package/hedhog/data/operations_certification.yaml +38 -0
- package/hedhog/data/operations_evaluation_cycle.yaml +18 -0
- package/hedhog/data/operations_performance_criterion.yaml +48 -0
- package/hedhog/data/role.yaml +14 -7
- package/hedhog/data/route.yaml +143 -80
- package/hedhog/frontend/app/_components/allocation-calendar.tsx.ejs +56 -56
- package/hedhog/frontend/app/_components/kanban-board.tsx.ejs +626 -83
- package/hedhog/frontend/app/_components/operations-header.tsx.ejs +29 -29
- package/hedhog/frontend/app/_components/section-card.tsx.ejs +32 -32
- package/hedhog/frontend/app/_components/status-badge.tsx.ejs +15 -15
- package/hedhog/frontend/app/_components/timesheet-entry-dialog.tsx.ejs +142 -142
- package/hedhog/frontend/app/_lib/hooks/use-operations-data.ts.ejs +41 -41
- package/hedhog/frontend/app/_lib/hooks/use-operations-growth-data.ts.ejs +63 -0
- package/hedhog/frontend/app/_lib/mocks/allocations.mock.ts.ejs +74 -74
- package/hedhog/frontend/app/_lib/mocks/contracts.mock.ts.ejs +74 -74
- package/hedhog/frontend/app/_lib/mocks/operations-growth.mock.ts.ejs +824 -0
- package/hedhog/frontend/app/_lib/mocks/projects.mock.ts.ejs +455 -60
- package/hedhog/frontend/app/_lib/mocks/tasks.mock.ts.ejs +117 -88
- package/hedhog/frontend/app/_lib/mocks/timesheets.mock.ts.ejs +84 -84
- package/hedhog/frontend/app/_lib/mocks/users.mock.ts.ejs +67 -67
- package/hedhog/frontend/app/_lib/services/contracts.service.ts.ejs +10 -10
- package/hedhog/frontend/app/_lib/services/operations-growth.service.ts.ejs +31 -0
- package/hedhog/frontend/app/_lib/services/projects.service.ts.ejs +10 -10
- package/hedhog/frontend/app/_lib/services/tasks.service.ts.ejs +10 -10
- package/hedhog/frontend/app/_lib/services/timesheets.service.ts.ejs +10 -10
- package/hedhog/frontend/app/_lib/types/operations-growth.ts.ejs +209 -0
- package/hedhog/frontend/app/_lib/types/operations.ts.ejs +156 -95
- package/hedhog/frontend/app/_lib/utils/format.ts.ejs +25 -25
- package/hedhog/frontend/app/_lib/utils/growth.ts.ejs +62 -0
- package/hedhog/frontend/app/_lib/utils/metrics.ts.ejs +103 -103
- package/hedhog/frontend/app/_lib/utils/status.ts.ejs +80 -80
- package/hedhog/frontend/app/allocations/page.tsx.ejs +155 -99
- package/hedhog/frontend/app/approvals/page.tsx.ejs +147 -147
- package/hedhog/frontend/app/career/page.tsx.ejs +143 -0
- package/hedhog/frontend/app/certifications/page.tsx.ejs +202 -0
- package/hedhog/frontend/app/contracts/[id]/page.tsx.ejs +108 -108
- package/hedhog/frontend/app/contracts/page.tsx.ejs +181 -124
- package/hedhog/frontend/app/evaluations/page.tsx.ejs +278 -0
- package/hedhog/frontend/app/goals/page.tsx.ejs +171 -0
- package/hedhog/frontend/app/growth/page.tsx.ejs +288 -0
- package/hedhog/frontend/app/layout.tsx.ejs +9 -9
- package/hedhog/frontend/app/manager/page.tsx.ejs +175 -0
- package/hedhog/frontend/app/page.tsx.ejs +177 -177
- package/hedhog/frontend/app/projects/[id]/page.tsx.ejs +936 -186
- package/hedhog/frontend/app/projects/page.tsx.ejs +1074 -111
- package/hedhog/frontend/app/rewards/page.tsx.ejs +196 -0
- package/hedhog/frontend/app/tasks/page.tsx.ejs +999 -47
- package/hedhog/frontend/app/timesheets/page.tsx.ejs +126 -126
- package/hedhog/frontend/messages/en.json +454 -142
- package/hedhog/frontend/messages/pt.json +454 -142
- package/hedhog/table/operations_allocation.yaml +52 -0
- package/hedhog/table/operations_calibration_item.yaml +61 -0
- package/hedhog/table/operations_calibration_session.yaml +25 -0
- package/hedhog/table/operations_career_level.yaml +75 -0
- package/hedhog/table/operations_career_track.yaml +21 -0
- package/hedhog/table/operations_certification.yaml +48 -0
- package/hedhog/table/operations_contract.yaml +57 -0
- package/hedhog/table/operations_employee.yaml +64 -0
- package/hedhog/table/operations_employee_certification.yaml +43 -0
- package/hedhog/table/operations_employee_connect.yaml +61 -0
- package/hedhog/table/operations_employee_evaluation.yaml +113 -0
- package/hedhog/table/operations_employee_evaluation_item.yaml +39 -0
- package/hedhog/table/operations_employee_profile.yaml +80 -0
- package/hedhog/table/operations_employee_skill_matrix.yaml +30 -0
- package/hedhog/table/operations_evaluation_cycle.yaml +31 -0
- package/hedhog/table/operations_goal.yaml +67 -0
- package/hedhog/table/operations_goal_progress.yaml +31 -0
- package/hedhog/table/operations_performance_criterion.yaml +29 -0
- package/hedhog/table/operations_project.yaml +66 -0
- package/hedhog/table/operations_promotion_readiness.yaml +49 -0
- package/hedhog/table/operations_promotion_recommendation.yaml +63 -0
- package/hedhog/table/operations_public_recognition.yaml +46 -0
- package/hedhog/table/operations_reward.yaml +100 -0
- package/hedhog/table/operations_score_event.yaml +81 -0
- package/hedhog/table/operations_task.yaml +60 -0
- package/hedhog/table/operations_timesheet.yaml +49 -0
- package/hedhog/table/operations_timesheet_entry.yaml +51 -0
- package/package.json +4 -4
- package/src/index.ts +2 -1
- package/src/language/en.json +8 -8
- package/src/language/pt.json +8 -8
- package/src/operations-data.controller.ts +54 -0
- package/src/operations-growth.controller.ts +44 -0
- package/src/operations.module.ts +21 -15
- package/src/operations.service.ts +137 -0
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Page } from '@/components/entity-list';
|
|
4
|
-
import { useParams } from 'next/navigation';
|
|
5
|
-
import { OperationsHeader } from '../../_components/operations-header';
|
|
6
|
-
import { SectionCard } from '../../_components/section-card';
|
|
7
|
-
import { StatusBadge } from '../../_components/status-badge';
|
|
8
|
-
import { useOperationsData } from '../../_lib/hooks/use-operations-data';
|
|
9
|
-
import { formatCurrency, formatDate } from '../../_lib/utils/format';
|
|
10
|
-
import {
|
|
11
|
-
getContractBadgeClasses,
|
|
12
|
-
getContractTypeLabel,
|
|
13
|
-
} from '../../_lib/utils/status';
|
|
14
|
-
|
|
15
|
-
export default function ContractDetailsPage() {
|
|
16
|
-
const params = useParams<{ id: string }>();
|
|
17
|
-
const { contracts, projects } = useOperationsData();
|
|
18
|
-
const contract = contracts.find((item) => item.id === params.id);
|
|
19
|
-
|
|
20
|
-
if (!contract) {
|
|
21
|
-
return <Page>Contract not found.</Page>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const linkedProjects = projects.filter((project) =>
|
|
25
|
-
contract.linkedProjectIds.includes(project.id)
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Page>
|
|
30
|
-
<OperationsHeader
|
|
31
|
-
title={contract.name}
|
|
32
|
-
description="Static mock detail page with production-ready structure."
|
|
33
|
-
current="Contract Details"
|
|
34
|
-
/>
|
|
35
|
-
|
|
36
|
-
<div className="grid gap-4 xl:grid-cols-2">
|
|
37
|
-
<SectionCard title="Contract Info">
|
|
38
|
-
<div className="grid gap-3 text-sm sm:grid-cols-2">
|
|
39
|
-
<p>
|
|
40
|
-
<span className="font-medium">Client:</span> {contract.client}
|
|
41
|
-
</p>
|
|
42
|
-
<p>
|
|
43
|
-
<span className="font-medium">Type:</span>{' '}
|
|
44
|
-
{getContractTypeLabel(contract.type)}
|
|
45
|
-
</p>
|
|
46
|
-
<p>
|
|
47
|
-
<span className="font-medium">Start:</span>{' '}
|
|
48
|
-
{formatDate(contract.startDate)}
|
|
49
|
-
</p>
|
|
50
|
-
<p>
|
|
51
|
-
<span className="font-medium">End:</span>{' '}
|
|
52
|
-
{formatDate(contract.endDate)}
|
|
53
|
-
</p>
|
|
54
|
-
<p>
|
|
55
|
-
<span className="font-medium">Hour Rate:</span>{' '}
|
|
56
|
-
{formatCurrency(contract.hourlyRate)}
|
|
57
|
-
</p>
|
|
58
|
-
<p>
|
|
59
|
-
<span className="font-medium">Hour Limit:</span>{' '}
|
|
60
|
-
{contract.hourLimit}h
|
|
61
|
-
</p>
|
|
62
|
-
<div className="sm:col-span-2">
|
|
63
|
-
<StatusBadge
|
|
64
|
-
label={contract.status}
|
|
65
|
-
className={getContractBadgeClasses(contract.status)}
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
</SectionCard>
|
|
70
|
-
|
|
71
|
-
<SectionCard title="Linked Projects">
|
|
72
|
-
<div className="space-y-3">
|
|
73
|
-
{linkedProjects.map((project) => (
|
|
74
|
-
<div key={project.id} className="rounded-lg border p-3">
|
|
75
|
-
<p className="font-medium">{project.name}</p>
|
|
76
|
-
<p className="text-sm text-muted-foreground">{project.client}</p>
|
|
77
|
-
</div>
|
|
78
|
-
))}
|
|
79
|
-
</div>
|
|
80
|
-
</SectionCard>
|
|
81
|
-
|
|
82
|
-
<SectionCard title="Billing Rules">
|
|
83
|
-
<ul className="space-y-2 text-sm">
|
|
84
|
-
{contract.billingRules.map((rule) => (
|
|
85
|
-
<li key={rule} className="rounded-md bg-muted/40 p-3">
|
|
86
|
-
{rule}
|
|
87
|
-
</li>
|
|
88
|
-
))}
|
|
89
|
-
</ul>
|
|
90
|
-
</SectionCard>
|
|
91
|
-
|
|
92
|
-
<SectionCard title="SLA">
|
|
93
|
-
<p className="text-sm text-muted-foreground">{contract.sla}</p>
|
|
94
|
-
</SectionCard>
|
|
95
|
-
|
|
96
|
-
<SectionCard title="Adjustments / Revisions" className="xl:col-span-2">
|
|
97
|
-
<ul className="space-y-2 text-sm">
|
|
98
|
-
{contract.revisions.map((revision) => (
|
|
99
|
-
<li key={revision} className="rounded-md border p-3">
|
|
100
|
-
{revision}
|
|
101
|
-
</li>
|
|
102
|
-
))}
|
|
103
|
-
</ul>
|
|
104
|
-
</SectionCard>
|
|
105
|
-
</div>
|
|
106
|
-
</Page>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Page } from '@/components/entity-list';
|
|
4
|
+
import { useParams } from 'next/navigation';
|
|
5
|
+
import { OperationsHeader } from '../../_components/operations-header';
|
|
6
|
+
import { SectionCard } from '../../_components/section-card';
|
|
7
|
+
import { StatusBadge } from '../../_components/status-badge';
|
|
8
|
+
import { useOperationsData } from '../../_lib/hooks/use-operations-data';
|
|
9
|
+
import { formatCurrency, formatDate } from '../../_lib/utils/format';
|
|
10
|
+
import {
|
|
11
|
+
getContractBadgeClasses,
|
|
12
|
+
getContractTypeLabel,
|
|
13
|
+
} from '../../_lib/utils/status';
|
|
14
|
+
|
|
15
|
+
export default function ContractDetailsPage() {
|
|
16
|
+
const params = useParams<{ id: string }>();
|
|
17
|
+
const { contracts, projects } = useOperationsData();
|
|
18
|
+
const contract = contracts.find((item) => item.id === params.id);
|
|
19
|
+
|
|
20
|
+
if (!contract) {
|
|
21
|
+
return <Page>Contract not found.</Page>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const linkedProjects = projects.filter((project) =>
|
|
25
|
+
contract.linkedProjectIds.includes(project.id)
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Page>
|
|
30
|
+
<OperationsHeader
|
|
31
|
+
title={contract.name}
|
|
32
|
+
description="Static mock detail page with production-ready structure."
|
|
33
|
+
current="Contract Details"
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<div className="grid gap-4 xl:grid-cols-2">
|
|
37
|
+
<SectionCard title="Contract Info">
|
|
38
|
+
<div className="grid gap-3 text-sm sm:grid-cols-2">
|
|
39
|
+
<p>
|
|
40
|
+
<span className="font-medium">Client:</span> {contract.client}
|
|
41
|
+
</p>
|
|
42
|
+
<p>
|
|
43
|
+
<span className="font-medium">Type:</span>{' '}
|
|
44
|
+
{getContractTypeLabel(contract.type)}
|
|
45
|
+
</p>
|
|
46
|
+
<p>
|
|
47
|
+
<span className="font-medium">Start:</span>{' '}
|
|
48
|
+
{formatDate(contract.startDate)}
|
|
49
|
+
</p>
|
|
50
|
+
<p>
|
|
51
|
+
<span className="font-medium">End:</span>{' '}
|
|
52
|
+
{formatDate(contract.endDate)}
|
|
53
|
+
</p>
|
|
54
|
+
<p>
|
|
55
|
+
<span className="font-medium">Hour Rate:</span>{' '}
|
|
56
|
+
{formatCurrency(contract.hourlyRate)}
|
|
57
|
+
</p>
|
|
58
|
+
<p>
|
|
59
|
+
<span className="font-medium">Hour Limit:</span>{' '}
|
|
60
|
+
{contract.hourLimit}h
|
|
61
|
+
</p>
|
|
62
|
+
<div className="sm:col-span-2">
|
|
63
|
+
<StatusBadge
|
|
64
|
+
label={contract.status}
|
|
65
|
+
className={getContractBadgeClasses(contract.status)}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</SectionCard>
|
|
70
|
+
|
|
71
|
+
<SectionCard title="Linked Projects">
|
|
72
|
+
<div className="space-y-3">
|
|
73
|
+
{linkedProjects.map((project) => (
|
|
74
|
+
<div key={project.id} className="rounded-lg border p-3">
|
|
75
|
+
<p className="font-medium">{project.name}</p>
|
|
76
|
+
<p className="text-sm text-muted-foreground">{project.client}</p>
|
|
77
|
+
</div>
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
</SectionCard>
|
|
81
|
+
|
|
82
|
+
<SectionCard title="Billing Rules">
|
|
83
|
+
<ul className="space-y-2 text-sm">
|
|
84
|
+
{contract.billingRules.map((rule) => (
|
|
85
|
+
<li key={rule} className="rounded-md bg-muted/40 p-3">
|
|
86
|
+
{rule}
|
|
87
|
+
</li>
|
|
88
|
+
))}
|
|
89
|
+
</ul>
|
|
90
|
+
</SectionCard>
|
|
91
|
+
|
|
92
|
+
<SectionCard title="SLA">
|
|
93
|
+
<p className="text-sm text-muted-foreground">{contract.sla}</p>
|
|
94
|
+
</SectionCard>
|
|
95
|
+
|
|
96
|
+
<SectionCard title="Adjustments / Revisions" className="xl:col-span-2">
|
|
97
|
+
<ul className="space-y-2 text-sm">
|
|
98
|
+
{contract.revisions.map((revision) => (
|
|
99
|
+
<li key={revision} className="rounded-md border p-3">
|
|
100
|
+
{revision}
|
|
101
|
+
</li>
|
|
102
|
+
))}
|
|
103
|
+
</ul>
|
|
104
|
+
</SectionCard>
|
|
105
|
+
</div>
|
|
106
|
+
</Page>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -1,124 +1,181 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} from '../
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
EmptyState,
|
|
5
|
+
Page,
|
|
6
|
+
PaginationFooter,
|
|
7
|
+
SearchBar,
|
|
8
|
+
} from '@/components/entity-list';
|
|
9
|
+
import { Input } from '@/components/ui/input';
|
|
10
|
+
import {
|
|
11
|
+
Select,
|
|
12
|
+
SelectContent,
|
|
13
|
+
SelectItem,
|
|
14
|
+
SelectTrigger,
|
|
15
|
+
SelectValue,
|
|
16
|
+
} from '@/components/ui/select';
|
|
17
|
+
import {
|
|
18
|
+
Table,
|
|
19
|
+
TableBody,
|
|
20
|
+
TableCell,
|
|
21
|
+
TableHead,
|
|
22
|
+
TableHeader,
|
|
23
|
+
TableRow,
|
|
24
|
+
} from '@/components/ui/table';
|
|
25
|
+
import { useTranslations } from 'next-intl';
|
|
26
|
+
import Link from 'next/link';
|
|
27
|
+
import { useMemo, useState } from 'react';
|
|
28
|
+
import { Layers } from 'lucide-react';
|
|
29
|
+
import { OperationsHeader } from '../_components/operations-header';
|
|
30
|
+
import { SectionCard } from '../_components/section-card';
|
|
31
|
+
import { StatusBadge } from '../_components/status-badge';
|
|
32
|
+
import { useOperationsData } from '../_lib/hooks/use-operations-data';
|
|
33
|
+
import { formatCurrency, formatDate } from '../_lib/utils/format';
|
|
34
|
+
import {
|
|
35
|
+
getContractBadgeClasses,
|
|
36
|
+
getContractTypeLabel,
|
|
37
|
+
} from '../_lib/utils/status';
|
|
38
|
+
|
|
39
|
+
const PAGE_SIZE_OPTIONS = [10, 20, 30, 50];
|
|
40
|
+
const DEFAULT_PAGE_SIZE = PAGE_SIZE_OPTIONS[0] ?? 10;
|
|
41
|
+
|
|
42
|
+
export default function ContractsPage() {
|
|
43
|
+
const t = useTranslations('operations.ContractsPage');
|
|
44
|
+
const { contracts } = useOperationsData();
|
|
45
|
+
const [searchInput, setSearchInput] = useState('');
|
|
46
|
+
const [search, setSearch] = useState('');
|
|
47
|
+
const [status, setStatus] = useState('all');
|
|
48
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
49
|
+
const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE);
|
|
50
|
+
|
|
51
|
+
const filteredContracts = useMemo(
|
|
52
|
+
() =>
|
|
53
|
+
contracts.filter((contract) => {
|
|
54
|
+
const matchesSearch =
|
|
55
|
+
`${contract.name} ${contract.client}`
|
|
56
|
+
.toLowerCase()
|
|
57
|
+
.includes(search.toLowerCase());
|
|
58
|
+
const matchesStatus = status === 'all' || contract.status === status;
|
|
59
|
+
return matchesSearch && matchesStatus;
|
|
60
|
+
}),
|
|
61
|
+
[contracts, search, status]
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const totalPages = Math.max(1, Math.ceil(filteredContracts.length / pageSize));
|
|
65
|
+
const safePage = Math.min(Math.max(currentPage, 1), totalPages);
|
|
66
|
+
const paginatedContracts = useMemo(() => {
|
|
67
|
+
const start = (safePage - 1) * pageSize;
|
|
68
|
+
return filteredContracts.slice(start, start + pageSize);
|
|
69
|
+
}, [filteredContracts, safePage, pageSize]);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Page>
|
|
73
|
+
<OperationsHeader
|
|
74
|
+
title={t('title')}
|
|
75
|
+
description={t('description')}
|
|
76
|
+
current={t('breadcrumb')}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<SearchBar
|
|
80
|
+
className="mb-6"
|
|
81
|
+
searchQuery={searchInput}
|
|
82
|
+
onSearchChange={setSearchInput}
|
|
83
|
+
placeholder={t('searchPlaceholder')}
|
|
84
|
+
onSearch={() => {
|
|
85
|
+
setSearch(searchInput);
|
|
86
|
+
setCurrentPage(1);
|
|
87
|
+
}}
|
|
88
|
+
controls={[
|
|
89
|
+
{
|
|
90
|
+
id: 'status-filter',
|
|
91
|
+
type: 'select',
|
|
92
|
+
value: status,
|
|
93
|
+
onChange: (value) => {
|
|
94
|
+
setStatus(value);
|
|
95
|
+
setCurrentPage(1);
|
|
96
|
+
},
|
|
97
|
+
placeholder: t('filters.all'),
|
|
98
|
+
options: [
|
|
99
|
+
{ value: 'all', label: t('filters.all') },
|
|
100
|
+
{ value: 'active', label: t('filters.active') },
|
|
101
|
+
{ value: 'renewal', label: t('filters.renewal') },
|
|
102
|
+
{ value: 'expired', label: t('filters.expired') },
|
|
103
|
+
{ value: 'draft', label: t('filters.draft') },
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
]}
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<SectionCard title={t('tableTitle')} description={t('tableDescription')}>
|
|
110
|
+
{filteredContracts.length === 0 ? (
|
|
111
|
+
<EmptyState
|
|
112
|
+
icon={<Layers className="h-12 w-12" />}
|
|
113
|
+
title={t('emptyState.title')}
|
|
114
|
+
description={t('emptyState.description')}
|
|
115
|
+
actionLabel={t('emptyState.action')}
|
|
116
|
+
onAction={() => {
|
|
117
|
+
setSearch('');
|
|
118
|
+
setSearchInput('');
|
|
119
|
+
setStatus('all');
|
|
120
|
+
setCurrentPage(1);
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
) : (
|
|
124
|
+
<div className="space-y-4">
|
|
125
|
+
<Table>
|
|
126
|
+
<TableHeader>
|
|
127
|
+
<TableRow>
|
|
128
|
+
<TableHead>{t('columns.name')}</TableHead>
|
|
129
|
+
<TableHead>{t('columns.client')}</TableHead>
|
|
130
|
+
<TableHead>{t('columns.type')}</TableHead>
|
|
131
|
+
<TableHead>{t('columns.startDate')}</TableHead>
|
|
132
|
+
<TableHead>{t('columns.endDate')}</TableHead>
|
|
133
|
+
<TableHead>{t('columns.hourRate')}</TableHead>
|
|
134
|
+
<TableHead>{t('columns.hourLimit')}</TableHead>
|
|
135
|
+
<TableHead>{t('columns.status')}</TableHead>
|
|
136
|
+
</TableRow>
|
|
137
|
+
</TableHeader>
|
|
138
|
+
<TableBody>
|
|
139
|
+
{paginatedContracts.map((contract) => (
|
|
140
|
+
<TableRow key={contract.id}>
|
|
141
|
+
<TableCell>
|
|
142
|
+
<Link
|
|
143
|
+
className="font-medium text-primary hover:underline"
|
|
144
|
+
href={`/operations/contracts/${contract.id}`}
|
|
145
|
+
>
|
|
146
|
+
{contract.name}
|
|
147
|
+
</Link>
|
|
148
|
+
</TableCell>
|
|
149
|
+
<TableCell>{contract.client}</TableCell>
|
|
150
|
+
<TableCell>{getContractTypeLabel(contract.type)}</TableCell>
|
|
151
|
+
<TableCell>{formatDate(contract.startDate)}</TableCell>
|
|
152
|
+
<TableCell>{formatDate(contract.endDate)}</TableCell>
|
|
153
|
+
<TableCell>{formatCurrency(contract.hourlyRate)}</TableCell>
|
|
154
|
+
<TableCell>{contract.hourLimit}h</TableCell>
|
|
155
|
+
<TableCell>
|
|
156
|
+
<StatusBadge
|
|
157
|
+
label={contract.status}
|
|
158
|
+
className={getContractBadgeClasses(contract.status)}
|
|
159
|
+
/>
|
|
160
|
+
</TableCell>
|
|
161
|
+
</TableRow>
|
|
162
|
+
))}
|
|
163
|
+
</TableBody>
|
|
164
|
+
</Table>
|
|
165
|
+
<PaginationFooter
|
|
166
|
+
currentPage={safePage}
|
|
167
|
+
pageSize={pageSize}
|
|
168
|
+
totalItems={filteredContracts.length}
|
|
169
|
+
onPageChange={setCurrentPage}
|
|
170
|
+
onPageSizeChange={(nextSize) => {
|
|
171
|
+
setPageSize(nextSize);
|
|
172
|
+
setCurrentPage(1);
|
|
173
|
+
}}
|
|
174
|
+
pageSizeOptions={PAGE_SIZE_OPTIONS}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
178
|
+
</SectionCard>
|
|
179
|
+
</Page>
|
|
180
|
+
);
|
|
181
|
+
}
|