{% extends 'OroUIBundle:actions:view.html.twig' %}
{% import 'OroUIBundle::macros.html.twig' as macros %}
{% import 'OroAddressBundle::macros.html.twig' as address %}
{% oro_title_set({params : {"%order.incrementId%": entity.incrementId} }) %}
{% block pageHeader %}
{% set breadcrumbs = {
'entity': entity,
'indexPath': path('orocrm_magento_order_index'),
'indexLabel': 'orocrm.magento.order.entity_plural_label'|trans,
'entityTitle': 'orocrm.magento.entity_number'|trans({'%entityName%': 'orocrm.magento.order.entity_label'|trans, '%entityNumber%': entity.incrementId})
} %}
{{ parent() }}
{% endblock pageHeader %}
{% block navButtons %}
{{ UI.button({
'path': path('orocrm_magento_order_actualize', {'id': entity.id}),
'label': 'orocrm.magento.order.refresh_label'|trans,
'title': 'orocrm.magento.order.refresh_label'|trans,
'iCss': 'icon-refresh'
}) }}
{% endblock navButtons %}
{% block content_data %}
{% set generalSubblocks = [] %}
{% set orderInformationWidget %}
{{ oro_widget_render({
'widgetType': 'block',
'url': path('orocrm_magento_order_widget_info', {id: entity.id}),
'title': 'orocrm.magento.order_information'|trans
}) }}
{% endset %}
{% set generalSubblocks = generalSubblocks|merge([{'data' : [orderInformationWidget] }]) %}
{% if entity.customer and resource_granted('orocrm_magento_customer_view') %}
{% set customerInformationWidget %}
{{ oro_widget_render({
'widgetType': 'block',
'url': path('orocrm_magento_customer_info', {id: entity.customer.id}),
'title': 'orocrm.magento.customer_information'|trans
}) }}
{% endset %}
{% set generalSubblocks = generalSubblocks|merge([{'data' : [customerInformationWidget] }]) %}
{% endif %}
{% set dataBlocks = [
{
'title': 'orocrm.magento.general_information'|trans,
'class': 'active',
'subblocks': generalSubblocks
}
] %}
{% if resource_granted('orocrm_magento_cart_view') %}
{% set orderItemsWidget %}
{{ oro_widget_render({
'widgetType': 'block',
'url': path('orocrm_magento_order_widget_items', {id: entity.id})
}) }}
{% endset %}
{% set dataBlocks = dataBlocks|merge([
{
'title': 'orocrm.magento.order.items.label'|trans,
'subblocks': [
{'data' : [orderItemsWidget] }
]
}
]) %}
{% endif %}
{% set relatedInformation = [] %}
{% if resource_granted('oro_email_view') %}
{% set emailIds = [] %}
{% for email in entity.getRelatedEmails %}
{% set emailIds = emailIds|merge([email.id]) %}
{% endfor %}
{% if emailIds is empty %}
{% set emailIds = [0] %}
{% endif %}
{% set orderEmailsWidget %}
{{ oro_widget_render({
'widgetType': 'block',
'url': path('oro_email_widget_base_emails', {'emailIds': emailIds}),
'title': 'oro.email.entity_plural_label'|trans,
'alias': 'cart_emails'
}) }}
{% endset %}
{% set relatedInformation = relatedInformation|merge([
{'data' : [orderEmailsWidget]}
]) %}
{% endif %}
{% if resource_granted('orocrm_call_view') %}
{% set callIds = [] %}
{% for call in entity.getRelatedCalls %}
{% set callIds = callIds|merge([call.id]) %}
{% endfor %}
{% if callIds is empty %}
{% set callIds = [0] %}
{% endif %}
{% set orderCallsWidget %}
{{ oro_widget_render({
'widgetType': 'block',
'url': path('orocrm_call_base_widget_calls', {'callIds': callIds}),
'title': 'orocrm.call.entity_plural_label'|trans,
'alias': 'cart_calls'
}) }}
{% endset %}
{% set relatedInformation = relatedInformation|merge([
{'data' : [orderCallsWidget]}
]) %}
{% endif %}
{% if relatedInformation is not empty %}
{% set dataBlocks = dataBlocks|merge([
{
'title': 'orocrm.magento.communications'|trans,
'subblocks': relatedInformation
}
]) %}
{% endif %}
{% set id = 'magentoOrderView' %}
{% set data = {'dataBlocks': dataBlocks} %}
{{ parent() }}
{% endblock content_data %}