feat: implement certificate history, intern submission views, and task management hooks

This commit is contained in:
Kemas M. Aryadary Rasyad
2026-07-29 01:29:16 +07:00
parent 09ddb21159
commit 41349e5303
11 changed files with 56 additions and 147 deletions
-108
View File
@@ -1,108 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Great+Vibes&family=Grenze:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<style>
html, body {
margin: 0;
padding: 0;
min-height: 100vh;
background: #1a1a1a;
display: flex;
align-items: center;
justify-content: center;
}
#preview {
max-width: 100%;
height: auto;
border: 1px solid #ffffff55;
box-shadow: 0 0 0 1px #000, 0 4px 20px rgba(0, 0, 0, 0.6);
}
</style>
</head>
<body>
<canvas id="preview"></canvas>
<script>
const TEMPLATE_PATH = "../../assets/template.png";
// LAYOUT
const LAYOUT = {
internName: { x: 0.54, y: 0.5, size: 130, font: "Great Vibes", color: "#800000" },
internNameSmall: { x: 0.82, y: 0.889, size: 33, font: "Great Vibes", color: "#800000" },
projectName: { x: 0.815, y: 0.598, size: 46, font: "Grenze", color: "#800000" },
duration: { x: 0.692, y: 0.645, size: 48, font: "Grenze", color: "#090909" },
certNo: { x: 0.56, y: 0.305, size: 50, font: "Grenze", color: "#090909" },
certNoSmall: { x: 0.825, y: 0.91, size: 22, font: "Grenze", color: "#800000" },
qr: { x: 0.77, y: 0.715, size: 0.103 },
};
const DATA = {
internName: "Kemas M. Aryadary Rasyad",
projectName: "Internify Proyek Humic",
duration: "20 April 2026 - 20 Juni 2026",
certNo: "No.2026/SPI3/CERT/XXXXXX/1",
verifyUrl: "dummy-uuid-preview",
};
function loadImage(src) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = () => reject(new Error("Gagal load gambar: " + src));
img.src = src;
});
}
async function ensureFontsLoaded() {
await Promise.all([
document.fonts.load('400 105px "Great Vibes"'),
document.fonts.load('400 54px "Grenze"'),
]);
await document.fonts.ready;
}
async function draw() {
await ensureFontsLoaded();
const templateImg = await loadImage(TEMPLATE_PATH);
const canvas = document.getElementById("preview");
canvas.width = templateImg.naturalWidth;
canvas.height = templateImg.naturalHeight;
const ctx = canvas.getContext("2d");
ctx.drawImage(templateImg, 0, 0);
ctx.textAlign = "center";
ctx.textBaseline = "middle";
const text = (cfg, value) => {
ctx.font = `400 ${cfg.size}px "${cfg.font}", serif`;
ctx.fillStyle = cfg.color;
ctx.fillText(value, canvas.width * cfg.x, canvas.height * cfg.y);
};
text(LAYOUT.internName, DATA.internName);
text(LAYOUT.internNameSmall, DATA.internName);
text(LAYOUT.projectName, DATA.projectName);
text(LAYOUT.duration, DATA.duration);
text(LAYOUT.certNo, DATA.certNo);
text(LAYOUT.certNoSmall, DATA.certNo);
// QR
const qrSize = Math.round(canvas.width * LAYOUT.qr.size);
ctx.fillStyle = "#000";
ctx.fillRect(canvas.width * LAYOUT.qr.x, canvas.height * LAYOUT.qr.y, qrSize, qrSize);
}
draw().catch((err) => {
document.body.insertAdjacentHTML("beforeend", `<pre style="color:red">${err.message}</pre>`);
});
</script>
</body>
</html>