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

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

{% block datatable_column_value %}
    {% if column == 'name' %}
        {{ widgets.label_name(entry.name, entry.color|colorize(entry.name)) }}
    {% elseif column == 'comment' %}
        {{ entry.comment|comment1line }}
    {% elseif column == 'number' %}
        {{ entry.number }}
    {% elseif column == 'company' %}
        {{ entry.company }}
    {% elseif column == 'vat_id' %}
        {{ entry.vatId }}
    {% elseif column == 'contact' %}
        {{ entry.contact }}
    {% elseif column == 'address' %}
        {{ entry.address }}
    {% elseif column == 'country' %}
        {{ entry.country|country_name }}
    {% elseif column == 'currency' %}
        {{ entry.currency|currency_name }}
    {% elseif column == 'phone' %}
        {{ entry.phone }}
    {% elseif column == 'fax' %}
        {{ entry.fax }}
    {% elseif column == 'mobile' %}
        {{ entry.mobile }}
    {% elseif column == 'email' %}
        {{ entry.email }}
    {% elseif column == 'homepage' %}
        {{ entry.homepage }}
    {% elseif column == 'budget' %}
        {% if entry.hasBudget() and is_granted('budget', entry) %}
            {{ entry.budget|money(entry.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.customer(entry, 'index') }}
    {% elseif column starts with 'mf_' %}
        {{ widgets.meta_field_value(entry, data) }}
    {% endif %}
{% endblock %}
