Split info page into two columns

master
Skylar Ittner 6 years ago
parent a00d6c78d2
commit 6782d518eb

@ -8,6 +8,7 @@
</h5> </h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row">
<?php <?php
require_once __DIR__ . "/../machine.php"; require_once __DIR__ . "/../machine.php";
@ -18,6 +19,7 @@
if (count($info) > 0) { if (count($info) > 0) {
?> ?>
<div class="col-sm-6 mb-3">
<h6>Machine Info:</h6> <h6>Machine Info:</h6>
<div class="list-group"> <div class="list-group">
<?php <?php
@ -64,20 +66,32 @@
} }
?> ?>
</div> </div>
</div>
<?php <?php
} }
$history = $machine->getHistory(); $components = $machine->getComponents();
if (count($history) > 0) { if (count($components) > 0) {
?> ?>
<h6 class="mt-3">History:</h6> <div class="col-sm-6 mb-3">
<h6>Components:</h6>
<div class="list-group"> <div class="list-group">
<?php <?php
foreach ($history as $h) { foreach ($components as $c) {
echo "<div class=\"list-group-item\">\n"; echo "<div class=\"list-group-item\">\n";
echo "<b>$h[eventname]</b> on " . date(DATETIME_FORMAT, strtotime($h['date'])) . "<br />\n"; echo "<b>$c[type]</b><br />\n";
echo "Serial: $c[serial]<br />\n";
if (!empty($c['tested'])) {
echo "Tested on: " . date(DATETIME_FORMAT, strtotime($c['tested'])) . "<br />\n";
}
if (!empty($c['capacity'])) {
echo "Capacity: $c[capacity]<br />\n";
}
if (!empty($c['model'])) {
echo "Model: $c[model]<br />\n";
}
if (!empty($h['notes'])) { if (!empty($h['notes'])) {
echo "<div>" . htmlspecialchars($h['notes']) . "</div>"; echo "<div>" . htmlspecialchars($h['notes']) . "</div>";
} }
@ -85,30 +99,22 @@
} }
?> ?>
</div> </div>
</div>
<?php <?php
} }
$components = $machine->getComponents(); $history = $machine->getHistory();
if (count($components) > 0) { if (count($history) > 0) {
?> ?>
<h6 class="mt-3">Components:</h6> <div class="col-sm-6 mb-3">
<h6>History:</h6>
<div class="list-group"> <div class="list-group">
<?php <?php
foreach ($components as $c) { foreach ($history as $h) {
echo "<div class=\"list-group-item\">\n"; echo "<div class=\"list-group-item\">\n";
echo "<b>$c[type]</b><br />\n"; echo "<b>$h[eventname]</b> on " . date(DATETIME_FORMAT, strtotime($h['date'])) . "<br />\n";
echo "Serial: $c[serial]<br />\n";
if (!empty($c['tested'])) {
echo "Tested on: " . date(DATETIME_FORMAT, strtotime($c['tested'])) . "<br />\n";
}
if (!empty($c['capacity'])) {
echo "Capacity: $c[capacity]<br />\n";
}
if (!empty($c['model'])) {
echo "Model: $c[model]<br />\n";
}
if (!empty($h['notes'])) { if (!empty($h['notes'])) {
echo "<div>" . htmlspecialchars($h['notes']) . "</div>"; echo "<div>" . htmlspecialchars($h['notes']) . "</div>";
} }
@ -116,6 +122,7 @@
} }
?> ?>
</div> </div>
</div>
<?php <?php
} }
} catch (Exception $ex) { } catch (Exception $ex) {
@ -123,6 +130,7 @@
} }
?> ?>
</div> </div>
</div>
<div class="card-body"> <div class="card-body">
<p>Look up another machine:</p> <p>Look up another machine:</p>
<form method="GET"> <form method="GET">

Loading…
Cancel
Save