{% extends "../../_collapsible_box.html" %}
{% load i18n %}
{% load static %}
{% load content_filters %}
{% load widget_tweaks %}
{% block collapsible_box_icon %}
    feather
{% endblock collapsible_box_icon %}
{% block collapsible_box_title %}
    {% minor_edit_label request.region language %}
{% endblock collapsible_box_title %}
{% block collapsible_box_content %}
    <div>
        {% render_field page_translation_form.minor_edit class+="mutually-exclusive-checkbox" data-unsaved-warning-exclude="" %}
        <label for="{{ page_translation_form.minor_edit.id_for_label }}"
               class="secondary">
            {{ page_translation_form.minor_edit.label }}
        </label>
        <div class="help-text">
            {% minor_edit_help_text request.region language page_translation_form %}
        </div>
    </div>
    {% if page_translation_form.mt_form_is_enabled %}
        <div id="machine-translation-form" data-minimum-hix="{{ minimum_hix }}">
            {% render_field page_translation_form.automatic_translation class+="mutually-exclusive-checkbox" %}
            <label for="{{ page_translation_form.automatic_translation.id_for_label }}"
                   class="secondary">
                {{ page_translation_form.automatic_translation.label }}
            </label>
            <div id="hix-score-warning"
                 class="hidden px-4 py-3 mb-2 text-orange-700 bg-yellow-100 border-l-4 border-yellow-500">
                <p>
                    {% blocktranslate trimmed %}
                        Increase the HIX score to at least {{ minimum_hix }} to enable automatic translations.
                    {% endblocktranslate %}
                </p>
            </div>
            <div class="help-text">
                {{ page_translation_form.automatic_translation.help_text }}
            </div>
            <div id="language-options" class="hidden pl-2">
                {% if page_translation_form.mt_translations_to_update.field.queryset.exists %}
                    <label for="{{ page_translation_form.mt_translations_to_update.id_for_label }}"
                           class="secondary">
                        {{ page_translation_form.mt_translations_to_update.label }}
                    </label>
                    {% render_field page_translation_form.mt_translations_to_update %}
                {% endif %}
                {% if page_translation_form.mt_translations_to_create.field.queryset.exists %}
                    <label for="{{ page_translation_form.mt_translations_to_create.id_for_label }}"
                           class="secondary">
                        {{ page_translation_form.mt_translations_to_create.label }}
                    </label>
                    {% render_field page_translation_form.mt_translations_to_create %}
                    <div class="mt-4 font-bold">
                        <input id="select-all-languages" type="checkbox" />
                        <label for="select-all-languages">
                            {% translate "Select all languages" %}
                        </label>
                    </div>
                {% endif %}
            </div>
        </div>
    {% endif %}
{% endblock collapsible_box_content %}
