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

Preversion du reset du filtre

parent 7394124f
Loading
Loading
Loading
Loading
+2 −30
Changes for module/Application/view/application/mission-specifique/affectation.phtml: 2 added lines, 30 removed lines.
Original line number Diff line number Diff line
@@ -33,36 +33,7 @@ $canDetruire = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivilege
</h1>

<div class="filter">
    <form method="get" action="<?php echo $this->url(); ?>">
        Structure :
        <select name="structure" class="selectpicker" data-live-search="true">
            <option value="0"> Toutes les structures </option>
            <?php foreach($structures as $clef => $label) : ?>
                <option value="<?php echo $clef; ?>"
                    <?php if ($structure && $structure->getId() == $clef) echo " selected" ?>
                > <?php echo $label; ?> </option>
            <?php endforeach; ?>
        </select>
        Agent :
        <select name="agent" class="selectpicker show-tick" data-live-search="true">
            <option value="0"> Tous les agents </option>
            <?php foreach($agents as $clef => $label) : ?>
                <option value="<?php echo $clef; ?>"
                    <?php if ($agent && $agent->getId() == $clef) echo " selected" ?>
                > <?php echo $label; ?> </option>
            <?php endforeach; ?>
        </select>
        Mission :
        <select name="mission" class="selectpicker" data-live-search="true">
            <option value="0"> Toutes les missions </option>
            <?php foreach($missions as $clef => $label) : ?>
                <option value="<?php echo $clef; ?>"
                    <?php if ($mission && $mission->getId() == $clef) echo " selected" ?>
                > <?php echo $label; ?> </option>
            <?php endforeach; ?>
        </select>
        <input class="btn btn-primary action" type="submit" value="Filter les affectations"/>
    </form>
    <?php echo $this->partial('partial/filtre', ['structures' => $structures, 'agents' => $agents, 'missions' => $missions, 'structure' => $structure, 'agent' => $agent, 'mission' => $mission], [], true); ?>
</div>

<div class="main">
@@ -163,3 +134,4 @@ $canDetruire = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivilege
        });
    });
</script>
+75 −0
Changes for module/Application/view/application/mission-specifique/partial/filtre.phtml: 75 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php
/**
 * @var array $structures
 * @var array $agents
 * @var array $missions
 *
 * @var Structure $structure
 * @var Agent $agent
 * @var MissionSpecifique $mission
 */

use Application\Entity\Db\Agent;
use Application\Entity\Db\MissionSpecifique;
use Application\Entity\Db\Structure;

?>

<form method="get" action="<?php echo $this->url(); ?>">
    <label for="structure">Structure :</label>
    <select id="structure" name="structure" class="selectpicker show-tick" data-live-search="true">
        <option value="0"> Toutes les structures </option>
        <?php foreach($structures as $clef => $label) : ?>
            <option value="<?php echo $clef; ?>"
                <?php if ($structure && $structure->getId() == $clef) echo " selected" ?>
            > <?php echo $label; ?> </option>
        <?php endforeach; ?>
    </select>

    <label for="structure">Agent :</label>
    <select id="agent" name="agent" class="selectpicker show-tick" data-live-search="true">
        <option value="0"> Tous les agents </option>
        <?php foreach($agents as $clef => $label) : ?>
            <option value="<?php echo $clef; ?>"
                <?php if ($agent && $agent->getId() == $clef) echo " selected" ?>
            > <?php echo $label; ?> </option>
        <?php endforeach; ?>
    </select>

    <label for="mission">Mission :</label>
    <select id="mission" name="mission" class="selectpicker show-tick" data-live-search="true">
        <option value="0"> Toutes les missions </option>
        <?php foreach($missions as $clef => $label) : ?>
            <option value="<?php echo $clef; ?>"
                <?php if ($mission && $mission->getId() == $clef) echo " selected" ?>
            > <?php echo $label; ?> </option>
        <?php endforeach; ?>
    </select>
    <button class="btn btn-primary" id="clear">
        <span class="icon effacer"></span>
    </button>

    <input class="btn btn-primary action pull-right" type="submit" value="Filter les affectations"/>
</form>


<style>
    div.filter {
        background-color: white;
        padding: 0.5rem;
        margin: 0.5rem;
        border-radius: 5px;
    }

    div.filter label {
        margin-left: 1em;
    }
</style>

<script>
    $('button#clear').click(function() {
        $('select#structure option:selected').removeAttr('selected');
        $('select#agent option:selected').removeAttr('selected');
        $('select#mission option:selected').removeAttr('selected');
    });
</script>
 No newline at end of file
+4 −0
Changes for public/css/app.css: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -212,6 +212,10 @@ span.icon.formation:before {
    content: "\f51b";
}

span.icon.effacer:before {
    content: "\f12d";
}

div.survol:hover {
    background-color: lightgoldenrodyellow;
}