Commit d1d78d72 authored by Thibaut Vallee's avatar Thibaut Vallee
Browse files

Data-table sur la liste

parent 59043953
Loading
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
use UnicaenMail\Entity\Db\Mail;
use UnicaenMail\Provider\Privilege\MailPrivileges;


/** Droits pour les actions */
$canAfficher = false;
if (!isset($options['droits']) OR !isset($options['droits']['afficher'])) {
@@ -32,7 +31,7 @@ if (!isset($options['droits']) OR !isset($options['droits']['supprimer'])) {

?>

<table class="table table-condensed table-hover">
<table id="mails-liste" class="table table-condensed table-hover">
    <thead>
    <tr>
        <th> Destinataires </th>
@@ -40,7 +39,7 @@ if (!isset($options['droits']) OR !isset($options['droits']['supprimer'])) {
        <th> Statut </th>
        <th> Sujet </th>
        <th> Infos </th>
        <th style="min-width:7rem;"> Action </th>
        <th> Action </th>
    </tr>
    </thead>
    <tbody>
@@ -87,14 +86,14 @@ if (!isset($options['droits']) OR !isset($options['droits']['supprimer'])) {
                       class="ajax-modal"
                       title="Afficher le mail" data-toggle="tooltip" data-html="true"
                    >
                        <span class="icon voir"></span></a>
                        <span class="fas fa-eye"></span></a>
                <?php endif; ?>
                <?php if ($canReenvoyer) : ?>
                    <?php /** @see \UnicaenMail\Controller\MailController::reenvoiAction() */?>
                    <a href="<?php echo $this->url('mail/reenvoi', ['mail' => $mail->getId()], [], true); ?>"
                       title="Ré-envoyer le mail" data-toggle="tooltip" data-html="true"
                    >
                        <span class="icon mail"></span></a>
                        <span class="fas fa-envelope"></span></a>
                <?php endif; ?>
                <?php if ($canSupprimer) : ?>
                    <?php /** @see \UnicaenMail\Controller\MailController::supprimerAction() */?>
@@ -102,7 +101,7 @@ if (!isset($options['droits']) OR !isset($options['droits']['supprimer'])) {
                       class="ajax-modal" data-event="modification"
                       title="Supprimer le mail" data-toggle="tooltip" data-html="true"
                    >
                        <span class="icon detruire"></span></a>
                        <span class="fas fa-trash-alt text-danger"></span></a>
                <?php endif; ?>
            </td>
        </tr>
+29 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ $canTest = $this->isAllowed(MailPrivileges::getResourceId(MailPrivileges::MAIL_A
    <div class="col-md-12">
        <a href="<?php echo $this->url('mail/test', [], [], true); ?>"
           class="btn btn-primary action ajax-modal" data-event="modification">
            <span class="icon mail"></span>
            <span class="fas fa-envelope"></span>
            Envoi d'un mail de test
        </a>
    </div>
@@ -41,6 +41,33 @@ $canTest = $this->isAllowed(MailPrivileges::getResourceId(MailPrivileges::MAIL_A

<script>
    $(function () {
        if (jQuery().dataTable) {
            $('#mails-liste').DataTable({
                "lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "Tous"]],
                "columnDefs": [
                    {targets: 5, orderable: false, searchable: false},
                ],
                "language": {
                    'lengthMenu': "Afficher _MENU_ &eacute;l&eacute;ments",
                    "search": "Filtre de recherche : _INPUT_",
                    "loadingRecords": "Chargement en cours...",
                    'info': "<small class=\"text-highlight\">Affichage : <strong><i class=\"far fa-list-alt\"></i> _START_ - _END_ sur _TOTAL_</strong></small>",
                    'infoEmpty': "",
                    'infoFiltered': "<small class=\"text-highlight\">(_MAX_ &eacute;l&eacute;ments au total)</small>",
                    'emptyTable': "Aucune donnée disponible.",
                    'zeroRecords': "Aucun enregistrement trouvé.",
                    "paginate": {
                        "previous": "<i class=\"fas fa-chevron-left\"></i>",
                        "next": "<i class=\"fas fa-chevron-right\"></i>"
                    }
                },
                "createdRow": function (row, data, index) {
                    $('.pop-ajax', row).popAjax();
                },
            });
        }


$("body").on("modification", function (event) {
            event.div.modal('hide');
            window.location.reload();