Files
mcinv/frontend/items.php

60 lines
929 B
PHP

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once "api/client.php";
$token = $_COOKIE["token"] ?? null;
if (!$token) {
header("Location: login.php");
exit;
}
$items = api_request(
"GET",
"/item",
null,
$token
);
?>
<!DOCTYPE html>
<html>
<head>
<title>Items</title>
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<div class="container">
<h1>Items</h1>
<table border="1" cellpadding="8">
<tr>
<th>ID</th>
<th>Name</th>
<th>Unit Type</th>
</tr>
<?php foreach ($items as $item): ?>
<tr>
<td><?= htmlspecialchars($item["id"]) ?></td>
<td><?= htmlspecialchars($item["name"]) ?></td>
<td><?= htmlspecialchars($item["unitType"]) ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</body>
</html>