<!-- eslint-disable vuejs-accessibility/click-events-have-key-events -->
<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_search_preferences_modal %}
<sw-modal
    class="sw-search-preferences-modal"
    :title="$tc('global.sw-search-preferences-modal.title')"
    :is-loading="isLoading"
    @modal-close="onClose"
>
    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_search_preferences_modal_description %}
    <p
        class="sw-search-preferences-modal__description"
        v-html="$tc('global.sw-search-preferences-modal.description')"
    >
    </p>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_search_preferences_modal_grid %}
    <sw-data-grid
        :show-selection="false"
        :show-actions="false"
        :plain-appearance="true"
        :data-source="searchPreferences"
        :columns="searchPreferencesColumns"
    >
        <template #column-active="{ item }">
            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_search_preferences_modal_grid_column_active %}
            <sw-checkbox-field
                v-model:value="item._searchable"
                @update:value="onChangeSearchPreference(item)"
            />
            {% endblock %}
        </template>

        <template #column-moduleName="{ item }">
            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_search_preferences_modal_grid_column_module_name %}
            <span>{{ getModuleName(item.entityName) }}</span>
            {% endblock %}
        </template>
    </sw-data-grid>
    {% endblock %}

    <template #modal-footer>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_search_preferences_modal_button_cancel %}
        <sw-button
            size="small"
            class="sw-search-preferences-modal__button-cancel"
            @click="onCancel"
        >
            {{ $tc('global.default.cancel') }}
        </sw-button>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_search_preferences_modal_button_save %}
        <sw-button
            variant="primary"
            size="small"
            class="sw-search-preferences-modal__button-save"
            :disabled="isLoading"
            @click="onSave"
        >
            {{ $tc('global.default.save') }}
        </sw-button>
        {% endblock %}
    </template>
</sw-modal>
{% endblock %}
