<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>View Inventory</title>
    {% include 'favicon.html' %}
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
</head>
<body align="center">
    {% include 'header.html' %}
    <main class="container mt-5 pt-3">
        <h2 class="mb-4">Item Inventory</h2>
        <table class="">
            <tr>
                <!-- Table headers -->
                {% for attrib in item_attributes %}
                    <th>{{ attrib.display_name }}</th>
                {% endfor %}
                <th colspan="2">Actions</th>
            </tr>
    
            <!-- Table rows -->
            {% for item in items %}
            <tr>
                {% for attrib in item_attributes %}
                    <td>{{ item[attrib.attrib_name] }}</td>
                {% endfor %}
                <td>
                    <form action="/update/{{ item[primary_attrib] }}" method="get">
                        <button type="submit">Edit</button>
                    </form>
                </td>
                <td>
                    <form action="/delete/{{ item[primary_attrib] }}" method="get">
                        <button type="submit">Delete</button>
                    </form>
                </td>
            </tr>
            {% endfor %}
        </table>
    </main>
    <!-- Bootstrap JS (for dropdowns) -->
    <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
</body>
</html>