{% extends 'base_backend_admin.html.twig' %}

{% block title %} Article {% endblock %}

{% block content %}
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-gray-800">Article</h1>
    <ol class="breadcrumb float-sm-right">
        <li class="breadcrumb-item">Article</li>
    </ol>
</div>




<!-- Begin Page Content -->
<div class="container-fluid">
    
    {% include 'backend_admin/basic/notice.html.twig' %}
    
    <!-- DataTales Example -->
    <div class="card shadow mb-4">
       
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-info">Liste des articles</h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Titre</th>
                            <th>Société</th>
                            <th>Date Ajoute</th>
                            <th>Limitation</th>
                            <th>Activer</th>
                            <th>Détail</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for article in articles %}
                            <tr>
                                <td>{{ article.getId() }}</td>
                                <td>{{ article.getTitre()}}</td>
                                <td>{{ article.getSociete().getNom() }}</td>
                                <td>{{ article.getDateAdd()|date("d/m/Y")}}</td>
                                <td>
                                    {% if article.getLimitType() == 0 %}
                                        Par Date: <b>{{ article.getLimitDate()|date("d/m/Y")  }}</b>
                                    {% elseif article.getLimitType() == 1 %}
                                        Par Quantité: <b>{{ article.getLimitQuantite() }}</b>
                                    {% endif %}
                                </td>
                                <td>
                                    {% if article.isActive() %}
                                        <i class="fa-solid fa-circle-check fa-xl" style="color: #26a269;"></i>
                                    {% else %}
                                        <i class="fa-solid fa-circle-xmark fa-xl" style="color: #e01b24;"></i>
                                    {% endif %}
                                </td>
                                <td>
                                    <a href="{{ path('backend_admin_article_update', {'id': article.getId() }) }}" title="Détail" class="btn btn-info btn-action">
                                        <i class="fa-solid fa-magnifying-glass"></i>
                                    </a>
                                    <a href="{{ path('backend_admin_article_uploder',{id:article.id}) }}" title="gestion des images" class="btn btn-warning"><i class="fa-regular fa-image"></i></a>
                                    {% if article.isActive() %}
                                        <a href="{{ path('backend_admin_article_activation',{id:article.id, 'activation': 'false'}) }}" title="gestion des images" class="btn btn-danger"><i class="fa-solid fa-x"></i></a>
                                    {% elseif (article.isActive() == false) and (article.getImageDefault() != '') %}
                                        <a href="{{ path('backend_admin_article_activation',{id:article.id, 'activation': 'true'}) }}" title="gestion des images" class="btn btn-success"><i class="fa-solid fa-check"></i></a>
                                    {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
                

{% endblock %}
