@hed-hog/finance 0.0.300 → 0.0.302
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/dist/finance.contract-activated.subscriber.d.ts +24 -0
- package/dist/finance.contract-activated.subscriber.d.ts.map +1 -0
- package/dist/finance.contract-activated.subscriber.js +519 -0
- package/dist/finance.contract-activated.subscriber.js.map +1 -0
- package/dist/finance.contract-activated.subscriber.spec.d.ts +2 -0
- package/dist/finance.contract-activated.subscriber.spec.d.ts.map +1 -0
- package/dist/finance.contract-activated.subscriber.spec.js +302 -0
- package/dist/finance.contract-activated.subscriber.spec.js.map +1 -0
- package/dist/finance.module.d.ts.map +1 -1
- package/dist/finance.module.js +6 -1
- package/dist/finance.module.js.map +1 -1
- package/hedhog/data/menu.yaml +0 -17
- package/hedhog/frontend/app/_components/finance-layout.tsx.ejs +108 -0
- package/hedhog/frontend/app/accounts-payable/approvals/page.tsx.ejs +51 -69
- package/hedhog/frontend/app/accounts-payable/installments/page.tsx.ejs +1312 -1138
- package/hedhog/frontend/app/accounts-receivable/collections-default/page.tsx.ejs +288 -268
- package/hedhog/frontend/app/accounts-receivable/installments/page.tsx.ejs +1175 -1016
- package/hedhog/frontend/app/administration/audit-logs/page.tsx.ejs +157 -173
- package/hedhog/frontend/app/administration/categories/page.tsx.ejs +44 -62
- package/hedhog/frontend/app/administration/cost-centers/page.tsx.ejs +62 -80
- package/hedhog/frontend/app/administration/period-close/page.tsx.ejs +151 -170
- package/hedhog/frontend/app/cash-and-banks/bank-accounts/page.tsx.ejs +369 -322
- package/hedhog/frontend/app/cash-and-banks/bank-reconciliation/page.tsx.ejs +204 -226
- package/hedhog/frontend/app/cash-and-banks/statements/page.tsx.ejs +122 -140
- package/hedhog/frontend/app/cash-and-banks/transfers/page.tsx.ejs +31 -49
- package/hedhog/frontend/app/page.tsx.ejs +3 -370
- package/hedhog/frontend/app/planning/cash-flow-forecast/page.tsx.ejs +150 -182
- package/hedhog/frontend/app/planning/receivables-calendar/page.tsx.ejs +52 -70
- package/hedhog/frontend/app/planning/scenarios/page.tsx.ejs +101 -95
- package/hedhog/frontend/app/reports/actual-vs-forecast/page.tsx.ejs +100 -125
- package/hedhog/frontend/app/reports/aging-default/page.tsx.ejs +77 -105
- package/hedhog/frontend/app/reports/cash-position/page.tsx.ejs +99 -134
- package/hedhog/frontend/app/reports/overview-results/page.tsx.ejs +147 -182
- package/hedhog/frontend/app/reports/top-customers/page.tsx.ejs +49 -61
- package/hedhog/frontend/app/reports/top-operational-expenses/page.tsx.ejs +49 -67
- package/hedhog/frontend/messages/en.json +176 -68
- package/hedhog/frontend/messages/pt.json +176 -68
- package/package.json +6 -5
- package/src/finance.contract-activated.subscriber.spec.ts +392 -0
- package/src/finance.contract-activated.subscriber.ts +780 -0
- package/src/finance.module.ts +6 -1
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
import { Page, PageHeader, PaginationFooter } from '@/components/entity-list';
|
|
4
4
|
import { Badge } from '@/components/ui/badge';
|
|
5
5
|
import { Button } from '@/components/ui/button';
|
|
6
|
-
import {
|
|
7
|
-
Card,
|
|
8
|
-
CardContent,
|
|
9
|
-
CardDescription,
|
|
10
|
-
CardHeader,
|
|
11
|
-
CardTitle,
|
|
12
|
-
} from '@/components/ui/card';
|
|
13
6
|
import { Input } from '@/components/ui/input';
|
|
14
7
|
import {
|
|
15
8
|
Select,
|
|
@@ -129,181 +122,172 @@ export default function AuditLogsPage() {
|
|
|
129
122
|
]}
|
|
130
123
|
/>
|
|
131
124
|
|
|
132
|
-
<
|
|
133
|
-
<
|
|
134
|
-
<
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
onChange={(event) => {
|
|
146
|
-
setSearch(event.target.value);
|
|
147
|
-
setPage(1);
|
|
148
|
-
}}
|
|
149
|
-
className="pl-8"
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
125
|
+
<div className="grid gap-3 md:grid-cols-2 lg:grid-cols-4">
|
|
126
|
+
<div className="relative lg:col-span-2">
|
|
127
|
+
<Search className="pointer-events-none absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
|
|
128
|
+
<Input
|
|
129
|
+
placeholder={t('filters.searchPlaceholder')}
|
|
130
|
+
value={search}
|
|
131
|
+
onChange={(event) => {
|
|
132
|
+
setSearch(event.target.value);
|
|
133
|
+
setPage(1);
|
|
134
|
+
}}
|
|
135
|
+
className="pl-8"
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
152
138
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
139
|
+
<Select
|
|
140
|
+
value={action}
|
|
141
|
+
onValueChange={(value) => {
|
|
142
|
+
setAction(value);
|
|
143
|
+
setPage(1);
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<SelectTrigger className="w-full">
|
|
147
|
+
<SelectValue placeholder={t('filters.action')} />
|
|
148
|
+
</SelectTrigger>
|
|
149
|
+
<SelectContent>
|
|
150
|
+
<SelectItem value="all">{t('filters.allActions')}</SelectItem>
|
|
151
|
+
<SelectItem value="create">create</SelectItem>
|
|
152
|
+
<SelectItem value="update">update</SelectItem>
|
|
153
|
+
<SelectItem value="delete">delete</SelectItem>
|
|
154
|
+
</SelectContent>
|
|
155
|
+
</Select>
|
|
170
156
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
157
|
+
<Input
|
|
158
|
+
placeholder={t('filters.userPlaceholder')}
|
|
159
|
+
value={actorUserId}
|
|
160
|
+
onChange={(event) => {
|
|
161
|
+
setActorUserId(event.target.value);
|
|
162
|
+
setPage(1);
|
|
163
|
+
}}
|
|
164
|
+
/>
|
|
179
165
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
166
|
+
<Select
|
|
167
|
+
value={entityTable}
|
|
168
|
+
onValueChange={(value) => {
|
|
169
|
+
setEntityTable(value);
|
|
170
|
+
setPage(1);
|
|
171
|
+
}}
|
|
172
|
+
>
|
|
173
|
+
<SelectTrigger className="w-full">
|
|
174
|
+
<SelectValue placeholder={t('filters.entity')} />
|
|
175
|
+
</SelectTrigger>
|
|
176
|
+
<SelectContent>
|
|
177
|
+
{entityOptions.map((option) => (
|
|
178
|
+
<SelectItem key={option} value={option}>
|
|
179
|
+
{option === 'all' ? t('filters.allEntities') : option}
|
|
180
|
+
</SelectItem>
|
|
181
|
+
))}
|
|
182
|
+
</SelectContent>
|
|
183
|
+
</Select>
|
|
198
184
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
185
|
+
<Input
|
|
186
|
+
type="date"
|
|
187
|
+
value={from}
|
|
188
|
+
onChange={(event) => {
|
|
189
|
+
setFrom(event.target.value);
|
|
190
|
+
setPage(1);
|
|
191
|
+
}}
|
|
192
|
+
/>
|
|
207
193
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
194
|
+
<Input
|
|
195
|
+
type="date"
|
|
196
|
+
value={to}
|
|
197
|
+
onChange={(event) => {
|
|
198
|
+
setTo(event.target.value);
|
|
199
|
+
setPage(1);
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
216
202
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
203
|
+
<Button
|
|
204
|
+
variant="outline"
|
|
205
|
+
className="gap-2"
|
|
206
|
+
onClick={() => {
|
|
207
|
+
setSearch('');
|
|
208
|
+
setAction('all');
|
|
209
|
+
setEntityTable('all');
|
|
210
|
+
setActorUserId('');
|
|
211
|
+
setFrom('');
|
|
212
|
+
setTo('');
|
|
213
|
+
setPage(1);
|
|
214
|
+
refetch();
|
|
215
|
+
}}
|
|
216
|
+
>
|
|
217
|
+
<X className="h-4 w-4" />
|
|
218
|
+
{t('filters.clear')}
|
|
219
|
+
</Button>
|
|
220
|
+
</div>
|
|
235
221
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
222
|
+
<div className="rounded-md border">
|
|
223
|
+
<Table>
|
|
224
|
+
<TableHeader>
|
|
225
|
+
<TableRow>
|
|
226
|
+
<TableHead>{t('table.headers.date')}</TableHead>
|
|
227
|
+
<TableHead>{t('table.headers.author')}</TableHead>
|
|
228
|
+
<TableHead>{t('table.headers.action')}</TableHead>
|
|
229
|
+
<TableHead>{t('table.headers.entity')}</TableHead>
|
|
230
|
+
<TableHead>{t('table.headers.record')}</TableHead>
|
|
231
|
+
<TableHead>{t('table.headers.summary')}</TableHead>
|
|
232
|
+
<TableHead>IP</TableHead>
|
|
233
|
+
</TableRow>
|
|
234
|
+
</TableHeader>
|
|
235
|
+
<TableBody>
|
|
236
|
+
{isLoading ? (
|
|
237
|
+
<TableRow>
|
|
238
|
+
<TableCell colSpan={7} className="h-24 text-center">
|
|
239
|
+
{t('table.loading')}
|
|
240
|
+
</TableCell>
|
|
241
|
+
</TableRow>
|
|
242
|
+
) : rows.length === 0 ? (
|
|
243
|
+
<TableRow>
|
|
244
|
+
<TableCell colSpan={7} className="h-24 text-center">
|
|
245
|
+
{t('table.empty')}
|
|
246
|
+
</TableCell>
|
|
247
|
+
</TableRow>
|
|
248
|
+
) : (
|
|
249
|
+
rows.map((row) => (
|
|
250
|
+
<TableRow key={row.id}>
|
|
251
|
+
<TableCell>
|
|
252
|
+
{row.createdAt
|
|
253
|
+
? new Date(row.createdAt).toLocaleString('pt-BR')
|
|
254
|
+
: '-'}
|
|
255
|
+
</TableCell>
|
|
256
|
+
<TableCell>
|
|
257
|
+
<div className="flex flex-col">
|
|
258
|
+
<span>{row.actorName || '-'}</span>
|
|
259
|
+
<span className="text-xs text-muted-foreground">
|
|
260
|
+
{row.actorEmail || row.actorUserId || '-'}
|
|
261
|
+
</span>
|
|
262
|
+
</div>
|
|
263
|
+
</TableCell>
|
|
264
|
+
<TableCell>
|
|
265
|
+
<Badge variant="outline">{row.action}</Badge>
|
|
266
|
+
</TableCell>
|
|
267
|
+
<TableCell>{row.entityTable}</TableCell>
|
|
268
|
+
<TableCell>{row.entityId}</TableCell>
|
|
269
|
+
<TableCell className="max-w-[360px] truncate">
|
|
270
|
+
{row.summary || '-'}
|
|
271
|
+
</TableCell>
|
|
272
|
+
<TableCell>{row.ipAddress || '-'}</TableCell>
|
|
247
273
|
</TableRow>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
{t('table.loading')}
|
|
254
|
-
</TableCell>
|
|
255
|
-
</TableRow>
|
|
256
|
-
) : rows.length === 0 ? (
|
|
257
|
-
<TableRow>
|
|
258
|
-
<TableCell colSpan={7} className="h-24 text-center">
|
|
259
|
-
{t('table.empty')}
|
|
260
|
-
</TableCell>
|
|
261
|
-
</TableRow>
|
|
262
|
-
) : (
|
|
263
|
-
rows.map((row) => (
|
|
264
|
-
<TableRow key={row.id}>
|
|
265
|
-
<TableCell>
|
|
266
|
-
{row.createdAt
|
|
267
|
-
? new Date(row.createdAt).toLocaleString('pt-BR')
|
|
268
|
-
: '-'}
|
|
269
|
-
</TableCell>
|
|
270
|
-
<TableCell>
|
|
271
|
-
<div className="flex flex-col">
|
|
272
|
-
<span>{row.actorName || '-'}</span>
|
|
273
|
-
<span className="text-xs text-muted-foreground">
|
|
274
|
-
{row.actorEmail || row.actorUserId || '-'}
|
|
275
|
-
</span>
|
|
276
|
-
</div>
|
|
277
|
-
</TableCell>
|
|
278
|
-
<TableCell>
|
|
279
|
-
<Badge variant="outline">{row.action}</Badge>
|
|
280
|
-
</TableCell>
|
|
281
|
-
<TableCell>{row.entityTable}</TableCell>
|
|
282
|
-
<TableCell>{row.entityId}</TableCell>
|
|
283
|
-
<TableCell className="max-w-[360px] truncate">
|
|
284
|
-
{row.summary || '-'}
|
|
285
|
-
</TableCell>
|
|
286
|
-
<TableCell>{row.ipAddress || '-'}</TableCell>
|
|
287
|
-
</TableRow>
|
|
288
|
-
))
|
|
289
|
-
)}
|
|
290
|
-
</TableBody>
|
|
291
|
-
</Table>
|
|
292
|
-
</div>
|
|
274
|
+
))
|
|
275
|
+
)}
|
|
276
|
+
</TableBody>
|
|
277
|
+
</Table>
|
|
278
|
+
</div>
|
|
293
279
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
</CardContent>
|
|
306
|
-
</Card>
|
|
280
|
+
<PaginationFooter
|
|
281
|
+
currentPage={data?.page || page}
|
|
282
|
+
pageSize={data?.pageSize || pageSize}
|
|
283
|
+
totalItems={data?.total || 0}
|
|
284
|
+
onPageChange={(newPage) => setPage(newPage)}
|
|
285
|
+
onPageSizeChange={(newPageSize) => {
|
|
286
|
+
setPageSize(newPageSize);
|
|
287
|
+
setPage(1);
|
|
288
|
+
}}
|
|
289
|
+
pageSizeOptions={[10, 20, 30, 40, 50]}
|
|
290
|
+
/>
|
|
307
291
|
</Page>
|
|
308
292
|
);
|
|
309
293
|
}
|
|
@@ -13,13 +13,6 @@ import {
|
|
|
13
13
|
} from '@/components/ui/alert-dialog';
|
|
14
14
|
import { Badge } from '@/components/ui/badge';
|
|
15
15
|
import { Button } from '@/components/ui/button';
|
|
16
|
-
import {
|
|
17
|
-
Card,
|
|
18
|
-
CardContent,
|
|
19
|
-
CardDescription,
|
|
20
|
-
CardHeader,
|
|
21
|
-
CardTitle,
|
|
22
|
-
} from '@/components/ui/card';
|
|
23
16
|
import {
|
|
24
17
|
Form,
|
|
25
18
|
FormControl,
|
|
@@ -62,7 +55,6 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|
|
62
55
|
import {
|
|
63
56
|
ChevronDown,
|
|
64
57
|
ChevronRight,
|
|
65
|
-
FolderTree,
|
|
66
58
|
GripVertical,
|
|
67
59
|
Pencil,
|
|
68
60
|
Plus,
|
|
@@ -620,17 +612,7 @@ export default function CategoriesPage() {
|
|
|
620
612
|
},
|
|
621
613
|
{ label: t('breadcrumbs.current') },
|
|
622
614
|
]}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
<Card>
|
|
626
|
-
<CardHeader className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
627
|
-
<div>
|
|
628
|
-
<CardTitle className="flex items-center gap-2">
|
|
629
|
-
<FolderTree className="h-5 w-5" />
|
|
630
|
-
{t('card.title')}
|
|
631
|
-
</CardTitle>
|
|
632
|
-
<CardDescription>{t('card.description')}</CardDescription>
|
|
633
|
-
</div>
|
|
615
|
+
actions={
|
|
634
616
|
<Button
|
|
635
617
|
className="gap-2"
|
|
636
618
|
onClick={() => {
|
|
@@ -641,51 +623,51 @@ export default function CategoriesPage() {
|
|
|
641
623
|
<Plus className="h-4 w-4" />
|
|
642
624
|
{t('actions.newCategory')}
|
|
643
625
|
</Button>
|
|
644
|
-
|
|
626
|
+
}
|
|
627
|
+
/>
|
|
645
628
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
629
|
+
<div className="space-y-4">
|
|
630
|
+
{flat.length === 0 ? (
|
|
631
|
+
<div className="rounded-md border border-dashed p-8 text-center text-sm text-muted-foreground">
|
|
632
|
+
{t('table.empty')}
|
|
633
|
+
</div>
|
|
634
|
+
) : (
|
|
635
|
+
<DndContext
|
|
636
|
+
sensors={sensors}
|
|
637
|
+
collisionDetection={closestCenter}
|
|
638
|
+
onDragOver={handleDragOver}
|
|
639
|
+
onDragEnd={handleDragEnd}
|
|
640
|
+
onDragCancel={() => setDragOverHint(null)}
|
|
641
|
+
>
|
|
642
|
+
<SortableContext
|
|
643
|
+
items={flat.map((item) => item.id)}
|
|
644
|
+
strategy={verticalListSortingStrategy}
|
|
658
645
|
>
|
|
659
|
-
<
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
item
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
</SortableContext>
|
|
685
|
-
</DndContext>
|
|
686
|
-
)}
|
|
687
|
-
</CardContent>
|
|
688
|
-
</Card>
|
|
646
|
+
<div className="space-y-2">
|
|
647
|
+
{flat.map((item) => (
|
|
648
|
+
<CategoryRow
|
|
649
|
+
key={item.id}
|
|
650
|
+
item={item}
|
|
651
|
+
expanded={expanded}
|
|
652
|
+
setExpanded={setExpanded}
|
|
653
|
+
dropHint={
|
|
654
|
+
dragOverHint?.overId === item.id
|
|
655
|
+
? dragOverHint.mode
|
|
656
|
+
: undefined
|
|
657
|
+
}
|
|
658
|
+
onEdit={(category) => {
|
|
659
|
+
setEditing(category);
|
|
660
|
+
setSheetOpen(true);
|
|
661
|
+
}}
|
|
662
|
+
onDelete={(id) => setDeleteId(id)}
|
|
663
|
+
t={t}
|
|
664
|
+
/>
|
|
665
|
+
))}
|
|
666
|
+
</div>
|
|
667
|
+
</SortableContext>
|
|
668
|
+
</DndContext>
|
|
669
|
+
)}
|
|
670
|
+
</div>
|
|
689
671
|
|
|
690
672
|
<CategoriaSheet
|
|
691
673
|
open={sheetOpen}
|
|
@@ -13,13 +13,6 @@ import {
|
|
|
13
13
|
} from '@/components/ui/alert-dialog';
|
|
14
14
|
import { Badge } from '@/components/ui/badge';
|
|
15
15
|
import { Button } from '@/components/ui/button';
|
|
16
|
-
import {
|
|
17
|
-
Card,
|
|
18
|
-
CardContent,
|
|
19
|
-
CardDescription,
|
|
20
|
-
CardHeader,
|
|
21
|
-
CardTitle,
|
|
22
|
-
} from '@/components/ui/card';
|
|
23
16
|
import {
|
|
24
17
|
Form,
|
|
25
18
|
FormControl,
|
|
@@ -261,84 +254,73 @@ export default function CostCentersPage() {
|
|
|
261
254
|
},
|
|
262
255
|
{ label: t('breadcrumbs.current') },
|
|
263
256
|
]}
|
|
257
|
+
actions={
|
|
258
|
+
<Button
|
|
259
|
+
onClick={() => {
|
|
260
|
+
setEditingCostCenter(null);
|
|
261
|
+
setSheetOpen(true);
|
|
262
|
+
}}
|
|
263
|
+
className="gap-2"
|
|
264
|
+
>
|
|
265
|
+
<Plus className="h-4 w-4" />
|
|
266
|
+
{t('actions.newCostCenter')}
|
|
267
|
+
</Button>
|
|
268
|
+
}
|
|
264
269
|
/>
|
|
265
270
|
|
|
266
|
-
<div className="
|
|
267
|
-
|
|
268
|
-
<
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
271
|
+
<div className="space-y-4">
|
|
272
|
+
{centers.length === 0 ? (
|
|
273
|
+
<div className="rounded-md border border-dashed p-8 text-center text-sm text-muted-foreground">
|
|
274
|
+
{t('table.empty')}
|
|
275
|
+
</div>
|
|
276
|
+
) : (
|
|
277
|
+
<div className="grid gap-3">
|
|
278
|
+
{centers.map((costCenter) => (
|
|
279
|
+
<div
|
|
280
|
+
key={costCenter.id}
|
|
281
|
+
className="flex flex-col gap-3 rounded-md border p-4 sm:flex-row sm:items-center sm:justify-between"
|
|
282
|
+
>
|
|
283
|
+
<div className="flex items-start gap-3">
|
|
284
|
+
<div className="rounded-md bg-muted p-2">
|
|
285
|
+
<Building2 className="h-4 w-4" />
|
|
286
|
+
</div>
|
|
287
|
+
<div>
|
|
288
|
+
<p className="text-sm font-medium">{costCenter.nome}</p>
|
|
289
|
+
<p className="text-xs text-muted-foreground">
|
|
290
|
+
{t('table.code', { code: costCenter.codigo })}
|
|
291
|
+
</p>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
284
294
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
295
|
+
<div className="flex items-center gap-2">
|
|
296
|
+
<Badge variant={costCenter.ativo ? 'default' : 'secondary'}>
|
|
297
|
+
{costCenter.ativo
|
|
298
|
+
? t('table.status.active')
|
|
299
|
+
: t('table.status.inactive')}
|
|
300
|
+
</Badge>
|
|
301
|
+
<Button
|
|
302
|
+
variant="outline"
|
|
303
|
+
size="icon"
|
|
304
|
+
onClick={() => {
|
|
305
|
+
setEditingCostCenter(costCenter);
|
|
306
|
+
setSheetOpen(true);
|
|
307
|
+
}}
|
|
296
308
|
>
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
<div className="flex items-center gap-2">
|
|
310
|
-
<Badge
|
|
311
|
-
variant={costCenter.ativo ? 'default' : 'secondary'}
|
|
312
|
-
>
|
|
313
|
-
{costCenter.ativo
|
|
314
|
-
? t('table.status.active')
|
|
315
|
-
: t('table.status.inactive')}
|
|
316
|
-
</Badge>
|
|
317
|
-
<Button
|
|
318
|
-
variant="outline"
|
|
319
|
-
size="icon"
|
|
320
|
-
onClick={() => {
|
|
321
|
-
setEditingCostCenter(costCenter);
|
|
322
|
-
setSheetOpen(true);
|
|
323
|
-
}}
|
|
324
|
-
>
|
|
325
|
-
<Pencil className="h-4 w-4" />
|
|
326
|
-
</Button>
|
|
327
|
-
<Button
|
|
328
|
-
variant="outline"
|
|
329
|
-
size="icon"
|
|
330
|
-
onClick={() => setCostCenterIdToDelete(costCenter.id)}
|
|
331
|
-
disabled={!costCenter.ativo}
|
|
332
|
-
>
|
|
333
|
-
<Trash2 className="h-4 w-4" />
|
|
334
|
-
</Button>
|
|
335
|
-
</div>
|
|
336
|
-
</div>
|
|
337
|
-
))}
|
|
309
|
+
<Pencil className="h-4 w-4" />
|
|
310
|
+
</Button>
|
|
311
|
+
<Button
|
|
312
|
+
variant="outline"
|
|
313
|
+
size="icon"
|
|
314
|
+
onClick={() => setCostCenterIdToDelete(costCenter.id)}
|
|
315
|
+
disabled={!costCenter.ativo}
|
|
316
|
+
>
|
|
317
|
+
<Trash2 className="h-4 w-4" />
|
|
318
|
+
</Button>
|
|
319
|
+
</div>
|
|
338
320
|
</div>
|
|
339
|
-
)}
|
|
340
|
-
</
|
|
341
|
-
|
|
321
|
+
))}
|
|
322
|
+
</div>
|
|
323
|
+
)}
|
|
342
324
|
</div>
|
|
343
325
|
|
|
344
326
|
<CentroCustoSheet
|