@hed-hog/core 0.0.299 → 0.0.300

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 (112) hide show
  1. package/dist/dashboard/dashboard/dashboard.controller.d.ts +6 -0
  2. package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
  3. package/dist/dashboard/dashboard/dashboard.service.d.ts +6 -0
  4. package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
  5. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +2 -1
  6. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
  7. package/dist/dashboard/dashboard-component/dashboard-component.controller.js +6 -3
  8. package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
  9. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +7 -1
  10. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
  11. package/dist/dashboard/dashboard-component/dashboard-component.service.js +76 -33
  12. package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
  13. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +65 -0
  14. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
  15. package/dist/dashboard/dashboard-core/dashboard-core.controller.js +111 -0
  16. package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
  17. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +69 -0
  18. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
  19. package/dist/dashboard/dashboard-core/dashboard-core.service.js +526 -19
  20. package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
  21. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +2 -0
  22. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
  23. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +2 -0
  24. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
  25. package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts +2 -0
  26. package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts.map +1 -1
  27. package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts +2 -0
  28. package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts.map +1 -1
  29. package/hedhog/data/dashboard.yaml +12 -6
  30. package/hedhog/data/dashboard_component_role.yaml +66 -0
  31. package/hedhog/data/dashboard_role.yaml +2 -8
  32. package/hedhog/data/route.yaml +72 -0
  33. package/hedhog/frontend/app/dashboard/[slug]/dashboard-content.tsx.ejs +333 -128
  34. package/hedhog/frontend/app/dashboard/[slug]/widget-renderer.tsx.ejs +277 -53
  35. package/hedhog/frontend/app/dashboard/components/add-widget-selector-dialog.tsx.ejs +179 -231
  36. package/hedhog/frontend/app/dashboard/components/draggable-grid.tsx.ejs +64 -18
  37. package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +1389 -0
  38. package/hedhog/frontend/app/dashboard/dashboard.css.ejs +37 -0
  39. package/hedhog/frontend/app/dashboard/management/page.tsx.ejs +1 -1
  40. package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +6 -6
  41. package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +8 -8
  42. package/hedhog/frontend/app/dashboard/management/tabs/items-tab.tsx.ejs +3 -3
  43. package/hedhog/frontend/app/dashboard/page.tsx.ejs +3 -25
  44. package/hedhog/frontend/messages/en.json +112 -2
  45. package/hedhog/frontend/messages/pt.json +111 -1
  46. package/hedhog/frontend/widgets/account-security.tsx.ejs +1 -1
  47. package/hedhog/frontend/widgets/active-users-card.tsx.ejs +2 -2
  48. package/hedhog/frontend/widgets/activity-timeline.tsx.ejs +1 -1
  49. package/hedhog/frontend/widgets/email-notifications.tsx.ejs +1 -1
  50. package/hedhog/frontend/widgets/locale-config.tsx.ejs +1 -1
  51. package/hedhog/frontend/widgets/login-history-chart.tsx.ejs +1 -1
  52. package/hedhog/frontend/widgets/mail-config.tsx.ejs +1 -1
  53. package/hedhog/frontend/widgets/mail-sent-card.tsx.ejs +2 -2
  54. package/hedhog/frontend/widgets/mail-sent-chart.tsx.ejs +1 -1
  55. package/hedhog/frontend/widgets/menus-card.tsx.ejs +2 -2
  56. package/hedhog/frontend/widgets/oauth-config.tsx.ejs +1 -1
  57. package/hedhog/frontend/widgets/permissions-card.tsx.ejs +2 -2
  58. package/hedhog/frontend/widgets/permissions-chart.tsx.ejs +1 -1
  59. package/hedhog/frontend/widgets/profile-card.tsx.ejs +1 -1
  60. package/hedhog/frontend/widgets/routes-card.tsx.ejs +2 -2
  61. package/hedhog/frontend/widgets/session-activity-chart.tsx.ejs +1 -1
  62. package/hedhog/frontend/widgets/sessions-today-card.tsx.ejs +2 -2
  63. package/hedhog/frontend/widgets/stat-access-level.tsx.ejs +1 -1
  64. package/hedhog/frontend/widgets/stat-actions-today.tsx.ejs +1 -1
  65. package/hedhog/frontend/widgets/stat-consecutive-days.tsx.ejs +1 -1
  66. package/hedhog/frontend/widgets/stat-online-time.tsx.ejs +1 -1
  67. package/hedhog/frontend/widgets/storage-config.tsx.ejs +1 -1
  68. package/hedhog/frontend/widgets/theme-config.tsx.ejs +1 -1
  69. package/hedhog/frontend/widgets/user-growth-chart.tsx.ejs +1 -1
  70. package/hedhog/frontend/widgets/user-roles.tsx.ejs +1 -1
  71. package/hedhog/frontend/widgets/user-sessions.tsx.ejs +1 -1
  72. package/hedhog/table/dashboard.yaml +6 -0
  73. package/package.json +5 -5
  74. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +15 -2
  75. package/src/dashboard/dashboard-component/dashboard-component.service.ts +107 -43
  76. package/src/dashboard/dashboard-core/dashboard-core.controller.ts +112 -1
  77. package/src/dashboard/dashboard-core/dashboard-core.service.ts +674 -19
  78. package/hedhog/frontend/app/dashboard/components/widgets/core..gitkeep.ejs +0 -11
  79. package/hedhog/frontend/app/dashboard/components/widgets/core.account-security.tsx.ejs +0 -192
  80. package/hedhog/frontend/app/dashboard/components/widgets/core.active-users-card.tsx.ejs +0 -58
  81. package/hedhog/frontend/app/dashboard/components/widgets/core.activity-timeline.tsx.ejs +0 -223
  82. package/hedhog/frontend/app/dashboard/components/widgets/core.email-notifications.tsx.ejs +0 -226
  83. package/hedhog/frontend/app/dashboard/components/widgets/core.locale-config.tsx.ejs +0 -168
  84. package/hedhog/frontend/app/dashboard/components/widgets/core.login-history-chart.tsx.ejs +0 -115
  85. package/hedhog/frontend/app/dashboard/components/widgets/core.mail-config.tsx.ejs +0 -199
  86. package/hedhog/frontend/app/dashboard/components/widgets/core.mail-sent-card.tsx.ejs +0 -58
  87. package/hedhog/frontend/app/dashboard/components/widgets/core.mail-sent-chart.tsx.ejs +0 -149
  88. package/hedhog/frontend/app/dashboard/components/widgets/core.menus-card.tsx.ejs +0 -58
  89. package/hedhog/frontend/app/dashboard/components/widgets/core.oauth-config.tsx.ejs +0 -175
  90. package/hedhog/frontend/app/dashboard/components/widgets/core.permissions-card.tsx.ejs +0 -61
  91. package/hedhog/frontend/app/dashboard/components/widgets/core.permissions-chart.tsx.ejs +0 -156
  92. package/hedhog/frontend/app/dashboard/components/widgets/core.profile-card.tsx.ejs +0 -186
  93. package/hedhog/frontend/app/dashboard/components/widgets/core.routes-card.tsx.ejs +0 -58
  94. package/hedhog/frontend/app/dashboard/components/widgets/core.session-activity-chart.tsx.ejs +0 -183
  95. package/hedhog/frontend/app/dashboard/components/widgets/core.sessions-today-card.tsx.ejs +0 -62
  96. package/hedhog/frontend/app/dashboard/components/widgets/core.stat-access-level.tsx.ejs +0 -57
  97. package/hedhog/frontend/app/dashboard/components/widgets/core.stat-actions-today.tsx.ejs +0 -57
  98. package/hedhog/frontend/app/dashboard/components/widgets/core.stat-consecutive-days.tsx.ejs +0 -57
  99. package/hedhog/frontend/app/dashboard/components/widgets/core.stat-online-time.tsx.ejs +0 -57
  100. package/hedhog/frontend/app/dashboard/components/widgets/core.storage-config.tsx.ejs +0 -196
  101. package/hedhog/frontend/app/dashboard/components/widgets/core.theme-config.tsx.ejs +0 -213
  102. package/hedhog/frontend/app/dashboard/components/widgets/core.user-growth-chart.tsx.ejs +0 -210
  103. package/hedhog/frontend/app/dashboard/components/widgets/core.user-roles.tsx.ejs +0 -132
  104. package/hedhog/frontend/app/dashboard/components/widgets/core.user-sessions.tsx.ejs +0 -236
  105. package/hedhog/frontend/app/dashboard/components/widgets/finance.alerts.tsx.ejs +0 -108
  106. package/hedhog/frontend/app/dashboard/components/widgets/finance.cash-balance-kpi.tsx.ejs +0 -66
  107. package/hedhog/frontend/app/dashboard/components/widgets/finance.cash-flow-chart.tsx.ejs +0 -122
  108. package/hedhog/frontend/app/dashboard/components/widgets/finance.default-kpi.tsx.ejs +0 -63
  109. package/hedhog/frontend/app/dashboard/components/widgets/finance.payable-30d-kpi.tsx.ejs +0 -73
  110. package/hedhog/frontend/app/dashboard/components/widgets/finance.receivable-30d-kpi.tsx.ejs +0 -73
  111. package/hedhog/frontend/app/dashboard/components/widgets/finance.upcoming-payable.tsx.ejs +0 -123
  112. package/hedhog/frontend/app/dashboard/components/widgets/finance.upcoming-receivable.tsx.ejs +0 -118
