Gerätehersteller, Devices, API Erweiterungen
This commit is contained in:
@@ -25,7 +25,8 @@
|
||||
<li class="breadcrumb-item active">Device Detail</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Device: <span class="font-weight-normal ml-1"><?= $devices->data->name ?></span> <span class="ml-2">
|
||||
<h4 class="page-title">Device: <span class="font-weight-normal ml-1"><?= $devices->data->name ?></span>
|
||||
<span class="ml-2">
|
||||
<a href="<?= self::getUrl("Device", "edit", ["id" => $devices->id, 'returnto' => "device-detail"]) ?>">
|
||||
<button class="btn btn-primary">Bearbeiten</button>
|
||||
</a>
|
||||
@@ -36,11 +37,17 @@
|
||||
<!-- end page title -->
|
||||
<?php
|
||||
|
||||
if (!empty($devices->price)) {
|
||||
if ($devices->price != "0.00") {
|
||||
$price = $devices->price;
|
||||
} else {
|
||||
$price = $devices->devicetype->price;
|
||||
}
|
||||
if ($devices->power != "0.0") {
|
||||
$power = $devices->power;
|
||||
} else {
|
||||
$power = $devices->devicetype->power;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -83,6 +90,10 @@ if (!empty($devices->price)) {
|
||||
<th>Preis</th>
|
||||
<td><?= $price ?> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Leistung</th>
|
||||
<td><?= $power ?> Watt</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bemerkung</th>
|
||||
<td><?= nl2br($devices->comment) ?> </td>
|
||||
@@ -152,11 +163,21 @@ if (!empty($devices->price)) {
|
||||
|
||||
</div>
|
||||
<div class="col-3 card-border">
|
||||
<div>
|
||||
<h4>Config Backups</h4>
|
||||
<div class="overflow-auto">
|
||||
<h4 class="float-left">Config Backups</h4>
|
||||
<?php if ($devices->devicetype->devicemanufactor->config_backup > count()): ?>
|
||||
<span><i title="Switch config" class="fa-light fa-rectangle-code code-ico"
|
||||
data-toggle="modal" data-target="#configCode"></i></span>
|
||||
<?php endif; ?>
|
||||
<div class="float-right">
|
||||
<a id="create-backup-href"
|
||||
href="https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=createconfig&ip=<?= $devices->ip; ?>&id=<?= $devices->id; ?>">
|
||||
<button class="btn btn-primary "><span id="create-backup-button-text">Backup erstellen</span>
|
||||
<span id="create-backup-load"></i></span></button>
|
||||
</a></div>
|
||||
</div>
|
||||
<?php
|
||||
if (!empty($configs)) {
|
||||
if ($devicesconfig->success == "true" && $devicesconfig->data > count()) {
|
||||
?>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
@@ -164,21 +185,35 @@ if (!empty($devices->price)) {
|
||||
<tr>
|
||||
<th>Datum/Uhrzeit</th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php foreach ($devicesconfig->data as $config) :
|
||||
$configfileCleartext = $config->config_cleartext;
|
||||
$configfileCompressed = $config->config_compressed;
|
||||
$configid = $config->id;
|
||||
?>
|
||||
<tr>
|
||||
<td><?= date("d.m.Y/H:i", $config->config_timestamp); ?></td>
|
||||
<td>
|
||||
<a href="https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=getconfig&id=<?= $configid; ?>&format=txt&filename=<?= $configfileCleartext; ?>">
|
||||
TXT</a> / <a
|
||||
href="https://<?= $_SERVER['SERVER_NAME']; ?>/Device/api?do=getconfig&id=<?= $configid; ?>&format=xml&filename=<?= $configfileCompressed; ?>">
|
||||
XML</a></td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<h5 class="text-center">Keine Configs vorhanden</h5>
|
||||
|
||||
<div class="mt-1">
|
||||
<h5 class="text-center">Keine Configs vorhanden</h5>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -191,10 +226,48 @@ if (!empty($devices->price)) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($devices->devicetype->devicemanufactor->config_backup > count()):
|
||||
|
||||
$year = date("Y", time());
|
||||
$month = date("n", time());
|
||||
$day = date("d", time());
|
||||
$config = $devices->devicetype->devicemanufactor->config_backup;
|
||||
$config = str_replace("&&YEAR&&", $year, $config);
|
||||
$config = str_replace("&&MONTH&&", $month, $config);
|
||||
$config = str_replace("&&DAY&&", $day, $config);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="modal fade" id="configCode" tabindex="-1" role="dialog" aria-labelledby="configCodeLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="configCodeLabel">SwitchConfig Autobackup</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?= nl2br($config) ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#create-backup-href').click(function () {
|
||||
|
||||
$('#create-backup-load').html('<i class="fas fa-spinner fa-spin spinner-ico"></i>');
|
||||
$('#create-backup-button-text').text('Backup wird erstellt.')
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,11 +1,25 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<?php
|
||||
foreach ($devicetypes as $devicetype) {
|
||||
$deviceTypes[$devicetype->id]=$devicetype->devicemanufactor->name . " " . $devicetype->name;
|
||||
$deviceTypes[$devicetype->id] = $devicetype->devicemanufactor->name . " " . $devicetype->name;
|
||||
}
|
||||
asort($deviceTypes);
|
||||
|
||||
|
||||
if ($device->price == "0.00") {
|
||||
$price = "";
|
||||
} else {
|
||||
$price = $device->price;
|
||||
}
|
||||
if ($device->power == "0.0") {
|
||||
$power = "";
|
||||
} else {
|
||||
$power = $device->power;
|
||||
}
|
||||
if (isset($_GET['returnto']) && $_GET['returnto'] == "device-detail") {
|
||||
$cancelUrl = self::getUrl("Device", "Detail", ["id" => $device->id]);
|
||||
} else {
|
||||
$cancelUrl = self::getUrl("Device");
|
||||
}
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css" rel="stylesheet" type="text/css"/>
|
||||
<!-- start page title -->
|
||||
@@ -34,7 +48,6 @@ asort($deviceTypes);
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?= ($device->id) ? "Device bearbeiten" : "Neues Gerät" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("Device", "save", ["returnto" => $_GET["returnto"]]) ?>">
|
||||
<div class="card">
|
||||
@@ -93,6 +106,22 @@ asort($deviceTypes);
|
||||
value="<?= $device->serial ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="serial">Preis</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="price" id="price"
|
||||
placeholder="<?= $device->devicetype->price ?>"
|
||||
value="<?= $price ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="serial">Leistung</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="power" id="power"
|
||||
placeholder="<?= $device->devicetype->power ?>"
|
||||
value="<?= $power ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="comment">Bemerkung</label>
|
||||
<div class="col-lg-10">
|
||||
@@ -109,6 +138,10 @@ asort($deviceTypes);
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
<a href="<?= $cancelUrl ?>">
|
||||
<button type="button" class="btn btn-secondary">Abbrechen</button>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ $pagination_baseurl_params = ["filter" => $filter];
|
||||
$pagination_entity_name = "Device";
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?=self::getResourcePath()?>assets/css/datatables-std.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css" rel="stylesheet" type="text/css"/>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -74,11 +74,16 @@ $pagination_entity_name = "Device";
|
||||
<?php
|
||||
|
||||
foreach ($devices as $device):
|
||||
if (!empty($device->price)) {
|
||||
if ($device->price != "0.00") {
|
||||
$price = $device->price;
|
||||
} else {
|
||||
$price = $device->devicetype->price;
|
||||
}
|
||||
if ($device->power != "0.0") {
|
||||
$power = $device->power;
|
||||
} else {
|
||||
$power = $device->devicetype->power;
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
@@ -94,7 +99,7 @@ $pagination_entity_name = "Device";
|
||||
<td class="text-center"><?= $device->mac ?></td>
|
||||
<td class="text-center"><?= $device->serial ?></td>
|
||||
<td class="text-right"><?= $price ?> €</td>
|
||||
<td class="text-right"><?= $device->devicetype->power ?> Watt</td>
|
||||
<td class="text-right"><?= $power ?> Watt</td>
|
||||
|
||||
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em; width: 80px">
|
||||
@@ -124,13 +129,13 @@ $pagination_entity_name = "Device";
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch=[9];
|
||||
var hidesearch = [9];
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/datatables-std.js"></script>
|
||||
<script type="text/javascript" src="<?= self::getResourcePath() ?>assets/js/datatables-std.js"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -42,6 +42,13 @@
|
||||
value="<?= $devicemanufactors->name ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="comment">Backup Config</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea class="form-control" id="config_backup" name="config_backup"
|
||||
rows="10"><?= $devicemanufactors->config_backup ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user