{% macro renderCollectionWithPrimaryElement(collection, isEmail, entity) %} {% import '@OroUI/macros.html.twig' as ui %} {% import '@OroEmail/macros.html.twig' as email %} {% set primaryElement = null %} {% set elements = [] %} {% for element in collection %} {% if element.primary %} {% set primaryElement = element %} {% else %} {% set elements = elements|merge([element]) %} {% endif %} {% endfor %} {% if primaryElement %} {% set elements = [primaryElement]|merge(elements) %} {% endif %} {% endmacro %} {% macro render_customer_info(entity) %} {% import '@OroUI/macros.html.twig' as ui %} {% import _self as sales %} {% set customer = entity.customerAssociation and entity.customerAssociation.customerTarget ? entity.customerAssociation.customerTarget : null %} {% set account = entity.customerAssociation and entity.customerAssociation.account ? entity.customerAssociation.account : null %} {%- set accountView = sales.entity_view(account) -%} {{ ui.renderHtmlProperty('oro.sales.opportunity.customer.label'|trans, accountView, entity, 'customer') }} {% if customer is not empty %}
{{ ui.renderHtmlProperty(oro_entity_config_value(oro_class_name(customer), 'label')|trans, sales.entity_view(customer), entity, 'customer') }}
{% endif %} {% endmacro %} {%- macro entity_view(entity) -%} {%- import '@OroUI/macros.html.twig' as ui -%} {%- set entityName = entity ? entity|oro_format_name : '' -%} {%- if (entity and is_granted('VIEW', entity)) -%} {{ ui.renderUrl(oro_entity_object_view_link(entity), entityName) }} {%- else -%} {{ entityName }} {%- endif -%} {%- endmacro -%}