{% extends '@OroUI/actions/update.html.twig' %} {% oro_title_set({ params : { "%email%": entity.email|default('N/A'|trans), "%entityName%": 'oro.customer.customeruser.entity_label'|trans } }) %} {% if saveFormAction is defined %} {% set formAction = path(saveFormAction.route, saveFormAction.parameters) %} {% else %} {% set formAction = entity.id ? path('oro_customer_customer_user_update', { 'id': entity.id }) : path('oro_customer_customer_user_create') %} {% endif %} {% block navButtons %} {% import '@OroUI/macros.html.twig' as UI %} {{ parent() }} {{ UI.cancelButton(path('oro_customer_customer_user_index')) }} {% set html = '' %} {% if is_granted('oro_customer_customer_user_view') %} {% set html = html ~ UI.saveAndCloseButton({ 'route' : 'oro_customer_customer_user_view', 'params' : {'id': '$id'} }) %} {% endif %} {% if is_granted('oro_customer_customer_user_update') %} {% set html = html ~ UI.saveAndStayButton({ 'route' : 'oro_customer_customer_user_update', 'params': {'id': '$id'} }) %} {% endif %} {% if returnAction is defined and is_granted(returnAction.aclRole) %} {% set html = html ~ UI.saveAndReturnButton({ 'route': returnAction.route, 'params': returnAction.parameters }) %} {% endif %} {{ UI.dropdownSaveButton({'html': html}) }} {% endblock navButtons %} {% block pageHeader %} {% if entity.id %} {% set breadcrumbs = { 'entity': entity, 'indexPath': path('oro_customer_customer_user_index'), 'indexLabel': 'oro.customer.customeruser.entity_plural_label'|trans, 'entityTitle': entity.email|default('N/A'|trans) } %} {{ parent() }} {% else %} {% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'oro.customer.customeruser.entity_label'|trans}) %} {% include '@OroUI/page_title_block.html.twig' with { title: title } %} {% endif %} {% endblock pageHeader %} {% block stats %}
  • {{ 'oro.ui.created_at'|trans }}: {{ entity.createdAt ? entity.createdAt|oro_format_datetime : 'N/A' }}
  • {{ 'oro.ui.updated_at'|trans }}: {{ entity.updatedAt ? entity.updatedAt|oro_format_datetime : 'N/A' }}
  • {{ 'oro.customer.customeruser.last_login.label'|trans }}: {{ entity.lastLogin ? entity.lastLogin|oro_format_datetime : 'N/A' }}
  • {{ 'oro.customer.customeruser.login_count.label'|trans }}: {{ entity.loginCount|default(0) }}
  • {% endblock stats %} {% block content_data %} {% set id = 'customer-user-edit' %} {% set roleWidgetAlias = 'oro_customer_customer_user_role' %} {% set customerFormOptions = { customerUserId: entity.id|default(null), customerFormId: '#' ~ form.customer.vars.id, widgetAlias: roleWidgetAlias, } %} {% set customerForm %}
    {{ form_row(form.customer) }}
    {% endset %} {% set formRows = [ form_row(form.enabled), form_row(form.namePrefix), form_row(form.firstName), form_row(form.middleName), form_row(form.lastName), form_row(form.nameSuffix), form_row(form.email), form_row(form.birthday), form_widget(form.plainPassword, { 'attr': {'class': 'password control-group-container'} }), customerForm, form_row(form.salesRepresentatives), form_row(form.isGuest), ] %} {% if form.passwordGenerate is defined %} {% set formRows = formRows|merge([ form_row(form.passwordGenerate, { 'attr': {'class': 'password-trigger'} }) ]) %} {% endif %} {% if form.sendEmail is defined %} {% set formRows = formRows|merge([ form_row(form.sendEmail) ]) %} {% endif %} {% set subblocks = [{ 'title': '', 'data': formRows }] %} {% if is_granted('oro_customer_customer_user_address_update') %} {% set subblocks = subblocks|merge([{ 'title': 'oro.customer.sections.addresses'|trans, 'data': [ form_widget(form.addresses), ] }]) %} {% endif %} {% set dataBlocks = [{ 'title': 'oro.customer.sections.general'|trans, 'subblocks': subblocks }] %} {% set dataBlocks = dataBlocks|merge(oro_form_additional_data(form, 'oro.customer.sections.additional'|trans)) %} {% set hasRoles = form.userRoles is defined %} {% if hasRoles %} {# Mark roles field as rendered, because it rendered by oro_widget_render #} {% do form.userRoles.setRendered %} {% set userRoles %} {% set widgetOptions = {} %} {% set widgetUrl = 'oro_customer_customer_user_roles' %} {% if entity.id %} {% set widgetOptions = widgetOptions|merge({customerUserId: entity.id}) %} {% endif %} {% if entity.customer and entity.customer.id %} {% set widgetOptions = widgetOptions|merge({customerId: entity.customer.id}) %} {% endif %} {% if form.userRoles.vars.errors|length %} {% set widgetOptions = widgetOptions|merge({ error: (form.userRoles.vars.errors|first).message }) %} {% endif %} {{ oro_widget_render({ 'widgetType': 'block', 'url': path(widgetUrl, widgetOptions), 'alias': roleWidgetAlias }) }} {% endset %} {% set title = 'oro.customer.customeruser.roles.label'|trans %} {% set dataBlocks = dataBlocks|merge( [{ 'title': title, 'subblocks': [ { 'title': '', 'data': [userRoles] } ] }] ) %} {% endif %} {% set data = { 'formErrors': form_errors(form), 'dataBlocks': dataBlocks }%}
    {{ parent() }}
    {% endblock content_data %}