{% extends '@OroUI/actions/view.html.twig' %}
{% import '@OroDataGrid/macros.html.twig' as dataGrid %}
{% oro_title_set({params : {"%identifier%": entity.identifier }}) %}
{% block pageHeader %}
{% set breadcrumbs = {
'entity': entity,
'indexPath': path('oro_order_index'),
'indexLabel': 'oro.order.entity_plural_label'|trans,
'entityTitle': 'oro.order.navigation.view'|trans({
'%identifier%': entity.identifier|default('N/A'|trans)
})
} %}
{{ parent() }}
{% endblock pageHeader %}
{% block content_data %}
{% import '@OroUI/macros.html.twig' as UI %}
{% set orderInformationWidget %}
{{ oro_widget_render({
'widgetType': 'block',
'title': 'oro.order.widgets.order_information'|trans,
'url': path('oro_order_info', {id: entity.id})
}) }}
{% endset %}
{% set generalSectionBlocks = [
{'data' : [
placeholder('view_general_section_before', {'entity': entity}),
orderInformationWidget,
placeholder('view_general_section_after', {'entity': entity})
]}
] %}
{% set dataBlocks = [
{
'title': 'oro.order.sections.general'|trans,
'priority': -200,
'subblocks': generalSectionBlocks
}
] %}
{% set orderTotals %}
{% include '@OroPricing/Totals/totals.html.twig' with {
pageComponent: 'oroorder/js/app/components/totals-component',
options: {totals: totals}
} only %}
{% endset %}
{% set shippingInformation %}
{%- if entity.shippingMethod and entity.shippingMethodType -%}
{% set shippingMethodLabel = oro_order_shipping_method_label(entity.shippingMethod, entity.shippingMethodType) %}
{{ UI.renderProperty('oro.order.shipping_method.label'|trans, shippingMethodLabel) }}
{%- endif -%}
{% if entity.shippingCost is not null %}
{{ UI.renderProperty('oro.order.shipping_cost.label'|trans,
entity.shippingCost.value|oro_format_currency({'currency': entity.shippingCost.currency})) }}
{% else %}
{{ UI.renderProperty('oro.order.shipping_cost.label'|trans, 'N/A'|trans) }}
{% endif %}
{% endset %}
{% set shippingSubBlocks = [{'data' : [shippingInformation]}] %}
{% if entity.shippingTrackings is defined %}
{% set shippingSubBlocks = shippingSubBlocks|merge([{'data' : [
oro_order_get_template_content('@OroOrder/Order/shipping_tracking.html.twig', {entity: entity})
]}]) %}
{% endif %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.order_line_items'|trans,
'priority': -150,
'subblocks': [{'data' : [dataGrid.renderGrid('order-line-items-grid', { order_id: entity.id })], spanClass: 'order-line-items'}]
}]) %}
{% if entity.subOrders is not empty %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.sub_orders'|trans,
'priority': -150,
'subblocks': [{'data' : [dataGrid.renderGrid('suborders-grid', { order_id: entity.id })], spanClass: 'order-suborders'}]
}]) %}
{% endif %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.shipping_information'|trans,
'priority': -100,
'subblocks': shippingSubBlocks
}]) %}
{% set dataBlocks = dataBlocks|merge({
'discounts': {
'title': 'oro.order.sections.discounts'|trans,
'priority': -75,
'subblocks': [{'data' : [
oro_order_get_template_content('@OroOrder/Discount/order_discount_view_collection.html.twig', {entity: entity})
]}]
}
}) %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.order_totals'|trans,
'priority': -50,
'subblocks': [{'data' : [orderTotals]}]
}]) %}
{% if is_granted('VIEW_PAYMENT_HISTORY', entity) %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.payment_history'|trans,
'priority': -20,
'subblocks': [{'data' : [
dataGrid.renderGrid('order-payment-transactions-grid', { order_id: entity.id })
]}]
}]) %}
{% if entity.subOrders is not empty %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.sub_orders_payment_history'|trans,
'priority': -20,
'subblocks': [{'data' : [
oro_order_get_template_content('@OroOrder/Order/Datagrid/subOrderPaymentTransactions.html.twig', {entity: entity})
]}]
}]) %}
{% endif %}
{% endif %}
{% set id = 'order-view' %}
{% set data = {'dataBlocks': dataBlocks} %}
{{ parent() }}
{% endblock content_data %}