diff --git a/sys0-code/test/overview.php b/sys0-code/test/overview.php index ad687d4..11b5f78 100644 --- a/sys0-code/test/overview.php +++ b/sys0-code/test/overview.php @@ -256,68 +256,30 @@ function updatePrinterData(data) { } if(printer.view==0 || printer.view==2){ -// Assuming `printerCardContainer` is the parent element where cards are appended -const printerCardContainer = document.getElementById('printerCardsContainer'); -let printerCard = document.getElementById(`printer-${printer.printer_id}`); - -if (!printerCard) { - // Create a new card element if it doesn't exist - printerCard = document.createElement('div'); - printerCard.id = `printer-${printer.printer_id}`; - printerCard.className = 'card'; - - // Optionally, add an iframe if it's part of the initial structure - const iframe = document.createElement('iframe'); - iframe.src = ''; // Set the source if needed - printerCard.appendChild(iframe); - - // Append the new card to the container - printerCardContainer.appendChild(printerCard); -} - -// Now handle updating the card content -if (own_id == printer.userid || cancel_all == "1") { - // Locate the iframe within the card - const iframe = printerCard.querySelector('iframe'); - if (!iframe) return; // If iframe doesn't exist, exit (though it should always exist now) - - // Construct the new HTML content - const data = ` -
-
Drucker ${printer.printer_id}
-
-
-
-
-
- - - - - - - - - - - -
Status${printerStatus}
Genutzt von${printer.username}
Filamentfarbe${printer.filament_color}
Erwartete Druckzeit${printer.print_time_total}
Verbleibende Druckzeit${printer.print_time_left}
Vergangene Druckzeit${printer.print_time}
Datei
${printer.file}
${printer.full_file}
Freigeben
-
- `; - - // Insert the new content before the iframe - iframe.insertAdjacentHTML('beforebegin', data); - - // Optionally, remove old content that is not part of the new data or iframe - const children = Array.from(printerCard.childNodes); - for (let child of children) { - if (child !== iframe && child !== iframe.previousElementSibling) { - printerCard.removeChild(child); - } - } - - - + if(own_id==printer.userid || cancel_all=="1"){ + printerCard.innerHTML = ` +
+
Drucker ${printer.printer_id}
+
+
+ +
+
+
+ + + + + + + + + + + +
Status${printerStatus}
Genutzt von${printer.username}
Filamentfarbe${printer.filament_color}
Erwartete Druckzeit${printer.print_time_total}
Verbleibende Druckzeit${printer.print_time_left}
Vergangene Druckzeit${printer.print_time}
Datei
${printer.file}
${printer.full_file}
Freigeben
+
+ `; }else{ printerCard.innerHTML = `
@@ -454,7 +416,7 @@ function getColorByStatus(status) { document.addEventListener('DOMContentLoaded', () => { fetchPrinterData(); - setInterval(fetchPrinterData, 15000); // Refresh every 6 seconds + setInterval(fetchPrinterData, 60000); // Refresh every 6 seconds });