{% extends 'OroUIBundle:actions:update.html.twig' %}
{% import 'OroDataGridBundle::macros.html.twig' as dataGrid %}
{% form_theme form with ['OroCRMContactBundle:Include:fields.html.twig', 'OroFormBundle:Form:fields.html.twig', 'OroTagBundle:Form:fields.html.twig'] %}
{% set fullname = entity|oro_format_name|default('N/A') %}
{% oro_title_set({ params : {"%contact.name%": fullname} }) %}
{% set gridName = 'contact-accounts-grid' %}
{% set formAction = form.vars.value.id ? path('orocrm_contact_update', { 'id': form.vars.value.id }) : path('orocrm_contact_create') %}
{% block navButtons %}
{% if form.vars.value.id and resource_granted('DELETE', form.vars.value) %}
{{ UI.deleteButton({
'dataUrl': path('oro_api_delete_contact', {'id': form.vars.value.id}),
'dataRedirect': path('orocrm_contact_index'),
'aCss': 'no-hash remove-button',
'id': 'btn-remove-contact',
'dataId': form.vars.value.id,
'entity_label': 'orocrm.contact.entity_label'|trans,
}) }}
{{ UI.buttonSeparator() }}
{% endif %}
{{ UI.cancelButton(path('orocrm_contact_index')) }}
{% set html = UI.saveAndCloseButton() %}
{% if form.vars.value.id or resource_granted('orocrm_contact_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_contact_index'),
'indexLabel': 'orocrm.contact.entity_plural_label'|trans,
'entityTitle': fullname
}
%}
{% set avatar = oro_configured_image_url(form.vars.value, 'picture') %}
{{ parent() }}
{% else %}
{% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'orocrm.contact.entity_label'|trans}) %}
{% include 'OroUIBundle::page_title_block.html.twig' with { title: title } %}
{% endif %}
{% endblock pageHeader %}
{% block stats %}
{% include 'OroCRMContactBundle:Contact:headerStats.html.twig' with {'entity': entity} %}
{% endblock stats %}
{% block content_data %}
{% set id = 'contact-profile' %}
{% set dataBlocks = [{
'title': 'General'|trans,
'class': 'active',
'subblocks': [
{
'title': 'Contact Information'|trans,
'data': [
form_row(form.namePrefix),
form_row(form.firstName),
form_row(form.middleName),
form_row(form.lastName),
form_row(form.nameSuffix),
form_row(form.description),
form_row(form.assignedTo),
form_row(form.reportsTo),
form_row(form.emails),
form_row(form.phones),
form_row(form.fax),
form_row(form.skype),
form_row(form.method),
form_row(form.twitter),
form_row(form.facebook),
form_row(form.googlePlus),
form_row(form.linkedIn),
form_row(form.jobTitle),
form_row(form.birthday),
form_row(form.gender),
form_row(form.source),
form_row(form.tags),
form_row(form.picture)
]
},
{
'title': 'orocrm.contact.addresses.label'|trans,
'data': [
form_widget(form.addresses),
]
},
]
}]
%}
{% 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.groups is defined and form.groups.children|length > 0 %}
{% set dataBlocks = dataBlocks|merge([{
'title' : 'orocrm.contact.groups.label'|trans,
'subblocks':
[
{
'title' : '',
'useSpan': false,
'data' : [
form_row(form.groups, { attr: { class: 'horizontal' } })
]
}
]
}]) %}
{% endif %}
{% set dataBlocks = dataBlocks|merge([{
'title' : 'orocrm.contact.accounts.label'|trans,
'subblocks':
[
{
'title' : null,
'useSpan': false,
'data' : [
form_widget(form.appendAccounts, {'id': 'appendAccounts'}),
form_widget(form.removeAccounts, {'id': 'removeAccounts'}),
dataGrid.renderGrid(gridName, { contact: form.vars.value.id }, { cssClass: 'inner-grid' })
]
}
]
}]) %}
{% set data = {
'formErrors': form_errors(form)? form_errors(form) : null,
'dataBlocks': dataBlocks,
} %}
{{ parent() }}
{% endblock content_data %}