{% extends 'base_back.html.twig' %}{% block style %} <link rel="stylesheet" href="{{ asset('back/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css') }}"> <link rel="stylesheet" href="{{ asset('back/plugins/datatables-responsive/css/responsive.bootstrap4.min.css') }}"> <link rel="stylesheet" href="{{ asset('back/css/admin-subscription.css')}}">{% endblock %}{% block body %} <!-- Content Header (Page header) --> <div class="content-header pt-3"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <div class="row"> <div class="col-md-6"> <h1 class="m-0 text-dark">Abonnements</h1> </div> </div> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container-fluid --> </div> <!-- /.content-header --> <!-- Main content --> <section class="content"> <div class="container-fluid"> <!-- Main row --> <div class="row"> <div class="card col-md-12"> <div class="card-header"> <h3 class="card-title">Liste des abonnés</h3> </div> <!-- /.card-header --> <div class="card-body" style="overflow-x:auto;"> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>Nom - Email</th> <th>Adresse</th> <th>Contact</th> <th>SIREN</th> <th>Type categorie</th> <th>Nb produits</th> <th class="text-center">Statut abonnement</th> <th class="text-center">Id abonnement</th> </tr> </thead> <tbody> {% for company in companies %} <tr> <td>{{ company.companyName }}<br>{{ company.email }}</td> <td>{{ company.adress }} {{ company.zipCode }} {{ company.city }}</td> <td>{{ company.contactCivility }} {{ company.contactName }}<br>Tél : {{ company.contactPhone }}</td> <td>{{ company.siren }}</td> <td> {% if company.type %} {% if company.type == 'product' %} Produits<br> {% else %} Services {% endif %} {% else %} <span style="color:red">Aucun</span><br> {% endif %} {% if company.isEditorGuide %} - Avec Guide éditeur<br>{% endif %} <a href="{{ path('admin_company_change_category', {'id': company.id}) }}">Modifier</a> </td> <td>{{ company.products|length }} {% if company.products|length == 1 %}<a href="{{ path('admin_company_see_product', {'id': company.products.first.id}) }}">Voir</a>{% endif %}</td> <td class="text-center"> <div class="subscription-status-container"> <div class="d-flex align-items-center"> {{ company.abonnements.last.isActive == true ? "<span style='color:green'>Actif</span>" : "<span style='color:red'>Désabonné</span>" }} </div> {% if company.abonnements.last.isActive == true %} <div> <form action="{{ url('admin_subscription_subscription_end', {id: company.id}) }}" method="post" onsubmit="return confirm('Êtes-vous sûr de vouloir annuler l\'abonnement ? ');"> <input type="hidden" name="token" value="{{ csrf_token('unsubscribe' ~ company.id) }}"/> <button class="btn btn-primary" type="submit" id="">Désactiver</button> </form> </div> {% endif %} </div> </td> <td class="text-center"> <p> {{ company.abonnements.last.stripeSubscriptionId }} </p> </td> </tr> {% endfor %} </table> </div> <!-- /.card-body --> </div> </div> <!-- /.row (main row) --> </div><!-- /.container-fluid --> </section>{% endblock %}{% block javascript %}{{ parent() }}<script src="{{ asset('back/plugins/jquery/jquery.min.js') }}"></script><!-- Bootstrap 4 --><script> $('.unsubscribe-form').on('submit', function(e){ e.preventDefault(); alert('le formulaire a été soumis !!') });</script><script src="{{ asset('back/plugins/datatables/jquery.dataTables.min.js') }}"></script><script src="{{ asset('back/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js') }}"></script><script src="{{ asset('back/plugins/datatables-responsive/js/dataTables.responsive.min.js') }}"></script><script src="{{ asset('back/plugins/datatables-responsive/js/responsive.bootstrap4.min.js') }}"></script><script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> <script> $(function () { $("#example1").DataTable({ "responsive": true, "autoWidth": false, "language": { "url": "//cdn.datatables.net/plug-ins/1.10.20/i18n/French.json" }, 'order': [] }); });</script>{% endblock %}