Commit c2f6a4fb authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Finalisation affichage plafonds

parent 2ae1b651
Loading
Loading
Loading
Loading
+1 −1
Changes for module/Application/src/View/Helper/Paiement/DemandeMiseEnPaiementViewHelper.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ class DemandeMiseEnPaiementViewHelper extends AbstractViewHelper
                            'data-usage'          => $this->budget[$sid][$trid]['usage'],
                        ])->html(
                            $t('div', [
                                'class'         => 'progressbar progress-bar-striped',
                                'class'         => 'progress-bar progress-bar-striped',
                                'role'          => 'progressbar',
                                'aria-valuenow' => 0,
                                'aria-valuemin' => 0,
+78 −3
Changes for module/Plafond/src/View/Helper/PlafondsViewHelper.php: 78 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ class PlafondsViewHelper extends AbstractHtmlElement
        ];

        $attrs = [
            'class'    => 'plafonds',
            'class'    => 'plafonds alert alert-info',
            'data-url' => $this->getView()->url('plafond/plafonds', $params),
        ];

@@ -80,9 +80,84 @@ class PlafondsViewHelper extends AbstractHtmlElement

    public function affichage(): string
    {
        var_dump($this->plafonds);

        if (empty($this->plafonds)) {
            return '';
        }

        $html = $this->getView()->tag('h4')->text('Plafonds');
        foreach ($this->plafonds as $plafond) {
            $html .= $this->affichagePlafond($plafond);
        }

        return $html;
    }



    protected function affichagePlafond(PlafondControle $plafond)
    {
        $t = $this->getView()->tag();

        $html = $t('div', ['class' => 'col-md-8'])->html(
            $plafond->getMessage()
            . ' '
            . $t('span', ['class' => 'label label-info'])->text('n° ' . $plafond->getNumero())
        );

        $text = '';

        $max = $plafond->getPlafond() + $plafond->getDerogation();
        if ($plafond->getHeures() >= $max) {
            $max = $plafond->getHeures();
            if ($plafond->getPlafond() == 0) {
                $text = floatToString($plafond->getHeures()) . 'h pour aucune autorisée';
            } else {
                $text = floatToString($plafond->getHeures()) . 'h pour ' . floatToString($plafond->getPlafond()) . ' max.';
            }

            if ($plafond->isBloquant()) {
                $color = 'danger';
            } else {
                $color = 'warning';
            }
        } else {
            if ($plafond->isBloquant()) {
                $color = 'info';
            } else {
                $color = 'success';
            }
        }

        if ($max > 0) {
            $progression = ceil($plafond->getHeures() * 100 / $max);
        } else {
            $progression = 0;
        }

        if (!$text) {
            if ($progression > 49) {
                $text = floatToString($plafond->getHeures()) . 'h, '
                    . floatToString($max - $plafond->getHeures()) . ' dispo.';
            } elseif ($progression > 10) {
                $text = floatToString($plafond->getHeures()) . 'h';
            }
        }

        $html .= $t('div', ['class' => 'col-md-4'])->html(
            $t('div', [
                'class' => 'progress',
            ])->html(
                $t('div', [
                    'class'         => 'progress-bar progress-bar-striped progress-bar-' . $color,
                    'role'          => 'progressbar',
                    'aria-valuenow' => $progression,
                    'aria-valuemin' => 0,
                    'aria-valuemax' => 100,
                    'style'         => 'width:' . $progression . '%',
                ])->text($text)
            )
        );

        return $t('div', ['class' => 'row plafond'])->html($html);
    }
}
 No newline at end of file
+11 −2
Changes for public/css/app.css: 11 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -629,11 +629,11 @@ td .alert {
}


.progressbar {
.progress-bar {
    box-shadow: 1px 0px 2px gray;
}

.progressbar.active {
.progress-bar.active {
    animation: 2s linear 0s normal none infinite running progress-bar-stripes;
}

@@ -882,3 +882,12 @@ form.statut fieldset legend {
.indicateurs-result table .cc {
    width: 2em;
}





/* Plafonds */
.plafonds .plafond .progress {
  margin-bottom: 10px;
}
 No newline at end of file
+1 −1
Changes for public/js/paiement.js: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1015,7 +1015,7 @@ $.widget("ose.dmepBudget", {
    setDiffValue: function (typeRessourceId, structureId, value)
    {
        var progress = this.getElementEnveloppe(typeRessourceId, structureId);
        var bar = progress.find('.progressbar');
        var bar = progress.find('.progress-bar');
        var dotation = progress.data('dotation');
        var usage = progress.data('usage') + value;
        var restant = dotation - usage;