{% extends 'OroUIBundle:actions:view.html.twig' %}
{% import 'OroDataGridBundle::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 %}
{% 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,
'class': 'active',
'priority': -200,
'subblocks': generalSectionBlocks
}
] %}
{% set orderTotals %}
{% include 'OroPricingBundle:Totals:totals.html.twig' with {
pageComponent: 'oroorder/js/app/components/totals-component',
options: {totals: totals}
} only %}
{% endset %}
{% set shippingInformation %}
{%- if entity.shippingMethodType -%}
{% set shippingMethodLabel = get_shipping_method_label(entity.shippingMethod) %}
{%- if shippingMethodLabel -%}
{{ UI.renderHtmlProperty('oro.order.shipping_method.label'|trans,
get_shipping_method_label(entity.shippingMethod)|trans ~
get_shipping_method_type_label(entity.shippingMethod, entity.shippingMethodType)|trans) }}
{%- endif -%}
{{ UI.renderHtmlProperty('oro.order.shipping_method.label'|trans,
get_shipping_method_type_label(entity.shippingMethod, entity.shippingMethodType)|trans) }}
{%- endif -%}
{% if entity.shippingCost is not null %}
{{ UI.renderHtmlProperty('oro.order.shipping_cost.label'|trans,
entity.shippingCost.value|oro_format_currency({'currency': entity.shippingCost.currency})) }}
{% else %}
{{ UI.renderHtmlProperty('oro.order.shipping_cost.label'|trans, 'N/A'|trans) }}
{% endif %}
{% endset %}
{% set paymentTerm %}
{% if entity.paymentTerm is not empty %}
{% if resource_granted('VIEW', entity.paymentTerm) %}
{% set paymentTermView = UI.renderUrl(path('oro_payment_term_view', {'id': entity.paymentTerm.id}), entity.paymentTerm.label) %}
{% else %}
{% set paymentTermView = entity.paymentTerm.label|escape %}
{% endif %}
{{ UI.renderHtmlProperty('oro.order.payment_term.label'|trans, paymentTermView) }}
{% else %}
{{ UI.renderHtmlProperty('oro.order.payment_term.label'|trans, 'N/A'|trans) }}
{% endif %}
{% endset %}
{% 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'}]
}]) %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.shipping_information'|trans,
'priority': -100,
'subblocks': [{'data' : [shippingInformation]}]
}]) %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.form.payment.label'|trans,
'priority': -75,
'subblocks': [{'data' : [paymentTerm]}]
}]) %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.order.sections.order_totals'|trans,
'priority': -50,
'subblocks': [{'data' : [orderTotals]}]
}]) %}
{% set id = 'order-view' %}
{% set data = {'dataBlocks': dataBlocks} %}
{{ parent() }}
{% endblock content_data %}