<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_manufacturer_list %}
<sw-page class="sw-manufacturer-list">
    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_list_search_bar %}
    <template #search-bar>
        <sw-search-bar
            initial-search-type="product_manufacturer"
            :initial-search="term"
            @search="onSearch"
        />
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_list_smart_bar_header %}
    <template #smart-bar-header>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_manufacturer_list_smart_bar_header_title %}
        <h2>
            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_manufacturer_list_smart_bar_header_title_text %}
            {{ $tc('sw-manufacturer.list.textManufacturerOverview') }}
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_manufacturer_list_smart_bar_header_amount %}
            <span
                v-if="!isLoading"
                class="sw-page__smart-bar-amount"
            >
                ({{ total }})
            </span>
            {% endblock %}
        </h2>
        {% endblock %}
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_list_actions %}
    <template #smart-bar-actions>
        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_manufacturer_list_smart_bar_actions %}
        <sw-button
            v-tooltip.bottom="{
                message: $tc('sw-privileges.tooltip.warning'),
                disabled: acl.can('product_manufacturer.creator'),
                showOnDisabledElements: true
            }"
            :router-link="{ name: 'sw.manufacturer.create' }"
            :disabled="!acl.can('product_manufacturer.creator') || undefined"
            class="sw-manufacturer-list__add-manufacturer"
            variant="primary"
        >
            {{ $tc('sw-manufacturer.list.buttonAddManufacturer') }}
        </sw-button>
        {% endblock %}
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_list_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_manufacturer_list_content %}
        <div class="sw-manufacturer-list__content">
            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_manufacturer_list_grid %}
            <sw-entity-listing
                v-if="entitySearchable"
                class="sw-manufacturer-list__grid"
                detail-route="sw.manufacturer.detail"
                :is-loading="isLoading"
                :columns="manufacturerColumns"
                :repository="manufacturerRepository"
                :items="manufacturers"
                :criteria-limit="limit"
                :sort-by="currentSortBy"
                :sort-direction="sortDirection"
                :disable-data-fetching="true"
                :allow-edit="acl.can('product_manufacturer.editor') || undefined"
                :allow-inline-edit="acl.can('product_manufacturer.editor') || undefined"
                :allow-delete="acl.can('product_manufacturer.deleter') || undefined"
                :show-selections="acl.can('product_manufacturer.deleter') || undefined"
                identifier="sw-manufacturer-list"
                @update-records="updateTotal"
                @page-change="onPageChange"
                @column-sort="onSortColumn"
            >
                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_manufacturer_list_grid_columns_name_preview %}
                <template #preview-name="{ item }">
                    <sw-media-preview-v2 :source="item.mediaId" />
                </template>
                {% endblock %}
            </sw-entity-listing>
            {% endblock %}

            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
            {% block sw_manufacturer_list_empty_state %}
            <sw-empty-state
                v-if="!isLoading && !total && isValidTerm(term)"
                :title="$tc('sw-empty-state.messageNoResultTitle')"
            >
                <template #default>
                    {{ $tc('sw-empty-state.messageNoResultSublineBefore') }}
                    <router-link
                        class="sw-empty-state__description-link"
                        :to="{ name: 'sw.profile.index.searchPreferences' }"
                    >
                        {{ $tc('sw-empty-state.messageNoResultSublineLink') }}
                    </router-link>
                    {{ $tc('sw-empty-state.messageNoResultSublineAfter') }}
                </template>
            </sw-empty-state>
            {% endblock %}

        </div>
        {% endblock %}

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