|
|
|
@ -7,6 +7,47 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once __DIR__ . "/../lib/required_public.php";
|
|
|
|
|
|
|
|
|
|
$publicsettings = json_decode(file_get_contents(__DIR__ . "/../custom/public.json"), true);
|
|
|
|
|
|
|
|
|
|
function getSearchBox(bool $searchagain = false): string {
|
|
|
|
|
global $publicsettings, $Strings;
|
|
|
|
|
if (isset($_GET["embed"])) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
$html = '<p>' . ($searchagain ? $publicsettings["Look up another device prompt"] : $publicsettings["Search box prompt"]) . '</p><form method="GET">'
|
|
|
|
|
. '<input type="text" name="id" class="form-control" placeholder="' . ($searchagain ? $publicsettings["ID number search box placeholder"] : $Strings->get("Number", false)) . '" required />'
|
|
|
|
|
. '<button type="submit" class="btn btn-primary btn-block mt-2">' . $Strings->get("Get Info", false) . '</button>'
|
|
|
|
|
. '</form>';
|
|
|
|
|
return $html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Output a Bootstrap card div with the given header HTML and body HTML.
|
|
|
|
|
* @param string $header
|
|
|
|
|
* @param (string|array) $body string or array of strings
|
|
|
|
|
*/
|
|
|
|
|
function printCard($header, $body) {
|
|
|
|
|
echo '<div class="card">';
|
|
|
|
|
echo ' <h3 class="card-header d-flex">';
|
|
|
|
|
echo ' <div>';
|
|
|
|
|
echo ' ' . $header;
|
|
|
|
|
echo ' </div>';
|
|
|
|
|
echo ' </h3>';
|
|
|
|
|
if (is_array($body)) {
|
|
|
|
|
foreach ($body as $b) {
|
|
|
|
|
if (empty($b)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
echo ' <div class="card-body">';
|
|
|
|
|
echo $b;
|
|
|
|
|
echo ' </div>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
echo $body;
|
|
|
|
|
}
|
|
|
|
|
echo "<div>";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
@ -38,33 +79,10 @@ if (isset($_GET["backgroundcolor"]) && !empty($_GET["backgroundcolor"]) && preg_
|
|
|
|
|
<?php
|
|
|
|
|
if (!empty($_GET["id"]) && strpos($_GET["id"], "68") === 0 && !CheckDigit::validateS10($_GET["id"])) {
|
|
|
|
|
// Made a typo in the machine ID
|
|
|
|
|
?>
|
|
|
|
|
<div class="card">
|
|
|
|
|
<h3 class="card-header d-flex">
|
|
|
|
|
<div>
|
|
|
|
|
<i class="fas fa-desktop"></i> <?php $Strings->get("Device Info"); ?>
|
|
|
|
|
</div>
|
|
|
|
|
</h3>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<?php
|
|
|
|
|
if (!empty($_GET["id"])) {
|
|
|
|
|
?>
|
|
|
|
|
<p class="text-danger"><code><?php echo htmlspecialchars($_GET['id']); ?></code> is not valid. Please try re-typing it.</p>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<?php if (!isset($_GET["embed"])) { ?>
|
|
|
|
|
<p>
|
|
|
|
|
Enter a <?php echo $SETTINGS["branding"]["machineidnumber"]; ?>, serial number, or tracking code.
|
|
|
|
|
</p>
|
|
|
|
|
<form method="GET">
|
|
|
|
|
<input type="text" name="id" class="form-control" placeholder="Number" required />
|
|
|
|
|
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
|
|
|
|
|
</form>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
printCard('<i class="fas fa-desktop"></i> ' . $Strings->get("Device Info", false), [
|
|
|
|
|
'<p class="text-danger"><code>' . htmlspecialchars($_GET['id']) . '</code> is not valid. Please try re-typing it.</p>',
|
|
|
|
|
getSearchBox()
|
|
|
|
|
]);
|
|
|
|
|
} else if (empty($_GET["id"]) || (!Machine::exists($_GET["id"]) && !Machine::serialExists($_GET["id"]) && !Component::exists($_GET["id"]))) {
|
|
|
|
|
// try package tracking query
|
|
|
|
|
$trackingok = false;
|
|
|
|
@ -93,377 +111,127 @@ if (isset($_GET["backgroundcolor"]) && !empty($_GET["backgroundcolor"]) && preg_
|
|
|
|
|
return $status;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<div class="card">
|
|
|
|
|
<h3 class="card-header d-flex">
|
|
|
|
|
<div>
|
|
|
|
|
<i class="fas fa-box"></i> <?php $Strings->get("Tracking Info"); ?>
|
|
|
|
|
</div>
|
|
|
|
|
</h3>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
|
|
$html = '<div class="row">
|
|
|
|
|
<div class="col-12 mb-3">
|
|
|
|
|
<div class="list-group">
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b>Tracking code:</b> <span style="font-family: 'Ubuntu Mono', monospace;"><?php echo $trkresp["code"]; ?></span>
|
|
|
|
|
<b>Tracking code:</b> <span style="font-family: \'Ubuntu Mono\', monospace;">' . $trkresp["code"] . '</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b>Current status:</b> <?php echo trackingStatusToNiceString($trkresp["current"]["status"]) . ": " . $trkresp["current"]["details"]; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<b>Current status:</b> ' . trackingStatusToNiceString($trkresp["current"]["status"]) . ": " . $trkresp["current"]["details"]
|
|
|
|
|
. '</div>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b>Last updated:</b> <?php echo date($SETTINGS["datetime_format"], $trkresp["current"]["date"]); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<b>Last updated:</b> ' . date($SETTINGS["datetime_format"], $trkresp["current"]["date"])
|
|
|
|
|
. '</div>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b>Last location:</b> <?php echo implode(" ", $trkresp["current"]["location"]); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<b>Last location:</b> ' . implode(" ", $trkresp["current"]["location"])
|
|
|
|
|
. '</div>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b>Carrier:</b> <?php echo $trkresp["carrier"]["name"]; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<b>Carrier:</b> ' . $trkresp["carrier"]["name"] .
|
|
|
|
|
'</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-12 mb-3">
|
|
|
|
|
<h6>History:</h6>
|
|
|
|
|
|
|
|
|
|
<div class="list-group">
|
|
|
|
|
<?php
|
|
|
|
|
foreach ($trkresp["history"] as $his) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<?php echo trackingStatusToNiceString($his["status"]) . ": " . $his["details"]; ?><br />
|
|
|
|
|
<?php echo date($SETTINGS["datetime_format"], $his["date"]); ?><br />
|
|
|
|
|
<?php echo implode(" ", $his["location"]); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="list-group">';
|
|
|
|
|
foreach ($trkresp["history"] as $his) {
|
|
|
|
|
$html .= '<div class="list-group-item">';
|
|
|
|
|
$html .= '<b>' . trackingStatusToNiceString($his["status"]) . ":</b> " . $his["details"] . '<br>';
|
|
|
|
|
$html .= date($SETTINGS["datetime_format"], $his["date"]) . '<br>';
|
|
|
|
|
$html .= implode(" ", $his["location"]);
|
|
|
|
|
$html .= '</div>';
|
|
|
|
|
}
|
|
|
|
|
$html .= '</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php if (!isset($_GET["embed"])) { ?>
|
|
|
|
|
<p>
|
|
|
|
|
Enter a <?php echo $SETTINGS["branding"]["machineidnumber"]; ?>, serial number, or tracking code.
|
|
|
|
|
</p>
|
|
|
|
|
<form method="GET">
|
|
|
|
|
<input type="text" name="id" class="form-control" placeholder="Number" required />
|
|
|
|
|
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
|
|
|
|
|
</form>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
printCard('<i class="fas fa-box"></i> ' . $Strings->get("Tracking Info", false), [
|
|
|
|
|
$html,
|
|
|
|
|
getSearchBox()
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!$trackingok) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="card">
|
|
|
|
|
<h3 class="card-header d-flex">
|
|
|
|
|
<div>
|
|
|
|
|
<i class="fas fa-desktop"></i> <?php $Strings->get("Device Info"); ?>
|
|
|
|
|
</div>
|
|
|
|
|
</h3>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<?php
|
|
|
|
|
if (!empty($_GET["id"])) {
|
|
|
|
|
?>
|
|
|
|
|
<p class="text-danger">No device with ID <code><?php echo htmlspecialchars($_GET['id']); ?></code> could be found.</p>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<?php if (!isset($_GET["embed"])) { ?>
|
|
|
|
|
<p>
|
|
|
|
|
Enter a <?php echo $SETTINGS["branding"]["machineidnumber"]; ?>, serial number, or tracking code.
|
|
|
|
|
</p>
|
|
|
|
|
<form method="GET">
|
|
|
|
|
<input type="text" name="id" class="form-control" placeholder="Number" required />
|
|
|
|
|
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
|
|
|
|
|
</form>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
$body = [];
|
|
|
|
|
if (!empty($_GET["id"])) {
|
|
|
|
|
$body[] = '<p class="text-danger">' . str_replace("{id}", htmlspecialchars($_GET['id']), $publicsettings["No device with ID error"]) . "</p>";
|
|
|
|
|
}
|
|
|
|
|
$body[] = getSearchBox();
|
|
|
|
|
printCard('<i class="fas fa-desktop"></i> ' . $Strings->get("Device Info", false), $body);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (Machine::exists($_GET["id"])) {
|
|
|
|
|
$machine = new Machine($_GET['id']);
|
|
|
|
|
} else if (Component::exists($_GET["id"])) {
|
|
|
|
|
if (Component::exists($_GET["id"])) {
|
|
|
|
|
$component = new Component($_GET["id"]);
|
|
|
|
|
$mid = $component->getMachineID();
|
|
|
|
|
if (!empty($mid) && Machine::exists($mid)) {
|
|
|
|
|
$machine = new Machine($mid);
|
|
|
|
|
} else {
|
|
|
|
|
// component exists but isn't attached to a machine
|
|
|
|
|
?>
|
|
|
|
|
<div class="card">
|
|
|
|
|
<h3 class="card-header d-flex">
|
|
|
|
|
<div>
|
|
|
|
|
<i class="fas fa-memory"></i> <?php echo $component->getTypeName(); ?> Info
|
|
|
|
|
</div>
|
|
|
|
|
</h3>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="alert alert-info">
|
|
|
|
|
<i class="fas fa-info-circle"></i> This component ID exists in the system but has no associated device.
|
|
|
|
|
</div>
|
|
|
|
|
$html = '<div class="alert alert-info">
|
|
|
|
|
<i class="fas fa-info-circle"></i> ' . $publicsettings["Component exist but isn't attached to a machine"]
|
|
|
|
|
. '</div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-12 mb-3">
|
|
|
|
|
<div class="list-group">
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($component->getID()); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php if (!empty($component->getModel())) { ?>
|
|
|
|
|
<div class="list-group-item"><b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($component->getModel()); ?></div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($component->getCapacity())) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item"><b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($component->getCapacity()); ?></div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($component->getSerial())) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item"><b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($component->getSerial()); ?></div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($component->getTestedDate())) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item"><b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["date_format"], strtotime($component->getTestedDate())); ?></div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($component->getPrice())) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item"><b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($component->getPrice(), 2); ?></div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($component->getManufacturer())) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item"><b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($component->getManufacturer()); ?></div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($component->getPublicNotes())) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b>Notes:</b><br>
|
|
|
|
|
<div class="ml-3"><?php echo htmlspecialchars($component->getPublicNotes()); ?></div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php /* Hide this box if we're embedded in another page */ if (!isset($_GET["embed"])) { ?>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<p>
|
|
|
|
|
Look up another device:
|
|
|
|
|
</p>
|
|
|
|
|
<form method="GET">
|
|
|
|
|
<input type="text" name="id" class="form-control" placeholder="<?php echo $SETTINGS["branding"]["shortmachineid"]; ?>" required />
|
|
|
|
|
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
<div class="list-group-item">'
|
|
|
|
|
. $component->toHTML(true)
|
|
|
|
|
. '</div></div></div></div>';
|
|
|
|
|
printCard('<i class="fas fa-memory"></i> ' . $Strings->get("Component", false) . ' #' . $component->getID(), [$html, getSearchBox()]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$machine = new Machine(Machine::getIDFromSerial($_GET['id']));
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<div class="card">
|
|
|
|
|
<h3 class="card-header d-flex">
|
|
|
|
|
<div>
|
|
|
|
|
<i class="<?php echo $machine->getIcon(); ?>"></i> <?php echo $machine->getTypeLabel(); ?> Info
|
|
|
|
|
</div>
|
|
|
|
|
</h3>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-12 mb-3">
|
|
|
|
|
<div class="list-group">
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("ID"); ?></b>: <?php echo htmlspecialchars($machine->getID()); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php if (!empty($machine->getOS())) { ?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("OS/Software"); ?></b>: <?php echo htmlspecialchars($machine->getOS()); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
<?php if (!empty($machine->getSerial())) { ?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($machine->getSerial()); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
<?php if (!empty($machine->getManufacturer())) { ?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($machine->getManufacturer()); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
<?php if (!empty($machine->getModel())) { ?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($machine->getModel()); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
<?php
|
|
|
|
|
if ($machine->getCondition() > 0) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("Condition"); ?></b>: <?php
|
|
|
|
|
$val = $machine->getCondition();
|
|
|
|
|
$filled = floor($val);
|
|
|
|
|
$empty = 10;
|
|
|
|
|
while ($filled > 0) {
|
|
|
|
|
$filled--;
|
|
|
|
|
$empty--;
|
|
|
|
|
echo "<i class=\"fas fa-star\"></i> ";
|
|
|
|
|
}
|
|
|
|
|
if ($val - floor($val) > 0.75) {
|
|
|
|
|
$empty--;
|
|
|
|
|
echo "<i class=\"fas fa-star\"></i> ";
|
|
|
|
|
} else if ($val - floor($val) > 0.25) {
|
|
|
|
|
$empty--;
|
|
|
|
|
echo "<i class=\"fas fa-star-half-alt\"></i> ";
|
|
|
|
|
}
|
|
|
|
|
while ($empty > 0) {
|
|
|
|
|
$empty--;
|
|
|
|
|
echo "<i class=\"far fa-star\"></i> ";
|
|
|
|
|
}
|
|
|
|
|
echo " ($val/10)";
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<?php
|
|
|
|
|
if ($machine->getPrice() > 0) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($machine->getPrice(), 2); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<?php
|
|
|
|
|
if (!empty($machine->getPublicNotes())) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("Notes"); ?></b>: <?php echo str_replace("\n", "\n<br>", htmlspecialchars($machine->getPublicNotes())); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
$history = $machine->getEvents();
|
|
|
|
|
$events = [];
|
|
|
|
|
foreach ($history as $h) {
|
|
|
|
|
$events[] = $h;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count($events) > 0) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="col-sm-6 mb-3">
|
|
|
|
|
<h6>Events:</h6>
|
|
|
|
|
<div class="list-group">
|
|
|
|
|
<?php
|
|
|
|
|
foreach ($history as $h) {
|
|
|
|
|
echo "<div class=\"list-group-item\">\n";
|
|
|
|
|
echo "<b>" . $h->getName() . "</b> on " . date($SETTINGS["datetime_format"], strtotime($h->getDate())) . "<br />\n";
|
|
|
|
|
if (!empty($h->getPublicNotes())) {
|
|
|
|
|
echo "<div><b>Notes:</b><br /><div class=\"ml-3\">" . htmlspecialchars($h->getPublicNotes()) . "</div></div>";
|
|
|
|
|
}
|
|
|
|
|
echo "\n</div>\n";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$components = $machine->getComponents();
|
|
|
|
|
|
|
|
|
|
if (count($components) > 0) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="col-sm-6 mb-3">
|
|
|
|
|
<h6>Components:</h6>
|
|
|
|
|
<div class="list-group">
|
|
|
|
|
<?php
|
|
|
|
|
foreach ($components as $c) {
|
|
|
|
|
?>
|
|
|
|
|
<div class = "list-group-item">
|
|
|
|
|
|
|
|
|
|
<b><?php echo $c->getTypeName(); ?></b><br />
|
|
|
|
|
<?php
|
|
|
|
|
if (!empty($c->getModel())) {
|
|
|
|
|
?>
|
|
|
|
|
<b><?php $Strings->get("Model"); ?></b>: <?php echo htmlspecialchars($c->getModel()); ?><br />
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
if (Machine::exists($_GET["id"])) {
|
|
|
|
|
$machine = new Machine($_GET['id']);
|
|
|
|
|
} else {
|
|
|
|
|
$machine = new Machine(Machine::getIDFromSerial($_GET['id']));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($c->getCapacity())) {
|
|
|
|
|
?>
|
|
|
|
|
<b><?php $Strings->get("Capacity"); ?></b>: <?php echo htmlspecialchars($c->getCapacity()); ?><br />
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
$eventshtml = "";
|
|
|
|
|
$history = $machine->getEvents();
|
|
|
|
|
$events = [];
|
|
|
|
|
foreach ($history as $h) {
|
|
|
|
|
$events[] = $h;
|
|
|
|
|
}
|
|
|
|
|
if (count($events) > 0) {
|
|
|
|
|
$eventshtml = '<div class="col-sm-6 mb-3">
|
|
|
|
|
<h6>Events:</h6>
|
|
|
|
|
<div class="list-group">';
|
|
|
|
|
foreach ($history as $h) {
|
|
|
|
|
$eventshtml .= '<div class="list-group-item">'
|
|
|
|
|
. $h->toHTML(true)
|
|
|
|
|
. '</div>';
|
|
|
|
|
}
|
|
|
|
|
$eventshtml .= '</div></div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($c->getSerial())) {
|
|
|
|
|
?>
|
|
|
|
|
<b><?php $Strings->get("Serial"); ?></b>: <?php echo htmlspecialchars($c->getSerial()); ?><br />
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($c->getTestedDate())) {
|
|
|
|
|
?>
|
|
|
|
|
<b><?php $Strings->get("Tested On"); ?></b>: <?php echo date($SETTINGS["date_format"], strtotime($c->getTestedDate())); ?><br />
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
$componentshtml = "";
|
|
|
|
|
$components = $machine->getComponents();
|
|
|
|
|
|
|
|
|
|
if (!empty($c->getPrice())) {
|
|
|
|
|
?>
|
|
|
|
|
<b><?php $Strings->get("Price"); ?></b>: $<?php echo number_format($c->getPrice(), 2); ?><br />
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
if (count($components) > 0) {
|
|
|
|
|
$componentshtml = '<div class="col-sm-6 mb-3"><h6>Components:</h6><div class="list-group">';
|
|
|
|
|
foreach ($components as $c) {
|
|
|
|
|
$componentshtml .= '<div class = "list-group-item">'
|
|
|
|
|
. $c->toHTML(true)
|
|
|
|
|
. '</div>';
|
|
|
|
|
}
|
|
|
|
|
$componentshtml .= '</div></div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($c->getManufacturer())) {
|
|
|
|
|
?>
|
|
|
|
|
<b><?php $Strings->get("Manufacturer"); ?></b>: <?php echo htmlspecialchars($c->getManufacturer()); ?><br />
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
$body = [
|
|
|
|
|
'<div class="row"><div class="col-12 mb-3">'
|
|
|
|
|
. $machine->toHTMLListGroup(true)
|
|
|
|
|
. '</div>'
|
|
|
|
|
. $eventshtml
|
|
|
|
|
. $componentshtml
|
|
|
|
|
. "</div>",
|
|
|
|
|
getSearchBox(true)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (!empty($c->getPublicNotes())) {
|
|
|
|
|
?>
|
|
|
|
|
<div>
|
|
|
|
|
<b>Notes:</b><br />
|
|
|
|
|
<div class="ml-3"><?php echo htmlspecialchars($c->getPublicNotes()); ?></div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php /* Hide this box if we're embedded in another page */ if (!isset($_GET["embed"])) { ?>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<p>
|
|
|
|
|
Look up another device:
|
|
|
|
|
</p>
|
|
|
|
|
<form method="GET">
|
|
|
|
|
<input type="text" name="id" class="form-control" placeholder="<?php echo $SETTINGS["branding"]["shortmachineid"]; ?>" required />
|
|
|
|
|
<button type="submit" class="btn btn-primary btn-block mt-2">Get Info</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
printCard('<i class="' . $machine->getIcon() . '"></i> ' . $machine->getTypeLabel() . ' Info', $body);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|