Files
Backend/WEBROOT/services/berichte.php
T
2026-03-09 22:01:54 +01:00

173 lines
4.6 KiB
PHP

<?php
$mode = $_GET['mode'] ?? 'fk';
if ($mode === 'normal') {
$data = Databaseshow("Firmenberichte");
} else {
$data = DatabaseShowWithFK(
"Berufsschulberichte",
$Berufsschulberichte,
);
}
$data = array_reverse($data);
$displayData = (is_array($data) && isset($data['rows'])) ? $data['rows'] : $data;
$count = is_array($displayData) ? count($displayData) : 0;
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../style.css">
<style>
.debug-table-container {
background: #252525;
border-radius: 8px;
padding: 0;
margin-top: 20px;
overflow-x: auto;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
table {
width: 100%;
border-collapse: collapse;
color: #ccc;
white-space: nowrap;
}
th {
background: #333;
text-align: left;
padding: 15px 12px;
border-bottom: 2px solid #3498db;
color: #3498db;
text-transform: uppercase;
font-size: 11px;
letter-spacing: 1px;
position: sticky;
top: 0;
z-index: 10;
}
td {
padding: 10px 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
font-size: 13px;
}
tr:nth-child(even) {
background: rgba(255, 255, 255, 0.02);
}
tr:hover {
background: rgba(52, 152, 219, 0.1);
color: #fff;
}
/* Highlight für DATUM Spalte */
td:first-child,
th:first-child {
position: sticky;
left: 0;
background: #252525;
z-index: 5;
border-right: 1px solid rgba(255, 255, 255, 0.1);
}
th:first-child {
z-index: 11;
background: #333;
}
.debug-raw {
background: #1a1a1a;
color: #00ff00;
padding: 20px;
border-radius: 8px;
font-family: 'Fira Code', monospace;
font-size: 12px;
overflow: auto;
border-left: 4px solid #3498db;
margin-top: 10px;
}
.badge-count {
background: #3498db;
color: white;
padding: 3px 10px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
}
.empty-note {
padding: 40px;
text-align: center;
color: #777;
font-style: italic;
}
</style>
</head>
<body class="<?= ($_SESSION['dark_mode'] ?? true) ? 'dark-mode' : '' ?>">
<div class="main">
<div class="content">
<h2 style="display: flex; justify-content: space-between; align-items: center;">
<span>📊 Berichtte-Vorschau:</span>
<div>
<a href="?service=<?= $selectedService ?>&mode=fk">
<button <?= $mode === 'fk' ? 'style="background:#3498db;color:white;"' : '' ?>>
Berufsschulberichte
</button>
</a>
<a href="?service=<?= $selectedService ?>&mode=normal">
<button <?= $mode === 'normal' ? 'style="background:#3498db;color:white;"' : '' ?>>
Arbeitsberichte
</button>
</a>
</div>
</h2>
<?php if ($count > 0 && is_array($displayData[0])): ?>
<div class="debug-table-container">
<table>
<thead>
<tr>
<?php foreach (array_keys($displayData[0]) as $column): ?>
<th><?= htmlspecialchars($column) ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($displayData as $row): ?>
<tr>
<?php foreach ($row as $key => $cell): ?>
<td><?= htmlspecialchars($cell ?? '-') ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="debug-table-container">
<div class="empty-note">
Keine tabellarischen Daten gefunden.<br>
<small>Struktur: <?= is_array($data) ? 'Array ('.count($data).' Keys)' : gettype($data) ?></small>
</div>
</div>
<?php endif; ?>
</div>
</div>
</body>
</html>