{% extends '@OroUI/actions/update.html.twig' %} {% import '@OroUI/macros.html.twig' as UI %} {% set entityId = entity.id %} {% if entityId %} {% oro_title_set({params : {"%name%": entity.rule.name} }) %} {% else %} {% oro_title_set({params : {"%entityName%": 'oro.promotion.entity_label'|trans} }) %} {% endif %} {% set formAction = entityId ? path('oro_promotion_update', { 'id': entityId }) : path('oro_promotion_create') %} {% block navButtons %} {% import '@OroUI/macros.html.twig' as UI %} {{ UI.cancelButton(path('oro_promotion_index')) }} {% set html = '' %} {% if is_granted('oro_promotion_view') %} {% set html = html ~ UI.saveAndCloseButton({ 'route' : 'oro_promotion_view', 'params' : {'id': '$id'} }) %} {% endif %} {% if entityId or is_granted('oro_promotion_update') %} {% set html = html ~ UI.saveAndStayButton({ 'route' : 'oro_promotion_update', 'params' : {'id': '$id'} }) %} {% endif %} {{ UI.dropdownSaveButton({'html': html}) }} {% endblock navButtons %} {% block pageHeader %} {% if entityId %} {% set breadcrumbs = { 'entity': entity, 'indexPath': path('oro_promotion_index'), 'indexLabel': 'oro.promotion.entity_plural_label'|trans, 'entityTitle': entity.rule.name|default('N/A'|trans) } %} {{ parent() }} {% else %} {% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'oro.promotion.entity_label'|trans}) %} {% include '@OroUI/page_title_block.html.twig' with { title: title } %} {% endif %} {% endblock pageHeader %} {% block content_data %} {% set id = 'promotion-edit' %} {% if form.rule.expression is defined%} {% set advancedConditions %} {% set collapseId = 'collapse-'|uniqid %}
{{ form_label(form.rule.expression) }}
{{ form_widget(form.rule.expression) }}
{% endset %} {% endif %} {% set dataBlocks = [ { 'title': 'oro.promotion.blocks.general'|trans, 'subblocks': [{ 'title': '', 'data': [ form.owner is defined ? form_row(form.owner) : '', form_row(form.rule.name), form_row(form.labels), form_row(form.rule.sortOrder), form_row(form.rule.enabled, {'label': 'oro.promotion.rule.enabled.label'}), form_row(form.rule.stopProcessing), form_row(form.useCoupons) ] }] }, { 'title': 'oro.promotion.blocks.discount_options'|trans, 'subblocks': [{ 'title': '', 'data': [ form_widget(form.discountConfiguration) ] }] }, { 'title': 'oro.promotion.blocks.schedules'|trans, 'subblocks': [{ 'title': '', 'data': [ form_row(form.schedules) ] }] } ] %} {% if form.scopes is defined and advancedConditions is defined %} {% set dataBlocks = dataBlocks|merge([ { 'title': 'oro.promotion.blocks.conditions'|trans, 'subblocks': [{ 'title': '', 'data': [ form_row(form.scopes), advancedConditions ] }] } ]) %} {% endif %} {% set dataBlocks = dataBlocks|merge([ { 'title': 'oro.promotion.blocks.matching_items'|trans, 'subblocks': [{ 'title': '', 'data': [ form_widget(form.productsSegment) ] }] } ]) %} {% set dataBlocks = dataBlocks|merge(oro_form_additional_data(form, 'Additional'|trans)) %} {% set data = { 'formErrors': form_errors(form), 'dataBlocks': dataBlocks }%} {{ parent() }} {% endblock content_data %}