@hed-hog/operations 0.0.297 → 0.0.299

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 (32) hide show
  1. package/hedhog/frontend/app/_components/collaborator-details-screen.tsx.ejs +310 -310
  2. package/hedhog/frontend/app/_components/collaborator-form-screen.tsx.ejs +631 -631
  3. package/hedhog/frontend/app/_components/contract-details-screen.tsx.ejs +132 -132
  4. package/hedhog/frontend/app/_components/contract-form-screen.tsx.ejs +558 -558
  5. package/hedhog/frontend/app/_components/project-details-screen.tsx.ejs +291 -291
  6. package/hedhog/frontend/app/_components/project-form-screen.tsx.ejs +689 -689
  7. package/hedhog/frontend/app/_lib/api.ts.ejs +32 -32
  8. package/hedhog/frontend/app/_lib/hooks/use-operations-access.ts.ejs +44 -44
  9. package/hedhog/frontend/app/_lib/types.ts.ejs +360 -360
  10. package/hedhog/frontend/app/_lib/utils/format.ts.ejs +129 -129
  11. package/hedhog/frontend/app/_lib/utils/forms.ts.ejs +14 -14
  12. package/hedhog/frontend/app/approvals/page.tsx.ejs +386 -386
  13. package/hedhog/frontend/app/collaborators/[id]/edit/page.tsx.ejs +11 -11
  14. package/hedhog/frontend/app/collaborators/[id]/page.tsx.ejs +11 -11
  15. package/hedhog/frontend/app/collaborators/new/page.tsx.ejs +5 -5
  16. package/hedhog/frontend/app/collaborators/page.tsx.ejs +261 -261
  17. package/hedhog/frontend/app/contracts/[id]/edit/page.tsx.ejs +11 -11
  18. package/hedhog/frontend/app/contracts/[id]/page.tsx.ejs +11 -11
  19. package/hedhog/frontend/app/contracts/new/page.tsx.ejs +17 -17
  20. package/hedhog/frontend/app/contracts/page.tsx.ejs +262 -262
  21. package/hedhog/frontend/app/page.tsx.ejs +319 -319
  22. package/hedhog/frontend/app/projects/[id]/edit/page.tsx.ejs +11 -11
  23. package/hedhog/frontend/app/projects/[id]/page.tsx.ejs +11 -11
  24. package/hedhog/frontend/app/projects/new/page.tsx.ejs +5 -5
  25. package/hedhog/frontend/app/projects/page.tsx.ejs +236 -236
  26. package/hedhog/frontend/app/schedule-adjustments/page.tsx.ejs +418 -418
  27. package/hedhog/frontend/app/team/page.tsx.ejs +339 -339
  28. package/hedhog/frontend/app/time-off/page.tsx.ejs +328 -328
  29. package/hedhog/frontend/app/timesheets/page.tsx.ejs +636 -636
  30. package/hedhog/frontend/messages/en.json +648 -648
  31. package/hedhog/frontend/messages/pt.json +647 -647
  32. package/package.json +4 -4
