{% extends '@OroUI/actions/update.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.sales.opportunity.name.label'|trans}) %} {% endif %} {% oro_title_set({params : {"%opportunity.name%": name} }) %} {% set pageComponent = { 'module': 'oroui/js/app/components/view-component', 'options': {'view': 'orosales/js/app/views/update-page-view'}, 'layout': 'separate' } %} {% if saveFormAction is defined %} {% set formAction = path(saveFormAction.route, saveFormAction.parameters) %} {% else %} {% set formAction = form.vars.value.id ? path('oro_sales_opportunity_update', { 'id': form.vars.value.id }) : path('oro_sales_opportunity_create') %} {% endif %} {% 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_opportunity', {'id': form.vars.value.id}), 'dataRedirect': path('oro_sales_opportunity_index'), 'aCss': 'no-hash remove-button', 'id': 'btn-remove-oppotunity', 'dataId': form.vars.value.id, 'entity_label': 'oro.sales.opportunity.entity_label'|trans, }) }} {{ UI.buttonSeparator() }} {% endif %} {{ UI.cancelButton(path('oro_sales_opportunity_index')) }} {% set html = UI.saveAndCloseButton({ 'route': 'oro_sales_opportunity_view', 'params': {'id': '$id'} }) %} {% if is_granted('oro_sales_opportunity_create') %} {% set html = html ~ UI.saveAndNewButton({ 'route': 'oro_sales_opportunity_create' }) %} {% endif %} {% if form.vars.value.id or is_granted('oro_sales_opportunity_update') %} {% set html = html ~ UI.saveAndStayButton({ 'route': 'oro_sales_opportunity_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 %} {% block pageHeader %} {% import '@OroUI/macros.html.twig' as UI %} {% if form.vars.value.id %} {% set name = 'N/A' %} {% if entity.name %} {% set name = is_granted('VIEW', entity, 'name') ? entity.name|default('N/A'|trans) : UI.renderDisabledLabel('view %fieldName% not granted'|trans({'%fieldName%': 'oro.sales.opportunity.name.label'|trans})) %} {% endif %} {% set breadcrumbs = { 'entity': form.vars.value, 'indexPath': path('oro_sales_opportunity_index'), 'indexLabel': 'oro.sales.opportunity.entity_plural_label'|trans, 'entityTitle': name } %} {{ parent() }} {% else %} {% set title = 'oro.ui.create_entity'|trans({'%entityName%': 'oro.sales.opportunity.entity_label'|trans}) %} {% include '@OroUI/page_title_block.html.twig' with { title: title } %} {% endif %} {% endblock pageHeader %} {% block stats %} {% if is_granted('VIEW', entity, 'createdAt') %}
  • {{ 'oro.ui.created_at'|trans }}: {{ entity.createdAt ? entity.createdAt|oro_format_datetime : 'N/A' }}
  • {% endif %} {% if is_granted('VIEW', entity, 'updatedAt') %}
  • {{ 'oro.ui.updated_at'|trans }}: {{ entity.updatedAt ? entity.updatedAt|oro_format_datetime : 'N/A' }}
  • {% endif %} {% endblock stats %} {% block breadcrumbs %} {% import '@OroUI/macros.html.twig' as UI %} {{ parent() }} {% if entity.status %} {{ UI.badge(entity.status.name, entity.status.id != 'lost' ? 'enabled' : 'disabled') }} {% endif %} {% endblock breadcrumbs %} {% block content_data %} {% set id = 'opportunity-profile' %} {% set formFields = [] %} {% if is_granted('EDIT', entity, 'owner') and form.owner is defined %} {% set formFields = formFields|merge([form_row(form.owner, {attr: {class: 'control-group-justified'}})]) %} {% endif %} {% if is_granted('EDIT', entity, 'name') %} {% set formFields = formFields|merge([form_row(form.name, {attr: {autofocus: true}})]) %} {% endif %} {% set formFieldsNames = [ 'customerAssociation', 'contact', 'status', 'probability', 'budgetAmount', 'closeDate', 'closeRevenue', 'closeReason' ] %} {% for formFieldName in formFieldsNames %} {% if is_granted('EDIT', entity, formFieldName) %} {% set formFields = formFields|merge([form_row(attribute(form, formFieldName))]) %} {% endif %} {% endfor %} {% set subBlockData = [] %} {% set subBlockFieldsNames = ['customerNeed', 'proposedSolution', 'notes'] %} {% for subBlockFieldName in subBlockFieldsNames %} {% if is_granted('EDIT', entity, subBlockFieldName) %} {% set subBlockData = subBlockData|merge([form_row(attribute(form, subBlockFieldName))]) %} {% endif %} {% endfor %} {% set dataBlocks = [{ 'title': 'General'|trans, 'subblocks': [ { 'title': 'Opportunity Information'|trans, 'data': formFields }, { 'data': subBlockData } ] }] %} {% set dataBlocks = dataBlocks|merge(oro_form_additional_data(form, 'Additional'|trans)) %} {% set data = { 'formErrors': form_errors(form) ? form_errors(form) : null, 'dataBlocks': dataBlocks, } %} {{ parent() }} {% endblock content_data %}