diff --git a/lang/en.json b/lang/en.json index f345a85..a321e8e 100755 --- a/lang/en.json +++ b/lang/en.json @@ -64,5 +64,8 @@ "Are you sure you want to delete this category?": "Are you sure you want to delete this category?", "Image": "Image", "Location": "Location", - "Print QR": "Print QR" + "Print QR": "Print QR", + "Close": "Close", + "QR Code": "QR Code", + "ID Code": "ID Code" } \ No newline at end of file diff --git a/lang/nl.json b/lang/nl.json index 4608c4e..1448f2f 100755 --- a/lang/nl.json +++ b/lang/nl.json @@ -64,5 +64,8 @@ "Are you sure you want to delete this category?": "Weet je zeker dat je deze categorie wilt verwijderen?", "Image": "Afbeelding", "Location": "Locatie", - "Print QR": "Print QR" + "Print QR": "Print QR", + "Close": "Sluit", + "QR Code": "QR Code", + "ID Code": "ID Code" } \ No newline at end of file diff --git a/public/index.php b/public/index.php index c35ba0f..668c535 100644 --- a/public/index.php +++ b/public/index.php @@ -48,7 +48,7 @@ $router->addRoute('GET', '/api/parts', [ItemController::class, 'renderAddForm']) // --- API CRUD Routes --- // Items $router->addRoute('POST', '/api/items', [ItemController::class, 'create']); -$router->addRoute('PUT', '/api/items/{id:\d+}', [ItemController::class, 'update']); +$router->addRoute('POST', '/api/items/{id:\d+}', [ItemController::class, 'update']); $router->addRoute('DELETE', '/api/items/{id:\d+}', [ItemController::class, 'delete']); // Categories diff --git a/public/js/app.js b/public/js/app.js index ec3d0a0..95a8fac 100755 --- a/public/js/app.js +++ b/public/js/app.js @@ -323,7 +323,7 @@ document.addEventListener('DOMContentLoaded', function() { } fetch('/api/items/' + id, { - method: 'PUT', + method: 'POST', body: formData }) .then(response => response.json()) diff --git a/src/Controllers/ItemController.php b/src/Controllers/ItemController.php index a48dc08..f4e3301 100755 --- a/src/Controllers/ItemController.php +++ b/src/Controllers/ItemController.php @@ -182,6 +182,9 @@ class ItemController ]); $qrCode = new QRCode($options); $svg = $qrCode->render($idCode); + if (strpos($svg, 'data:image/svg+xml;base64,') === 0) { + $svg = base64_decode(substr($svg, 26)); // 26 is length of 'data:image/svg+xml;base64,' + } file_put_contents($qrDir . $idCode . '.svg', $svg); } diff --git a/templates/print_qr.twig b/templates/print_qr.twig index 0fa563c..645f7cc 100644 --- a/templates/print_qr.twig +++ b/templates/print_qr.twig @@ -4,7 +4,7 @@
-