{% extends '@OroUI/actions/update.html.twig' %} {% import '@OroDataGrid/macros.html.twig' as dataGrid %} {% form_theme form with ['@OroForm/Form/fields.html.twig'] %} {% set entityId = form.vars.value.id %} {% oro_title_set({params : { "%business_unit.name%": form.vars.value.name } }) %} {% set gridName = 'bu-update-users-grid' %} {% set formAction = entityId ? path('oro_business_unit_update', { 'id': entityId}) : path('oro_business_unit_create') %} {% block head_script %} {{ parent() }} {% set listenerParameters = { 'columnName': 'has_business_unit', 'selectors': { 'included': '#businessUnitAppendUsers', 'excluded': '#businessUnitRemoveUsers' } } %} {% endblock %} {% block navButtons %} {% import '@OroUI/macros.html.twig' as UI %} {% if entityId and oro_get_business_units_count() > 1 and is_granted('DELETE', form.vars.value) %} {{ UI.deleteButton({ 'dataUrl': path('oro_api_delete_businessunit', {'id': entityId}), 'dataRedirect': path('oro_business_unit_index'), 'aCss': 'no-hash remove-button', 'dataId': entityId, 'id': 'btn-remove-business_unit', 'entity_label': 'oro.organization.businessunit.entity_label'|trans, 'disabled': not allow_delete }) }} {{ UI.buttonSeparator() }} {% endif %} {{ UI.cancelButton(path('oro_business_unit_index')) }} {% set html = UI.saveAndCloseButton({ 'route': 'oro_business_unit_view', 'params': {'id': '$id'} }) %} {% if is_granted('oro_business_unit_create') %} {% set html = html ~ UI.saveAndNewButton({ 'route': 'oro_business_unit_create' }) %} {% endif %} {% if form.vars.value.id or is_granted('oro_business_unit_update') %} {% set html = html ~ UI.saveAndStayButton({ 'route': 'oro_business_unit_update', 'params': {'id': '$id'} }) %} {% endif %} {{ UI.dropdownSaveButton({'html': html}) }} {% endblock navButtons %} {% block pageHeader %} {% if entityId %} {% set breadcrumbs = { 'entity': form.vars.value, 'indexPath': path('oro_business_unit_index'), 'indexLabel': 'oro.organization.businessunit.entity_plural_label'|trans, 'entityTitle': form.vars.value.name } %} {{ parent() }} {% else %} {% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'oro.organization.businessunit.entity_label'|trans}) %} {% include '@OroUI/page_title_block.html.twig' with { title: title } %} {% endif %} {% endblock pageHeader %} {% block content_data %} {% set id = 'business_unit-profile' %} {% set dataBlocks = [{ 'title': 'General'|trans, 'class': 'active', 'subblocks': [{ 'title': '', 'data': [ form_widget(form.appendUsers, {'id': 'businessUnitAppendUsers'}), form_widget(form.removeUsers, {'id': 'businessUnitRemoveUsers'}), form_row(form.name), form_row(form.parentBusinessUnit), form_row(form.phone), form_row(form.website), form_row(form.email), form_row(form.fax), ] }] }] %} {% set dataBlocks = dataBlocks|merge(oro_form_additional_data(form, 'Additional'|trans)) %} {% set dataBlocks = dataBlocks|merge([{ 'title' : 'oro.organization.businessunit.users.label'|trans, 'subblocks': [{ 'title' : null, 'useSpan': false, 'data' : [dataGrid.renderGrid(gridName, {business_unit_id: entityId}, { cssClass: 'inner-grid' })] }] }] ) %} {% set data = { 'formErrors': form_errors(form)? form_errors(form) : null, 'dataBlocks': dataBlocks } %} {{ parent() }} {% endblock content_data %}