<commit_before>{#
    Available variables:
    * entity       - Oro\Bundle\EmailBundle\Model\Email
    * form         - Oro\Bundle\EmailBundle\Form\type\EmailType
    * saved        - bool
#}
{% form_theme form with ['OroFormBundle:Form:fields.html.twig'] %}
{% import 'OroUIBundle::macros.html.twig' as UI %}

{% block page_container %}
<div class="widget-content email-form">
    {% if saved %}
        <script type="text/javascript">
            require(['underscore', 'oro/translator', 'oro/widget-manager', 'oro/messenger', 'oro/mediator'],
            function(_, __, widgetManager, messenger, mediator) {
                widgetManager.getWidgetInstance({{ app.request.get('_wid')|json_encode|raw }}, function(widget) {
                    messenger.notificationFlashMessage('success', __('The email was sent'));
                    widget.trigger('emailSent');
                    widget.remove();
                });
            });
        </script>
    {% else %}
        {% if not form.vars.valid and form.vars.errors|length %}
            <div class="alert alert-error">
                <div class="message">
                    {{ form_errors(form) }}
                </div>
            </div>
        {% endif %}
        <div class="form-container">
            <form id="{{ form.vars.name }}" action="{{ path('oro_email_email_create') }}" method="post">
                <fieldset class="form-horizontal">
                    {{ form_row(form.gridName) }}
                    {{ form_row(form.from) }}
                    {{ form_row(form.to) }}
                    {{ form_row(form.subject) }}
                    {{ form_row(form.body, {'attr': {'class': 'email-body'} }) }}
                    {{ form_rest(form) }}
                    <div class="widget-actions form-actions" style="display: none;">
                        <button class="btn" type="reset">{{ 'Cancel'|trans }}</button>
                        <button class="btn btn-primary" type="submit">{{ 'Send'|trans }}</button>
                    </div>
                </fieldset>
            </form>
            {{ oro_form_js_validation(form) }}
        </div>
    {% endif %}
</div>
{% endblock %}
<commit_msg>CRM-851: Add handling for tabs - use success event<commit_after>{#
    Available variables:
    * entity       - Oro\Bundle\EmailBundle\Model\Email
    * form         - Oro\Bundle\EmailBundle\Form\type\EmailType
    * saved        - bool
#}
{% form_theme form with ['OroFormBundle:Form:fields.html.twig'] %}
{% import 'OroUIBundle::macros.html.twig' as UI %}

{% block page_container %}
<div class="widget-content email-form">
    {% if saved %}
        <script type="text/javascript">
            require(['underscore', 'oro/translator', 'oro/widget-manager', 'oro/messenger', 'oro/mediator'],
            function(_, __, widgetManager, messenger, mediator) {
                widgetManager.getWidgetInstance({{ app.request.get('_wid')|json_encode|raw }}, function(widget) {
                    messenger.notificationFlashMessage('success', __('The email was sent'));
                    mediator.trigger('widget_success:' + widget.getAlias());
                    widget.remove(true);
                });
            });
        </script>
    {% else %}
        {% if not form.vars.valid and form.vars.errors|length %}
            <div class="alert alert-error">
                <div class="message">
                    {{ form_errors(form) }}
                </div>
            </div>
        {% endif %}
        <div class="form-container">
            <form id="{{ form.vars.name }}" action="{{ path('oro_email_email_create') }}" method="post">
                <fieldset class="form-horizontal">
                    {{ form_row(form.gridName) }}
                    {{ form_row(form.from) }}
                    {{ form_row(form.to) }}
                    {{ form_row(form.subject) }}
                    {{ form_row(form.body, {'attr': {'class': 'email-body'} }) }}
                    {{ form_rest(form) }}
                    <div class="widget-actions form-actions" style="display: none;">
                        <button class="btn" type="reset">{{ 'Cancel'|trans }}</button>
                        <button class="btn btn-primary" type="submit">{{ 'Send'|trans }}</button>
                    </div>
                </fieldset>
            </form>
            {{ oro_form_js_validation(form) }}
        </div>
    {% endif %}
</div>
{% endblock %}

{'fraction_non_alphanumeric': 0.16093504158237806, 'fraction_numerical': 0.0006743088334457181, 'mean_word_length': 1.7917189460476788, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3438110', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1190, 'n_words': 216}