Faserplanung Update
* Umbau Rohrverzeichnis auf Ajax Table * Auslagerung der JS vom Rohrverzeichnis in eigene Datei
This commit is contained in:
@@ -1,39 +1,5 @@
|
||||
<?php
|
||||
$typeOption[1] = "Einzel";
|
||||
$typeOption[2] = "Schutzrohr";
|
||||
$typeOption[3] = "Verband";
|
||||
$dimension_v1Option[1] = "MR7";
|
||||
$dimension_v1Option[2] = "MR14";
|
||||
$dimension_v1Option[3] = "MR16";
|
||||
$dimension_v1Option[4] = "MR20";
|
||||
$dimension_v1Option[5] = "PE32";
|
||||
$dimension_v1Option[6] = "PE40";
|
||||
$dimension_v1Option[7] = "PE50";
|
||||
$dimension_v1Option[8] = "KSR50";
|
||||
$dimension_v1Option[9] = "KSR80";
|
||||
$dimension_v1Option[10] = "KSR100";
|
||||
$dimension_v2Option[1] = "Anzahl";
|
||||
$dimension_v2Option[2] = "Dimenson";
|
||||
$dimension_v2Option[3] = "Farben";
|
||||
$starting_pointOption[1] = "Greenfield";
|
||||
$starting_pointOption[2] = "POP";
|
||||
$starting_pointOption[3] = "Building";
|
||||
$starting_pointOption[4] = "Schacht-Verteiler";
|
||||
$statusOption[10] = "Geplant";
|
||||
$statusOption[20] = "Umsetzung";
|
||||
$statusOption[30] = "Fertiggestellt";
|
||||
$responsibleOption[1] = "(F)";
|
||||
$responsibleOption[2] = "(P)";
|
||||
|
||||
foreach ($networks as $network) {
|
||||
$Network[$network->id] = $network->name;
|
||||
}
|
||||
foreach ($pipworkeraddresses as $pipworkeraddress) {
|
||||
$Pipeworker[$pipworkeraddress->id] = $pipworkeraddress->company;
|
||||
}
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<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"/>
|
||||
<!-- start page title -->
|
||||
<style>
|
||||
@@ -71,8 +37,9 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
|
||||
class="fas fa-plus"></i> Neuen Rohrverzeichnis anlegen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-striped table-hover table-sm font-13">
|
||||
|
||||
|
||||
<table id="datatable" class="table table-striped table-hover table-sm font-13 w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Bezeichnung</th>
|
||||
@@ -83,7 +50,7 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
|
||||
<th class="text-center">Endpunkt</th>
|
||||
<th class="text-center">Zuständig</th>
|
||||
<th class="text-center">Status</th>
|
||||
<th class="edit-width"></th>
|
||||
<th class="edit-width text-center"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
@@ -95,95 +62,13 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($fiberplanpipes as $fiberplanpipe):
|
||||
unset($networks);
|
||||
unset($endpoints);
|
||||
foreach ($fiberplanpipeEndpoints[$fiberplanpipe->id] as $fiberplanpipeEndpoint) {
|
||||
if ($fiberplanpipeEndpoint->pop_id) {
|
||||
$networks[$fiberplanpipeEndpoint->pop->network->name] = $fiberplanpipeEndpoint->pop->network->name;
|
||||
$endpoints[] = '<span title="POP">(P) </span>' . $fiberplanpipeEndpoint->pop->name;
|
||||
} else if ($fiberplanpipeEndpoint->building_id) {
|
||||
$networks[$fiberplanpipeEndpoint->building->network->name] = $fiberplanpipeEndpoint->building->network->name;
|
||||
$endpoints[] = '<span title="Building">(B) </span>' . $fiberplanpipeEndpoint->building->street . " " . $fiberplanpipeEndpoint->building->number;
|
||||
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher_id) {
|
||||
$networks[$fiberplanpipeEndpoint->fiberPlanDispatcher->network->name] = $fiberplanpipeEndpoint->fiberPlanDispatcher->network->name;
|
||||
if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "1") {
|
||||
$endpoints[] = '<span title="Verteiler">(V) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
} elseif ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "2") {
|
||||
$endpoints[] = '<span title="Schacht">(S) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "3") {
|
||||
$endpoints[] = '<span title="Greenfield">(G) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "4") {
|
||||
$endpoints[] = '<span title="Abzweigepunkt">(A) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($fiberplanpipe->type == "3") {
|
||||
$name = "";
|
||||
if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 && $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4";
|
||||
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
}
|
||||
$typeDescription = $name;
|
||||
//
|
||||
} else {
|
||||
$typeDescription = $dimension_v1Option[$fiberplanpipe->type_description];
|
||||
}
|
||||
$startpoint = '<span class="startpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->startpoint_type] . "/" . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['name'] . '</span>';
|
||||
$endpoint = '<span class="endpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->entpoint_type] . "/" . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['name'] . '</span>';
|
||||
|
||||
$responsible = $responsibleOption[$fiberplanpipe->responsible];
|
||||
|
||||
if ($fiberplanpipe->address_id) {
|
||||
$responsible .= " " . $Pipeworker[$fiberplanpipe->address_id];
|
||||
if ($fiberplanpipe->responsible_text) {
|
||||
$responsible .= " (" . $fiberplanpipe->responsible_text . ")";
|
||||
}
|
||||
} else {
|
||||
$responsible .= " " . $fiberplanpipe->responsible_text;
|
||||
}
|
||||
if ($fiberplanpipe->startpoint_network_id == $fiberplanpipe->endpoint_network_id) {
|
||||
$networkName = $Network[$fiberplanpipe->startpoint_network_id];
|
||||
} else {
|
||||
$networkName = $Network[$fiberplanpipe->startpoint_network_id] . " / " . $Network[$fiberplanpipe->endpoint_network_id];
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?= self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipe->id]) ?>"><?= $fiberplanpipe->description ?></a>
|
||||
</td>
|
||||
<td style="white-space: nowrap"><?= $typeOption[$fiberplanpipe->type] . " / " . $typeDescription ?></td>
|
||||
<td class="text-center"><?= $fiberplanpipe->length ?></td>
|
||||
|
||||
<td><?= implode(',', $networks) ?></td>
|
||||
<td><?= $endpoints[0] ?></td>
|
||||
<td><?= $endpoints[count($endpoints) - 1] ?></td>
|
||||
<td><?= $responsible ?></td>
|
||||
<td><?= $statusOption[$fiberplanpipe->status] ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("FiberPlanPipe", "edit", ["id" => $fiberplanpipe->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("FiberPlanPipe", "delete", ["id" => $fiberplanpipe->id]) ?>"
|
||||
onclick="if(!confirm('Rohrverzeichnis wirklich löschen?')) return false;"
|
||||
class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -206,10 +91,14 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [8];
|
||||
let requestUrl = "<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getFiberPlanPipes']) ?>";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
src="<?= self::getResourcePath() ?>js/pages/FiberPlanPipe/index.js?<?= $git_merge_ts ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -19,14 +19,6 @@ class FiberPlanPipeController extends mfBaseController
|
||||
protected function indexAction()
|
||||
{
|
||||
$this->layout()->setTemplate("FiberPlanPipe/Index");
|
||||
$fiberplanpipes = FiberPlanPipeModel::getAll();
|
||||
$pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses();
|
||||
$fiberplanpipeEndpoints = FiberPlanPipeEndpointModel::getAll();
|
||||
|
||||
$this->layout()->set("fiberplanpipeEndpoints", $fiberplanpipeEndpoints);
|
||||
$this->layout()->set("pipworkeraddresses", $pipworkeraddresses);
|
||||
$this->layout()->set("fiberplanpipes", $fiberplanpipes);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
@@ -56,6 +48,9 @@ class FiberPlanPipeController extends mfBaseController
|
||||
case "getPops":
|
||||
$return = $this->getPops($network);
|
||||
break;
|
||||
case "getFiberPlanPipes":
|
||||
$return = $this->getFiberPlanPipes();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
@@ -283,4 +278,110 @@ class FiberPlanPipeController extends mfBaseController
|
||||
{
|
||||
FiberPlanPipeModel::getBuildingInfo($network, $bdtype);
|
||||
}
|
||||
|
||||
|
||||
protected function getFiberPlanPipes()
|
||||
{
|
||||
|
||||
$fiberplanpipes = FiberPlanPipeModel::getAll();
|
||||
$pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses();
|
||||
$fiberplanpipeEndpoints = FiberPlanPipeEndpointModel::getAll();
|
||||
$typeOption = FiberPlanPipeModel::$type_definition;
|
||||
$statusOption = FiberPlanPipeModel::$status_definition;
|
||||
$dimension_v1Option = FiberPlanPipeModel::$type_descrition_definition;
|
||||
$responsibleOption[1] = "(F)";
|
||||
$responsibleOption[2] = "(P)";
|
||||
|
||||
foreach ($pipworkeraddresses as $pipworkeraddress) {
|
||||
$Pipeworker[$pipworkeraddress->id] = $pipworkeraddress->company;
|
||||
}
|
||||
$responsecount = count($fiberplanpipes);
|
||||
|
||||
foreach ($fiberplanpipes as $fiberplanpipe) {
|
||||
unset($networks);
|
||||
unset($endpoints);
|
||||
|
||||
// Performance Killer muss bereinigt werden
|
||||
foreach ($fiberplanpipeEndpoints[$fiberplanpipe->id] as $fiberplanpipeEndpoint) {
|
||||
if ($fiberplanpipeEndpoint->pop_id) {
|
||||
$networks[$fiberplanpipeEndpoint->pop->network->name] = $fiberplanpipeEndpoint->pop->network->name;
|
||||
$endpoints[] = '<span title="POP">(P) </span>' . $fiberplanpipeEndpoint->pop->name;
|
||||
} else if ($fiberplanpipeEndpoint->building_id) {
|
||||
$networks[$fiberplanpipeEndpoint->building->network->name] = $fiberplanpipeEndpoint->building->network->name;
|
||||
$endpoints[] = '<span title="Building">(B) </span>' . $fiberplanpipeEndpoint->building->street . " " . $fiberplanpipeEndpoint->building->number;
|
||||
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher_id) {
|
||||
$networks[$fiberplanpipeEndpoint->fiberPlanDispatcher->network->name] = $fiberplanpipeEndpoint->fiberPlanDispatcher->network->name;
|
||||
if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "1") {
|
||||
$endpoints[] = '<span title="Verteiler">(V) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
} elseif ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "2") {
|
||||
$endpoints[] = '<span title="Schacht">(S) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "3") {
|
||||
$endpoints[] = '<span title="Greenfield">(G) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "4") {
|
||||
$endpoints[] = '<span title="Abzweigepunkt">(A) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
|
||||
}
|
||||
}
|
||||
}
|
||||
//....
|
||||
|
||||
if ($fiberplanpipe->type == "3") {
|
||||
$name = "";
|
||||
if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 && $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4";
|
||||
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
|
||||
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
|
||||
}
|
||||
$typeDescription = $name;
|
||||
//
|
||||
} else {
|
||||
$typeDescription = $dimension_v1Option[$fiberplanpipe->type_description];
|
||||
}
|
||||
$startpoint = '<span class="startpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->startpoint_type] . "/" . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['name'] . '</span>';
|
||||
$endpoint = '<span class="endpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->entpoint_type] . "/" . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['name'] . '</span>';
|
||||
|
||||
$responsible = $responsibleOption[$fiberplanpipe->responsible];
|
||||
|
||||
if ($fiberplanpipe->address_id) {
|
||||
$responsible .= " " . $Pipeworker[$fiberplanpipe->address_id];
|
||||
if ($fiberplanpipe->responsible_text) {
|
||||
$responsible .= " (" . $fiberplanpipe->responsible_text . ")";
|
||||
}
|
||||
} else {
|
||||
$responsible .= " " . $fiberplanpipe->responsible_text;
|
||||
}
|
||||
if ($fiberplanpipe->startpoint_network_id == $fiberplanpipe->endpoint_network_id) {
|
||||
$networkName = $Network[$fiberplanpipe->startpoint_network_id];
|
||||
} else {
|
||||
$networkName = $Network[$fiberplanpipe->startpoint_network_id] . " / " . $Network[$fiberplanpipe->endpoint_network_id];
|
||||
}
|
||||
$edit = '<a href="' . self::getUrl("FiberPlanPipe", "edit", ["id" => $fiberplanpipe->id]) . '"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a><a href="' . self::getUrl("FiberPlanPipe", "delete", ["id" => $fiberplanpipe->id]) . '"
|
||||
onclick="if(!confirm("Rohrverzeichnis wirklich löschen?")) return false;"
|
||||
class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>';
|
||||
|
||||
$rows[] = array(
|
||||
'description' => array('description' => '<a href="' . self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipe->id]) . '">' . $fiberplanpipe->description . '</a>', 'order' => $fiberplanpipe->description),
|
||||
'typeOption' => array('typeOption' => $typeOption[$fiberplanpipe->type] . " / " . $typeDescription, 'order' => $typeOption[$fiberplanpipe->type] . " / " . $typeDescription),
|
||||
'length' => array('length' => $fiberplanpipe->length, 'order' => $fiberplanpipe->length),
|
||||
'networks' => array('networks' => implode(',', $networks), 'order' => implode(',', $networks)),
|
||||
'startpoint' => array('startpoint' => $endpoints[0], 'order' => $endpoints[0]),
|
||||
'endpoint' => array('endpoint' => $endpoints[count($endpoints) - 1], 'order' => $endpoints[count($endpoints) - 1]),
|
||||
'responsible' => array('responsible' => $responsible, 'order' => $responsible),
|
||||
'state' => array('state' => $statusOption[$fiberplanpipe->status], 'order' => $statusOption[$fiberplanpipe->status]),
|
||||
'edit' => array('edit' => $edit, 'order' => ''),
|
||||
);
|
||||
}
|
||||
|
||||
$json['success'] = true;
|
||||
$json['data'] = $rows;
|
||||
$json['recordsFiltered'] = $responsecount;
|
||||
$json['recordsTotal'] = $responsecount;
|
||||
$json = json_encode($json);
|
||||
echo trim($json);
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class FiberPlanPipeModel
|
||||
private $comment;
|
||||
public static $type_descrition_definition = array(1 => "MR7", 2 => "MR14", 3 => "MR16", 4 => "MR20", 5 => "PE32", 6 => "PE40", 7 => "PE50", 8 => "KSR50", 9 => "KSR80", 10 => "KSR100");
|
||||
public static $type_definition = array(1 => "Enzel", 2 => "Schutzrohr", 3 => "Verband");
|
||||
public static $status_definition = array(10 => "Geplant", 20 => "Umsetzung", 30 => "Fertiggestellt");
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
169
public/js/pages/FiberPlanPipe/index.js
Normal file
169
public/js/pages/FiberPlanPipe/index.js
Normal file
@@ -0,0 +1,169 @@
|
||||
let table;
|
||||
if (typeof hidesearch === "undefined") {
|
||||
var hidesearch;
|
||||
hidesearch = [100];
|
||||
}
|
||||
|
||||
if (typeof cstmdom === "undefined") {
|
||||
var cstmdom;
|
||||
cstmdom = "flBrtip";
|
||||
|
||||
}
|
||||
if (typeof columndefs === "undefined") {
|
||||
var columndefs;
|
||||
columndefs = "";
|
||||
|
||||
}
|
||||
|
||||
if (typeof columnfilter === "undefined") {
|
||||
var columnfilter;
|
||||
columnfilter = "";
|
||||
}
|
||||
|
||||
if (typeof columnoptions === "undefined") {
|
||||
var columnoptions;
|
||||
columnoptions = "";
|
||||
}
|
||||
|
||||
$('#filterrow th').each(function (i) {
|
||||
let title = $('#datatable thead th').eq($(this).index()).text();
|
||||
|
||||
if (hidesearch.includes($(this).index())) {
|
||||
|
||||
} else if (columnfilter.includes($(this).index())) {
|
||||
$(this).html('<select style="padding: 0;height: 28px;;text-align: center;" id="selectsearch" class="form-control form-control-select form-control-special" data-index="' + i + '">' + columnoptions + '</select>');
|
||||
|
||||
} else {
|
||||
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
||||
}
|
||||
});
|
||||
|
||||
table = $('#datatable').DataTable({
|
||||
responsive: true,
|
||||
"order": [[0, "desc"]],
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success margina d-none d-lg-block',
|
||||
exportOptions: {
|
||||
columns: ['th:not(:last-child)']
|
||||
}
|
||||
}
|
||||
], columnDefs: [
|
||||
columndefs
|
||||
],
|
||||
"language": {
|
||||
"url": "/datatables/json/german.json?v1"
|
||||
},
|
||||
orderCellsTop: true,
|
||||
stateSave: true,
|
||||
stateDuration: 60 * 60 * 24 * 30,
|
||||
"initComplete": function () {
|
||||
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
|
||||
$('#clear_cookie').click(function () {
|
||||
$('#filterrow input').val('');
|
||||
$('#filterrow select').val('');
|
||||
table.search('').columns().search('').draw();
|
||||
});
|
||||
},
|
||||
"dom": cstmdom,
|
||||
"ajax": {
|
||||
"url": requestUrl,
|
||||
"type": "POST",
|
||||
"data": function (d) {
|
||||
},
|
||||
"dataSrc": function (json) {
|
||||
return json.data;
|
||||
}
|
||||
|
||||
},
|
||||
"columns": [
|
||||
{
|
||||
"data": {
|
||||
_: "description.description",
|
||||
"sort": "description.order"
|
||||
},
|
||||
className: "text-nowrap"
|
||||
}, {
|
||||
"data": {
|
||||
_: "typeOption.typeOption",
|
||||
"sort": "typeOption.order"
|
||||
},
|
||||
className: "text-center"
|
||||
}, {
|
||||
"data": {
|
||||
_: "length.length",
|
||||
"sort": "length.order"
|
||||
},
|
||||
className: "text-center"
|
||||
}, {
|
||||
"data": {
|
||||
_: "networks.networks",
|
||||
"sort": "networks.order"
|
||||
},
|
||||
className: "text-center"
|
||||
}, {
|
||||
"data": {
|
||||
_: "startpoint.startpoint",
|
||||
"sort": "startpoint.order"
|
||||
},
|
||||
className: ""
|
||||
}
|
||||
, {
|
||||
"data": {
|
||||
_: "endpoint.endpoint",
|
||||
"sort": "endpoint.order"
|
||||
},
|
||||
className: "text-left"
|
||||
},{
|
||||
"data": {
|
||||
_: "responsible.responsible",
|
||||
"sort": "responsible.order"
|
||||
},
|
||||
className: "text-left"
|
||||
}, {
|
||||
"data": {
|
||||
_: "state.state",
|
||||
"sort": "state.order"
|
||||
},
|
||||
className: "text-left"
|
||||
},{
|
||||
"data": {
|
||||
_: "edit.edit",
|
||||
"sort": "edit.order"
|
||||
},
|
||||
className: "edit-td"
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
$('#filterrow').on('keyup', 'input', function () {
|
||||
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
|
||||
});
|
||||
|
||||
$('#selectsearch').change(function () {
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
|
||||
|
||||
});
|
||||
let state = table.state.loaded();
|
||||
if (state) {
|
||||
table.columns().eq(0).each(function (colIdx) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
|
||||
if (colSearch.search) {
|
||||
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
||||
}
|
||||
});
|
||||
table.draw();
|
||||
}
|
||||
Reference in New Issue
Block a user