feat: Quickstart, Benutzerverwaltung und Orion-Ergebnisbox

This commit is contained in:
Schubert Ferenc 2026-07-12 12:19:54 +02:00
parent 4f669a3426
commit e9e46f2cb4
404 changed files with 1032 additions and 600 deletions

View file

@ -0,0 +1,66 @@
from __future__ import annotations
from dataclasses import dataclass
from app.modules.orion.html import text
@dataclass(frozen=True)
class ResultPresentation:
key: str
label: str
css_class: str
color: str
RESULT_PRESENTATIONS: dict[str, ResultPresentation] = {
"BESTANDEN": ResultPresentation("BESTANDEN", "Bestanden", "result-box--passed", "#245C36"),
"BESTANDEN_MIT_AUFLAGEN": ResultPresentation(
"BESTANDEN_MIT_AUFLAGEN",
"Bestanden mit Auflagen",
"result-box--conditional",
"#7A5A00",
),
"NICHT_BESTANDEN": ResultPresentation(
"NICHT_BESTANDEN",
"Nicht bestanden",
"result-box--failed",
"#7A1F26",
),
"OFFEN": ResultPresentation("OFFEN", "Noch nicht bewertet", "result-box--open", "#2E3B40"),
}
RESULT_ALIASES = {
"": "OFFEN",
"OFFEN": "OFFEN",
"BESTANDEN": "BESTANDEN",
"BESTANDEN_MIT_AUFLAGEN": "BESTANDEN_MIT_AUFLAGEN",
"NICHT_BESTANDEN": "NICHT_BESTANDEN",
"offen": "OFFEN",
"bestanden": "BESTANDEN",
"bestanden_mit_auflagen": "BESTANDEN_MIT_AUFLAGEN",
"mit_auflagen": "BESTANDEN_MIT_AUFLAGEN",
"bestanden mit Auflagen": "BESTANDEN_MIT_AUFLAGEN",
"nicht_bestanden": "NICHT_BESTANDEN",
"nicht bestanden": "NICHT_BESTANDEN",
}
def validation_result_presentation(value: str | None) -> ResultPresentation:
key = RESULT_ALIASES.get(str(value or "").strip(), "OFFEN")
return RESULT_PRESENTATIONS[key]
def validation_result_label(value: str | None) -> str:
return validation_result_presentation(value).label
def validation_result_box(value: str | None, *, compact: bool = False) -> str:
presentation = validation_result_presentation(value)
size_class = "result-box--compact" if compact else "result-box--cover"
return (
f'<div class="result-box {size_class} {presentation.css_class}">'
'<div class="result-box__label">VALIDIERUNGSERGEBNIS</div>'
f'<div class="result-box__value">{text(presentation.label.upper() if not compact else presentation.label)}</div>'
"</div>"
)