Files
thetool/Layout/default/Preorder/PDF_MAIN.php
2025-09-18 13:23:22 +02:00

158 lines
6.3 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Fehlerprotokoll</title>
<style>
body { font-family: "Open Sans", sans-serif, Verdana; font-size: 10px; color: #333; }
.fault-entry {
/* Enhanced border for better printing */
border: 1.5pt solid #aaa;
border-radius: 5px;
margin-bottom: 15px;
padding: 10px;
page-break-inside: avoid;
}
.fault-entry h2 {
font-size: 14px;
color: #005384;
margin-top: 0;
margin-bottom: 10px;
/* Enhanced border for better printing */
border-bottom: 1.5pt solid #f7c423;
padding-bottom: 5px;
}
.info-table { width: 100%; border-collapse: collapse; font-size: 10px; margin-bottom: 10px; }
.info-table td { padding: 4px; vertical-align: top; }
.info-table td.label { font-weight: bold; width: 120px; color: #444; }
/* Container for the two-column fault layout */
.faults-layout-table { width: 100%; border-spacing: 10px 0; border-collapse: separate; table-layout: fixed; }
.faults-layout-table td { vertical-align: top; width: 50%; }
/* Red box for reported fault reasons */
.fault-reasons-box {
background-color: #fdedec;
/* Enhanced border for better printing */
border: 1.5pt solid #d63031;
border-left: 3pt solid #c0392b;
border-radius: 4px;
padding: 10px;
height: 100%; /* Ensures boxes have similar height */
box-sizing: border-box;
}
.fault-reasons-box h3 {
font-size: 12px;
color: #c0392b;
margin-top: 0;
margin-bottom: 8px;
}
.fault-reasons-box ul {
margin: 0;
padding-left: 0;
list-style-type: none; /* Remove default bullets */
}
/* Custom "beautiful" bullet points */
.fault-reasons-box li {
margin-bottom: 4px;
padding-left: 15px;
position: relative;
}
.fault-reasons-box li:before {
content: '»'; /* Using a character for better PDF compatibility */
position: absolute;
left: 0;
top: 0px;
color: #c0392b;
font-weight: bold;
}
/* Yellow box for other annotations */
.fault-other-box {
background-color: #fef9e7;
padding: 10px;
/* Enhanced border for better printing */
border: 1.5pt solid #e5b200;
border-left: 3pt solid #f7c423;
border-radius: 4px;
height: 100%;
box-sizing: border-box;
}
.no-faults { text-align: center; font-size: 14px; color: #777; padding: 40px; border: 2px dashed #ccc; border-radius: 8px; }
a { color: #005384; text-decoration: none; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<?php if (empty($faultyEntries)): ?>
<div class="no-faults">
Für die Kampagne "<?= htmlspecialchars($campaignName) ?>" wurden keine Fehler gemeldet.
</div>
<?php else: ?>
<?php foreach ($faultyEntries as $entry):
$addr = $entry['address'];
$fullAddress = htmlspecialchars($addr['strasse_name'] . ' ' . $addr['hausnummer'] . ', ' . $addr['plz_name'] . ' ' . $addr['ortschaft_name']);
?>
<div class="fault-entry">
<h2><?= $fullAddress ?></h2>
<table class="info-table">
<tr>
<td class="label">TheTool ID:</td>
<td><?= $addr['hausnummer_id'] ?> (<a href="<?= $entry['addressDbLink'] ?>" target="_blank">TheTool Link</a>)</td>
<td class="label">RIMO Type:</td>
<td><?= htmlspecialchars($addr['rimo_type'] ?: 'N/A') ?></td>
</tr>
<tr>
<td class="label">Externe Referenz:</td>
<td><?= htmlspecialchars($addr['extref'] ?: 'N/A') ?></td>
<td class="label">RIMO Op/Ex State:</td>
<td><?= htmlspecialchars($addr['rimo_op_state'] ?: 'N/A') ?> / <?= htmlspecialchars($addr['rimo_ex_state'] ?: 'N/A') ?></td>
</tr>
<tr>
<td class="label">Wohneinheiten:</td>
<td><?= $addr['wohneinheit_count'] ?></td>
<td class="label">Koordinaten:</td>
<td><?= number_format((float)$addr['gps_lat'], 8) ?>, <?= number_format((float)$addr['gps_long'], 8) ?> (<a href="<?= $entry['googleMapsLink'] ?>" target="_blank">Karte</a>)</td>
</tr>
</table>
<?php
$hasReasons = !empty($entry['faults']['reasons']);
$hasOther = !empty(trim($entry['faults']['other']));
?>
<?php if ($hasReasons || $hasOther): ?>
<table class="faults-layout-table">
<tr>
<td>
<?php if ($hasReasons): ?>
<div class="fault-reasons-box">
<h3>Gemeldete Fehler</h3>
<ul>
<?php foreach ($entry['faults']['reasons'] as $reason): ?>
<li><?= htmlspecialchars($reason) ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</td>
<td>
<?php if ($hasOther): ?>
<div class="fault-other-box">
<strong>Sonstige Anmerkungen:</strong><br>
<?= nl2br(htmlspecialchars($entry['faults']['other'])) ?>
</div>
<?php endif; ?>
</td>
</tr>
</table>
<?php else: ?>
<p>Keine spezifischen Fehlerdetails angegeben.</p>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</body>
</html>