{% extends "base/main_base.html" %}

{% set active_page ='products' %}

{% block pagehead %}
<title>SpareParts</title>
{% endblock %}

{% block content %}

  {% include 'prods/nav.html' %}

  <br>

  <h2>products for 
      <span class="badge badge-primary">{{SECTION_NAME}}</span>
      <span class="badge badge-secondary">{{category}}</span>
  </h2>
  <br>
    <table class="table">
            <thead>
              <tr>
                <th>barcode</th>
                <th>name</th>
                <th>description</th>
                <th>category</th>
                <th>date</th>
                <th>price</th>
                <th>selling price</th>
                <th>discontinued</th>
                <th>in stock</th>
                <th></th>
              </tr>
            </thead>
            <tbody>
              {%for p in products%}
              <tr>
                <td>{{p.barcode}}</td>
                <td>{{p.name}}</td>
                <td>{{p.description}}</td>
                <td>{{p.category_name}}</td>
                <td>{{p.date}}</td>
                <td>{{p.price}}</td>
                <td>{{p.selling_price}}</td>
                <td>{{p.discontinued}}</td>
                <td>{{p.in_stock}}</td>
                
                <td style="">
                  <a 
                      href="/prods/edit/{{category}}/{{p.barcode}}" class="btn btn-warning" role="button">
                    <i class="fas fa-pencil-alt"></i>
                  </a>
                  <a href="/prods/delete/{{category}}/{{p.barcode}}" class="btn btn-danger" role="button">
                    <i class="fas fa-trash-alt"></i>
                  </a>
                </td>
              </tr>
              {%endfor%}
            </tbody>
          </table>

{% endblock %}