{% extends "admin/background_pages/base.html" %}

{% load bulb_static static compress %}

{% block title %}Gestion : {{ node_class_name }}{% endblock title %}

{% block head %}
    {% if DEBUG %}
        {% compress css %}
            <link rel="stylesheet" type="text/x-scss" href="{% static "handling/css/style/node_class_home_page.scss" %}"/>
        {% endcompress %}

{% elif not DEBUG %}
        <link rel="stylesheet" href="{% static_bundled_src "handling/bundle_node_class_home.css" %}"/>

    {% endif %}
{% endblock head %}

{% block administration_part_name %}
    >
    <a class="nav-link" href="{% url "handling_home" %}">Gestion</a>
    >
    <a class="nav-link" href="{% url "node_model_home" node_model_name=node_model_name %}">{{ node_model_name }}</a>
{% endblock administration_part_name %}

{% block content %}
    <br/>
    <br/>
    <br/>

    <a href="{% url "node_creation" node_model_name=node_model_name %}">Créer une nouvelle instance</a>


    <table>
        <thead>
            <tr>
                {% for field_number, field_name in preview_fields_dict.items %}
                    <th>{{ field_name }}</th>
                {% endfor %}
            </tr>
        </thead>

        <tbody>
            {% for uuid, properties in fifteen_lasts_instances_json.items %}
                <tr>
                    {% for property_number, property_tuple in properties.items %}
                            <td {% if property_tuple.1 == True %}
                                class="true_td"
                            {% elif property_tuple.1 == False  %}
                                class="false_td"
                            {% endif %}>
                                <a href="{% url "node_handling" node_model_name=node_model_name node_uuid=uuid %}">
                                    {{ property_tuple.1|truncatechars:40 }}
                                </a>
                            </td>
                    {% endfor %}
                </tr>
            {% endfor %}
        </tbody>
    </table>

{% endblock content %}

{% block scripts %}{% endblock scripts %}