@hed-hog/finance 0.0.301 → 0.0.303

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.
@@ -11,23 +11,6 @@
11
11
  - where:
12
12
  slug: admin-finance
13
13
 
14
- - menu_id:
15
- where:
16
- slug: /finance
17
- icon: chart-no-axes-combined
18
- url: /finance
19
- name:
20
- en: Overview
21
- pt: Visão geral
22
- slug: /finance/overview
23
- order: 101
24
- relations:
25
- role:
26
- - where:
27
- slug: admin
28
- - where:
29
- slug: admin-finance
30
-
31
14
  - menu_id:
32
15
  where:
33
16
  slug: /finance
@@ -17,6 +17,7 @@ type FinancePageSectionProps = {
17
17
  children: ReactNode;
18
18
  className?: string;
19
19
  contentClassName?: string;
20
+ variant?: 'card' | 'flat';
20
21
  };
21
22
 
22
23
  export function FinancePageSection({
@@ -26,9 +27,31 @@ export function FinancePageSection({
26
27
  children,
27
28
  className,
28
29
  contentClassName,
30
+ variant = 'card',
29
31
  }: FinancePageSectionProps) {
30
32
  const hasHeader = title || description || actions;
31
33
 
34
+ if (variant === 'flat') {
35
+ return (
36
+ <section className={cn('space-y-4', className)}>
37
+ {hasHeader ? (
38
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
39
+ <div className="space-y-1">
40
+ {title ? (
41
+ <h2 className="text-base font-semibold">{title}</h2>
42
+ ) : null}
43
+ {description ? (
44
+ <p className="text-sm text-muted-foreground">{description}</p>
45
+ ) : null}
46
+ </div>
47
+ {actions ? <div className="shrink-0">{actions}</div> : null}
48
+ </div>
49
+ ) : null}
50
+ <div className={cn(contentClassName)}>{children}</div>
51
+ </section>
52
+ );
53
+ }
54
+
32
55
  return (
33
56
  <Card
34
57
  className={cn(
@@ -1,26 +1,26 @@
1
1
  'use client';
2
2
 
3
- 'use client';
4
-
5
- import { FinancePageSection } from '@/app/(app)/(libraries)/finance/_components/finance-layout';
6
- import { Badge } from '@/components/ui/badge';
7
- import { Button } from '@/components/ui/button';
8
- import { EmptyState, Page, PageHeader } from '@/components/entity-list';
9
- import {
10
- Dialog,
11
- DialogContent,
3
+ 'use client';
4
+
5
+ import { FinancePageSection } from '@/app/(app)/(libraries)/finance/_components/finance-layout';
6
+ import { EmptyState, Page, PageHeader } from '@/components/entity-list';
7
+ import { Badge } from '@/components/ui/badge';
8
+ import { Button } from '@/components/ui/button';
9
+ import {
10
+ Dialog,
11
+ DialogContent,
12
12
  DialogDescription,
13
13
  DialogFooter,
14
14
  DialogHeader,
15
15
  DialogTitle,
16
16
  DialogTrigger,
17
- } from '@/components/ui/dialog';
18
- import { KpiCardsGrid } from '@/components/ui/kpi-cards-grid';
19
- import { Label } from '@/components/ui/label';
20
- import { Money } from '@/components/ui/money';
21
- import {
22
- Table,
23
- TableBody,
17
+ } from '@/components/ui/dialog';
18
+ import { KpiCardsGrid } from '@/components/ui/kpi-cards-grid';
19
+ import { Label } from '@/components/ui/label';
20
+ import { Money } from '@/components/ui/money';
21
+ import {
22
+ Table,
23
+ TableBody,
24
24
  TableCell,
25
25
  TableHead,
26
26
  TableHeader,
@@ -207,38 +207,38 @@ export default function AprovacoesPage() {
207
207
  },
208
208
  };
209
209
 
210
- const totalPendente = aprovacoes.reduce((acc, a) => acc + a.valor, 0);
211
- const urgentCount = aprovacoes.filter(
212
- (a) => a.urgencia === 'alta' || a.urgencia === 'critica'
213
- ).length;
214
- const summaryCards = [
215
- {
216
- key: 'pending',
217
- title: t('cards.pending'),
218
- value: aprovacoes.length,
219
- icon: Clock,
220
- layout: 'compact' as const,
221
- },
222
- {
223
- key: 'value',
224
- title: t('cards.totalValue'),
225
- value: <Money value={totalPendente} />,
226
- icon: AlertTriangle,
227
- layout: 'compact' as const,
228
- },
229
- {
230
- key: 'urgent',
231
- title: t('cards.urgent'),
232
- value: urgentCount,
233
- icon: AlertTriangle,
234
- layout: 'compact' as const,
235
- iconContainerClassName: 'bg-orange-500/10 text-orange-700',
236
- accentClassName: 'from-orange-500/20 via-amber-500/10 to-transparent',
237
- },
238
- ];
239
-
240
- return (
241
- <Page>
210
+ const totalPendente = aprovacoes.reduce((acc, a) => acc + a.valor, 0);
211
+ const urgentCount = aprovacoes.filter(
212
+ (a) => a.urgencia === 'alta' || a.urgencia === 'critica'
213
+ ).length;
214
+ const summaryCards = [
215
+ {
216
+ key: 'pending',
217
+ title: t('cards.pending'),
218
+ value: aprovacoes.length,
219
+ icon: Clock,
220
+ layout: 'compact' as const,
221
+ },
222
+ {
223
+ key: 'value',
224
+ title: t('cards.totalValue'),
225
+ value: <Money value={totalPendente} />,
226
+ icon: AlertTriangle,
227
+ layout: 'compact' as const,
228
+ },
229
+ {
230
+ key: 'urgent',
231
+ title: t('cards.urgent'),
232
+ value: urgentCount,
233
+ icon: AlertTriangle,
234
+ layout: 'compact' as const,
235
+ iconContainerClassName: 'bg-orange-500/10 text-orange-700',
236
+ accentClassName: 'from-orange-500/20 via-amber-500/10 to-transparent',
237
+ },
238
+ ];
239
+
240
+ return (
241
+ <Page>
242
242
  <PageHeader
243
243
  title={t('header.title')}
244
244
  description={t('header.description')}
@@ -246,20 +246,17 @@ export default function AprovacoesPage() {
246
246
  { label: t('breadcrumbs.home'), href: '/' },
247
247
  { label: t('breadcrumbs.finance'), href: '/finance' },
248
248
  { label: t('breadcrumbs.current') },
249
- ]}
250
- />
251
-
252
- <KpiCardsGrid items={summaryCards} columns={3} />
253
-
254
- <FinancePageSection
255
- title={t('table.title')}
256
- description={t('table.description')}
257
- >
258
- {aprovacoes.length > 0 ? (
259
- <div className="overflow-x-auto">
260
- <Table>
261
- <TableHeader>
262
- <TableRow>
249
+ ]}
250
+ />
251
+
252
+ <KpiCardsGrid items={summaryCards} columns={3} />
253
+
254
+ <FinancePageSection variant="flat">
255
+ {aprovacoes.length > 0 ? (
256
+ <div className="overflow-x-auto">
257
+ <Table>
258
+ <TableHeader>
259
+ <TableRow>
263
260
  <TableHead>{t('table.headers.document')}</TableHead>
264
261
  <TableHead>{t('table.headers.supplier')}</TableHead>
265
262
  <TableHead>{t('table.headers.requester')}</TableHead>
@@ -282,16 +279,16 @@ export default function AprovacoesPage() {
282
279
  const fornecedor = titulo
283
280
  ? getPessoaById(titulo.fornecedorId)
284
281
  : null;
285
- const urgencia =
286
- urgenciaConfig[
287
- aprovacao.urgencia as keyof typeof urgenciaConfig
288
- ] || urgenciaConfig.media;
289
-
290
- return (
291
- <TableRow key={aprovacao.id} className="hover:bg-muted/30">
292
- <TableCell className="font-medium">
293
- {titulo?.documento}
294
- </TableCell>
282
+ const urgencia =
283
+ urgenciaConfig[
284
+ aprovacao.urgencia as keyof typeof urgenciaConfig
285
+ ] || urgenciaConfig.media;
286
+
287
+ return (
288
+ <TableRow key={aprovacao.id} className="hover:bg-muted/30">
289
+ <TableCell className="font-medium">
290
+ {titulo?.documento}
291
+ </TableCell>
295
292
  <TableCell>{fornecedor?.nome}</TableCell>
296
293
  <TableCell>{aprovacao.solicitante}</TableCell>
297
294
  <TableCell className="text-right">
@@ -337,22 +334,20 @@ export default function AprovacoesPage() {
337
334
  </TableCell>
338
335
  </TableRow>
339
336
  );
340
- })}
341
- </TableBody>
342
- </Table>
343
- </div>
344
- ) : (
345
- <div className="px-4 py-8 sm:px-6">
346
- <EmptyState
347
- icon={<CheckCircle className="h-12 w-12" />}
348
- title={t('empty.title')}
349
- description={t('empty.description')}
350
- actionLabel={t('empty.refresh')}
351
- onAction={() => void refetch()}
352
- />
353
- </div>
354
- )}
355
- </FinancePageSection>
356
- </Page>
357
- );
358
- }
337
+ })}
338
+ </TableBody>
339
+ </Table>
340
+ </div>
341
+ ) : (
342
+ <EmptyState
343
+ icon={<CheckCircle className="h-12 w-12" />}
344
+ title={t('empty.title')}
345
+ description={t('empty.description')}
346
+ actionLabel={t('empty.refresh')}
347
+ onAction={() => void refetch()}
348
+ />
349
+ )}
350
+ </FinancePageSection>
351
+ </Page>
352
+ );
353
+ }