Pop Feature Erweiterungen

* Project 8454 (Erweiterung Felder Status, Speicherort, Dokustand Datum)
* Schrank breite um 1ne Col verbreitert
* neue Migration
This commit is contained in:
Daniel Spitzer
2025-05-11 19:53:31 +02:00
parent 14bcb7b3c2
commit 09aaede76b
6 changed files with 117 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet" type="text/css"/>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
<style>
.card-border {
@@ -178,6 +179,14 @@ if (!empty(trim($pops->vlan_ipv6)))
<th class="text-nowrap">Access VLANs</th>
<td><?= $vlans ?> </td>
</tr>
<tr>
<th class="text-nowrap">Dokustand | Status</th>
<td><?= ($pops->doku_date) ? date("d.m.Y") : '-' ?><span class="ml-2 mr-2">|</span><?= ($pops->state) ? $stateArray[$pops->state] : '-' ?> </td>
</tr>
<tr>
<th class="text-nowrap">Fotospeicherort</th>
<td><?php if ($pops->folder_link): ?> <a href="file://<?= $pops->folder_link ?>"><?= $pops->folder_link ?></a><?php endif; ?></td>
</tr>
<tr>
<th class="text-nowrap">Interne Notiz</th>
<td><?= nl2br($pops->note) ?> </td>
@@ -204,7 +213,7 @@ if (!empty(trim($pops->vlan_ipv6)))
<th class="text-center ">Geräte Typ</th>
<th class="text-center ">Hersteller</th>
<th class="text-center all">IP-Adresse</th>
<th class="text-center " >Seriennummer</th>
<th class="text-center ">Seriennummer</th>
<th class="text-center ">Preis</th>
<th title="maximale Leistung" class="text-center text-nowrap">max. P.</th>
</tr>
@@ -309,7 +318,8 @@ if (!empty(trim($pops->vlan_ipv6)))
</div>
</div>
<?php if ($popracks) : ?>
<div class="modal fade bd-example-modal-xl" tabindex="-1" role="dialog" aria-labelledby="myExtraLargeModalLabel" aria-hidden="true">
<div class="modal fade bd-example-modal-xl" tabindex="-1" role="dialog" aria-labelledby="myExtraLargeModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
...
@@ -465,10 +475,9 @@ if (!empty(trim($pops->vlan_ipv6)))
<div>
<h4>Schränke </h4>
</div>
<div id="sortracklist" class="row" data-popid="<?= $pops->id ?>">
<?php foreach ($popracks as $poprack) : ?>
<div class="col-lg-2 list-group-item-move">
<div class="col-lg-3 col-12 list-group-item-move mb-3">
<table class="w-100 p-0 font-13"
style="max-width: 100%; box-shadow: 2px 2px 5px 2px rgba(0,0,0,0.31);border-radius: 5px 5px 5px 5px;">
<thead>

View File

@@ -10,9 +10,13 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "pop-detail") {
$cancelUrl = self::getUrl("Network");
}
?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<style>
</style>
<div class="row">
<div class="col-12">
<div class="page-title-box">
@@ -139,6 +143,35 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "pop-detail") {
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="state">Status</label>
<div class="col-lg-3">
<select class="select2 form-control " name="state"
id="state">
<option value="">&nbsp;</option>
<?php foreach ($stateArray as $key => $value): ?>
<option value="<?= $key ?>" <?= ($key == $pop->state) ? "selected='selected'" : "" ?>><?= $value ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="note">Dokustand</label>
<div class="col-lg-2">
<input type="date"
min="<?php //($pop->doku_date) ? date("Y-m-d", $pop->doku_date) : "" ?>"
value="<?= ($pop->doku_date) ? date("Y-m-d", $pop->doku_date) : "" ?>"
class="form-control" name="doku_date" id="doku_date">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="folder_link">Fotospeicherort</label>
<div class="col-lg-4">
<input type="text"
value="<?= ($pop->folder_link) ? : "" ?>"
class="form-control" name="folder_link" id="folder_link">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
<div class="col-lg-10">
@@ -146,6 +179,7 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "pop-detail") {
rows="5"><?= $pop->note ?></textarea>
</div>
</div>
</div>
</div>
@@ -183,7 +217,8 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "pop-detail") {
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('wheel.disableScroll')
});
$(".select2").select2();
$(".select2").select2({
});
// network_id // owner_id
@@ -191,7 +226,7 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "pop-detail") {
const urlParams = new URLSearchParams(window.location.search);
const network_id = urlParams.get('network_id');
if(network_id) {
if (network_id) {
console.log("network_id", network_id);
$("#owner_id").val(network_id).trigger('change');
}

View File

@@ -74,6 +74,8 @@ class PopController extends mfBaseController
$this->redirect("Pop");
}
$popnetwork = PopNetworkModel::getbyPopid($id);
$stateArray=PopModel::$stateArray;
$this->layout()->set("stateArray", $stateArray);
$this->layout()->set("popnetwork", implode(', ' , $popnetwork['name']));
$this->layout()->setTemplate("Pop/Detail");
$filter['pop_id'] = $id;
@@ -86,8 +88,12 @@ class PopController extends mfBaseController
protected function addAction()
{
$stateArray=PopModel::$stateArray;
$this->layout()->set("stateArray", $stateArray);
$this->layout()->setTemplate("Pop/Form");
$this->layout()->set("networks", NetworkModel::getAll());
if ($this->request->network_id) {
$pop = new Pop();
$pop->network_id = $this->request->network_id;
@@ -151,6 +157,9 @@ class PopController extends mfBaseController
$data['vlan_public'] = ($r->vlan_public) ? $r->vlan_public : null;
$data['vlan_nat'] = ($r->vlan_nat) ? $r->vlan_nat : null;
$data['vlan_ipv6'] = ($r->vlan_ipv6) ? $r->vlan_ipv6 : null;
$data['state'] = ($r->state) ? $r->state : null;
$data['folder_link'] = ($r->folder_link) ? $r->folder_link : null;
$data['doku_date'] = ($r->doku_date) ? strtotime($r->doku_date) : null;
$data['note'] = $r->note;
$data['edit_by'] = 1;

View File

@@ -10,6 +10,10 @@ class PopModel
public $vlan_public = null;
public $vlan_nat = null;
public $vlan_ipv6 = null;
public $state = null;
public $folder_link = null;
public $doku_date = null;
public $note = null;
@@ -18,6 +22,14 @@ class PopModel
public $create = null;
public $edit = null;
public static $stateArray = [
1 => "Planung (Innenleben)",
2 => "Bauphase (Schrank)",
3 => "Grobdoku",
4 => "in Betrieb",
5 => "von Techniker abgenommen (Altbestand)",
];
public static function find($data)
{
@@ -122,7 +134,7 @@ class PopModel
WHERE $where
ORDER BY name, PopNetwork.network_id LIMIT 1
";
$res = $db->query($sql);
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
@@ -142,15 +154,15 @@ class PopModel
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT Pop.* FROM Pop
LEFT JOIN PopNetwork ON (PopNetwork.pop_id = Pop.id)
WHERE $where
ORDER BY name, PopNetwork.network_id";
$res = $db->query($sql);
//$res = $db->select("Pop", "*", "$where ORDER BY name, network_id");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Pop($data);

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class PopAddFields extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$timerecordingCategory = $this->table("Pop");
$timerecordingCategory->addColumn("state", "integer", ["null" => true, "default" => null,"comment" => "1:Planung/2:Bauphase/3:Grobdoku,4:in Betrieb/5:von Techniker abgenommen", "after" => "vlan_ipv6"]);
$timerecordingCategory->addColumn("folder_link", "text", ["null" => true, "default" => null, "after" => "state"]);
$timerecordingCategory->addColumn("doku_date", "integer", ["null" => true, "default" => null, "after" => "folder_link"]);
$timerecordingCategory->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table('Pop');
$table->removeColumn("state");
$table->removeColumn("folder_link");
$table->removeColumn("doku_date");
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -8,4 +8,7 @@
}
.select2-container--default .select2-selection--single {
border: 1px solid #ced4da;
}
.select2-container .select2-selection--multiple {
min-height: calc(1.5em + 0.9rem + 2px);
}