feat: Add certificate templates for Scrum, ITIL, and PRINCE2 courses
- Add 3 new HTML templates: ScrumGeneric, ITIL, PRINCE2 - Add 3 background images: blue (Scrum), green (ITIL), orange (PRINCE2) - Extract and add signatures: Gablas, Husam - Update certificate.service.js to support multiple templates with different backgrounds Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,13 +20,26 @@ export const CERTIFICATE_TEMPLATES = {
|
||||
name: 'AI Certifikát',
|
||||
file: 'AIcertifikat.html',
|
||||
description: 'Osvedčenie o absolvovaní AI kurzu',
|
||||
background: 'background.jpeg',
|
||||
},
|
||||
ScrumGeneric: {
|
||||
name: 'Scrum (Gablas)',
|
||||
file: 'ScrumGeneric.html',
|
||||
description: 'Scrum Master / Product Owner - lektor Gablas',
|
||||
background: 'background-blue.jpeg',
|
||||
},
|
||||
ITIL: {
|
||||
name: 'ITIL (Husam)',
|
||||
file: 'ITIL.html',
|
||||
description: 'ITIL Foundation - lektor Husam',
|
||||
background: 'background-green.jpeg',
|
||||
},
|
||||
PRINCE2: {
|
||||
name: 'PRINCE2 (Gablas)',
|
||||
file: 'PRINCE2.html',
|
||||
description: 'PRINCE2 Foundation/Practitioner - lektor Gablas',
|
||||
background: 'background-orange.jpeg',
|
||||
},
|
||||
// Add more templates here in the future
|
||||
// participation: {
|
||||
// name: 'Potvrdenie o účasti',
|
||||
// file: 'participation.html',
|
||||
// description: 'Potvrdenie o účasti na školení',
|
||||
// },
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -57,9 +70,12 @@ const generateCertificateId = (registraciaId) => {
|
||||
/**
|
||||
* Load assets as base64 for embedding in HTML
|
||||
*/
|
||||
const loadAssets = async () => {
|
||||
const loadAssets = async (templateName) => {
|
||||
const template = CERTIFICATE_TEMPLATES[templateName];
|
||||
const backgroundFile = template?.background || 'background.jpeg';
|
||||
|
||||
const [background, signatureGablasova, signatureZdarilek] = await Promise.all([
|
||||
fs.readFile(path.join(ASSETS_DIR, 'background.jpeg')),
|
||||
fs.readFile(path.join(ASSETS_DIR, backgroundFile)),
|
||||
fs.readFile(path.join(ASSETS_DIR, 'signature-gablasova.png')),
|
||||
fs.readFile(path.join(ASSETS_DIR, 'signature-zdarilek.png')),
|
||||
]);
|
||||
@@ -196,7 +212,7 @@ export const generateCertificate = async (registraciaId, templateName = 'AIcerti
|
||||
// Load template and assets
|
||||
const [templateHtml, assets] = await Promise.all([
|
||||
loadTemplate(templateName),
|
||||
loadAssets(),
|
||||
loadAssets(templateName),
|
||||
]);
|
||||
|
||||
// Generate certificate data
|
||||
|
||||
Reference in New Issue
Block a user