{% extends "base_generic.html" %}
{% load tags %}
{% block script %}
<script>
    $(document).ready(function(){
$('form').submit(function () {


    if () {
        alert('CID doubled');
        return false;
    }
});

});
</script>
{% endblock %}

{% block content %}

<div class="container-fluid">

<h3 style="margin-top: 10px"> {{user.username}}'s products </h3>

{% if product_list %}
 <table class="table table-sm table-hover">
    <caption>* FP = Future trends & Prototypes; AA = Animated Architecture; MA = Money Architecture; SMA = Spatial Media Art; PAUI = Participatory Architecture & Urban Interaction</caption>

     <thead class="">
    <tr>
        <th scope="col"></th>
        <th scope="col"> Product</th>
        <th scope="col"> Category</th>
        <th scope="col"> Editable</th>
        <th scope="col"> Delete</th>

    </tr>
    {% for product in product_list %}
    <tr class="{% get_sucsess product %}"   >
        <td  scope="col"><img src="{{product.media_set.first.image_small.url}}"  width="50" height="50" alt="{{ product.pk }}"> </td>
        <td  scope="col"> <a href="{% url 'product-detail' product.pk %}">   {{product.name|upper }} </a></td>
          <td scope="col">
        {% for category in product.category.all %}
        {{category.short_name}}{% if not forloop.last %} | {% endif %}
             {% endfor %}
        </td>
        <td scope="col"> {% if product.edit %} <a href="{% url 'edit-product' product.pk %}"> edit product </a> ; <a href="{% url 'add-Image' product.pk %}"> edit Media </a> {% else %} already sumbitted {% endif %} </td>
        <td scope="col"> <a href="{% url 'product-delete' pk=product.pk %}" target="" rel="">Delete</a>   </td>

    </tr>
    {% endfor %}




 </table>
    <a href="{% url 'new-submit-view' %}"><button class="btn border-dark rounded-0 mybtn" type="submit">Add product </button> </a>
 {% else %}
<div class="container-fluid">

    <h6>Seems like you haven't uploaded anything yet :(<br> Start Sumbitting now :  <a href="{% url 'new-submit-view' %}"><button class="btn border-dark rounded-0 mybtn" type="submit">Add products </button> </a></h6>
</div>

{% endif %}

{% endblock %}
