{# 


    {% include '@GlobalApplication/ConsoBudgetaire/template_conso_budget.twig' with {
        'id' : random(),
        'title' : '',
        'libAxes' : '',
        'devise' : '', 
        'MontantBudget' : '', 
        'DejaConsomme' : '',  
        'ConsoDocument' : '',
    } %}

#}

    {% if MontantBudget | convertFloat %} 
        {% set percentTotal = 100 %}
        {% set percentDejaConso = (DejaConsomme | convertFloat) * percentTotal / MontantBudget | convertFloat %}
        {% set percentConso = (ConsoTotal | convertFloat) * percentTotal / MontantBudget | convertFloat %}
    {% endif %}


    {% if percentConso > 110 %}
        {% set percentConso = 110 %}
    {% endif %}


    {% if percent >= 100 %}
        {% set colorBarre = '#FD0D0D' %}
        {% set colorBackground = 'rgba(253, 13, 13, 0.3)' %}
    {% elseif alerte and percent >= alerte %}
        {% set colorBarre = '#FF6B3D' %}
        {% set colorBackground = 'rgba(255, 107, 61, 0.3)' %}
    {% else %}
        {% set colorBarre = '#3b7a3b' %}
        {% set colorBackground = 'rgba(59, 122, 59, 0.3)' %}
    {% endif %}
    

    <div class="graph_budget">

        <div class="title">{{ title }}</div>
        <div class="titreBudget">{{ libAxes }}</div>
        <div class="budget">
            <span>{{ 'Budget' | trad }} :</span>
            <span>{{ MontantBudget | prix }} {{devise}}</span>
        </div>
    
        {% if MontantBudget | convertFloat %} 
            <div class="groupBar">
                <div class="bar MontantBudget" style="height:{{ percentTotal }}%;background: {{ colorBackground }};">
                </div>
                <div class="splitConso" style="bottom:{{ percentConso }}%;">
                    <div class="lib_conso lib_dejaDonso"><span>{{ ConsoTotal | prix }} {{ devise }}</span></div>
                </div>
                <div class="bar ConsoDocument" style="height:{{ percentConso }}%;">
                    <div class="lib_conso">{{ ConsoDocument | prix }} {{ devise }}</div>
                </div>
                <div class="bar DejaConsomme" style="height:{{ percentDejaConso }}%;background: {{ colorBarre }};">
                </div>
            </div>

            <div class="percentConso" style="color : {{ colorBarre }};">{{ percent |prix }} %</div>
        {% else %}
            <div class="noConso">{{ 'Aucun budget n\'est défini, la consommation ne peut être affichée.' | trad }}</div>
        {% endif %}
    </div>