diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php
index 5309aeb7c..96f422b86 100644
--- a/app/devices/device_edit.php
+++ b/app/devices/device_edit.php
@@ -441,6 +441,22 @@
}
}
+ //update device key ids if drag and drop was used
+ if (!empty($_POST['device_key_ids'])) {
+ $device_key_ids = explode(",", $_POST["device_key_ids"]);
+
+ foreach ($device_key_ids as $device) {
+ list($key_uuid, $key_id) = explode("|", $device);
+
+ foreach ($array['devices'][0]['device_keys'] as &$key) {
+ if ($key['device_key_uuid'] == $key_uuid) {
+ $key['device_key_id'] = $key_id;
+ break;
+ }
+ }
+ unset($key);
+ }
+ }
//save the device
$database->save($array);
@@ -1588,6 +1604,8 @@
foreach ($device_keys as $row) {
//set the column names
if ((empty($row['device_key_vendor']) || empty($previous_device_key_vendor) || $previous_device_key_vendor != $row['device_key_vendor']) && !$device_keys_generic_header_displayed) {
+ echo " \n";
+ echo "
\n";
echo " \n";
echo " | ".$text['label-device_key_category']." | \n";
if (permission_exists('device_key_id')) {
@@ -1623,6 +1641,7 @@
echo " \n";
echo " \n";
}
+ echo " | \n";
echo "
\n";
}
@@ -1630,8 +1649,9 @@
if (!empty($row['device_key_uuid']) && is_uuid($row['device_key_uuid'])) {
echo " \n";
}
+
//show all the rows in the array
- echo " \n";
+ echo "
\n";
echo "| \n";
echo " | \n";
+ if (is_uuid($row["device_key_uuid"])) {
+ echo " \n";
+ echo " \n";
+ echo " | \n";
+ }
echo "
\n";
//set the previous vendor
$previous_device_key_vendor = $row['device_key_vendor'] ?? '';
//increment the array key
$x++;
}
+
+ echo " \n";
echo " \n";
if (!empty($text['description-keys'])) {
echo "
".$text['description-keys']."\n";
@@ -2067,6 +2094,55 @@
echo "";
echo "\n";
echo "
";
+
+ //include sortablejs
+ echo "";
+
+ //device key drag and drop
+ echo "\n";
+ ?>
+
+
+ ";
echo "";
+
+ //device key drag and drop
+ echo "\n";
+ ?>
+
+
+ ";
//include the footer