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

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

    <div class="container-admin">
        <div class="header">
                <h3 class="card-header-title">Configuration multisite (uniquement si vous avez plusieurs site) </h3>
                    <p class="intro-form">Cette section vous permet de gérer vos différente site afin de rediriger l'utilisateur vers le plus pres de chez lui.<br>
                    </p>
        </div>
        <div class="tab-content">
            <div class="panel-heading">Magasin
                <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 %}
