<commit_before>{% import 'OroUIBundle::macros.html.twig' as ui %}
{% import 'OroTagBundle::macros.html.twig' as tag %}
{% import 'OroEntityConfigBundle::macros.html.twig' as entityConfig %}

{% macro renderEmail(emailAddress, isPrimary, entity) %}
    {% import 'OroEmailBundle::macros.html.twig' as email %}
    {% if isPrimary %}<strong>{% endif %}
        {{ email.renderEmailWithActions(emailAddress, entity) }}
    {% if isPrimary %}</strong>{% endif %}
{% endmacro %}

{% macro renderApiBlock(user, userApi, viewProfile) %}
    {% set ownUserView = app.user and user and app.user.id == user.id %}
    {% if viewProfile or is_granted('MANAGE_API_KEY', user) or ownUserView %}
        {{ oro_widget_render({
            'widgetType': 'block',
            'url': path('oro_user_apigen', { id: user.id }),
            'alias': 'user-apikey-gen-widget',
            'elementFirst': true,
            'separateLayout': false
        }) }}
    {% endif %}
{% endmacro %}

<div class="widget-content">
    <div class="row-fluid form-horizontal">
        <div class="responsive-block">
            {{ ui.renderProperty('oro.user.username.label'|trans, entity.username) }}

            {% set birthday_string %}
                {{ entity.birthday is empty ? 'N/A'|trans : entity.birthday|oro_format_date }}
                {% if entity.birthday is not empty %}
                    ({{ entity.birthday|age_string({'default': 'N/A'}) }})
                {% endif %}
            {% endset %}
            {{ ui.renderProperty('oro.user.birthday.label'|trans, birthday_string) }}

            {% set emails = [_self.renderEmail(entity.email, true, entity)] %}
            {% for emailEntity in entity.emails %}
                {% set emails = emails|merge([_self.renderEmail(emailEntity.email, false, entity)]) %}
            {% endfor %}
            {{ ui.renderHtmlProperty('oro.user.emails.label'|trans, emails|join('<br />')) }}

            {{ ui.renderHtmlProperty('oro.user.phone.label'|trans, entity.phone ? ui.renderPhoneWithActions(entity.phone, entity) : null) }}

            {% if is_granted('oro_user_role_view') %}
                {% set roles = [] %}
                {% for entityRole in entity.roles %}
                    {% set roles = roles|merge([entityRole.label]) %}
                {% endfor %}
                {{ ui.renderHtmlProperty('oro.user.roles.label'|trans, roles|join('\n')|escape|nl2br) }}
            {% endif %}

            {% if is_granted('oro_user_group_view') %}
                {{ ui.renderHtmlProperty('oro.user.groups.label'|trans, entity.groups|join('<br />')) }}
            {% endif %}

            {% if is_granted('oro_business_unit_view') %}
                {{ ui.renderHtmlProperty('oro.user.business_units.label'|trans, entity.businessUnits|join('<br />')) }}
            {% endif %}

            {{ entityConfig.renderDynamicFields(entity) }}
        </div><commit_msg>BAP-16183: Field: bu.n validation issue on user profile page (#15928)<commit_after>{% import 'OroUIBundle::macros.html.twig' as ui %}
{% import 'OroTagBundle::macros.html.twig' as tag %}
{% import 'OroEntityConfigBundle::macros.html.twig' as entityConfig %}

{% macro renderEmail(emailAddress, isPrimary, entity) %}
    {% import 'OroEmailBundle::macros.html.twig' as email %}
    {% if isPrimary %}<strong>{% endif %}
        {{ email.renderEmailWithActions(emailAddress, entity) }}
    {% if isPrimary %}</strong>{% endif %}
{% endmacro %}

{% macro renderApiBlock(user, userApi, viewProfile) %}
    {% set ownUserView = app.user and user and app.user.id == user.id %}
    {% if viewProfile or is_granted('MANAGE_API_KEY', user) or ownUserView %}
        {{ oro_widget_render({
            'widgetType': 'block',
            'url': path('oro_user_apigen', { id: user.id }),
            'alias': 'user-apikey-gen-widget',
            'elementFirst': true,
            'separateLayout': false
        }) }}
    {% endif %}
{% endmacro %}

<div class="widget-content">
    <div class="row-fluid form-horizontal">
        <div class="responsive-block">
            {{ ui.renderProperty('oro.user.username.label'|trans, entity.username) }}

            {% set birthday_string %}
                {{ entity.birthday is empty ? 'N/A'|trans : entity.birthday|oro_format_date }}
                {% if entity.birthday is not empty %}
                    ({{ entity.birthday|age_string({'default': 'N/A'}) }})
                {% endif %}
            {% endset %}
            {{ ui.renderProperty('oro.user.birthday.label'|trans, birthday_string) }}

            {% set emails = [_self.renderEmail(entity.email, true, entity)] %}
            {% for emailEntity in entity.emails %}
                {% set emails = emails|merge([_self.renderEmail(emailEntity.email, false, entity)]) %}
            {% endfor %}
            {{ ui.renderHtmlProperty('oro.user.emails.label'|trans, emails|join('<br />')) }}

            {{ ui.renderHtmlProperty('oro.user.phone.label'|trans, entity.phone ? ui.renderPhoneWithActions(entity.phone, entity) : null) }}

            {% if is_granted('oro_user_role_view') %}
                {% set roles = [] %}
                {% for entityRole in entity.roles %}
                    {% set roles = roles|merge([entityRole.label]) %}
                {% endfor %}
                {{ ui.renderHtmlProperty('oro.user.roles.label'|trans, roles|join('\n')|escape|nl2br) }}
            {% endif %}

            {% if is_granted('oro_user_group_view') %}
                {{ ui.renderHtmlProperty('oro.user.groups.label'|trans, entity.groups|join('\n')|escape|nl2br) }}
            {% endif %}

            {% if is_granted('oro_business_unit_view') %}
                {{ ui.renderHtmlProperty('oro.user.business_units.label'|trans, entity.businessUnits|join('\n')|escape|nl2br) }}
            {% endif %}

            {{ entityConfig.renderDynamicFields(entity) }}
        </div>
{'fraction_non_alphanumeric': 0.16457627118644066, 'fraction_numerical': 0.0023728813559322033, 'mean_word_length': 2.458968347010551, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3228774', 'n_tokens_mistral': 1903, 'n_tokens_neox': 1710, 'n_words': 292}