<?php

require '../config.php';
session_start();
session_write_close();

$res = $conn->query("
SELECT *
FROM assets_master
ORDER BY asset_name
");
?>

<!DOCTYPE html>
<html>
<head>
<title>Assets</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="flex bg-gray-100">

<?php include '../sidebar.php'; ?>

<div class="flex-1 p-8" id="main-content">

<h1 class="text-3xl font-bold mb-6">
Asset Register
</h1>

<a href="assign_asset.php"
class="bg-blue-600 text-white px-5 py-3 rounded-lg">

Assign Asset

</a>

<div class="bg-white rounded-xl shadow mt-6 overflow-hidden">

<table class="w-full">

<thead class="bg-gray-100">

<tr>
<th class="p-4 text-left">Asset</th>
<th class="p-4">Type</th>
<th class="p-4">Serial</th>
<th class="p-4">Status</th>
</tr>

</thead>

<tbody>

<?php while($row=$res->fetch_assoc()): ?>

<tr class="border-b">

<td class="p-4">
<?= htmlspecialchars($row['asset_name']) ?>
</td>

<td class="p-4">
<?= htmlspecialchars($row['asset_type']) ?>
</td>

<td class="p-4">
<?= htmlspecialchars($row['serial_number']) ?>
</td>

<td class="p-4">
<?= htmlspecialchars($row['asset_status']) ?>
</td>

</tr>

<?php endwhile; ?>

</tbody>

</table>

</div>

</div>
</body>
</html>