Fix image update in edit, QR code generation and translations
This commit is contained in:
parent
c1957baab9
commit
bfea1f4dfe
@ -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"
|
||||
}
|
||||
@ -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"
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -323,7 +323,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
|
||||
fetch('/api/items/' + id, {
|
||||
method: 'PUT',
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>QR Code for {{ item.name }}</title>
|
||||
<title>{{ trans('QR Code') }} for {{ item.name }}</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; text-align: center; margin: 20px; }
|
||||
.qr-container { border: 1px solid #000; padding: 20px; display: inline-block; }
|
||||
@ -16,7 +16,7 @@
|
||||
<body>
|
||||
<div class="qr-container">
|
||||
<h2>{{ item.name }}</h2>
|
||||
<p>ID Code: {{ item.id_code }}</p>
|
||||
<p>{{ trans('ID Code') }}: {{ item.id_code }}</p>
|
||||
<img src="/uploads/qr/{{ item.id_code }}.svg" alt="QR Code" class="qr-code">
|
||||
<div class="details">
|
||||
<p><strong>Description:</strong> {{ item.description }}</p>
|
||||
@ -27,7 +27,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: center; margin-top: 20px;">
|
||||
<button onclick="window.close()">Sluit</button>
|
||||
<button onclick="window.close()">{{ trans('Close') }}</button>
|
||||
</div>
|
||||
<script>
|
||||
window.print();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user