diff --git a/Layout/default/Pop/_rack_body.php b/Layout/default/Pop/_rack_body.php index 5f35c4ed8..20ff5f38d 100644 --- a/Layout/default/Pop/_rack_body.php +++ b/Layout/default/Pop/_rack_body.php @@ -107,9 +107,9 @@ for ($i = 1; $i <= $rack_he; $i++) : ?> } if ($slots['width'] == "12") $width = "85%"; - else if ($slots['width'] == "6") $width = "42%"; - else if ($slots['width'] == "4") $width = "28%"; - else if ($slots['width'] == "3") $width = "21%"; + else if ($slots['width'] == "6") $width = "42.5%"; + else if ($slots['width'] == "4") $width = "28.33%"; + else if ($slots['width'] == "3") $width = "21.25%"; while ($position < $slots['position']) { @@ -118,8 +118,7 @@ for ($i = 1; $i <= $rack_he; $i++) : ?> $calcwidth += $slots['width']; } - echo '' . $slots['modulname'] . $extTextspan . ''; - + echo '' . $slots['modulname'] . $extTextspan . ''; $position++; $calcwidth += $slots['width']; } diff --git a/public/js/pages/pop/detail.js b/public/js/pages/pop/detail.js index 73445bbd9..e1127f35a 100644 --- a/public/js/pages/pop/detail.js +++ b/public/js/pages/pop/detail.js @@ -74,6 +74,8 @@ $(document).ready(function () { modal.find('.modal-title').html('Modul (' + destinationname + ')'); modal.find('.alert').text(''); modal.find('.alert').hide(); + $('#module-slot-div').hide(); + $('#module-position-div').hide(); var options; var selected; var hemaxcount = 1; @@ -96,23 +98,40 @@ $(document).ready(function () { if (parent.find('td').eq(1).data('id') || parent.find('td').eq(2).data('id') || parent.find('td').eq(3).data('id') || parent.find('td').eq(4).data('id')) { var counttd = parent.find('td').length - 1; var newmodule = false; - if (counttd > 1) { + + var modwidth; + var totalPositions; + if (parent.find('td').eq(1).data('width')) { + modwidth = parent.find('td').eq(1).data('width'); + totalPositions = 12 / modwidth; + } else { + modwidth = 12 / counttd; + totalPositions = counttd; + } + $('#module-width').val(modwidth); + + if (totalPositions > 1) { var options; - for (let i = 1; i <= counttd; i++) { + for (let i = 1; i <= totalPositions; i++) { options = options + ''; } $('#module-slot').html(options); $('#module-position').html(options); $('#module-slot-div').show(); } + else + { + + } + $('#module-width').attr('disabled', 'disabled'); $('#he-count-div').html(``); $('#he-start-div').html(``); + + if (parent.find('td').eq(1).data('id') === undefined) { newmodule = true; } - var modwidth = 12 / counttd; - $('#module-width').val(modwidth); if (!newmodule) { $('#module-remove').show(); @@ -133,7 +152,7 @@ $(document).ready(function () { } $('#module-name').val(parent.find('td').eq(1).data('name')); const status = parent.find('td').eq(1).data('status'); - $('#module-type').val(parent.find('td').eq(1).data('type')).change(); // .change() ist hier wichtig! + $('#module-type').val(parent.find('td').eq(1).data('type')).change(); $('#module-status').val(status); $('#module-type option[value="1"]').prop('disabled', true);