Add name changer and repair need icon

This commit is contained in:
Haitem 2020-09-08 18:47:58 +02:00
parent 2c6e7e2ecc
commit ed732e125a
2 changed files with 24 additions and 15 deletions

View File

@ -24,6 +24,9 @@ if (!empty ($_POST)){
if (!empty ($_POST['deviceRoomId']) && !empty ($_POST['deviceId'])) {
$deviceManager->edit ($_POST['deviceId'], array ('room_id' => $_POST['deviceRoomId']));
}
if (!empty ($_POST['deviceName']) && !empty ($_POST['deviceId'])) {
$deviceManager->edit ($_POST['deviceId'], array ('name' => $_POST['deviceName']));
}
header('Location: ./device');
die();
}

View File

@ -42,9 +42,14 @@
<?php foreach ($DEVICES as $device) : ?>
<tr>
<td><i class="fa">&#x<?php echo (!empty($device['icon']) ? $device['icon'] : ""); ?></i></td>
<td><?php echo (!empty($device['name']) ? $device['name'] : ""); ?></td>
<td>
<form method="post" action="" enctype="multipart/form-data">
<form method="post" action="">
<input type="hidden" name="deviceId" value="<?php echo (!empty($device['device_id']) ? $device['device_id'] : ""); ?>">
<input class="input" type="text" onchange="this.form.submit();" name="deviceName" value="<?php echo (!empty($device['name']) ? $device['name'] : ""); ?>">
</form>
</td>
<td>
<form method="post" action="">
<input type="hidden" name="deviceId" value="<?php echo (!empty($device['device_id']) ? $device['device_id'] : ""); ?>">
<select class="input" name="deviceRoomId" onchange="this.form.submit();">
<?php
@ -67,7 +72,8 @@
$icon = "fa-check-circle";
$color = "green";
} else if ($device['firmware_hash'] == "need") {
$icon = "arrow-circle-up";
$icon = "fa-arrow-circle-up";
$color = "#6495ED";
} else {
$icon = "fa-times-circle";
$color = "red";
@ -75,7 +81,7 @@
}
?>
<i class="fa <?php echo $icon; ?>" style="color: <?php echo $color; ?>"></i>
<i class="fa <?php echo $icon; ?>" style="color: <?php echo $color; ?>;"></i>
<?php echo $device['firmware_hash'] ?>
<button class="fa custom-file-input" type="button" onclick="document.getElementById('deviceFirmware-<?php echo $device['device_id']?>').click();">&#xf0ee;</button>
<form style="display: none;" method="post" action="" enctype="multipart/form-data">