Add close button to print QR page; fix QR generation to use file_put_contents

This commit is contained in:
Edwin Noorlander 2025-11-11 18:04:57 +01:00
parent 4ed2f075a6
commit ec8beab484
2 changed files with 10 additions and 2 deletions

View File

@ -175,7 +175,8 @@ class ItemController
'eccLevel' => QRCode::ECC_L, 'eccLevel' => QRCode::ECC_L,
]); ]);
$qrCode = new QRCode($options); $qrCode = new QRCode($options);
$qrCode->render($idCode, $qrDir . $idCode . '.svg'); $svg = $qrCode->render($idCode);
file_put_contents($qrDir . $idCode . '.svg', $svg);
} }
public static function printQR($id) { public static function printQR($id) {

View File

@ -26,7 +26,14 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
<script>window.print();</script> <div style="text-align: center; margin-top: 20px;">
<button onclick="window.close()">Sluit</button>
</div>
<script>
window.print();
// Optionally, close after print, but browser support varies
// window.onafterprint = function() { window.close(); };
</script>
</body> </body>
</html> </html>
{% endautoescape %} {% endautoescape %}