{% extends "dashboard.html" %}
{% load static %}

{% block content %}
<article>
    <header class="object__header">
        <h1><img src="{% static "images/cubes.png" %}" alt=""> Catalog</h1>
        <a href="{% url 'dashboard:product-create' %}" class="action-button">+ New product</a>
    </header>
    <section class="object__list">
        <div class="object__item panel__header object__item--col4">
            <span></span>
            <span>Name</span>
            <span>Visible</span>
            <span>Price</span>
        </div>
    {% for product in product_list  %}
        <a class="object__item object__item--link object__item--col4"  href="{% url 'dashboard:product-detail' product.pk %}">
            <figure class="product__figure">
                <img class="product__image" src="{{product.get_first_img.image.url}}" alt="{{product.get_first_img.image}}">
            </figure>
            <strong>{{product.name}}</strong>
            <span>{{product.visible_in_listings|yesno:"Yes,No"}}</span>
            <span>${{product.price}}</span>
        </a>
    {% endfor %}
    </section>
</article>
{% endblock content %}
