{% extends '@OroUI/actions/update.html.twig' %} {% form_theme form with ['@OroForm/Form/fields.html.twig'] %} {% set name = 'N/A' %} {% if entity.name %} {% set name = is_granted('VIEW', entity, 'name') ? entity.name|default('N/A'|trans) : 'view %fieldName% not granted'|trans({'%fieldName%': 'oro.account.name.label'|trans}) %} {% endif %} {% oro_title_set({params : {"%account.name%": name }}) %} {% set formAction = form.vars.value.id ? path('oro_account_update', { 'id': form.vars.value.id }) : path('oro_account_create') %} {% block head_script %} {{ parent() }} {% block stylesheets %} {{ form_stylesheet(form) }} {% endblock %} {% endblock %} {% block navButtons %} {% import '@OroUI/macros.html.twig' as UI %} {% if form.vars.value.id and is_granted('DELETE', form.vars.value) %} {{ UI.deleteButton({ 'dataUrl': path('oro_api_delete_account', {'id': form.vars.value.id}), 'dataRedirect': path('oro_account_index'), 'aCss': 'no-hash remove-button', 'dataId': form.vars.value.id, 'id': 'btn-remove-account', 'entity_label': 'oro.account.entity_label'|trans, }) }} {{ UI.buttonSeparator() }} {% endif %} {{ UI.cancelButton(path('oro_account_index')) }} {% set html = UI.saveAndCloseButton({ 'route': 'oro_account_view', 'params': {'id': '$id'} }) %} {% if is_granted('oro_account_create') %} {% set html = html ~ UI.saveAndNewButton({ 'route': 'oro_account_create' }) %} {% endif %} {% if form.vars.value.id or is_granted('oro_account_update') %} {% set html = html ~ UI.saveAndStayButton({ 'route': 'oro_account_update', 'params': {'id': '$id'} }) %} {% endif %} {{ UI.dropdownSaveButton({'html': html}) }} {% endblock %} {% block pageHeader %} {% import '@OroUI/macros.html.twig' as UI %} {% if form.vars.value.id %} {% set name = 'N/A' %} {% if form.vars.value.name %} {% set name = is_granted('VIEW', form.vars.value, 'name') ? form.vars.value.name|default('N/A'|trans) : UI.renderDisabledLabel('view %fieldName% not granted'|trans({'%fieldName%': 'oro.account.name.label'|trans})) %} {% endif %} {% set breadcrumbs = { 'entity': form.vars.value, 'indexPath': path('oro_account_index'), 'indexLabel': 'oro.account.entity_plural_label'|trans, 'entityTitle': name } %} {{ parent() }} {% else %} {% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'oro.account.entity_label'|trans}) %} {% include '@OroUI/page_title_block.html.twig' with { title: title } %} {% endif %} {% endblock pageHeader %} {% block content_data %} {% set id = 'account-profile' %} {% set subBlockData = [] %} {% if is_granted('EDIT', entity, 'name') %} {% set subBlockData = subBlockData|merge([form_row(form.name)]) %} {% endif %} {% set dataBlocks = [{ 'title': 'General'|trans, 'subblocks': [ { 'title': 'Basic Information'|trans, 'data': subBlockData } ] }] %} {% set dataBlocks = dataBlocks|merge(oro_form_additional_data(form, 'Additional'|trans)) %} {% if form.contacts is defined%} {% set dataBlocks = dataBlocks|merge([{ 'title' : 'oro.account.contacts.label'|trans, 'subblocks': [{ 'title' : null, 'useSpan': false, 'data' : [ form_widget(form.default_contact), form_widget(form.contacts)] }] }] ) %} {% endif %} {% set data = { 'formErrors': form_errors(form)? form_errors(form) : null, 'dataBlocks': dataBlocks, } %}