fixing some display

This commit is contained in:
root
2024-12-22 09:48:20 +00:00
parent 849a13f02c
commit f05d3cfe52
2 changed files with 58 additions and 3 deletions

View File

@@ -98,9 +98,11 @@ while (mysqli_stmt_fetch($stmt)) {
$printer["print_time_total"] = seconds_to_time(intval($json["job"]["estimatedPrintTime"])); $printer["print_time_total"] = seconds_to_time(intval($json["job"]["estimatedPrintTime"]));
$printer["print_time_left"] = seconds_to_time(intval($json["progress"]["printTimeLeft"])); $printer["print_time_left"] = seconds_to_time(intval($json["progress"]["printTimeLeft"]));
$printer["print_time"] = seconds_to_time(intval($json["progress"]["printTime"])); $printer["print_time"] = seconds_to_time(intval($json["progress"]["printTime"]));
$printer["view"]=0; $printer["view"]=5;
//insert into db that this one is printing //insert into db that this one is printing
$sql="UPDATE printer SET system_status=99 WHERE id = $printer_id"; $sql="UPDATE printer SET system_status=99 WHERE id = $printer_id";
$stmt = mysqli_prepare($link, $sql);
mysqli_stmt_execute($stmt);
}else{ }else{
$printer["print_status"]="Bereit"; $printer["print_status"]="Bereit";
$printer["view"]=3; $printer["view"]=3;

View File

@@ -252,7 +252,9 @@ function updatePrinterData(data) {
printerStatus = 'Bereit'; printerStatus = 'Bereit';
}else if(printer.view==4){ }else if(printer.view==4){
printerStatus = 'Problem / Nicht betriebsbereit'; printerStatus = 'Problem / Nicht betriebsbereit';
} }else if(printer.view==4){
printerStatus = 'Von anderer Quelle aus gestartet';
}
if(printer.view==0 || printer.view==2){ if(printer.view==0 || printer.view==2){
if(own_id==printer.userid || cancel_all=="1"){ if(own_id==printer.userid || cancel_all=="1"){
@@ -382,6 +384,55 @@ function updatePrinterData(data) {
</table> </table>
</div> </div>
`; `;
}else if(printer.view==5){
if(cancel_all=="1"){
printerCard.innerHTML = `
<div class="card-body">
<h5 class="card-title">Drucker ${printer.printer_id}</h5>
</div>
<div class="card-body">
<iframe height="230px" scrolling="no" width="100%" src="/app/webcam.php?printer_id=${printer.printer_id}&username=<?php echo($username); ?>&url=${printer.url}"></iframe>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: ${printer.progress}%" aria-valuenow="${printer.progress}" aria-valuemin="0" aria-valuemax="100">${printer.progress}%</div>
</div>
<table class="table table-borderless">
<thead>
<tr><td>Status</td><td style="color: ${getColorByStatus(printer.view)}">${printerStatus}</td></tr>
<tr><td>Genutzt von</td><td>Externer Nutzer</td></tr>
<tr><td>Filamentfarbe</td><td>${printer.filament_color}</td></tr>
<tr><td>Erwartete Druckzeit</td><td>${printer.print_time_total}</td></tr>
<tr><td>Verbleibende Druckzeit</td><td>${printer.print_time_left}</td></tr>
<tr><td>Vergangene Druckzeit</td><td>${printer.print_time}</td></tr>
<tr><td>Datei</td><td><div class='hover-element'>${printer.file}<div class='description'>${printer.full_file}</div></div></td></tr>
</thead>
<tr><td><a class='btn btn-success' href='overview.php?free=${printer.printer_id}&rid=<?php echo($_SESSION["rid"]); ?>'>Freigeben</a></td></tr>
</table>
</div>
`;
}else{
printerCard.innerHTML = `
<div class="card-body">
<h5 class="card-title">Drucker ${printer.printer_id}</h5>
</div>
<div class="card-body">
<iframe height="230px" scrolling="no" width="100%" src="/app/webcam.php?printer_id=${printer.printer_id}&username=<?php echo($username); ?>&url=${printer.url}"></iframe>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: ${printer.progress}%" aria-valuenow="${printer.progress}" aria-valuemin="0" aria-valuemax="100">${printer.progress}%</div>
</div>
<table class="table table-borderless">
<thead>
<tr><td>Status</td><td style="color: ${getColorByStatus(printer.view)}">${printerStatus}</td></tr>
<tr><td>Genutzt von</td><td>Externer Nutzer</td></tr>
<tr><td>Filamentfarbe</td><td>${printer.filament_color}</td></tr>
<tr><td>Erwartete Druckzeit</td><td>${printer.print_time_total}</td></tr>
<tr><td>Verbleibende Druckzeit</td><td>${printer.print_time_left}</td></tr>
<tr><td>Vergangene Druckzeit</td><td>${printer.print_time}</td></tr>
<tr><td>Datei</td><td><div class='hover-element'>${printer.file}<div class='description'>${printer.full_file}</div></div></td></tr>
</thead>
</table>
</div>
`;
}
} }
col.appendChild(printerCard); col.appendChild(printerCard);
@@ -403,7 +454,9 @@ function getColorByStatus(status) {
case 3: case 3:
return 'green'; return 'green';
case 4: case 4:
return 'red'; return 'red';
case 5:
return 'orange';
} }
} }