{% extends "core/dashboard_base.html" %}

{% block title %}Seller Dashboard | Ethio-gebeya{% endblock %}

{% block dashboard_content %}
<section class="grid cards-3">
  <article class="card">
    <p class="label">Products</p>
    <p class="value">{{ product_count }}</p>
  </article>
  <article class="card">
    <p class="label">Orders</p>
    <p class="value">{{ total_orders }}</p>
  </article>
  <article class="card">
    <p class="label">Revenue</p>
    <p class="value">${{ total_revenue }}</p>
  </article>
</section>

<section class="card" style="margin-top: 1rem;">
  <h2 style="margin: 0 0 0.75rem;">Recent Sales</h2>
  {% if recent_sales %}
  <table>
    <thead>
      <tr>
        <th>Buyer</th>
        <th>Product</th>
        <th>Qty</th>
        <th>Total</th>
      </tr>
    </thead>
    <tbody>
      {% for sale in recent_sales %}
      <tr>
        <td>{{ sale.order.buyer.username }}</td>
        <td>{{ sale.product.name }}</td>
        <td>{{ sale.quantity }}</td>
        <td>${{ sale.price }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
  {% else %}
  <p>No sales yet.</p>
  {% endif %}
</section>
{% endblock %}
