{% extends '@OroUI/actions/view.html.twig' %} {% set hasGrantedNameView = is_granted('VIEW', entity, 'name') %} {% oro_title_set({params : {"%account.name%": hasGrantedNameView ? entity.name|default('N/A'|trans) : 'view %fieldName% not granted'|trans({'%fieldName%': 'oro.account.name.label'|trans}) }}) %} {% block navButtons %} {% import '@OroUI/macros.html.twig' as UI %} {% if is_granted('EDIT', entity) %} {{ UI.editButton({ 'path': path('oro_account_update', {'id': entity.id}), 'entity_label': 'oro.account.entity_label'|trans }) }} {% endif %} {% if is_granted('DELETE', entity) %} {{ UI.deleteButton({ 'dataUrl': path('oro_api_delete_account', {'id': entity.id}), 'dataRedirect': path('oro_account_index'), 'aCss': 'no-hash remove-button', 'dataId': entity.id, 'id': 'btn-remove-account', 'dataMessage': 'oro.ui.delete_confirm_cascade'|trans({ '%entity_label%' : 'oro.account.entity_label'|trans }), }) }} {% endif %} {% endblock navButtons %} {% block pageHeader %} {% import '@OroUI/macros.html.twig' as UI %} {% set breadcrumbs = { 'entity': entity, 'indexPath': path('oro_account_index'), 'indexLabel': 'oro.account.entity_plural_label'|trans, 'rawEntityTitle': not hasGrantedNameView, 'entityTitle': hasGrantedNameView ? entity.name|default('N/A'|trans) : UI.renderDisabledLabel('view %fieldName% not granted'|trans({'%fieldName%': 'oro.account.name.label'|trans})) } %} {{ parent() }} {% endblock pageHeader %} {% block content_data %} {% set accountInformationWidget %} {{ oro_widget_render({ 'widgetType': 'block', 'title': 'oro.account.widgets.account_information'|trans, 'url': path('oro_account_widget_info', {id: entity.id}) }) }} {% endset %} {% set generalSectionBlocks = [{'data' : [accountInformationWidget]}]%} {% if is_granted('oro_contact_view') and is_granted('VIEW', entity, 'contacts') %} {% set contactsInformationWidget %}
{% endset %} {% set generalSectionBlocks = generalSectionBlocks|merge( [{'data': [contactsInformationWidget]}] ) %} {% endif %} {% set dataBlocks = [ { 'title': 'oro.account.sections.general'|trans, 'subblocks': generalSectionBlocks } ] %} {# Render account channels #} {% for channel in channels %} {%- set accountChannelInfoSection -%} {% apply spaceless %} {% set placeHolderName = 'oro_account_channel_info_' ~ channel.channelType %} {{ placeholder(placeHolderName, {'accountId': entity.id, 'channelId': channel.id}) }} {% endapply %} {%- endset -%} {% if accountChannelInfoSection|striptags|trim is not empty %} {% set dataBlocks = dataBlocks|merge([ { 'title': channel.name, 'priority': 255, 'subblocks': [ {'data' : [accountChannelInfoSection]} ] } ]) %} {% endif %} {% endfor %} {# Render Website Activity Section if there is at least one applicable customer #} {% set websiteActivity %} {%- placeholder oro_website_activity with {'customers': customers, 'byChannel': true} -%} {% endset %} {% if websiteActivity is not empty %} {% set dataBlocks = dataBlocks|merge([ { 'title': 'oro.account.sections.website_activity'|trans, 'priority': 1050, 'subblocks': [ {'data' : [websiteActivity]} ] } ]) %} {% endif %} {% set id = 'accountView' %} {% set data = {'dataBlocks': dataBlocks} %} {{ parent() }} {% endblock content_data %}