feat: Ausgebaut-Status für Anlagen-Elemente
Elemente können als "ausgebaut" markiert werden mit Datum. Bleiben in der DB für Nachvollziehbarkeit, werden ausgegraut dargestellt und können per Toggle ein-/ausgeblendet werden. - DB: decommissioned + date_decommissioned Spalten - Dialog mit Datumsauswahl beim Ausbauen - Toggle-Button in Baum- und Graph-Toolbar - Ausgebaute Elemente ausgegraut (opacity 0.4, durchgestrichen) - Badge mit Ausbau-Datum im Baum - Kontextmenü im Graph für Ausbauen/Einbauen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ee4c6688d9
commit
fd8d11e764
12 changed files with 338 additions and 4 deletions
|
|
@ -48,7 +48,8 @@ function treeToArray($nodes) {
|
|||
'fk_parent' => $node->fk_parent,
|
||||
'fk_system' => $node->fk_system,
|
||||
'type_label' => $node->type_label,
|
||||
'status' => $node->status
|
||||
'status' => $node->status,
|
||||
'decommissioned' => (int) $node->decommissioned
|
||||
);
|
||||
if (!empty($node->children)) {
|
||||
$item['children'] = treeToArray($node->children);
|
||||
|
|
@ -94,7 +95,8 @@ switch ($action) {
|
|||
'display_label' => $prefix . $node->label,
|
||||
'fk_parent' => $node->fk_parent,
|
||||
'type_label' => $node->type_label,
|
||||
'status' => $node->status
|
||||
'status' => $node->status,
|
||||
'decommissioned' => (int) $node->decommissioned
|
||||
);
|
||||
if (!empty($node->children)) {
|
||||
$flattenTree($node->children, $prefix . ' ');
|
||||
|
|
@ -123,6 +125,7 @@ switch ($action) {
|
|||
'type_label' => $anlage->type_label,
|
||||
'fk_system' => $anlage->fk_system,
|
||||
'status' => $anlage->status,
|
||||
'decommissioned' => (int) $anlage->decommissioned,
|
||||
'field_values' => $anlage->getFieldValues()
|
||||
);
|
||||
} else {
|
||||
|
|
@ -130,6 +133,36 @@ switch ($action) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 'toggle_decommissioned':
|
||||
// Ausgebaut-Status umschalten
|
||||
if (!$user->hasRight('kundenkarte', 'write')) {
|
||||
$response['error'] = $langs->trans('ErrorPermissionDenied');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($anlageId > 0 && $anlage->fetch($anlageId) > 0) {
|
||||
$anlage->decommissioned = $anlage->decommissioned ? 0 : 1;
|
||||
if ($anlage->decommissioned) {
|
||||
// Ausbau: Datum setzen (aus POST oder heute)
|
||||
$dateStr = GETPOST('date_decommissioned', 'alpha');
|
||||
$anlage->date_decommissioned = !empty($dateStr) ? $dateStr : date('Y-m-d');
|
||||
} else {
|
||||
// Wieder einbauen: Datum löschen
|
||||
$anlage->date_decommissioned = null;
|
||||
}
|
||||
$result = $anlage->update($user);
|
||||
if ($result > 0) {
|
||||
$response['success'] = true;
|
||||
$response['decommissioned'] = (int) $anlage->decommissioned;
|
||||
$response['date_decommissioned'] = $anlage->date_decommissioned;
|
||||
} else {
|
||||
$response['error'] = 'Fehler beim Speichern';
|
||||
}
|
||||
} else {
|
||||
$response['error'] = $langs->trans('ErrorRecordNotFound');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'reorder':
|
||||
// Reihenfolge der Elemente aktualisieren
|
||||
if (!$user->hasRight('kundenkarte', 'write')) {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ if ($resFields) {
|
|||
// Elemente laden - OHNE GLOBAL-System (das ist nur die separate Gebäudestruktur)
|
||||
// Gebäude/Räume werden über den Typ erkannt (type_system_code = GLOBAL)
|
||||
// Hierarchie kommt aus fk_parent (wie im Baum)
|
||||
$sql = "SELECT a.rowid, a.label, a.fk_parent, a.fk_system, a.fk_anlage_type,";
|
||||
$sql = "SELECT a.rowid, a.label, a.fk_parent, a.fk_system, a.fk_anlage_type, a.decommissioned, a.date_decommissioned,";
|
||||
$sql .= " a.field_values, a.fk_contact, a.graph_x, a.graph_y, a.graph_width, a.graph_height,";
|
||||
$sql .= " t.label as type_label, t.picto as type_picto, t.color as type_color,";
|
||||
$sql .= " t.can_have_children as type_can_have_children,";
|
||||
|
|
@ -128,6 +128,8 @@ if ($resql) {
|
|||
'fk_parent' => (int) $obj->fk_parent,
|
||||
'fk_anlage_type' => (int) $obj->fk_anlage_type,
|
||||
'is_building' => $isBuilding,
|
||||
'decommissioned' => isset($obj->decommissioned) ? (int) $obj->decommissioned : 0,
|
||||
'date_decommissioned' => isset($obj->date_decommissioned) ? $obj->date_decommissioned : null,
|
||||
'image_count' => (int) $obj->image_count,
|
||||
'doc_count' => (int) $obj->doc_count,
|
||||
'graph_x' => $obj->graph_x !== null ? (float) $obj->graph_x : null,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ class Anlage extends CommonObject
|
|||
public $note_private;
|
||||
public $note_public;
|
||||
public $status;
|
||||
public $decommissioned;
|
||||
public $date_decommissioned;
|
||||
|
||||
public $date_creation;
|
||||
public $fk_user_creat;
|
||||
|
|
@ -217,6 +219,8 @@ class Anlage extends CommonObject
|
|||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->status = $obj->status;
|
||||
$this->decommissioned = isset($obj->decommissioned) ? (int) $obj->decommissioned : 0;
|
||||
$this->date_decommissioned = isset($obj->date_decommissioned) ? $obj->date_decommissioned : null;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
|
@ -287,6 +291,8 @@ class Anlage extends CommonObject
|
|||
$sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "NULL");
|
||||
$sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "NULL");
|
||||
$sql .= ", status = ".((int) $this->status);
|
||||
$sql .= ", decommissioned = ".((int) $this->decommissioned);
|
||||
$sql .= ", date_decommissioned = ".($this->date_decommissioned ? "'".$this->db->escape($this->date_decommissioned)."'" : "NULL");
|
||||
$sql .= ", fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class modKundenKarte extends DolibarrModules
|
|||
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@kundenkarte'
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = '8.3';
|
||||
$this->version = '8.4';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
|
|
@ -633,6 +633,9 @@ class modKundenKarte extends DolibarrModules
|
|||
|
||||
// v6.8.0: Schutzgruppen-Zuordnung (fk_protection)
|
||||
$this->migrate_v680_protection_groups();
|
||||
|
||||
// v8.0.0: Ausgebaut-Status für Anlagen
|
||||
$this->migrate_v800_decommissioned();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -927,6 +930,26 @@ class modKundenKarte extends DolibarrModules
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migration v8.0.0: Ausgebaut-Status für Anlagen
|
||||
*/
|
||||
private function migrate_v800_decommissioned()
|
||||
{
|
||||
$table = MAIN_DB_PREFIX."kundenkarte_anlage";
|
||||
|
||||
$resql = $this->db->query("SHOW COLUMNS FROM ".$table." LIKE 'decommissioned'");
|
||||
if (!$resql || $this->db->num_rows($resql) == 0) {
|
||||
$this->db->query("ALTER TABLE ".$table." ADD COLUMN decommissioned tinyint DEFAULT 0 NOT NULL AFTER status");
|
||||
$this->db->query("ALTER TABLE ".$table." ADD INDEX idx_anlage_decommissioned (decommissioned)");
|
||||
}
|
||||
|
||||
// Ausbau-Datum
|
||||
$resql = $this->db->query("SHOW COLUMNS FROM ".$table." LIKE 'date_decommissioned'");
|
||||
if (!$resql || $this->db->num_rows($resql) == 0) {
|
||||
$this->db->query("ALTER TABLE ".$table." ADD COLUMN date_decommissioned DATE NULL AFTER decommissioned");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
|
|
|
|||
|
|
@ -2846,3 +2846,43 @@ body.kundenkarte-drag-active * {
|
|||
.edit-product-clear:hover {
|
||||
color: #e74c3c !important;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
AUSGEBAUTE ELEMENTE (Decommissioned)
|
||||
======================================== */
|
||||
|
||||
/* Ausgebaute Elemente im Baum standardmäßig ausgeblendet */
|
||||
/* Funktion 1: kundenkarte-tree-node, Funktion 2: kundenkarte-tree-row */
|
||||
.kundenkarte-tree .decommissioned {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Sichtbar wenn Toggle aktiv */
|
||||
.kundenkarte-tree.show-decommissioned .decommissioned {
|
||||
display: flex !important;
|
||||
opacity: 0.4 !important;
|
||||
}
|
||||
|
||||
/* Ausgegraut: Label durchgestrichen */
|
||||
.kundenkarte-tree.show-decommissioned .decommissioned .tree-label,
|
||||
.kundenkarte-tree.show-decommissioned .decommissioned .tree-item-label {
|
||||
text-decoration: line-through !important;
|
||||
}
|
||||
|
||||
/* Badge "Ausgebaut" mit Datum */
|
||||
.badge-decommissioned {
|
||||
display: inline-block !important;
|
||||
margin-left: 8px !important;
|
||||
padding: 1px 6px !important;
|
||||
font-size: 10px !important;
|
||||
background: #8b4513 !important;
|
||||
color: #ddd !important;
|
||||
border-radius: 3px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
/* Toggle-Button aktiver Zustand */
|
||||
#btn-toggle-decommissioned.active {
|
||||
background: rgba(139, 69, 19, 0.3) !important;
|
||||
border-color: #8b4513 !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,69 @@
|
|||
});
|
||||
};
|
||||
|
||||
// Dialog zum Ausbauen mit Datumsauswahl
|
||||
KundenKarte.showDecommissionDialog = function(anlageId, onSuccess) {
|
||||
$('#kundenkarte-decommission-dialog').remove();
|
||||
|
||||
var today = new Date().toISOString().split('T')[0];
|
||||
|
||||
var html = '<div id="kundenkarte-decommission-dialog" class="kundenkarte-modal">';
|
||||
html += '<div class="kundenkarte-modal-content" style="max-width:400px;">';
|
||||
html += '<div class="kundenkarte-modal-header"><h3><i class="fa fa-power-off"></i> Element ausbauen</h3>';
|
||||
html += '<span class="kundenkarte-modal-close">×</span></div>';
|
||||
html += '<div class="kundenkarte-modal-body" style="padding:20px;">';
|
||||
html += '<p style="margin:0 0 15px 0;font-size:14px;">Element als ausgebaut markieren?</p>';
|
||||
html += '<label style="display:block;margin-bottom:5px;font-size:13px;color:#aaa;">Ausbau-Datum:</label>';
|
||||
html += '<input type="date" id="decommission-date" value="' + today + '" style="width:100%;padding:8px;border:1px solid #555;border-radius:4px;background:#2a2a3a;color:#ddd;font-size:14px;">';
|
||||
html += '</div>';
|
||||
html += '<div class="kundenkarte-modal-footer" style="display:flex;gap:10px;justify-content:flex-end;">';
|
||||
html += '<button type="button" class="button" id="decommission-confirm" style="background:#8b4513;color:#fff;"><i class="fa fa-power-off"></i> Ausbauen</button>';
|
||||
html += '<button type="button" class="button" id="decommission-cancel"><i class="fa fa-times"></i> Abbrechen</button>';
|
||||
html += '</div>';
|
||||
html += '</div></div>';
|
||||
|
||||
$('body').append(html);
|
||||
$('#kundenkarte-decommission-dialog').addClass('visible');
|
||||
$('#decommission-date').focus();
|
||||
|
||||
$('#decommission-confirm').on('click', function() {
|
||||
var dateVal = $('#decommission-date').val();
|
||||
$('#kundenkarte-decommission-dialog').remove();
|
||||
$(document).off('keydown.decommDialog');
|
||||
|
||||
$.post(KundenKarte.ajaxUrl + '/anlage.php', {
|
||||
action: 'toggle_decommissioned',
|
||||
anlage_id: anlageId,
|
||||
date_decommissioned: dateVal,
|
||||
token: KundenKarte.token
|
||||
}, function(res) {
|
||||
if (res.success) {
|
||||
if (typeof onSuccess === 'function') {
|
||||
onSuccess(res);
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
} else {
|
||||
alert(res.error || 'Fehler');
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
$('#decommission-cancel, #kundenkarte-decommission-dialog .kundenkarte-modal-close').on('click', function() {
|
||||
$('#kundenkarte-decommission-dialog').remove();
|
||||
$(document).off('keydown.decommDialog');
|
||||
});
|
||||
|
||||
$(document).on('keydown.decommDialog', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
$('#kundenkarte-decommission-dialog').remove();
|
||||
$(document).off('keydown.decommDialog');
|
||||
} else if (e.key === 'Enter') {
|
||||
$('#decommission-confirm').click();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Global error display with details
|
||||
KundenKarte.showError = function(title, message, details) {
|
||||
$('#kundenkarte-error-dialog').remove();
|
||||
|
|
@ -216,6 +279,47 @@
|
|||
self.toggleCompactMode();
|
||||
});
|
||||
|
||||
// Ausgebaute Elemente ein-/ausblenden
|
||||
$(document).on('click', '#btn-toggle-decommissioned', function(e) {
|
||||
e.preventDefault();
|
||||
var $btn = $(this);
|
||||
$btn.toggleClass('active');
|
||||
var show = $btn.hasClass('active');
|
||||
$btn.find('i').toggleClass('fa-eye-slash', !show).toggleClass('fa-eye', show);
|
||||
$('.kundenkarte-tree').toggleClass('show-decommissioned', show);
|
||||
});
|
||||
|
||||
// Ausbauen/Einbauen per Klick
|
||||
$(document).on('click', '.btn-toggle-decommissioned', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var $btn = $(this);
|
||||
var anlageId = $btn.data('anlage-id');
|
||||
if (!anlageId) return;
|
||||
|
||||
// Prüfen ob Element bereits ausgebaut ist
|
||||
var $row = $btn.closest('.decommissioned');
|
||||
if ($row.length) {
|
||||
// Wieder einbauen - einfache Bestätigung
|
||||
KundenKarte.showConfirm('Wieder einbauen', 'Element wieder als eingebaut markieren?', function() {
|
||||
$.post(KundenKarte.ajaxUrl + '/anlage.php', {
|
||||
action: 'toggle_decommissioned',
|
||||
anlage_id: anlageId,
|
||||
token: KundenKarte.token
|
||||
}, function(res) {
|
||||
if (res.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert(res.error || 'Fehler');
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
} else {
|
||||
// Ausbauen - Dialog mit Datumsfeld
|
||||
KundenKarte.showDecommissionDialog(anlageId);
|
||||
}
|
||||
});
|
||||
|
||||
// In compact mode, click on item to expand/show details
|
||||
$(document).on('click', '.kundenkarte-tree.compact-mode .kundenkarte-tree-item', function(e) {
|
||||
// Don't trigger on action buttons or toggle
|
||||
|
|
|
|||
|
|
@ -338,6 +338,11 @@
|
|||
n.data.display_label = lines.join('\n');
|
||||
}
|
||||
|
||||
// Ausgebaut-Markierung
|
||||
if (n.data.decommissioned) {
|
||||
n.classes = (n.classes || '') + ' decommissioned';
|
||||
}
|
||||
|
||||
cyElements.push(n);
|
||||
});
|
||||
}
|
||||
|
|
@ -539,6 +544,14 @@
|
|||
'opacity': 0.6
|
||||
}
|
||||
},
|
||||
// Ausgebaute Elemente - ausgegraut
|
||||
{
|
||||
selector: '.decommissioned',
|
||||
style: {
|
||||
'opacity': 0.35,
|
||||
'border-style': 'dashed'
|
||||
}
|
||||
},
|
||||
// Hover
|
||||
{
|
||||
selector: 'node:active',
|
||||
|
|
@ -606,6 +619,35 @@
|
|||
case 'add-child':
|
||||
window.location.href = baseUrl + '&action=create&parent_id=' + anlageId;
|
||||
break;
|
||||
case 'toggle-decommissioned':
|
||||
var nodeEl = self.cy.$('#n_' + anlageId);
|
||||
var isDecomm = nodeEl.length && nodeEl.data('decommissioned');
|
||||
if (isDecomm) {
|
||||
// Wieder einbauen - Bestätigung
|
||||
window.KundenKarte.showConfirm('Wieder einbauen', 'Element wieder als eingebaut markieren?', function() {
|
||||
$.post(window.KundenKarte.ajaxUrl + '/anlage.php', {
|
||||
action: 'toggle_decommissioned',
|
||||
anlage_id: anlageId,
|
||||
token: window.KundenKarte.token
|
||||
}, function(res) {
|
||||
if (res.success) {
|
||||
nodeEl.data('decommissioned', 0);
|
||||
nodeEl.removeClass('decommissioned');
|
||||
} else {
|
||||
alert(res.error || 'Fehler');
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
} else {
|
||||
// Ausbauen - Dialog mit Datum
|
||||
window.KundenKarte.showDecommissionDialog(anlageId, function(res) {
|
||||
if (nodeEl.length) {
|
||||
nodeEl.data('decommissioned', 1);
|
||||
nodeEl.addClass('decommissioned');
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
self.hideContextMenu();
|
||||
});
|
||||
|
|
@ -620,6 +662,15 @@
|
|||
if (!this.contextMenuEl) return;
|
||||
this.contextMenuNodeId = node.data('id').replace('n_', '');
|
||||
|
||||
// Ausgebaut-Label im Kontextmenü anpassen
|
||||
var isDecomm = node.data('decommissioned');
|
||||
var $decommLabel = $(this.contextMenuEl).find('.ctx-decommission-label');
|
||||
var $decommIcon = $(this.contextMenuEl).find('.ctx-decommission i');
|
||||
if ($decommLabel.length) {
|
||||
$decommLabel.text(isDecomm ? 'Wieder einbauen' : 'Ausbauen');
|
||||
$decommIcon.attr('class', isDecomm ? 'fa fa-plug' : 'fa fa-power-off');
|
||||
}
|
||||
|
||||
var container = document.getElementById(this.containerId);
|
||||
var rect = container.getBoundingClientRect();
|
||||
var x = rect.left + renderedPos.x;
|
||||
|
|
|
|||
|
|
@ -555,3 +555,9 @@ ViewModes = Verfuegbare Ansichten
|
|||
ViewModesBoth = Baum & Graph
|
||||
ViewModesTreeOnly = Nur Baum
|
||||
ViewModesGraphOnly = Nur Graph
|
||||
|
||||
# Ausgebaut-Status
|
||||
Decommissioned = Ausgebaut
|
||||
Decommission = Ausbauen
|
||||
Recommission = Wieder einbauen
|
||||
ShowDecommissioned = Ausgebaute Elemente anzeigen
|
||||
|
|
|
|||
|
|
@ -303,3 +303,9 @@ ViewModes = Available Views
|
|||
ViewModesBoth = Tree & Graph
|
||||
ViewModesTreeOnly = Tree Only
|
||||
ViewModesGraphOnly = Graph Only
|
||||
|
||||
# Decommissioned status
|
||||
Decommissioned = Decommissioned
|
||||
Decommission = Decommission
|
||||
Recommission = Recommission
|
||||
ShowDecommissioned = Show decommissioned elements
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ function kundenkarte_graph_print_container($params)
|
|||
print '<a class="ctx-item ctx-add-child" data-action="add-child"><i class="fa fa-plus"></i> '.$langs->trans('AddChild').'</a>';
|
||||
print '<a class="ctx-item ctx-edit" data-action="edit"><i class="fa fa-edit"></i> '.$langs->trans('Edit').'</a>';
|
||||
print '<a class="ctx-item ctx-copy" data-action="copy"><i class="fa fa-copy"></i> '.$langs->trans('Copy').'</a>';
|
||||
print '<a class="ctx-item ctx-decommission" data-action="toggle-decommissioned"><i class="fa fa-power-off"></i> <span class="ctx-decommission-label">'.$langs->trans('Decommission').'</span></a>';
|
||||
}
|
||||
if ($permissiontodelete) {
|
||||
print '<a class="ctx-item ctx-delete" data-action="delete"><i class="fa fa-trash"></i> '.$langs->trans('Delete').'</a>';
|
||||
|
|
|
|||
|
|
@ -507,6 +507,9 @@ if ($isTreeView) {
|
|||
print '<button type="button" class="button small" id="btn-collapse-all" title="'.$langs->trans('CollapseAll').'">';
|
||||
print '<i class="fa fa-compress"></i> '.$langs->trans('CollapseAll');
|
||||
print '</button>';
|
||||
print '<button type="button" class="button small" id="btn-toggle-decommissioned" title="'.$langs->trans('ShowDecommissioned').'">';
|
||||
print '<i class="fa fa-eye-slash"></i> <span>'.$langs->trans('Decommissioned').'</span>';
|
||||
print '</button>';
|
||||
if ($systemId > 0) {
|
||||
$exportUrl = dol_buildpath('/kundenkarte/ajax/export_tree_pdf.php', 1).'?socid='.$id.'&system='.$systemId;
|
||||
print '<a class="button small" href="'.$exportUrl.'" title="'.$langs->trans('ExportPDF').'" target="_blank">';
|
||||
|
|
@ -1227,6 +1230,9 @@ function printTree($nodes, $socid, $systemId, $canEdit, $canDelete, $langs, $lev
|
|||
if (!$hasConnection && $level > 0) {
|
||||
$nodeClass .= ' no-cable'; // durchgeschleift - kein eigenes Kabel
|
||||
}
|
||||
if (!empty($node->decommissioned)) {
|
||||
$nodeClass .= ' decommissioned';
|
||||
}
|
||||
if ($node->type_can_have_equipment) {
|
||||
$nodeClass .= ' node-equipment'; // Geräte-Container (Schaltschrank, Verteiler)
|
||||
} elseif ($node->type_can_have_children) {
|
||||
|
|
@ -1262,6 +1268,14 @@ function printTree($nodes, $socid, $systemId, $canEdit, $canDelete, $langs, $lev
|
|||
}
|
||||
print '</span>';
|
||||
|
||||
// Ausgebaut-Badge mit Datum
|
||||
if (!empty($node->decommissioned)) {
|
||||
$decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : '';
|
||||
$decommText = $langs->trans('Decommissioned');
|
||||
if ($decommDate) $decommText .= ' '.$decommDate;
|
||||
print ' <span class="badge-decommissioned"><i class="fa fa-power-off"></i> '.$decommText.'</span>';
|
||||
}
|
||||
|
||||
// Spacer to push badges to the right
|
||||
print '<span class="kundenkarte-tree-spacer"></span>';
|
||||
|
||||
|
|
@ -1304,6 +1318,9 @@ function printTree($nodes, $socid, $systemId, $canEdit, $canDelete, $langs, $lev
|
|||
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$socid.'&system='.$systemId.'&action=edit&anlage_id='.$node->id.'" title="'.$langs->trans('Edit').'"><i class="fa fa-edit"></i></a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$socid.'&system='.$systemId.'&action=copy&anlage_id='.$node->id.'" title="'.$langs->trans('Copy').'"><i class="fa fa-copy"></i></a>';
|
||||
$decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission');
|
||||
$decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off';
|
||||
print '<a href="#" class="btn-toggle-decommissioned" data-anlage-id="'.$node->id.'" title="'.$decommLabel.'"><i class="fa '.$decommIcon.'"></i></a>';
|
||||
}
|
||||
if ($canDelete) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$socid.'&system='.$systemId.'&action=delete&anlage_id='.$node->id.'" title="'.$langs->trans('Delete').'" class="deletelink"><i class="fa fa-trash"></i></a>';
|
||||
|
|
@ -1473,6 +1490,9 @@ function printTreeWithCableLines($nodes, $socid, $systemId, $canEdit, $canDelete
|
|||
if (!$hasConnection && $level > 0) {
|
||||
$nodeClass .= ' no-cable';
|
||||
}
|
||||
if (!empty($node->decommissioned)) {
|
||||
$nodeClass .= ' decommissioned';
|
||||
}
|
||||
|
||||
print '<div class="'.$nodeClass.'">';
|
||||
|
||||
|
|
@ -1529,6 +1549,14 @@ function printTreeWithCableLines($nodes, $socid, $systemId, $canEdit, $canDelete
|
|||
}
|
||||
print '</span>';
|
||||
|
||||
// Ausgebaut-Badge mit Datum
|
||||
if (!empty($node->decommissioned)) {
|
||||
$decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : '';
|
||||
$decommText = $langs->trans('Decommissioned');
|
||||
if ($decommDate) $decommText .= ' '.$decommDate;
|
||||
print ' <span class="badge-decommissioned"><i class="fa fa-power-off"></i> '.$decommText.'</span>';
|
||||
}
|
||||
|
||||
// Spacer to push badges to the right
|
||||
print '<span class="kundenkarte-tree-spacer"></span>';
|
||||
|
||||
|
|
@ -1568,6 +1596,9 @@ function printTreeWithCableLines($nodes, $socid, $systemId, $canEdit, $canDelete
|
|||
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$socid.'&system='.$systemId.'&action=edit&anlage_id='.$node->id.'" title="'.$langs->trans('Edit').'"><i class="fa fa-edit"></i></a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$socid.'&system='.$systemId.'&action=copy&anlage_id='.$node->id.'" title="'.$langs->trans('Copy').'"><i class="fa fa-copy"></i></a>';
|
||||
$decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission');
|
||||
$decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off';
|
||||
print '<a href="#" class="btn-toggle-decommissioned" data-anlage-id="'.$node->id.'" title="'.$decommLabel.'"><i class="fa '.$decommIcon.'"></i></a>';
|
||||
}
|
||||
if ($canDelete) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$socid.'&system='.$systemId.'&action=delete&anlage_id='.$node->id.'" title="'.$langs->trans('Delete').'" class="deletelink"><i class="fa fa-trash"></i></a>';
|
||||
|
|
|
|||
|
|
@ -505,6 +505,9 @@ if ($isTreeView) {
|
|||
print '<button type="button" class="button small" id="btn-collapse-all" title="'.$langs->trans('CollapseAll').'">';
|
||||
print '<i class="fa fa-compress"></i> '.$langs->trans('CollapseAll');
|
||||
print '</button>';
|
||||
print '<button type="button" class="button small" id="btn-toggle-decommissioned" title="'.$langs->trans('ShowDecommissioned').'">';
|
||||
print '<i class="fa fa-eye-slash"></i> <span>'.$langs->trans('Decommissioned').'</span>';
|
||||
print '</button>';
|
||||
if ($systemId > 0) {
|
||||
$exportUrl = dol_buildpath('/kundenkarte/ajax/export_tree_pdf.php', 1).'?socid='.$object->socid.'&contactid='.$id.'&system='.$systemId;
|
||||
print '<a class="button small" href="'.$exportUrl.'" title="'.$langs->trans('ExportPDF').'" target="_blank">';
|
||||
|
|
@ -1225,6 +1228,9 @@ function printTree($nodes, $contactid, $systemId, $canEdit, $canDelete, $langs,
|
|||
if (!$hasConnection && $level > 0) {
|
||||
$nodeClass .= ' no-cable'; // durchgeschleift - kein eigenes Kabel
|
||||
}
|
||||
if (!empty($node->decommissioned)) {
|
||||
$nodeClass .= ' decommissioned';
|
||||
}
|
||||
if ($node->type_can_have_equipment) {
|
||||
$nodeClass .= ' node-equipment'; // Geräte-Container (Schaltschrank, Verteiler)
|
||||
} elseif ($node->type_can_have_children) {
|
||||
|
|
@ -1260,6 +1266,14 @@ function printTree($nodes, $contactid, $systemId, $canEdit, $canDelete, $langs,
|
|||
}
|
||||
print '</span>';
|
||||
|
||||
// Ausgebaut-Badge mit Datum
|
||||
if (!empty($node->decommissioned)) {
|
||||
$decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : '';
|
||||
$decommText = $langs->trans('Decommissioned');
|
||||
if ($decommDate) $decommText .= ' '.$decommDate;
|
||||
print ' <span class="badge-decommissioned"><i class="fa fa-power-off"></i> '.$decommText.'</span>';
|
||||
}
|
||||
|
||||
// Spacer to push badges to the right
|
||||
print '<span class="kundenkarte-tree-spacer"></span>';
|
||||
|
||||
|
|
@ -1302,6 +1316,9 @@ function printTree($nodes, $contactid, $systemId, $canEdit, $canDelete, $langs,
|
|||
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$contactid.'&system='.$systemId.'&action=edit&anlage_id='.$node->id.'" title="'.$langs->trans('Edit').'"><i class="fa fa-edit"></i></a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$contactid.'&system='.$systemId.'&action=copy&anlage_id='.$node->id.'" title="'.$langs->trans('Copy').'"><i class="fa fa-copy"></i></a>';
|
||||
$decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission');
|
||||
$decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off';
|
||||
print '<a href="#" class="btn-toggle-decommissioned" data-anlage-id="'.$node->id.'" title="'.$decommLabel.'"><i class="fa '.$decommIcon.'"></i></a>';
|
||||
}
|
||||
if ($canDelete) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$contactid.'&system='.$systemId.'&action=delete&anlage_id='.$node->id.'" title="'.$langs->trans('Delete').'" class="deletelink"><i class="fa fa-trash"></i></a>';
|
||||
|
|
@ -1503,6 +1520,9 @@ function printTreeWithCableLines($nodes, $contactid, $systemId, $canEdit, $canDe
|
|||
if (!$hasConnection && $level > 0) {
|
||||
$nodeClass .= ' no-cable';
|
||||
}
|
||||
if (!empty($node->decommissioned)) {
|
||||
$nodeClass .= ' decommissioned';
|
||||
}
|
||||
|
||||
print '<div class="'.$nodeClass.'">';
|
||||
|
||||
|
|
@ -1559,6 +1579,14 @@ function printTreeWithCableLines($nodes, $contactid, $systemId, $canEdit, $canDe
|
|||
}
|
||||
print '</span>';
|
||||
|
||||
// Ausgebaut-Badge mit Datum
|
||||
if (!empty($node->decommissioned)) {
|
||||
$decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : '';
|
||||
$decommText = $langs->trans('Decommissioned');
|
||||
if ($decommDate) $decommText .= ' '.$decommDate;
|
||||
print ' <span class="badge-decommissioned"><i class="fa fa-power-off"></i> '.$decommText.'</span>';
|
||||
}
|
||||
|
||||
// Spacer to push badges to the right
|
||||
print '<span class="kundenkarte-tree-spacer"></span>';
|
||||
|
||||
|
|
@ -1598,6 +1626,9 @@ function printTreeWithCableLines($nodes, $contactid, $systemId, $canEdit, $canDe
|
|||
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$contactid.'&system='.$systemId.'&action=edit&anlage_id='.$node->id.'" title="'.$langs->trans('Edit').'"><i class="fa fa-edit"></i></a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$contactid.'&system='.$systemId.'&action=copy&anlage_id='.$node->id.'" title="'.$langs->trans('Copy').'"><i class="fa fa-copy"></i></a>';
|
||||
$decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission');
|
||||
$decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off';
|
||||
print '<a href="#" class="btn-toggle-decommissioned" data-anlage-id="'.$node->id.'" title="'.$decommLabel.'"><i class="fa '.$decommIcon.'"></i></a>';
|
||||
}
|
||||
if ($canDelete) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$contactid.'&system='.$systemId.'&action=delete&anlage_id='.$node->id.'" title="'.$langs->trans('Delete').'" class="deletelink"><i class="fa fa-trash"></i></a>';
|
||||
|
|
|
|||
Loading…
Reference in a new issue