<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_settings_list %}
<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_settings_product_feature_set_index %}
<sw-page class="sw-settings-product-feature-sets-list">

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_settings_product_feature_set_list_search_bar %}
    <template #search-bar>
        <sw-search-bar
            initial-search-type="feature_set"
            :placeholder="$tc('sw-settings-product-feature-sets.general.placeholderSearchBar')"
            :initial-search="term"
            @search="onSearch"
        />
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_settings_product_feature_set_list_smart_bar_header %}
    <template #smart-bar-header>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_settings_product_feature_set_list_smart_bar_header_title %}
        <h2>
            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_settings_product_feature_set_list_smart_bar_header_title_text %}
            {{ $tc('sw-settings.index.title') }} <sw-icon
                name="regular-chevron-right-xs"
                small
            /> {{ $tc('sw-settings-product-feature-sets.list.textHeadline') }}
            {% endblock %}
        </h2>
        {% endblock %}
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_settings_product_feature_set_list_smart_bar_actions %}
    <template #smart-bar-actions>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_settings_product_feature_set_list_smart_bar_actions_add %}
        <sw-button
            :router-link="{ name: 'sw.settings.product.feature.sets.create' }"
            :disabled="!acl.can('product_feature_sets.creator') || undefined"
            class="sw-settings-product-feature-sets-list-grid__create-button"
            variant="primary"
        >
            {{ $tc('sw-settings-product-feature-sets.list.buttonAddEssentialCharacteristics') }}
        </sw-button>
        {% endblock %}
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_settings_product_feature_set_list_smart_bar_language_switch %}
    <template #language-switch>
        <sw-language-switch @on-change="onChangeLanguage" />
    </template>
    {% endblock %}

    <template #content>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_settings_product_feature_set_list_content %}
        <div class="sw-product-feature-sets-list__content">

            <sw-entity-listing
                v-if="isLoading || productFeatureSets"
                ref="swSettingsProductFeatureSetsGrid"
                class="sw-settings-product-feature-sets-list-grid"
                :items="productFeatureSets"
                :columns="getProductFeatureSetsColumns()"
                :repository="productFeatureSetsRepository"
                detail-route="sw.settings.product.feature.sets.detail"
                :disable-data-fetching="true"
                :sort-by="sortBy"
                :sort-direction="sortDirection"
                :allow-inline-edit="acl.can('product_feature_sets.editor')"
                :allow-edit="acl.can('product_feature_sets.editor')"
                :allow-view="acl.can('product_feature_sets.viewer')"
                :allow-delete="acl.can('product_feature_sets.deleter')"
                :is-loading="isLoading"
                @page-change="onPageChange"
                @column-sort="onSortColumn"
                @inline-edit-save="onInlineEditSave"
            >

                <template #column-features="{ item }">
                    <span v-if="item.features">
                        {{ renderFeaturePreview(item.features) }}
                    </span>
                </template>

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_product_feature_set_list_grid_columns_actions %}
                <template #actions="{ item }">

                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_settings_product_feature_set_list_grid_columns_actions_edit %}
                    <sw-context-menu-item
                        :router-link="{ name: 'sw.settings.product.feature.sets.detail', params: { id: item.id, edit: 'edit' }}"
                        :disabled="!acl.can('product_feature_sets.editor') || undefined"
                        class="sw-product-feature-sets-list__edit-action"
                    >
                        {{ $tc('sw-settings-product-feature-sets.list.contextMenuEdit') }}
                    </sw-context-menu-item>
                    {% endblock %}

                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_settings_product_feature_set_list_grid_columns_actions_delete %}
                    <sw-context-menu-item
                        :disabled="item.isSystemDefault || !acl.can('product_feature_sets.deleter') || undefined"
                        variant="danger"
                        class="sw-product-feature-sets-list__delete-action"
                        @click="onDelete(item.id)"
                    >
                        {{ $tc('sw-settings-product-feature-sets.list.contextMenuDelete') }}
                    </sw-context-menu-item>
                    {% endblock %}

                </template>
                {% endblock %}

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_settings_product_feature_set_list_grid_action_modals %}
                <template #action-modals="{ item }">

                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_settings_product_feature_set_list_delete_modal %}
                    <sw-modal
                        v-if="showDeleteModal"
                        :title="$tc('global.default.warning')"
                        variant="small"
                        @modal-close="onCloseDeleteModal"
                    >

                        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                        {% block sw_settings_product_feature_set_list_delete_modal_confirm_delete_text %}
                        <p class="sw-settings-product-feature-sets-list__confirm-delete-text">
                            {{ $tc('sw-settings-product-feature-sets.list.textDeleteConfirm', 0, { name: item.name }) }}
                        </p>
                        {% endblock %}

                        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                        {% block sw_settings_product_feature_set_list_delete_modal_footer %}
                        <template #modal-footer>

                            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                            {% block sw_settings_product_feature_set_list_delete_modal_cancel %}
                            <sw-button
                                size="small"
                                @click="onCloseDeleteModal"
                            >
                                {{ $tc('global.default.cancel') }}
                            </sw-button>
                            {% endblock %}

                            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                            {% block sw_settings_product_feature_set_list_delete_modal_confirm %}
                            <sw-button
                                variant="danger"
                                size="small"
                                @click="onConfirmDelete(item.id)"
                            >
                                {{ $tc('sw-settings-product-feature-sets.list.buttonDelete') }}
                            </sw-button>
                            {% endblock %}

                        </template>
                        {% endblock %}
                    </sw-modal>
                    {% endblock %}

                </template>
                {% endblock %}

            </sw-entity-listing>

        </div>
        {% endblock %}

    </template>

</sw-page>
    {% endblock %}
{% endblock %}
