{% extends 'datatable.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "activity/actions.html.twig" as actions %}

{% block datatable_row_attr %} {{ widgets.activity_row_attr(entry, now) }}{% endblock %}

{% block datatable_column_value %}
    {% if column == 'name' %}
        {{ widgets.label_name(entry.name, entry.color|colorize(entry.name)) }}
    {% elseif column == 'project' %}
        {# only none-global activities have a project and customer assigned #}
        {% if entry.project %}
            {{ widgets.label_project(entry.project) }}
            {% if entry.project.customer %}
                <br>
                <small>
                    {{ widgets.label_customer(entry.project.customer) }}
                </small>
            {% endif %}
        {% endif %}
    {% elseif column == 'comment' %}
        {{ entry.comment|comment1line }}
    {% elseif column == 'budget' %}
        {% if entry.hasBudget() and is_granted('budget', entry) %}
            {{ entry.budget|money((entry.project is null ? defaultCurrency : entry.project.customer.currency)) }}
        {% else %}
            &ndash;
        {% endif %}
    {% elseif column == 'timeBudget' %}
        {% if entry.hasTimeBudget() and is_granted('time', entry) %}
            {{ entry.timeBudget|duration }}
        {% else %}
            &ndash;
        {% endif %}
    {% elseif column == 'billable' %}
        {{ widgets.label_boolean(entry.billable) }}
    {% elseif column == 'team' %}
        {{ widgets.badge_team_access(entry.teams) }}
    {% elseif column == 'visible' %}
        {{ widgets.label_visible(entry.visible) }}
    {% elseif column == 'actions' %}
        {{ actions.activity(entry, 'index') }}
    {% elseif column starts with 'mf_' %}
        {{ widgets.meta_field_value(entry, data) }}
    {% endif %}
{% endblock %}
