{% extends 'OroUIBundle:actions:update.html.twig' %}
{% form_theme form with ['OroFormBundle:Form:fields.html.twig', 'OroTagBundle:Form:fields.html.twig'] %}
{% oro_title_set({params : {"%account.name%": form.vars.value.name|default('N/A')} }) %}
{% set formAction = form.vars.value.id ? path('orocrm_account_update', { 'id': form.vars.value.id }) : path('orocrm_account_create') %}
{% block head_script %}
{{ parent() }}
{% block stylesheets %}
{{ form_stylesheet(form) }}
{% endblock %}
{% endblock %}
{% block navButtons %}
{% if form.vars.value.id and resource_granted('DELETE', form.vars.value) %}
{{ UI.deleteButton({
'dataUrl': path('oro_api_delete_account', {'id': form.vars.value.id}),
'dataRedirect': path('orocrm_account_index'),
'aCss': 'no-hash remove-button',
'dataId': form.vars.value.id,
'id': 'btn-remove-account',
'entity_label': 'orocrm.account.entity_label'|trans,
}) }}
{{ UI.buttonSeparator() }}
{% endif %}
{{ UI.cancelButton(path('orocrm_account_index')) }}
{% set html = UI.saveAndCloseButton() %}
{% if form.vars.value.id or resource_granted('orocrm_account_update') %}
{% set html = html ~ UI.saveAndStayButton() %}
{% endif %}
{{ UI.dropdownSaveButton({'html': html}) }}
{% endblock %}
{% block pageHeader %}
{% if form.vars.value.id %}
{% set breadcrumbs = {
'entity': form.vars.value,
'indexPath': path('orocrm_account_index'),
'indexLabel': 'orocrm.account.entity_plural_label'|trans,
'entityTitle': form.vars.value.name|default('N/A')
}
%}
{{ parent() }}
{% else %}
{% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'orocrm.account.entity_label'|trans}) %}
{% include 'OroUIBundle::page_title_block.html.twig' with { title: title } %}
{% endif %}
{% endblock pageHeader %}
{% block content_data %}
{% set id = 'account-profile' %}
{% set dataBlocks = [{
'title': 'General'|trans,
'class': 'active',
'subblocks': [
{
'title': 'Basic Information'|trans,
'data': [
form_row(form.name),
form_row(form.tags)
]
}
]
}] %}
{% set additionalData = [] %}
{% for child in form.children if child.vars.extra_field is defined and child.vars.extra_field %}
{% set additionalData = additionalData|merge([form_row(child)]) %}
{% endfor %}
{% if additionalData is not empty %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'Additional'|trans,
'subblocks': [{
'title': '',
'useSpan': false,
'data' : additionalData
}]
}] ) %}
{% endif %}
{% if form.contacts is defined%}
{% set dataBlocks = dataBlocks|merge([{
'title' : 'orocrm.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,
} %}
{{ parent() }}
{% endblock content_data %}