@@ -1,328 +1,328 @@
1
- 'use client';
2
-
3
- import { EmptyState, Page, SearchBar } from '@/components/entity-list';
4
- import { Button } from '@/components/ui/button';
5
- import { Input } from '@/components/ui/input';
6
- import { KpiCardsGrid } from '@/components/ui/kpi-cards-grid';
7
- import {
8
- Select,
9
- SelectContent,
10
- SelectItem,
11
- SelectTrigger,
12
- SelectValue,
13
- } from '@/components/ui/select';
14
- import {
15
- Sheet,
16
- SheetContent,
17
- SheetDescription,
18
- SheetHeader,
19
- SheetTitle,
20
- } from '@/components/ui/sheet';
21
- import {
22
- Table,
23
- TableBody,
24
- TableCell,
25
- TableHead,
26
- TableHeader,
27
- TableRow,
28
- } from '@/components/ui/table';
29
- import { Textarea } from '@/components/ui/textarea';
30
- import { useApp, useQuery } from '@hed-hog/next-app-provider';
31
- import { Palmtree, Plus } from 'lucide-react';
32
- import { useMemo, useState } from 'react';
33
- import { useTranslations } from 'next-intl';
34
- import { OperationsHeader } from '../_components/operations-header';
35
- import { StatusBadge } from '../_components/status-badge';
36
- import { fetchOperations, mutateOperations } from '../_lib/api';
37
- import { useOperationsAccess } from '../_lib/hooks/use-operations-access';
38
- import type { OperationsTimeOffRequest } from '../_lib/types';
39
- import { parseNumberInput, trimToNull } from '../_lib/utils/forms';
40
- import {
41
- formatDateRange,
42
- formatEnumLabel,
43
- getStatusBadgeClass,
44
- } from '../_lib/utils/format';
45
-
46
- type TimeOffFormState = {
47
- requestType: string;
48
- startDate: string;
49
- endDate: string;
50
- totalDays: string;
51
- reason: string;
52
- };
53
-
54
- const emptyForm: TimeOffFormState = {
55
- requestType: 'vacation',
56
- startDate: '',
57
- endDate: '',
58
- totalDays: '',
59
- reason: '',
60
- };
61
-
62
- export default function OperationsTimeOffPage() {
63
- const t = useTranslations('operations.TimeOffPage');
64
- const commonT = useTranslations('operations.Common');
65
- const { request, showToastHandler, currentLocaleCode } = useApp();
66
- const access = useOperationsAccess();
67
- const [search, setSearch] = useState('');
68
- const [statusFilter, setStatusFilter] = useState('all');
69
- const [isSheetOpen, setIsSheetOpen] = useState(false);
70
- const [form, setForm] = useState<TimeOffFormState>(emptyForm);
71
-
72
- const { data: requests = [], refetch } = useQuery<OperationsTimeOffRequest[]>({
73
- queryKey: ['operations-time-off', currentLocaleCode],
74
- enabled: access.isCollaborator,
75
- queryFn: () =>
76
- fetchOperations<OperationsTimeOffRequest[]>(request, '/operations/time-off'),
77
- });
78
-
79
- const filteredRows = useMemo(
80
- () =>
81
- requests.filter((item) => {
82
- const matchesSearch = !search.trim()
83
- ? true
84
- : [item.collaboratorName, item.approverName, item.reason, item.requestType]
85
- .filter(Boolean)
86
- .some((value) =>
87
- String(value).toLowerCase().includes(search.trim().toLowerCase())
88
- );
89
- const matchesStatus =
90
- statusFilter === 'all' ? true : item.status === statusFilter;
91
- return matchesSearch && matchesStatus;
92
- }),
93
- [requests, search, statusFilter]
94
- );
95
-
96
- const cards = [
97
- {
98
- key: 'submitted',
99
- title: t('cards.submitted'),
100
- value: requests.filter((item) => item.status === 'submitted').length,
101
- },
102
- {
103
- key: 'approved',
104
- title: t('cards.approved'),
105
- value: requests.filter((item) => item.status === 'approved').length,
106
- },
107
- {
108
- key: 'days',
109
- title: t('cards.days'),
110
- value: requests.reduce(
111
- (total, item) => total + Number(item.totalDays ?? 0),
112
- 0
113
- ),
114
- },
115
- ];
116
-
117
- const onSubmit = async () => {
118
- if (!form.startDate || !form.endDate) {
119
- showToastHandler?.('error', t('messages.requiredFields'));
120
- return;
121
- }
122
-
123
- try {
124
- await mutateOperations(request, '/operations/time-off', 'POST', {
125
- requestType: form.requestType,
126
- startDate: form.startDate,
127
- endDate: form.endDate,
128
- totalDays: parseNumberInput(form.totalDays),
129
- reason: trimToNull(form.reason),
130
- });
131
-
132
- showToastHandler?.('success', t('messages.saveSuccess'));
133
- setIsSheetOpen(false);
134
- setForm(emptyForm);
135
- await refetch();
136
- } catch {
137
- showToastHandler?.('error', t('messages.saveError'));
138
- }
139
- };
140
-
141
- return (
142
- <Page>
143
- <OperationsHeader
144
- title={t('title')}
145
- description={t('description')}
146
- current={t('breadcrumb')}
147
- actions={
148
- access.isCollaborator ? (
149
- <Button size="sm" onClick={() => setIsSheetOpen(true)}>
150
- <Plus className="size-4" />
151
- {commonT('actions.create')}
152
- </Button>
153
- ) : undefined
154
- }
155
- />
156
-
157
- <SearchBar
158
- searchQuery={search}
159
- onSearchChange={setSearch}
160
- onSearch={() => undefined}
161
- placeholder={t('searchPlaceholder')}
162
- controls={[
163
- {
164
- id: 'status',
165
- type: 'select',
166
- value: statusFilter,
167
- onChange: setStatusFilter,
168
- placeholder: commonT('labels.status'),
169
- options: [
170
- { value: 'all', label: commonT('filters.allStatuses') },
171
- { value: 'submitted', label: formatEnumLabel('submitted') },
172
- { value: 'approved', label: formatEnumLabel('approved') },
173
- { value: 'rejected', label: formatEnumLabel('rejected') },
174
- ],
175
- },
176
- ]}
177
- />
178
-
179
- <KpiCardsGrid items={cards} columns={3} />
180
-
181
- {filteredRows.length > 0 ? (
182
- <div className="overflow-x-auto rounded-md border">
183
- <Table>
184
- <TableHeader>
185
- <TableRow>
186
- <TableHead>{commonT('labels.collaborator')}</TableHead>
187
- <TableHead>{commonT('labels.requestType')}</TableHead>
188
- <TableHead>{commonT('labels.timeline')}</TableHead>
189
- <TableHead>{commonT('labels.approver')}</TableHead>
190
- <TableHead>{commonT('labels.status')}</TableHead>
191
- <TableHead>{commonT('labels.reason')}</TableHead>
192
- <TableHead>{commonT('labels.notes')}</TableHead>
193
- </TableRow>
194
- </TableHeader>
195
- <TableBody>
196
- {filteredRows.map((requestItem) => (
197
- <TableRow key={requestItem.id}>
198
- <TableCell>{requestItem.collaboratorName}</TableCell>
199
- <TableCell>{formatEnumLabel(requestItem.requestType)}</TableCell>
200
- <TableCell>
201
- <div>
202
- {formatDateRange(requestItem.startDate, requestItem.endDate)}
203
- </div>
204
- <div className="text-xs text-muted-foreground">
205
- {requestItem.totalDays ?? 0} {commonT('labels.days')}
206
- </div>
207
- </TableCell>
208
- <TableCell>
209
- {requestItem.approverName || commonT('labels.notAssigned')}
210
- </TableCell>
211
- <TableCell>
212
- <StatusBadge
213
- label={formatEnumLabel(requestItem.status)}
214
- className={getStatusBadgeClass(requestItem.status)}
215
- />
216
- </TableCell>
217
- <TableCell>
218
- {requestItem.reason || commonT('labels.noNotes')}
219
- </TableCell>
220
- <TableCell>
221
- {requestItem.approverNote || commonT('labels.noNotes')}
222
- </TableCell>
223
- </TableRow>
224
- ))}
225
- </TableBody>
226
- </Table>
227
- </div>
228
- ) : (
229
- <EmptyState
230
- icon={<Palmtree className="size-12" />}
231
- title={commonT('states.emptyTitle')}
232
- description={t('emptyDescription')}
233
- actionLabel={access.isCollaborator ? commonT('actions.create') : commonT('actions.refresh')}
234
- onAction={access.isCollaborator ? () => setIsSheetOpen(true) : () => void refetch()}
235
- />
236
- )}
237
-
238
- <Sheet open={isSheetOpen} onOpenChange={setIsSheetOpen}>
239
- <SheetContent className="w-full overflow-y-auto sm:max-w-xl">
240
- <SheetHeader>
241
- <SheetTitle>{t('sheet.title')}</SheetTitle>
242
- <SheetDescription>{t('sheet.description')}</SheetDescription>
243
- </SheetHeader>
244
-
245
- <div className="mt-6 grid gap-4">
246
- <div className="space-y-2">
247
- <label className="text-sm font-medium">{commonT('labels.requestType')}</label>
248
- <Select
249
- value={form.requestType}
250
- onValueChange={(value) =>
251
- setForm((current) => ({ ...current, requestType: value }))
252
- }
253
- >
254
- <SelectTrigger>
255
- <SelectValue />
256
- </SelectTrigger>
257
- <SelectContent>
258
- <SelectItem value="vacation">Vacation</SelectItem>
259
- <SelectItem value="personal_time">Personal Time</SelectItem>
260
- <SelectItem value="sick_leave">Sick Leave</SelectItem>
261
- <SelectItem value="unpaid_leave">Unpaid Leave</SelectItem>
262
- <SelectItem value="other">Other</SelectItem>
263
- </SelectContent>
264
- </Select>
265
- </div>
266
-
267
- <div className="grid gap-4 md:grid-cols-2">
268
- <div className="space-y-2">
269
- <label className="text-sm font-medium">{commonT('labels.startDate')}</label>
270
- <Input
271
- type="date"
272
- value={form.startDate}
273
- onChange={(event) =>
274
- setForm((current) => ({
275
- ...current,
276
- startDate: event.target.value,
277
- }))
278
- }
279
- />
280
- </div>
281
- <div className="space-y-2">
282
- <label className="text-sm font-medium">{commonT('labels.endDate')}</label>
283
- <Input
284
- type="date"
285
- value={form.endDate}
286
- onChange={(event) =>
287
- setForm((current) => ({
288
- ...current,
289
- endDate: event.target.value,
290
- }))
291
- }
292
- />
293
- </div>
294
- </div>
295
-
296
- <div className="space-y-2">
297
- <label className="text-sm font-medium">{commonT('labels.days')}</label>
298
- <Input
299
- type="number"
300
- step="0.5"
301
- value={form.totalDays}
302
- onChange={(event) =>
303
- setForm((current) => ({
304
- ...current,
305
- totalDays: event.target.value,
306
- }))
307
- }
308
- />
309
- </div>
310
-
311
- <div className="space-y-2">
312
- <label className="text-sm font-medium">{commonT('labels.reason')}</label>
313
- <Textarea
314
- rows={4}
315
- value={form.reason}
316
- onChange={(event) =>
317
- setForm((current) => ({ ...current, reason: event.target.value }))
318
- }
319
- />
320
- </div>
321
-
322
- <Button onClick={() => void onSubmit()}>{commonT('actions.save')}</Button>
323
- </div>
324
- </SheetContent>
325
- </Sheet>
326
- </Page>
327
- );
328
- }
1
+ 'use client';
2
+
3
+ import { EmptyState, Page, SearchBar } from '@/components/entity-list';
4
+ import { Button } from '@/components/ui/button';
5
+ import { Input } from '@/components/ui/input';
6
+ import { KpiCardsGrid } from '@/components/ui/kpi-cards-grid';
7
+ import {
8
+ Select,
9
+ SelectContent,
10
+ SelectItem,
11
+ SelectTrigger,
12
+ SelectValue,
13
+ } from '@/components/ui/select';
14
+ import {
15
+ Sheet,
16
+ SheetContent,
17
+ SheetDescription,
18
+ SheetHeader,
19
+ SheetTitle,
20
+ } from '@/components/ui/sheet';
21
+ import {
22
+ Table,
23
+ TableBody,
24
+ TableCell,
25
+ TableHead,
26
+ TableHeader,
27
+ TableRow,
28
+ } from '@/components/ui/table';
29
+ import { Textarea } from '@/components/ui/textarea';
30
+ import { useApp, useQuery } from '@hed-hog/next-app-provider';
31
+ import { Palmtree, Plus } from 'lucide-react';
32
+ import { useMemo, useState } from 'react';
33
+ import { useTranslations } from 'next-intl';
34
+ import { OperationsHeader } from '../_components/operations-header';
35
+ import { StatusBadge } from '../_components/status-badge';
36
+ import { fetchOperations, mutateOperations } from '../_lib/api';
37
+ import { useOperationsAccess } from '../_lib/hooks/use-operations-access';
38
+ import type { OperationsTimeOffRequest } from '../_lib/types';
39
+ import { parseNumberInput, trimToNull } from '../_lib/utils/forms';
40
+ import {
41
+ formatDateRange,
42
+ formatEnumLabel,
43
+ getStatusBadgeClass,
44
+ } from '../_lib/utils/format';
45
+
46
+ type TimeOffFormState = {
47
+ requestType: string;
48
+ startDate: string;
49
+ endDate: string;
50
+ totalDays: string;
51
+ reason: string;
52
+ };
53
+
54
+ const emptyForm: TimeOffFormState = {
55
+ requestType: 'vacation',
56
+ startDate: '',
57
+ endDate: '',
58
+ totalDays: '',
59
+ reason: '',
60
+ };
61
+
62
+ export default function OperationsTimeOffPage() {
63
+ const t = useTranslations('operations.TimeOffPage');
64
+ const commonT = useTranslations('operations.Common');
65
+ const { request, showToastHandler, currentLocaleCode } = useApp();
66
+ const access = useOperationsAccess();
67
+ const [search, setSearch] = useState('');
68
+ const [statusFilter, setStatusFilter] = useState('all');
69
+ const [isSheetOpen, setIsSheetOpen] = useState(false);
70
+ const [form, setForm] = useState<TimeOffFormState>(emptyForm);
71
+
72
+ const { data: requests = [], refetch } = useQuery<OperationsTimeOffRequest[]>({
73
+ queryKey: ['operations-time-off', currentLocaleCode],
74
+ enabled: access.isCollaborator,
75
+ queryFn: () =>
76
+ fetchOperations<OperationsTimeOffRequest[]>(request, '/operations/time-off'),
77
+ });
78
+
79
+ const filteredRows = useMemo(
80
+ () =>
81
+ requests.filter((item) => {
82
+ const matchesSearch = !search.trim()
83
+ ? true
84
+ : [item.collaboratorName, item.approverName, item.reason, item.requestType]
85
+ .filter(Boolean)
86
+ .some((value) =>
87
+ String(value).toLowerCase().includes(search.trim().toLowerCase())
88
+ );
89
+ const matchesStatus =
90
+ statusFilter === 'all' ? true : item.status === statusFilter;
91
+ return matchesSearch && matchesStatus;
92
+ }),
93
+ [requests, search, statusFilter]
94
+ );
95
+
96
+ const cards = [
97
+ {
98
+ key: 'submitted',
99
+ title: t('cards.submitted'),
100
+ value: requests.filter((item) => item.status === 'submitted').length,
101
+ },
102
+ {
103
+ key: 'approved',
104
+ title: t('cards.approved'),
105
+ value: requests.filter((item) => item.status === 'approved').length,
106
+ },
107
+ {
108
+ key: 'days',
109
+ title: t('cards.days'),
110
+ value: requests.reduce(
111
+ (total, item) => total + Number(item.totalDays ?? 0),
112
+ 0
113
+ ),
114
+ },
115
+ ];
116
+
117
+ const onSubmit = async () => {
118
+ if (!form.startDate || !form.endDate) {
119
+ showToastHandler?.('error', t('messages.requiredFields'));
120
+ return;
121
+ }
122
+
123
+ try {
124
+ await mutateOperations(request, '/operations/time-off', 'POST', {
125
+ requestType: form.requestType,
126
+ startDate: form.startDate,
127
+ endDate: form.endDate,
128
+ totalDays: parseNumberInput(form.totalDays),
129
+ reason: trimToNull(form.reason),
130
+ });
131
+
132
+ showToastHandler?.('success', t('messages.saveSuccess'));
133
+ setIsSheetOpen(false);
134
+ setForm(emptyForm);
135
+ await refetch();
136
+ } catch {
137
+ showToastHandler?.('error', t('messages.saveError'));
138
+ }
139
+ };
140
+
141
+ return (
142
+ <Page>
143
+ <OperationsHeader
144
+ title={t('title')}
145
+ description={t('description')}
146
+ current={t('breadcrumb')}
147
+ actions={
148
+ access.isCollaborator ? (
149
+ <Button size="sm" onClick={() => setIsSheetOpen(true)}>
150
+ <Plus className="size-4" />
151
+ {commonT('actions.create')}
152
+ </Button>
153
+ ) : undefined
154
+ }
155
+ />
156
+
157
+ <SearchBar
158
+ searchQuery={search}
159
+ onSearchChange={setSearch}
160
+ onSearch={() => undefined}
161
+ placeholder={t('searchPlaceholder')}
162
+ controls={[
163
+ {
164
+ id: 'status',
165
+ type: 'select',
166
+ value: statusFilter,
167
+ onChange: setStatusFilter,
168
+ placeholder: commonT('labels.status'),
169
+ options: [
170
+ { value: 'all', label: commonT('filters.allStatuses') },
171
+ { value: 'submitted', label: formatEnumLabel('submitted') },
172
+ { value: 'approved', label: formatEnumLabel('approved') },
173
+ { value: 'rejected', label: formatEnumLabel('rejected') },
174
+ ],
175
+ },
176
+ ]}
177
+ />
178
+
179
+ <KpiCardsGrid items={cards} columns={3} />
180
+
181
+ {filteredRows.length > 0 ? (
182
+ <div className="overflow-x-auto rounded-md border">
183
+ <Table>
184
+ <TableHeader>
185
+ <TableRow>
186
+ <TableHead>{commonT('labels.collaborator')}</TableHead>
187
+ <TableHead>{commonT('labels.requestType')}</TableHead>
188
+ <TableHead>{commonT('labels.timeline')}</TableHead>
189
+ <TableHead>{commonT('labels.approver')}</TableHead>
190
+ <TableHead>{commonT('labels.status')}</TableHead>
191
+ <TableHead>{commonT('labels.reason')}</TableHead>
192
+ <TableHead>{commonT('labels.notes')}</TableHead>
193
+ </TableRow>
194
+ </TableHeader>
195
+ <TableBody>
196
+ {filteredRows.map((requestItem) => (
197
+ <TableRow key={requestItem.id}>
198
+ <TableCell>{requestItem.collaboratorName}</TableCell>
199
+ <TableCell>{formatEnumLabel(requestItem.requestType)}</TableCell>
200
+ <TableCell>
201
+ <div>
202
+ {formatDateRange(requestItem.startDate, requestItem.endDate)}
203
+ </div>
204
+ <div className="text-xs text-muted-foreground">
205
+ {requestItem.totalDays ?? 0} {commonT('labels.days')}
206
+ </div>
207
+ </TableCell>
208
+ <TableCell>
209
+ {requestItem.approverName || commonT('labels.notAssigned')}
210
+ </TableCell>
211
+ <TableCell>
212
+ <StatusBadge
213
+ label={formatEnumLabel(requestItem.status)}
214
+ className={getStatusBadgeClass(requestItem.status)}
215
+ />
216
+ </TableCell>
217
+ <TableCell>
218
+ {requestItem.reason || commonT('labels.noNotes')}
219
+ </TableCell>
220
+ <TableCell>
221
+ {requestItem.approverNote || commonT('labels.noNotes')}
222
+ </TableCell>
223
+ </TableRow>
224
+ ))}
225
+ </TableBody>
226
+ </Table>
227
+ </div>
228
+ ) : (
229
+ <EmptyState
230
+ icon={<Palmtree className="size-12" />}
231
+ title={commonT('states.emptyTitle')}
232
+ description={t('emptyDescription')}
233
+ actionLabel={access.isCollaborator ? commonT('actions.create') : commonT('actions.refresh')}
234
+ onAction={access.isCollaborator ? () => setIsSheetOpen(true) : () => void refetch()}
235
+ />
236
+ )}
237
+
238
+ <Sheet open={isSheetOpen} onOpenChange={setIsSheetOpen}>
239
+ <SheetContent className="w-full overflow-y-auto sm:max-w-xl">
240
+ <SheetHeader>
241
+ <SheetTitle>{t('sheet.title')}</SheetTitle>
242
+ <SheetDescription>{t('sheet.description')}</SheetDescription>
243
+ </SheetHeader>
244
+
245
+ <div className="mt-6 grid gap-4">
246
+ <div className="space-y-2">
247
+ <label className="text-sm font-medium">{commonT('labels.requestType')}</label>
248
+ <Select
249
+ value={form.requestType}
250
+ onValueChange={(value) =>
251
+ setForm((current) => ({ ...current, requestType: value }))
252
+ }
253
+ >
254
+ <SelectTrigger>
255
+ <SelectValue />
256
+ </SelectTrigger>
257
+ <SelectContent>
258
+ <SelectItem value="vacation">Vacation</SelectItem>
259
+ <SelectItem value="personal_time">Personal Time</SelectItem>
260
+ <SelectItem value="sick_leave">Sick Leave</SelectItem>
261
+ <SelectItem value="unpaid_leave">Unpaid Leave</SelectItem>
262
+ <SelectItem value="other">Other</SelectItem>
263
+ </SelectContent>
264
+ </Select>
265
+ </div>
266
+
267
+ <div className="grid gap-4 md:grid-cols-2">
268
+ <div className="space-y-2">
269
+ <label className="text-sm font-medium">{commonT('labels.startDate')}</label>
270
+ <Input
271
+ type="date"
272
+ value={form.startDate}
273
+ onChange={(event) =>
274
+ setForm((current) => ({
275
+ ...current,
276
+ startDate: event.target.value,
277
+ }))
278
+ }
279
+ />
280
+ </div>
281
+ <div className="space-y-2">
282
+ <label className="text-sm font-medium">{commonT('labels.endDate')}</label>
283
+ <Input
284
+ type="date"
285
+ value={form.endDate}
286
+ onChange={(event) =>
287
+ setForm((current) => ({
288
+ ...current,
289
+ endDate: event.target.value,
290
+ }))
291
+ }
292
+ />
293
+ </div>
294
+ </div>
295
+
296
+ <div className="space-y-2">
297
+ <label className="text-sm font-medium">{commonT('labels.days')}</label>
298
+ <Input
299
+ type="number"
300
+ step="0.5"
301
+ value={form.totalDays}
302
+ onChange={(event) =>
303
+ setForm((current) => ({
304
+ ...current,
305
+ totalDays: event.target.value,
306
+ }))
307
+ }
308
+ />
309
+ </div>
310
+
311
+ <div className="space-y-2">
312
+ <label className="text-sm font-medium">{commonT('labels.reason')}</label>
313
+ <Textarea
314
+ rows={4}
315
+ value={form.reason}
316
+ onChange={(event) =>
317
+ setForm((current) => ({ ...current, reason: event.target.value }))
318
+ }
319
+ />
320
+ </div>
321
+
322
+ <Button onClick={() => void onSubmit()}>{commonT('actions.save')}</Button>
323
+ </div>
324
+ </SheetContent>
325
+ </Sheet>
326
+ </Page>
327
+ );
328
+ }