Commit 70038017 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Modifcation de la page des applications : recherche en historique et...

Modifcation de la page des applications : recherche en historique et activation/desactivation en cliquant
parent 9c71b4db
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -61,13 +61,7 @@ $this->headTitle("Index des applications");
</div>

<script>
    $(document).ready(function() {
        $('.datatable').DataTable( {
            language: {
                url: '/localisation/fr_FR.json'
            }
        } );
    } );


    $(function() {
        let hash = $(location).attr('hash');
+37 −7
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ $canEffacer = $droits['canEffacer'];
<br/>
<br/>

<table id="datatable" class="datatable table table-condensed">
<table id="applications" class="datatable table table-condensed">
    <thead>
    <tr>
        <th> Libelle</th>
@@ -78,8 +78,20 @@ $canEffacer = $droits['canEffacer'];
            </td>
            <td> <a href="<?php echo $application->getUrl(); ?>"><?php echo $application->getUrl(); ?></a> </td>
            <td>
                <?php if ($canEditer) : ?>
                <a
                    <?php /** @see \Application\Controller\ApplicationController::changerStatusAction() */?>
                        href="<?php echo $this->url('application/changer-status', ['id' => $application->getId()], [], true); ?>"
                        title="Activer/Desactiver l'application"
                >
                <?php endif; ?>
                    <?php if ($application->isActif()) : ?>
                        <span class="badge" style="background-color: darkgreen;">&nbsp;</span>
                    <?php else : ?>
                        <span class="badge" style="background-color: darkred;">&nbsp;</span>
                    <?php endif;?>
                <?php if ($canEditer) : ?>
                    </a>
                <?php endif; ?>
            </td>
            <td>
@@ -99,12 +111,6 @@ $canEffacer = $droits['canEffacer'];
                <!--                            <a href="--><?php ////echo $this->url('application/formation', ['id' => $application->getId()], [], true); ?><!--"  class="ajax-modal" data-event="modification">-->
                <!--                                <span class="icon formation" title="Modifier liste des formations"></span></a>-->
                <!--                        --><?php //endif; ?>
                <?php if ($canEditer) : ?>
                    <a
                        <?php /** @see \Application\Controller\ApplicationController::changerStatusAction() */?>
                        href="<?php echo $this->url('application/changer-status', ['id' => $application->getId()], [], true); ?>">
                        <span class="icon power"  title="Activer/Desactiver l'application"></span></a>
                <?php endif; ?>
                <?php if ($canEffacer) : ?>
                    <a
                        <?php /** @see \Application\Controller\ApplicationController::effacerAction() */?>
@@ -120,6 +126,30 @@ $canEffacer = $droits['canEffacer'];
</table>

<script>
    let loaded = false;

    $(document).ready(function() {
        var table = $('#applications').DataTable({
            "paging": false
        });
        let searchParams = new URLSearchParams(window.location.search);
        let param = searchParams.get('search')
        if (param !== null) {
            table.search(param);
            table.draw();
        }
        loaded = true;
    });

    $(document).on('search.dt', function (event) {
        if (loaded === true) {
            console.log(event);
            let valeur = $('div#applications_filter input[type="search"]').val();
            console.log(valeur);
            history.replaceState({}, null, '?search=' + valeur);
        }
    });

    $('select#groupe-select').change(function() {
        let selected = $('select#groupe-select option:selected').val();
        let new_url = "?groupe="+ selected + "#application" ;