@hed-hog/core 0.0.329 → 0.0.331
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/core.module.d.ts.map +1 -1
- package/dist/core.module.js +7 -4
- package/dist/core.module.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/oauth/oauth.service.js +1 -1
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/pdf/components/index.d.ts +57 -0
- package/dist/pdf/components/index.d.ts.map +1 -0
- package/dist/pdf/components/index.js +258 -0
- package/dist/pdf/components/index.js.map +1 -0
- package/dist/pdf/dto/generate-pdf.dto.d.ts +5 -0
- package/dist/pdf/dto/generate-pdf.dto.d.ts.map +1 -0
- package/dist/pdf/dto/generate-pdf.dto.js +27 -0
- package/dist/pdf/dto/generate-pdf.dto.js.map +1 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.d.ts +10 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.d.ts.map +1 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.js +3 -0
- package/dist/pdf/interfaces/pdf-theme-config.interface.js.map +1 -0
- package/dist/pdf/pdf.controller.d.ts +16 -0
- package/dist/pdf/pdf.controller.d.ts.map +1 -0
- package/dist/pdf/pdf.controller.js +100 -0
- package/dist/pdf/pdf.controller.js.map +1 -0
- package/dist/pdf/pdf.module.d.ts +3 -0
- package/dist/pdf/pdf.module.d.ts.map +1 -0
- package/dist/pdf/pdf.module.js +29 -0
- package/dist/pdf/pdf.module.js.map +1 -0
- package/dist/pdf/pdf.service.d.ts +44 -0
- package/dist/pdf/pdf.service.d.ts.map +1 -0
- package/dist/pdf/pdf.service.js +185 -0
- package/dist/pdf/pdf.service.js.map +1 -0
- package/dist/pdf/templates/hcode-institutional.template.d.ts +36 -0
- package/dist/pdf/templates/hcode-institutional.template.d.ts.map +1 -0
- package/dist/pdf/templates/hcode-institutional.template.js +67 -0
- package/dist/pdf/templates/hcode-institutional.template.js.map +1 -0
- package/dist/pdf/themes/hcode.theme.d.ts +25 -0
- package/dist/pdf/themes/hcode.theme.d.ts.map +1 -0
- package/dist/pdf/themes/hcode.theme.js +504 -0
- package/dist/pdf/themes/hcode.theme.js.map +1 -0
- package/hedhog/data/route.yaml +8 -0
- package/hedhog/data/setting_group.yaml +60 -0
- package/hedhog/frontend/app/account/layout.tsx.ejs +1 -1
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +27 -23
- package/hedhog/frontend/app/mail/template/page.tsx.ejs +5 -5
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +574 -574
- package/hedhog/frontend/app/menu/page.tsx.ejs +7 -2
- package/hedhog/frontend/app/preferences/page.tsx.ejs +1 -1
- package/hedhog/frontend/app/roles/page.tsx.ejs +7 -2
- package/hedhog/frontend/app/users/page.tsx.ejs +1 -1
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +5 -9
- package/hedhog/frontend/messages/en.json +36 -1
- package/hedhog/frontend/messages/pt.json +36 -1
- package/package.json +5 -5
- package/src/core.module.ts +7 -4
- package/src/index.ts +9 -6
- package/src/oauth/oauth.service.ts +12 -12
- package/src/pdf/components/index.ts +316 -0
- package/src/pdf/dto/generate-pdf.dto.ts +11 -0
- package/src/pdf/interfaces/pdf-theme-config.interface.ts +10 -0
- package/src/pdf/pdf.controller.ts +86 -0
- package/src/pdf/pdf.module.ts +17 -0
- package/src/pdf/pdf.service.ts +229 -0
- package/src/pdf/templates/hcode-institutional.template.ts +122 -0
- package/src/pdf/themes/hcode.theme.ts +515 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { PdfThemeConfig } from '../interfaces/pdf-theme-config.interface';
|
|
2
|
+
import { buildFontImport, buildThemeCss } from '../themes/hcode.theme';
|
|
3
|
+
|
|
4
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
// Inline SVG icon paths (24×24 viewBox, stroke-width 2.2 — Design System spec)
|
|
6
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
const ICON_PATHS: Record<string, string> = {
|
|
8
|
+
discovery:
|
|
9
|
+
'<circle cx="11" cy="11" r="8" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
10
|
+
'<line x1="16.5" y1="16.5" x2="22" y2="22" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/>',
|
|
11
|
+
strategy:
|
|
12
|
+
'<rect x="3" y="12" width="4" height="9" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
13
|
+
'<rect x="10" y="7" width="4" height="14" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
14
|
+
'<rect x="17" y="3" width="4" height="18" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>',
|
|
15
|
+
governance:
|
|
16
|
+
'<polygon points="12,2 22,7 22,17 12,22 2,17 2,7" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
17
|
+
'<polygon points="12,7 17,9.5 17,14.5 12,17 7,14.5 7,9.5" stroke="currentColor" stroke-width="2.2" fill="none"/>',
|
|
18
|
+
training:
|
|
19
|
+
'<path d="M22 10v6m0 0l-10 5-10-5V10l10 5 10-5z" stroke="currentColor" stroke-width="2.2" fill="none" stroke-linejoin="round"/>',
|
|
20
|
+
curriculum:
|
|
21
|
+
'<rect x="2" y="3" width="20" height="14" rx="2" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
22
|
+
'<line x1="7" y1="8" x2="17" y2="8" stroke="currentColor" stroke-width="2.2"/>' +
|
|
23
|
+
'<line x1="7" y1="12" x2="13" y2="12" stroke="currentColor" stroke-width="2.2"/>',
|
|
24
|
+
agents:
|
|
25
|
+
'<circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
26
|
+
'<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
27
|
+
'<line x1="12" y1="3" x2="12" y2="1" stroke="currentColor" stroke-width="2.2"/>' +
|
|
28
|
+
'<line x1="12" y1="23" x2="12" y2="21" stroke="currentColor" stroke-width="2.2"/>' +
|
|
29
|
+
'<line x1="3" y1="12" x2="1" y2="12" stroke="currentColor" stroke-width="2.2"/>' +
|
|
30
|
+
'<line x1="23" y1="12" x2="21" y2="12" stroke="currentColor" stroke-width="2.2"/>',
|
|
31
|
+
datasets:
|
|
32
|
+
'<rect x="3" y="3" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
33
|
+
'<rect x="13" y="3" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
34
|
+
'<rect x="3" y="13" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
35
|
+
'<rect x="13" y="13" width="8" height="8" rx="1" stroke="currentColor" stroke-width="2.2" fill="none"/>',
|
|
36
|
+
impact:
|
|
37
|
+
'<polyline points="22,12 18,12 15,21 9,3 6,12 2,12" stroke="currentColor" stroke-width="2.2" fill="none" ' +
|
|
38
|
+
'stroke-linecap="round" stroke-linejoin="round"/>',
|
|
39
|
+
experiment:
|
|
40
|
+
'<path d="M9 3h6M9 3v7L4.5 17A2 2 0 006.4 20h11.2a2 2 0 001.9-3L15 10V3" ' +
|
|
41
|
+
'stroke="currentColor" stroke-width="2.2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>',
|
|
42
|
+
default:
|
|
43
|
+
'<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="2.2" fill="none"/>' +
|
|
44
|
+
'<line x1="12" y1="8" x2="12" y2="12" stroke="currentColor" stroke-width="2.2"/>' +
|
|
45
|
+
'<circle cx="12" cy="16" r="0.8" fill="currentColor"/>',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function inlineSvgIcon(name: string): string {
|
|
49
|
+
const path = ICON_PATHS[name] ?? ICON_PATHS.default;
|
|
50
|
+
return (
|
|
51
|
+
`<svg width="17" height="17" viewBox="0 0 24 24" fill="none" ` +
|
|
52
|
+
`xmlns="http://www.w3.org/2000/svg">${path}</svg>`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
57
|
+
// Logo
|
|
58
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Builds the logo HTML.
|
|
62
|
+
* If the admin has set a pdf-logo URL/data-URI → renders <img>.
|
|
63
|
+
* Otherwise renders the CSS-based wordmark from the Design System spec.
|
|
64
|
+
*/
|
|
65
|
+
export function buildLogoHtml(config: PdfThemeConfig, compact = false): string {
|
|
66
|
+
if (config.logoOverride) {
|
|
67
|
+
const h = compact ? '28px' : '36px';
|
|
68
|
+
return (
|
|
69
|
+
`<img src="${config.logoOverride}" alt="${config.companyName}" ` +
|
|
70
|
+
`style="max-height:${h};max-width:140px;object-fit:contain;">`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
if (compact) {
|
|
74
|
+
// Header-size lockup
|
|
75
|
+
return `<div style="display:flex;flex-direction:column;gap:2px;">
|
|
76
|
+
<div style="font-family:'Inter',sans-serif;font-weight:300;font-size:22px;letter-spacing:-0.01em;line-height:1;">
|
|
77
|
+
<span style="color:var(--primary)">h</span><span style="color:var(--ink-3)">code</span>
|
|
78
|
+
</div>
|
|
79
|
+
<div style="font-family:'Inter',sans-serif;font-weight:400;font-size:7px;letter-spacing:0.30em;text-transform:uppercase;color:var(--primary);">${config.area.toUpperCase()}</div>
|
|
80
|
+
</div>`;
|
|
81
|
+
}
|
|
82
|
+
return `<div class="lockup">
|
|
83
|
+
<div class="lockup-wordmark">
|
|
84
|
+
<span class="glyph">h</span><span class="wordmark">code</span>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="lockup-area">${config.area.toUpperCase()}</div>
|
|
87
|
+
</div>`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
91
|
+
// Page shell
|
|
92
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
93
|
+
|
|
94
|
+
/** Wraps everything in a complete HTML document with fonts + theme CSS. */
|
|
95
|
+
export function pageShell(extraHead: string, body: string, config: PdfThemeConfig): string {
|
|
96
|
+
return `<!DOCTYPE html>
|
|
97
|
+
<html lang="pt-BR">
|
|
98
|
+
<head>
|
|
99
|
+
<meta charset="UTF-8">
|
|
100
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
101
|
+
${buildFontImport()}
|
|
102
|
+
${buildThemeCss(config)}
|
|
103
|
+
${extraHead}
|
|
104
|
+
</head>
|
|
105
|
+
<body>
|
|
106
|
+
${body}
|
|
107
|
+
</body>
|
|
108
|
+
</html>`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
112
|
+
// Cover page
|
|
113
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
export interface CoverPageData {
|
|
116
|
+
title: string;
|
|
117
|
+
subtitle?: string;
|
|
118
|
+
/** defaults to current date formatted */
|
|
119
|
+
dateLabel?: string;
|
|
120
|
+
/** defaults to "HCODE · CNPJ 24.700.731/0001-08" */
|
|
121
|
+
bottomMeta?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Full-bleed A4 cover with Design System two-column layout. */
|
|
125
|
+
export function coverPage(config: PdfThemeConfig, data: CoverPageData): string {
|
|
126
|
+
const date =
|
|
127
|
+
data.dateLabel ??
|
|
128
|
+
new Date()
|
|
129
|
+
.toLocaleDateString('pt-BR', { month: 'long', year: 'numeric' })
|
|
130
|
+
.toUpperCase();
|
|
131
|
+
|
|
132
|
+
const areas = [
|
|
133
|
+
{ num: '01', label: 'CONSULTING' },
|
|
134
|
+
{ num: '02', label: 'TRAINING' },
|
|
135
|
+
{ num: '03', label: 'RESEARCH' },
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
return `<div class="cover">
|
|
139
|
+
<!-- LEFT: white, content -->
|
|
140
|
+
<div class="cover-left">
|
|
141
|
+
<div>
|
|
142
|
+
<div class="t-meta" style="margin-bottom:40px;">DESIGN SYSTEM · V1.0 · ${date}</div>
|
|
143
|
+
${buildLogoHtml(config)}
|
|
144
|
+
<div style="margin-top:32px;margin-bottom:20px;">
|
|
145
|
+
<div class="t-display">${data.title}</div>
|
|
146
|
+
</div>
|
|
147
|
+
${data.subtitle ? `<div class="t-body" style="max-width:340px;font-size:12px;">${data.subtitle}</div>` : ''}
|
|
148
|
+
</div>
|
|
149
|
+
<div class="t-micro">${data.bottomMeta ?? 'HCODE · CNPJ 24.700.731/0001-08'}</div>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<!-- RIGHT: primary color, glyph + area list -->
|
|
153
|
+
<div class="cover-right">
|
|
154
|
+
<div class="cover-system-label">HCODE / SYSTEM</div>
|
|
155
|
+
<div class="cover-release-label">RELEASE 01</div>
|
|
156
|
+
<div class="cover-right-glyph">h</div>
|
|
157
|
+
<ul class="cover-right-areas">
|
|
158
|
+
${areas
|
|
159
|
+
.map(
|
|
160
|
+
(a) =>
|
|
161
|
+
`<li><span class="num">0${areas.indexOf(a) + 1}</span>${a.label}</li>`,
|
|
162
|
+
)
|
|
163
|
+
.join('')}
|
|
164
|
+
</ul>
|
|
165
|
+
</div>
|
|
166
|
+
</div>`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
170
|
+
// Page header (accent bar + logo row)
|
|
171
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
172
|
+
|
|
173
|
+
/** Thin primary-colored bar at the very top of a content page. */
|
|
174
|
+
export function pageAccentBar(): string {
|
|
175
|
+
return `<div class="page-accent-bar"></div>`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Header row: compact logo lockup on the left, page title (meta) on the right.
|
|
179
|
+
* Matches Design System pattern: logo | ● PAGE · TITLE
|
|
180
|
+
*/
|
|
181
|
+
export function pageHeader(config: PdfThemeConfig, pageTitle: string): string {
|
|
182
|
+
return `<div class="page-header">
|
|
183
|
+
${buildLogoHtml(config, true)}
|
|
184
|
+
<div style="display:flex;align-items:center;gap:6px;">
|
|
185
|
+
<span style="display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--primary);flex-shrink:0;"></span>
|
|
186
|
+
<div class="t-meta" style="color:var(--ink-3);">${pageTitle.toUpperCase()}</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>`;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
192
|
+
// Section header
|
|
193
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
194
|
+
|
|
195
|
+
/** Eyebrow + H2 title with primary-color left accent bar — Design System spec. */
|
|
196
|
+
export function sectionHeader(eyebrow: string, title: string): string {
|
|
197
|
+
return `<div class="section-header">
|
|
198
|
+
<div class="t-eyebrow">${eyebrow}</div>
|
|
199
|
+
<div class="t-h2">${title}</div>
|
|
200
|
+
</div>`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
204
|
+
// Purpose block
|
|
205
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
206
|
+
|
|
207
|
+
/** Full-width colored block (primary background) with eyebrow, title and body. */
|
|
208
|
+
export function purposeBlock(eyebrow: string, title: string, body: string): string {
|
|
209
|
+
return `<div class="purpose-block no-break">
|
|
210
|
+
<div class="t-eyebrow">${eyebrow}</div>
|
|
211
|
+
<div class="t-h3">${title}</div>
|
|
212
|
+
<div class="t-body">${body}</div>
|
|
213
|
+
</div>`;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
217
|
+
// Feature cards
|
|
218
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
219
|
+
|
|
220
|
+
export interface FeatureCardData {
|
|
221
|
+
/** Key from the ICON_PATHS map (e.g. "discovery", "strategy") */
|
|
222
|
+
icon?: string;
|
|
223
|
+
title: string;
|
|
224
|
+
description: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** 3-column feature card grid — icon tile + colored title + body. */
|
|
228
|
+
export function featureCards(cards: FeatureCardData[]): string {
|
|
229
|
+
const items = cards
|
|
230
|
+
.map(
|
|
231
|
+
(c) => `<div class="feature-card no-break">
|
|
232
|
+
<div class="feature-card-icon">${inlineSvgIcon(c.icon ?? 'default')}</div>
|
|
233
|
+
<div class="feature-card-title">${c.title}</div>
|
|
234
|
+
<div class="feature-card-desc">${c.description}</div>
|
|
235
|
+
</div>`,
|
|
236
|
+
)
|
|
237
|
+
.join('');
|
|
238
|
+
return `<div class="feature-cards">${items}</div>`;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
242
|
+
// Chip
|
|
243
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
244
|
+
|
|
245
|
+
/** Pill chip with area-colored dot — Design System spec. */
|
|
246
|
+
export function chip(label: string): string {
|
|
247
|
+
return `<span class="chip">${label}</span>`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
251
|
+
// Data table
|
|
252
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
253
|
+
|
|
254
|
+
/** Responsive data table with page-break-inside:avoid on rows. */
|
|
255
|
+
export function dataTable(headers: string[], rows: string[][]): string {
|
|
256
|
+
const ths = headers.map((h) => `<th>${h}</th>`).join('');
|
|
257
|
+
const trs = rows
|
|
258
|
+
.map((row) => `<tr>${row.map((cell) => `<td>${cell}</td>`).join('')}</tr>`)
|
|
259
|
+
.join('');
|
|
260
|
+
return `<table class="data-table">
|
|
261
|
+
<thead><tr>${ths}</tr></thead>
|
|
262
|
+
<tbody>${trs}</tbody>
|
|
263
|
+
</table>`;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
267
|
+
// Metadata block
|
|
268
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
269
|
+
|
|
270
|
+
/** 4-column grid of label+value cells with rounded border. */
|
|
271
|
+
export function metadataBlock(items: Array<{ label: string; value: string }>): string {
|
|
272
|
+
const cells = items
|
|
273
|
+
.map(
|
|
274
|
+
(item) => `<div class="metadata-item">
|
|
275
|
+
<div class="metadata-label">${item.label}</div>
|
|
276
|
+
<div class="metadata-value">${item.value}</div>
|
|
277
|
+
</div>`,
|
|
278
|
+
)
|
|
279
|
+
.join('');
|
|
280
|
+
return `<div class="metadata-block">${cells}</div>`;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
284
|
+
// Signature area
|
|
285
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
286
|
+
|
|
287
|
+
/** Auto-grid of signature lines with optional name label. */
|
|
288
|
+
export function signatureArea(
|
|
289
|
+
signatories: Array<{ label: string; name?: string }>,
|
|
290
|
+
): string {
|
|
291
|
+
const items = signatories
|
|
292
|
+
.map(
|
|
293
|
+
(s) => `<div class="signature-item">
|
|
294
|
+
<div class="signature-line"></div>
|
|
295
|
+
<div class="signature-label">${s.label}</div>
|
|
296
|
+
${s.name ? `<div class="signature-name">${s.name}</div>` : ''}
|
|
297
|
+
</div>`,
|
|
298
|
+
)
|
|
299
|
+
.join('');
|
|
300
|
+
return `<div class="signature-area">${items}</div>`;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
304
|
+
// Fixed footer (repeats on every PDF page)
|
|
305
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Fixed footer that appears on every page.
|
|
309
|
+
* Left: company + doc label. Right: page counter via CSS counter(page).
|
|
310
|
+
*/
|
|
311
|
+
export function pdfFooter(companyName = 'hcode', docLabel = 'DESIGN SYSTEM V1.0'): string {
|
|
312
|
+
return `<div class="pdf-footer">
|
|
313
|
+
<div class="t-micro">${companyName.toUpperCase()} · ${docLabel}</div>
|
|
314
|
+
<div class="t-micro pdf-footer-page"></div>
|
|
315
|
+
</div>`;
|
|
316
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IsIn, IsOptional } from 'class-validator';
|
|
2
|
+
|
|
3
|
+
export class GeneratePdfDTO {
|
|
4
|
+
@IsOptional()
|
|
5
|
+
@IsIn(['consulting', 'training', 'research'])
|
|
6
|
+
area?: 'consulting' | 'training' | 'research';
|
|
7
|
+
|
|
8
|
+
@IsOptional()
|
|
9
|
+
@IsIn(['inline', 'attachment'])
|
|
10
|
+
disposition?: 'inline' | 'attachment';
|
|
11
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Public, Role } from '@hed-hog/api';
|
|
2
|
+
import { Controller, Get, Inject, Query, Res, forwardRef } from '@nestjs/common';
|
|
3
|
+
import { Response } from 'express';
|
|
4
|
+
|
|
5
|
+
import { GeneratePdfDTO } from './dto/generate-pdf.dto';
|
|
6
|
+
import { PdfService } from './pdf.service';
|
|
7
|
+
|
|
8
|
+
@Role()
|
|
9
|
+
@Controller('core/pdf')
|
|
10
|
+
export class PdfController {
|
|
11
|
+
constructor(
|
|
12
|
+
@Inject(forwardRef(() => PdfService))
|
|
13
|
+
private readonly pdfService: PdfService,
|
|
14
|
+
) {}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* GET /core/pdf/example
|
|
18
|
+
*
|
|
19
|
+
* Generates a sample hcode Institutional PDF using the Design System
|
|
20
|
+
* template with the currently configured area color.
|
|
21
|
+
* Publicly accessible — no auth required.
|
|
22
|
+
*/
|
|
23
|
+
@Public()
|
|
24
|
+
@Get('example')
|
|
25
|
+
async example(@Query() query: GeneratePdfDTO, @Res() res: Response) {
|
|
26
|
+
const area = query.area ?? 'consulting';
|
|
27
|
+
const disposition = query.disposition ?? 'inline';
|
|
28
|
+
|
|
29
|
+
const buffer = await this.pdfService.generatePdfFromTemplate(
|
|
30
|
+
'hcode-institutional',
|
|
31
|
+
{
|
|
32
|
+
area,
|
|
33
|
+
title: 'Inteligência aplicada.',
|
|
34
|
+
subtitle:
|
|
35
|
+
'De diagnóstico a aplicação: consultoria, formação e pesquisa em IA para empresas que querem liderar.',
|
|
36
|
+
description:
|
|
37
|
+
'Combinamos diagnóstico estratégico, formação corporativa e pesquisa aplicada para transformar ' +
|
|
38
|
+
'a inteligência artificial em resultado mensurável para o seu negócio.',
|
|
39
|
+
features: [
|
|
40
|
+
{
|
|
41
|
+
icon: 'discovery',
|
|
42
|
+
title: 'Discovery & Diagnóstico',
|
|
43
|
+
description:
|
|
44
|
+
'Mapeamento de maturidade, gaps e oportunidades de IA na sua operação atual.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
icon: 'strategy',
|
|
48
|
+
title: 'Estratégia & Roadmap',
|
|
49
|
+
description:
|
|
50
|
+
'Plano de adoção com priorização por impacto, viabilidade e alinhamento cultural.',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
icon: 'governance',
|
|
54
|
+
title: 'Governança & Ética',
|
|
55
|
+
description:
|
|
56
|
+
'Frameworks de uso responsável, políticas internas e compliance regulatório.',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
tableHeaders: ['Fase', 'Entregável', 'Duração', 'Responsável'],
|
|
60
|
+
tableRows: [
|
|
61
|
+
['01 · Discovery', 'Diagnóstico de maturidade IA', '2 semanas', 'hcode'],
|
|
62
|
+
['02 · Estratégia', 'Roadmap de adoção e priorização', '3 semanas', 'hcode + Cliente'],
|
|
63
|
+
['03 · Piloto', 'Implantação de caso de uso prioritário', '6 semanas', 'hcode + TI'],
|
|
64
|
+
['04 · Scale', 'Expansão e gestão de mudança', 'ongoing', 'Cliente (suporte hcode)'],
|
|
65
|
+
],
|
|
66
|
+
metadata: [
|
|
67
|
+
{ label: 'Área', value: area.charAt(0).toUpperCase() + area.slice(1) },
|
|
68
|
+
{ label: 'Versão', value: '1.0' },
|
|
69
|
+
{ label: 'Data', value: new Date().toLocaleDateString('pt-BR') },
|
|
70
|
+
{ label: 'Design System', value: 'DS v1.0' },
|
|
71
|
+
],
|
|
72
|
+
signatories: [
|
|
73
|
+
{ label: 'Responsável pelo Projeto' },
|
|
74
|
+
{ label: 'Aprovado por' },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
res.set({
|
|
80
|
+
'Content-Type': 'application/pdf',
|
|
81
|
+
'Content-Disposition': `${disposition}; filename="hcode-${area}-example.pdf"`,
|
|
82
|
+
'Content-Length': buffer.length,
|
|
83
|
+
});
|
|
84
|
+
res.end(buffer);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef, Module } from '@nestjs/common';
|
|
2
|
+
import { ConfigModule } from '@nestjs/config';
|
|
3
|
+
|
|
4
|
+
import { SettingModule } from '../setting/setting.module';
|
|
5
|
+
import { PdfController } from './pdf.controller';
|
|
6
|
+
import { PdfService } from './pdf.service';
|
|
7
|
+
|
|
8
|
+
@Module({
|
|
9
|
+
imports: [
|
|
10
|
+
ConfigModule,
|
|
11
|
+
forwardRef(() => SettingModule),
|
|
12
|
+
],
|
|
13
|
+
providers: [PdfService],
|
|
14
|
+
exports: [PdfService],
|
|
15
|
+
controllers: [PdfController],
|
|
16
|
+
})
|
|
17
|
+
export class PdfModule {}
|