<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_manufacturer_detail %}
<sw-page class="sw-manufacturer-detail">

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_detail_header %}
    <template #smart-bar-header>
        <h2>{{ placeholder(manufacturer, 'name', $tc('sw-manufacturer.detail.textHeadline')) }}</h2>
    </template>

    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_detail_actions %}
    <template #smart-bar-actions>

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_manufacturer_detail_actions_abort %}
        <sw-button
            v-tooltip.bottom="tooltipCancel"
            :disabled="manufacturerIsLoading || undefined"
            @click="onCancel"
        >
            {{ $tc('global.default.cancel') }}
        </sw-button>
        {% endblock %}

        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
        {% block sw_manufacturer_detail_actions_save %}
        <sw-button-process
            v-model:processSuccess="isSaveSuccessful"
            v-tooltip.bottom="tooltipSave"
            class="sw-manufacturer-detail__save-action"
            :is-loading="isLoading"
            :disabled="isLoading || !acl.can('product_manufacturer.editor') || undefined"
            variant="primary"
            @click.prevent="onSave"
        >
            {{ $tc('sw-manufacturer.detail.buttonSave') }}
        </sw-button-process>
        {% endblock %}

    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_detail_language_switch %}
    <template #language-switch>
        <sw-language-switch
            :disabled="manufacturerId == null || undefined"
            :save-changes-function="saveOnLanguageChange"
            :abort-change-function="abortOnLanguageChange"
            @on-change="onChangeLanguage"
        />
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_detail_content %}
    <template #content>
        <sw-card-view>
            <template v-if="manufacturerIsLoading">
                <sw-skeleton variant="detail-bold" />
                <sw-skeleton />
            </template>

            <template v-else>

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_manufacturer_detail_content_language_info %}
                <sw-language-info
                    :entity-description="placeholder(manufacturer, 'name', $tc('sw-manufacturer.detail.textHeadline'))"
                />
                {% endblock %}

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_manufacturer_detail_base_basic_info_card %}
                <sw-card
                    position-identifier="sw-manufacturer-detail-basic-info"
                    :title="$tc('sw-manufacturer.detail.cardTitleManufacturerInfo')"
                >
                    <sw-container
                        class="sw-manufacturer-detail__container"
                        columns="repeat(auto-fit, minmax(250px, 1fr))"
                        gap="0 30px"
                    >
                        <div class="sw-manufacturer-detail__base-info-wrapper">

                            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                            {% block sw_manufacturer_detail_base_info_field_name %}
                            <sw-text-field
                                v-model:value="manufacturer.name"
                                :label="$tc('sw-manufacturer.detail.labelName')"
                                :placeholder="placeholder(manufacturer, 'name', $tc('sw-manufacturer.detail.placeholderName'))"
                                name="name"
                                validation="required"
                                required
                                :error="manufacturerNameError"
                                :disabled="!acl.can('product_manufacturer.editor') || undefined"
                            />
                            {% endblock %}

                            <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                            {% block sw_manufacturer_detail_base_info_field_link %}
                            <sw-text-field
                                v-model:value="manufacturer.link"
                                :label="$tc('sw-manufacturer.detail.labelLink')"
                                :placeholder="$tc('sw-manufacturer.detail.placeholderLink')"
                                name="link"
                                :disabled="!acl.can('product_manufacturer.editor') || undefined"
                            />
                            {% endblock %}
                        </div>

                        <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                        {% block sw_manufacturer_detail_logo_upload %}
                        <sw-upload-listener
                            :upload-tag="mediaUploadTag"
                            auto-upload
                            @media-upload-finish="setMediaItem"
                        />
                        <sw-media-upload-v2
                            class="sw-manufacturer-detail__logo-upload"
                            :source="manufacturer.mediaId"
                            :allow-multi-select="false"
                            variant="regular"
                            :upload-tag="mediaUploadTag"
                            :label="$tc('sw-manufacturer.detail.labelLogo')"
                            :default-folder="manufacturerRepository.entityName"
                            :disabled="!acl.can('product_manufacturer.editor') || undefined"
                            @sw-media-upload-v2-media-upload-success="setMediaItem"
                            @media-drop="onDropMedia"
                            @media-upload-sidebar-open="openMediaSidebar"
                            @media-upload-remove-image="onUnlinkLogo"
                        />
                        {% endblock %}
                    </sw-container>

                    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                    {% block sw_manufacturer_detail_base_info_field_description %}
                    <sw-text-editor
                        v-model:value="manufacturer.description"
                        :label="$tc('sw-manufacturer.detail.labelDescription')"
                        :placeholder="placeholder(manufacturer, 'description', $tc('sw-manufacturer.detail.placeholderDescription'))"
                        name="description"
                        sanitize-input
                        sanitize-field-name="product_manufacturer_translation.description"
                        :disabled="!acl.can('product_manufacturer.editor') || undefined"
                    />
                    {% endblock %}
                </sw-card>
                {% endblock %}

                <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
                {% block sw_manufacturer_detail_custom_field_sets %}
                <sw-card
                    v-if="customFieldSets.length > 0"
                    position-identifier="sw-manufacturer-detail-custom-field-sets"
                    :title="$tc('sw-settings-custom-field.general.mainMenuItemGeneral')"
                    :is-loading="manufacturerIsLoading"
                >
                    <sw-custom-field-set-renderer
                        v-if="manufacturer"
                        :entity="manufacturer"
                        :sets="customFieldSets"
                        :disabled="!acl.can('product_manufacturer.editor') || undefined"
                    />
                </sw-card>
                {% endblock %}
            </template>
        </sw-card-view>
    </template>
    {% endblock %}

    <!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
    {% block sw_manufacturer_detail_sidebar %}
    <template #sidebar>
        <sw-sidebar :propagate-width="true">
            <sw-sidebar-media-item
                ref="mediaSidebarItem"
                :disabled="!acl.can('product_manufacturer.editor') || undefined"
            >
                <template
                    #context-menu-items="media"
                >
                    <sw-context-menu-item @click="setMediaFromSidebar(media.mediaItem)">
                        {{ $tc('sw-manufacturer.detail.labelUseAsLogo') }}
                    </sw-context-menu-item>
                </template>
            </sw-sidebar-media-item>
        </sw-sidebar>
    </template>
    {% endblock %}

</sw-page>
{% endblock %}
