{% extends '@CpCreationVitiCore/admin/base.html.twig' %}
{% import '@A2lixTranslationForm/macros_bootstrap_3.html.twig' as a2lixTranslations %}

{% block content %}
    <h1 class="page-header">{{ 'marketing.review_request.admin.title'|trans }}</h1>

    <div class="alert alert-info">
        {{ 'marketing.review_request.admin.activation_notice'|trans }}
    </div>

    {{ form_start(form, {attr: {novalidate: 'novalidate'}}) }}
        <div class="panel panel-default">
            <div class="panel-heading">
                <a class="btn btn-danger btn-rounded" href="{{ path('admin_marketing') }}">
                    {{ 'marketing.common.back'|trans }}
                </a>
                <button type="submit" class="btn btn-primary btn-rounded">
                    {{ 'marketing.common.save'|trans }}
                </button>
                {% include '@CpCreationVitiCore/admin/marketing/_test_email_modal.html.twig' with {
                    modal_id: 'reviewRequestTestEmailModal',
                    action: path('admin_marketing_review_request_test_email'),
                    recipient: test_email_recipient,
                    csrf_token_id: 'marketing-review-request-test-email',
                    show_modal: false,
                } only %}
            </div>
        </div>

        <div class="panel panel-info">
            <div class="panel-heading">{{ 'marketing.review_request.configuration.title'|trans }}</div>
            <div class="panel-body">
                {{ form_row(form.enabled) }}
                {{ form_row(form.sendDelayDays) }}
                {{ form_row(form.tokenLifetimeDays) }}
                {{ form_row(form.secondReminderEnabled) }}
                {{ form_row(form.secondReminderDelayDays) }}
                {{ form_row(form.moderationRequired) }}
                {{ form_row(form.googleBusinessReviewUrl) }}
                {{ form_row(form.fulfilledAfter) }}
                {% include '@CpCreationVitiCore/admin/marketing/_email_title_modal.html.twig' with {
                    modal_id: 'reviewRequestEmailTitleModal',
                    title_key: 'marketing.review_request.configuration.email_content_title',
                    help_key: 'marketing.review_request.configuration.email_content_help',
                    translations_form: form.translations,
                    fields: ['emailTitle'],
                } only %}
                {% if is_granted('ROLE_SUPER_ADMIN') %}
                    <hr>
                    <div class="alert alert-warning">
                        {{ 'marketing.review_request.configuration.policy_mandatory_notice'|trans }}
                    </div>
                    {{ a2lixTranslations.partialTranslations(form.translations, ['policyAdditionalContent']) }}
                {% endif %}
            </div>
        </div>
    {{ form_end(form) }}

    {% include '@CpCreationVitiCore/admin/marketing/_test_email_modal.html.twig' with {
        modal_id: 'reviewRequestTestEmailModal',
        action: path('admin_marketing_review_request_test_email'),
        recipient: test_email_recipient,
        csrf_token_id: 'marketing-review-request-test-email',
        show_button: false,
    } only %}
{% endblock %}
