Gerätetyp erweitert um Temperaturen
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
<link href="<?=self::getResourcePath()?>assets/css/select2-cstm.css?<?=date('U')?>" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet" type="text/css"/>
|
||||
<!-- start page title -->
|
||||
<style type="text/css">
|
||||
.tool-border-spacer
|
||||
{
|
||||
border-right: 2px solid #868686;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
@@ -78,7 +84,18 @@
|
||||
value="<?= $devicetypes->power ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="price">Temperatur Warnung | Kritisch</label>
|
||||
<div class="col-lg-2 tool-border-spacer">
|
||||
<input type="number" min="0" step="1" class="form-control" name="temp_warning" id="temp_warning" placeholder="80"
|
||||
value="<?= $devicetypes->temp_warning ?>" >
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<input type="number" min="0" step="1" class="form-control" name="temp_critical" id="temp_critical" placeholder="90"
|
||||
value="<?= $devicetypes->temp_critical ?>" >
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -44,6 +44,8 @@ class DeviceController extends mfBaseController
|
||||
"manufacturer" => $deviceType->devicemanufactor->name,
|
||||
"price" => $deviceType->price,
|
||||
"power" => $deviceType->power,
|
||||
"temp_warning" => $deviceType->temp_warning,
|
||||
"temp_critical" => $deviceType->temp_critical,
|
||||
"creator" => $deviceType->creator->name,
|
||||
"created" => $deviceType->create,
|
||||
];
|
||||
|
||||
@@ -76,6 +76,17 @@ class DevicetypeController extends mfBaseController
|
||||
} else {
|
||||
$power = $r->power;
|
||||
}
|
||||
if (!$r->temp_warning) {
|
||||
$temp_warning = "80";
|
||||
} else {
|
||||
$temp_warning = $r->temp_warning;
|
||||
}
|
||||
|
||||
if (!$r->temp_critical) {
|
||||
$temp_critical = "90";
|
||||
} else {
|
||||
$temp_critical = $r->temp_critical;
|
||||
}
|
||||
|
||||
|
||||
if ($r->olt) {
|
||||
@@ -88,6 +99,8 @@ class DevicetypeController extends mfBaseController
|
||||
$data['price'] = $price;
|
||||
$data['power'] = $power;
|
||||
$data['olt'] = $olt;
|
||||
$data['temp_warning'] = $temp_warning;
|
||||
$data['temp_critical'] = $temp_critical;
|
||||
|
||||
if (!$data['name']) {
|
||||
$this->layout()->setFlash("Name darf nicht leer sein", "error");
|
||||
|
||||
@@ -7,6 +7,8 @@ class DevicetypeModel
|
||||
public $price = null;
|
||||
public $olt = null;
|
||||
public $devicemanufactor_id = null;
|
||||
public $temp_warning = 80;
|
||||
public $temp_critical = 90;
|
||||
|
||||
|
||||
public $create_by = null;
|
||||
|
||||
33
db/migrations/20250902070036_devicetype_add_temperature.php
Normal file
33
db/migrations/20250902070036_devicetype_add_temperature.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class DevicetypeAddTemperature extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Devicetype");
|
||||
$table->addColumn("temp_warning", "integer", ['null' => false,'default' => '80', "after" => "power"]);
|
||||
$table->addColumn("temp_critical", "integer", ['null' => false,'default' => '90', "after" => "temp_warning"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Devicetype")->removeColumn("temp_warning")->save();
|
||||
$this->table("Devicetype")->removeColumn("temp_critical")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,6 +241,8 @@ Vue.component('DeviceType', {
|
||||
{text: 'Hersteller', key: 'manufacturer', filter: 'search', class: 'text-center'},
|
||||
{text: 'Preis', key: 'price', filter: 'numberRange', class: 'text-center', suffix: ' €'},
|
||||
{text: 'max. Leistung', key: 'power', filter: 'numberRange', class: 'text-center', suffix: ' W'},
|
||||
{text: 'Temp. Warnung', key: 'temp_warning', filter: 'numberRange', class: 'text-center', suffix: ' °C'},
|
||||
{text: 'Temp. Kritisch', key: 'temp_critical', filter: 'numberRange', class: 'text-center', suffix: ' °C'},
|
||||
{text: 'Erstellungsdatum', key: 'created', filter: 'date', class: 'text-center'},
|
||||
{text: 'Erstellt von', key: 'creator', filter: 'search', class: 'text-center'},
|
||||
{text: 'Aktionen', key: 'actions', class: 'text-center', sortable: false, filter: false, priority: 9},
|
||||
|
||||
Reference in New Issue
Block a user