Improve component attach UX

master
Skylar Ittner 4 years ago
parent 458cf93b34
commit 34de7419ed

@ -15,19 +15,26 @@ if (!$user->hasPermission("MACHINEMANAGER_VIEW")) {
$writeaccess = $user->hasPermission("MACHINEMANAGER_EDIT");
$components = $database->select("components", ["compid", "serial", "machineid", "model", "manufacturer", "capacity"]);
$attachto = false;
if (!empty($VARS["attachto"]) && Machine::exists($VARS["attachto"])) {
$attachto = $VARS["attachto"];
$components = $database->select("components", ["compid", "serial", "machineid", "model", "manufacturer", "capacity"], ["machineid" => null]);
} else {
$components = $database->select("components", ["compid", "serial", "machineid", "model", "manufacturer", "capacity"]);
}
?>
<div class="btn-group">
<?php if ($writeaccess) { ?>
<a href="app.php?page=editcomponent" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Add Component"); ?></a>
<?php } ?>
</div>
<?php if ($attachto != false) { ?>
<div class="alert alert-info" role="alert">
Select an unused component to attach to machine #<?php echo htmlspecialchars($VARS["attachto"]); ?>
</div>
<?php } else { ?>
<div class="btn-group">
<?php if ($writeaccess) { ?>
<a href="app.php?page=editcomponent" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Add Component"); ?></a>
<?php } ?>
</div>
<?php } ?>
<table id="componenttable" class="table table-bordered table-hover table-sm">
<thead>
<tr>

Loading…
Cancel
Save