{% extends 'base.html.twig' %}
{% import "activity/actions.html.twig" as actions %}

{% block page_title %}{{ 'admin_activity.title'|trans }}{% endblock %}
{% block page_actions %}{{ actions.activity(activity, 'delete') }}{% endblock %}

{% block main %}

    {% set params = {
        '%activity%': '<strong>' ~ activity.name ~ '</strong>',
        '%project%': '<strong>-</strong>',
        '%customer%': '<strong>-</strong>',
        '%records%': '<strong>' ~ stats.recordAmount ~ '</strong>',
        '%duration%': '<strong>' ~ stats.recordDuration|duration ~ '</strong>'
    } %}

    {% if activity.project is not null %}
        {% set params = params|merge({
            '%project%': '<strong>' ~ activity.project.name ~ '</strong>',
            '%customer%': '<strong>' ~ activity.project.customer.name ~ '</strong>',
        }) %}
    {% endif %}

    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% import "macros/progressbar.html.twig" as progress %}
        {% block box_title %}{{ activity.name }}{% endblock %}
        {% block box_body %}
            <p>
                {{ 'admin_activity.short_stats'|trans(params)|raw }}
            </p>

            {% set currency = null %}
            {% if activity.project is not null %}
                {% set currency = activity.project.customer.currency %}
            {% endif %}

            {{ progress.progressbar(activity.budget, stats.recordRate, 'label.budget'|trans, stats.recordRate|money(currency) ~ ' / ' ~ activity.budget|money(currency) ) }}
            {{ progress.progressbar(activity.timeBudget, stats.recordDuration, 'label.timeBudget'|trans, stats.recordDuration|duration ~ ' / ' ~ activity.timeBudget|duration ) }}
        {% endblock %}
    {% endembed %}

{% endblock %}
