{% extends "base_generic.html" %}
{% load tags %}
{% block script %}
<script>

</script>
{% endblock %}

{% block content %}

<div class="container-fluid">





{% if object_list %}

<div class="container">

  <div class="row">
      <div class="col-sm-6">

        <h3 style="margin-top: 10px"> {{user.username}}'s Projekte </h3>
        <br><br>
        <button class="btn  mybtn border-thin" onclick="window.location.href='{% url 'neues-projekt-dispatch' %}'" type="submit">Projekt hinzufügen</button>
        <br><br>
      </div>
  </div>
  <div class="dropdown-divider" style="margin-bottom: 10px;" ></div>
    <div class="row">
        <div class="col-sm-1">Bild</div>
        <div class="col-sm-4">Projekt</div>
        <div class="col-sm-3">Bearbeiten</div>
        <div class="col-sm-2">Löschen</div>
        <div class="col-sm-2"> Freischaltung beantragen</div>
    </div>

    <div class="dropdown-divider" style="margin-bottom: 10px;" ></div>


    {% for product in object_list %}
    <div class="row proj-{{ product.pk }}" id="proj-id-{{ product.pk }}">
        <!-- image -->
        <div class="col-sm-1"><img src="{{product.media_set.first.image_small.url}}?v={{ product.media_set.first.pk }}"  width="50" height="50" alt="{{ product.pk }}"></div>
        <!-- titel -->
        <div class="col-sm-4"><a href="{% url 'product-detail-type' type=product.type pk=product.pk  %}">   {{ product.name }} </a></div>
        <div class="col-sm-3">{% if product.edit %} <a href="{% url 'projekt-bearbeiten-type' type=product.type pk=product.pk %}"> Projekt bearbeiten</a> <br> <a href="{% url 'add-image' product.pk %}"> Media bearbeiten </a> {% else %} Es kann nicht bearbeitet werden {% endif %} </div>
        <div class="col-sm-2"><a href="{% url 'product-delete' pk=product.pk %}" target="" rel="">Löschen</a> </div>
        <div class="col-sm-2"><a href="{% url 'product-publish' pk=product.pk %}" target="" rel="">Freischaltung</a></div>
    </div>
    <div class="dropdown-divider"></div>

    {% endfor %}
</div>



 {% else %}
<div class="container-fluid">

    <h6>Scheint, als hättest du noch nichts eingetragen :( <br> Gib jetzt ein Projekt ein:<a href="{% url 'neues-projekt-dispatch' %}"><button class="btn border-dark rounded-0 mybtn" type="submit">Projekt eintragen </button> </a></h6>
</div>

{% endif %}

{% endblock %}
