{% extends "base.html" %}

{% block content %}
<h1 class="mb-4">Dashboard</h1>
<a href="{{ url_for('add_product') }}" class="btn btn-primary mb-3">Add New Product</a>
<table class="table table-striped">
    <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Price</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        {% for product in products %}
        <tr>
            <td>{{ product.id }}</td>
            <td>{{ product.name }}</td>
            <td>${{ "%.2f"|format(product.price) }}</td>
            <td>{{ product.description }}</td>
            <td>
                <a href="{{ url_for('edit_product', id=product.id) }}" class="btn btn-sm btn-warning">Edit</a>
                <a href="{{ url_for('delete_product', id=product.id) }}" class="btn btn-sm btn-danger">Delete</a>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}