This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
breakpilot-pwa/backend/frontend/school/pages/parent_onboarding.py
BreakPilot Dev 19855efacc
Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
feat: BreakPilot PWA - Full codebase (clean push without large binaries)
All services: admin-v2, studio-v2, website, ai-compliance-sdk,
consent-service, klausur-service, voice-service, and infrastructure.
Large PDFs and compiled binaries excluded via .gitignore.
2026-02-11 13:25:58 +01:00

181 lines
6.1 KiB
Python
Raw Permalink 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.
"""
School Module - Parent Onboarding Page
QR code landing page for parent registration
"""
from ..styles import SCHOOL_BASE_STYLES, ONBOARDING_STYLES
from ..templates import COMMON_SCRIPTS
def parent_onboarding() -> str:
"""Parent onboarding page (QR code landing)"""
# Onboarding page uses its own simplified styles without sidebar
styles = f"""
:root {{
--bp-primary: #6C1B1B;
--bp-bg: #F8F8F8;
--bp-surface: #FFFFFF;
--bp-text: #4A4A4A;
--bp-text-muted: #6B6B6B;
--bp-accent: #5ABF60;
--bp-border: #E0E0E0;
}}
* {{ box-sizing: border-box; margin: 0; padding: 0; }}
{ONBOARDING_STYLES}
"""
content = '''
<div class="onboarding-container">
<div class="logo">
<div class="logo-icon">BP</div>
<span class="logo-text">BreakPilot</span>
</div>
<div id="loading">
<div class="spinner"></div>
<p>QR-Code wird validiert...</p>
</div>
<div id="content" style="display: none;">
<h1>Eltern-Registrierung</h1>
<p class="subtitle">Sie wurden eingeladen, sich für die Schulkommunikation zu registrieren.</p>
<div id="error" class="error" style="display: none;"></div>
<div id="success" class="success" style="display: none;"></div>
<div class="info-card">
<div class="info-row">
<span class="info-label">Schule</span>
<span class="info-value" id="school-name">-</span>
</div>
<div class="info-row">
<span class="info-label">Klasse</span>
<span class="info-value" id="class-name">-</span>
</div>
<div class="info-row">
<span class="info-label">Kind</span>
<span class="info-value" id="student-name">-</span>
</div>
<div class="info-row">
<span class="info-label">Ihre Rolle</span>
<span class="info-value" id="role">Elternteil</span>
</div>
</div>
<div class="checkbox-group">
<div class="checkbox-item">
<input type="checkbox" id="consent-terms" required>
<label class="checkbox-label" for="consent-terms">
Ich habe die <a href="/terms" target="_blank">Nutzungsbedingungen</a> gelesen und akzeptiere diese.
</label>
</div>
<div class="checkbox-item">
<input type="checkbox" id="consent-privacy" required>
<label class="checkbox-label" for="consent-privacy">
Ich habe die <a href="/privacy" target="_blank">Datenschutzerklärung</a> gelesen und stimme der Verarbeitung meiner Daten zu.
</label>
</div>
<div class="checkbox-item">
<input type="checkbox" id="consent-custody" required>
<label class="checkbox-label" for="consent-custody">
Ich bestätige, dass ich sorgeberechtigt für das oben genannte Kind bin.
</label>
</div>
</div>
<button class="btn btn-primary" id="submit-btn" onclick="completeOnboarding()" disabled>
Registrierung abschließen
</button>
</div>
</div>'''
scripts = '''
<script>
const API_BASE = '/api/v1';
let tokenData = null;
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
async function validateToken() {
if (!token) {
showError('Kein gültiger QR-Code. Bitte scannen Sie den QR-Code erneut.');
return;
}
try {
const response = await fetch(API_BASE + '/onboarding/validate?token=' + token);
const data = await response.json();
if (!response.ok || !data.valid) {
showError('Der QR-Code ist ungültig oder abgelaufen. Bitte wenden Sie sich an den Klassenlehrer.');
return;
}
tokenData = data;
document.getElementById('school-name').textContent = data.school_name;
document.getElementById('class-name').textContent = data.class_name;
document.getElementById('student-name').textContent = data.student_name;
document.getElementById('role').textContent = data.role === 'parent_representative' ? 'Elternvertreter' : 'Elternteil';
document.getElementById('loading').style.display = 'none';
document.getElementById('content').style.display = 'block';
} catch (error) {
showError('Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.');
}
}
function showError(message) {
document.getElementById('loading').style.display = 'none';
document.getElementById('content').style.display = 'block';
document.getElementById('error').textContent = message;
document.getElementById('error').style.display = 'block';
}
document.querySelectorAll('input[type="checkbox"]').forEach(cb => {
cb.addEventListener('change', () => {
const allChecked = document.querySelectorAll('input[type="checkbox"]:checked').length === 3;
document.getElementById('submit-btn').disabled = !allChecked;
});
});
async function completeOnboarding() {
const btn = document.getElementById('submit-btn');
btn.disabled = true;
btn.textContent = 'Wird verarbeitet...';
try {
const returnUrl = encodeURIComponent(window.location.href);
window.location.href = '/app/login?return_to=' + returnUrl + '&onboarding=true';
} catch (error) {
showError('Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.');
btn.disabled = false;
btn.textContent = 'Registrierung abschließen';
}
}
validateToken();
</script>'''
# This page doesn't use the standard base template with sidebar
return f'''<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>BreakPilot Eltern-Onboarding</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
{styles}
</style>
</head>
<body>
{content}
{scripts}
</body>
</html>'''