New version
This commit is contained in:
7
public/page/404.php
Normal file
7
public/page/404.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
http_response_code(404);
|
||||
?>
|
||||
<section class="mm-shell">
|
||||
<h1 class="mm-title">Seite nicht gefunden</h1>
|
||||
<p class="mm-subtitle">Die angeforderte Seite existiert nicht.</p>
|
||||
</section>
|
||||
19
public/page/api/materials.php
Normal file
19
public/page/api/materials.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$app = app();
|
||||
$pdo = $app->pdo();
|
||||
|
||||
if (!$pdo) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'DB disabled or unavailable'], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
$repo = new \App\Repository\MaterialMatrixRepository($pdo);
|
||||
$materials = $repo->listActiveMaterials();
|
||||
|
||||
echo json_encode($materials, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
37
public/page/api/printer-materials.php
Normal file
37
public/page/api/printer-materials.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$printerId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
if ($printerId <= 0) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'printer id missing'], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
$app = app();
|
||||
$pdo = $app->pdo();
|
||||
|
||||
if (!$pdo) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'DB disabled or unavailable'], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
$repo = new \App\Repository\MaterialMatrixRepository($pdo);
|
||||
$printer = $repo->getPrinterById($printerId);
|
||||
|
||||
if (!$printer) {
|
||||
http_response_code(404);
|
||||
echo json_encode(['error' => 'printer not found'], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
$materials = $repo->listMaterialsForPrinter($printerId);
|
||||
|
||||
echo json_encode([
|
||||
'printer' => $printer,
|
||||
'materials' => $materials,
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
19
public/page/api/printers.php
Normal file
19
public/page/api/printers.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$app = app();
|
||||
$pdo = $app->pdo();
|
||||
|
||||
if (!$pdo) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'DB disabled or unavailable'], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
$repo = new \App\Repository\MaterialMatrixRepository($pdo);
|
||||
$printers = $repo->listActivePrinters();
|
||||
|
||||
echo json_encode($printers, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
$activePage = 'dashboard';
|
||||
require __DIR__ . '/../../partials/structure/layout_start.php';
|
||||
require __DIR__ . '/../../partials/landing/main/material-matrix.php';
|
||||
require __DIR__ . '/../../partials/structure/layout_end.php';
|
||||
2
public/page/index.php
Normal file
2
public/page/index.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
tpl('material-matrix', 'landing', 'main');
|
||||
Reference in New Issue
Block a user