{% extends 'layouts/layouts_admin/base_administration.html.twig' %}{% block headerContent %} {% include 'admin/admin_products/tpl_header.html.twig' with {'title': "Produits", 'subtitle': "Gérer l'ensemble de vos produits"} %}{% endblock %}{% block title %}Gestion des produits{% endblock %}{% block javascripts %} <script src="{{ asset('assets/DataTables/datatables.min.js') }}"></script> <script src="{{ asset('js_admin/products/products.js') }}"></script>{% endblock %}{% block stylesheets %} <link rel="stylesheet" href="{{ asset('assets/DataTables/datatables.min.css') }}">{% endblock %}{% block content %} {{ include('admin/admin_products/tpl_onglets.html.twig') }} <div class="row"> <div class="col-md-12"> <div class="main-card mb-3 card"> <div class="card-body"> <div class="card-header flexJustify">Liste des produits</div> <div class="card-body"> <table style="width: 100%;" id="data_table_products" class="table table-hover"> <thead> <tr> <th></th> <th></th> <th class="align-middle">Nom</th> <th class="align-middle">Catégorie</th> <th class="align-middle"> Type Odyssée </th> <th class="align-middle">Date de création</th> {% if stockManagement %} <th class="align-middle">Stock alerte</th> {% endif %} <th></th> <th></th> </tr> </thead> <tbody> {% for product in productsList %} {# QUAND LE PRODUIT N'A PAS DE REFERENCE #} {% set refCount = 0 %} {% set typeOdyssee = '' %} {% for ref in referencesList %} {% if ref.productId == product.id %} {% set refCount = refCount+1 %} {% set typeOdyssee = ref.typeOdyssee %} {% endif %} {% endfor %} <tr id="row{{ product.id }}"> <td class="text-center align-middle"> <div class="mb-0 mr-0 badge badge-dot badge-dot-lg badge-{% if product.getProdIsonline() %}success{% else %}danger{% endif %}">{% if product.getProdIsonline() == 1 %}1{% else %}0{% endif %}</div> </td> <td> <img src="{{ asset('/medias_front/products/' ~ product.prodPicture, projectDirectory) }}" alt="{{ product.prodTitle }}" style="max-width: 50px;"> </td> <td> <a href="{{ path('admin_product_edit', {prod_id:product.getId()}) }}">{{ product.getProdModel() }}</a> {% if refCount == 0 and product.prodType == 'single' %} <span class="badge badge-warning ml-3">Vous devez définir un prix pour cet article</span> {% elseif refCount == 0 and product.prodType == 'multiple' %} <span class="badge badge-warning ml-3">Vous devez définir des références sur ce produit</span> {% endif %} </td> <td class="align-middle"> {% for categ in categsList %} {% if categ.id == product.getCategoryId() %} {{ categ.categ_entitled }} {% endif %} {% endfor %} </td> <td> {{ typeOdyssee }} </td> <td class="align-middle"> {% if product.getProdCreationDate()|date("H:i:s") != '00:00:00' %} {{ product.getProdCreationDate()|date("d/m/Y H:i") }} {% else %} {{ product.getProdCreationDate()|date("d/m/Y") }} {% endif %} </td> {% if stockManagement %} <td class="align-middle"> {% set alert = false %} {% for ref in referencesList if not alert %} {% if ref.refQuantity <= ref.stockAlert %} {% if ref.productId == product.id %} {% set alert = true %} {% endif %} {% endif %} {% endfor %} {% if alert %} <span class="badge badge-pill badge-danger">Stock faible</span> {% else %} <span class="badge badge-pill badge-success">Stock bon</span> {% endif %} </td> {% endif %} <td class="align-middle"> <button class="border-0 btn-transition btn btn-outline-info" onclick="window.location = '{{ path('admin_product_edit', {prod_id:product.getId()}) }}';"> <i class="fa fa-cog"></i> </button> </td> <td class="align-middle"> <button class="border-0 btn-transition btn btn-outline-danger" onclick="if (confirm('Voulez-vous supprimer ce produit ?')) removeProduct({{ product.getId() }});"> <i class="fa fa-trash-alt"></i> </button> </td> </tr> {% endfor %} </tbody> </table> </div> </div> </div> </div> </div>{% endblock %}