{% extends '@OroUI/actions/update.html.twig' %}
{% import '@OroDataGrid/macros.html.twig' as dataGrid %}
{% if form.vars.value.id %}
{% oro_title_set({params : {"%group.label%": form.vars.value.label} }) %}
{% endif %}
{% set gridName = 'contact-group-contacts-grid' %}
{% set formAction = form.vars.value.id ? path('oro_contact_group_update', { id: form.vars.value.id }) : path('oro_contact_group_create') %}
{% 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_contactgroup', {'id': form.vars.value.id}),
'dataRedirect': path('oro_contact_group_index'),
'aCss': 'no-hash remove-button',
'id': 'btn-remove-contact-group',
'dataId': form.vars.value.id,
'entity_label': 'oro.contact.group.entity_label'|trans,
}) }}
{{ UI.buttonSeparator() }}
{% endif %}
{{ UI.cancelButton(path('oro_contact_group_index')) }}
{% set html = UI.saveAndCloseButton({
'route': 'oro_contact_group_index'
}) %}
{% if is_granted('oro_contact_group_create') %}
{% set html = html ~ UI.saveAndNewButton({
'route': 'oro_contact_group_create'
}) %}
{% endif %}
{% if form.vars.value.id or is_granted('oro_contact_group_update') %}
{% set html = html ~ UI.saveAndStayButton({
'route': 'oro_contact_group_update',
'params': {'id': '$.id'}
}) %}
{% endif %}
{{ UI.dropdownSaveButton({'html': html}) }}
{% endblock navButtons %}
{% block pageHeader %}
{% if form.vars.value.id %}
{% set breadcrumbs = {
'entity': form.vars.value,
'indexPath': path('oro_contact_group_index'),
'indexLabel': 'oro.contact.group.entity_plural_label'|trans,
'entityTitle': form.vars.value.label|default('N/A'|trans)
}
%}
{{ parent() }}
{% else %}
{% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'oro.contact.group.entity_label'|trans}) %}
{% include '@OroUI/page_title_block.html.twig' with { title: title } %}
{% endif %}
{% endblock pageHeader %}
{% block content_data %}
{% set id = 'contact-group-profile' %}
{% set dataBlocks = [{
'title': 'General'|trans,
'subblocks': [
{
'title': 'Basic Information'|trans,
'data': [
form_row(form.label)
]
}
]
}] %}
{% if showContactsGrid %}
{% set gridParams = form.vars.value.id ? {group: form.vars.value.id} : {} %}
{% set gridData = dataGrid.renderGrid(gridName, gridParams, { cssClass: 'inner-grid' }) %}
{% set dataBlocks = dataBlocks|merge([{
'title': 'oro.contact.entity_plural_label'|trans,
'subblocks':
[
{
'title' : null,
'useSpan': false,
'data' : [
form_widget(form.appendContacts, {'id': 'groupAppendContacts'}),
form_widget(form.removeContacts, {'id': 'groupRemoveContacts'}),
gridData
]
}
]
}]) %}
{% endif %}
{% set data = {
'formErrors': form_errors(form)? form_errors(form) : null,
'dataBlocks': dataBlocks,
} %}
{{ parent() }}
{% endblock content_data %}