<span data-graph-id="{{ nameGraphEvolution }}"></span>

{% if displayFullReport or headline is defined %}
    <h2 piwik-enriched-headline
        {% if idGoal is defined and idGoal and goalName is defined and not ecommerce is defined %}
            edit-url="{{ linkTo({'module': 'Goals', 'action': 'manage', 'idGoal': idGoal})|e('html_attr') }}"
            feature-name="{{ 'Goals_Details'|translate|e('html_attr') }}"
        {% endif %}
       >{% if headline is defined %}{{ headline }}{% elseif goalName is defined %}{{ 'Goals_GoalX'|translate(goalName) }}{% else %}{{ 'General_EvolutionOverPeriod'|translate }}{% endif %}</h2>
{% endif %}
{{ graphEvolution|raw }}

<div id='leftcolumn' style="clear:both;{% if not isWidget and ecommerce is defined %}width:33%;'{% endif %}">
    <div class="sparkline">{{ sparkline(urlSparklineConversions) }}
        {% if ecommerce is defined %}
            <strong>{{ nb_conversions|number }}</strong>
            {{ 'General_EcommerceOrders'|translate }}
            <img src='plugins/Morpheus/images/ecommerceOrder.gif'>
        {% else %}
            {{ 'Goals_Conversions'|translate("<strong>"~nb_conversions|number~"</strong>")|raw }}
        {% endif %}
        {% if goalAllowMultipleConversionsPerVisit is defined and goalAllowMultipleConversionsPerVisit %}
            ({{ 'General_NVisits'|translate("<strong>"~nb_visits_converted|number~"</strong>")|raw }})
        {% endif %}
    </div>
    {% if revenue != 0 or ecommerce is defined %}
        <div class="sparkline">
            {{ sparkline(urlSparklineRevenue) }}
            {% set revenue=revenue|money(idSite) %}
            {% if ecommerce is defined %}
                <strong>{{ revenue|raw }}</strong> {{ 'General_TotalRevenue'|translate }}
            {% else %}
                {{ 'Goals_OverallRevenue'|translate("<strong>"~revenue~"</strong>")|raw }}
            {% endif %}
        </div>
    {% endif %}
    {% if ecommerce is defined %}
        <div class="sparkline">{{ sparkline(urlSparklineAverageOrderValue) }}
            <strong>{{ avg_order_revenue|money(idSite)|raw }}</strong>
            {{ 'General_AverageOrderValue'|translate }}
        </div>
    {% endif %}

</div>
<div id='leftcolumn' {% if not isWidget and ecommerce is defined %}style='width:33%;'{% endif %}>
    <div class="sparkline">{{ sparkline(urlSparklineConversionRate) }}
        {% if ecommerce is defined %}
            {% set ecommerceOrdersText %}{{ 'General_EcommerceOrders'|translate }}{% endset %}
            {{ 'Goals_ConversionRate'|translate("<strong>"~conversion_rate|percent~"</strong> "~ecommerceOrdersText)|raw }}
        {% else %}
            {{ 'Goals_OverallConversionRate'|translate("<strong>"~conversion_rate|percent~"</strong>")|raw }}
        {% endif %}
    </div>
    {% if ecommerce is defined %}
        <div class="sparkline">{{ sparkline(urlSparklinePurchasedProducts) }}
            <strong>{{ items|number }}</strong> {{ 'General_PurchasedProducts'|translate }}</div>
    {% endif %}
</div>
{% if ecommerce is defined %}
    <div id='rightcolumn' {% if not isWidget %}style='width:30%;'{% endif %}>
        <div>
            <img src='plugins/Morpheus/images/ecommerceAbandonedCart.gif'> <em>{{ 'General_AbandonedCarts'|translate }}</em>
        </div>

        <div class="sparkline">
            {{ sparkline(cart_urlSparklineConversions) }}
            {% set ecommerceAbandonedCartsText %}{{ 'Goals_AbandonedCart'|translate }}{% endset %}
            <strong>{{ cart_nb_conversions|number }}</strong> {{ 'General_VisitsWith'|translate(ecommerceAbandonedCartsText) }}
        </div>

        <div class="sparkline">
            {{ sparkline(cart_urlSparklineRevenue) }}
            {% set revenue %}{{ cart_revenue|money(idSite)|raw }}{% endset %}
            {% set revenueText %}{{ 'General_ColumnRevenue'|translate }}{% endset %}
            <strong>{{ revenue }}</strong> {{ 'Goals_LeftInCart'|translate(revenueText) }}
        </div>

        <div class="sparkline">
            {{ sparkline(cart_urlSparklineConversionRate) }}
            <strong>{{ cart_conversion_rate|percent }}</strong>
            {{ 'General_VisitsWith'|translate(ecommerceAbandonedCartsText) }}
        </div>
    </div>
{% endif %}
{% include "_sparklineFooter.twig" %}

