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

Améliroation de l'affichage pour le changement d'état

parent 4bb00b31
Loading
Loading
Loading
Loading
+9
Changes for module/Formation/src/Formation/Entity/Db/Etat.php: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ class Etat {
    private $icone;
    /** @var string|null */
    private $couleur;
    /** @var int|null */
    private $ordre;

    /**
     * @return string
@@ -61,4 +63,11 @@ class Etat {
        return $this->couleur;
    }

    /**
     * @return int|null
     */
    public function getOrdre(): ?int
    {
        return $this->ordre;
    }
}
 No newline at end of file
+1
Changes for module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.Etat.dcm.xml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
        <field name="description"          type="string"       length="9999"       column="DESCRIPTION"      nullable="true"/>
        <field name="icone"                type="string"       length="1024"       column="ICONE"            nullable="true"/>
        <field name="couleur"              type="string"       length="1024"       column="COULEUR"          nullable="true"/>
        <field name="ordre"                type="integer"                          column="ORDRE"            nullable="true"/>

    </entity>
</doctrine-mapping>
 No newline at end of file
+5 −1
Changes for module/Formation/view/formation/session/changer-etat.phtml: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ use Formation\Entity\Db\Session;
 */

$current = ($session->getEtat())?$session->getEtat()->getCode():null;

usort($etats, function (Etat $a, Etat $b) { return $a->getOrdre() > $b->getOrdre();});
?>

<form method="post" action="<?php echo $this->url("formation/session/changer-etat",['session' => $session->getId()],[], true); ?>">
@@ -17,7 +19,9 @@ $current = ($session->getEtat())?$session->getEtat()->getCode():null;
    <select id="etat" name="etat" class="selectpicker">
        <option>Selectionner un état</option>
        <?php foreach ($etats as $etat) : ?>
            <option value="<?php echo $etat->getCode(); ?>" <?php if ($current===$etat->getCode()) echo " selected "; ?>>
            <option value="<?php echo $etat->getCode(); ?>" <?php if ($current===$etat->getCode()) echo " selected "; ?>
                    data-content="<span class='badge' style='background:<?php echo $etat->getCouleur(); ?>'><span class='<?php echo $etat->getIcone(); ?>'></span></span> &nbsp; <?php echo $etat->getLibelle(); ?>"
            >
                <?php echo $etat->getLibelle(); ?>
            </option>
        <?php endforeach; ?>