Fix sorting room, fix form sending after sorting and add column Historie
This commit is contained in:
@@ -28,7 +28,8 @@ class Device extends Template
|
||||
"token" => "token",
|
||||
"signal" => "signal",
|
||||
"firmware" => "firmware_hash",
|
||||
"icon" => "icon"
|
||||
"icon" => "icon",
|
||||
"history" => "history",
|
||||
];
|
||||
|
||||
$sortIcons = [
|
||||
@@ -47,18 +48,23 @@ class Device extends Template
|
||||
$sortBy = "id";
|
||||
$sortType = "DESC";
|
||||
}
|
||||
|
||||
$template->prepare('sortIcon', [$sortBy => $sortIcons[$sortType]]);
|
||||
|
||||
foreach ($devices as $key => $device) {
|
||||
//Signal Stenght
|
||||
$subdevice = $subDeviceManager->getSubDeviceByMasterAndType($device['device_id'], "wifi");
|
||||
$subdeviceLocal = $subDeviceManager->getSubDeviceByMaster($device['device_id']);
|
||||
if (!empty ($subdeviceLocal)) {
|
||||
$devices[$key]['history'] = (!empty ($subdeviceLocal['history']) ? $subdeviceLocal['history'] : 0);
|
||||
} else {
|
||||
unset($devices[$key]['history']);
|
||||
}
|
||||
$devices[$key]['signal'] = "";
|
||||
if (!empty($subdevice['subdevice_id'])) {
|
||||
$record = $recordManager->getLastRecord($subdevice['subdevice_id']);
|
||||
if (!empty($record)) {
|
||||
$devices[$key]['signal'] = $record['value'] . " " . $subdevice['unit'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Firmware Status
|
||||
|
@@ -36,6 +36,7 @@
|
||||
<a href="device/mac/<?php echo $SORTTYPE; ?>">(Mac)</a><i class="fa"><?php echo (!empty($SORTICON['mac']) ? $SORTICON['mac'] : ""); ?></i><br>
|
||||
<a href="device/token/<?php echo $SORTTYPE; ?>">Token</a><i class="fa"><?php echo (!empty($SORTICON['token']) ? $SORTICON['token'] : ""); ?></i>
|
||||
</th>
|
||||
<th><a href="device/history/<?php echo $SORTTYPE; ?>">Historie</a><i class="fa"><?php echo (!empty($SORTICON['history']) ? $SORTICON['history'] : ""); ?></i></th>
|
||||
<th>Action
|
||||
<form method="post" action="">
|
||||
<button class="fa custom-file-input" type="submit" name="deviceCommand" value="reset" title="Reset All"><b></b></button>
|
||||
@@ -100,6 +101,14 @@
|
||||
<td><?php echo (!empty($device['mac']) ? $device['mac'] : ""); ?><br>
|
||||
<?php echo (!empty($device['ip_address']) ? $device['ip_address'] : ""); ?><br>
|
||||
<?php echo (!empty($device['token']) ? $device['token'] : ""); ?></td>
|
||||
<td>
|
||||
<?php if (isset($device['history'])): ?>
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="deviceId" value="<?php echo (!empty($device['device_id']) ? $device['device_id'] : ""); ?>">
|
||||
<input class="input" type="number" onchange="this.form.submit();" name="deviceHistory" value="<?php echo (!empty($device['history']) ? $device['history'] : 0); ?>">
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (!empty($device['mac'])) : ?>
|
||||
<form method="post" action="">
|
||||
@@ -122,12 +131,6 @@
|
||||
$partial->render();
|
||||
//TODO js do main.js
|
||||
?>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#sortable").sortable();
|
||||
$("#sortable").disableSelection();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo $this->title ?></title>
|
||||
<title><?php echo $this->title; ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $this->content(); ?>
|
||||
|
Reference in New Issue
Block a user