Rechtstexte und B2C-Vertragsabläufe absichern

This commit is contained in:
2026-08-22 14:31:56 +02:00
parent d320a4fd7a
commit a31a235422
58 changed files with 2502 additions and 316 deletions
+36
View File
@@ -9,6 +9,16 @@ $user = app_require_platform_admin($pdo);
$tenants = app_backoffice_fetch_tenants($pdo);
$billingPlans = billing_plans();
$legalRequests = $pdo->query(
"SELECT lr.id, lr.reference_code, lr.request_type, lr.requester_name,
lr.requester_email, lr.contract_reference, lr.request_reason,
lr.requested_end, lr.status, lr.received_at, t.name AS tenant_name
FROM legal_requests lr
LEFT JOIN tenants t ON t.id = lr.tenant_id
WHERE lr.status <> 'processed'
ORDER BY lr.received_at ASC
LIMIT 100"
)->fetchAll();
include 'header.php';
include 'headerline.php';
@@ -21,6 +31,31 @@ include 'nav.php';
<p>Nur für Betreiber-Admins sichtbar: Übersicht aller Mandanten, unabhängig von deren eigener Mitgliedschaft.
Jeder Zugriff wird im Audit-Log des jeweiligen Mandanten protokolliert.</p>
<h3>Offene Kündigungen und Widerrufe</h3>
<?php if ($legalRequests === []): ?>
<div class="hint-box success"><p>Keine offenen Rechtserklärungen.</p></div>
<?php else: ?>
<table>
<tr><th>Eingang</th><th>Art / Referenz</th><th>Kunde</th><th>Erklärung</th><th>Status</th><th></th></tr>
<?php foreach ($legalRequests as $request): ?>
<tr>
<td><?php echo saas_html($request['received_at']); ?></td>
<td><?php echo $request['request_type'] === 'withdrawal' ? 'Widerruf' : 'Kündigung'; ?><br><small><?php echo saas_html($request['reference_code']); ?></small></td>
<td><?php echo saas_html($request['requester_name']); ?><br><a href="mailto:<?php echo saas_html($request['requester_email']); ?>"><?php echo saas_html($request['requester_email']); ?></a><br><small><?php echo saas_html($request['tenant_name'] ?? $request['contract_reference']); ?></small></td>
<td><?php echo $request['requested_end'] !== null ? 'Ende: ' . saas_html($request['requested_end']) . '<br>' : ''; ?><?php echo nl2br(saas_html($request['request_reason'] ?? '')); ?></td>
<td><?php echo saas_html($request['status']); ?></td>
<td>
<form method="post" action="rechtserklaerung-bearbeiten.php">
<?php echo app_csrf_field(); ?>
<input type="hidden" name="request_id" value="<?php echo (int)$request['id']; ?>">
<button type="submit" class="button small">Als erledigt markieren</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<table>
<tr>
<th>Kunde</th>
@@ -44,6 +79,7 @@ include 'nav.php';
<br><small>benötigt: <?php echo saas_html($billingPlans[$tenantRequiredPlan]['label'] ?? $tenantRequiredPlan); ?></small>
<?php endif; ?>
</td>
<td><?php echo saas_html($tenant['created_at']); ?></td>
<td><?php echo (int)$tenant['active_participant_count']; ?> / <?php echo (int)$tenant['participant_count']; ?></td>
<td><?php echo saas_html(saas_format_money_cents((int)$tenant['balance_cents'])); ?> €</td>
<td><a href="backoffice-mandant.php?tenant_id=<?php echo (int)$tenant['id']; ?>" class="button">Ansehen</a></td>