{% extends ajax-suffix ? "@gantry-admin/partials/ajax.html.twig" : "@gantry-admin/partials/base.html.twig" %}

{% block gantry %}
<form method="post"
      action="{{ gantry.route(action) }}"
      data-g-inheritance-settings="{{ {'id': item.id, 'type': item.type, 'subtype': item.subtype}|json_encode|e('html_attr') }}"
>
    <div class="g-tabs" role="tablist">
        <ul>
            {# Settings Tab #}
            <li class="active">
                <a href="#" id="g-settings-particle-tab" role="presentation" aria-controls="g-settings-particle" role="tab" aria-expanded="true">
                    {% if inheritable %}<i class="fa fa-fw fa-{{ (item.inherit and ('attributes' in item.inherit.include)) ? 'lock' : 'unlock' }}"></i>{% endif %}
                    {% block title %}
                    {{ 'GANTRY5_PLATFORM_PARTICLE'|trans }}
                    {% endblock %}
                </a>
            </li>
            {# Block Tab #}
            {% if extra %}
            <li>
                <a href="#" id="g-settings-block-tab" role="presentation" aria-controls="g-settings-block" role="tab" aria-expanded="false">
                    {% if inheritable %}<i class="fa fa-fw fa-{{ (item.inherit and ('block' in item.inherit.include)) ? 'lock' : 'unlock' }}"></i>{% endif %}
                    {{ 'GANTRY5_PLATFORM_BLOCK'|trans }}
                </a>
            </li>
            {% endif %}
            {# Inheritance Tab #}
            {% if inheritance %}
            <li>
                <a href="#" id="g-settings-inheritance-tab" role="presentation" aria-controls="g-settings-inheritance" aria-expanded="false">
                    {{ 'GANTRY5_PLATFORM_INHERITANCE'|trans }}
                </a>
            </li>
            {% endif %}
        </ul>
    </div>

    <div class="g-panes">
        {# Settings Pane #}
        <div class="g-pane active" role="tabpanel" id="g-settings-particle" aria-labelledby="g-settings-particle-tab" aria-expanded="true">
            {% include '@gantry-admin/pages/configurations/layouts/particle-card.html.twig' with {
                title: item.title,
                blueprints: particle.form,
                overrideable: overrideable and (particle.form.overrideable is not defined or particle.form.overrideable),
                inherit: 'attributes' in item.inherit.include and item.inherit.outline in inheritance.form.fields.outline.filter ? item.inherit.outline : null
            } %}
        </div>

        {# Block Pane #}
        {% if extra %}
        <div class="g-pane" role="tabpanel" id="g-settings-block" aria-labelledby="g-settings-block-tab" aria-expanded="false">
            {% include '@gantry-admin/pages/configurations/layouts/particle-card.html.twig' with {
                gantry: gantry,
                title: 'GANTRY5_PLATFORM_BLOCK'|trans,
                blueprints: extra.form,
                data: {block: item.block},
                prefix: 'block.',
                inherit: 'block' in item.inherit.include and item.inherit.outline in inheritance.form.fields.outline.filter ? item.inherit.outline : null
            } only %}
        </div>
        {% endif %}

        {# Inheritance Pane #}
        {% if inheritance %}
        <div class="g-pane" role="tabpanel" id="g-settings-inheritance" aria-labelledby="g-settings-inheritance-tab" aria-expanded="false">
            <div class="card settings-block">
                <h4>
                    {{ 'GANTRY5_PLATFORM_INHERITANCE'|trans }}
                </h4>
                <div class="inner-params">
                    <input type="hidden" name="{{ 'inherit.section'|fieldName }}" value="{{ item.id }}" />
                    {% include 'forms/fields.html.twig' with {
                        gantry: gantry,
                        blueprints: inheritance.form,
                        data: {inherit: item.inherit},
                        prefix: 'inherit.'
                    } only %}
                </div>
            </div>
        </div>
        {% endif %}
    </div>

    <div class="g-modal-actions">
        <button class="button button-primary" type="submit">{{ 'GANTRY5_PLATFORM_APPLY'|trans }}</button>
        <button class="button button-primary" data-apply-and-save>{{ 'GANTRY5_PLATFORM_APPLY_SAVE'|trans }}</button>
        <button class="button g5-dialog-close">{{ 'GANTRY5_PLATFORM_CANCEL'|trans }}</button>
    </div>
</form>
{% endblock %}
