{% extends '@PrestaShop/Admin/layout.html.twig' %}

{% block content %}
<div class="row content">
    {% include '@Modules/polarisprestatheme/views/templates/admin/nav.html.twig' %}

    <div class="container-content">
        <div class="tab-content">
            <div class="panel-heading">Block Store 
                <a class="action-link add" style="float:right" href="{{path('admin_presta_store' , {id: -1, action:'add'})}}"><span class="material-icons">add</span></a>
             </div>
            <table>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Image</th>
                        <th>Etat</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    {% for store in stores %}
                        <tr>
                            <td>{{ loop.index }}</td>
                            <td>{{ store.name }}</td>
                            <td>
                                <img style="max-width:75px; border: 1px solid #ddd;" src="{{ store.image }}"/>
                            </td>
                            <td>
                                <a href="#" class="toggle-visibility" 
                                    data-id="{{ loop.index0 }}" 
                                    data-objet="configStore" 
                                    data-url="{{ path('admin_presta_toggle_visibility') }}">
                                    {% if store.isVisible %}
                                        <span style="color:green" class="material-icons">check</span>
                                    {% else %}
                                        <span style="color:red" class="material-icons">close</span>
                                    {% endif %}
                                </a>
                            </td>
                            <td>
                                <a href="{{ path('admin_presta_store', {id: loop.index - 1, action: 'edit'}) }}">
                                    <span class="material-icons">edit</span>
                                </a>
                                <a href="{{ path('admin_presta_store', {id: loop.index - 1, action: 'delete'}) }}">
                                    <span class="material-icons">delete</span>
                                </a>
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}
