gwoe-antragspruefer/app/templates/v2/screens/scorecard.html
Dotty Dotter 1faf4e9220 feat(#179 Phase 15): Scorecards — HTML-Template + PNG-Endpoint
Mockup im GWÖ-Stil mit:
- Drucksachen-Header (Kicker + Datum)
- Titel + antragstellende Fraktionen als Pills
- Empfehlungs-Verdict
- 420-Zeichen-Zusammenfassung
- Big Score-Zahl (farbcodiert nach 8/5/3-Schwellen)
- 5x5 Mini-Matrix mit korrekten 5 Klassen (rating-pp/-p/-0/-n/-nn)
- Footer mit Brand + Drucksachen-ID

Endpoints:
- GET /v2/scorecard?drucksache=&bundesland=&format=og|square (HTML)
- GET /api/assessment/scorecard.png?... (PNG via Playwright,
  1200x630 für og, 1080x1080 für square)

Pattern entlehnt von app/og_card.py (Playwright-Headless-Render).

Refs: #179

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 23:44:21 +02:00

192 lines
5.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Scorecard — {{ assessment.title }}</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Source Sans Pro', 'Helvetica Neue', sans-serif; }
body {
width: {{ width }}px;
height: {{ height }}px;
background: linear-gradient(135deg, #f8faf2 0%, #e9ede0 100%);
color: #1f1f1f;
overflow: hidden;
position: relative;
}
.card {
width: 100%;
height: 100%;
padding: {{ '38px 48px' if width >= 1200 else '32px 36px' }};
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
}
.header {
display: flex;
justify-content: space-between;
align-items: baseline;
border-bottom: 2px solid #009DA5;
padding-bottom: 10px;
}
.kicker {
font-family: 'Source Code Pro', monospace;
font-size: 12pt;
color: #009DA5;
text-transform: uppercase;
letter-spacing: 0.1em;
}
.meta {
font-family: 'Source Code Pro', monospace;
font-size: 11pt;
color: #555;
}
.body-grid {
flex: 1;
display: grid;
grid-template-columns: {{ '1.4fr 1fr' if width >= 1200 else '1fr' }};
gap: 28px;
margin-top: 22px;
}
.left-col h1 {
font-size: {{ '28pt' if width >= 1200 else '22pt' }};
line-height: 1.18;
margin-bottom: 14px;
color: #1f1f1f;
font-weight: 700;
}
.left-col .fraktionen {
font-family: 'Source Code Pro', monospace;
font-size: 11pt;
color: #555;
margin-bottom: 18px;
}
.left-col .fraktionen .pill {
display: inline-block;
padding: 2px 10px;
background: rgba(136, 158, 51, 0.15);
color: #44570a;
border-radius: 3px;
margin-right: 5px;
}
.left-col .verdict {
font-size: 14pt;
color: #1a7f37;
font-weight: 600;
margin-bottom: 12px;
}
.left-col .summary {
font-size: 12pt;
line-height: 1.55;
color: #333;
/* Clamp fuer Lang-Texte */
display: -webkit-box;
-webkit-line-clamp: {{ 6 if width >= 1200 else 4 }};
-webkit-box-orient: vertical;
overflow: hidden;
}
.right-col {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding-top: 8px;
}
.score-big {
font-family: 'Source Code Pro', monospace;
font-size: {{ '88pt' if width >= 1200 else '72pt' }};
font-weight: 700;
line-height: 1;
color: {{ score_color }};
margin-bottom: 4px;
}
.score-label {
font-family: 'Source Code Pro', monospace;
font-size: 11pt;
text-transform: uppercase;
letter-spacing: 0.1em;
color: #555;
margin-bottom: 16px;
}
/* Mini-Matrix 5x5 */
.matrix {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(5, 1fr);
gap: 2px;
width: {{ '220px' if width >= 1200 else '160px' }};
aspect-ratio: 1 / 1;
}
.matrix .cell {
border-radius: 2px;
display: flex;
align-items: center;
justify-content: center;
font-family: 'Source Code Pro', monospace;
font-size: 10pt;
font-weight: 700;
}
.cell.r-pp { background: #889E33; color: #fff; }
.cell.r-p { background: #cddaa1; color: #44570a; }
.cell.r-0 { background: #f0f0f0; color: #888; }
.cell.r-n { background: #efc9c3; color: #931515; }
.cell.r-nn { background: #9A2A2A; color: #fff; }
.footer {
position: absolute;
bottom: {{ '16px' if width >= 1200 else '12px' }};
left: {{ '48px' if width >= 1200 else '36px' }};
right: {{ '48px' if width >= 1200 else '36px' }};
display: flex;
justify-content: space-between;
align-items: center;
font-family: 'Source Code Pro', monospace;
font-size: 9pt;
color: #888;
border-top: 1px solid rgba(0,0,0,0.1);
padding-top: 8px;
}
.footer .brand { color: #009DA5; font-weight: 700; letter-spacing: 0.06em; }
</style>
</head>
<body>
<div class="card">
<div class="header">
<div class="kicker">GWÖ-Bewertung · {{ bundesland }} · {{ assessment.drucksache }}</div>
<div class="meta">{{ datum }}</div>
</div>
<div class="body-grid">
<div class="left-col">
<h1>{{ assessment.title|truncate(100, end="…") }}</h1>
{% if fraktionen %}
<div class="fraktionen">
{% for f in fraktionen %}<span class="pill">{{ f }}</span>{% endfor %}
</div>
{% endif %}
<div class="verdict">{{ assessment.empfehlung.value }}</div>
<div class="summary">{{ assessment.gwoe_begruendung|truncate(420, end="…") }}</div>
</div>
<div class="right-col">
<div class="score-big">{{ "%.1f"|format(assessment.gwoe_score) }}</div>
<div class="score-label">GWÖ-Score · 010</div>
<div class="matrix">
{% for r in ['A','B','C','D','E'] %}
{% for c in ['1','2','3','4','5'] %}
{% set cell = matrix_lookup.get(r ~ c, {}) %}
{% set rt = cell.get('rating', 0) %}
<div class="cell {% if rt >= 4 %}r-pp{% elif rt >= 1 %}r-p{% elif rt == 0 %}r-0{% elif rt <= -4 %}r-nn{% else %}r-n{% endif %}">
{% if rt >= 4 %}++{% elif rt >= 1 %}+{% elif rt == 0 %}·{% elif rt <= -4 %}{% else %}{% endif %}
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>
<div class="footer">
<span><span class="brand">gwoe.toppyr.de</span> · automatische Gemeinwohl-Bilanzierung</span>
<span>{{ assessment.drucksache }}</span>
</div>
</div>
</body>
</html>