' +
'
Anschlusspunkt (Eingang)';
- // Phase selection
+ // Phase-Buttons (wie im Leitungs-Dialog)
html += '
';
- html += '
';
- html += '
';
// Bezeichnung (optional)
@@ -11638,6 +12436,14 @@
$('body').append(html);
+ // Phase-Button Klick-Handler
+ $('.input-phase-btn').on('click', function() {
+ $('.input-phase-btn').css('outline', 'none');
+ $(this).css('outline', '2px solid #fff');
+ $('.input-phase-val').val($(this).data('phase'));
+ $('.input-color-val').val($(this).data('color'));
+ });
+
$('.input-cancel-btn').on('click', function() { $('.schematic-output-dialog').remove(); });
$('.input-delete-btn').on('click', function() {
var id = $(this).data('id');
@@ -11645,12 +12451,13 @@
self.deleteConnection(id);
});
$('.input-save-btn').on('click', function() {
- var phase = $('.input-phase').val();
+ var phase = $('.input-phase-val').val();
+ var color = $('.input-color-val').val();
var label = $('.input-label').val();
if (existingInput) {
- self.updateInput(existingInput.id, phase, label);
+ self.updateInput(existingInput.id, phase, label, color);
} else {
- self.createInput(eqId, termId, phase, label);
+ self.createInput(eqId, termId, phase, label, color);
}
$('.schematic-output-dialog').remove();
});
@@ -11658,6 +12465,15 @@
$(document).one('keydown.inputDialog', function(e) {
if (e.key === 'Escape') $('.schematic-output-dialog').remove();
});
+
+ // Dialog-Position anpassen
+ setTimeout(function() {
+ var $dialog = $('.schematic-output-dialog');
+ var dw = $dialog.outerWidth(), dh = $dialog.outerHeight();
+ var ww = $(window).width(), wh = $(window).height();
+ if (x + dw > ww - 10) $dialog.css('left', (ww - dw - 10) + 'px');
+ if (y + dh > wh - 10) $dialog.css('top', (wh - dh - 10) + 'px');
+ }, 10);
},
// Show dialog for creating an OUTPUT connection (Abgang for Verbraucher, N)
@@ -11831,7 +12647,7 @@
},
// Create INPUT connection (external source -> equipment terminal)
- createInput: function(eqId, termId, phase, label) {
+ createInput: function(eqId, termId, phase, label, color) {
var self = this;
$.ajax({
url: baseUrl + '/custom/kundenkarte/ajax/equipment_connection.php',
@@ -11843,6 +12659,7 @@
fk_target: eqId,
target_terminal_id: termId,
connection_type: phase,
+ color: color || '',
output_label: label,
token: $('input[name="token"]').val()
},
@@ -11859,7 +12676,7 @@
},
// Update INPUT connection
- updateInput: function(connId, phase, label) {
+ updateInput: function(connId, phase, label, color) {
var self = this;
$.ajax({
url: baseUrl + '/custom/kundenkarte/ajax/equipment_connection.php',
@@ -11868,6 +12685,7 @@
action: 'update',
connection_id: connId,
connection_type: phase,
+ color: color || '',
output_label: label,
token: $('input[name="token"]').val()
},
@@ -12173,15 +12991,27 @@
dialogHtml += '
Verbindung bearbeiten
';
- // Connection type
+ // Phase/Typ als farbige Buttons
+ var currentType = conn.connection_type || '';
+ var currentColor = conn.color || self.PHASE_COLORS[currentType] || '#3498db';
dialogHtml += '
';
- dialogHtml += '
';
- dialogHtml += '
';
+ dialogHtml += '
';
+ dialogHtml += '
';
+ dialogHtml += '
';
// Output label
dialogHtml += '