{% import '@OroUI/macros.html.twig' as ui %} {% import '@OroEntityConfig/macros.html.twig' as entityConfig %} {% import '@OroUser/macros.html.twig' as U %} {% import _self as contactInfo %} {% 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 getSocialUrl(type, value) -%} {%- if value|slice(0, 5) == 'http:' or value|slice(0, 6) == 'https:' -%} {{- value -}} {%- else -%} {{- oro_social_url(type, value) -}} {%- endif -%} {%- endmacro -%}
{%- set skypeData -%} {%- if entity.skype -%} {{ entity.skype }} {{ skype_button(entity.skype) }} {%- endif -%} {%- endset -%} {%- set socialData -%} {%- if entity.twitter or entity.facebook or entity.googlePlus or entity.linkedIn -%} {%- endif -%} {%- endset -%} {{ ui.renderSwitchableHtmlProperty('oro.contact.description.label'|trans, entity.description) }} {{ ui.renderHtmlProperty('oro.contact.phones.label'|trans, entity.phones.count ? contactInfo.renderCollectionWithPrimaryElement(entity.phones, false, entity) : null) }} {{ ui.renderHtmlProperty('oro.contact.emails.label'|trans, entity.emails.count ? contactInfo.renderCollectionWithPrimaryElement(entity.emails, true, entity) : null) }} {% set faxPhone = entity.fax ? ui.renderPhone(entity.fax) : null %} {{ ui.renderHtmlProperty('oro.contact.fax.label'|trans, faxPhone, null, null, {'dir': faxPhone ? 'ltr' : null}) }} {{ ui.renderHtmlProperty('oro.contact.skype.label'|trans, skypeData) }} {{ ui.renderProperty('oro.contact.method.label'|trans, entity.method) }} {{ ui.renderHtmlProperty('oro.contact.social.label'|trans, socialData) }} {{ entityConfig.renderDynamicFields(entity) }}
{%- set accountsData -%} {%- if entity.accounts.count -%} {% set accountViewGranted = is_granted('oro_account_view') %} {%- for account in entity.accounts -%} {%- if accountViewGranted -%} {{ ui.renderEntityViewLabel(account, 'name', 'oro.account.entity_label') }} {%- else -%} {{ ui.renderEntityViewLabel(account, 'name') }} {%- endif -%} {% if not loop.last %}, {% endif %} {%- endfor -%} {%- endif -%} {%- endset -%} {%- set assignedToData -%} {%- if entity.assignedTo -%} {{ U.render_user_name(entity.assignedTo) }} {{ U.user_business_unit_name(entity.assignedTo) }} {%- endif -%} {%- endset -%} {{ ui.renderProperty('oro.contact.job_title.label'|trans, entity.jobTitle) }} {{ ui.renderHtmlProperty('oro.contact.accounts.label'|trans, accountsData) }} {{ ui.renderProperty('oro.contact.birthday.label'|trans, ui.render_birthday(entity.birthday)) }} {{ ui.renderProperty('oro.contact.gender.label'|trans, oro_gender(entity.gender)) }} {{ ui.renderProperty('oro.contact.source.label'|trans, entity.source) }} {{ ui.renderHtmlProperty('oro.contact.assigned_to.label'|trans, assignedToData) }} {{ ui.renderHtmlProperty( 'oro.contact.reports_to.label'|trans, ui.entityViewLink(entity.reportsTo, entity.reportsTo|oro_format_name, 'oro_contact_view') ) }} {% if entity.groups.count or feature_resource_enabled('Oro\\Bundle\\ContactBundle\\Entity\\Group', 'entities') %} {{ ui.renderProperty('oro.contact.groups.label'|trans, entity.groups.count ? entity.groupLabels|join(', ') : null) }} {% endif %}