@@ -1,73 +0,0 @@
1
- 'use client';
2
-
3
- import { Card, CardContent } from '@/components/ui/card';
4
- import { useWidgetData } from '@/hooks/use-widget-data';
5
- import { TrendingUp } from 'lucide-react';
6
- import { useTranslations } from 'next-intl';
7
- import { WidgetWrapper } from '../widget-wrapper';
8
-
9
- interface Receivable30dKpiProps {
10
- widget?: { name?: string };
11
- onRemove?: () => void;
12
- }
13
-
14
- interface FinanceData {
15
- kpis?: {
16
- aReceber30dias: number;
17
- aReceber7dias: number;
18
- };
19
- }
20
-
21
- export default function Receivable30dKpi({
22
- widget,
23
- onRemove,
24
- }: Receivable30dKpiProps) {
25
- const t = useTranslations('finance.DashboardPage');
26
-
27
- const { data, isLoading, isAccessDenied, isError } =
28
- useWidgetData<FinanceData>({
29
- endpoint: '/finance/data',
30
- queryKey: 'finance-kpi-receivable-30d',
31
- });
32
-
33
- const value = data?.kpis?.aReceber30dias ?? 0;
34
- const sevenDays = data?.kpis?.aReceber7dias ?? 0;
35
- const formatted = new Intl.NumberFormat('pt-BR', {
36
- style: 'currency',
37
- currency: 'BRL',
38
- }).format(value);
39
-
40
- return (
41
- <WidgetWrapper
42
- isLoading={isLoading}
43
- isAccessDenied={isAccessDenied}
44
- isError={isError}
45
- widgetName={widget?.name || t('kpis.receivable30.title')}
46
- onRemove={onRemove}
47
- >
48
- <Card className="h-full overflow-hidden transition-all duration-300 hover:shadow-md">
49
- <CardContent className="flex h-full items-center gap-3 p-4">
50
- <div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-green-50">
51
- <TrendingUp className="h-5 w-5 text-green-600" />
52
- </div>
53
- <div className="flex min-w-0 flex-col">
54
- <span className="text-[10px] font-medium uppercase tracking-wider text-muted-foreground">
55
- {t('kpis.receivable30.title')}
56
- </span>
57
- <span className="truncate text-lg font-bold tracking-tight text-foreground">
58
- {formatted}
59
- </span>
60
- <span className="text-[10px] text-muted-foreground">
61
- {t('kpis.receivable30.sevenDays', {
62
- value: new Intl.NumberFormat('pt-BR', {
63
- style: 'currency',
64
- currency: 'BRL',
65
- }).format(sevenDays),
66
- })}
67
- </span>
68
- </div>
69
- </CardContent>
70
- </Card>
71
- </WidgetWrapper>
72
- );
73
- }
@@ -1,123 +0,0 @@
1
- 'use client';
2
-
3
- import {
4
- Card,
5
- CardContent,
6
- CardDescription,
7
- CardHeader,
8
- CardTitle,
9
- } from '@/components/ui/card';
10
- import { Money } from '@/components/ui/money';
11
- import { StatusBadge } from '@/components/ui/status-badge';
12
- import { useWidgetData } from '@/hooks/use-widget-data';
13
- import { ArrowDownRight } from 'lucide-react';
14
- import { useTranslations } from 'next-intl';
15
- import Link from 'next/link';
16
- import { WidgetWrapper } from '../widget-wrapper';
17
-
18
- interface FinanceData {
19
- titulosPagar?: Array<{
20
- id: string;
21
- status: string;
22
- documento: string;
23
- fornecedorId?: string;
24
- parcelas: Array<{
25
- status: string;
26
- vencimento: string;
27
- valor: number;
28
- }>;
29
- }>;
30
- pessoas?: Array<{
31
- id: string;
32
- nome: string;
33
- }>;
34
- }
35
-
36
- interface UpcomingPayableProps {
37
- widget?: { name?: string };
38
- onRemove?: () => void;
39
- }
40
-
41
- function formatDate(value: string) {
42
- return new Date(value).toLocaleDateString('pt-BR');
43
- }
44
-
45
- export default function UpcomingPayable({
46
- widget,
47
- onRemove,
48
- }: UpcomingPayableProps) {
49
- const t = useTranslations('finance.DashboardPage');
50
-
51
- const { data, isLoading, isAccessDenied, isError } =
52
- useWidgetData<FinanceData>({
53
- endpoint: '/finance/data',
54
- queryKey: 'finance-upcoming-payable',
55
- });
56
-
57
- const getPersonById = (id?: string) =>
58
- (data?.pessoas || []).find((p) => p.id === id);
59
-
60
- const approvedPayables = (data?.titulosPagar || []).filter(
61
- (titulo) => titulo.status !== 'rascunho' && titulo.status !== 'cancelado'
62
- );
63
-
64
- const rows = approvedPayables
65
- .flatMap((titulo) =>
66
- titulo.parcelas
67
- .filter((p) => p.status === 'aberto' || p.status === 'vencido')
68
- .map((parcela) => ({
69
- tituloId: titulo.id,
70
- documento: titulo.documento,
71
- person: getPersonById(titulo.fornecedorId)?.nome || '',
72
- dueDate: parcela.vencimento,
73
- value: parcela.valor,
74
- status: parcela.status,
75
- }))
76
- )
77
- .slice(0, 3);
78
-
79
- return (
80
- <WidgetWrapper
81
- isLoading={isLoading}
82
- isAccessDenied={isAccessDenied}
83
- isError={isError}
84
- widgetName={widget?.name || t('upcoming.payable')}
85
- onRemove={onRemove}
86
- >
87
- <Card className="h-full">
88
- <CardHeader>
89
- <CardTitle className="flex items-center gap-2 text-base">
90
- <ArrowDownRight className="h-4 w-4 text-red-500" />
91
- {t('upcoming.payable')}
92
- </CardTitle>
93
- <CardDescription>{t('upcoming.nextDueDates')}</CardDescription>
94
- </CardHeader>
95
- <CardContent>
96
- <div className="space-y-4">
97
- {rows.map((item, index) => (
98
- <Link
99
- key={index}
100
- href={`/finance/accounts-payable/installments/${item.tituloId}`}
101
- className="-m-2 flex cursor-pointer items-center justify-between rounded-md p-2 transition-colors hover:bg-muted/50 active:bg-muted"
102
- >
103
- <div className="space-y-1">
104
- <p className="text-sm font-medium">{item.documento}</p>
105
- <p className="text-xs text-muted-foreground">{item.person}</p>
106
- </div>
107
- <div className="text-right">
108
- <p className="text-sm font-medium">
109
- <Money value={item.value} />
110
- </p>
111
- <p className="text-xs text-muted-foreground">
112
- {formatDate(item.dueDate)}
113
- </p>
114
- </div>
115
- <StatusBadge status={item.status as any} />
116
- </Link>
117
- ))}
118
- </div>
119
- </CardContent>
120
- </Card>
121
- </WidgetWrapper>
122
- );
123
- }
@@ -1,118 +0,0 @@
1
- 'use client';
2
-
3
- import {
4
- Card,
5
- CardContent,
6
- CardDescription,
7
- CardHeader,
8
- CardTitle,
9
- } from '@/components/ui/card';
10
- import { Money } from '@/components/ui/money';
11
- import { StatusBadge } from '@/components/ui/status-badge';
12
- import { useWidgetData } from '@/hooks/use-widget-data';
13
- import { ArrowUpRight } from 'lucide-react';
14
- import { useTranslations } from 'next-intl';
15
- import Link from 'next/link';
16
- import { WidgetWrapper } from '../widget-wrapper';
17
-
18
- interface FinanceData {
19
- titulosReceber?: Array<{
20
- id: string;
21
- documento: string;
22
- clienteId?: string;
23
- parcelas: Array<{
24
- status: string;
25
- vencimento: string;
26
- valor: number;
27
- }>;
28
- }>;
29
- pessoas?: Array<{
30
- id: string;
31
- nome: string;
32
- }>;
33
- }
34
-
35
- interface UpcomingReceivableProps {
36
- widget?: { name?: string };
37
- onRemove?: () => void;
38
- }
39
-
40
- function formatDate(value: string) {
41
- return new Date(value).toLocaleDateString('pt-BR');
42
- }
43
-
44
- export default function UpcomingReceivable({
45
- widget,
46
- onRemove,
47
- }: UpcomingReceivableProps) {
48
- const t = useTranslations('finance.DashboardPage');
49
-
50
- const { data, isLoading, isAccessDenied, isError } =
51
- useWidgetData<FinanceData>({
52
- endpoint: '/finance/data',
53
- queryKey: 'finance-upcoming-receivable',
54
- });
55
-
56
- const getPersonById = (id?: string) =>
57
- (data?.pessoas || []).find((p) => p.id === id);
58
-
59
- const rows = (data?.titulosReceber || [])
60
- .flatMap((titulo) =>
61
- titulo.parcelas
62
- .filter((p) => p.status === 'aberto' || p.status === 'vencido')
63
- .map((parcela) => ({
64
- tituloId: titulo.id,
65
- documento: titulo.documento,
66
- person: getPersonById(titulo.clienteId)?.nome || '',
67
- dueDate: parcela.vencimento,
68
- value: parcela.valor,
69
- status: parcela.status,
70
- }))
71
- )
72
- .slice(0, 3);
73
-
74
- return (
75
- <WidgetWrapper
76
- isLoading={isLoading}
77
- isAccessDenied={isAccessDenied}
78
- isError={isError}
79
- widgetName={widget?.name || t('upcoming.receivable')}
80
- onRemove={onRemove}
81
- >
82
- <Card className="h-full">
83
- <CardHeader>
84
- <CardTitle className="flex items-center gap-2 text-base">
85
- <ArrowUpRight className="h-4 w-4 text-green-500" />
86
- {t('upcoming.receivable')}
87
- </CardTitle>
88
- <CardDescription>{t('upcoming.nextDueDates')}</CardDescription>
89
- </CardHeader>
90
- <CardContent>
91
- <div className="space-y-4">
92
- {rows.map((item, index) => (
93
- <Link
94
- key={index}
95
- href={`/finance/accounts-receivable/installments/${item.tituloId}`}
96
- className="-m-2 flex cursor-pointer items-center justify-between rounded-md p-2 transition-colors hover:bg-muted/50 active:bg-muted"
97
- >
98
- <div className="space-y-1">
99
- <p className="text-sm font-medium">{item.documento}</p>
100
- <p className="text-xs text-muted-foreground">{item.person}</p>
101
- </div>
102
- <div className="text-right">
103
- <p className="text-sm font-medium">
104
- <Money value={item.value} />
105
- </p>
106
- <p className="text-xs text-muted-foreground">
107
- {formatDate(item.dueDate)}
108
- </p>
109
- </div>
110
- <StatusBadge status={item.status as any} />
111
- </Link>
112
- ))}
113
- </div>
114
- </CardContent>
115
- </Card>
116
- </WidgetWrapper>
117
- );
118
- }