feat: complete package 2 delete flows and package 3 port management
This commit is contained in:
@@ -180,7 +180,14 @@ if ($editorFloor) {
|
||||
<td><?php echo (int)$panel['port_count']; ?></td>
|
||||
<td class="actions">
|
||||
<a href="?module=floor_infrastructure&action=edit&type=patchpanel&id=<?php echo (int)$panel['id']; ?>" class="button button-small">Bearbeiten</a>
|
||||
<a href="?module=floor_infrastructure&action=delete&type=patchpanel&id=<?php echo (int)$panel['id']; ?>" class="button button-small button-danger" onclick="return confirm('Patchpanel wirklich loeschen?');">Loeschen</a>
|
||||
<button
|
||||
type="button"
|
||||
class="button button-small button-danger js-floor-infra-delete"
|
||||
data-delete-id="<?php echo (int)$panel['id']; ?>"
|
||||
data-delete-type="patchpanel"
|
||||
data-delete-label="<?php echo htmlspecialchars((string)$panel['name'], ENT_QUOTES, 'UTF-8'); ?>">
|
||||
Loeschen
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@@ -226,7 +233,14 @@ if ($editorFloor) {
|
||||
<td><?php echo htmlspecialchars((string)($outlet['comment'] ?? '')); ?></td>
|
||||
<td class="actions">
|
||||
<a href="?module=floor_infrastructure&action=edit&type=outlet&id=<?php echo (int)$outlet['id']; ?>" class="button button-small">Bearbeiten</a>
|
||||
<a href="?module=floor_infrastructure&action=delete&type=outlet&id=<?php echo (int)$outlet['id']; ?>" class="button button-small button-danger" onclick="return confirm('Wandbuchse wirklich loeschen?');">Loeschen</a>
|
||||
<button
|
||||
type="button"
|
||||
class="button button-small button-danger js-floor-infra-delete"
|
||||
data-delete-id="<?php echo (int)$outlet['id']; ?>"
|
||||
data-delete-type="outlet"
|
||||
data-delete-label="<?php echo htmlspecialchars((string)$outlet['name'], ENT_QUOTES, 'UTF-8'); ?>">
|
||||
Loeschen
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@@ -237,3 +251,38 @@ if ($editorFloor) {
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.js-floor-infra-delete').forEach((button) => {
|
||||
button.addEventListener('click', () => {
|
||||
const id = Number(button.dataset.deleteId || '0');
|
||||
const type = (button.dataset.deleteType || '').trim();
|
||||
const label = button.dataset.deleteLabel || 'Objekt';
|
||||
if (id <= 0 || (type !== 'patchpanel' && type !== 'outlet')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const entityLabel = type === 'patchpanel' ? 'Patchpanel' : 'Wandbuchse';
|
||||
if (!confirm(entityLabel + ' "' + label + '" wirklich loeschen?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch('?module=floor_infrastructure&action=delete', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
|
||||
body: 'id=' + encodeURIComponent(id) + '&type=' + encodeURIComponent(type)
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data && data.success) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
alert((data && data.message) ? data.message : 'Loeschen fehlgeschlagen');
|
||||
})
|
||||
.catch(() => alert('Loeschen fehlgeschlagen'));
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user